@finalai/agent-provider 0.9.0 → 0.10.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 (200) hide show
  1. package/HOSTING.md +334 -245
  2. package/README.md +93 -14
  3. package/dist/modules/canonical-json.d.mts +4 -0
  4. package/dist/modules/canonical-json.mjs +33 -0
  5. package/dist/modules/canonical-json.mjs.map +7 -0
  6. package/dist/modules/channel.d.mts +0 -3
  7. package/dist/modules/channel.mjs.map +1 -1
  8. package/dist/modules/code-host/host.d.mts +10 -0
  9. package/dist/modules/code-host/host.mjs +88 -0
  10. package/dist/modules/code-host/host.mjs.map +7 -0
  11. package/dist/modules/code-host/in-process.d.mts +24 -0
  12. package/dist/modules/code-host/in-process.mjs +89 -0
  13. package/dist/modules/code-host/in-process.mjs.map +7 -0
  14. package/dist/modules/code-host/index.d.mts +4 -0
  15. package/dist/modules/code-host/index.mjs +5 -0
  16. package/dist/modules/code-host/index.mjs.map +7 -0
  17. package/dist/modules/code-host/serverless.d.mts +63 -0
  18. package/dist/modules/code-host/serverless.mjs +27 -0
  19. package/dist/modules/code-host/serverless.mjs.map +7 -0
  20. package/dist/modules/code-host/types.d.mts +152 -0
  21. package/dist/modules/code-host/types.mjs +85 -0
  22. package/dist/modules/code-host/types.mjs.map +7 -0
  23. package/dist/modules/conformance/agent.mjs +72 -6
  24. package/dist/modules/conformance/agent.mjs.map +2 -2
  25. package/dist/modules/conformance/harness-kit.d.mts +9 -2
  26. package/dist/modules/conformance/harness-kit.mjs +224 -63
  27. package/dist/modules/conformance/harness-kit.mjs.map +3 -3
  28. package/dist/modules/conformance/local-harness.d.mts +1 -4
  29. package/dist/modules/conformance/local-harness.mjs +21 -22
  30. package/dist/modules/conformance/local-harness.mjs.map +2 -2
  31. package/dist/modules/conformance/protocol.d.mts +1 -0
  32. package/dist/modules/conformance/protocol.mjs +2 -0
  33. package/dist/modules/conformance/protocol.mjs.map +2 -2
  34. package/dist/modules/conformance/sandbox-kit.d.mts +12 -4
  35. package/dist/modules/conformance/sandbox-kit.mjs +189 -103
  36. package/dist/modules/conformance/sandbox-kit.mjs.map +2 -2
  37. package/dist/modules/conformance/scripted-model/chat-completions.mjs +1 -0
  38. package/dist/modules/conformance/scripted-model/chat-completions.mjs.map +2 -2
  39. package/dist/modules/conformance/scripted-model/directives.d.mts +3 -0
  40. package/dist/modules/conformance/scripted-model/directives.mjs +26 -10
  41. package/dist/modules/conformance/scripted-model/directives.mjs.map +2 -2
  42. package/dist/modules/conformance/scripted-model/messages.mjs +1 -0
  43. package/dist/modules/conformance/scripted-model/messages.mjs.map +2 -2
  44. package/dist/modules/conformance/scripted-model/responses.mjs +2 -0
  45. package/dist/modules/conformance/scripted-model/responses.mjs.map +2 -2
  46. package/dist/modules/conformance/stdio.d.mts +21 -0
  47. package/dist/modules/conformance/stdio.mjs +158 -0
  48. package/dist/modules/conformance/stdio.mjs.map +7 -0
  49. package/dist/modules/credential-routes.d.mts +2 -0
  50. package/dist/modules/credential-routes.mjs +2 -0
  51. package/dist/modules/credential-routes.mjs.map +2 -2
  52. package/dist/modules/document.d.mts +376 -0
  53. package/dist/modules/document.mjs +208 -0
  54. package/dist/modules/document.mjs.map +7 -0
  55. package/dist/modules/harness-configuration.d.mts +16 -0
  56. package/dist/modules/harness-configuration.mjs +83 -0
  57. package/dist/modules/harness-configuration.mjs.map +7 -0
  58. package/dist/modules/harness-definition.d.mts +280 -0
  59. package/dist/modules/harness-definition.mjs +430 -0
  60. package/dist/modules/harness-definition.mjs.map +7 -0
  61. package/dist/modules/harness-provider.d.mts +197 -0
  62. package/dist/modules/harness-provider.mjs +108 -0
  63. package/dist/modules/harness-provider.mjs.map +7 -0
  64. package/dist/modules/harness-requirements.d.mts +19 -0
  65. package/dist/modules/harness-requirements.mjs +40 -0
  66. package/dist/modules/harness-requirements.mjs.map +7 -0
  67. package/dist/modules/harness-start.d.mts +33 -0
  68. package/dist/modules/harness-start.mjs +107 -0
  69. package/dist/modules/harness-start.mjs.map +7 -0
  70. package/dist/modules/harness.d.mts +84 -109
  71. package/dist/modules/harness.mjs +56 -111
  72. package/dist/modules/harness.mjs.map +3 -3
  73. package/dist/modules/identity.d.mts +1 -0
  74. package/dist/modules/identity.mjs +2 -0
  75. package/dist/modules/identity.mjs.map +7 -0
  76. package/dist/modules/index.d.mts +12 -6
  77. package/dist/modules/index.mjs +12 -6
  78. package/dist/modules/index.mjs.map +2 -2
  79. package/dist/modules/inference.d.mts +35 -0
  80. package/dist/modules/inference.mjs +74 -0
  81. package/dist/modules/inference.mjs.map +7 -0
  82. package/dist/modules/local-channel-context.mjs +1 -1
  83. package/dist/modules/local-channel-context.mjs.map +2 -2
  84. package/dist/modules/requirements-check.d.mts +30 -0
  85. package/dist/modules/requirements-check.mjs +164 -0
  86. package/dist/modules/requirements-check.mjs.map +7 -0
  87. package/dist/modules/room-surface.d.mts +0 -5
  88. package/dist/modules/room-surface.mjs.map +2 -2
  89. package/dist/modules/sandbox/client.d.mts +3 -0
  90. package/dist/modules/sandbox/client.mjs +101 -18
  91. package/dist/modules/sandbox/client.mjs.map +2 -2
  92. package/dist/modules/sandbox/grant.d.mts +78 -0
  93. package/dist/modules/sandbox/grant.mjs +134 -0
  94. package/dist/modules/sandbox/grant.mjs.map +7 -0
  95. package/dist/modules/sandbox/index.d.mts +3 -3
  96. package/dist/modules/sandbox/index.mjs +4 -5
  97. package/dist/modules/sandbox/index.mjs.map +2 -2
  98. package/dist/modules/sandbox/mcp-hosted.d.mts +1 -1
  99. package/dist/modules/sandbox/mcp-hosted.mjs +4 -7
  100. package/dist/modules/sandbox/mcp-hosted.mjs.map +2 -2
  101. package/dist/modules/sandbox/mcp.d.mts +4 -2
  102. package/dist/modules/sandbox/mcp.mjs +14 -7
  103. package/dist/modules/sandbox/mcp.mjs.map +2 -2
  104. package/dist/modules/sandbox/memory-sandbox.d.mts +2 -1
  105. package/dist/modules/sandbox/memory-sandbox.mjs +71 -41
  106. package/dist/modules/sandbox/memory-sandbox.mjs.map +2 -2
  107. package/dist/modules/sandbox/networking.d.mts +7 -7
  108. package/dist/modules/sandbox/networking.mjs +16 -9
  109. package/dist/modules/sandbox/networking.mjs.map +2 -2
  110. package/dist/modules/sandbox/remote/adapter.d.mts +30 -0
  111. package/dist/modules/sandbox/remote/adapter.mjs +381 -0
  112. package/dist/modules/sandbox/remote/adapter.mjs.map +7 -0
  113. package/dist/modules/sandbox/remote/errors.d.mts +10 -0
  114. package/dist/modules/sandbox/remote/errors.mjs +62 -0
  115. package/dist/modules/sandbox/remote/errors.mjs.map +7 -0
  116. package/dist/modules/sandbox/remote/index.d.mts +5 -0
  117. package/dist/modules/sandbox/remote/index.mjs +6 -0
  118. package/dist/modules/sandbox/remote/index.mjs.map +7 -0
  119. package/dist/modules/sandbox/remote/ndjson.d.mts +6 -0
  120. package/dist/modules/sandbox/remote/ndjson.mjs +80 -0
  121. package/dist/modules/sandbox/remote/ndjson.mjs.map +7 -0
  122. package/dist/modules/sandbox/remote/platform-api.d.mts +8 -0
  123. package/dist/modules/sandbox/remote/platform-api.mjs +15 -0
  124. package/dist/modules/sandbox/remote/platform-api.mjs.map +7 -0
  125. package/dist/modules/sandbox/remote/preamble.d.mts +7 -0
  126. package/dist/modules/sandbox/remote/preamble.mjs +51 -0
  127. package/dist/modules/sandbox/remote/preamble.mjs.map +7 -0
  128. package/dist/modules/sandbox/remote/serve.d.mts +34 -0
  129. package/dist/modules/sandbox/remote/serve.mjs +519 -0
  130. package/dist/modules/sandbox/remote/serve.mjs.map +7 -0
  131. package/dist/modules/sandbox/remote/testing.d.mts +34 -0
  132. package/dist/modules/sandbox/remote/testing.mjs +275 -0
  133. package/dist/modules/sandbox/remote/testing.mjs.map +7 -0
  134. package/dist/modules/sandbox/seeds.d.mts +2 -2
  135. package/dist/modules/sandbox/seeds.mjs +2 -2
  136. package/dist/modules/sandbox/seeds.mjs.map +2 -2
  137. package/dist/modules/sandbox/server.d.mts +4 -6
  138. package/dist/modules/sandbox/server.mjs +93 -49
  139. package/dist/modules/sandbox/server.mjs.map +2 -2
  140. package/dist/modules/sandbox/setup/apply.d.mts +41 -0
  141. package/dist/modules/sandbox/setup/apply.mjs +204 -0
  142. package/dist/modules/sandbox/setup/apply.mjs.map +7 -0
  143. package/dist/modules/sandbox/setup/describe.d.mts +10 -0
  144. package/dist/modules/sandbox/setup/describe.mjs +62 -0
  145. package/dist/modules/sandbox/setup/describe.mjs.map +7 -0
  146. package/dist/modules/sandbox/setup/index.d.mts +6 -0
  147. package/dist/modules/sandbox/setup/index.mjs +17 -0
  148. package/dist/modules/sandbox/setup/index.mjs.map +7 -0
  149. package/dist/modules/sandbox/setup/paths.d.mts +8 -0
  150. package/dist/modules/sandbox/setup/paths.mjs +18 -0
  151. package/dist/modules/sandbox/setup/paths.mjs.map +7 -0
  152. package/dist/modules/sandbox/setup/schema.d.mts +42 -0
  153. package/dist/modules/sandbox/setup/schema.mjs +58 -0
  154. package/dist/modules/sandbox/setup/schema.mjs.map +7 -0
  155. package/dist/modules/sandbox/tool-policy.d.mts +1 -1
  156. package/dist/modules/sandbox/tool-policy.mjs +1 -1
  157. package/dist/modules/sandbox/tool-policy.mjs.map +2 -2
  158. package/dist/modules/sandbox/types.d.mts +117 -130
  159. package/dist/modules/sandbox/types.mjs +46 -50
  160. package/dist/modules/sandbox/types.mjs.map +3 -3
  161. package/dist/modules/sandbox/wire.d.mts +93 -6
  162. package/dist/modules/sandbox/wire.mjs +61 -38
  163. package/dist/modules/sandbox/wire.mjs.map +2 -2
  164. package/dist/modules/schemas.d.mts +5 -76
  165. package/dist/modules/schemas.mjs +18 -85
  166. package/dist/modules/schemas.mjs.map +2 -2
  167. package/dist/modules/tool-annotations.d.mts +15 -6
  168. package/dist/modules/tool-annotations.mjs +9 -3
  169. package/dist/modules/tool-annotations.mjs.map +2 -2
  170. package/dist/modules/tool-descriptor.d.mts +16 -0
  171. package/dist/modules/tool-descriptor.mjs +19 -0
  172. package/dist/modules/tool-descriptor.mjs.map +7 -0
  173. package/dist/modules/tool-patterns.d.mts +7 -7
  174. package/dist/modules/tool-patterns.mjs +10 -9
  175. package/dist/modules/tool-patterns.mjs.map +2 -2
  176. package/package.json +86 -36
  177. package/dist/modules/credentials.d.mts +0 -206
  178. package/dist/modules/credentials.mjs +0 -207
  179. package/dist/modules/credentials.mjs.map +0 -7
  180. package/dist/modules/dynamic.d.mts +0 -40
  181. package/dist/modules/dynamic.mjs +0 -79
  182. package/dist/modules/dynamic.mjs.map +0 -7
  183. package/dist/modules/hosted-bindings.d.mts +0 -15
  184. package/dist/modules/hosted-bindings.mjs +0 -21
  185. package/dist/modules/hosted-bindings.mjs.map +0 -7
  186. package/dist/modules/manifest.d.mts +0 -791
  187. package/dist/modules/manifest.mjs +0 -322
  188. package/dist/modules/manifest.mjs.map +0 -7
  189. package/dist/modules/provider-ref.d.mts +0 -29
  190. package/dist/modules/provider-ref.mjs +0 -55
  191. package/dist/modules/provider-ref.mjs.map +0 -7
  192. package/dist/modules/sandbox/open-scope-node.d.mts +0 -4
  193. package/dist/modules/sandbox/open-scope-node.mjs +0 -19
  194. package/dist/modules/sandbox/open-scope-node.mjs.map +0 -7
  195. package/dist/modules/sandbox/open-scope.d.mts +0 -16
  196. package/dist/modules/sandbox/open-scope.mjs +0 -66
  197. package/dist/modules/sandbox/open-scope.mjs.map +0 -7
  198. package/dist/modules/sandbox/workspace-identity.d.mts +0 -5
  199. package/dist/modules/sandbox/workspace-identity.mjs +0 -14
  200. package/dist/modules/sandbox/workspace-identity.mjs.map +0 -7
package/README.md CHANGED
@@ -1,7 +1,68 @@
1
1
  # @finalai/agent-provider
2
2
 
3
- Contracts for custom harnesses, sandboxes, channels, and credential policies, plus
4
- RPC/MCP projections and conformance tools for integration authors.
3
+ Contracts for the agent stack: the agent document and its requirements, harnesses,
4
+ sandboxes, the code host and channels, plus RPC/MCP projections and conformance
5
+ tools for integration authors.
6
+
7
+ ## Agents declare requirements; callers provide them
8
+
9
+ An agent is one JSON document (`agentDocumentSchema`, exported as `./document`):
10
+ identity, instructions, skills, the tools and hooks it defines, and what it
11
+ `require`s: a harness (a permission ceiling, the features it can live without and
12
+ an optional recommendation), compute keyed by capability (`files`, `shell`,
13
+ `computerUse`, `browserUse`, each with an access ceiling) and named integration
14
+ slots. It never names what provides them. `agentDocumentHash` is its identity: the
15
+ content hash of the canonical document, defaults applied.
16
+
17
+ Whoever starts work provides the rest as plain data: harness settings
18
+ (`{ harness, adapter?, configuration, environment? }`), a sandbox per capability and an
19
+ integration per slot. `unmetRequirements` is the single check every caller runs
20
+ before anything starts; `files` and `shell` must name the same sandbox. Inference
21
+ sources (`subscription()`, `apiKey(name)`, `finalCredits()`, `harnessLogin()`) are
22
+ an ordered list in the harness settings: the first available one wins.
23
+
24
+ Each tool and hook says where its code runs. In-process code runs in the process
25
+ that created the session; serverless code carries its own self-contained source in
26
+ the document. `createCodeHost` (`./code-host`) routes a tool call, hook or approval
27
+ predicate by that placement, and `serveInProcessCode` answers in-process calls on
28
+ the creating client's side; both speak the same invocation and line schemas.
29
+
30
+ Harnesses, ACP adapters and environments are independent pieces
31
+ (`./harness-definition`): a harness definition and an ACP adapter definition are
32
+ data with run entries per runtime kind (`process`, `worker`), an environment is a
33
+ sandbox whose provider declares the runtime kinds it runs, or an ACP endpoint at a
34
+ URL. `composeHarness` picks a runtime all three share for the requirements check,
35
+ and a harness provider (`./harness-provider`) starts adapter(harness) there and
36
+ returns the ACP endpoint.
37
+
38
+ ## Harnesses
39
+
40
+ A harness definition says what it accepts: the document features it supports,
41
+ the lowest permission it can be held to, the inference sources it can use, what it
42
+ uses natively where it runs (`files`, `shell`) and the JSON Schema of its
43
+ configuration. `validateHarnessConfiguration` (`./harness-configuration`) checks a
44
+ configuration against that schema (its `final://schemas/*` references resolve to
45
+ the shared fragments) and the definition's limits; `acceptsHarnessSettings` also
46
+ checks that the settings name the harness. `harnessCheckInputOf` turns a composed
47
+ harness into the requirements check's input. A harness is opened with the agent
48
+ document, the resolved settings and one sandbox endpoint per capability it drives.
49
+
50
+ ## Sandboxes
51
+
52
+ A sandbox is a resource. A provider implements `create`, `attach` (reporting
53
+ whether the disk is `fresh` and the machine `booted`), `detach`, `park` and
54
+ `delete`, plus `capabilities` (each capability it serves with the most access it
55
+ grants) and the cached `artifactKey`/`prepare` preparation. Every handle RPC method
56
+ is gated by the connection's per-capability grant (`./sandbox/grant`): `{ files:
57
+ 'write' }` writes files and runs nothing.
58
+
59
+ A sandbox setup (`defineSandboxSetup`, `./sandbox/setup`) is provider-neutral:
60
+ repositories, variables (values or project secrets by name), steps run once per
61
+ sandbox, services started after each boot, named commands and notes.
62
+ `applySandboxSetup` applies it through the standard handle in idempotent phases,
63
+ so a resumed sandbox redoes only what its attach lost, and passes secrets to
64
+ process environments only. `describeSandbox` reports the real checkout paths,
65
+ service URLs and commands.
5
66
 
6
67
  Sandbox networking is a composable extension. `SandboxNetworkingExtensionIface`
7
68
  owns policy persistence, controller setup, readiness and suspension; the sandbox
@@ -22,21 +83,42 @@ equivalent admission, deferred setup and failure cleanup. Namespace-only adapter
22
83
  must disclose the startup traffic window when their provider cannot fence boot.
23
84
 
24
85
  Hosts pass `credentials` (`SandboxCredentialsIface`) on sandbox contexts:
25
- `computersAccess()`, `deviceAccess({ actingUserId })` and `secret({ secretRef })`.
26
- Providers that need a third-party key take `credential: { secretRef }`
27
- (`sandboxCredentialRefSchema`) in their environment options.
86
+ `secret({ secretRef })`, resolved in the sandbox's project. Providers that need a
87
+ third-party key take `credential: { secretRef }` (`sandboxCredentialRefSchema`) in
88
+ their environment options. A backend the provider's registration was granted is
89
+ reached with `identity({ audience })`: a platform-identity assertion for that
90
+ backend, naming the sandbox and the acting user, which the backend verifies with
91
+ `/identity`. `lifecycle.parkAfterIdleMs` says when the platform parks an idle
92
+ sandbox, so a backend idle timeout can outlast it.
93
+
94
+ `/sandbox/remote` is the sandbox-provider wire. `serveSandboxProvider` serves
95
+ providers at the URLs a project registers: lifecycle calls over HTTP (long ones
96
+ answer NDJSON with heartbeats), and `/v1/attach`, a WebSocket that carries the
97
+ handle RPC once attached. Each call is authenticated by a sandbox-provider
98
+ assertion; on the attach socket `identity/refresh` replaces it when the acting
99
+ user changes. `remoteSandboxProvider` is the platform's side: an ordinary
100
+ provider over the wire that reports the applied network policy, writes the
101
+ platform's files and sets the platform's environment on every process itself.
102
+ `connectSandboxProviderInMemory` joins the two in memory, and the sandbox
103
+ conformance kit's `remote` mode runs every provider case through it.
28
104
 
29
105
  Implement the public provider interfaces and use `/conformance` to exercise them.
30
106
  Use leaf entrypoints for sandbox wire clients, servers, MCP adapters, and local
31
107
  channel sockets. These helpers adapt your integration to the provider contracts.
32
108
 
33
109
  `/conformance` provides harness and sandbox checks, profiles, and a reference harness.
110
+ The harness profiles are `plain-acp-v2` (standard ACP only), `final` (checks the
111
+ Final extensions an agent advertises) and `final-required`, which every ACP adapter
112
+ must pass: it runs each extension check (the `initialize` advertisement,
113
+ `_final/session/observe`, `_final/live_text`, `emittedAtMs`, author meta, replay
114
+ after a sequence number, provider errors) and fails those the agent does not
115
+ advertise. Fork is checked where advertised.
34
116
  `/conformance/scripted-model` provides deterministic model handlers for exercising
35
117
  your integration. The `final-agents conformance` CLI runs the harness checks.
36
118
 
37
119
  Declare `executionPolicy: { beforeExecution }` on a provider handle, or supply it
38
- in `SandboxStartContextIface` from the host. `defineSandboxProvider` automatically
39
- applies both policies to handles returned by start, resume and passive recovery;
120
+ in `SandboxResourceContextIface` from the host. `defineSandboxProvider` automatically
121
+ applies both policies to handles returned by attach and passive attach;
40
122
  the host policy runs first. Construction consumes the policy declaration so later
41
123
  composition does not reinstall it. Providers do not need to wrap execution methods.
42
124
  An ordinary provider without either policy retains its existing behavior.
@@ -64,7 +146,7 @@ retains ownership of its endpoints, with the host transport as a fallback. Pass
64
146
  Pass the complete keys from `sandboxMcpToolPolicyKeys` to `resolveSandboxToolPolicy`.
65
147
  Egress consent requires its canonical capability/action keys; arbitrary hosted
66
148
  tools can use the same display name and must retain their ordinary tool policy.
67
- When the builtin egress capability is exposed, conflicting hosted names are prefixed rather than hidden. Configure/Disable preauthorization requires its exact action key; a legacy hosted-tool `egress: Allow` cannot waive consent. Read bindings cannot change network policy, including with lifecycle authority. Handle RPC
149
+ When the builtin egress capability is exposed, conflicting hosted names are prefixed rather than hidden. Configure/Disable preauthorization requires its exact action key; a legacy hosted-tool `egress: Allow` cannot waive consent. A grant without `shell` cannot change network policy, including with lifecycle authority. Handle RPC
68
150
  hosts must supply `authorizeOperation` for Configure/Disable; without it mutations
69
151
  are refused. The host owns approval policy, including any explicit preauthorization.
70
152
 
@@ -108,7 +190,7 @@ belong to harnesses and the separately typed Final room surface.
108
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.
109
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.
110
192
 
111
- `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. Channels compile into their authored bundle; 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.
193
+ `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.
112
194
 
113
195
  A host must fail ambiguous tenant selection rather than choosing an arbitrary
114
196
  credential. Tenant-wide `people.revoke` with reason `uninstalled` or
@@ -117,11 +199,8 @@ the tenant applies this lifecycle change to the binding's namespace. A socket ha
117
199
  cleanup grace after disconnect; every other operation is revoked immediately, and all
118
200
  capabilities end when the handler returns. Attachment authorization still applies.
119
201
 
120
- Manifests record channel credentials and `surface` routes/listeners/place kinds.
121
- The `roomSurface` field describes `channels/final.ts`, the customization of the Final
122
- chat itself, which is typed separately in `@finalai/agent-provider/room-surface`.
123
- The address, attached-session and handoff channel API is removed. Existing channel
124
- authors must migrate and republish their definitions.
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`.
125
204
 
126
205
  ## Durable processes
127
206
 
@@ -0,0 +1,4 @@
1
+ import type { JsonValue } from "./json.mjs";
2
+ export declare const canonicalJson: (value: JsonValue) => string;
3
+ export declare const contentHash: (value: JsonValue) => Promise<string>;
4
+ export declare const isContentHash: (text: string) => boolean;
@@ -0,0 +1,33 @@
1
+ const canonicalJson = (value) => {
2
+ if (value === null || typeof value === "boolean") return JSON.stringify(value);
3
+ if (typeof value === "number") {
4
+ if (!Number.isFinite(value)) throw new Error("canonical JSON has no non-finite numbers");
5
+ return JSON.stringify(value);
6
+ }
7
+ if (typeof value === "string") return JSON.stringify(value);
8
+ if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
9
+ const keys = Object.keys(value).sort();
10
+ const members = [];
11
+ for (const key of keys) {
12
+ const member = value[key];
13
+ if (member === void 0) continue;
14
+ members.push(`${JSON.stringify(key)}:${canonicalJson(member)}`);
15
+ }
16
+ return `{${members.join(",")}}`;
17
+ };
18
+ const HASH_PREFIX = "sha256:";
19
+ const hex = (bytes) => Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
20
+ const contentHash = async (value) => {
21
+ const digest = await crypto.subtle.digest(
22
+ "SHA-256",
23
+ new TextEncoder().encode(canonicalJson(value))
24
+ );
25
+ return `${HASH_PREFIX}${hex(digest)}`;
26
+ };
27
+ const isContentHash = (text) => /^sha256:[0-9a-f]{64}$/.test(text);
28
+ export {
29
+ canonicalJson,
30
+ contentHash,
31
+ isContentHash
32
+ };
33
+ //# sourceMappingURL=canonical-json.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/canonical-json.ts"],
4
+ "sourcesContent": ["import type { JsonValue } from \"./json.mjs\";\n\n// RFC 8785-style canonical JSON: object keys sorted by UTF-16 code units, no\n// whitespace, numbers in their shortest round-trip form. Two documents with the\n// same data produce the same text, so the same hash.\nexport const canonicalJson = (value: JsonValue): string => {\n if (value === null || typeof value === 'boolean') return JSON.stringify(value);\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) throw new Error('canonical JSON has no non-finite numbers');\n return JSON.stringify(value);\n }\n if (typeof value === 'string') return JSON.stringify(value);\n if (Array.isArray(value)) return `[${value.map(canonicalJson).join(',')}]`;\n const keys = Object.keys(value).sort();\n const members: string[] = [];\n for (const key of keys) {\n const member = value[key];\n if (member === undefined) continue;\n members.push(`${JSON.stringify(key)}:${canonicalJson(member)}`);\n }\n return `{${members.join(',')}}`;\n};\n\nconst HASH_PREFIX = 'sha256:';\n\nconst hex = (bytes: ArrayBuffer): string =>\n Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, '0')).join('');\n\n// `sha256:<hex>` of the canonical text. Web Crypto, so it runs in Node,\n// browsers and Workers alike.\nexport const contentHash = async (value: JsonValue): Promise<string> => {\n const digest = await crypto.subtle.digest(\n 'SHA-256',\n new TextEncoder().encode(canonicalJson(value)),\n );\n return `${HASH_PREFIX}${hex(digest)}`;\n};\n\nexport const isContentHash = (text: string): boolean => /^sha256:[0-9a-f]{64}$/.test(text);\n"],
5
+ "mappings": "AAKO,MAAM,gBAAgB,CAAC,UAA6B;AACzD,MAAI,UAAU,QAAQ,OAAO,UAAU,UAAW,QAAO,KAAK,UAAU,KAAK;AAC7E,MAAI,OAAO,UAAU,UAAU;AAC7B,QAAI,CAAC,OAAO,SAAS,KAAK,EAAG,OAAM,IAAI,MAAM,0CAA0C;AACvF,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B;AACA,MAAI,OAAO,UAAU,SAAU,QAAO,KAAK,UAAU,KAAK;AAC1D,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,IAAI,MAAM,IAAI,aAAa,EAAE,KAAK,GAAG,CAAC;AACvE,QAAM,OAAO,OAAO,KAAK,KAAK,EAAE,KAAK;AACrC,QAAM,UAAoB,CAAC;AAC3B,aAAW,OAAO,MAAM;AACtB,UAAM,SAAS,MAAM,GAAG;AACxB,QAAI,WAAW,OAAW;AAC1B,YAAQ,KAAK,GAAG,KAAK,UAAU,GAAG,CAAC,IAAI,cAAc,MAAM,CAAC,EAAE;AAAA,EAChE;AACA,SAAO,IAAI,QAAQ,KAAK,GAAG,CAAC;AAC9B;AAEA,MAAM,cAAc;AAEpB,MAAM,MAAM,CAAC,UACX,MAAM,KAAK,IAAI,WAAW,KAAK,GAAG,CAAC,SAAS,KAAK,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE;AAIlF,MAAM,cAAc,OAAO,UAAsC;AACtE,QAAM,SAAS,MAAM,OAAO,OAAO;AAAA,IACjC;AAAA,IACA,IAAI,YAAY,EAAE,OAAO,cAAc,KAAK,CAAC;AAAA,EAC/C;AACA,SAAO,GAAG,WAAW,GAAG,IAAI,MAAM,CAAC;AACrC;AAEO,MAAM,gBAAgB,CAAC,SAA0B,wBAAwB,KAAK,IAAI;",
6
+ "names": []
7
+ }
@@ -261,9 +261,6 @@ export interface ChannelReceiveContextIface<Config = JsonObject> {
261
261
  id: string;
262
262
  url: string;
263
263
  owner: {
264
- kind: 'agent';
265
- definitionId: string;
266
- } | {
267
264
  kind: 'install';
268
265
  installId: string;
269
266
  };
@@ -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: 'agent'; definitionId: string } | { 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"],
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
5
  "mappings": "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",
6
6
  "names": ["ChannelReplies", "ChannelAudience", "ChannelCreate", "ChannelCredentialKind", "ChannelSigningAlgorithm", "ChannelSignatureEncoding", "ChannelOAuthClientAuthentication"]
7
7
  }
@@ -0,0 +1,10 @@
1
+ import { type AgentDocumentIface } from "../document.mjs";
2
+ import type { ServerlessRuntimeIface } from "./serverless.mjs";
3
+ import { type CodeHostIface, type CodeRunIface } from "./types.mjs";
4
+ export interface CreateCodeHostArgsIface {
5
+ document: AgentDocumentIface;
6
+ agent: string;
7
+ serverless: ServerlessRuntimeIface;
8
+ inProcess: () => CodeRunIface | null;
9
+ }
10
+ export declare const createCodeHost: (args: CreateCodeHostArgsIface) => CodeHostIface;
@@ -0,0 +1,88 @@
1
+ import {
2
+ CodePlacement,
3
+ ToolApprovalMode
4
+ } from "../document.mjs";
5
+ import {
6
+ CodeErrorCode,
7
+ CodeKind,
8
+ CodeLineType
9
+ } from "./types.mjs";
10
+ const failure = (code, message) => ({ ok: false, code, message });
11
+ const createCodeHost = (args) => {
12
+ const runner = (code) => {
13
+ if (code.placement === CodePlacement.InProcess) return args.inProcess();
14
+ return (invocation, options) => args.serverless.run(
15
+ { agent: args.agent, source: code.source, export: code.export, invocation },
16
+ options
17
+ );
18
+ };
19
+ const run = async (code, invocation, call) => {
20
+ const execute = runner(code);
21
+ if (execute == null)
22
+ return failure(
23
+ CodeErrorCode.Unavailable,
24
+ `${invocation.name} runs in the process that created the session, which is not connected`
25
+ );
26
+ try {
27
+ for await (const line of execute(invocation, { signal: call.signal })) {
28
+ if (line.type === CodeLineType.Progress) {
29
+ call.onProgress?.(line.label == null ? { data: line.data } : line);
30
+ continue;
31
+ }
32
+ if (line.type === CodeLineType.Error) return failure(CodeErrorCode.Failed, line.message);
33
+ return line.modelOutput === void 0 ? { ok: true, output: line.output } : { ok: true, output: line.output, modelOutput: line.modelOutput };
34
+ }
35
+ return failure(CodeErrorCode.Failed, `${invocation.name} ended without a result`);
36
+ } catch (cause) {
37
+ return failure(CodeErrorCode.Failed, cause instanceof Error ? cause.message : String(cause));
38
+ }
39
+ };
40
+ return {
41
+ invokeTool: async (call) => {
42
+ const tool = args.document.tools[call.name];
43
+ if (tool == null) return failure(CodeErrorCode.NotFound, `no tool ${call.name}`);
44
+ return run(
45
+ tool.code,
46
+ { kind: CodeKind.Tool, name: call.name, input: call.input, context: call.context },
47
+ call
48
+ );
49
+ },
50
+ dispatchHook: async (call) => {
51
+ const hook = args.document.hooks.find((candidate) => candidate.name === call.name);
52
+ if (hook == null) return failure(CodeErrorCode.NotFound, `no hook ${call.name}`);
53
+ return run(
54
+ hook.code,
55
+ {
56
+ kind: CodeKind.Hook,
57
+ name: call.name,
58
+ event: call.event,
59
+ payload: call.payload,
60
+ context: call.context
61
+ },
62
+ call
63
+ );
64
+ },
65
+ evaluateApproval: async (call) => {
66
+ const tool = args.document.tools[call.name];
67
+ if (tool == null) return failure(CodeErrorCode.NotFound, `no tool ${call.name}`);
68
+ const approval = tool.approval ?? ToolApprovalMode.Allow;
69
+ if (typeof approval === "string") return { ok: true, ask: approval === ToolApprovalMode.Ask };
70
+ const result = await run(
71
+ approval.whenInput,
72
+ { kind: CodeKind.Approval, name: call.name, input: call.input, context: call.context },
73
+ call
74
+ );
75
+ if (!result.ok) return result;
76
+ if (typeof result.output !== "boolean")
77
+ return failure(
78
+ CodeErrorCode.Invalid,
79
+ `the approval of ${call.name} must answer true (ask) or false (allow)`
80
+ );
81
+ return { ok: true, ask: result.output };
82
+ }
83
+ };
84
+ };
85
+ export {
86
+ createCodeHost
87
+ };
88
+ //# sourceMappingURL=host.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/code-host/host.ts"],
4
+ "sourcesContent": ["import {\n CodePlacement,\n ToolApprovalMode,\n type AgentDocumentIface,\n type CodeIface,\n} from \"../document.mjs\";\nimport type { ServerlessRuntimeIface } from \"./serverless.mjs\";\nimport {\n CodeErrorCode,\n CodeKind,\n CodeLineType,\n type ApprovalResultIface,\n type CodeCallIface,\n type CodeHostIface,\n type CodeInvocationIface,\n type CodeResultIface,\n type CodeRunIface,\n} from \"./types.mjs\";\n\nexport interface CreateCodeHostArgsIface {\n document: AgentDocumentIface;\n // The document's content hash.\n agent: string;\n // Final's serverless runtime.\n serverless: ServerlessRuntimeIface;\n // The creating client's connection, when one that holds the code is\n // connected; read on every call, since it comes and goes.\n inProcess: () => CodeRunIface | null;\n}\n\nconst failure = (code: CodeErrorCode, message: string) => ({ ok: false as const, code, message });\n\n// Routes each call by the placement its document gives it: serverless code to\n// the runtime with its source, in-process code to the creating client.\nexport const createCodeHost = (args: CreateCodeHostArgsIface): CodeHostIface => {\n const runner = (code: CodeIface): CodeRunIface | null => {\n if (code.placement === CodePlacement.InProcess) return args.inProcess();\n return (invocation, options) =>\n args.serverless.run(\n { agent: args.agent, source: code.source, export: code.export, invocation },\n options,\n );\n };\n\n const run = async (\n code: CodeIface,\n invocation: CodeInvocationIface,\n call: Pick<CodeCallIface, 'signal' | 'onProgress'>,\n ): Promise<CodeResultIface> => {\n const execute = runner(code);\n if (execute == null)\n return failure(\n CodeErrorCode.Unavailable,\n `${invocation.name} runs in the process that created the session, which is not connected`,\n );\n try {\n for await (const line of execute(invocation, { signal: call.signal })) {\n if (line.type === CodeLineType.Progress) {\n call.onProgress?.(line.label == null ? { data: line.data } : line);\n continue;\n }\n if (line.type === CodeLineType.Error) return failure(CodeErrorCode.Failed, line.message);\n return line.modelOutput === undefined\n ? { ok: true, output: line.output }\n : { ok: true, output: line.output, modelOutput: line.modelOutput };\n }\n return failure(CodeErrorCode.Failed, `${invocation.name} ended without a result`);\n } catch (cause) {\n return failure(CodeErrorCode.Failed, cause instanceof Error ? cause.message : String(cause));\n }\n };\n\n return {\n invokeTool: async (call) => {\n const tool = args.document.tools[call.name];\n if (tool == null) return failure(CodeErrorCode.NotFound, `no tool ${call.name}`);\n return run(\n tool.code,\n { kind: CodeKind.Tool, name: call.name, input: call.input, context: call.context },\n call,\n );\n },\n dispatchHook: async (call) => {\n const hook = args.document.hooks.find((candidate) => candidate.name === call.name);\n if (hook == null) return failure(CodeErrorCode.NotFound, `no hook ${call.name}`);\n return run(\n hook.code,\n {\n kind: CodeKind.Hook,\n name: call.name,\n event: call.event,\n payload: call.payload,\n context: call.context,\n },\n call,\n );\n },\n evaluateApproval: async (call): Promise<ApprovalResultIface> => {\n const tool = args.document.tools[call.name];\n if (tool == null) return failure(CodeErrorCode.NotFound, `no tool ${call.name}`);\n const approval = tool.approval ?? ToolApprovalMode.Allow;\n if (typeof approval === 'string') return { ok: true, ask: approval === ToolApprovalMode.Ask };\n const result = await run(\n approval.whenInput,\n { kind: CodeKind.Approval, name: call.name, input: call.input, context: call.context },\n call,\n );\n if (!result.ok) return result;\n if (typeof result.output !== 'boolean')\n return failure(\n CodeErrorCode.Invalid,\n `the approval of ${call.name} must answer true (ask) or false (allow)`,\n );\n return { ok: true, ask: result.output };\n },\n };\n};\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,24 @@
1
+ import type { JsonValue } from "../json.mjs";
2
+ import type { SandboxClientIface } from "../sandbox/client.mjs";
3
+ import { type CodeContextIface, type CodeRunIface, type CodeSandboxEndpointIface } from "./types.mjs";
4
+ export interface InProcessToolResultIface {
5
+ output: JsonValue;
6
+ modelOutput?: JsonValue;
7
+ }
8
+ export interface InProcessToolIface {
9
+ execute(input: JsonValue, ctx: CodeContextIface): Promise<InProcessToolResultIface>;
10
+ }
11
+ export type InProcessHookIface = (event: {
12
+ name: string;
13
+ payload: JsonValue;
14
+ }, ctx: CodeContextIface) => Promise<JsonValue | void>;
15
+ export type InProcessApprovalIface = (input: JsonValue, ctx: CodeContextIface) => Promise<boolean>;
16
+ export interface InProcessCodeRegistryIface {
17
+ tools: Record<string, InProcessToolIface>;
18
+ hooks: Record<string, InProcessHookIface>;
19
+ approvals: Record<string, InProcessApprovalIface>;
20
+ }
21
+ export interface ServeInProcessCodeOptionsIface {
22
+ openSandbox: (endpoint: CodeSandboxEndpointIface) => Promise<SandboxClientIface>;
23
+ }
24
+ export declare const serveInProcessCode: (registry: InProcessCodeRegistryIface, options: ServeInProcessCodeOptionsIface) => CodeRunIface;
@@ -0,0 +1,89 @@
1
+ import { Capability } from "@finalai/agent-protocol";
2
+ import * as z from "zod";
3
+ import {
4
+ CodeKind,
5
+ CodeLineType,
6
+ codeInvocationSchema
7
+ } from "./types.mjs";
8
+ const capabilitySchema = z.nativeEnum(Capability);
9
+ const errorMessage = (cause) => cause instanceof Error ? cause.message : String(cause);
10
+ const execute = async (registry, invocation, ctx) => {
11
+ switch (invocation.kind) {
12
+ case CodeKind.Tool: {
13
+ const tool = registry.tools[invocation.name];
14
+ if (tool == null) throw new Error(`this process does not hold the tool ${invocation.name}`);
15
+ const { output, modelOutput } = await tool.execute(invocation.input, ctx);
16
+ return modelOutput === void 0 ? { type: CodeLineType.Result, output } : { type: CodeLineType.Result, output, modelOutput };
17
+ }
18
+ case CodeKind.Hook: {
19
+ const hook = registry.hooks[invocation.name];
20
+ if (hook == null) throw new Error(`this process does not hold the hook ${invocation.name}`);
21
+ const output = await hook({ name: invocation.event, payload: invocation.payload }, ctx);
22
+ return { type: CodeLineType.Result, output: output ?? null };
23
+ }
24
+ case CodeKind.Approval: {
25
+ const predicate = registry.approvals[invocation.name];
26
+ if (predicate == null)
27
+ throw new Error(`this process does not hold the approval of ${invocation.name}`);
28
+ return { type: CodeLineType.Result, output: await predicate(invocation.input, ctx) };
29
+ }
30
+ }
31
+ };
32
+ const serveInProcessCode = (registry, options) => async function* run(raw, runOptions) {
33
+ const parsed = codeInvocationSchema.safeParse(raw);
34
+ if (!parsed.success) {
35
+ yield { type: CodeLineType.Error, message: `invalid invocation: ${parsed.error.message}` };
36
+ return;
37
+ }
38
+ const invocation = parsed.data;
39
+ const queue = [];
40
+ let wake = null;
41
+ const push = (line) => {
42
+ queue.push(line);
43
+ wake?.();
44
+ wake = null;
45
+ };
46
+ const opened = /* @__PURE__ */ new Map();
47
+ const ctx = {
48
+ sessionId: invocation.context.sessionId,
49
+ callId: invocation.context.callId,
50
+ actingUserId: invocation.context.actingUserId,
51
+ signal: runOptions.signal ?? new AbortController().signal,
52
+ progress: (data, label) => push({ type: CodeLineType.Progress, data, ...label == null ? {} : { label } }),
53
+ sandbox: async (name) => {
54
+ const capability = capabilitySchema.parse(name);
55
+ const endpoint = invocation.context.compute[capability];
56
+ if (endpoint == null) throw new Error(`this session has no sandbox for ${capability}`);
57
+ const existing = opened.get(capability);
58
+ if (existing != null) return existing;
59
+ const connecting = options.openSandbox(endpoint);
60
+ opened.set(capability, connecting);
61
+ return connecting;
62
+ },
63
+ ...runOptions.secrets == null ? {} : { secrets: runOptions.secrets }
64
+ };
65
+ void execute(registry, invocation, ctx).catch(
66
+ (cause) => ({
67
+ type: CodeLineType.Error,
68
+ message: errorMessage(cause)
69
+ })
70
+ ).then(async (line) => {
71
+ for (const client of opened.values()) (await client.catch(() => null))?.close();
72
+ push(line);
73
+ });
74
+ for (; ; ) {
75
+ const line = queue.shift();
76
+ if (line == null) {
77
+ await new Promise((resolve) => {
78
+ wake = resolve;
79
+ });
80
+ continue;
81
+ }
82
+ yield line;
83
+ if (line.type !== CodeLineType.Progress) return;
84
+ }
85
+ };
86
+ export {
87
+ serveInProcessCode
88
+ };
89
+ //# sourceMappingURL=in-process.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/code-host/in-process.ts"],
4
+ "sourcesContent": ["import { Capability } from '@finalai/agent-protocol';\nimport * as z from 'zod';\nimport type { JsonValue } from \"../json.mjs\";\nimport type { SandboxClientIface } from \"../sandbox/client.mjs\";\nimport {\n CodeKind,\n CodeLineType,\n codeInvocationSchema,\n type CodeContextIface,\n type CodeLineIface,\n type CodeRunIface,\n type CodeSandboxEndpointIface,\n} from \"./types.mjs\";\n\n// The client side of in-process code: the process that created a session\n// holds the bodies of its in-process tools, hooks and predicates and answers\n// the platform's invocations over its own connection. Whatever carries the\n// connection hands each invocation to the function this returns and sends the\n// lines back.\n\nexport interface InProcessToolResultIface {\n // The structured result.\n output: JsonValue;\n // What the model sees in place of `output`; absent shows the output.\n modelOutput?: JsonValue;\n}\n\nexport interface InProcessToolIface {\n // Projects for the model from the tool's own result, before either is\n // turned into JSON, so a projection sees the values the tool returned.\n execute(input: JsonValue, ctx: CodeContextIface): Promise<InProcessToolResultIface>;\n}\n\nexport type InProcessHookIface = (\n event: { name: string; payload: JsonValue },\n ctx: CodeContextIface,\n) => Promise<JsonValue | void>;\n\n// Answers whether to ask a person before the tool runs with this input.\nexport type InProcessApprovalIface = (input: JsonValue, ctx: CodeContextIface) => Promise<boolean>;\n\nexport interface InProcessCodeRegistryIface {\n tools: Record<string, InProcessToolIface>;\n hooks: Record<string, InProcessHookIface>;\n // By tool name.\n approvals: Record<string, InProcessApprovalIface>;\n}\n\nexport interface ServeInProcessCodeOptionsIface {\n // Connects to a sandbox handle endpoint (the transport is the caller's).\n openSandbox: (endpoint: CodeSandboxEndpointIface) => Promise<SandboxClientIface>;\n}\n\nconst capabilitySchema = z.nativeEnum(Capability);\n\nconst errorMessage = (cause: unknown): string =>\n cause instanceof Error ? cause.message : String(cause);\n\nconst execute = async (\n registry: InProcessCodeRegistryIface,\n invocation: z.output<typeof codeInvocationSchema>,\n ctx: CodeContextIface,\n): Promise<CodeLineIface> => {\n switch (invocation.kind) {\n case CodeKind.Tool: {\n const tool = registry.tools[invocation.name];\n if (tool == null) throw new Error(`this process does not hold the tool ${invocation.name}`);\n const { output, modelOutput } = await tool.execute(invocation.input, ctx);\n return modelOutput === undefined\n ? { type: CodeLineType.Result, output }\n : { type: CodeLineType.Result, output, modelOutput };\n }\n case CodeKind.Hook: {\n const hook = registry.hooks[invocation.name];\n if (hook == null) throw new Error(`this process does not hold the hook ${invocation.name}`);\n const output = await hook({ name: invocation.event, payload: invocation.payload }, ctx);\n return { type: CodeLineType.Result, output: output ?? null };\n }\n case CodeKind.Approval: {\n const predicate = registry.approvals[invocation.name];\n if (predicate == null)\n throw new Error(`this process does not hold the approval of ${invocation.name}`);\n return { type: CodeLineType.Result, output: await predicate(invocation.input, ctx) };\n }\n }\n};\n\nexport const serveInProcessCode = (\n registry: InProcessCodeRegistryIface,\n options: ServeInProcessCodeOptionsIface,\n): CodeRunIface =>\n async function* run(raw, runOptions): AsyncGenerator<CodeLineIface> {\n const parsed = codeInvocationSchema.safeParse(raw);\n if (!parsed.success) {\n yield { type: CodeLineType.Error, message: `invalid invocation: ${parsed.error.message}` };\n return;\n }\n const invocation = parsed.data;\n // Progress streams as it is reported; the final line ends the stream.\n const queue: CodeLineIface[] = [];\n let wake: (() => void) | null = null;\n const push = (line: CodeLineIface) => {\n queue.push(line);\n wake?.();\n wake = null;\n };\n const opened = new Map<Capability, Promise<SandboxClientIface>>();\n const ctx: CodeContextIface = {\n sessionId: invocation.context.sessionId,\n callId: invocation.context.callId,\n actingUserId: invocation.context.actingUserId,\n signal: runOptions.signal ?? new AbortController().signal,\n progress: (data, label) =>\n push({ type: CodeLineType.Progress, data, ...(label == null ? {} : { label }) }),\n sandbox: async (name) => {\n const capability = capabilitySchema.parse(name);\n const endpoint = invocation.context.compute[capability];\n if (endpoint == null) throw new Error(`this session has no sandbox for ${capability}`);\n const existing = opened.get(capability);\n if (existing != null) return existing;\n const connecting = options.openSandbox(endpoint);\n opened.set(capability, connecting);\n return connecting;\n },\n ...(runOptions.secrets == null ? {} : { secrets: runOptions.secrets }),\n };\n void execute(registry, invocation, ctx)\n .catch(\n (cause: unknown): CodeLineIface => ({\n type: CodeLineType.Error,\n message: errorMessage(cause),\n }),\n )\n .then(async (line) => {\n for (const client of opened.values()) (await client.catch(() => null))?.close();\n push(line);\n });\n for (;;) {\n const line = queue.shift();\n if (line == null) {\n await new Promise<void>((resolve) => {\n wake = resolve;\n });\n continue;\n }\n yield line;\n if (line.type !== CodeLineType.Progress) return;\n }\n };\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./host.mjs";
2
+ export * from "./in-process.mjs";
3
+ export * from "./serverless.mjs";
4
+ export * from "./types.mjs";
@@ -0,0 +1,5 @@
1
+ export * from "./host.mjs";
2
+ export * from "./in-process.mjs";
3
+ export * from "./serverless.mjs";
4
+ export * from "./types.mjs";
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/code-host/index.ts"],
4
+ "sourcesContent": ["export * from \"./host.mjs\";\nexport * from \"./in-process.mjs\";\nexport * from \"./serverless.mjs\";\nexport * from \"./types.mjs\";\n"],
5
+ "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
6
+ "names": []
7
+ }