@finalai/agent-provider 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +15 -8
  2. package/dist/modules/channel.d.mts +51 -12
  3. package/dist/modules/channel.mjs +1 -0
  4. package/dist/modules/channel.mjs.map +2 -2
  5. package/dist/modules/credential-routes.d.mts +1 -3
  6. package/dist/modules/credential-routes.mjs +0 -2
  7. package/dist/modules/credential-routes.mjs.map +2 -2
  8. package/dist/modules/document.d.mts +0 -18
  9. package/dist/modules/document.mjs +1 -16
  10. package/dist/modules/document.mjs.map +3 -3
  11. package/dist/modules/index.d.mts +0 -1
  12. package/dist/modules/index.mjs +0 -1
  13. package/dist/modules/index.mjs.map +2 -2
  14. package/dist/modules/local-channel-context.d.mts +1 -1
  15. package/dist/modules/local-channel-context.mjs +1 -1
  16. package/dist/modules/local-channel-context.mjs.map +2 -2
  17. package/dist/modules/sandbox/remote/body.d.mts +1 -0
  18. package/dist/modules/sandbox/remote/body.mjs +27 -0
  19. package/dist/modules/sandbox/remote/body.mjs.map +7 -0
  20. package/dist/modules/sandbox/remote/serve.mjs +3 -2
  21. package/dist/modules/sandbox/remote/serve.mjs.map +2 -2
  22. package/dist/modules/sandbox/setup/apply.d.mts +1 -2
  23. package/dist/modules/sandbox/setup/apply.mjs +6 -20
  24. package/dist/modules/sandbox/setup/apply.mjs.map +2 -2
  25. package/dist/modules/sandbox/setup/describe.mjs +1 -1
  26. package/dist/modules/sandbox/setup/describe.mjs.map +1 -1
  27. package/dist/modules/sandbox/setup/schema.d.mts +2 -1
  28. package/dist/modules/sandbox/types.d.mts +0 -12
  29. package/dist/modules/sandbox/types.mjs +1 -7
  30. package/dist/modules/sandbox/types.mjs.map +2 -2
  31. package/package.json +3 -8
  32. package/dist/modules/room-surface.d.mts +0 -350
  33. package/dist/modules/room-surface.mjs +0 -156
  34. package/dist/modules/room-surface.mjs.map +0 -7
package/README.md CHANGED
@@ -162,15 +162,20 @@ Acquiring a hosted MCP endpoint or channel is foreground work: it may start a se
162
162
  ## Channels
163
163
 
164
164
  `ChannelDefinitionIface<Config, Inbound, State>` describes a provider namespace,
165
- its application credentials, identity proof, place kinds, routes/listeners,
166
- receive function, and typed semantic event handlers. Channels resolve people and
165
+ the provider application credentials it requires, identity proof, place kinds,
166
+ routes/listeners, receive function, and typed semantic event handlers. Channels resolve people and
167
167
  places through `ChannelReceiveContextIface`; they do not supply Final user,
168
168
  conversation or agent IDs. A host validates every opaque person/conversation
169
169
  handle against its binding and invocation.
170
170
 
171
171
  `post` records a linked person's message. `input` without `principal` is a
172
172
  nonhuman event; `input` with a principal represents an unlinked person and requires
173
- an explicitly configured `anyone` audience. A shared place cannot target Home.
173
+ an explicitly configured `anyone` audience. `input`'s `actingAs` names the linked
174
+ person the agent's turn acts for; an input acting for nobody waits for the running
175
+ turn. `replyExpected: false` lets the agent stay silent when it has nothing to say.
176
+ An unlinked person resolves with the install's `linkUrl` and an unconnected place
177
+ with its `connectUrl` only when the installer provided those pages; otherwise the
178
+ channel explains linking in its own words. A shared place cannot target Home.
174
179
  `attach` records content without dispatching a turn. It supports recordings and
175
180
  other channel-produced attachments. Explicit `anyone`/`group` defaults let `places.resolve`
176
181
  create a Shared chat for a new anonymous call. Input idempotency keys are scoped to
@@ -185,10 +190,13 @@ Semantic events cover messages, tools, plans, decisions and turn completion, plu
185
190
  origin-bearing edits/removals/reactions. Completion events include the reply and
186
191
  are delivered at least once; channels persist provider reply IDs in `store` for
187
192
  deduplication. `replies: all` enables `message.posted` mirroring. Raw ACP updates
188
- belong to harnesses and the separately typed Final room surface.
193
+ belong to harnesses.
189
194
 
190
- `observe` streams one turn's events, from its start, and accepts a cancellation signal. Use `events` to hear a conversation over time. HTTP and binary WebSocket routes receive the same capabilities; listeners additionally receive an abort signal. Events a host receives for an installed app arrive unchanged at the channel's `POST /webhook` route, signature headers included, so a channel verifies them like any other request. Speech providers and audio processing belong to application code, using its declared credentials and ordinary HTTP/socket requests.
191
- Installed app credentials stay with the host in every execution mode. `credentials.client()` exposes only the public client ID; `verify()` checks signed payloads without returning the signing key. `exchange()` returns an opaque, short-lived OAuth credential handle. Select that handle or the installed app with `credentials.fetch`'s `credential` option; requests default to no credential. `credentials.connect()` supports host-injected credentials in outgoing JSON socket frames. Hosts enforce the same destination and grant checks for all these operations. Only explicitly declared project secrets can be read through `secret(name)`. Sockets accept bounded caller-owned headers for provider handshakes. Installed app credentials remain opaque and can be injected into JSON frames. Exchange handles are invocation-scoped and expire; they do not provide durable person-token storage or automatic refresh. An application's authorization callback must use provider APIs that can establish the current person's access.
195
+ `observe` streams one turn's events, from its start, and accepts a cancellation signal. Use `events` to hear a conversation over time. HTTP and binary WebSocket routes receive the same capabilities; listeners additionally receive an abort signal. Speech providers and audio processing belong to application code, using its declared credentials and ordinary HTTP/socket requests.
196
+
197
+ A channel declares the provider application it needs in `require.app`: an OAuth client and named secret slots (a signing secret, an app-level token). A channel app satisfies it, either the installer's own or one the channel's publisher attached to the publication; an install whose app cannot meet the declaration is refused. App credentials stay with the host in every execution mode. `credentials.client()` exposes only the public client ID; `verify({ secret })` checks a signed payload with a slot's key without returning it. `exchange()` returns an opaque, short-lived OAuth credential handle. Select that handle, a provider tenant's installed token (`{ kind: 'app', tenant }`) or a secret slot (`{ kind: 'secret', slot }`) with `credentials.fetch`'s `credential` option; requests default to no credential. `credentials.connect()` supports host-injected credentials in outgoing JSON socket frames. Hosts enforce the same destination and grant checks for all these operations. `secret(slot)` reads only slots the channel declares. Sockets accept bounded caller-owned headers for provider handshakes. Exchange handles are invocation-scoped and expire; they do not provide durable person-token storage or automatic refresh. An application's authorization callback must use provider APIs that can establish the current person's access.
198
+
199
+ A provider tenant (a workspace, a server) installs the app through the channel's own code. `tenants.installPath` names a GET route that receives a single-use `ticket`; it calls `credentials.redirect({ path, ticket })`, and the redirect route calls `credentials.exchange({ ..., store: { tenant } })`, which stores the token as that tenant's install. A tenant belongs to one install of an app at a time: a later install takes it over. Routes marked `shared: true` are also served at the app's shared ingress URL, one URL per app registered with the provider once. The publication the app routes its ingress through declares `ingress.tenantOf`, which verifies each request with app-only credentials and returns the tenant, a direct `respond` for app-level handshakes, or null to reject it; the host then runs the shared route of the binding that holds that tenant.
192
200
 
193
201
  `binding.url` is the host's canonical binding base URL for routes. Provider settings must not hold it when an application serves more than one binding. For OAuth, declare the callback route with `redirect: true` and call `credentials.redirect({ path })`: the returned `url` is the same for every binding, so an application registers it once, and `state` returns the person to this binding. Send both unchanged, and use the same `url` in the token exchange. A `redirect` route must be a GET and is reachable only through that URL. A channel is published as one self-contained module; naming an installed implementation does not grant additional authority. `resources.resolve` maps an application URL to a canonical provider place; the required companion `resources.authorize` checks the linked person's current provider access. Hosts repeat that authorization for later observation access. `places.follow` and `unfollow` manage observation under a linked person's authority, while `places.observers` enumerates authorized deliveries.
194
202
 
@@ -199,8 +207,7 @@ the tenant applies this lifecycle change to the binding's namespace. A socket ha
199
207
  cleanup grace after disconnect; every other operation is revoked immediately, and all
200
208
  capabilities end when the handler returns. Attachment authorization still applies.
201
209
 
202
- A channel's handlers always run on Final's serverless runtime. The customization of
203
- the Final chat itself is typed separately in `@finalai/agent-provider/room-surface`.
210
+ A channel's handlers always run on Final's serverless runtime.
204
211
 
205
212
  ## Durable processes
206
213
 
@@ -34,10 +34,10 @@ export type PersonResolution = {
34
34
  displayName: string;
35
35
  } | {
36
36
  kind: 'unlinked';
37
- linkUrl: string;
37
+ linkUrl?: string;
38
38
  } | {
39
39
  kind: 'blocked';
40
- reason: 'not-in-organization' | 'suspended';
40
+ reason: 'not-a-member' | 'suspended';
41
41
  };
42
42
  export declare enum ChannelReplies {
43
43
  Origin = "origin",
@@ -68,7 +68,7 @@ export type PlaceResolution = {
68
68
  policy: PlacePolicy;
69
69
  } | {
70
70
  kind: 'unconnected';
71
- connectUrl: string;
71
+ connectUrl?: string;
72
72
  defaults: PlaceDefaultsIface | null;
73
73
  };
74
74
  export interface Refusal {
@@ -108,6 +108,7 @@ export declare const channelReceiveResultSchema: z.ZodUnion<readonly [z.ZodObjec
108
108
  }, z.core.$strip>]>;
109
109
  export declare enum ChannelCredentialKind {
110
110
  App = "app",
111
+ Secret = "secret",
111
112
  OAuth = "oauth",
112
113
  None = "none"
113
114
  }
@@ -115,7 +116,11 @@ export declare const channelCredentialHandleSchema: z.core.$ZodBranded<z.ZodStri
115
116
  export type ChannelCredentialHandle = z.infer<typeof channelCredentialHandleSchema>;
116
117
  export type ChannelCredentialRef = {
117
118
  kind: ChannelCredentialKind.App;
118
- tenant?: string;
119
+ tenant: string;
120
+ } | {
121
+ kind: ChannelCredentialKind.Secret;
122
+ slot: string;
123
+ scheme?: string;
119
124
  } | {
120
125
  kind: ChannelCredentialKind.OAuth;
121
126
  handle: ChannelCredentialHandle;
@@ -140,6 +145,7 @@ export interface ChannelCredentialRequestInitIface extends RequestInit {
140
145
  credential?: ChannelCredentialRef;
141
146
  }
142
147
  export interface ChannelVerifyOptionsIface {
148
+ secret: string;
143
149
  algorithm: ChannelSigningAlgorithm;
144
150
  encoding: ChannelSignatureEncoding;
145
151
  data: string;
@@ -151,9 +157,13 @@ export interface ChannelOAuthExchangeOptionsIface {
151
157
  authentication: ChannelOAuthClientAuthentication;
152
158
  clientId?: string;
153
159
  signal?: AbortSignal;
160
+ store?: {
161
+ tenant: string;
162
+ };
154
163
  }
155
164
  export interface ChannelRedirectOptionsIface {
156
165
  path: string;
166
+ ticket?: string;
157
167
  }
158
168
  export interface ChannelRedirectIface {
159
169
  url: string;
@@ -184,7 +194,7 @@ export interface ChannelCredentialsIface {
184
194
  redirect(args: ChannelRedirectOptionsIface): Promise<ChannelRedirectIface>;
185
195
  fetch(input: RequestInfo | URL, init?: ChannelCredentialRequestInitIface): Promise<Response>;
186
196
  connect(args: ChannelCredentialConnectOptionsIface): Promise<ChannelCredentialSocketIface>;
187
- secret(name: string): Promise<string | null>;
197
+ secret(slot: string): Promise<string | null>;
188
198
  }
189
199
  export interface ChannelPostArgsIface {
190
200
  from: PersonHandle;
@@ -202,6 +212,8 @@ export interface ChannelConversationIface {
202
212
  input(args: {
203
213
  label: string;
204
214
  principal?: PrincipalRef;
215
+ actingAs?: PersonHandle;
216
+ replyExpected?: boolean;
205
217
  content: ContentBlock[];
206
218
  context?: string[];
207
219
  origin: OriginIface;
@@ -260,10 +272,7 @@ export interface ChannelReceiveContextIface<Config = JsonObject> {
260
272
  binding: {
261
273
  id: string;
262
274
  url: string;
263
- owner: {
264
- kind: 'install';
265
- installId: string;
266
- };
275
+ projectId: string;
267
276
  };
268
277
  config: Config;
269
278
  credentials: ChannelCredentialsIface;
@@ -364,6 +373,7 @@ export interface HttpChannelRouteDefinitionIface<Config = JsonObject> {
364
373
  method: 'GET' | 'POST' | 'PUT' | 'DELETE';
365
374
  path: string;
366
375
  redirect?: boolean;
376
+ shared?: boolean;
367
377
  handler(args: ChannelRouteContextIface<Config>): Promise<Response>;
368
378
  }
369
379
  export interface WebSocketChannelRouteDefinitionIface<Config = JsonObject> {
@@ -378,14 +388,43 @@ export type ChannelEventHandlersIface<Config, State> = {
378
388
  [Kind in keyof ChannelSemanticDataByKindIface]?: (data: ChannelSemanticDataByKindIface[Kind], ctx: ChannelEventContextIface<Config, State>) => Promise<void>;
379
389
  };
380
390
  export type ChannelEventKind = keyof ChannelSemanticDataByKindIface;
391
+ export interface ChannelAppRequirementIface {
392
+ description: string;
393
+ oauthClient?: {
394
+ description: string;
395
+ optional?: boolean;
396
+ };
397
+ secrets?: Record<string, {
398
+ description: string;
399
+ optional?: boolean;
400
+ }>;
401
+ }
402
+ export interface ChannelRequireIface {
403
+ app?: ChannelAppRequirementIface;
404
+ }
405
+ export interface ChannelIngressContextIface {
406
+ app: {
407
+ id: string;
408
+ };
409
+ credentials: Pick<ChannelCredentialsIface, 'verify' | 'secret' | 'client'>;
410
+ log(message: string, details?: JsonObject): void;
411
+ }
412
+ export interface ChannelIngressIface {
413
+ tenantOf(request: Request, ctx: ChannelIngressContextIface): Promise<{
414
+ tenant: string;
415
+ } | {
416
+ respond: Response;
417
+ } | null>;
418
+ }
381
419
  export interface ChannelDefinitionIface<Config = JsonObject, Inbound = JsonValue, State = JsonValue> {
382
420
  name: string;
383
421
  config?: Config;
384
422
  configure?(config: Config): ChannelDefinitionIface<Config, Inbound, State>;
385
- credentials: {
386
- app: string | null;
387
- secrets?: string[];
423
+ require?: ChannelRequireIface;
424
+ tenants?: {
425
+ installPath: string;
388
426
  };
427
+ ingress?: ChannelIngressIface;
389
428
  identity: {
390
429
  kind: 'redirect';
391
430
  start(args: {
@@ -54,6 +54,7 @@ const channelReceiveResultSchema = z.union([
54
54
  ]);
55
55
  var ChannelCredentialKind = /* @__PURE__ */ ((ChannelCredentialKind2) => {
56
56
  ChannelCredentialKind2["App"] = "app";
57
+ ChannelCredentialKind2["Secret"] = "secret";
57
58
  ChannelCredentialKind2["OAuth"] = "oauth";
58
59
  ChannelCredentialKind2["None"] = "none";
59
60
  return ChannelCredentialKind2;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/channel.ts"],
4
- "sourcesContent": ["import type { ContentBlock } from '@agentclientprotocol/sdk/experimental/v2';\nimport * as z from 'zod';\nimport { jsonObjectSchema, type JsonObject, type JsonValue } from \"./json.mjs\";\nimport type { ChannelSemanticDataByKindIface } from \"./semantic-events.mjs\";\n\n// Handles carry no authority until the platform validates their binding and invocation signature.\nexport const personHandleSchema = z.string().min(1).brand<'ChannelPerson'>();\nexport const conversationHandleSchema = z.string().min(1).brand<'ChannelConversation'>();\nexport type PersonHandle = z.infer<typeof personHandleSchema>;\nexport type ConversationHandle = z.infer<typeof conversationHandleSchema>;\n\nexport const principalRefSchema = z.object({\n id: z.string().min(1),\n tenant: z.string().min(1).optional(),\n displayName: z.string().optional(),\n});\nexport type PrincipalRef = z.infer<typeof principalRefSchema>;\nexport interface PlaceRef {\n kind: string;\n id: string;\n tenant?: string;\n parent?: PlaceRef;\n title?: string;\n}\nexport const placeRefSchema: z.ZodType<PlaceRef> = z.lazy(() =>\n z.object({\n kind: z.string().min(1),\n id: z.string().min(1),\n tenant: z.string().min(1).optional(),\n parent: placeRefSchema.optional(),\n title: z.string().optional(),\n }),\n);\nexport interface OriginIface {\n place: PlaceRef;\n ref?: JsonObject;\n}\nexport const originSchema = z.object({ place: placeRefSchema, ref: jsonObjectSchema.optional() });\n\nexport type PersonResolution =\n | { kind: 'member'; person: PersonHandle; displayName: string }\n | { kind: 'unlinked'; linkUrl: string }\n | { kind: 'blocked'; reason: 'not-in-organization' | 'suspended' };\nexport enum ChannelReplies {\n Origin = 'origin',\n All = 'all',\n}\nexport enum ChannelAudience {\n Members = 'members',\n Anyone = 'anyone',\n}\nexport enum ChannelCreate {\n DirectWithAgent = 'direct-with-agent',\n Group = 'group',\n}\nexport const placePolicySchema = z.object({\n replies: z.nativeEnum(ChannelReplies),\n audience: z.nativeEnum(ChannelAudience),\n});\nexport interface PlacePolicy {\n replies: ChannelReplies | `${ChannelReplies}`;\n audience: ChannelAudience | `${ChannelAudience}`;\n}\nexport interface PlaceDefaultsIface extends PlacePolicy {\n create: ChannelCreate | `${ChannelCreate}`;\n}\nexport type PlaceResolution =\n | { kind: 'connected'; conversation: ConversationHandle; policy: PlacePolicy }\n | { kind: 'unconnected'; connectUrl: string; defaults: PlaceDefaultsIface | null };\nexport interface Refusal {\n refused: 'unlinked' | 'no-access' | 'unconnected' | 'not-audience';\n linkUrl?: string;\n connectUrl?: string;\n message: string;\n}\nexport type ChannelReceiveResult =\n | { accepted: true }\n | { accepted: false; refusal: Refusal }\n | { ignored: true; reason: string };\nexport const refusalSchema = z.object({\n refused: z.union([\n z.literal('unlinked'),\n z.literal('no-access'),\n z.literal('unconnected'),\n z.literal('not-audience'),\n ]),\n linkUrl: z.string().optional(),\n connectUrl: z.string().optional(),\n message: z.string(),\n});\nexport const channelReceiveResultSchema = z.union([\n z.object({ accepted: z.literal(true) }),\n z.object({ accepted: z.literal(false), refusal: refusalSchema }),\n z.object({ ignored: z.literal(true), reason: z.string() }),\n]);\nexport enum ChannelCredentialKind {\n App = 'app',\n OAuth = 'oauth',\n None = 'none',\n}\nexport const channelCredentialHandleSchema = z.string().min(1).brand<'ChannelCredential'>();\nexport type ChannelCredentialHandle = z.infer<typeof channelCredentialHandleSchema>;\nexport type ChannelCredentialRef =\n | { kind: ChannelCredentialKind.App; tenant?: string }\n | { kind: ChannelCredentialKind.OAuth; handle: ChannelCredentialHandle }\n | { kind: ChannelCredentialKind.None };\nexport enum ChannelSigningAlgorithm {\n HmacSha256 = 'hmac-sha256',\n HmacSha1 = 'hmac-sha1',\n Ed25519 = 'ed25519',\n}\nexport enum ChannelSignatureEncoding {\n Hex = 'hex',\n Base64 = 'base64',\n}\nexport enum ChannelOAuthClientAuthentication {\n Body = 'body',\n Basic = 'basic',\n None = 'none',\n}\nexport interface ChannelCredentialRequestInitIface extends RequestInit {\n credential?: ChannelCredentialRef;\n}\nexport interface ChannelVerifyOptionsIface {\n algorithm: ChannelSigningAlgorithm;\n encoding: ChannelSignatureEncoding;\n data: string;\n signature: string;\n}\nexport interface ChannelOAuthExchangeOptionsIface {\n url: string;\n parameters: Record<string, string>;\n authentication: ChannelOAuthClientAuthentication;\n clientId?: string;\n signal?: AbortSignal;\n}\nexport interface ChannelRedirectOptionsIface {\n // A GET route of this channel declared with `redirect: true`.\n path: string;\n}\nexport interface ChannelRedirectIface {\n url: string;\n state: string;\n}\nexport interface ChannelCredentialConnectOptionsIface {\n url: string;\n signal?: AbortSignal;\n}\nexport interface ChannelCredentialInjectionIface {\n path: string[];\n credential: ChannelCredentialRef;\n}\nexport interface ChannelCredentialSocketIface {\n messages: AsyncIterable<string | Uint8Array>;\n send(\n data: string | Uint8Array,\n options?: { inject?: ChannelCredentialInjectionIface[] },\n ): Promise<void>;\n close(code?: number, reason?: string): Promise<void>;\n closeCode(): number | null;\n}\nexport interface ChannelCredentialsIface {\n // Installed credentials stay with the host in every execution mode.\n client(): Promise<{ clientId: string }>;\n verify(args: ChannelVerifyOptionsIface): Promise<boolean>;\n exchange(args: ChannelOAuthExchangeOptionsIface): Promise<ChannelCredentialHandle>;\n // Send `url` as the OAuth redirect URI and `state` unchanged. `url` is the same for every\n // binding, so a provider application registers it once; `state` returns to this binding.\n redirect(args: ChannelRedirectOptionsIface): Promise<ChannelRedirectIface>;\n // Requests without an explicit credential are unauthenticated.\n fetch(input: RequestInfo | URL, init?: ChannelCredentialRequestInitIface): Promise<Response>;\n connect(args: ChannelCredentialConnectOptionsIface): Promise<ChannelCredentialSocketIface>;\n // Only explicitly declared project secrets can be read by authored code.\n secret(name: string): Promise<string | null>;\n}\nexport interface ChannelPostArgsIface {\n from: PersonHandle;\n content: ContentBlock[];\n context?: string[];\n origin: OriginIface;\n idempotencyKey: string;\n waitForAcceptance?: boolean;\n}\nexport interface ChannelConversationIface {\n post(args: ChannelPostArgsIface): Promise<{ messageId: string; turnId?: string } | Refusal>;\n input(args: {\n label: string;\n principal?: PrincipalRef;\n content: ContentBlock[];\n context?: string[];\n origin: OriginIface;\n idempotencyKey: string;\n waitForAcceptance?: boolean;\n }): Promise<{ inputId: string; turnId?: string } | Refusal>;\n attach(args: {\n origin: OriginIface;\n content: ContentBlock[];\n label: string;\n idempotencyKey: string;\n from?: PersonHandle;\n }): Promise<{ messageId: string } | Refusal>;\n edit(args: {\n externalKey: string;\n by: PersonHandle;\n content: ContentBlock[];\n }): Promise<{ messageId: string } | Refusal>;\n remove(args: { externalKey: string; by: PersonHandle }): Promise<{ removed: boolean } | Refusal>;\n react(args: {\n target: { externalKey: string } | { replyOf: { externalKey: string; turnId: string } };\n emoji: string;\n by: PersonHandle;\n op: 'add' | 'remove';\n }): Promise<{ ok: true } | Refusal>;\n}\nexport type SemanticEvent = {\n [Kind in keyof ChannelSemanticDataByKindIface]: {\n type: Kind;\n data: ChannelSemanticDataByKindIface[Kind];\n seq: number;\n };\n}[keyof ChannelSemanticDataByKindIface];\nexport interface ChannelReceiveContextIface<Config = JsonObject> {\n binding: {\n id: string;\n url: string;\n owner: { kind: 'install'; installId: string };\n };\n config: Config;\n credentials: ChannelCredentialsIface;\n people: {\n resolve(principal: PrincipalRef): Promise<PersonResolution>;\n identify(person: PersonHandle): Promise<PrincipalRef | null>;\n // Tenant-wide uninstall/revocation also disconnects that tenant's places.\n revoke(args: {\n principal?: PrincipalRef;\n tenant?: string;\n reason: 'deactivated' | 'uninstalled' | 'provider-revoked';\n }): Promise<void>;\n confirm(args: { ticket: string; principal: PrincipalRef }): Promise<{ linked: true } | Refusal>;\n };\n places: {\n // Explicit anyone/group defaults may create a Shared chat while resolving a new place.\n resolve(place: PlaceRef): Promise<PlaceResolution>;\n observers(place: PlaceRef): Promise<ConversationHandle[]>;\n connect(\n place: PlaceRef,\n to: {\n by: PersonHandle;\n conversation?: ConversationHandle;\n create?: ChannelCreate | `${ChannelCreate}`;\n },\n ): Promise<ConversationHandle>;\n disconnect(place: PlaceRef, by: PersonHandle): Promise<void>;\n follow(\n place: PlaceRef,\n args: { by: PersonHandle; conversation: ConversationHandle; ttlSeconds?: number },\n ): Promise<void>;\n unfollow(\n place: PlaceRef,\n args: { by: PersonHandle; conversation: ConversationHandle },\n ): Promise<void>;\n };\n conversation(handle: ConversationHandle): ChannelConversationIface;\n observe(\n handle: ConversationHandle,\n args: { turnId: string; signal?: AbortSignal },\n ): AsyncIterable<SemanticEvent>;\n decisions: {\n resolve(args: {\n decisionId: string;\n outcome: JsonValue;\n by: PersonHandle;\n }): Promise<{ resolved: boolean } | Refusal>;\n };\n turns: {\n cancel(args: {\n conversation: ConversationHandle;\n by?: PersonHandle;\n turnId?: string;\n }): Promise<{ accepted: boolean } | Refusal>;\n };\n store: {\n get(key: string): Promise<JsonValue | null>;\n set(key: string, value: JsonValue | null, options?: { ttlSeconds?: number }): Promise<void>;\n };\n log(message: string, details?: JsonObject): void;\n}\nexport interface ChannelSocketIface {\n readonly signal: AbortSignal;\n readonly messages: AsyncIterable<string | Uint8Array>;\n // Authenticate the request before accepting. The selected protocol must have been offered.\n accept(options?: { protocol?: string }): void;\n send(data: string | Uint8Array): void;\n close(code?: number, reason?: string): void;\n}\n// State starts null and persists for the callbacks of one turn.\nexport interface ChannelTurnStateIface<State> {\n get(): State | null;\n set(state: State | null): void;\n}\nexport interface ChannelEventContextIface<Config = JsonObject, State = JsonValue> extends Pick<\n ChannelReceiveContextIface<Config>,\n 'binding' | 'config' | 'credentials' | 'store' | 'log'\n> {\n origin: OriginIface;\n conversation: ConversationHandle;\n turn: { id: string; agent: { displayName: string } };\n state: ChannelTurnStateIface<State>;\n}\nexport interface ChannelRouteContextIface<\n Config = JsonObject,\n> extends ChannelReceiveContextIface<Config> {\n request: Request;\n receive(input: JsonValue): Promise<ChannelReceiveResult>;\n}\nexport interface HttpChannelRouteDefinitionIface<Config = JsonObject> {\n method: 'GET' | 'POST' | 'PUT' | 'DELETE';\n path: string;\n // Served only for a provider returning with `credentials.redirect` state.\n redirect?: boolean;\n handler(args: ChannelRouteContextIface<Config>): Promise<Response>;\n}\nexport interface WebSocketChannelRouteDefinitionIface<Config = JsonObject> {\n method: 'WS';\n path: string;\n handler(\n args: ChannelRouteContextIface<Config> & { socket: ChannelSocketIface },\n ): Promise<Response | void>;\n}\nexport type RouteDefinitionIface<Config = JsonObject> =\n | HttpChannelRouteDefinitionIface<Config>\n | WebSocketChannelRouteDefinitionIface<Config>;\nexport type ChannelEventHandlersIface<Config, State> = {\n [Kind in keyof ChannelSemanticDataByKindIface]?: (\n data: ChannelSemanticDataByKindIface[Kind],\n ctx: ChannelEventContextIface<Config, State>,\n ) => Promise<void>;\n};\nexport type ChannelEventKind = keyof ChannelSemanticDataByKindIface;\nexport interface ChannelDefinitionIface<\n Config = JsonObject,\n Inbound = JsonValue,\n State = JsonValue,\n> {\n name: string;\n config?: Config;\n configure?(config: Config): ChannelDefinitionIface<Config, Inbound, State>;\n credentials: { app: string | null; secrets?: string[] };\n identity:\n | {\n kind: 'redirect';\n start(\n args: { ticket: string; principal: PrincipalRef },\n ctx: ChannelReceiveContextIface<Config>,\n ): Promise<URL>;\n }\n | {\n kind: 'challenge';\n deliver(\n args: { principal: PrincipalRef; code: string },\n ctx: ChannelReceiveContextIface<Config>,\n ): Promise<void>;\n }\n | { kind: 'none' };\n places: { kinds: readonly string[]; defaults?(place: PlaceRef): PlaceDefaultsIface | null };\n resources?: {\n authorize(\n args: { place: PlaceRef; principal: PrincipalRef },\n ctx: ChannelReceiveContextIface<Config>,\n ): Promise<boolean>;\n resolve(\n args: { url: string; principal: PrincipalRef },\n ctx: ChannelReceiveContextIface<Config>,\n ): Promise<PlaceRef | null>;\n };\n routes?: RouteDefinitionIface<Config>[];\n listeners?: {\n key: string;\n run(ctx: ChannelReceiveContextIface<Config> & { signal: AbortSignal }): Promise<void>;\n }[];\n receive(input: Inbound, ctx: ChannelReceiveContextIface<Config>): Promise<ChannelReceiveResult>;\n events?: ChannelEventHandlersIface<Config, State>;\n}\nexport const defineChannel = <Config = JsonObject, Inbound = JsonValue, State = JsonValue>(\n definition: ChannelDefinitionIface<Config, Inbound, State>,\n): ChannelDefinitionIface<Config, Inbound, State> => definition;\n"],
5
- "mappings": "AACA,YAAY,OAAO;AACnB,SAAS,wBAAyD;AAI3D,MAAM,qBAAqB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAuB;AACpE,MAAM,2BAA2B,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAA6B;AAIhF,MAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,EACnC,aAAa,EAAE,OAAO,EAAE,SAAS;AACnC,CAAC;AASM,MAAM,iBAAsC,EAAE;AAAA,EAAK,MACxD,EAAE,OAAO;AAAA,IACP,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,IACtB,IAAI,EAAE,OAAO,EAAE,IAAI,CA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O,EAAE,SAAS,EAAE,QAAQ,IAAI,GAAG,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC3D,CAAC;AACM,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AAHG,SAAAA;AAAA,GAAA;AAKL,MAAM,gCAAgC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAA2B;AAMnF,IAAK,0BAAL,kBAAKC,6BAAL;AACL,EAAAA,yBAAA,gBAAa;AACb,EAAAA,yBAAA,cAAW;AACX,EAAAA,yBAAA,aAAU;AAHA,SAAAA;AAAA,GAAA;AAKL,IAAK,2BAAL,kBAAKC,8BAAL;AACL,EAAAA,0BAAA,SAAM;AACN,EAAAA,0BAAA,YAAS;AAFC,SAAAA;AAAA,GAAA;AAIL,IAAK,mCAAL,kBAAKC,sCAAL;AACL,EAAAA,kCAAA,UAAO;AACP,EAAAA,kCAAA,WAAQ;AACR,EAAAA,kCAAA,UAAO;AAHG,SAAAA;AAAA,GAAA;AA4QL,MAAM,gBAAgB,CAC3B,eACmD;",
4
+ "sourcesContent": ["import type { ContentBlock } from '@agentclientprotocol/sdk/experimental/v2';\nimport * as z from 'zod';\nimport { jsonObjectSchema, type JsonObject, type JsonValue } from \"./json.mjs\";\nimport type { ChannelSemanticDataByKindIface } from \"./semantic-events.mjs\";\n\n// Handles carry no authority until the platform validates their binding and invocation signature.\nexport const personHandleSchema = z.string().min(1).brand<'ChannelPerson'>();\nexport const conversationHandleSchema = z.string().min(1).brand<'ChannelConversation'>();\nexport type PersonHandle = z.infer<typeof personHandleSchema>;\nexport type ConversationHandle = z.infer<typeof conversationHandleSchema>;\n\nexport const principalRefSchema = z.object({\n id: z.string().min(1),\n tenant: z.string().min(1).optional(),\n displayName: z.string().optional(),\n});\nexport type PrincipalRef = z.infer<typeof principalRefSchema>;\nexport interface PlaceRef {\n kind: string;\n id: string;\n tenant?: string;\n parent?: PlaceRef;\n title?: string;\n}\nexport const placeRefSchema: z.ZodType<PlaceRef> = z.lazy(() =>\n z.object({\n kind: z.string().min(1),\n id: z.string().min(1),\n tenant: z.string().min(1).optional(),\n parent: placeRefSchema.optional(),\n title: z.string().optional(),\n }),\n);\nexport interface OriginIface {\n place: PlaceRef;\n ref?: JsonObject;\n}\nexport const originSchema = z.object({ place: placeRefSchema, ref: jsonObjectSchema.optional() });\n\nexport type PersonResolution =\n | { kind: 'member'; person: PersonHandle; displayName: string }\n // `linkUrl` is the installer's link page for this person, when the install has one; without\n // it, the channel tells the person how to link in its own words.\n | { kind: 'unlinked'; linkUrl?: string }\n | { kind: 'blocked'; reason: 'not-a-member' | 'suspended' };\nexport enum ChannelReplies {\n Origin = 'origin',\n All = 'all',\n}\nexport enum ChannelAudience {\n Members = 'members',\n Anyone = 'anyone',\n}\nexport enum ChannelCreate {\n DirectWithAgent = 'direct-with-agent',\n Group = 'group',\n}\nexport const placePolicySchema = z.object({\n replies: z.nativeEnum(ChannelReplies),\n audience: z.nativeEnum(ChannelAudience),\n});\nexport interface PlacePolicy {\n replies: ChannelReplies | `${ChannelReplies}`;\n audience: ChannelAudience | `${ChannelAudience}`;\n}\nexport interface PlaceDefaultsIface extends PlacePolicy {\n create: ChannelCreate | `${ChannelCreate}`;\n}\nexport type PlaceResolution =\n | { kind: 'connected'; conversation: ConversationHandle; policy: PlacePolicy }\n // `connectUrl` is the installer's connect page for this place, when the install has one.\n | { kind: 'unconnected'; connectUrl?: string; defaults: PlaceDefaultsIface | null };\nexport interface Refusal {\n refused: 'unlinked' | 'no-access' | 'unconnected' | 'not-audience';\n linkUrl?: string;\n connectUrl?: string;\n message: string;\n}\nexport type ChannelReceiveResult =\n | { accepted: true }\n | { accepted: false; refusal: Refusal }\n | { ignored: true; reason: string };\nexport const refusalSchema = z.object({\n refused: z.union([\n z.literal('unlinked'),\n z.literal('no-access'),\n z.literal('unconnected'),\n z.literal('not-audience'),\n ]),\n linkUrl: z.string().optional(),\n connectUrl: z.string().optional(),\n message: z.string(),\n});\nexport const channelReceiveResultSchema = z.union([\n z.object({ accepted: z.literal(true) }),\n z.object({ accepted: z.literal(false), refusal: refusalSchema }),\n z.object({ ignored: z.literal(true), reason: z.string() }),\n]);\nexport enum ChannelCredentialKind {\n // A provider tenant's token, stored when the tenant installed the channel's app.\n App = 'app',\n // A secret slot of the channel's app, injected without the channel reading it.\n Secret = 'secret',\n OAuth = 'oauth',\n None = 'none',\n}\nexport const channelCredentialHandleSchema = z.string().min(1).brand<'ChannelCredential'>();\nexport type ChannelCredentialHandle = z.infer<typeof channelCredentialHandleSchema>;\nexport type ChannelCredentialRef =\n | { kind: ChannelCredentialKind.App; tenant: string }\n // `scheme` is the Authorization scheme the secret is sent with (`Bearer` when omitted). Frame\n // injection writes the bare value.\n | { kind: ChannelCredentialKind.Secret; slot: string; scheme?: string }\n | { kind: ChannelCredentialKind.OAuth; handle: ChannelCredentialHandle }\n | { kind: ChannelCredentialKind.None };\nexport enum ChannelSigningAlgorithm {\n HmacSha256 = 'hmac-sha256',\n HmacSha1 = 'hmac-sha1',\n Ed25519 = 'ed25519',\n}\nexport enum ChannelSignatureEncoding {\n Hex = 'hex',\n Base64 = 'base64',\n}\nexport enum ChannelOAuthClientAuthentication {\n Body = 'body',\n Basic = 'basic',\n None = 'none',\n}\nexport interface ChannelCredentialRequestInitIface extends RequestInit {\n credential?: ChannelCredentialRef;\n}\nexport interface ChannelVerifyOptionsIface {\n // The app secret slot holding the signing secret or public key; its value is never read.\n secret: string;\n algorithm: ChannelSigningAlgorithm;\n encoding: ChannelSignatureEncoding;\n data: string;\n signature: string;\n}\nexport interface ChannelOAuthExchangeOptionsIface {\n url: string;\n parameters: Record<string, string>;\n authentication: ChannelOAuthClientAuthentication;\n clientId?: string;\n signal?: AbortSignal;\n // Stores the token as this provider tenant's install of the channel's app. Honoured only in a\n // redirect route whose state carries an unused tenant-install ticket for this binding.\n store?: { tenant: string };\n}\nexport interface ChannelRedirectOptionsIface {\n // A GET route of this channel declared with `redirect: true`.\n path: string;\n // A tenant-install ticket the install route received; it is bound into the signed state.\n ticket?: string;\n}\nexport interface ChannelRedirectIface {\n url: string;\n state: string;\n}\nexport interface ChannelCredentialConnectOptionsIface {\n url: string;\n signal?: AbortSignal;\n}\nexport interface ChannelCredentialInjectionIface {\n path: string[];\n credential: ChannelCredentialRef;\n}\nexport interface ChannelCredentialSocketIface {\n messages: AsyncIterable<string | Uint8Array>;\n send(\n data: string | Uint8Array,\n options?: { inject?: ChannelCredentialInjectionIface[] },\n ): Promise<void>;\n close(code?: number, reason?: string): Promise<void>;\n closeCode(): number | null;\n}\nexport interface ChannelCredentialsIface {\n // The channel app's credentials stay with the host in every execution mode.\n client(): Promise<{ clientId: string }>;\n verify(args: ChannelVerifyOptionsIface): Promise<boolean>;\n exchange(args: ChannelOAuthExchangeOptionsIface): Promise<ChannelCredentialHandle>;\n // Send `url` as the OAuth redirect URI and `state` unchanged. `url` is the same for every\n // binding, so a provider application registers it once; `state` returns to this binding.\n redirect(args: ChannelRedirectOptionsIface): Promise<ChannelRedirectIface>;\n // Requests without an explicit credential are unauthenticated.\n fetch(input: RequestInfo | URL, init?: ChannelCredentialRequestInitIface): Promise<Response>;\n connect(args: ChannelCredentialConnectOptionsIface): Promise<ChannelCredentialSocketIface>;\n // The value of an app secret slot the channel declares in `require.app.secrets`; null for any\n // other slot.\n secret(slot: string): Promise<string | null>;\n}\nexport interface ChannelPostArgsIface {\n from: PersonHandle;\n content: ContentBlock[];\n context?: string[];\n origin: OriginIface;\n idempotencyKey: string;\n waitForAcceptance?: boolean;\n}\nexport interface ChannelConversationIface {\n post(args: ChannelPostArgsIface): Promise<{ messageId: string; turnId?: string } | Refusal>;\n input(args: {\n label: string;\n principal?: PrincipalRef;\n // The linked person the agent's turn acts for; with nobody, the input waits for the\n // running turn.\n actingAs?: PersonHandle;\n // False when the agent should reply only if it has something to say. Default true.\n replyExpected?: boolean;\n content: ContentBlock[];\n context?: string[];\n origin: OriginIface;\n idempotencyKey: string;\n waitForAcceptance?: boolean;\n }): Promise<{ inputId: string; turnId?: string } | Refusal>;\n attach(args: {\n origin: OriginIface;\n content: ContentBlock[];\n label: string;\n idempotencyKey: string;\n from?: PersonHandle;\n }): Promise<{ messageId: string } | Refusal>;\n edit(args: {\n externalKey: string;\n by: PersonHandle;\n content: ContentBlock[];\n }): Promise<{ messageId: string } | Refusal>;\n remove(args: { externalKey: string; by: PersonHandle }): Promise<{ removed: boolean } | Refusal>;\n react(args: {\n target: { externalKey: string } | { replyOf: { externalKey: string; turnId: string } };\n emoji: string;\n by: PersonHandle;\n op: 'add' | 'remove';\n }): Promise<{ ok: true } | Refusal>;\n}\nexport type SemanticEvent = {\n [Kind in keyof ChannelSemanticDataByKindIface]: {\n type: Kind;\n data: ChannelSemanticDataByKindIface[Kind];\n seq: number;\n };\n}[keyof ChannelSemanticDataByKindIface];\nexport interface ChannelReceiveContextIface<Config = JsonObject> {\n binding: {\n id: string;\n url: string;\n // The project the install belongs to.\n projectId: string;\n };\n config: Config;\n credentials: ChannelCredentialsIface;\n people: {\n resolve(principal: PrincipalRef): Promise<PersonResolution>;\n identify(person: PersonHandle): Promise<PrincipalRef | null>;\n // Tenant-wide uninstall/revocation also disconnects that tenant's places.\n revoke(args: {\n principal?: PrincipalRef;\n tenant?: string;\n reason: 'deactivated' | 'uninstalled' | 'provider-revoked';\n }): Promise<void>;\n confirm(args: { ticket: string; principal: PrincipalRef }): Promise<{ linked: true } | Refusal>;\n };\n places: {\n // Explicit anyone/group defaults may create a Shared chat while resolving a new place.\n resolve(place: PlaceRef): Promise<PlaceResolution>;\n observers(place: PlaceRef): Promise<ConversationHandle[]>;\n connect(\n place: PlaceRef,\n to: {\n by: PersonHandle;\n conversation?: ConversationHandle;\n create?: ChannelCreate | `${ChannelCreate}`;\n },\n ): Promise<ConversationHandle>;\n disconnect(place: PlaceRef, by: PersonHandle): Promise<void>;\n follow(\n place: PlaceRef,\n args: { by: PersonHandle; conversation: ConversationHandle; ttlSeconds?: number },\n ): Promise<void>;\n unfollow(\n place: PlaceRef,\n args: { by: PersonHandle; conversation: ConversationHandle },\n ): Promise<void>;\n };\n conversation(handle: ConversationHandle): ChannelConversationIface;\n observe(\n handle: ConversationHandle,\n args: { turnId: string; signal?: AbortSignal },\n ): AsyncIterable<SemanticEvent>;\n decisions: {\n resolve(args: {\n decisionId: string;\n outcome: JsonValue;\n by: PersonHandle;\n }): Promise<{ resolved: boolean } | Refusal>;\n };\n turns: {\n cancel(args: {\n conversation: ConversationHandle;\n by?: PersonHandle;\n turnId?: string;\n }): Promise<{ accepted: boolean } | Refusal>;\n };\n store: {\n get(key: string): Promise<JsonValue | null>;\n set(key: string, value: JsonValue | null, options?: { ttlSeconds?: number }): Promise<void>;\n };\n log(message: string, details?: JsonObject): void;\n}\nexport interface ChannelSocketIface {\n readonly signal: AbortSignal;\n readonly messages: AsyncIterable<string | Uint8Array>;\n // Authenticate the request before accepting. The selected protocol must have been offered.\n accept(options?: { protocol?: string }): void;\n send(data: string | Uint8Array): void;\n close(code?: number, reason?: string): void;\n}\n// State starts null and persists for the callbacks of one turn.\nexport interface ChannelTurnStateIface<State> {\n get(): State | null;\n set(state: State | null): void;\n}\nexport interface ChannelEventContextIface<Config = JsonObject, State = JsonValue> extends Pick<\n ChannelReceiveContextIface<Config>,\n 'binding' | 'config' | 'credentials' | 'store' | 'log'\n> {\n origin: OriginIface;\n conversation: ConversationHandle;\n turn: { id: string; agent: { displayName: string } };\n state: ChannelTurnStateIface<State>;\n}\nexport interface ChannelRouteContextIface<\n Config = JsonObject,\n> extends ChannelReceiveContextIface<Config> {\n request: Request;\n receive(input: JsonValue): Promise<ChannelReceiveResult>;\n}\nexport interface HttpChannelRouteDefinitionIface<Config = JsonObject> {\n method: 'GET' | 'POST' | 'PUT' | 'DELETE';\n path: string;\n // Served only for a provider returning with `credentials.redirect` state.\n redirect?: boolean;\n // Also served at the app's shared ingress URL, for the binding `ingress.tenantOf` picks.\n shared?: boolean;\n handler(args: ChannelRouteContextIface<Config>): Promise<Response>;\n}\nexport interface WebSocketChannelRouteDefinitionIface<Config = JsonObject> {\n method: 'WS';\n path: string;\n handler(\n args: ChannelRouteContextIface<Config> & { socket: ChannelSocketIface },\n ): Promise<Response | void>;\n}\nexport type RouteDefinitionIface<Config = JsonObject> =\n | HttpChannelRouteDefinitionIface<Config>\n | WebSocketChannelRouteDefinitionIface<Config>;\nexport type ChannelEventHandlersIface<Config, State> = {\n [Kind in keyof ChannelSemanticDataByKindIface]?: (\n data: ChannelSemanticDataByKindIface[Kind],\n ctx: ChannelEventContextIface<Config, State>,\n ) => Promise<void>;\n};\nexport type ChannelEventKind = keyof ChannelSemanticDataByKindIface;\n\n// Provider application credentials the channel needs, satisfied by a channel app: the install's\n// own, or the one the channel's publisher attached.\nexport interface ChannelAppRequirementIface {\n description: string;\n oauthClient?: { description: string; optional?: boolean };\n // Secret slots, by name (a signing secret, an app-level token).\n secrets?: Record<string, { description: string; optional?: boolean }>;\n}\nexport interface ChannelRequireIface {\n app?: ChannelAppRequirementIface;\n}\nexport interface ChannelIngressContextIface {\n app: { id: string };\n credentials: Pick<ChannelCredentialsIface, 'verify' | 'secret' | 'client'>;\n log(message: string, details?: JsonObject): void;\n}\nexport interface ChannelIngressIface {\n // Reads which provider tenant a request to the app's shared ingress URL is for, after verifying\n // it. `respond` answers an app-level request (a URL handshake) with no binding; null rejects it.\n tenantOf(\n request: Request,\n ctx: ChannelIngressContextIface,\n ): Promise<{ tenant: string } | { respond: Response } | null>;\n}\nexport interface ChannelDefinitionIface<\n Config = JsonObject,\n Inbound = JsonValue,\n State = JsonValue,\n> {\n name: string;\n config?: Config;\n configure?(config: Config): ChannelDefinitionIface<Config, Inbound, State>;\n require?: ChannelRequireIface;\n // A GET route that starts the provider's app install for a tenant; it receives `ticket`.\n tenants?: { installPath: string };\n // Present on the publication an app routes its shared ingress through.\n ingress?: ChannelIngressIface;\n identity:\n | {\n kind: 'redirect';\n start(\n args: { ticket: string; principal: PrincipalRef },\n ctx: ChannelReceiveContextIface<Config>,\n ): Promise<URL>;\n }\n | {\n kind: 'challenge';\n deliver(\n args: { principal: PrincipalRef; code: string },\n ctx: ChannelReceiveContextIface<Config>,\n ): Promise<void>;\n }\n | { kind: 'none' };\n places: { kinds: readonly string[]; defaults?(place: PlaceRef): PlaceDefaultsIface | null };\n resources?: {\n authorize(\n args: { place: PlaceRef; principal: PrincipalRef },\n ctx: ChannelReceiveContextIface<Config>,\n ): Promise<boolean>;\n resolve(\n args: { url: string; principal: PrincipalRef },\n ctx: ChannelReceiveContextIface<Config>,\n ): Promise<PlaceRef | null>;\n };\n routes?: RouteDefinitionIface<Config>[];\n listeners?: {\n key: string;\n run(ctx: ChannelReceiveContextIface<Config> & { signal: AbortSignal }): Promise<void>;\n }[];\n receive(input: Inbound, ctx: ChannelReceiveContextIface<Config>): Promise<ChannelReceiveResult>;\n events?: ChannelEventHandlersIface<Config, State>;\n}\nexport const defineChannel = <Config = JsonObject, Inbound = JsonValue, State = JsonValue>(\n definition: ChannelDefinitionIface<Config, Inbound, State>,\n): ChannelDefinitionIface<Config, Inbound, State> => definition;\n"],
5
+ "mappings": "AACA,YAAY,OAAO;AACnB,SAAS,wBAAyD;AAI3D,MAAM,qBAAqB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAuB;AACpE,MAAM,2BAA2B,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAA6B;AAIhF,MAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,EACnC,aAAa,EAAE,OAAO,EAAE,SAAS;AACnC,CAAC;AASM,MAAM,iBAAsC,EAAE;AAAA,EAAK,MACxD,EAAE,OAAO;AAAA,IACP,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,IACtB,IAAI,EAAE,OAAO,EAAE,IA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E,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,GAAG,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC3D,CAAC;AACM,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,SAAM;AAEN,EAAAA,uBAAA,YAAS;AACT,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AANG,SAAAA;AAAA,GAAA;AAQL,MAAM,gCAAgC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAA2B;AASnF,IAAK,0BAAL,kBAAKC,6BAAL;AACL,EAAAA,yBAAA,gBAAa;AACb,EAAAA,yBAAA,cAAW;AACX,EAAAA,yBAAA,aAAU;AAHA,SAAAA;AAAA,GAAA;AAKL,IAAK,2BAAL,kBAAKC,8BAAL;AACL,EAAAA,0BAAA,SAAM;AACN,EAAAA,0BAAA,YAAS;AAFC,SAAAA;AAAA,GAAA;AAIL,IAAK,mCAAL,kBAAKC,sCAAL;AACL,EAAAA,kCAAA,UAAO;AACP,EAAAA,kCAAA,WAAQ;AACR,EAAAA,kCAAA,UAAO;AAHG,SAAAA;AAAA,GAAA;AAyTL,MAAM,gBAAgB,CAC3B,eACmD;",
6
6
  "names": ["ChannelReplies", "ChannelAudience", "ChannelCreate", "ChannelCredentialKind", "ChannelSigningAlgorithm", "ChannelSignatureEncoding", "ChannelOAuthClientAuthentication"]
7
7
  }
@@ -3,11 +3,9 @@ export declare enum CredentialRoute {
3
3
  Model = "model",
4
4
  Mcp = "mcp",
5
5
  Sandbox = "sandbox",
6
- TranscriptStore = "transcript-store",
7
6
  SessionStore = "session-store",
8
7
  FrameAttachments = "frame-attachments",
9
- SubscriptionRelay = "subscription-relay",
10
- FinalMcp = "final-mcp"
8
+ SubscriptionRelay = "subscription-relay"
11
9
  }
12
10
  export interface RouteGrantIface {
13
11
  route: CredentialRoute;
@@ -3,11 +3,9 @@ var CredentialRoute = /* @__PURE__ */ ((CredentialRoute2) => {
3
3
  CredentialRoute2["Model"] = "model";
4
4
  CredentialRoute2["Mcp"] = "mcp";
5
5
  CredentialRoute2["Sandbox"] = "sandbox";
6
- CredentialRoute2["TranscriptStore"] = "transcript-store";
7
6
  CredentialRoute2["SessionStore"] = "session-store";
8
7
  CredentialRoute2["FrameAttachments"] = "frame-attachments";
9
8
  CredentialRoute2["SubscriptionRelay"] = "subscription-relay";
10
- CredentialRoute2["FinalMcp"] = "final-mcp";
11
9
  return CredentialRoute2;
12
10
  })(CredentialRoute || {});
13
11
  const routeGrantSchema = z.object({
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/credential-routes.ts"],
4
- "sourcesContent": ["import * as z from 'zod';\n\n// Route-scoped, short-lived grants. A harness reads its model\n// credential through the broker's `model` route with `token`; it never sees a\n// subscription secret unless it is Final-managed and the grant says so. A leaf\n// module: a harness session's Durable Object evaluates it (with the relay\n// contract) before its started line, without the rest of harness.ts.\n\nexport enum CredentialRoute {\n Model = 'model',\n Mcp = 'mcp',\n Sandbox = 'sandbox',\n TranscriptStore = 'transcript-store',\n // Issued for each HarnessService the harness or its ACP adapter declares.\n SessionStore = 'session-store',\n FrameAttachments = 'frame-attachments',\n SubscriptionRelay = 'subscription-relay',\n // Attached only by the MCP host to the configured Final MCP endpoint.\n FinalMcp = 'final-mcp',\n}\n\nexport interface RouteGrantIface {\n route: CredentialRoute;\n token: string;\n expiresAt: string;\n}\n\nexport const routeGrantSchema = z.object({\n route: z.nativeEnum(CredentialRoute),\n token: z.string().min(1),\n expiresAt: z.string(),\n}) satisfies z.ZodType<RouteGrantIface>;\n\n// The body of a refresh: the harness session the token belongs to and the\n// routes to renew (at-open harnesses: `model`, whose renewal carries `atOpen`;\n// `mcp` and `sandbox` for the MCP headers and sandbox endpoints they hold).\nexport const credentialRefreshRequestSchema = z.object({\n harnessSessionId: z.string().uuid(),\n routes: z.array(z.nativeEnum(CredentialRoute)).min(1).max(8),\n});\n\nexport type CredentialRefreshRequestIface = z.infer<typeof credentialRefreshRequestSchema>;\n"],
5
- "mappings": "AAAA,YAAY,OAAO;AAQZ,IAAK,kBAAL,kBAAKA,qBAAL;AACL,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,SAAM;AACN,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,qBAAkB;AAElB,EAAAA,iBAAA,kBAAe;AACf,EAAAA,iBAAA,sBAAmB;AACnB,EAAAA,iBAAA,uBAAoB;AAEpB,EAAAA,iBAAA,cAAW;AAVD,SAAAA;AAAA,GAAA;AAmBL,MAAM,mBAAmB,EAAE,OAAO;AAAA,EACvC,OAAO,EAAE,WAAW,eAAe;AAAA,EACnC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACvB,WAAW,EAAE,OAAO;AACtB,CAAC;AAKM,MAAM,iCAAiC,EAAE,OAAO;AAAA,EACrD,kBAAkB,EAAE,OAAO,EAAE,KAAK;AAAA,EAClC,QAAQ,EAAE,MAAM,EAAE,WAAW,eAAe,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAC7D,CAAC;",
4
+ "sourcesContent": ["import * as z from 'zod';\n\n// Route-scoped, short-lived grants. A harness reads its model\n// credential through the broker's `model` route with `token`; it never sees a\n// subscription secret unless it is Final-managed and the grant says so. A leaf\n// module: a harness session's Durable Object evaluates it (with the relay\n// contract) before its started line, without the rest of harness.ts.\n\nexport enum CredentialRoute {\n Model = 'model',\n Mcp = 'mcp',\n Sandbox = 'sandbox',\n // Issued for each HarnessService the harness or its ACP adapter declares.\n SessionStore = 'session-store',\n FrameAttachments = 'frame-attachments',\n SubscriptionRelay = 'subscription-relay',\n}\n\nexport interface RouteGrantIface {\n route: CredentialRoute;\n token: string;\n expiresAt: string;\n}\n\nexport const routeGrantSchema = z.object({\n route: z.nativeEnum(CredentialRoute),\n token: z.string().min(1),\n expiresAt: z.string(),\n}) satisfies z.ZodType<RouteGrantIface>;\n\n// The body of a refresh: the harness session the token belongs to and the\n// routes to renew (at-open harnesses: `model`, whose renewal carries `atOpen`;\n// `mcp` and `sandbox` for the MCP headers and sandbox endpoints they hold).\nexport const credentialRefreshRequestSchema = z.object({\n harnessSessionId: z.string().uuid(),\n routes: z.array(z.nativeEnum(CredentialRoute)).min(1).max(8),\n});\n\nexport type CredentialRefreshRequestIface = z.infer<typeof credentialRefreshRequestSchema>;\n"],
5
+ "mappings": "AAAA,YAAY,OAAO;AAQZ,IAAK,kBAAL,kBAAKA,qBAAL;AACL,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,SAAM;AACN,EAAAA,iBAAA,aAAU;AAEV,EAAAA,iBAAA,kBAAe;AACf,EAAAA,iBAAA,sBAAmB;AACnB,EAAAA,iBAAA,uBAAoB;AAPV,SAAAA;AAAA,GAAA;AAgBL,MAAM,mBAAmB,EAAE,OAAO;AAAA,EACvC,OAAO,EAAE,WAAW,eAAe;AAAA,EACnC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACvB,WAAW,EAAE,OAAO;AACtB,CAAC;AAKM,MAAM,iCAAiC,EAAE,OAAO;AAAA,EACrD,kBAAkB,EAAE,OAAO,EAAE,KAAK;AAAA,EAClC,QAAQ,EAAE,MAAM,EAAE,WAAW,eAAe,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAC7D,CAAC;",
6
6
  "names": ["CredentialRoute"]
7
7
  }
@@ -235,17 +235,6 @@ export declare const requirementsSchema: z.ZodObject<{
235
235
  }, z.core.$strict>>>;
236
236
  }, z.core.$strict>;
237
237
  export type RequirementsIface = z.infer<typeof requirementsSchema>;
238
- export declare enum ScheduleTarget {
239
- OwnerDirect = "owner-direct",
240
- BoundConversation = "bound-conversation"
241
- }
242
- export declare const documentScheduleSchema: z.ZodObject<{
243
- key: z.ZodString;
244
- cron: z.ZodString;
245
- timezone: z.ZodString;
246
- prompt: z.ZodString;
247
- target: z.ZodEnum<typeof ScheduleTarget>;
248
- }, z.core.$strict>;
249
238
  export declare const agentIdentitySchema: z.ZodObject<{
250
239
  name: z.ZodString;
251
240
  description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -361,13 +350,6 @@ export declare const agentDocumentSchema: z.ZodObject<{
361
350
  }, z.core.$strict>>>;
362
351
  toolPolicy: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEnum<typeof ToolApprovalMode>>>;
363
352
  secrets: z.ZodDefault<z.ZodArray<z.ZodString>>;
364
- schedules: z.ZodDefault<z.ZodArray<z.ZodObject<{
365
- key: z.ZodString;
366
- cron: z.ZodString;
367
- timezone: z.ZodString;
368
- prompt: z.ZodString;
369
- target: z.ZodEnum<typeof ScheduleTarget>;
370
- }, z.core.$strict>>>;
371
353
  }, z.core.$strict>;
372
354
  export type AgentDocumentIface = z.output<typeof agentDocumentSchema>;
373
355
  export type AgentDocumentInputIface = z.input<typeof agentDocumentSchema>;
@@ -120,18 +120,6 @@ const requirementsSchema = z.strictObject({
120
120
  compute: computeRequirementsSchema.default({}),
121
121
  integrations: z.record(z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/), integrationRequirementSchema).default({})
122
122
  });
123
- var ScheduleTarget = /* @__PURE__ */ ((ScheduleTarget2) => {
124
- ScheduleTarget2["OwnerDirect"] = "owner-direct";
125
- ScheduleTarget2["BoundConversation"] = "bound-conversation";
126
- return ScheduleTarget2;
127
- })(ScheduleTarget || {});
128
- const documentScheduleSchema = z.strictObject({
129
- key: z.string().min(1),
130
- cron: z.string().min(1),
131
- timezone: z.string().min(1),
132
- prompt: z.string().min(1),
133
- target: z.nativeEnum(ScheduleTarget)
134
- });
135
123
  const agentIdentitySchema = z.strictObject({
136
124
  name: z.string().min(1).max(120),
137
125
  description: z.string().max(2e3).nullable().default(null),
@@ -153,8 +141,7 @@ const agentDocumentSchema = z.strictObject({
153
141
  // (`shell`, `files.write`).
154
142
  toolPolicy: z.record(z.string().min(1), z.nativeEnum(ToolApprovalMode)).default({}),
155
143
  // Project secrets the agent's code may read, by name.
156
- secrets: z.array(z.string().min(1)).default([]),
157
- schedules: z.array(documentScheduleSchema).default([])
144
+ secrets: z.array(z.string().min(1)).default([])
158
145
  });
159
146
  const inProcessCodeOf = (document) => {
160
147
  const names = [];
@@ -182,7 +169,6 @@ export {
182
169
  AGENT_DOCUMENT_VERSION,
183
170
  CodePlacement,
184
171
  HarnessFeature,
185
- ScheduleTarget,
186
172
  ToolApprovalMode,
187
173
  agentDocumentHash,
188
174
  agentDocumentSchema,
@@ -191,7 +177,6 @@ export {
191
177
  computeRequirementsOf,
192
178
  computeRequirementsSchema,
193
179
  documentHookSchema,
194
- documentScheduleSchema,
195
180
  documentSkillSchema,
196
181
  documentToolSchema,
197
182
  harnessRecommendationSchema,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/document.ts"],
4
- "sourcesContent": ["import * as z from 'zod';\nimport {\n agentAvatarSchema,\n Capability,\n capabilityAccessSchemas,\n type CapabilityAccess,\n} from '@finalai/agent-protocol';\nimport { PermissionLevel } from '@finalai/agent-protocol/agent-platform';\nimport { contentHash } from \"./canonical-json.mjs\";\nimport { jsonSchemaSchema, jsonValueSchema } from \"./json.mjs\";\n\n// The agent's document (manifest v5): everything an agent is, as data. It\n// states what the agent requires and never what provides it: no sandboxes,\n// servers, credentials, models or harness placement. A session pins one\n// document by its content hash (./canonical-json.ts).\n//\n// Custom code is part of the document only when it runs on Final's runtime:\n// a serverless tool or hook carries its self-contained ES module source. An\n// in-process one carries only its interface; its body never leaves the\n// process that created the session.\n\nexport const AGENT_DOCUMENT_VERSION = 5;\n\nexport enum CodePlacement {\n // Runs in the process that created the session, over its connection.\n InProcess = 'in-process',\n // Runs on Final's runtime from the source in the document.\n Serverless = 'serverless',\n}\n\nexport enum ToolApprovalMode {\n Allow = 'allow',\n Ask = 'ask',\n}\n\n// One self-contained ES module. It may use the runtime's globals (`fetch`,\n// `crypto`, `URL`, ...) and its `ctx` argument; it imports nothing.\nexport const serverlessSourceSchema = z.strictObject({\n source: z\n .string()\n .min(1)\n .max(4 * 1024 * 1024),\n // The module export implementing it.\n export: z.string().min(1).default('default'),\n});\n\nexport const codeSchema = z.discriminatedUnion('placement', [\n z.strictObject({ placement: z.literal(CodePlacement.InProcess) }),\n z.strictObject({\n placement: z.literal(CodePlacement.Serverless),\n ...serverlessSourceSchema.shape,\n }),\n]);\n\nexport type CodeIface = z.infer<typeof codeSchema>;\n\nexport const toolAnnotationsSchema = z.strictObject({\n title: z.string().optional(),\n readOnlyHint: z.boolean().optional(),\n destructiveHint: z.boolean().optional(),\n idempotentHint: z.boolean().optional(),\n openWorldHint: z.boolean().optional(),\n});\n\n// Fixed approval, or a predicate over the input that runs where the tool runs.\nexport const toolApprovalSchema = z.union([\n z.nativeEnum(ToolApprovalMode),\n z.strictObject({ whenInput: codeSchema }),\n]);\n\nexport const documentToolSchema = z.strictObject({\n description: z.string(),\n inputSchema: jsonSchemaSchema,\n outputSchema: jsonSchemaSchema.optional(),\n annotations: toolAnnotationsSchema.optional(),\n approval: toolApprovalSchema.optional(),\n code: codeSchema,\n});\n\nexport type DocumentToolIface = z.infer<typeof documentToolSchema>;\n\nexport const documentHookSchema = z.strictObject({\n name: z.string().min(1).max(120),\n events: z.array(z.string().min(1)).min(1),\n code: codeSchema,\n});\n\nexport type DocumentHookIface = z.infer<typeof documentHookSchema>;\n\nexport const documentSkillSchema = z.strictObject({\n name: z.string().min(1).max(120),\n description: z.string().max(2000).optional(),\n files: z.record(z.string().min(1), z.string()),\n});\n\nexport type DocumentSkillIface = z.infer<typeof documentSkillSchema>;\n\n// Features of a harness the agent can live without. Everything else the\n// agent's parts need (./harness-requirements.ts) must be supported.\nexport enum HarnessFeature {\n Skills = 'skills',\n McpTools = 'mcpTools',\n NativeToolPolicy = 'nativeToolPolicy',\n SystemInstructions = 'systemInstructions',\n}\n\nexport const harnessRecommendationSchema = z.strictObject({\n harness: z.string().min(1),\n model: z.string().min(1).optional(),\n reasoning: z.string().min(1).optional(),\n});\n\nexport const harnessRequirementSchema = z.strictObject({\n // Binding: the most a caller's harness may be allowed to do unasked.\n permissionMode: z.nativeEnum(PermissionLevel),\n optionalFeatures: z.array(z.nativeEnum(HarnessFeature)).default([]),\n // A hint: binds nobody. The platform and the SDK never act on it.\n recommended: harnessRecommendationSchema.optional(),\n});\n\nexport type HarnessRequirementIface = z.infer<typeof harnessRequirementSchema>;\n\nconst computeRequirementFor = <Access extends z.ZodType<CapabilityAccess>>(access: Access) =>\n z.strictObject({\n access,\n optional: z.boolean().default(false),\n description: z.string().max(2000).optional(),\n });\n\nexport const computeRequirementsSchema = z.strictObject({\n [Capability.Files]: computeRequirementFor(capabilityAccessSchemas[Capability.Files]).optional(),\n [Capability.Shell]: computeRequirementFor(capabilityAccessSchemas[Capability.Shell]).optional(),\n [Capability.ComputerUse]: computeRequirementFor(\n capabilityAccessSchemas[Capability.ComputerUse],\n ).optional(),\n [Capability.BrowserUse]: computeRequirementFor(\n capabilityAccessSchemas[Capability.BrowserUse],\n ).optional(),\n});\n\nexport interface ComputeRequirementIface {\n access: CapabilityAccess;\n optional: boolean;\n description?: string;\n}\n\n// MCP tool annotation hints a slot's policy selects on.\nexport const toolAnnotationSelectorSchema = z\n .strictObject({\n readOnlyHint: z.boolean().optional(),\n destructiveHint: z.boolean().optional(),\n idempotentHint: z.boolean().optional(),\n openWorldHint: z.boolean().optional(),\n })\n .refine((selector) => Object.keys(selector).length > 0, 'Select at least one annotation');\n\n// The most an integration provided for a slot may expose. Names and `*`\n// patterns (./tool-patterns.ts); the most specific matching key governs.\nexport const integrationToolPolicySchema = z.strictObject({\n // Absent: every tool the server lists.\n allow: z.array(z.string().min(1)).optional(),\n deny: z.array(z.string().min(1)).optional(),\n // Tools listed up front; the rest stay reachable through search.\n load: z.array(z.string().min(1)).optional(),\n allowAnnotations: z.array(toolAnnotationSelectorSchema).optional(),\n denyAnnotations: z.array(toolAnnotationSelectorSchema).optional(),\n});\n\nexport const integrationRequirementSchema = z.strictObject({\n description: z.string().min(1).max(2000),\n optional: z.boolean().default(false),\n tools: integrationToolPolicySchema.optional(),\n // Tool name or pattern \u2192 approval.\n approvals: z.record(z.string().min(1), z.nativeEnum(ToolApprovalMode)).optional(),\n});\n\nexport type IntegrationRequirementIface = z.infer<typeof integrationRequirementSchema>;\n\nexport const requirementsSchema = z.strictObject({\n harness: harnessRequirementSchema,\n compute: computeRequirementsSchema.default({}),\n integrations: z\n .record(z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/), integrationRequirementSchema)\n .default({}),\n});\n\nexport type RequirementsIface = z.infer<typeof requirementsSchema>;\n\nexport enum ScheduleTarget {\n OwnerDirect = 'owner-direct',\n BoundConversation = 'bound-conversation',\n}\n\nexport const documentScheduleSchema = z.strictObject({\n key: z.string().min(1),\n cron: z.string().min(1),\n timezone: z.string().min(1),\n prompt: z.string().min(1),\n target: z.nativeEnum(ScheduleTarget),\n});\n\nexport const agentIdentitySchema = z.strictObject({\n name: z.string().min(1).max(120),\n description: z.string().max(2000).nullable().default(null),\n avatar: agentAvatarSchema.optional(),\n});\n\nexport const agentDocumentSchema = z.strictObject({\n version: z.literal(AGENT_DOCUMENT_VERSION),\n identity: agentIdentitySchema,\n // Markdown, given to the harness as system instructions.\n instructions: z.string().max(200_000).default(''),\n skills: z.array(documentSkillSchema).default([]),\n require: requirementsSchema,\n // Files written into the workspace of whatever provides `files`, once per sandbox.\n workspace: z.record(z.string().min(1), z.string()).default({}),\n // Key is the tool's name.\n tools: z.record(z.string().regex(/^[a-zA-Z0-9_-]{1,64}$/), documentToolSchema).default({}),\n hooks: z.array(documentHookSchema).default([]),\n // Approval for the harness's own tools, by capability or tool name\n // (`shell`, `files.write`).\n toolPolicy: z.record(z.string().min(1), z.nativeEnum(ToolApprovalMode)).default({}),\n // Project secrets the agent's code may read, by name.\n secrets: z.array(z.string().min(1)).default([]),\n schedules: z.array(documentScheduleSchema).default([]),\n});\n\nexport type AgentDocumentIface = z.output<typeof agentDocumentSchema>;\nexport type AgentDocumentInputIface = z.input<typeof agentDocumentSchema>;\n\n// Names of the tools and hooks whose code only runs in the creating process.\nexport const inProcessCodeOf = (document: AgentDocumentIface): string[] => {\n const names: string[] = [];\n for (const [name, tool] of Object.entries(document.tools)) {\n if (tool.code.placement === CodePlacement.InProcess) names.push(name);\n else if (\n typeof tool.approval === 'object' &&\n tool.approval.whenInput.placement === CodePlacement.InProcess\n )\n names.push(`${name} (approval)`);\n }\n for (const hook of document.hooks)\n if (hook.code.placement === CodePlacement.InProcess) names.push(`hook ${hook.name}`);\n return names;\n};\n\n// The compute requirements in a fixed order, with defaults applied.\nexport const computeRequirementsOf = (\n document: AgentDocumentIface,\n): [Capability, ComputeRequirementIface][] => {\n const entries: [Capability, ComputeRequirementIface][] = [];\n for (const capability of Object.values(Capability)) {\n const requirement = document.require.compute[capability];\n if (requirement != null) entries.push([capability, requirement]);\n }\n return entries;\n};\n\n// The agent's identity: the content hash of its document with defaults\n// applied, so a document written out in full and one leaving defaults out are\n// the same agent. Nothing a caller provides (harness settings, compute,\n// integrations) is part of it.\nexport const agentDocumentHash = async (document: AgentDocumentInputIface): Promise<string> =>\n contentHash(\n jsonValueSchema.parse(JSON.parse(JSON.stringify(agentDocumentSchema.parse(document)))),\n );\n"],
5
- "mappings": "AAAA,YAAY,OAAO;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB,uBAAuB;AAY3C,MAAM,yBAAyB;AAE/B,IAAK,gBAAL,kBAAKA,mBAAL;AAEL,EAAAA,eAAA,eAAY;AAEZ,EAAAA,eAAA,gBAAa;AAJH,SAAAA;AAAA,GAAA;AAOL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,SAAM;AAFI,SAAAA;AAAA,GAAA;AAOL,MAAM,yBAAyB,EAAE,aAAa;AAAA,EACnD,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL,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,CAAC,CAAC;AAAA;AAAA;AAAA,EAG7C,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,WAAW,gBAAgB,CAAC,EAAE,QAAQ,CAAC,CAAC;AAAA;AAAA,EAElF,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAAA,EAC9C,WAAW,EAAE,MAAM,sBAAsB,EAAE,QAAQ,CAAC,CAAC;AACvD,CAAC;AAMM,MAAM,kBAAkB,CAAC,aAA2C;AACzE,QAAM,QAAkB,CAAC;AACzB,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,SAAS,KAAK,GAAG;AACzD,QAAI,KAAK,KAAK,cAAc,6BAAyB,OAAM,KAAK,IAAI;AAAA,aAElE,OAAO,KAAK,aAAa,YACzB,KAAK,SAAS,UAAU,cAAc;AAEtC,YAAM,KAAK,GAAG,IAAI,aAAa;AAAA,EACnC;AACA,aAAW,QAAQ,SAAS;AAC1B,QAAI,KAAK,KAAK,cAAc,6BAAyB,OAAM,KAAK,QAAQ,KAAK,IAAI,EAAE;AACrF,SAAO;AACT;AAGO,MAAM,wBAAwB,CACnC,aAC4C;AAC5C,QAAM,UAAmD,CAAC;AAC1D,aAAW,cAAc,OAAO,OAAO,UAAU,GAAG;AAClD,UAAM,cAAc,SAAS,QAAQ,QAAQ,UAAU;AACvD,QAAI,eAAe,KAAM,SAAQ,KAAK,CAAC,YAAY,WAAW,CAAC;AAAA,EACjE;AACA,SAAO;AACT;AAMO,MAAM,oBAAoB,OAAO,aACtC;AAAA,EACE,gBAAgB,MAAM,KAAK,MAAM,KAAK,UAAU,oBAAoB,MAAM,QAAQ,CAAC,CAAC,CAAC;AACvF;",
6
- "names": ["CodePlacement", "ToolApprovalMode", "HarnessFeature", "ScheduleTarget"]
4
+ "sourcesContent": ["import * as z from 'zod';\nimport {\n agentAvatarSchema,\n Capability,\n capabilityAccessSchemas,\n type CapabilityAccess,\n} from '@finalai/agent-protocol';\nimport { PermissionLevel } from '@finalai/agent-protocol/agent-platform';\nimport { contentHash } from \"./canonical-json.mjs\";\nimport { jsonSchemaSchema, jsonValueSchema } from \"./json.mjs\";\n\n// The agent's document (manifest v5): everything an agent is, as data. It\n// states what the agent requires and never what provides it: no sandboxes,\n// servers, credentials, models or harness placement. A session pins one\n// document by its content hash (./canonical-json.ts).\n//\n// Custom code is part of the document only when it runs on Final's runtime:\n// a serverless tool or hook carries its self-contained ES module source. An\n// in-process one carries only its interface; its body never leaves the\n// process that created the session.\n\nexport const AGENT_DOCUMENT_VERSION = 5;\n\nexport enum CodePlacement {\n // Runs in the process that created the session, over its connection.\n InProcess = 'in-process',\n // Runs on Final's runtime from the source in the document.\n Serverless = 'serverless',\n}\n\nexport enum ToolApprovalMode {\n Allow = 'allow',\n Ask = 'ask',\n}\n\n// One self-contained ES module. It may use the runtime's globals (`fetch`,\n// `crypto`, `URL`, ...) and its `ctx` argument; it imports nothing.\nexport const serverlessSourceSchema = z.strictObject({\n source: z\n .string()\n .min(1)\n .max(4 * 1024 * 1024),\n // The module export implementing it.\n export: z.string().min(1).default('default'),\n});\n\nexport const codeSchema = z.discriminatedUnion('placement', [\n z.strictObject({ placement: z.literal(CodePlacement.InProcess) }),\n z.strictObject({\n placement: z.literal(CodePlacement.Serverless),\n ...serverlessSourceSchema.shape,\n }),\n]);\n\nexport type CodeIface = z.infer<typeof codeSchema>;\n\nexport const toolAnnotationsSchema = z.strictObject({\n title: z.string().optional(),\n readOnlyHint: z.boolean().optional(),\n destructiveHint: z.boolean().optional(),\n idempotentHint: z.boolean().optional(),\n openWorldHint: z.boolean().optional(),\n});\n\n// Fixed approval, or a predicate over the input that runs where the tool runs.\nexport const toolApprovalSchema = z.union([\n z.nativeEnum(ToolApprovalMode),\n z.strictObject({ whenInput: codeSchema }),\n]);\n\nexport const documentToolSchema = z.strictObject({\n description: z.string(),\n inputSchema: jsonSchemaSchema,\n outputSchema: jsonSchemaSchema.optional(),\n annotations: toolAnnotationsSchema.optional(),\n approval: toolApprovalSchema.optional(),\n code: codeSchema,\n});\n\nexport type DocumentToolIface = z.infer<typeof documentToolSchema>;\n\nexport const documentHookSchema = z.strictObject({\n name: z.string().min(1).max(120),\n events: z.array(z.string().min(1)).min(1),\n code: codeSchema,\n});\n\nexport type DocumentHookIface = z.infer<typeof documentHookSchema>;\n\nexport const documentSkillSchema = z.strictObject({\n name: z.string().min(1).max(120),\n description: z.string().max(2000).optional(),\n files: z.record(z.string().min(1), z.string()),\n});\n\nexport type DocumentSkillIface = z.infer<typeof documentSkillSchema>;\n\n// Features of a harness the agent can live without. Everything else the\n// agent's parts need (./harness-requirements.ts) must be supported.\nexport enum HarnessFeature {\n Skills = 'skills',\n McpTools = 'mcpTools',\n NativeToolPolicy = 'nativeToolPolicy',\n SystemInstructions = 'systemInstructions',\n}\n\nexport const harnessRecommendationSchema = z.strictObject({\n harness: z.string().min(1),\n model: z.string().min(1).optional(),\n reasoning: z.string().min(1).optional(),\n});\n\nexport const harnessRequirementSchema = z.strictObject({\n // Binding: the most a caller's harness may be allowed to do unasked.\n permissionMode: z.nativeEnum(PermissionLevel),\n optionalFeatures: z.array(z.nativeEnum(HarnessFeature)).default([]),\n // A hint: binds nobody. The platform and the SDK never act on it.\n recommended: harnessRecommendationSchema.optional(),\n});\n\nexport type HarnessRequirementIface = z.infer<typeof harnessRequirementSchema>;\n\nconst computeRequirementFor = <Access extends z.ZodType<CapabilityAccess>>(access: Access) =>\n z.strictObject({\n access,\n optional: z.boolean().default(false),\n description: z.string().max(2000).optional(),\n });\n\nexport const computeRequirementsSchema = z.strictObject({\n [Capability.Files]: computeRequirementFor(capabilityAccessSchemas[Capability.Files]).optional(),\n [Capability.Shell]: computeRequirementFor(capabilityAccessSchemas[Capability.Shell]).optional(),\n [Capability.ComputerUse]: computeRequirementFor(\n capabilityAccessSchemas[Capability.ComputerUse],\n ).optional(),\n [Capability.BrowserUse]: computeRequirementFor(\n capabilityAccessSchemas[Capability.BrowserUse],\n ).optional(),\n});\n\nexport interface ComputeRequirementIface {\n access: CapabilityAccess;\n optional: boolean;\n description?: string;\n}\n\n// MCP tool annotation hints a slot's policy selects on.\nexport const toolAnnotationSelectorSchema = z\n .strictObject({\n readOnlyHint: z.boolean().optional(),\n destructiveHint: z.boolean().optional(),\n idempotentHint: z.boolean().optional(),\n openWorldHint: z.boolean().optional(),\n })\n .refine((selector) => Object.keys(selector).length > 0, 'Select at least one annotation');\n\n// The most an integration provided for a slot may expose. Names and `*`\n// patterns (./tool-patterns.ts); the most specific matching key governs.\nexport const integrationToolPolicySchema = z.strictObject({\n // Absent: every tool the server lists.\n allow: z.array(z.string().min(1)).optional(),\n deny: z.array(z.string().min(1)).optional(),\n // Tools listed up front; the rest stay reachable through search.\n load: z.array(z.string().min(1)).optional(),\n allowAnnotations: z.array(toolAnnotationSelectorSchema).optional(),\n denyAnnotations: z.array(toolAnnotationSelectorSchema).optional(),\n});\n\nexport const integrationRequirementSchema = z.strictObject({\n description: z.string().min(1).max(2000),\n optional: z.boolean().default(false),\n tools: integrationToolPolicySchema.optional(),\n // Tool name or pattern \u2192 approval.\n approvals: z.record(z.string().min(1), z.nativeEnum(ToolApprovalMode)).optional(),\n});\n\nexport type IntegrationRequirementIface = z.infer<typeof integrationRequirementSchema>;\n\nexport const requirementsSchema = z.strictObject({\n harness: harnessRequirementSchema,\n compute: computeRequirementsSchema.default({}),\n integrations: z\n .record(z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/), integrationRequirementSchema)\n .default({}),\n});\n\nexport type RequirementsIface = z.infer<typeof requirementsSchema>;\n\nexport const agentIdentitySchema = z.strictObject({\n name: z.string().min(1).max(120),\n description: z.string().max(2000).nullable().default(null),\n avatar: agentAvatarSchema.optional(),\n});\n\nexport const agentDocumentSchema = z.strictObject({\n version: z.literal(AGENT_DOCUMENT_VERSION),\n identity: agentIdentitySchema,\n // Markdown, given to the harness as system instructions.\n instructions: z.string().max(200_000).default(''),\n skills: z.array(documentSkillSchema).default([]),\n require: requirementsSchema,\n // Files written into the workspace of whatever provides `files`, once per sandbox.\n workspace: z.record(z.string().min(1), z.string()).default({}),\n // Key is the tool's name.\n tools: z.record(z.string().regex(/^[a-zA-Z0-9_-]{1,64}$/), documentToolSchema).default({}),\n hooks: z.array(documentHookSchema).default([]),\n // Approval for the harness's own tools, by capability or tool name\n // (`shell`, `files.write`).\n toolPolicy: z.record(z.string().min(1), z.nativeEnum(ToolApprovalMode)).default({}),\n // Project secrets the agent's code may read, by name.\n secrets: z.array(z.string().min(1)).default([]),\n});\n\nexport type AgentDocumentIface = z.output<typeof agentDocumentSchema>;\nexport type AgentDocumentInputIface = z.input<typeof agentDocumentSchema>;\n\n// Names of the tools and hooks whose code only runs in the creating process.\nexport const inProcessCodeOf = (document: AgentDocumentIface): string[] => {\n const names: string[] = [];\n for (const [name, tool] of Object.entries(document.tools)) {\n if (tool.code.placement === CodePlacement.InProcess) names.push(name);\n else if (\n typeof tool.approval === 'object' &&\n tool.approval.whenInput.placement === CodePlacement.InProcess\n )\n names.push(`${name} (approval)`);\n }\n for (const hook of document.hooks)\n if (hook.code.placement === CodePlacement.InProcess) names.push(`hook ${hook.name}`);\n return names;\n};\n\n// The compute requirements in a fixed order, with defaults applied.\nexport const computeRequirementsOf = (\n document: AgentDocumentIface,\n): [Capability, ComputeRequirementIface][] => {\n const entries: [Capability, ComputeRequirementIface][] = [];\n for (const capability of Object.values(Capability)) {\n const requirement = document.require.compute[capability];\n if (requirement != null) entries.push([capability, requirement]);\n }\n return entries;\n};\n\n// The agent's identity: the content hash of its document with defaults\n// applied, so a document written out in full and one leaving defaults out are\n// the same agent. Nothing a caller provides (harness settings, compute,\n// integrations) is part of it.\nexport const agentDocumentHash = async (document: AgentDocumentInputIface): Promise<string> =>\n contentHash(\n jsonValueSchema.parse(JSON.parse(JSON.stringify(agentDocumentSchema.parse(document)))),\n );\n"],
5
+ "mappings": "AAAA,YAAY,OAAO;AACnB;AAAA,E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AA,EACzF,OAAO,EAAE,MAAM,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAAA;AAAA;AAAA,EAG7C,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,WAAW,gBAAgB,CAAC,EAAE,QAAQ,CAAC,CAAC;AAAA;AAAA,EAElF,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAChD,CAAC;AAMM,MAAM,kBAAkB,CAAC,aAA2C;AACzE,QAAM,QAAkB,CAAC;AACzB,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,SAAS,KAAK,GAAG;AACzD,QAAI,KAAK,KAAK,cAAc,6BAAyB,OAAM,KAAK,IAAI;AAAA,aAElE,OAAO,KAAK,aAAa,YACzB,KAAK,SAAS,UAAU,cAAc;AAEtC,YAAM,KAAK,GAAG,IAAI,aAAa;AAAA,EACnC;AACA,aAAW,QAAQ,SAAS;AAC1B,QAAI,KAAK,KAAK,cAAc,6BAAyB,OAAM,KAAK,QAAQ,KAAK,IAAI,EAAE;AACrF,SAAO;AACT;AAGO,MAAM,wBAAwB,CACnC,aAC4C;AAC5C,QAAM,UAAmD,CAAC;AAC1D,aAAW,cAAc,OAAO,OAAO,UAAU,GAAG;AAClD,UAAM,cAAc,SAAS,QAAQ,QAAQ,UAAU;AACvD,QAAI,eAAe,KAAM,SAAQ,KAAK,CAAC,YAAY,WAAW,CAAC;AAAA,EACjE;AACA,SAAO;AACT;AAMO,MAAM,oBAAoB,OAAO,aACtC;AAAA,EACE,gBAAgB,MAAM,KAAK,MAAM,KAAK,UAAU,oBAAoB,MAAM,QAAQ,CAAC,CAAC,CAAC;AACvF;",
6
+ "names": ["CodePlacement", "ToolApprovalMode", "HarnessFeature"]
7
7
  }
@@ -6,7 +6,6 @@ export * from "./harness-definition.mjs";
6
6
  export * from "./harness-provider.mjs";
7
7
  export * from "./json.mjs";
8
8
  export * from "./document.mjs";
9
- export * from "./room-surface.mjs";
10
9
  export * from "./sandbox/types.mjs";
11
10
  export * from "./schemas.mjs";
12
11
  export * from "./tool-annotations.mjs";
@@ -13,7 +13,6 @@ export * from "./harness-definition.mjs";
13
13
  export * from "./harness-provider.mjs";
14
14
  export * from "./json.mjs";
15
15
  export * from "./document.mjs";
16
- export * from "./room-surface.mjs";
17
16
  export * from "./sandbox/types.mjs";
18
17
  export * from "./schemas.mjs";
19
18
  export * from "./tool-annotations.mjs";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/index.ts"],
4
- "sourcesContent": ["export {\n ProcessInspectionOperation,\n inspectedProcessSchema,\n processInspectionDetailSchema,\n processInspectionPageSchema,\n processInspectionRequestSchema,\n processInspectionResultSchema,\n type InspectedProcessIface,\n type ProcessInspectionDetailIface,\n type ProcessInspectionPageIface,\n type ProcessInspectionRequestIface,\n type ProcessInspectionResultIface,\n} from '@finalai/agent-protocol/process-inspection';\nexport * from \"./channel.mjs\";\nexport * from \"./harness.mjs\";\nexport * from \"./harness-configuration.mjs\";\nexport * from \"./harness-definition.mjs\";\nexport * from \"./harness-provider.mjs\";\nexport * from \"./json.mjs\";\nexport * from \"./document.mjs\";\nexport * from \"./room-surface.mjs\";\nexport * from \"./sandbox/types.mjs\";\nexport * from \"./schemas.mjs\";\nexport * from \"./tool-annotations.mjs\";\nexport * from \"./tool-patterns.mjs\";\nexport * from \"./tool-descriptor.mjs\";\nexport * from \"./sandbox/grant.mjs\";\nexport * from \"./sandbox/setup/index.mjs\";\nexport * from \"./code-host/index.mjs\";\n\nexport * from \"./semantic-events.mjs\";\n\nexport * from \"./sandbox/snapshots.mjs\";\n\nexport {\n SandboxEditorOperation,\n sandboxEditorRequestSchema,\n sandboxEditorResultSchema,\n sandboxEditorSessionSchema,\n type SandboxEditorRequestIface,\n type SandboxEditorResultIface,\n type SandboxEditorSessionIface,\n} from \"./sandbox/editor.mjs\";\nexport * from \"./canonical-json.mjs\";\nexport * from \"./harness-requirements.mjs\";\nexport * from \"./inference.mjs\";\nexport * from \"./requirements-check.mjs\";\n"],
5
- "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
4
+ "sourcesContent": ["export {\n ProcessInspectionOperation,\n inspectedProcessSchema,\n processInspectionDetailSchema,\n processInspectionPageSchema,\n processInspectionRequestSchema,\n processInspectionResultSchema,\n type InspectedProcessIface,\n type ProcessInspectionDetailIface,\n type ProcessInspectionPageIface,\n type ProcessInspectionRequestIface,\n type ProcessInspectionResultIface,\n} from '@finalai/agent-protocol/process-inspection';\nexport * from \"./channel.mjs\";\nexport * from \"./harness.mjs\";\nexport * from \"./harness-configuration.mjs\";\nexport * from \"./harness-definition.mjs\";\nexport * from \"./harness-provider.mjs\";\nexport * from \"./json.mjs\";\nexport * from \"./document.mjs\";\nexport * from \"./sandbox/types.mjs\";\nexport * from \"./schemas.mjs\";\nexport * from \"./tool-annotations.mjs\";\nexport * from \"./tool-patterns.mjs\";\nexport * from \"./tool-descriptor.mjs\";\nexport * from \"./sandbox/grant.mjs\";\nexport * from \"./sandbox/setup/index.mjs\";\nexport * from \"./code-host/index.mjs\";\n\nexport * from \"./semantic-events.mjs\";\n\nexport * from \"./sandbox/snapshots.mjs\";\n\nexport {\n SandboxEditorOperation,\n sandboxEditorRequestSchema,\n sandboxEditorResultSchema,\n sandboxEditorSessionSchema,\n type SandboxEditorRequestIface,\n type SandboxEditorResultIface,\n type SandboxEditorSessionIface,\n} from \"./sandbox/editor.mjs\";\nexport * from \"./canonical-json.mjs\";\nexport * from \"./harness-requirements.mjs\";\nexport * from \"./inference.mjs\";\nexport * from \"./requirements-check.mjs\";\n"],
5
+ "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
@@ -2,7 +2,7 @@ import type { ChannelReceiveContextIface, ChannelCredentialsIface } from "./chan
2
2
  import type { JsonObject } from "./json.mjs";
3
3
  export interface LocalChannelContextOptionsIface {
4
4
  config?: JsonObject;
5
- secret(name: string): Promise<string | null>;
5
+ secret(slot: string): Promise<string | null>;
6
6
  credentials?: ChannelCredentialsIface;
7
7
  url?: string;
8
8
  fetch?: typeof fetch;
@@ -21,7 +21,7 @@ const createLocalChannelContext = (options) => {
21
21
  binding: {
22
22
  id: "local",
23
23
  url: options.url ?? "http://localhost",
24
- owner: { kind: "install", installId: "local" }
24
+ projectId: "local"
25
25
  },
26
26
  config: options.config ?? {},
27
27
  credentials: {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/local-channel-context.ts"],
4
- "sourcesContent": ["import type { ChannelReceiveContextIface, ChannelCredentialsIface } from \"./channel.mjs\";\nimport type { JsonObject } from \"./json.mjs\";\nexport interface LocalChannelContextOptionsIface {\n config?: JsonObject;\n secret(name: string): Promise<string | null>;\n credentials?: ChannelCredentialsIface;\n url?: string;\n fetch?: typeof fetch;\n}\n// Local route previews can validate and log ingress; authenticated platform operations require a host.\nexport const createLocalChannelContext = (\n options: LocalChannelContextOptionsIface,\n): ChannelReceiveContextIface => {\n const unavailable = (): never => {\n throw new Error('This channel operation needs an authenticated Final host.');\n };\n const noStream = (): AsyncIterable<never> => ({\n [Symbol.asyncIterator]: () => ({ next: async () => unavailable() }),\n });\n const credentials: ChannelCredentialsIface = options.credentials ?? {\n client: async () => unavailable(),\n verify: async () => unavailable(),\n exchange: async () => unavailable(),\n redirect: async () => unavailable(),\n connect: async () => unavailable(),\n secret: options.secret,\n fetch: async (input, init) => {\n if (init?.credential != null && init.credential.kind !== 'none') return unavailable();\n return (options.fetch ?? globalThis.fetch)(input, { ...init, redirect: 'manual' });\n },\n };\n return {\n binding: {\n id: 'local',\n url: options.url ?? 'http://localhost',\n owner: { kind: 'install', installId: 'local' },\n },\n config: options.config ?? {},\n credentials: {\n client: () => credentials.client(),\n verify: (value) => credentials.verify(value),\n exchange: (value) => credentials.exchange(value),\n redirect: (value) => credentials.redirect(value),\n connect: (value) => credentials.connect(value),\n fetch: (input, init) => credentials.fetch(input, init),\n secret: options.secret,\n },\n people: {\n resolve: async () => unavailable(),\n identify: async () => unavailable(),\n confirm: async () => unavailable(),\n revoke: async () => unavailable(),\n },\n places: {\n resolve: async () => unavailable(),\n observers: async () => unavailable(),\n connect: async () => unavailable(),\n disconnect: async () => unavailable(),\n follow: async () => unavailable(),\n unfollow: async () => unavailable(),\n },\n conversation: () => ({\n post: async () => unavailable(),\n input: async () => unavailable(),\n attach: async () => unavailable(),\n edit: async () => unavailable(),\n remove: async () => unavailable(),\n react: async () => unavailable(),\n }),\n observe: noStream,\n decisions: { resolve: async () => unavailable() },\n turns: { cancel: async () => unavailable() },\n store: { get: async () => unavailable(), set: async () => unavailable() },\n log: () => undefined,\n };\n};\n"],
5
- "mappings": "AAUO,MAAM,4BAA4B,CACvC,YAC+B;AAC/B,QAAM,cAAc,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AAQ,YAAY,YAAY;AAAA,IAClC;AAAA,IACA,QAAQ;AAAA,MACN,SAAS,YAAY,YAAY;AAAA,MACjC,WAAW,YAAY,YAAY;AAAA,MACnC,SAAS,YAAY,YAAY;AAAA,MACjC,YAAY,YAAY,YAAY;AAAA,MACpC,QAAQ,YAAY,YAAY;AAAA,MAChC,UAAU,YAAY,YAAY;AAAA,IACpC;AAAA,IACA,cAAc,OAAO;AAAA,MACnB,MAAM,YAAY,YAAY;AAAA,MAC9B,OAAO,YAAY,YAAY;AAAA,MAC/B,QAAQ,YAAY,YAAY;AAAA,MAChC,MAAM,YAAY,YAAY;AAAA,MAC9B,QAAQ,YAAY,YAAY;AAAA,MAChC,OAAO,YAAY,YAAY;AAAA,IACjC;AAAA,IACA,SAAS;AAAA,IACT,WAAW,EAAE,SAAS,YAAY,YAAY,EAAE;AAAA,IAChD,OAAO,EAAE,QAAQ,YAAY,YAAY,EAAE;AAAA,IAC3C,OAAO,EAAE,KAAK,YAAY,YAAY,GAAG,KAAK,YAAY,YAAY,EAAE;AAAA,IACxE,KAAK,MAAM;AAAA,EACb;AACF;",
4
+ "sourcesContent": ["import type { ChannelReceiveContextIface, ChannelCredentialsIface } from \"./channel.mjs\";\nimport type { JsonObject } from \"./json.mjs\";\nexport interface LocalChannelContextOptionsIface {\n config?: JsonObject;\n secret(slot: string): Promise<string | null>;\n credentials?: ChannelCredentialsIface;\n url?: string;\n fetch?: typeof fetch;\n}\n// Local route previews can validate and log ingress; authenticated platform operations require a host.\nexport const createLocalChannelContext = (\n options: LocalChannelContextOptionsIface,\n): ChannelReceiveContextIface => {\n const unavailable = (): never => {\n throw new Error('This channel operation needs an authenticated Final host.');\n };\n const noStream = (): AsyncIterable<never> => ({\n [Symbol.asyncIterator]: () => ({ next: async () => unavailable() }),\n });\n const credentials: ChannelCredentialsIface = options.credentials ?? {\n client: async () => unavailable(),\n verify: async () => unavailable(),\n exchange: async () => unavailable(),\n redirect: async () => unavailable(),\n connect: async () => unavailable(),\n secret: options.secret,\n fetch: async (input, init) => {\n if (init?.credential != null && init.credential.kind !== 'none') return unavailable();\n return (options.fetch ?? globalThis.fetch)(input, { ...init, redirect: 'manual' });\n },\n };\n return {\n binding: {\n id: 'local',\n url: options.url ?? 'http://localhost',\n projectId: 'local',\n },\n config: options.config ?? {},\n credentials: {\n client: () => credentials.client(),\n verify: (value) => credentials.verify(value),\n exchange: (value) => credentials.exchange(value),\n redirect: (value) => credentials.redirect(value),\n connect: (value) => credentials.connect(value),\n fetch: (input, init) => credentials.fetch(input, init),\n secret: options.secret,\n },\n people: {\n resolve: async () => unavailable(),\n identify: async () => unavailable(),\n confirm: async () => unavailable(),\n revoke: async () => unavailable(),\n },\n places: {\n resolve: async () => unavailable(),\n observers: async () => unavailable(),\n connect: async () => unavailable(),\n disconnect: async () => unavailable(),\n follow: async () => unavailable(),\n unfollow: async () => unavailable(),\n },\n conversation: () => ({\n post: async () => unavailable(),\n input: async () => unavailable(),\n attach: async () => unavailable(),\n edit: async () => unavailable(),\n remove: async () => unavailable(),\n react: async () => unavailable(),\n }),\n observe: noStream,\n decisions: { resolve: async () => unavailable() },\n turns: { cancel: async () => unavailable() },\n store: { get: async () => unavailable(), set: async () => unavailable() },\n log: () => undefined,\n };\n};\n"],
5
+ "mappings": "AAUO,MAAM,4BAA4B,CACvC,YAC+B;AAC/B,QAAM,cAAc,MAAa;AAC/B,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AACA,QAAM,WAAW,OAA6B;AAAA,IAC5C,CAAC,OAAO,aAAa,GAAG,OAAO,EAAE,MAAM,YAAY,YAAY,EAAE;AAAA,EACnE;AACA,QAAM,cAAuC,QAAQ,eAAe;AAAA,IAClE,QAAQ,YAAY,YAAY;AAAA,IAChC,QAAQ,YAAY,YAAY;AAAA,IAChC,UAAU,YAAY,YAAY;AAAA,IAClC,UAAU,YAAY,YAAY;AAAA,IAClC,SAAS,YAAY,YAAY;AAAA,IACjC,QAAQ,QAAQ;AAAA,IAChB,O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