/** * Minimal DurableObjectNamespace surface we need — `idFromName` + * `get` returning a `Stub` with `fetch(req)`. Kept structural so we * don't depend on `@cloudflare/workers-types` (the user's project has * them; we shouldn't duplicate). */ export interface MinimalDurableObjectNamespace { idFromName(name: string): MinimalDurableObjectId; get(id: MinimalDurableObjectId): MinimalDurableObjectStub; } export interface MinimalDurableObjectId { readonly name?: string; } export interface MinimalDurableObjectStub { fetch(req: Request): Promise; } /** * Route an incoming Worker `fetch` request to the Durable Object * that owns its `tid`. * * The token travels in three places depending on the route: * - LAP HTTP calls: `Authorization: Bearer ` header * - Mint / resume HTTP calls: no token (identity resolver runs * inside the DO via the LAP router; we route by origin or a * special `/agent/mint` path — see below) * - WebSocket upgrade: `?token=` in the URL * * Requests that don't carry a tid (mint, resume-list, sessions) are * routed to a "root" DO named `__root`, which handles identity / * token store operations centrally. LAP and WS calls route to the * per-tid DO so the pairing state stays local. * * This is the recommended entry for Cloudflare Workers deployments; * users who need custom routing can write their own and call the * underlying primitives directly. * * As of 0.0.35 the token format is opaque (random, not signed), so we * can't recover `tid` from the token alone. The caller passes a * `resolveTid` callback — typically `(token) => stub.fetch(...)` to * the root DO's token-resolution endpoint — that turns a bearer into * its tid via the shared token store. Callers that don't shard by * tid can pass `() => Promise.resolve(rootName)` to route everything * through the root DO. */ export declare function routeToAgentDO(req: Request, namespace: MinimalDurableObjectNamespace, resolveTid: (token: string) => Promise, opts?: { rootName?: string; mcpPath?: string; }): Promise; //# sourceMappingURL=worker.d.ts.map