@finalai/agent-provider 0.9.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 (206) hide show
  1. package/HOSTING.md +334 -245
  2. package/README.md +106 -20
  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 +51 -15
  7. package/dist/modules/channel.mjs +1 -0
  8. package/dist/modules/channel.mjs.map +2 -2
  9. package/dist/modules/code-host/host.d.mts +10 -0
  10. package/dist/modules/code-host/host.mjs +88 -0
  11. package/dist/modules/code-host/host.mjs.map +7 -0
  12. package/dist/modules/code-host/in-process.d.mts +24 -0
  13. package/dist/modules/code-host/in-process.mjs +89 -0
  14. package/dist/modules/code-host/in-process.mjs.map +7 -0
  15. package/dist/modules/code-host/index.d.mts +4 -0
  16. package/dist/modules/code-host/index.mjs +5 -0
  17. package/dist/modules/code-host/index.mjs.map +7 -0
  18. package/dist/modules/code-host/serverless.d.mts +63 -0
  19. package/dist/modules/code-host/serverless.mjs +27 -0
  20. package/dist/modules/code-host/serverless.mjs.map +7 -0
  21. package/dist/modules/code-host/types.d.mts +152 -0
  22. package/dist/modules/code-host/types.mjs +85 -0
  23. package/dist/modules/code-host/types.mjs.map +7 -0
  24. package/dist/modules/conformance/agent.mjs +72 -6
  25. package/dist/modules/conformance/agent.mjs.map +2 -2
  26. package/dist/modules/conformance/harness-kit.d.mts +9 -2
  27. package/dist/modules/conformance/harness-kit.mjs +224 -63
  28. package/dist/modules/conformance/harness-kit.mjs.map +3 -3
  29. package/dist/modules/conformance/local-harness.d.mts +1 -4
  30. package/dist/modules/conformance/local-harness.mjs +21 -22
  31. package/dist/modules/conformance/local-harness.mjs.map +2 -2
  32. package/dist/modules/conformance/protocol.d.mts +1 -0
  33. package/dist/modules/conformance/protocol.mjs +2 -0
  34. package/dist/modules/conformance/protocol.mjs.map +2 -2
  35. package/dist/modules/conformance/sandbox-kit.d.mts +12 -4
  36. package/dist/modules/conformance/sandbox-kit.mjs +189 -103
  37. package/dist/modules/conformance/sandbox-kit.mjs.map +2 -2
  38. package/dist/modules/conformance/scripted-model/chat-completions.mjs +1 -0
  39. package/dist/modules/conformance/scripted-model/chat-completions.mjs.map +2 -2
  40. package/dist/modules/conformance/scripted-model/directives.d.mts +3 -0
  41. package/dist/modules/conformance/scripted-model/directives.mjs +26 -10
  42. package/dist/modules/conformance/scripted-model/directives.mjs.map +2 -2
  43. package/dist/modules/conformance/scripted-model/messages.mjs +1 -0
  44. package/dist/modules/conformance/scripted-model/messages.mjs.map +2 -2
  45. package/dist/modules/conformance/scripted-model/responses.mjs +2 -0
  46. package/dist/modules/conformance/scripted-model/responses.mjs.map +2 -2
  47. package/dist/modules/conformance/stdio.d.mts +21 -0
  48. package/dist/modules/conformance/stdio.mjs +158 -0
  49. package/dist/modules/conformance/stdio.mjs.map +7 -0
  50. package/dist/modules/credential-routes.d.mts +3 -3
  51. package/dist/modules/credential-routes.mjs +2 -2
  52. package/dist/modules/credential-routes.mjs.map +2 -2
  53. package/dist/modules/document.d.mts +358 -0
  54. package/dist/modules/document.mjs +193 -0
  55. package/dist/modules/document.mjs.map +7 -0
  56. package/dist/modules/harness-configuration.d.mts +16 -0
  57. package/dist/modules/harness-configuration.mjs +83 -0
  58. package/dist/modules/harness-configuration.mjs.map +7 -0
  59. package/dist/modules/harness-definition.d.mts +280 -0
  60. package/dist/modules/harness-definition.mjs +430 -0
  61. package/dist/modules/harness-definition.mjs.map +7 -0
  62. package/dist/modules/harness-provider.d.mts +197 -0
  63. package/dist/modules/harness-provider.mjs +108 -0
  64. package/dist/modules/harness-provider.mjs.map +7 -0
  65. package/dist/modules/harness-requirements.d.mts +19 -0
  66. package/dist/modules/harness-requirements.mjs +40 -0
  67. package/dist/modules/harness-requirements.mjs.map +7 -0
  68. package/dist/modules/harness-start.d.mts +33 -0
  69. package/dist/modules/harness-start.mjs +107 -0
  70. package/dist/modules/harness-start.mjs.map +7 -0
  71. package/dist/modules/harness.d.mts +84 -109
  72. package/dist/modules/harness.mjs +56 -111
  73. package/dist/modules/harness.mjs.map +3 -3
  74. package/dist/modules/identity.d.mts +1 -0
  75. package/dist/modules/identity.mjs +2 -0
  76. package/dist/modules/identity.mjs.map +7 -0
  77. package/dist/modules/index.d.mts +12 -7
  78. package/dist/modules/index.mjs +12 -7
  79. package/dist/modules/index.mjs.map +2 -2
  80. package/dist/modules/inference.d.mts +35 -0
  81. package/dist/modules/inference.mjs +74 -0
  82. package/dist/modules/inference.mjs.map +7 -0
  83. package/dist/modules/local-channel-context.d.mts +1 -1
  84. package/dist/modules/local-channel-context.mjs +1 -1
  85. package/dist/modules/local-channel-context.mjs.map +2 -2
  86. package/dist/modules/requirements-check.d.mts +30 -0
  87. package/dist/modules/requirements-check.mjs +164 -0
  88. package/dist/modules/requirements-check.mjs.map +7 -0
  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/body.d.mts +1 -0
  114. package/dist/modules/sandbox/remote/body.mjs +27 -0
  115. package/dist/modules/sandbox/remote/body.mjs.map +7 -0
  116. package/dist/modules/sandbox/remote/errors.d.mts +10 -0
  117. package/dist/modules/sandbox/remote/errors.mjs +62 -0
  118. package/dist/modules/sandbox/remote/errors.mjs.map +7 -0
  119. package/dist/modules/sandbox/remote/index.d.mts +5 -0
  120. package/dist/modules/sandbox/remote/index.mjs +6 -0
  121. package/dist/modules/sandbox/remote/index.mjs.map +7 -0
  122. package/dist/modules/sandbox/remote/ndjson.d.mts +6 -0
  123. package/dist/modules/sandbox/remote/ndjson.mjs +80 -0
  124. package/dist/modules/sandbox/remote/ndjson.mjs.map +7 -0
  125. package/dist/modules/sandbox/remote/platform-api.d.mts +8 -0
  126. package/dist/modules/sandbox/remote/platform-api.mjs +15 -0
  127. package/dist/modules/sandbox/remote/platform-api.mjs.map +7 -0
  128. package/dist/modules/sandbox/remote/preamble.d.mts +7 -0
  129. package/dist/modules/sandbox/remote/preamble.mjs +51 -0
  130. package/dist/modules/sandbox/remote/preamble.mjs.map +7 -0
  131. package/dist/modules/sandbox/remote/serve.d.mts +34 -0
  132. package/dist/modules/sandbox/remote/serve.mjs +520 -0
  133. package/dist/modules/sandbox/remote/serve.mjs.map +7 -0
  134. package/dist/modules/sandbox/remote/testing.d.mts +34 -0
  135. package/dist/modules/sandbox/remote/testing.mjs +275 -0
  136. package/dist/modules/sandbox/remote/testing.mjs.map +7 -0
  137. package/dist/modules/sandbox/seeds.d.mts +2 -2
  138. package/dist/modules/sandbox/seeds.mjs +2 -2
  139. package/dist/modules/sandbox/seeds.mjs.map +2 -2
  140. package/dist/modules/sandbox/server.d.mts +4 -6
  141. package/dist/modules/sandbox/server.mjs +93 -49
  142. package/dist/modules/sandbox/server.mjs.map +2 -2
  143. package/dist/modules/sandbox/setup/apply.d.mts +40 -0
  144. package/dist/modules/sandbox/setup/apply.mjs +190 -0
  145. package/dist/modules/sandbox/setup/apply.mjs.map +7 -0
  146. package/dist/modules/sandbox/setup/describe.d.mts +10 -0
  147. package/dist/modules/sandbox/setup/describe.mjs +62 -0
  148. package/dist/modules/sandbox/setup/describe.mjs.map +7 -0
  149. package/dist/modules/sandbox/setup/index.d.mts +6 -0
  150. package/dist/modules/sandbox/setup/index.mjs +17 -0
  151. package/dist/modules/sandbox/setup/index.mjs.map +7 -0
  152. package/dist/modules/sandbox/setup/paths.d.mts +8 -0
  153. package/dist/modules/sandbox/setup/paths.mjs +18 -0
  154. package/dist/modules/sandbox/setup/paths.mjs.map +7 -0
  155. package/dist/modules/sandbox/setup/schema.d.mts +43 -0
  156. package/dist/modules/sandbox/setup/schema.mjs +58 -0
  157. package/dist/modules/sandbox/setup/schema.mjs.map +7 -0
  158. package/dist/modules/sandbox/tool-policy.d.mts +1 -1
  159. package/dist/modules/sandbox/tool-policy.mjs +1 -1
  160. package/dist/modules/sandbox/tool-policy.mjs.map +2 -2
  161. package/dist/modules/sandbox/types.d.mts +117 -142
  162. package/dist/modules/sandbox/types.mjs +47 -57
  163. package/dist/modules/sandbox/types.mjs.map +3 -3
  164. package/dist/modules/sandbox/wire.d.mts +93 -6
  165. package/dist/modules/sandbox/wire.mjs +61 -38
  166. package/dist/modules/sandbox/wire.mjs.map +2 -2
  167. package/dist/modules/schemas.d.mts +5 -76
  168. package/dist/modules/schemas.mjs +18 -85
  169. package/dist/modules/schemas.mjs.map +2 -2
  170. package/dist/modules/tool-annotations.d.mts +15 -6
  171. package/dist/modules/tool-annotations.mjs +9 -3
  172. package/dist/modules/tool-annotations.mjs.map +2 -2
  173. package/dist/modules/tool-descriptor.d.mts +16 -0
  174. package/dist/modules/tool-descriptor.mjs +19 -0
  175. package/dist/modules/tool-descriptor.mjs.map +7 -0
  176. package/dist/modules/tool-patterns.d.mts +7 -7
  177. package/dist/modules/tool-patterns.mjs +10 -9
  178. package/dist/modules/tool-patterns.mjs.map +2 -2
  179. package/package.json +86 -41
  180. package/dist/modules/credentials.d.mts +0 -206
  181. package/dist/modules/credentials.mjs +0 -207
  182. package/dist/modules/credentials.mjs.map +0 -7
  183. package/dist/modules/dynamic.d.mts +0 -40
  184. package/dist/modules/dynamic.mjs +0 -79
  185. package/dist/modules/dynamic.mjs.map +0 -7
  186. package/dist/modules/hosted-bindings.d.mts +0 -15
  187. package/dist/modules/hosted-bindings.mjs +0 -21
  188. package/dist/modules/hosted-bindings.mjs.map +0 -7
  189. package/dist/modules/manifest.d.mts +0 -791
  190. package/dist/modules/manifest.mjs +0 -322
  191. package/dist/modules/manifest.mjs.map +0 -7
  192. package/dist/modules/provider-ref.d.mts +0 -29
  193. package/dist/modules/provider-ref.mjs +0 -55
  194. package/dist/modules/provider-ref.mjs.map +0 -7
  195. package/dist/modules/room-surface.d.mts +0 -355
  196. package/dist/modules/room-surface.mjs +0 -156
  197. package/dist/modules/room-surface.mjs.map +0 -7
  198. package/dist/modules/sandbox/open-scope-node.d.mts +0 -4
  199. package/dist/modules/sandbox/open-scope-node.mjs +0 -19
  200. package/dist/modules/sandbox/open-scope-node.mjs.map +0 -7
  201. package/dist/modules/sandbox/open-scope.d.mts +0 -16
  202. package/dist/modules/sandbox/open-scope.mjs +0 -66
  203. package/dist/modules/sandbox/open-scope.mjs.map +0 -7
  204. package/dist/modules/sandbox/workspace-identity.d.mts +0 -5
  205. package/dist/modules/sandbox/workspace-identity.mjs +0 -14
  206. package/dist/modules/sandbox/workspace-identity.mjs.map +0 -7
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/sandbox/open-scope.ts"],
4
- "sourcesContent": ["import * as z from 'zod';\nimport type { NetworkSandboxSessionIface, SandboxOpenRequestIface } from \"./types.mjs\";\n\n// sandbox.ts's default `defineSandbox` selector awaits an environment's\n// `open(...)` to get the live sandbox it prepares:\n//\n// export default defineSandbox(async ({ session }) => {\n// const sandbox = await computer.open({ access: 'write' });\n// await sandbox.writeTextFile({ path: '.final/session', content: session.id });\n// return sandbox;\n// });\n//\n// The isolate runtime that calls the selector installs an opener scope on the\n// isolate's global (the authored bundle and the runtime are separate modules\n// that share only the global); a request awaited while a selector runs opens\n// through it. Everywhere else (compiling, dynamic resolvers) an open request\n// is a plain description, not awaited.\n\n// Returns the live session for the request.\nexport type SandboxOpener = (\n request: SandboxOpenRequestIface<unknown, unknown>,\n) => Promise<NetworkSandboxSessionIface>;\n\nexport interface SandboxOpenScopeIface {\n // The opener of the selector running in the current async context.\n current(): SandboxOpener | null;\n}\n\ndeclare global {\n // Installed by the isolate runtime (open-scope-node.ts); absent elsewhere.\n var __finalSandboxOpenScope: unknown;\n}\n\n// A global object the scope is installed on: the isolate's, or a local realm's.\nexport interface SandboxOpenScopeGlobalIface {\n __finalSandboxOpenScope?: unknown;\n}\n\n// What `environment.open(...)` returns: the open request, awaitable inside a\n// selector, where awaiting it opens the sandbox and yields its live session.\nexport type AwaitableSandboxOpenRequestIface<EnvOptions, OpenOptions> = SandboxOpenRequestIface<\n EnvOptions,\n OpenOptions\n> &\n PromiseLike<NetworkSandboxSessionIface>;\n\n// Outside a selector there is nothing to open. Awaiting a request there\n// rejects with this error, which carries the plain request: an async dynamic\n// resolver's `return environment.open(...)` awaits it implicitly, and the\n// resolver runtime takes the request back (`unopenedRequestOf`).\nconst openRequestFieldsSchema = z.looseObject({\n providerName: z.string(),\n environmentOptions: z.unknown(),\n openOptions: z.unknown(),\n});\nconst unopenedSchema = z.object({\n unopenedRequest: openRequestFieldsSchema,\n});\n\nexport const unopenedRequestOf = (\n cause: unknown,\n): SandboxOpenRequestIface<unknown, unknown> | null => {\n const parsed = unopenedSchema.safeParse(cause);\n return parsed.success ? parsed.data.unopenedRequest : null;\n};\n\n// Packed entrypoints each own their declarations; the shared global must not name a private type.\nconst scopeMethodsSchema = z.looseObject({ current: z.function() });\nconst sandboxOpenScopeSchema = z.custom<SandboxOpenScopeIface>(\n (value) => scopeMethodsSchema.safeParse(value).success,\n);\n\nexport const awaitableOpenRequest = <T extends SandboxOpenRequestIface<unknown, unknown>>(\n request: T,\n): T & PromiseLike<NetworkSandboxSessionIface> => {\n const then: PromiseLike<NetworkSandboxSessionIface>['then'] = (onFulfilled, onRejected) => {\n const scope = sandboxOpenScopeSchema.safeParse(globalThis.__finalSandboxOpenScope).data;\n const opener = scope?.current() ?? null;\n const opened: Promise<NetworkSandboxSessionIface> =\n opener == null\n ? Promise.reject(\n Object.assign(\n new Error(\n `awaiting ${request.providerName}.open() opens a sandbox only inside a defineSandbox selector`,\n ),\n { unopenedRequest: { ...request } },\n ),\n )\n : opener(request);\n return opened.then(onFulfilled, onRejected);\n };\n // oxlint-disable-next-line unicorn/no-thenable -- awaiting the request inside a selector is the API.\n const awaitable = Object.assign(request, { then });\n // Non-enumerable: lowering, spreading and JSON never see it.\n // oxlint-disable-next-line unicorn/no-thenable -- the same property, made non-enumerable.\n Object.defineProperty(awaitable, 'then', { enumerable: false });\n return awaitable;\n};\n\n// Runtimes hand selectors their own sandbox clients; enough of the session\n// surface to be sure one is a session before the selector gets it.\nconst sessionMethodsSchema = z.looseObject({\n id: z.string(),\n description: z.string(),\n defaultWorkingDirectory: z.string(),\n ports: z.array(z.number()),\n readFile: z.function(),\n readBinaryFile: z.function(),\n readTextFile: z.function(),\n writeFile: z.function(),\n writeBinaryFile: z.function(),\n writeTextFile: z.function(),\n spawn: z.function(),\n run: z.function(),\n stat: z.function(),\n readDir: z.function(),\n resolvePath: z.function(),\n removePath: z.function(),\n getPortEndpoint: z.function(),\n getPortUrl: z.function(),\n stop: z.function(),\n destroy: z.function(),\n});\n\nexport const sandboxSessionSchema = z.custom<NetworkSandboxSessionIface>(\n (value) => sessionMethodsSchema.safeParse(value).success,\n);\n"],
5
- "mappings": "AAAA,YAAY,OAAO;AAkDnB,MAAM,0BAA0B,EAAE,YAAY;AAAA,EAC5C,cAAc,EAAE,OAAO;AAAA,EACvB,oBAAoB,EAAE,QAAQ;AAAA,EAC9B,aAAa,EAAE,QAAQ;AACzB,CAAC;AACD,MAAM,iBAAiB,EAAE,OAAO;AAAA,EAC9B,iBAAiB;AACnB,CAAC;AAEM,MAAM,oBAAoB,CAC/B,UACqD;AACrD,QAAM,SAAS,eAAe,UAAU,KAAK;AAC7C,SAAO,OAAO,UAAU,OAAO,KAAK,kBAAkB;AACxD;AAGA,MAAM,qBAAqB,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAClE,MAAM,yBAAyB,EAAE;AAAA,EAC/B,CAAC,UAAU,mBAAmB,UAAU,KAAK,EAAE;AACjD;AAEO,MAAM,uBAAuB,CAClC,YACgD;AAChD,QAAM,OAAwD,CAAC,aAAa,eAAe;AACzF,UAAM,QAAQ,uBAAuB,UAAU,WAAW,uBAAuB,EAAE;AACnF,UAAM,SAAS,OAAO,QAAQ,KAAK;AACnC,UAAM,SACJ,UAAU,OACN,QAAQ;AAAA,MACN,OAAO;AAAA,QACL,IAAI;AAAA,UACF,YAAY,QAAQ,YAAY;AAAA,QAClC;AAAA,QACA,EAAE,iBAAiB,EAAE,GAAG,QAAQ,EAAE;AAAA,MACpC;AAAA,IACF,IACA,OAAO,OAAO;AACpB,WAAO,OAAO,KAAK,aAAa,UAAU;AAAA,EAC5C;AAEA,QAAM,YAAY,OAAO,OAAO,SAAS,EAAE,KAAK,CAAC;AAGjD,SAAO,eAAe,WAAW,QAAQ,EAAE,YAAY,MAAM,CAAC;AAC9D,SAAO;AACT;AAIA,MAAM,uBAAuB,EAAE,YAAY;AAAA,EACzC,IAAI,EAAE,OAAO;AAAA,EACb,aAAa,EAAE,OAAO;AAAA,EACtB,yBAAyB,EAAE,OAAO;AAAA,EAClC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EACzB,UAAU,EAAE,SAAS;AAAA,EACrB,gBAAgB,EAAE,SAAS;AAAA,EAC3B,cAAc,EAAE,SAAS;AAAA,EACzB,WAAW,EAAE,SAAS;AAAA,EACtB,iBAAiB,EAAE,SAAS;AAAA,EAC5B,eAAe,EAAE,SAAS;AAAA,EAC1B,OAAO,EAAE,SAAS;AAAA,EAClB,KAAK,EAAE,SAAS;AAAA,EAChB,MAAM,EAAE,SAAS;AAAA,EACjB,SAAS,EAAE,SAAS;AAAA,EACpB,aAAa,EAAE,SAAS;AAAA,EACxB,YAAY,EAAE,SAAS;AAAA,EACvB,iBAAiB,EAAE,SAAS;AAAA,EAC5B,YAAY,EAAE,SAAS;AAAA,EACvB,MAAM,EAAE,SAAS;AAAA,EACjB,SAAS,EAAE,SAAS;AACtB,CAAC;AAEM,MAAM,uBAAuB,EAAE;AAAA,EACpC,CAAC,UAAU,qBAAqB,UAAU,KAAK,EAAE;AACnD;",
6
- "names": []
7
- }
@@ -1,5 +0,0 @@
1
- import { SandboxWorkspace, type SandboxStartContextIface } from "./types.mjs";
2
- export declare const sandboxWorkspaceId: (args: {
3
- session: Pick<SandboxStartContextIface["session"], "bindingId" | "conversationId" | "target" | "workspaceId">;
4
- workspace: SandboxWorkspace;
5
- }) => string;
@@ -1,14 +0,0 @@
1
- import { SandboxWorkspace } from "./types.mjs";
2
- const encodeIdentityPart = (value) => {
3
- if (!value.isWellFormed()) throw new Error("Workspace identity must contain valid Unicode");
4
- return encodeURIComponent(value);
5
- };
6
- const sandboxWorkspaceId = (args) => {
7
- const id = args.session.workspaceId ?? (args.workspace === SandboxWorkspace.Conversation && args.session.conversationId != null ? `conversation:${encodeIdentityPart(args.session.conversationId)}:${encodeIdentityPart(args.session.target)}` : `binding:${encodeIdentityPart(args.session.bindingId)}`);
8
- if (id.length === 0) throw new Error("Supply a nonempty stable workspaceId");
9
- return id;
10
- };
11
- export {
12
- sandboxWorkspaceId
13
- };
14
- //# sourceMappingURL=workspace-identity.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/sandbox/workspace-identity.ts"],
4
- "sourcesContent": ["import { SandboxWorkspace, type SandboxStartContextIface } from \"./types.mjs\";\n\nconst encodeIdentityPart = (value: string): string => {\n if (!value.isWellFormed()) throw new Error('Workspace identity must contain valid Unicode');\n return encodeURIComponent(value);\n};\n\n// Conversation workspaces survive replacement bindings; other workspaces belong to their binding.\nexport const sandboxWorkspaceId = (args: {\n session: Pick<\n SandboxStartContextIface['session'],\n 'bindingId' | 'conversationId' | 'target' | 'workspaceId'\n >;\n workspace: SandboxWorkspace;\n}): string => {\n const id =\n args.session.workspaceId ??\n (args.workspace === SandboxWorkspace.Conversation && args.session.conversationId != null\n ? `conversation:${encodeIdentityPart(args.session.conversationId)}:${encodeIdentityPart(args.session.target)}`\n : `binding:${encodeIdentityPart(args.session.bindingId)}`);\n if (id.length === 0) throw new Error('Supply a nonempty stable workspaceId');\n return id;\n};\n"],
5
- "mappings": "AAAA,SAAS,wBAAuD;AAEhE,MAAM,qBAAqB,CAAC,UAA0B;AACpD,MAAI,CAAC,MAAM,aAAa,EAAG,OAAM,IAAI,MAAM,+CAA+C;AAC1F,SAAO,mBAAmB,KAAK;AACjC;AAGO,MAAM,qBAAqB,CAAC,SAMrB;AACZ,QAAM,KACJ,KAAK,QAAQ,gBACZ,KAAK,cAAc,iBAAiB,gBAAgB,KAAK,QAAQ,kBAAkB,OAChF,gBAAgB,mBAAmB,KAAK,QAAQ,cAAc,CAAC,IAAI,mBAAmB,KAAK,QAAQ,MAAM,CAAC,KAC1G,WAAW,mBAAmB,KAAK,QAAQ,SAAS,CAAC;AAC3D,MAAI,GAAG,WAAW,EAAG,OAAM,IAAI,MAAM,sCAAsC;AAC3E,SAAO;AACT;",
6
- "names": []
7
- }