@finalai/final-agent-provider 0.5.0 → 0.6.1

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 (30) hide show
  1. package/HOSTING.md +3 -3
  2. package/README.md +4 -0
  3. package/WORKSPACE-EGRESS.md +7 -6
  4. package/dist/modules/channels/projection.d.mts +13 -7
  5. package/dist/modules/channels/projection.mjs +49 -31
  6. package/dist/modules/channels/projection.mjs.map +2 -2
  7. package/dist/modules/sandboxes/computer.d.mts +4 -3
  8. package/dist/modules/sandboxes/computer.mjs +22 -35
  9. package/dist/modules/sandboxes/computer.mjs.map +2 -2
  10. package/dist/modules/sandboxes/computers-api.d.mts +2 -17
  11. package/dist/modules/sandboxes/computers-api.mjs +27 -44
  12. package/dist/modules/sandboxes/computers-api.mjs.map +2 -2
  13. package/dist/modules/sandboxes/device-api.d.mts +3 -8
  14. package/dist/modules/sandboxes/device-api.mjs +17 -28
  15. package/dist/modules/sandboxes/device-api.mjs.map +3 -3
  16. package/dist/modules/sandboxes/device.d.mts +2 -1
  17. package/dist/modules/sandboxes/device.mjs +13 -5
  18. package/dist/modules/sandboxes/device.mjs.map +2 -2
  19. package/dist/modules/sandboxes/egress.d.mts +4 -1
  20. package/dist/modules/sandboxes/egress.mjs +20 -2
  21. package/dist/modules/sandboxes/egress.mjs.map +2 -2
  22. package/dist/modules/sandboxes/environment.d.mts +0 -3
  23. package/dist/modules/sandboxes/environment.mjs +2 -8
  24. package/dist/modules/sandboxes/environment.mjs.map +2 -2
  25. package/dist/modules/sandboxes/index.d.mts +1 -1
  26. package/dist/modules/sandboxes/index.mjs +0 -2
  27. package/dist/modules/sandboxes/index.mjs.map +2 -2
  28. package/dist/modules/sandboxes/testing/fake-backends.mjs +2 -2
  29. package/dist/modules/sandboxes/testing/fake-backends.mjs.map +2 -2
  30. package/package.json +5 -5
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/sandboxes/environment.ts"],
4
- "sourcesContent": ["import { NetworkPolicy, SandboxAccess, SandboxAttach } from '@finalai/agent-provider';\nimport * as z from 'zod';\n\n// Environment options of the `computer` and `device` sandboxes: the JSON a manifest's\n// sandbox binding carries as `environment`, validated by the provider. Pure (no\n// I/O) so authored definitions can import it.\n\nexport const COMPUTER_SANDBOX_SPECIFIER = '@finalai/final-agent-provider/sandboxes/computer';\nexport const DEVICE_SANDBOX_SPECIFIER = '@finalai/final-agent-provider/sandboxes/device';\n\n// Organization secrets the `computer` sandbox's credential is kept in, as any\n// Computers API customer keeps theirs: an organization API key, and the team\n// (`team_...`) that owns the computers when the key has no owning user.\nexport const COMPUTERS_API_KEY_SECRET = 'FINAL_COMPUTERS_API_KEY';\nexport const COMPUTERS_API_TEAM_SECRET = 'FINAL_COMPUTERS_TEAM_ID';\n// Optional convention for hosts using customer-managed Device API keys.\n// User-token hosts supply their credential callback without this secret.\nexport const DEVICE_API_KEY_SECRET = 'FINAL_DEVICE_API_KEY';\nexport const DEVICE_API_ACTING_USER_HEADER = 'Final-Acting-User-Id';\n\nexport enum ComputerWorkspacePolicy {\n // The disk lives as long as the agent's session.\n Session = 'session',\n // The disk belongs to the conversation: every agent in it shares it and a session reset keeps it.\n Conversation = 'conversation',\n // The disk is discarded when the sandbox is released.\n Ephemeral = 'ephemeral',\n}\n\nexport enum TemplateWhenMissing {\n Skip = 'skip',\n Fail = 'fail',\n}\n\n// Repository aliases mount at /workspaces/<alias>.\nexport const repositoryAliasSchema = z\n .string()\n .regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/)\n .max(120);\nconst variableNameSchema = z\n .string()\n .regex(/^[A-Za-z_][A-Za-z0-9_]*$/)\n .max(256);\n\nexport const computerRepositorySchema = z.object({\n alias: repositoryAliasSchema,\n // A repository the organization can reach, named as the host's repository\n // resolver accepts it (a GitHub 'final/app', a Code Storage id), or a git URL.\n repository: z.string().min(1),\n ref: z.string().min(1).nullable().default(null),\n});\n\nexport const computerNetworkPolicySchema = z.union([\n z.nativeEnum(NetworkPolicy),\n z.object({ mode: z.nativeEnum(NetworkPolicy), allow: z.array(z.string()).default([]) }),\n]);\n\n// Start-time parameters; everything optional so a guide reference can override any subset.\nexport const computerParametersSchema = z.object({\n repositories: z.array(computerRepositorySchema).optional(),\n // Names of organization variables; values are injected at start, never stored here.\n variables: z.array(variableNameSchema).optional(),\n workspace: z.nativeEnum(ComputerWorkspacePolicy).optional(),\n networkPolicy: computerNetworkPolicySchema.optional(),\n // Plain, non-secret environment values.\n env: z.record(variableNameSchema, z.string().max(16 * 1024)).optional(),\n});\n\n// The subset of `.final/sandbox-template.yaml` v2 the computer sandbox reads.\nconst templateStepSchema = z.object({\n run: z\n .string()\n .min(1)\n .max(10 * 1024),\n cwd: z.string().min(1).default('.'),\n whenMissing: z.nativeEnum(TemplateWhenMissing).nullable().default(null),\n timeoutMinutes: z.number().int().min(1).max(120).default(20),\n required: z.boolean().default(true),\n});\nconst templateServiceSchema = templateStepSchema.extend({\n name: z\n .string()\n .regex(/^[a-z0-9][a-z0-9-]*$/)\n .max(64),\n ready: z\n .object({ url: z.string().url(), timeoutSeconds: z.number().int().min(1).max(600).default(90) })\n .nullable()\n .default(null),\n});\nconst templateCommandSchema = z.object({\n run: z\n .string()\n .min(1)\n .max(10 * 1024),\n description: z.string().min(1).max(500).nullable().default(null),\n cwd: z.string().min(1).default('.'),\n whenMissing: z.nativeEnum(TemplateWhenMissing).nullable().default(null),\n timeoutMinutes: z.number().int().min(1).max(120).default(20),\n});\n\nexport const computerTemplateSchema = z.object({\n version: z.literal(2).default(2),\n build: z\n .object({\n timeoutMinutes: z.number().int().min(1).max(120).default(30),\n steps: z.array(templateStepSchema).max(30).default([]),\n verify: z.array(templateStepSchema).max(30).default([]),\n })\n .prefault({}),\n workspace: z.object({ setup: z.array(templateStepSchema).max(30).default([]) }).prefault({}),\n services: z.array(templateServiceSchema).max(20).default([]),\n commands: z\n .record(\n z\n .string()\n .regex(/^[a-z0-9][a-z0-9-]*$/)\n .max(64),\n templateCommandSchema,\n )\n .default({}),\n});\n\nexport const computerInlineGuideSchema = z.object({\n // An OCI image reference, or `lineage:<name>` for a platform image lineage.\n image: z.string().min(1),\n template: computerTemplateSchema.prefault({}),\n repositories: z.array(computerRepositorySchema).default([]),\n variables: z.array(variableNameSchema).default([]),\n});\n\nexport const computerEnvironmentSchema = z.union([\n z.strictObject({\n guide: z.strictObject({\n ref: z.string().min(1),\n version: z.union([z.literal('latest'), z.number().int().min(1)]).default('latest'),\n }),\n parameters: computerParametersSchema.prefault({}),\n }),\n z.strictObject({\n inline: computerInlineGuideSchema,\n parameters: computerParametersSchema.prefault({}),\n }),\n z.strictObject({ image: z.string().min(1), parameters: computerParametersSchema.prefault({}) }),\n // The organization's default guide.\n z.strictObject({ parameters: computerParametersSchema.prefault({}) }),\n]);\n\n// `.open({ access, attach })` of the `computer` and `device` sandboxes. `attach`\n// is the session service's (lazy unless `on-prompt`); the provider\n// reads only `access`.\nexport const computerOpenOptionsSchema = z.strictObject({\n access: z.nativeEnum(SandboxAccess).default(SandboxAccess.Write),\n attach: z.nativeEnum(SandboxAttach).optional(),\n});\n\nexport const deviceEnvironmentSchema = z.union([\n z.strictObject({ deviceId: z.string().uuid() }),\n // A pairing code the owner approved; resolved to a device at prepare.\n z.strictObject({ pairing: z.string().min(1) }),\n // The only Device of the user the session acts for.\n z.strictObject({}),\n]);\n\nexport type ComputerRepositoryIface = z.infer<typeof computerRepositorySchema>;\nexport type ComputerParametersIface = z.infer<typeof computerParametersSchema>;\nexport type ComputerTemplateIface = z.infer<typeof computerTemplateSchema>;\nexport type ComputerTemplateInputIface = z.input<typeof computerTemplateSchema>;\nexport type ComputerInlineGuideIface = z.infer<typeof computerInlineGuideSchema>;\nexport type ComputerEnvironmentOptions = z.infer<typeof computerEnvironmentSchema>;\nexport type ComputerOpenOptionsIface = z.infer<typeof computerOpenOptionsSchema>;\nexport type ComputerNetworkPolicyOption = z.infer<typeof computerNetworkPolicySchema>;\nex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Aa;AAAA,MACpB,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,MACrB,SAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,QAAQ,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,QAAQ;AAAA,IACnF,CAAC;AAAA,IACD,YAAY,yBAAyB,SAAS,CAAC,CAAC;AAAA,EAClD,CAAC;AAAA,EACD,EAAE,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,YAAY,yBAAyB,SAAS,CAAC,CAAC;AAAA,EAClD,CAAC;AAAA,EACD,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,YAAY,yBAAyB,SAAS,CAAC,CAAC,EAAE,CAAC;AAAA;AAAA,EAE9F,EAAE,aAAa,EAAE,YAAY,yBAAyB,SAAS,CAAC,CAAC,EAAE,CAAC;AACtE,CAAC;AAKM,MAAM,4BAA4B,EAAE,aAAa;AAAA,EACtD,QAAQ,EAAE,WAAW,aAAa,EAAE,QAAQ,cAAc,KAAK;AAAA,EAC/D,QAAQ,EAAE,WAAW,aAAa,EAAE,SAAS;AAC/C,CAAC;AAEM,MAAM,0BAA0B,EAAE,MAAM;AAAA,EAC7C,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAAA;AAAA,EAE9C,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;AAAA;AAAA,EAE7C,EAAE,aAAa,CAAC,CAAC;AACnB,CAAC;",
4
+ "sourcesContent": ["import { NetworkPolicy, SandboxAccess, SandboxAttach } from '@finalai/agent-provider';\nimport * as z from 'zod';\n\n// Environment options of the `computer` and `device` sandboxes: the JSON a manifest's\n// sandbox binding carries as `environment`, validated by the provider. Pure (no\n// I/O) so authored definitions can import it.\n\nexport const COMPUTER_SANDBOX_SPECIFIER = '@finalai/final-agent-provider/sandboxes/computer';\nexport const DEVICE_SANDBOX_SPECIFIER = '@finalai/final-agent-provider/sandboxes/device';\n\n// The `computer` and `device` sandboxes read no secrets: they authenticate with\n// the context's `credentials.computersAccess` and `credentials.deviceAccess`.\nexport const DEVICE_API_ACTING_USER_HEADER = 'Final-Acting-User-Id';\n\nexport enum ComputerWorkspacePolicy {\n // The disk lives as long as the agent's session.\n Session = 'session',\n // The disk belongs to the conversation: every agent in it shares it and a session reset keeps it.\n Conversation = 'conversation',\n // The disk is discarded when the sandbox is released.\n Ephemeral = 'ephemeral',\n}\n\nexport enum TemplateWhenMissing {\n Skip = 'skip',\n Fail = 'fail',\n}\n\n// Repository aliases mount at /workspaces/<alias>.\nexport const repositoryAliasSchema = z\n .string()\n .regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/)\n .max(120);\nconst variableNameSchema = z\n .string()\n .regex(/^[A-Za-z_][A-Za-z0-9_]*$/)\n .max(256);\n\nexport const computerRepositorySchema = z.object({\n alias: repositoryAliasSchema,\n // A repository the organization can reach, named as the host's repository\n // resolver accepts it (a GitHub 'final/app', a Final repository id), or a git URL.\n repository: z.string().min(1),\n ref: z.string().min(1).nullable().default(null),\n});\n\nexport const computerNetworkPolicySchema = z.union([\n z.nativeEnum(NetworkPolicy),\n z.object({ mode: z.nativeEnum(NetworkPolicy), allow: z.array(z.string()).default([]) }),\n]);\n\n// Start-time parameters; everything optional so a guide reference can override any subset.\nexport const computerParametersSchema = z.object({\n repositories: z.array(computerRepositorySchema).optional(),\n // Names of variables (secrets); values are injected at start, never stored here.\n variables: z.array(variableNameSchema).optional(),\n workspace: z.nativeEnum(ComputerWorkspacePolicy).optional(),\n networkPolicy: computerNetworkPolicySchema.optional(),\n // Plain, non-secret environment values.\n env: z.record(variableNameSchema, z.string().max(16 * 1024)).optional(),\n});\n\n// The subset of `.final/sandbox-template.yaml` v2 the computer sandbox reads.\nconst templateStepSchema = z.object({\n run: z\n .string()\n .min(1)\n .max(10 * 1024),\n cwd: z.string().min(1).default('.'),\n whenMissing: z.nativeEnum(TemplateWhenMissing).nullable().default(null),\n timeoutMinutes: z.number().int().min(1).max(120).default(20),\n required: z.boolean().default(true),\n});\nconst templateServiceSchema = templateStepSchema.extend({\n name: z\n .string()\n .regex(/^[a-z0-9][a-z0-9-]*$/)\n .max(64),\n ready: z\n .object({ url: z.string().url(), timeoutSeconds: z.number().int().min(1).max(600).default(90) })\n .nullable()\n .default(null),\n});\nconst templateCommandSchema = z.object({\n run: z\n .string()\n .min(1)\n .max(10 * 1024),\n description: z.string().min(1).max(500).nullable().default(null),\n cwd: z.string().min(1).default('.'),\n whenMissing: z.nativeEnum(TemplateWhenMissing).nullable().default(null),\n timeoutMinutes: z.number().int().min(1).max(120).default(20),\n});\n\nexport const computerTemplateSchema = z.object({\n version: z.literal(2).default(2),\n build: z\n .object({\n timeoutMinutes: z.number().int().min(1).max(120).default(30),\n steps: z.array(templateStepSchema).max(30).default([]),\n verify: z.array(templateStepSchema).max(30).default([]),\n })\n .prefault({}),\n workspace: z.object({ setup: z.array(templateStepSchema).max(30).default([]) }).prefault({}),\n services: z.array(templateServiceSchema).max(20).default([]),\n commands: z\n .record(\n z\n .string()\n .regex(/^[a-z0-9][a-z0-9-]*$/)\n .max(64),\n templateCommandSchema,\n )\n .default({}),\n});\n\nexport const computerInlineGuideSchema = z.object({\n // An OCI image reference, or `lineage:<name>` for a platform image lineage.\n image: z.string().min(1),\n template: computerTemplateSchema.prefault({}),\n repositories: z.array(computerRepositorySchema).default([]),\n variables: z.array(variableNameSchema).default([]),\n});\n\nexport const computerEnvironmentSchema = z.union([\n z.strictObject({\n guide: z.strictObject({\n ref: z.string().min(1),\n version: z.union([z.literal('latest'), z.number().int().min(1)]).default('latest'),\n }),\n parameters: computerParametersSchema.prefault({}),\n }),\n z.strictObject({\n inline: computerInlineGuideSchema,\n parameters: computerParametersSchema.prefault({}),\n }),\n z.strictObject({ image: z.string().min(1), parameters: computerParametersSchema.prefault({}) }),\n // The organization's default guide.\n z.strictObject({ parameters: computerParametersSchema.prefault({}) }),\n]);\n\n// `.open({ access, attach })` of the `computer` and `device` sandboxes. `attach`\n// is the host's (lazy unless `on-prompt`); the provider reads only `access`.\nexport const computerOpenOptionsSchema = z.strictObject({\n access: z.nativeEnum(SandboxAccess).default(SandboxAccess.Write),\n attach: z.nativeEnum(SandboxAttach).optional(),\n});\n\nexport const deviceEnvironmentSchema = z.union([\n z.strictObject({ deviceId: z.string().uuid() }),\n // A pairing code the owner approved; resolved to a device at prepare.\n z.strictObject({ pairing: z.string().min(1) }),\n // The only Device of the user the session acts for.\n z.strictObject({}),\n]);\n\nexport type ComputerRepositoryIface = z.infer<typeof computerRepositorySchema>;\nexport type ComputerParametersIface = z.infer<typeof computerParametersSchema>;\nexport type ComputerTemplateIface = z.infer<typeof computerTemplateSchema>;\nexport type ComputerTemplateInputIface = z.input<typeof computerTemplateSchema>;\nexport type ComputerInlineGuideIface = z.infer<typeof computerInlineGuideSchema>;\nexport type ComputerEnvironmentOptions = z.infer<typeof computerEnvironmentSchema>;\nexport type ComputerOpenOptionsIface = z.infer<typeof computerOpenOptionsSchema>;\nexport type ComputerNetworkPolicyOption = z.infer<typeof computerNetworkPolicySchema>;\nexport type DeviceEnvironmentOptions = z.infer<typeof deviceEnvironmentSchema>;\n"],
5
+ "mappings": "AAAA,SAAS,eAAe,eAAe,qBAAqB;AAC5D,YAAY,OAAO;AAMZ,MAAM,6BAA6B;AACnC,MAAM,2BAA2B;AAIjC,MAAM,gCAAgC;AAEtC,IAAK,0BAAL,kBAAKA,6BAAL;AAEL,EAAAA,yBAAA,aAAU;AAEV,EAAAA,yBAAA,kBAAe;AAEf,EAAAA,yBAAA,eAAY;AANF,SAAAA;AAAA,GAAA;AASL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAML,MAAM,wBAAwB,EAClC,OAAO,EACP,MAAM,8BAA8B,EACpC,IAAI,G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EAAE,CAAC;AACtE,CAAC;AAIM,MAAM,4BAA4B,EAAE,aAAa;AAAA,EACtD,QAAQ,EAAE,WAAW,aAAa,EAAE,QAAQ,cAAc,KAAK;AAAA,EAC/D,QAAQ,EAAE,WAAW,aAAa,EAAE,SAAS;AAC/C,CAAC;AAEM,MAAM,0BAA0B,EAAE,MAAM;AAAA,EAC7C,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAAA;AAAA,EAE9C,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;AAAA;AAAA,EAE7C,EAAE,aAAa,CAAC,CAAC;AACnB,CAAC;",
6
6
  "names": ["ComputerWorkspacePolicy", "TemplateWhenMissing"]
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import { type JsonObject, type NetworkPolicy, type NetworkSandboxSessionIface, type PackageProviderRefIface, type SandboxAccess, type SandboxAttach, type SandboxEnvironmentIface, type SandboxOpenRequestIface } from '@finalai/agent-provider';
2
2
  import { type ComputerTemplateInputIface, type ComputerWorkspacePolicy } from "./environment.mjs";
3
- export { COMPUTER_SANDBOX_SPECIFIER, computerEnvironmentSchema, ComputerWorkspacePolicy, DEVICE_API_ACTING_USER_HEADER, DEVICE_API_KEY_SECRET, DEVICE_SANDBOX_SPECIFIER, deviceEnvironmentSchema, TemplateWhenMissing, } from "./environment.mjs";
3
+ export { COMPUTER_SANDBOX_SPECIFIER, computerEnvironmentSchema, ComputerWorkspacePolicy, DEVICE_API_ACTING_USER_HEADER, DEVICE_SANDBOX_SPECIFIER, deviceEnvironmentSchema, TemplateWhenMissing, } from "./environment.mjs";
4
4
  export type { ComputerEnvironmentOptions, ComputerRepositoryIface, ComputerTemplateIface, ComputerTemplateInputIface, DeviceEnvironmentOptions, } from "./environment.mjs";
5
5
  type EnumInput<E extends string> = E | `${E}`;
6
6
  export interface SandboxOpenInputIface {
@@ -16,7 +16,6 @@ import {
16
16
  computerEnvironmentSchema as computerEnvironmentSchema2,
17
17
  ComputerWorkspacePolicy,
18
18
  DEVICE_API_ACTING_USER_HEADER,
19
- DEVICE_API_KEY_SECRET,
20
19
  DEVICE_SANDBOX_SPECIFIER as DEVICE_SANDBOX_SPECIFIER2,
21
20
  deviceEnvironmentSchema as deviceEnvironmentSchema2,
22
21
  TemplateWhenMissing
@@ -108,7 +107,6 @@ export {
108
107
  COMPUTER_SANDBOX_SPECIFIER2 as COMPUTER_SANDBOX_SPECIFIER,
109
108
  ComputerWorkspacePolicy,
110
109
  DEVICE_API_ACTING_USER_HEADER,
111
- DEVICE_API_KEY_SECRET,
112
110
  DEVICE_SANDBOX_SPECIFIER2 as DEVICE_SANDBOX_SPECIFIER,
113
111
  TemplateWhenMissing,
114
112
  computer,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/sandboxes/index.ts"],
4
- "sourcesContent": ["import {\n awaitableOpenRequest,\n jsonObjectSchema,\n packageRef,\n type JsonObject,\n type NetworkPolicy,\n type NetworkSandboxSessionIface,\n type PackageProviderRefIface,\n type SandboxAccess,\n type SandboxAttach,\n type SandboxEnvironmentIface,\n type SandboxOpenRequestIface,\n} from '@finalai/agent-provider';\nimport * as z from 'zod';\nimport {\n COMPUTER_SANDBOX_SPECIFIER,\n computerEnvironmentSchema,\n computerOpenOptionsSchema,\n DEVICE_SANDBOX_SPECIFIER,\n deviceEnvironmentSchema,\n type ComputerOpenOptionsIface,\n type ComputerTemplateInputIface,\n type ComputerWorkspacePolicy,\n} from \"./environment.mjs\";\n\n// Authoring helpers for `computer` and `device` in sandbox.ts. Each returns\n// a sandbox environment whose `.open()` yields the\n// binding request the compiler records (`providerRef`, as every provider package's\n// helpers name it). The agent compiler bundles this module itself, so what an\n// authored definition records is exactly what the provider validates. Runtime\n// factories live in `./sandboxes/computer` and `./sandboxes/device`.\n\nexport {\n COMPUTER_SANDBOX_SPECIFIER,\n computerEnvironmentSchema,\n ComputerWorkspacePolicy,\n DEVICE_API_ACTING_USER_HEADER,\n DEVICE_API_KEY_SECRET,\n DEVICE_SANDBOX_SPECIFIER,\n deviceEnvironmentSchema,\n TemplateWhenMissing,\n} from \"./environment.mjs\";\nexport type {\n ComputerEnvironmentOptions,\n ComputerRepositoryIface,\n ComputerTemplateIface,\n ComputerTemplateInputIface,\n DeviceEnvironmentOptions,\n} from \"./environment.mjs\";\n\ntype EnumInput<E extends string> = E | `${E}`;\n\nexport interface SandboxOpenInputIface {\n access?: EnumInput<SandboxAccess>;\n // `on-prompt` attaches when a prompt arrives instead of on the first tool call.\n attach?: EnumInput<SandboxAttach>;\n}\n\nexport interface InstalledSandboxOpenRequestIface extends SandboxOpenRequestIface<\n JsonObject,\n JsonObject\n> {\n readonly provider: PackageProviderRefIface;\n readonly providerRef: PackageProviderRefIface;\n}\n\nexport interface InstalledSandboxEnvironmentIface extends SandboxEnvironmentIface<\n JsonObject,\n SandboxOpenInputIface\n> {\n readonly provider: PackageProviderRefIface;\n readonly providerRef: PackageProviderRefIface;\n // Awaitable inside a sandbox.ts selector, where it opens the sandbox.\n open(\n options?: SandboxOpenInputIface,\n ): InstalledSandboxOpenRequestIface & PromiseLike<NetworkSandboxSessionIface>;\n}\n\nexport interface ComputerRepositoryInputIface {\n alias: string;\n repository: string;\n ref?: string | null;\n}\n\nexport interface ComputerParametersInputIface {\n repositories?: ComputerRepositoryInputIface[];\n // Names of organization variables managed in Build; values are injected at start.\n variables?: string[];\n workspace?: EnumInput<ComputerWorkspacePolicy>;\n networkPolicy?: EnumInput<NetworkPolicy> | { mode: EnumInput<NetworkPolicy>; allow?: string[] };\n // Plain, non-secret values; secrets can only be named in `variables`.\n env?: Record<string, string>;\n}\n\nexport interface ComputerSetupGuideInputIface extends ComputerParametersInputIface {\n // Slug of a guide saved in Build.\n ref: string;\n version?: number | 'latest';\n}\n\nexport interface ComputerInlineGuideInputIface {\n // An OCI image reference, or `lineage:<name>` for a platform image lineage.\n image: string;\n template: ComputerTemplateInputIface;\n repositories?: ComputerRepositoryInputIface[];\n variables?: string[];\n}\n\nexport interface ComputerInputIface extends ComputerParametersInputIface {\n image?: string;\n}\n\nexport interface DeviceInputIface {\n deviceId?: string;\n pairing?: string;\n}\n\ninterface RecordedInlineGuideIface {\n image: string;\n template: ComputerTemplateInputIface;\n repositories: ComputerRepositoryInputIface[];\n variables: string[];\n}\n\ntype RecordedInput =\n | ComputerParametersInputIface\n | DeviceInputIface\n | RecordedInlineGuideIface\n | ComputerOpenOptionsIface;\n\n// The helper's input as JSON; JSON.stringify drops undefined members, so the\n// recorded manifest is stable.\nconst recorded = (value: RecordedInput): JsonObject =>\n jsonObjectSchema.parse(JSON.parse(JSON.stringify(value)));\n\nconst validated = (schema: z.ZodType, value: JsonObject, label: string): JsonObject => {\n const parsed = schema.safeParse(value);\n if (!parsed.success) throw new Error(`invalid ${label}: ${parsed.error.message}`);\n return value;\n};\n\nconst validatedOpen = (\n openOptions: SandboxOpenInputIface,\n providerName: string,\n): ComputerOpenOptionsIface => {\n const parsed = computerOpenOptionsSchema.safeParse(openOptions);\n if (!parsed.success)\n throw new Error(`invalid ${providerName} open options: ${parsed.error.message}`);\n return parsed.data;\n};\n\nconst environmentFor = (args: {\n providerName: string;\n specifier: string;\n options: JsonObject;\n authoringWarnings?: readonly string[];\n}): InstalledSandboxEnvironmentIface => {\n const provider = packageRef(args.specifier);\n return {\n provider,\n providerRef: provider,\n providerName: args.providerName,\n options: args.options,\n authoringWarnings: args.authoringWarnings,\n open: (openOptions) =>\n awaitableOpenRequest({\n provider,\n providerRef: provider,\n providerName: args.providerName,\n environmentOptions: args.options,\n openOptions: recorded(validatedOpen(openOptions ?? {}, args.providerName)),\n authoringWarnings: args.authoringWarnings,\n }),\n };\n};\n\nconst computerProviderRef = packageRef(COMPUTER_SANDBOX_SPECIFIER);\n\nconst computerEnvironment = (options: JsonObject): InstalledSandboxEnvironmentIface => {\n const environment: Parameters<typeof environmentFor>[0] = {\n providerName: 'computer',\n specifier: COMPUTER_SANDBOX_SPECIFIER,\n options: validated(computerEnvironmentSchema, options, 'computer environment'),\n };\n if (options['inline'] != null)\n environment.authoringWarnings = [\n 'This inline computer guide builds its base on first use, which may take minutes. Publish a saved setup guide to prepare the base ahead of time.',\n ];\n return environmentFor(environment);\n};\n\nconst parametersOf = (input: ComputerParametersInputIface): JsonObject =>\n recorded({\n repositories: input.repositories,\n variables: input.variables,\n workspace: input.workspace,\n networkPolicy: input.networkPolicy,\n env: input.env,\n });\n\nconst guideReference = (input: ComputerSetupGuideInputIface): InstalledSandboxEnvironmentIface =>\n computerEnvironment({\n guide: { ref: input.ref, version: input.version ?? 'latest' },\n parameters: parametersOf(input),\n });\n\nconst inlineGuide = (input: ComputerInlineGuideInputIface): InstalledSandboxEnvironmentIface =>\n computerEnvironment({\n inline: recorded({\n image: input.image,\n template: input.template,\n repositories: input.repositories ?? [],\n variables: input.variables ?? [],\n }),\n });\n\n// A saved computer setup guide by reference; every argument after `ref`/`version`\n// overrides that version's saved defaults. `.define(...)` binds an inline guide,\n// whose base is built on first use.\n// `providerRef` names the provider for `defineDynamic({ provider: computer, ... })`.\nexport const computerSetupGuide = Object.assign(guideReference, {\n define: inlineGuide,\n providerRef: computerProviderRef,\n});\n\n// The organization's default guide with an ephemeral workspace, or just an image.\nexport const computer = Object.assign(\n (input: ComputerInputIface = {}): InstalledSandboxEnvironmentIface => {\n const parameters = parametersOf({ workspace: 'ephemeral', ...input });\n return computerEnvironment(\n input.image == null ? { parameters } : { image: input.image, parameters },\n );\n },\n { providerRef: computerProviderRef },\n);\n\n// A Final Device: by id, by an approved pairing code, or the organization's default.\nexport const device = Object.assign(\n (input: DeviceInputIface = {}): InstalledSandboxEnvironmentIface =>\n environmentFor({\n providerName: 'device',\n specifier: DEVICE_SANDBOX_SPECIFIER,\n options: validated(deviceEnvironmentSchema, recorded(input), 'device environment'),\n }),\n { providerRef: packageRef(DEVICE_SANDBOX_SPECIFIER) },\n);\n"],
5
- "mappings": "AAAA;AAAA,EAC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AAU,yBAAyB,SAAS,KAAK,GAAG,oBAAoB;AAAA,EACnF,CAAC;AAAA,EACH,EAAE,aAAa,WAAW,wBAAwB,EAAE;AACtD;",
4
+ "sourcesContent": ["import {\n awaitableOpenRequest,\n jsonObjectSchema,\n packageRef,\n type JsonObject,\n type NetworkPolicy,\n type NetworkSandboxSessionIface,\n type PackageProviderRefIface,\n type SandboxAccess,\n type SandboxAttach,\n type SandboxEnvironmentIface,\n type SandboxOpenRequestIface,\n} from '@finalai/agent-provider';\nimport * as z from 'zod';\nimport {\n COMPUTER_SANDBOX_SPECIFIER,\n computerEnvironmentSchema,\n computerOpenOptionsSchema,\n DEVICE_SANDBOX_SPECIFIER,\n deviceEnvironmentSchema,\n type ComputerOpenOptionsIface,\n type ComputerTemplateInputIface,\n type ComputerWorkspacePolicy,\n} from \"./environment.mjs\";\n\n// Authoring helpers for `computer` and `device` in sandbox.ts. Each returns\n// a sandbox environment whose `.open()` yields the\n// binding request the compiler records (`providerRef`, as every provider package's\n// helpers name it). The agent compiler bundles this module itself, so what an\n// authored definition records is exactly what the provider validates. Runtime\n// factories live in `./sandboxes/computer` and `./sandboxes/device`.\n\nexport {\n COMPUTER_SANDBOX_SPECIFIER,\n computerEnvironmentSchema,\n ComputerWorkspacePolicy,\n DEVICE_API_ACTING_USER_HEADER,\n DEVICE_SANDBOX_SPECIFIER,\n deviceEnvironmentSchema,\n TemplateWhenMissing,\n} from \"./environment.mjs\";\nexport type {\n ComputerEnvironmentOptions,\n ComputerRepositoryIface,\n ComputerTemplateIface,\n ComputerTemplateInputIface,\n DeviceEnvironmentOptions,\n} from \"./environment.mjs\";\n\ntype EnumInput<E extends string> = E | `${E}`;\n\nexport interface SandboxOpenInputIface {\n access?: EnumInput<SandboxAccess>;\n // `on-prompt` attaches when a prompt arrives instead of on the first tool call.\n attach?: EnumInput<SandboxAttach>;\n}\n\nexport interface InstalledSandboxOpenRequestIface extends SandboxOpenRequestIface<\n JsonObject,\n JsonObject\n> {\n readonly provider: PackageProviderRefIface;\n readonly providerRef: PackageProviderRefIface;\n}\n\nexport interface InstalledSandboxEnvironmentIface extends SandboxEnvironmentIface<\n JsonObject,\n SandboxOpenInputIface\n> {\n readonly provider: PackageProviderRefIface;\n readonly providerRef: PackageProviderRefIface;\n // Awaitable inside a sandbox.ts selector, where it opens the sandbox.\n open(\n options?: SandboxOpenInputIface,\n ): InstalledSandboxOpenRequestIface & PromiseLike<NetworkSandboxSessionIface>;\n}\n\nexport interface ComputerRepositoryInputIface {\n alias: string;\n repository: string;\n ref?: string | null;\n}\n\nexport interface ComputerParametersInputIface {\n repositories?: ComputerRepositoryInputIface[];\n // Names of variables (secrets managed in Build); values are injected at start.\n variables?: string[];\n workspace?: EnumInput<ComputerWorkspacePolicy>;\n networkPolicy?: EnumInput<NetworkPolicy> | { mode: EnumInput<NetworkPolicy>; allow?: string[] };\n // Plain, non-secret values; secrets can only be named in `variables`.\n env?: Record<string, string>;\n}\n\nexport interface ComputerSetupGuideInputIface extends ComputerParametersInputIface {\n // Slug of a guide saved in Build.\n ref: string;\n version?: number | 'latest';\n}\n\nexport interface ComputerInlineGuideInputIface {\n // An OCI image reference, or `lineage:<name>` for a platform image lineage.\n image: string;\n template: ComputerTemplateInputIface;\n repositories?: ComputerRepositoryInputIface[];\n variables?: string[];\n}\n\nexport interface ComputerInputIface extends ComputerParametersInputIface {\n image?: string;\n}\n\nexport interface DeviceInputIface {\n deviceId?: string;\n pairing?: string;\n}\n\ninterface RecordedInlineGuideIface {\n image: string;\n template: ComputerTemplateInputIface;\n repositories: ComputerRepositoryInputIface[];\n variables: string[];\n}\n\ntype RecordedInput =\n | ComputerParametersInputIface\n | DeviceInputIface\n | RecordedInlineGuideIface\n | ComputerOpenOptionsIface;\n\n// The helper's input as JSON; JSON.stringify drops undefined members, so the\n// recorded manifest is stable.\nconst recorded = (value: RecordedInput): JsonObject =>\n jsonObjectSchema.parse(JSON.parse(JSON.stringify(value)));\n\nconst validated = (schema: z.ZodType, value: JsonObject, label: string): JsonObject => {\n const parsed = schema.safeParse(value);\n if (!parsed.success) throw new Error(`invalid ${label}: ${parsed.error.message}`);\n return value;\n};\n\nconst validatedOpen = (\n openOptions: SandboxOpenInputIface,\n providerName: string,\n): ComputerOpenOptionsIface => {\n const parsed = computerOpenOptionsSchema.safeParse(openOptions);\n if (!parsed.success)\n throw new Error(`invalid ${providerName} open options: ${parsed.error.message}`);\n return parsed.data;\n};\n\nconst environmentFor = (args: {\n providerName: string;\n specifier: string;\n options: JsonObject;\n authoringWarnings?: readonly string[];\n}): InstalledSandboxEnvironmentIface => {\n const provider = packageRef(args.specifier);\n return {\n provider,\n providerRef: provider,\n providerName: args.providerName,\n options: args.options,\n authoringWarnings: args.authoringWarnings,\n open: (openOptions) =>\n awaitableOpenRequest({\n provider,\n providerRef: provider,\n providerName: args.providerName,\n environmentOptions: args.options,\n openOptions: recorded(validatedOpen(openOptions ?? {}, args.providerName)),\n authoringWarnings: args.authoringWarnings,\n }),\n };\n};\n\nconst computerProviderRef = packageRef(COMPUTER_SANDBOX_SPECIFIER);\n\nconst computerEnvironment = (options: JsonObject): InstalledSandboxEnvironmentIface => {\n const environment: Parameters<typeof environmentFor>[0] = {\n providerName: 'computer',\n specifier: COMPUTER_SANDBOX_SPECIFIER,\n options: validated(computerEnvironmentSchema, options, 'computer environment'),\n };\n if (options['inline'] != null)\n environment.authoringWarnings = [\n 'This inline computer guide builds its base on first use, which may take minutes. Publish a saved setup guide to prepare the base ahead of time.',\n ];\n return environmentFor(environment);\n};\n\nconst parametersOf = (input: ComputerParametersInputIface): JsonObject =>\n recorded({\n repositories: input.repositories,\n variables: input.variables,\n workspace: input.workspace,\n networkPolicy: input.networkPolicy,\n env: input.env,\n });\n\nconst guideReference = (input: ComputerSetupGuideInputIface): InstalledSandboxEnvironmentIface =>\n computerEnvironment({\n guide: { ref: input.ref, version: input.version ?? 'latest' },\n parameters: parametersOf(input),\n });\n\nconst inlineGuide = (input: ComputerInlineGuideInputIface): InstalledSandboxEnvironmentIface =>\n computerEnvironment({\n inline: recorded({\n image: input.image,\n template: input.template,\n repositories: input.repositories ?? [],\n variables: input.variables ?? [],\n }),\n });\n\n// A saved computer setup guide by reference; every argument after `ref`/`version`\n// overrides that version's saved defaults. `.define(...)` binds an inline guide,\n// whose base is built on first use.\n// `providerRef` names the provider for `defineDynamic({ provider: computer, ... })`.\nexport const computerSetupGuide = Object.assign(guideReference, {\n define: inlineGuide,\n providerRef: computerProviderRef,\n});\n\n// The organization's default guide with an ephemeral workspace, or just an image.\nexport const computer = Object.assign(\n (input: ComputerInputIface = {}): InstalledSandboxEnvironmentIface => {\n const parameters = parametersOf({ workspace: 'ephemeral', ...input });\n return computerEnvironment(\n input.image == null ? { parameters } : { image: input.image, parameters },\n );\n },\n { providerRef: computerProviderRef },\n);\n\n// A Final Device: by id, by an approved pairing code, or the organization's default.\nexport const device = Object.assign(\n (input: DeviceInputIface = {}): InstalledSandboxEnvironmentIface =>\n environmentFor({\n providerName: 'device',\n specifier: DEVICE_SANDBOX_SPECIFIER,\n options: validated(deviceEnvironmentSchema, recorded(input), 'device environment'),\n }),\n { providerRef: packageRef(DEVICE_SANDBOX_SPECIFIER) },\n);\n"],
5
+ "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OASK;AACP,YAAY,OAAO;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AASP;AAAA,EACE,8BAAAA;AAAA,EACA,6BAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAAAC;AAAA,EACA,2BAAAC;AAAA,EACA;AAAA,OACK;AA2FP,MAAM,WAAW,CAAC,UAChB,iBAAiB,MAAM,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC,CAAC;AAE1D,MAAM,YAAY,CAAC,QAAmB,OAAmB,UAA8B;AACrF,QAAM,SAAS,OAAO,UAAU,KAAK;AACrC,MAAI,CAAC,OAAO,QAAS,OAAM,IAAI,MAA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M,WAAW,SAAS;AAAA,EAC5D,YAAY,aAAa,KAAK;AAChC,CAAC;AAEH,MAAM,cAAc,CAAC,UACnB,oBAAoB;AAAA,EAClB,QAAQ,SAAS;AAAA,IACf,OAAO,MAAM;AAAA,IACb,UAAU,MAAM;AAAA,IAChB,cAAc,MAAM,gBAAgB,CAAC;AAAA,IACrC,WAAW,MAAM,aAAa,CAAC;AAAA,EACjC,CAAC;AACH,CAAC;AAMI,MAAM,qBAAqB,OAAO,OAAO,gBAAgB;AAAA,EAC9D,QAAQ;AAAA,EACR,aAAa;AACf,CAAC;AAGM,MAAM,WAAW,OAAO;AAAA,EAC7B,CAAC,QAA4B,CAAC,MAAwC;AACpE,UAAM,aAAa,aAAa,EAAE,WAAW,aAAa,GAAG,MAAM,CAAC;AACpE,WAAO;AAAA,MACL,MAAM,SAAS,OAAO,EAAE,WAAW,IAAI,EAAE,OAAO,MAAM,OAAO,WAAW;AAAA,IAC1E;AAAA,EACF;AAAA,EACA,EAAE,aAAa,oBAAoB;AACrC;AAGO,MAAM,SAAS,OAAO;AAAA,EAC3B,CAAC,QAA0B,CAAC,MAC1B,eAAe;AAAA,IACb,cAAc;AAAA,IACd,WAAW;AAAA,IACX,SAAS,UAAU,yBAAyB,SAAS,KAAK,GAAG,oBAAoB;AAAA,EACnF,CAAC;AAAA,EACH,EAAE,aAAa,WAAW,wBAAwB,EAAE;AACtD;",
6
6
  "names": ["COMPUTER_SANDBOX_SPECIFIER", "computerEnvironmentSchema", "DEVICE_SANDBOX_SPECIFIER", "deviceEnvironmentSchema"]
7
7
  }
@@ -31,7 +31,6 @@ const createComputerSchema = z.strictObject({
31
31
  egress: z.nativeEnum(ComputerEgressPolicy),
32
32
  allow: z.array(z.string()).optional()
33
33
  }).optional(),
34
- teamId: z.string().startsWith("team_").optional(),
35
34
  vcpu: z.number().optional(),
36
35
  memoryMb: z.number().optional(),
37
36
  diskGb: z.number().optional(),
@@ -94,7 +93,8 @@ const createFakeComputersApi = (args = {}) => {
94
93
  state: computer.state,
95
94
  network: computer.body.network ?? { egress: ComputerEgressPolicy.Internet },
96
95
  imageVersionId: z.string().nullable().catch(null).parse(computer.body.imageVersionId ?? null),
97
- teamId: z.string().nullable().catch(null).parse(computer.body.teamId ?? null),
96
+ // The token's project: the API infers it.
97
+ projectId: "prj_fake",
98
98
  hostname: `${computer.name}-k3p9x7qd.virtual-machine.lax-2.example`,
99
99
  tags: []
100
100
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/sandboxes/testing/fake-backends.ts"],
4
- "sourcesContent": ["import {\n jsonObjectSchema,\n jsonValueSchema,\n type JsonObject,\n type JsonValue,\n} from '@finalai/agent-provider';\nimport { ComputerEgressPolicy } from '@finalai/computers';\nimport { posix } from 'node:path';\nimport * as z from 'zod';\nimport { concatBytes, decodeBase64, encodeBase64 } from \"../bytes.mjs\";\nimport { createFakeMachine, readFakeOutput, type FakeMachineIface } from \"./fake-machine.mjs\";\n\n// A fake public Computers API (vm-service `/v1` over fetch, API-key bearer),\n// backed by in-memory machines. The `device` provider's fakes live with the\n// Device API (device-api-service/src/testing), which it is tested against.\n\nexport interface FakeComputerIface {\n id: string;\n name: string;\n state: number;\n body: JsonObject;\n machine: FakeMachineIface;\n}\n\nexport interface FakeImageIface {\n id: string;\n source: 'platform' | 'customer';\n reference: string;\n lineage: string;\n state: 'pending' | 'building' | 'ready' | 'failed' | 'expired';\n error: string | null;\n}\n\nexport interface FakeBaseIface {\n id: string;\n computerId: string;\n state: 'capturing' | 'ready' | 'failed' | 'expired';\n error: string | null;\n retained: boolean;\n}\n\nexport interface FakeComputersApiIface {\n fetch: typeof fetch;\n computers: Map<string, FakeComputerIface>;\n images: Map<string, FakeImageIface>;\n bases: Map<string, FakeBaseIface>;\n // Base reads a fresh capture answers `capturing` before it settles.\n baseCaptureReads: { count: number };\n // Set: the next captures settle `failed` with this error instead of `ready`.\n captureFailure: { error: string | null };\n requests: { method: string; path: string; body: JsonValue; headers: Headers }[];\n actions: { computerId: string; action: string }[];\n // Actions answered 409 (a conflicting transition) without changing the computer.\n actionConflicts: Set<string>;\n // Actions answered with this status (a failed host command) without changing the computer.\n actionFailures: Map<string, number>;\n // Computer reads a stopped computer answers `stopped` before it is shelved.\n shelveReads: { count: number };\n // Image reads a fresh registration answers `building` before it is ready.\n imageBuildReads: { count: number };\n // Computer reads a created or started computer answers `pending` (a resumed\n // one `resuming`) before it runs; until then commands and files answer 409.\n bootReads: { count: number };\n computerByName(name: string): FakeComputerIface | undefined;\n}\n\nconst STATE = {\n Pending: 1,\n Running: 3,\n Paused: 4,\n Stopped: 5,\n Resuming: 6,\n Error: 8,\n Deleted: 9,\n Shelved: 10,\n} as const;\nconst NOT_RUNNING = 'Computer is not running; resume it explicitly before this operation';\nexport const FAKE_COMPUTERS_API_KEY = 'fk_org_api_key';\nexport const FAKE_PLATFORM_SANDBOX_IMAGE = 'cimv_0190e0000000700080000000000001';\n\nconst json = (body: JsonValue, status = 200): Response =>\n new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } });\n\n// What POST /v1/computers accepts (vm-service/src/routes/v1.ts); anything else,\n// such as the internal surface's image, lineage, projectArtifact or the\n// platform-only policies, is refused so a test fails when the provider asks for it.\nconst createComputerSchema = z.strictObject({\n name: z.string().optional(),\n regionSlug: z.string().optional(),\n imageVersionId: z.string().startsWith('cimv_').optional(),\n baseId: z.string().startsWith('part_').optional(),\n idlePolicy: z.enum(['shelve', 'pause', 'delete']).optional(),\n network: z\n .strictObject({\n egress: z.nativeEnum(ComputerEgressPolicy),\n allow: z.array(z.string()).optional(),\n })\n .optional(),\n teamId: z.string().startsWith('team_').optional(),\n vcpu: z.number().optional(),\n memoryMb: z.number().optional(),\n diskGb: z.number().optional(),\n userVolumeGb: z.number().nullable().optional(),\n env: z.record(z.string(), z.string()).optional(),\n setupScript: z.string().optional(),\n commandMode: z.number().optional(),\n customCommand: z.string().optional(),\n httpPort: z.number().optional(),\n httpPublic: z.boolean().optional(),\n ephemeral: z.boolean().optional(),\n idleTimeoutSeconds: z.number().optional(),\n autoResume: z.boolean().optional(),\n tags: z.array(z.string()).optional(),\n comment: z.string().optional(),\n});\n\nexport const createFakeComputersApi = (\n args: {\n machineFor?: (computer: { id: string; name: string }) => FakeMachineIface;\n computerUseAvailable?: boolean;\n screenAvailable?: boolean;\n } = {},\n): FakeComputersApiIface => {\n const computers = new Map<string, FakeComputerIface>();\n const images = new Map<string, FakeImageIface>([\n [\n FAKE_PLATFORM_SANDBOX_IMAGE,\n {\n id: FAKE_PLATFORM_SANDBOX_IMAGE,\n source: 'platform',\n reference: 'ghcr.io/final/sandbox:release',\n lineage: 'sandbox',\n state: 'ready',\n error: null,\n },\n ],\n ]);\n const requests: FakeComputersApiIface['requests'] = [];\n const actions: FakeComputersApiIface['actions'] = [];\n const actionConflicts = new Set<string>();\n const actionFailures = new Map<string, number>();\n const shelveReads = { count: 0 };\n const shelving = new Map<string, number>();\n const imageBuildReads = { count: 1 };\n const bootReads = { count: 1 };\n const booting = new Map<string, number>();\n const boot = (computer: FakeComputerIface, state: number) => {\n if (bootReads.count <= 0) {\n computer.state = STATE.Running;\n return;\n }\n computer.state = state;\n booting.set(computer.id, bootReads.count);\n };\n const imageReads = new Map<string, number>();\n const bases = new Map<string, FakeBaseIface>();\n const baseCaptureReads = { count: 1 };\n const captureFailure: FakeComputersApiIface['captureFailure'] = { error: null };\n const captureErrors = new Map<string, string>();\n const baseReads = new Map<string, number>();\n let computerCount = 0;\n const byIdempotency = new Map<string, string>();\n\n const wire = (computer: FakeComputerIface) => ({\n id: computer.id,\n name: computer.name,\n state: computer.state,\n network: computer.body.network ?? { egress: ComputerEgressPolicy.Internet },\n imageVersionId: z\n .string()\n .nullable()\n .catch(null)\n .parse(computer.body.imageVersionId ?? null),\n teamId: z\n .string()\n .nullable()\n .catch(null)\n .parse(computer.body.teamId ?? null),\n hostname: `${computer.name}-k3p9x7qd.virtual-machine.lax-2.example`,\n tags: [],\n });\n const imageWire = (image: FakeImageIface) => ({\n ...image,\n digest: `sha256:${image.id}`,\n sizes: ['standard'],\n registryCredentialId: null,\n createdAt: null,\n readyAt: null,\n lastUsedAt: null,\n });\n const baseWire = (base: FakeBaseIface) => ({\n ...base,\n image: 'ghcr.io/final/sandbox:release',\n digest: `sha256:${'b'.repeat(64)}`,\n diskGb: 20,\n createdAt: null,\n readyAt: null,\n lastUsedAt: null,\n });\n const find = (idOrName: string): FakeComputerIface | undefined =>\n computers.get(idOrName) ??\n [...computers.values()].find(\n (computer) => computer.name === idOrName && computer.state !== STATE.Deleted,\n );\n\n const handle = async (request: Request): Promise<Response> => {\n const url = new URL(request.url);\n const text = request.method === 'GET' ? '' : await request.text();\n const body = text === '' ? null : jsonValueSchema.parse(JSON.parse(text));\n requests.push({ method: request.method, path: url.pathname, body, headers: request.headers });\n if (!url.pathname.startsWith('/v1/')) return json({ error: 'not found' }, 404);\n if (request.headers.get('authorization') !== `Bearer ${FAKE_COMPUTERS_API_KEY}`) {\n return json({ error: 'unauthorized' }, 401);\n }\n const path = url.pathname.slice('/v1'.length);\n if (request.method === 'POST' && path === '/computers') {\n const parsed = createComputerSchema.safeParse(body);\n if (!parsed.success) return json({ error: 'invalid body' }, 400);\n if ((parsed.data.imageVersionId == null) === (parsed.data.baseId == null)) {\n return json({ error: 'pass exactly one of imageVersionId and baseId' }, 400);\n }\n if (parsed.data.imageVersionId != null) {\n const image = images.get(parsed.data.imageVersionId);\n if (image == null) return json({ error: 'image version not found' }, 404);\n if (image.state !== 'ready') return json({ error: `image version is ${image.state}` }, 409);\n }\n if (parsed.data.baseId != null) {\n const base = bases.get(parsed.data.baseId);\n if (base == null) return json({ error: 'base not found' }, 404);\n if (base.state !== 'ready') return json({ error: `base is ${base.state}` }, 409);\n }\n const key = request.headers.get('idempotency-key');\n if (parsed.data.ephemeral === true && parsed.data.idlePolicy === 'pause')\n return json({ error: 'ephemeral VMs are always deleted when idle' }, 400);\n const existing = key == null ? undefined : computers.get(byIdempotency.get(key) ?? '');\n if (existing != null) return json({ computer: wire(existing) });\n computerCount += 1;\n const id = `comp_0190a0000000700080000000${String(computerCount).padStart(4, '0')}`;\n const name = parsed.data.name ?? `computer-${computerCount}`;\n const computer: FakeComputerIface = {\n id,\n name,\n state: STATE.Pending,\n body: jsonObjectSchema.parse(body),\n machine: args.machineFor?.({ id, name }) ?? createFakeMachine(),\n };\n boot(computer, STATE.Pending);\n computers.set(id, computer);\n if (key != null) byIdempotency.set(key, id);\n return json({ computer: wire(computer) });\n }\n if (request.method === 'GET' && path === '/images') {\n const lineage = url.searchParams.get('lineage');\n const state = url.searchParams.get('state');\n const matching = [...images.values()]\n .filter((image) => lineage == null || image.lineage === lineage)\n .filter((image) => state == null || image.state === state)\n .reverse();\n return json({ images: matching.map(imageWire) });\n }\n if (request.method === 'POST' && path === '/images') {\n const parsed = z\n .strictObject({\n reference: z.string(),\n registryCredentialId: z.string().optional(),\n sizes: z.array(z.string()).optional(),\n })\n .safeParse(body);\n if (!parsed.success) return json({ error: 'invalid body' }, 400);\n const known = [...images.values()].find(\n (image) =>\n image.reference === parsed.data.reference &&\n (image.state === 'pending' || image.state === 'building' || image.state === 'ready'),\n );\n if (known != null) return json({ image: imageWire(known) });\n const id = `cimv_0190f0000000700080000000${String(images.size + 1).padStart(4, '0')}`;\n const image: FakeImageIface = {\n id,\n source: 'customer',\n reference: parsed.data.reference,\n lineage: parsed.data.reference,\n state: 'building',\n error: null,\n };\n images.set(id, image);\n return json({ image: imageWire(image) }, 201);\n }\n const imageMatch = /^\\/images\\/([^/]+)$/.exec(path);\n if (request.method === 'GET' && imageMatch != null) {\n const image = images.get(decodeURIComponent(imageMatch[1] ?? ''));\n if (image == null) return json({ error: 'image not found' }, 404);\n const reads = (imageReads.get(image.id) ?? 0) + 1;\n imageReads.set(image.id, reads);\n if (image.state === 'building' && reads > imageBuildReads.count) image.state = 'ready';\n return json({ image: imageWire(image) });\n }\n if (request.method === 'POST' && path === '/tokens') {\n const parsed = z\n .strictObject({\n name: z.string(),\n computerId: z.string().startsWith('comp_').optional(),\n scopes: z.array(z.string()).optional(),\n expiresAt: z.string().optional(),\n })\n .safeParse(body);\n if (!parsed.success) return json({ error: 'invalid body' }, 400);\n return json({ id: 'ctok_1', token: 'fvm1.http-token' });\n }\n const baseMatch = /^\\/bases\\/([^/]+)$/.exec(path);\n if (request.method === 'PATCH' && baseMatch != null) {\n const base = bases.get(decodeURIComponent(baseMatch[1] ?? ''));\n if (base == null) return json({ error: 'base not found' }, 404);\n const retained = z.object({ retained: z.boolean() }).parse(body);\n base.retained = retained.retained;\n return json({ base: baseWire(base) });\n }\n if (request.method === 'GET' && baseMatch != null) {\n const base = bases.get(decodeURIComponent(baseMatch[1] ?? ''));\n if (base == null) return json({ error: 'base not found' }, 404);\n const reads = (baseReads.get(base.id) ?? 0) + 1;\n baseReads.set(base.id, reads);\n if (base.state === 'capturing' && reads > baseCaptureReads.count) {\n const error = captureErrors.get(base.id) ?? null;\n base.state = error == null ? 'ready' : 'failed';\n base.error = error;\n }\n return json({ base: baseWire(base) });\n }\n const computerMatch = /^\\/computers\\/([^/]+)(\\/.*)?$/.exec(path);\n if (computerMatch == null) return json({ error: `no route ${path}` }, 404);\n const computer = find(decodeURIComponent(computerMatch[1] ?? ''));\n if (computer == null || computer.state === STATE.Deleted)\n return json({ error: 'computer not found' }, 404);\n const rest = computerMatch[2] ?? '';\n const machine = computer.machine;\n if (request.method === 'GET' && rest === '/screen')\n return json({ available: args.screenAvailable ?? false });\n if (request.method === 'POST' && rest === '/screen')\n return json({\n url: `https://computer-api.example/v1/computers/${computer.id}/screen/view#screen-token`,\n token: 'screen-token',\n expiresAt: new Date(Date.now() + 900_000).toISOString(),\n });\n if (request.method === 'PATCH' && rest === '') {\n const patch = createComputerSchema.pick({ network: true, autoResume: true }).parse(body);\n if (patch.network != null) computer.body.network = patch.network;\n if (patch.autoResume != null) computer.body.autoResume = patch.autoResume;\n return json({ computer: wire(computer) });\n }\n if (request.method === 'GET' && rest === '/computer-use')\n return json({\n available: args.computerUseAvailable ?? false,\n installed: args.computerUseAvailable ?? false,\n });\n if (request.method === 'GET' && rest === '') {\n const starting = booting.get(computer.id);\n if (starting != null) {\n if (starting <= 0) {\n booting.delete(computer.id);\n computer.state = STATE.Running;\n } else booting.set(computer.id, starting - 1);\n }\n const left = shelving.get(computer.id);\n if (left != null) {\n if (left <= 0) {\n shelving.delete(computer.id);\n computer.state = STATE.Shelved;\n } else shelving.set(computer.id, left - 1);\n }\n return json({ computer: wire(computer) });\n }\n if (request.method === 'POST' && rest === '/capture') {\n if (computer.state !== STATE.Running) return json({ error: 'not running' }, 409);\n if (computer.body.userVolumeGb !== null) return json({ error: 'has a user volume' }, 409);\n const id = `part_0190b0000000700080000000${String(bases.size + 1).padStart(4, '0')}`;\n const capture = z.object({ retained: z.boolean().default(false) }).parse(body ?? {});\n const base: FakeBaseIface = {\n id,\n computerId: computer.id,\n state: 'capturing',\n error: null,\n retained: capture.retained,\n };\n bases.set(id, base);\n if (captureFailure.error != null) captureErrors.set(id, captureFailure.error);\n computer.state = STATE.Stopped;\n return json({ base: baseWire(base) }, 202);\n }\n const action = /^\\/actions\\/(.+)$/.exec(rest);\n if (request.method === 'POST' && action != null) {\n const name = action[1] ?? '';\n actions.push({ computerId: computer.id, action: name });\n if (actionConflicts.has(name))\n return json({ error: 'a lifecycle transition is committing' }, 409);\n const failure = actionFailures.get(name);\n if (failure != null) return json({ error: `${name} failed` }, failure);\n // vm-service pauses only a computer that runs (vm-ops applyVmLifecycleAction).\n if (name === 'pause' && computer.state === STATE.Shelved)\n return json({ error: 'VM is shelved; wake it before pausing' }, 409);\n if (name === 'pause' && computer.state === STATE.Stopped)\n return json({ error: 'VM is stopped; nothing to pause' }, 409);\n if (name === 'pause' && computer.state === STATE.Error)\n return json({ error: 'pause failed: cannot pause vm in state Error' }, 502);\n if (name !== 'resume' && name !== 'start') booting.delete(computer.id);\n if (name === 'pause') computer.state = STATE.Paused;\n if (name === 'resume') boot(computer, STATE.Resuming);\n if (name === 'start') boot(computer, STATE.Pending);\n // A computer that is not ephemeral shelves on stop (vm-service vm-ops).\n if (name === 'stop') {\n computer.state = shelveReads.count > 0 ? STATE.Stopped : STATE.Shelved;\n if (shelveReads.count > 0) shelving.set(computer.id, shelveReads.count);\n }\n if (name === 'delete') computer.state = STATE.Deleted;\n return json({ computer: wire(computer) });\n }\n if (\n computer.state !== STATE.Running &&\n (rest === '/exec' || rest === '/run' || rest === '/files' || rest.startsWith('/processes/'))\n )\n return json({ error: NOT_RUNNING }, 409);\n if (request.method === 'POST' && (rest === '/exec' || rest === '/run')) {\n const parsed = z\n .object({\n command: z.string(),\n cwd: z.string().optional(),\n env: z.record(z.string(), z.string()).optional(),\n })\n .parse(body);\n const process = machine.exec({\n id: `proc-${machine.execs.length + 1}`,\n command: parsed.command,\n cwd: parsed.cwd ?? '/',\n env: parsed.env ?? {},\n });\n if (rest === '/exec')\n return json({ id: process.id, bootId: process.bootId, pid: 1, state: 'running' });\n const output = await readFakeOutput(process, { stdout: 0, stderr: 0, waitMs: 50 });\n return json({\n id: process.id,\n bootId: process.bootId,\n pid: 1,\n timedOut: false,\n elapsedMs: 1,\n ...outputBody(output, process, 0, 0),\n });\n }\n const processMatch = /^\\/processes\\/([^/]+)\\/(output|input|terminate)$/.exec(rest);\n if (processMatch != null) {\n const process = machine.processes.get(processMatch[1] ?? '');\n if (process == null) return json({ error: 'process not found' }, 404);\n if (processMatch[2] === 'output') {\n const stdoutOffset = Number(url.searchParams.get('stdoutOffset') ?? 0);\n const stderrOffset = Number(url.searchParams.get('stderrOffset') ?? 0);\n const output = await readFakeOutput(process, {\n stdout: stdoutOffset,\n stderr: stderrOffset,\n waitMs: Number(url.searchParams.get('waitMs') ?? 0),\n });\n return json(outputBody(output, process, stdoutOffset, stderrOffset));\n }\n if (processMatch[2] === 'terminate') {\n process.terminate();\n return json({ ok: true });\n }\n const input = z\n .object({\n dataB64: z.string().optional(),\n eof: z.boolean().optional(),\n signal: z.string().optional(),\n })\n .parse(body);\n if (input.dataB64 != null) process.write(decodeBase64(input.dataB64));\n if (input.eof === true) process.eof();\n if (input.signal != null) process.terminate(input.signal);\n return json({ ok: true });\n }\n if (rest === '/files' && request.method === 'GET') {\n const path = url.searchParams.get('path') ?? '';\n // Reads follow symlinks.\n const content = machine.files.get(machine.links.get(path) ?? path);\n if (content == null) return json({ error: `${path}: No such file or directory` }, 502);\n const offset = Number(url.searchParams.get('offset') ?? 0);\n const length = Number(url.searchParams.get('length') ?? content.byteLength);\n const slice = content.subarray(offset, offset + length);\n return json({\n dataB64: encodeBase64(slice),\n eof: offset + slice.byteLength >= content.byteLength,\n offset,\n });\n }\n if (rest === '/files' && request.method === 'PUT') {\n const parsed = z\n .object({ path: z.string(), dataB64: z.string(), append: z.boolean().optional() })\n .parse(body);\n if (!machine.dirs.has(posix.dirname(parsed.path)))\n return json({ error: 'No such file or directory' }, 502);\n const data = decodeBase64(parsed.dataB64);\n const previous =\n parsed.append === true\n ? (machine.files.get(parsed.path) ?? new Uint8Array())\n : new Uint8Array();\n machine.files.set(parsed.path, concatBytes([previous, data]));\n return json({ bytesWritten: data.byteLength });\n }\n return json({ error: `no route ${request.method} ${path}` }, 404);\n };\n\n return {\n fetch: async (input, init) => handle(new Request(input, init)),\n computers,\n images,\n bases,\n baseCaptureReads,\n captureFailure,\n requests,\n actions,\n actionConflicts,\n actionFailures,\n shelveReads,\n imageBuildReads,\n bootReads,\n computerByName: (name) => [...computers.values()].find((computer) => computer.name === name),\n };\n};\n\nconst outputBody = (\n output: { stdout: Uint8Array; stderr: Uint8Array; exited: boolean },\n process: {\n exitCode: number | null;\n signal: string | null;\n stdout: Uint8Array;\n stderr: Uint8Array;\n },\n stdoutOffset: number,\n stderrOffset: number,\n) => ({\n stdout: {\n dataB64: encodeBase64(output.stdout),\n offset: stdoutOffset,\n nextOffset: stdoutOffset + output.stdout.byteLength,\n eof: output.exited && stdoutOffset + output.stdout.byteLength >= process.stdout.byteLength,\n },\n stderr: {\n dataB64: encodeBase64(output.stderr),\n offset: stderrOffset,\n nextOffset: stderrOffset + output.stderr.byteLength,\n eof: output.exited && stderrOffset + output.stderr.byteLength >= process.stderr.byteLength,\n },\n state: output.exited ? 'exited' : 'running',\n result: output.exited ? { exitCode: process.exitCode, signal: process.signal } : null,\n});\n"],
5
- "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,4BAA4B;AACrC,SAAS,aAAa;AACtB,YAAY,OAAO;AACnB,SAAS,aAAa,cAAc,oBAAoB;AACxD,SAAS,mBAAmB,sBAA6C;AAwDzE,MAAM,QAAQ;AAAA,EACZ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACX;AACA,MAAM,cAAc;AACb,MAAM,yBAAyB;AAC/B,MAAM,8BAA8B;AAE3C,MAAM,OAAO,CAAC,MAAiB,SAAS,QACtC,IAAI,SAAS,KAAK,UAAU,IAAI,GAAG,EAAE,QAAQ,SAAS,EAAE,gBAAgB,mBAAmB,EAAE,CAAC;AAKhG,MAAM,uBAAuB,EAAE,aAAa;AAAA,EAC1C,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,gBAAgB,EAAE,OAAO,EAAE,WAAW,OAAO,EAAE,SAAS;AAAA,EACxD,QAAQ,EAAE,OAAO,EAAE,WAAW,OAAO,EAAE,SAAS;AAAA,EAChD,YAAY,EAAE,KAAK,CAAC,UAAU,SAAS,QAAQ,CAAC,EAAE,SAAS;AAAA,EAC3D,SAAS,EACN,aAAa;AAAA,IACZ,QAAQ,EAAE,WAAW,oBAAoB;AAAA,IACzC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACtC,CAAC,EACA,SAAS;AAAA,EACZ,QAAQ,EAAE,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O,KAAK,EAAE,OAAO,YAAY,QAAQ,MAAM,IAAI,IAAI,GAAG,GAAG,GAAG;AAAA,EAClE;AAEA,SAAO;AAAA,IACL,OAAO,OAAO,OAAO,SAAS,OAAO,IAAI,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC7D;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,CAAC,SAAS,CAAC,GAAG,UAAU,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,SAAS,SAAS,IAAI;AAAA,EAC7F;AACF;AAEA,MAAM,aAAa,CACjB,QACA,SAMA,cACA,kBACI;AAAA,EACJ,QAAQ;AAAA,IACN,SAAS,aAAa,OAAO,MAAM;AAAA,IACnC,QAAQ;AAAA,IACR,YAAY,eAAe,OAAO,OAAO;AAAA,IACzC,KAAK,OAAO,UAAU,eAAe,OAAO,OAAO,cAAc,QAAQ,OAAO;AAAA,EAClF;AAAA,EACA,QAAQ;AAAA,IACN,SAAS,aAAa,OAAO,MAAM;AAAA,IACnC,QAAQ;AAAA,IACR,YAAY,eAAe,OAAO,OAAO;AAAA,IACzC,KAAK,OAAO,UAAU,eAAe,OAAO,OAAO,cAAc,QAAQ,OAAO;AAAA,EAClF;AAAA,EACA,OAAO,OAAO,SAAS,WAAW;AAAA,EAClC,QAAQ,OAAO,SAAS,EAAE,UAAU,QAAQ,UAAU,QAAQ,QAAQ,OAAO,IAAI;AACnF;",
4
+ "sourcesContent": ["import {\n jsonObjectSchema,\n jsonValueSchema,\n type JsonObject,\n type JsonValue,\n} from '@finalai/agent-provider';\nimport { ComputerEgressPolicy } from '@finalai/computers';\nimport { posix } from 'node:path';\nimport * as z from 'zod';\nimport { concatBytes, decodeBase64, encodeBase64 } from \"../bytes.mjs\";\nimport { createFakeMachine, readFakeOutput, type FakeMachineIface } from \"./fake-machine.mjs\";\n\n// A fake public Computers API (`/v1` over fetch, bearer token), backed by\n// in-memory machines.\n\nexport interface FakeComputerIface {\n id: string;\n name: string;\n state: number;\n body: JsonObject;\n machine: FakeMachineIface;\n}\n\nexport interface FakeImageIface {\n id: string;\n source: 'platform' | 'customer';\n reference: string;\n lineage: string;\n state: 'pending' | 'building' | 'ready' | 'failed' | 'expired';\n error: string | null;\n}\n\nexport interface FakeBaseIface {\n id: string;\n computerId: string;\n state: 'capturing' | 'ready' | 'failed' | 'expired';\n error: string | null;\n retained: boolean;\n}\n\nexport interface FakeComputersApiIface {\n fetch: typeof fetch;\n computers: Map<string, FakeComputerIface>;\n images: Map<string, FakeImageIface>;\n bases: Map<string, FakeBaseIface>;\n // Base reads a fresh capture answers `capturing` before it settles.\n baseCaptureReads: { count: number };\n // Set: the next captures settle `failed` with this error instead of `ready`.\n captureFailure: { error: string | null };\n requests: { method: string; path: string; body: JsonValue; headers: Headers }[];\n actions: { computerId: string; action: string }[];\n // Actions answered 409 (a conflicting transition) without changing the computer.\n actionConflicts: Set<string>;\n // Actions answered with this status (a failed host command) without changing the computer.\n actionFailures: Map<string, number>;\n // Computer reads a stopped computer answers `stopped` before it is shelved.\n shelveReads: { count: number };\n // Image reads a fresh registration answers `building` before it is ready.\n imageBuildReads: { count: number };\n // Computer reads a created or started computer answers `pending` (a resumed\n // one `resuming`) before it runs; until then commands and files answer 409.\n bootReads: { count: number };\n computerByName(name: string): FakeComputerIface | undefined;\n}\n\nconst STATE = {\n Pending: 1,\n Running: 3,\n Paused: 4,\n Stopped: 5,\n Resuming: 6,\n Error: 8,\n Deleted: 9,\n Shelved: 10,\n} as const;\nconst NOT_RUNNING = 'Computer is not running; resume it explicitly before this operation';\nexport const FAKE_COMPUTERS_API_KEY = 'fk_org_api_key';\nexport const FAKE_PLATFORM_SANDBOX_IMAGE = 'cimv_0190e0000000700080000000000001';\n\nconst json = (body: JsonValue, status = 200): Response =>\n new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } });\n\n// What POST /v1/computers accepts; anything else, such as image, lineage,\n// projectArtifact or platform-only policies, is refused so a test fails when the\n// provider asks for it.\nconst createComputerSchema = z.strictObject({\n name: z.string().optional(),\n regionSlug: z.string().optional(),\n imageVersionId: z.string().startsWith('cimv_').optional(),\n baseId: z.string().startsWith('part_').optional(),\n idlePolicy: z.enum(['shelve', 'pause', 'delete']).optional(),\n network: z\n .strictObject({\n egress: z.nativeEnum(ComputerEgressPolicy),\n allow: z.array(z.string()).optional(),\n })\n .optional(),\n vcpu: z.number().optional(),\n memoryMb: z.number().optional(),\n diskGb: z.number().optional(),\n userVolumeGb: z.number().nullable().optional(),\n env: z.record(z.string(), z.string()).optional(),\n setupScript: z.string().optional(),\n commandMode: z.number().optional(),\n customCommand: z.string().optional(),\n httpPort: z.number().optional(),\n httpPublic: z.boolean().optional(),\n ephemeral: z.boolean().optional(),\n idleTimeoutSeconds: z.number().optional(),\n autoResume: z.boolean().optional(),\n tags: z.array(z.string()).optional(),\n comment: z.string().optional(),\n});\n\nexport const createFakeComputersApi = (\n args: {\n machineFor?: (computer: { id: string; name: string }) => FakeMachineIface;\n computerUseAvailable?: boolean;\n screenAvailable?: boolean;\n } = {},\n): FakeComputersApiIface => {\n const computers = new Map<string, FakeComputerIface>();\n const images = new Map<string, FakeImageIface>([\n [\n FAKE_PLATFORM_SANDBOX_IMAGE,\n {\n id: FAKE_PLATFORM_SANDBOX_IMAGE,\n source: 'platform',\n reference: 'ghcr.io/final/sandbox:release',\n lineage: 'sandbox',\n state: 'ready',\n error: null,\n },\n ],\n ]);\n const requests: FakeComputersApiIface['requests'] = [];\n const actions: FakeComputersApiIface['actions'] = [];\n const actionConflicts = new Set<string>();\n const actionFailures = new Map<string, number>();\n const shelveReads = { count: 0 };\n const shelving = new Map<string, number>();\n const imageBuildReads = { count: 1 };\n const bootReads = { count: 1 };\n const booting = new Map<string, number>();\n const boot = (computer: FakeComputerIface, state: number) => {\n if (bootReads.count <= 0) {\n computer.state = STATE.Running;\n return;\n }\n computer.state = state;\n booting.set(computer.id, bootReads.count);\n };\n const imageReads = new Map<string, number>();\n const bases = new Map<string, FakeBaseIface>();\n const baseCaptureReads = { count: 1 };\n const captureFailure: FakeComputersApiIface['captureFailure'] = { error: null };\n const captureErrors = new Map<string, string>();\n const baseReads = new Map<string, number>();\n let computerCount = 0;\n const byIdempotency = new Map<string, string>();\n\n const wire = (computer: FakeComputerIface) => ({\n id: computer.id,\n name: computer.name,\n state: computer.state,\n network: computer.body.network ?? { egress: ComputerEgressPolicy.Internet },\n imageVersionId: z\n .string()\n .nullable()\n .catch(null)\n .parse(computer.body.imageVersionId ?? null),\n // The token's project: the API infers it.\n projectId: 'prj_fake',\n hostname: `${computer.name}-k3p9x7qd.virtual-machine.lax-2.example`,\n tags: [],\n });\n const imageWire = (image: FakeImageIface) => ({\n ...image,\n digest: `sha256:${image.id}`,\n sizes: ['standard'],\n registryCredentialId: null,\n createdAt: null,\n readyAt: null,\n lastUsedAt: null,\n });\n const baseWire = (base: FakeBaseIface) => ({\n ...base,\n image: 'ghcr.io/final/sandbox:release',\n digest: `sha256:${'b'.repeat(64)}`,\n diskGb: 20,\n createdAt: null,\n readyAt: null,\n lastUsedAt: null,\n });\n const find = (idOrName: string): FakeComputerIface | undefined =>\n computers.get(idOrName) ??\n [...computers.values()].find(\n (computer) => computer.name === idOrName && computer.state !== STATE.Deleted,\n );\n\n const handle = async (request: Request): Promise<Response> => {\n const url = new URL(request.url);\n const text = request.method === 'GET' ? '' : await request.text();\n const body = text === '' ? null : jsonValueSchema.parse(JSON.parse(text));\n requests.push({ method: request.method, path: url.pathname, body, headers: request.headers });\n if (!url.pathname.startsWith('/v1/')) return json({ error: 'not found' }, 404);\n if (request.headers.get('authorization') !== `Bearer ${FAKE_COMPUTERS_API_KEY}`) {\n return json({ error: 'unauthorized' }, 401);\n }\n const path = url.pathname.slice('/v1'.length);\n if (request.method === 'POST' && path === '/computers') {\n const parsed = createComputerSchema.safeParse(body);\n if (!parsed.success) return json({ error: 'invalid body' }, 400);\n if ((parsed.data.imageVersionId == null) === (parsed.data.baseId == null)) {\n return json({ error: 'pass exactly one of imageVersionId and baseId' }, 400);\n }\n if (parsed.data.imageVersionId != null) {\n const image = images.get(parsed.data.imageVersionId);\n if (image == null) return json({ error: 'image version not found' }, 404);\n if (image.state !== 'ready') return json({ error: `image version is ${image.state}` }, 409);\n }\n if (parsed.data.baseId != null) {\n const base = bases.get(parsed.data.baseId);\n if (base == null) return json({ error: 'base not found' }, 404);\n if (base.state !== 'ready') return json({ error: `base is ${base.state}` }, 409);\n }\n const key = request.headers.get('idempotency-key');\n if (parsed.data.ephemeral === true && parsed.data.idlePolicy === 'pause')\n return json({ error: 'ephemeral VMs are always deleted when idle' }, 400);\n const existing = key == null ? undefined : computers.get(byIdempotency.get(key) ?? '');\n if (existing != null) return json({ computer: wire(existing) });\n computerCount += 1;\n const id = `comp_0190a0000000700080000000${String(computerCount).padStart(4, '0')}`;\n const name = parsed.data.name ?? `computer-${computerCount}`;\n const computer: FakeComputerIface = {\n id,\n name,\n state: STATE.Pending,\n body: jsonObjectSchema.parse(body),\n machine: args.machineFor?.({ id, name }) ?? createFakeMachine(),\n };\n boot(computer, STATE.Pending);\n computers.set(id, computer);\n if (key != null) byIdempotency.set(key, id);\n return json({ computer: wire(computer) });\n }\n if (request.method === 'GET' && path === '/images') {\n const lineage = url.searchParams.get('lineage');\n const state = url.searchParams.get('state');\n const matching = [...images.values()]\n .filter((image) => lineage == null || image.lineage === lineage)\n .filter((image) => state == null || image.state === state)\n .reverse();\n return json({ images: matching.map(imageWire) });\n }\n if (request.method === 'POST' && path === '/images') {\n const parsed = z\n .strictObject({\n reference: z.string(),\n registryCredentialId: z.string().optional(),\n sizes: z.array(z.string()).optional(),\n })\n .safeParse(body);\n if (!parsed.success) return json({ error: 'invalid body' }, 400);\n const known = [...images.values()].find(\n (image) =>\n image.reference === parsed.data.reference &&\n (image.state === 'pending' || image.state === 'building' || image.state === 'ready'),\n );\n if (known != null) return json({ image: imageWire(known) });\n const id = `cimv_0190f0000000700080000000${String(images.size + 1).padStart(4, '0')}`;\n const image: FakeImageIface = {\n id,\n source: 'customer',\n reference: parsed.data.reference,\n lineage: parsed.data.reference,\n state: 'building',\n error: null,\n };\n images.set(id, image);\n return json({ image: imageWire(image) }, 201);\n }\n const imageMatch = /^\\/images\\/([^/]+)$/.exec(path);\n if (request.method === 'GET' && imageMatch != null) {\n const image = images.get(decodeURIComponent(imageMatch[1] ?? ''));\n if (image == null) return json({ error: 'image not found' }, 404);\n const reads = (imageReads.get(image.id) ?? 0) + 1;\n imageReads.set(image.id, reads);\n if (image.state === 'building' && reads > imageBuildReads.count) image.state = 'ready';\n return json({ image: imageWire(image) });\n }\n if (request.method === 'POST' && path === '/tokens') {\n const parsed = z\n .strictObject({\n name: z.string(),\n computerId: z.string().startsWith('comp_').optional(),\n scopes: z.array(z.string()).optional(),\n expiresAt: z.string().optional(),\n })\n .safeParse(body);\n if (!parsed.success) return json({ error: 'invalid body' }, 400);\n return json({ id: 'ctok_1', token: 'fvm1.http-token' });\n }\n const baseMatch = /^\\/bases\\/([^/]+)$/.exec(path);\n if (request.method === 'PATCH' && baseMatch != null) {\n const base = bases.get(decodeURIComponent(baseMatch[1] ?? ''));\n if (base == null) return json({ error: 'base not found' }, 404);\n const retained = z.object({ retained: z.boolean() }).parse(body);\n base.retained = retained.retained;\n return json({ base: baseWire(base) });\n }\n if (request.method === 'GET' && baseMatch != null) {\n const base = bases.get(decodeURIComponent(baseMatch[1] ?? ''));\n if (base == null) return json({ error: 'base not found' }, 404);\n const reads = (baseReads.get(base.id) ?? 0) + 1;\n baseReads.set(base.id, reads);\n if (base.state === 'capturing' && reads > baseCaptureReads.count) {\n const error = captureErrors.get(base.id) ?? null;\n base.state = error == null ? 'ready' : 'failed';\n base.error = error;\n }\n return json({ base: baseWire(base) });\n }\n const computerMatch = /^\\/computers\\/([^/]+)(\\/.*)?$/.exec(path);\n if (computerMatch == null) return json({ error: `no route ${path}` }, 404);\n const computer = find(decodeURIComponent(computerMatch[1] ?? ''));\n if (computer == null || computer.state === STATE.Deleted)\n return json({ error: 'computer not found' }, 404);\n const rest = computerMatch[2] ?? '';\n const machine = computer.machine;\n if (request.method === 'GET' && rest === '/screen')\n return json({ available: args.screenAvailable ?? false });\n if (request.method === 'POST' && rest === '/screen')\n return json({\n url: `https://computer-api.example/v1/computers/${computer.id}/screen/view#screen-token`,\n token: 'screen-token',\n expiresAt: new Date(Date.now() + 900_000).toISOString(),\n });\n if (request.method === 'PATCH' && rest === '') {\n const patch = createComputerSchema.pick({ network: true, autoResume: true }).parse(body);\n if (patch.network != null) computer.body.network = patch.network;\n if (patch.autoResume != null) computer.body.autoResume = patch.autoResume;\n return json({ computer: wire(computer) });\n }\n if (request.method === 'GET' && rest === '/computer-use')\n return json({\n available: args.computerUseAvailable ?? false,\n installed: args.computerUseAvailable ?? false,\n });\n if (request.method === 'GET' && rest === '') {\n const starting = booting.get(computer.id);\n if (starting != null) {\n if (starting <= 0) {\n booting.delete(computer.id);\n computer.state = STATE.Running;\n } else booting.set(computer.id, starting - 1);\n }\n const left = shelving.get(computer.id);\n if (left != null) {\n if (left <= 0) {\n shelving.delete(computer.id);\n computer.state = STATE.Shelved;\n } else shelving.set(computer.id, left - 1);\n }\n return json({ computer: wire(computer) });\n }\n if (request.method === 'POST' && rest === '/capture') {\n if (computer.state !== STATE.Running) return json({ error: 'not running' }, 409);\n if (computer.body.userVolumeGb !== null) return json({ error: 'has a user volume' }, 409);\n const id = `part_0190b0000000700080000000${String(bases.size + 1).padStart(4, '0')}`;\n const capture = z.object({ retained: z.boolean().default(false) }).parse(body ?? {});\n const base: FakeBaseIface = {\n id,\n computerId: computer.id,\n state: 'capturing',\n error: null,\n retained: capture.retained,\n };\n bases.set(id, base);\n if (captureFailure.error != null) captureErrors.set(id, captureFailure.error);\n computer.state = STATE.Stopped;\n return json({ base: baseWire(base) }, 202);\n }\n const action = /^\\/actions\\/(.+)$/.exec(rest);\n if (request.method === 'POST' && action != null) {\n const name = action[1] ?? '';\n actions.push({ computerId: computer.id, action: name });\n if (actionConflicts.has(name))\n return json({ error: 'a lifecycle transition is committing' }, 409);\n const failure = actionFailures.get(name);\n if (failure != null) return json({ error: `${name} failed` }, failure);\n // The API pauses only a computer that runs.\n if (name === 'pause' && computer.state === STATE.Shelved)\n return json({ error: 'VM is shelved; wake it before pausing' }, 409);\n if (name === 'pause' && computer.state === STATE.Stopped)\n return json({ error: 'VM is stopped; nothing to pause' }, 409);\n if (name === 'pause' && computer.state === STATE.Error)\n return json({ error: 'pause failed: cannot pause vm in state Error' }, 502);\n if (name !== 'resume' && name !== 'start') booting.delete(computer.id);\n if (name === 'pause') computer.state = STATE.Paused;\n if (name === 'resume') boot(computer, STATE.Resuming);\n if (name === 'start') boot(computer, STATE.Pending);\n // A computer that is not ephemeral shelves on stop.\n if (name === 'stop') {\n computer.state = shelveReads.count > 0 ? STATE.Stopped : STATE.Shelved;\n if (shelveReads.count > 0) shelving.set(computer.id, shelveReads.count);\n }\n if (name === 'delete') computer.state = STATE.Deleted;\n return json({ computer: wire(computer) });\n }\n if (\n computer.state !== STATE.Running &&\n (rest === '/exec' || rest === '/run' || rest === '/files' || rest.startsWith('/processes/'))\n )\n return json({ error: NOT_RUNNING }, 409);\n if (request.method === 'POST' && (rest === '/exec' || rest === '/run')) {\n const parsed = z\n .object({\n command: z.string(),\n cwd: z.string().optional(),\n env: z.record(z.string(), z.string()).optional(),\n })\n .parse(body);\n const process = machine.exec({\n id: `proc-${machine.execs.length + 1}`,\n command: parsed.command,\n cwd: parsed.cwd ?? '/',\n env: parsed.env ?? {},\n });\n if (rest === '/exec')\n return json({ id: process.id, bootId: process.bootId, pid: 1, state: 'running' });\n const output = await readFakeOutput(process, { stdout: 0, stderr: 0, waitMs: 50 });\n return json({\n id: process.id,\n bootId: process.bootId,\n pid: 1,\n timedOut: false,\n elapsedMs: 1,\n ...outputBody(output, process, 0, 0),\n });\n }\n const processMatch = /^\\/processes\\/([^/]+)\\/(output|input|terminate)$/.exec(rest);\n if (processMatch != null) {\n const process = machine.processes.get(processMatch[1] ?? '');\n if (process == null) return json({ error: 'process not found' }, 404);\n if (processMatch[2] === 'output') {\n const stdoutOffset = Number(url.searchParams.get('stdoutOffset') ?? 0);\n const stderrOffset = Number(url.searchParams.get('stderrOffset') ?? 0);\n const output = await readFakeOutput(process, {\n stdout: stdoutOffset,\n stderr: stderrOffset,\n waitMs: Number(url.searchParams.get('waitMs') ?? 0),\n });\n return json(outputBody(output, process, stdoutOffset, stderrOffset));\n }\n if (processMatch[2] === 'terminate') {\n process.terminate();\n return json({ ok: true });\n }\n const input = z\n .object({\n dataB64: z.string().optional(),\n eof: z.boolean().optional(),\n signal: z.string().optional(),\n })\n .parse(body);\n if (input.dataB64 != null) process.write(decodeBase64(input.dataB64));\n if (input.eof === true) process.eof();\n if (input.signal != null) process.terminate(input.signal);\n return json({ ok: true });\n }\n if (rest === '/files' && request.method === 'GET') {\n const path = url.searchParams.get('path') ?? '';\n // Reads follow symlinks.\n const content = machine.files.get(machine.links.get(path) ?? path);\n if (content == null) return json({ error: `${path}: No such file or directory` }, 502);\n const offset = Number(url.searchParams.get('offset') ?? 0);\n const length = Number(url.searchParams.get('length') ?? content.byteLength);\n const slice = content.subarray(offset, offset + length);\n return json({\n dataB64: encodeBase64(slice),\n eof: offset + slice.byteLength >= content.byteLength,\n offset,\n });\n }\n if (rest === '/files' && request.method === 'PUT') {\n const parsed = z\n .object({ path: z.string(), dataB64: z.string(), append: z.boolean().optional() })\n .parse(body);\n if (!machine.dirs.has(posix.dirname(parsed.path)))\n return json({ error: 'No such file or directory' }, 502);\n const data = decodeBase64(parsed.dataB64);\n const previous =\n parsed.append === true\n ? (machine.files.get(parsed.path) ?? new Uint8Array())\n : new Uint8Array();\n machine.files.set(parsed.path, concatBytes([previous, data]));\n return json({ bytesWritten: data.byteLength });\n }\n return json({ error: `no route ${request.method} ${path}` }, 404);\n };\n\n return {\n fetch: async (input, init) => handle(new Request(input, init)),\n computers,\n images,\n bases,\n baseCaptureReads,\n captureFailure,\n requests,\n actions,\n actionConflicts,\n actionFailures,\n shelveReads,\n imageBuildReads,\n bootReads,\n computerByName: (name) => [...computers.values()].find((computer) => computer.name === name),\n };\n};\n\nconst outputBody = (\n output: { stdout: Uint8Array; stderr: Uint8Array; exited: boolean },\n process: {\n exitCode: number | null;\n signal: string | null;\n stdout: Uint8Array;\n stderr: Uint8Array;\n },\n stdoutOffset: number,\n stderrOffset: number,\n) => ({\n stdout: {\n dataB64: encodeBase64(output.stdout),\n offset: stdoutOffset,\n nextOffset: stdoutOffset + output.stdout.byteLength,\n eof: output.exited && stdoutOffset + output.stdout.byteLength >= process.stdout.byteLength,\n },\n stderr: {\n dataB64: encodeBase64(output.stderr),\n offset: stderrOffset,\n nextOffset: stderrOffset + output.stderr.byteLength,\n eof: output.exited && stderrOffset + output.stderr.byteLength >= process.stderr.byteLength,\n },\n state: output.exited ? 'exited' : 'running',\n result: output.exited ? { exitCode: process.exitCode, signal: process.signal } : null,\n});\n"],
5
+ "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,4BAA4B;AACrC,SAAS,aAAa;AACtB,YAAY,OAAO;AACnB,SAAS,aAAa,cAAc,oBAAoB;AACxD,SAAS,mBAAmB,sBAA6C;AAuDzE,MAAM,QAAQ;AAAA,EACZ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACX;AACA,MAAM,cAAc;AACb,MAAM,yBAAyB;AAC/B,MAAM,8BAA8B;AAE3C,MAAM,OAAO,CAAC,MAAiB,SAAS,QACtC,IAAI,SAAS,KAAK,UAAU,IAAI,GAAG,EAAE,QAAQ,SAAS,EAAE,gBAAgB,mBAAmB,EAAE,CAAC;AAKhG,MAAM,uBAAuB,EAAE,aAAa;AAAA,EAC1C,MAAM,E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U,QAAQ,UAAU,QAAQ,QAAQ,OAAO,IAAI;AACnF;",
6
6
  "names": ["computer", "image", "path"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finalai/final-agent-provider",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "private": false,
5
5
  "description": "Final's provider package: serverless, remote and local harnesses; the computer and device sandboxes; the messaging, schedule and event channels.",
6
6
  "license": "Apache-2.0",
@@ -220,13 +220,13 @@
220
220
  "dependencies": {
221
221
  "@agentclientprotocol/sdk": "1.8.0",
222
222
  "@finalai/acp-session": "0.1.10",
223
- "@finalai/agent-protocol": "0.5.0",
224
- "@finalai/agent-provider": "0.5.0",
225
- "@finalai/computers": "0.2.0",
223
+ "@finalai/agent-protocol": "0.6.0",
224
+ "@finalai/agent-provider": "0.5.1",
225
+ "@finalai/computers": "0.3.0",
226
226
  "@finalai/websockets": "0.1.6",
227
227
  "ws": "^8.21.3",
228
228
  "zod": "4.6.5",
229
- "@finalai/agent-definition": "0.5.0"
229
+ "@finalai/agent-definition": "0.5.1"
230
230
  },
231
231
  "engines": {
232
232
  "node": ">=26"