| author | |
| committer | |
| log | 8bd7745f0af918582807326d90e58d59324bb2a6 |
| tree | e3e99a7f12e512a02148e8b91ec050960161cb38 |
| parent | 31d0c8a4f47ead36c9a63ac4d3bf27b55c05095a |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>2 files changed, 10 insertions(+), 13 deletions(-)
infra/relay/src/hooks/HookInboxObject.ts+7-9| ... | ... | @@ -23,14 +23,6 @@ const RUN_FAILURE_RETRY_MS = 60_000; |
| 23 | 23 | |
| 24 | 24 | type Call<A> = Effect.Effect<A, never, Alchemy.RuntimeContext>; |
| 25 | 25 | |
| 26 | export interface HookInboxObjectShape { | |
| 27 | /** Holds a request for `baseUrl`; false when the inbox is full and nothing was stored. */ | |
| 28 | readonly hold: (hook: HookInboxStore.HeldHook, baseUrl: string) => Call<boolean>; | |
| 29 | /** The environment is back at `baseUrl`: deliver what is waiting now. */ | |
| 30 | readonly wake: (baseUrl: string) => Call<boolean>; | |
| 31 | readonly clear: () => Call<void>; | |
| 32 | } | |
| 33 | ||
| 34 | 26 | /** |
| 35 | 27 | * One per managed endpoint, addressed by endpoint key. Holds webhook requests |
| 36 | 28 | * the environment could not take, in SQLite, and pushes them back through |
| ... | ... | @@ -38,7 +30,13 @@ export interface HookInboxObjectShape { |
| 38 | 30 | */ |
| 39 | 31 | export class HookInboxObject extends Cloudflare.DurableObject< |
| 40 | 32 | HookInboxObject, |
| 41 | HookInboxObjectShape | |
| 33 | { | |
| 34 | /** Holds a request for `baseUrl`; false when the inbox is full and nothing was stored. */ | |
| 35 | readonly hold: (hook: HookInboxStore.HeldHook, baseUrl: string) => Call<boolean>; | |
| 36 | /** The environment is back at `baseUrl`: deliver what is waiting now. */ | |
| 37 | readonly wake: (baseUrl: string) => Call<boolean>; | |
| 38 | readonly clear: () => Call<void>; | |
| 39 | } | |
| 42 | 40 | >()("HookInboxObject") {} |
| 43 | 41 | |
| 44 | 42 | /** |
infra/relay/src/worker.ts+3-4| ... | ... | @@ -67,8 +67,7 @@ import * as MobileRegistrations from "./agentActivity/MobileRegistrations.ts"; |
| 67 | 67 | import * as HookForwarder from "./hooks/HookForwarder.ts"; |
| 68 | 68 | import * as HeldHooks from "./hooks/HeldHooks.ts"; |
| 69 | 69 | import * as HookInbox from "./hooks/HookInbox.ts"; |
| 70 | import { HookInboxObject } from "./hooks/HookInboxObject.ts"; | |
| 71 | import * as HookInboxObjectLayer from "./hooks/HookInboxObject.ts"; | |
| 70 | import * as HookInboxObject from "./hooks/HookInboxObject.ts"; | |
| 72 | 71 | |
| 73 | 72 | const layerWebcrypto = Layer.succeed( |
| 74 | 73 | Crypto.Crypto, |
| ... | ... | @@ -201,7 +200,7 @@ export const layer = Api.make( |
| 201 | 200 | period: HookForwarder.RELAY_HOOK_ENDPOINT_RATE_LIMIT.periodSeconds, |
| 202 | 201 | }, |
| 203 | 202 | }); |
| 204 | const hookInboxes = yield* HookInboxObject; | |
| 203 | const hookInboxes = yield* HookInboxObject.HookInboxObject; | |
| 205 | 204 | |
| 206 | 205 | // |
| 207 | 206 | // 3. Runtime layers and app construction |
| ... | ... | @@ -470,7 +469,7 @@ export const layer = Api.make( |
| 470 | 469 | Layer.provideMerge(Cloudflare.Tunnel.ReadWriteTunnelBinding), |
| 471 | 470 | Layer.provideMerge(Cloudflare.DNS.ReadWriteDnsHttp), |
| 472 | 471 | Layer.provideMerge(Cloudflare.Workers.RateLimitBinding), |
| 473 | Layer.provideMerge(HookInboxObjectLayer.layer), | |
| 472 | Layer.provideMerge(HookInboxObject.layer), | |
| 474 | 473 | // The worker runtime opens its own HTTP span around ours. For webhook |
| 475 | 474 | // paths it would record the raw URL, token included, and adopt the |
| 476 | 475 | // sender's traceparent, so only our redacted span covers those. |