@finalai/final-agent-provider 0.10.1 → 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 (159) hide show
  1. package/HOSTING.md +334 -245
  2. package/README.md +126 -40
  3. package/WORKSPACE-EGRESS.md +11 -11
  4. package/dist/modules/catalog.d.mts +9 -0
  5. package/dist/modules/catalog.mjs +21 -0
  6. package/dist/modules/catalog.mjs.map +7 -0
  7. package/dist/modules/harnesses/acp-agent.d.mts +4 -0
  8. package/dist/modules/harnesses/acp-agent.mjs +35 -0
  9. package/dist/modules/harnesses/acp-agent.mjs.map +7 -0
  10. package/dist/modules/harnesses/adapters.d.mts +7 -0
  11. package/dist/modules/harnesses/adapters.mjs +74 -0
  12. package/dist/modules/harnesses/adapters.mjs.map +7 -0
  13. package/dist/modules/harnesses/claude-code.d.mts +14 -0
  14. package/dist/modules/harnesses/claude-code.mjs +79 -0
  15. package/dist/modules/harnesses/claude-code.mjs.map +7 -0
  16. package/dist/modules/harnesses/codex.d.mts +12 -0
  17. package/dist/modules/harnesses/codex.mjs +90 -0
  18. package/dist/modules/harnesses/codex.mjs.map +7 -0
  19. package/dist/modules/harnesses/config-fields.d.mts +98 -57
  20. package/dist/modules/harnesses/config-fields.mjs +58 -35
  21. package/dist/modules/harnesses/config-fields.mjs.map +3 -3
  22. package/dist/modules/harnesses/definitions.d.mts +3 -0
  23. package/dist/modules/harnesses/definitions.mjs +21 -0
  24. package/dist/modules/harnesses/definitions.mjs.map +7 -0
  25. package/dist/modules/harnesses/fidelity.d.mts +1 -1
  26. package/dist/modules/harnesses/fidelity.mjs +17 -14
  27. package/dist/modules/harnesses/fidelity.mjs.map +2 -2
  28. package/dist/modules/harnesses/final.d.mts +12 -0
  29. package/dist/modules/harnesses/final.mjs +70 -0
  30. package/dist/modules/harnesses/final.mjs.map +7 -0
  31. package/dist/modules/harnesses/index.d.mts +13 -12
  32. package/dist/modules/harnesses/index.mjs +86 -45
  33. package/dist/modules/harnesses/index.mjs.map +3 -3
  34. package/dist/modules/harnesses/names.d.mts +43 -0
  35. package/dist/modules/harnesses/names.mjs +59 -0
  36. package/dist/modules/harnesses/names.mjs.map +7 -0
  37. package/dist/modules/harnesses/nanocode-claude.d.mts +18 -0
  38. package/dist/modules/harnesses/nanocode-claude.mjs +101 -0
  39. package/dist/modules/harnesses/nanocode-claude.mjs.map +7 -0
  40. package/dist/modules/harnesses/nanocode-codex.d.mts +13 -0
  41. package/dist/modules/harnesses/nanocode-codex.mjs +64 -0
  42. package/dist/modules/harnesses/nanocode-codex.mjs.map +7 -0
  43. package/dist/modules/harnesses/pi.d.mts +12 -0
  44. package/dist/modules/harnesses/pi.mjs +71 -0
  45. package/dist/modules/harnesses/pi.mjs.map +7 -0
  46. package/dist/modules/integrations.d.mts +9 -0
  47. package/dist/modules/integrations.mjs +29 -0
  48. package/dist/modules/integrations.mjs.map +7 -0
  49. package/dist/modules/provider/general.bundle.d.mts +1 -0
  50. package/dist/modules/provider/general.bundle.mjs +5 -0
  51. package/dist/modules/provider/general.bundle.mjs.map +7 -0
  52. package/dist/modules/provider/general.d.mts +11 -0
  53. package/dist/modules/provider/general.mjs +130 -0
  54. package/dist/modules/provider/general.mjs.map +7 -0
  55. package/dist/modules/provider/index.d.mts +3 -0
  56. package/dist/modules/provider/index.mjs +13 -0
  57. package/dist/modules/provider/index.mjs.map +7 -0
  58. package/dist/modules/sandboxes/access.d.mts +34 -0
  59. package/dist/modules/sandboxes/access.mjs +15 -0
  60. package/dist/modules/sandboxes/access.mjs.map +7 -0
  61. package/dist/modules/sandboxes/computer.d.mts +24 -51
  62. package/dist/modules/sandboxes/computer.mjs +523 -888
  63. package/dist/modules/sandboxes/computer.mjs.map +3 -3
  64. package/dist/modules/sandboxes/computers-api.d.mts +3 -2
  65. package/dist/modules/sandboxes/computers-api.mjs +2 -4
  66. package/dist/modules/sandboxes/computers-api.mjs.map +2 -2
  67. package/dist/modules/sandboxes/device-api.d.mts +4 -3
  68. package/dist/modules/sandboxes/device-api.mjs +2 -4
  69. package/dist/modules/sandboxes/device-api.mjs.map +2 -2
  70. package/dist/modules/sandboxes/device.d.mts +6 -6
  71. package/dist/modules/sandboxes/device.mjs +126 -121
  72. package/dist/modules/sandboxes/device.mjs.map +3 -3
  73. package/dist/modules/sandboxes/egress.d.mts +10 -9
  74. package/dist/modules/sandboxes/egress.mjs +73 -56
  75. package/dist/modules/sandboxes/egress.mjs.map +2 -2
  76. package/dist/modules/sandboxes/environment.d.mts +35 -269
  77. package/dist/modules/sandboxes/environment.mjs +27 -104
  78. package/dist/modules/sandboxes/environment.mjs.map +3 -3
  79. package/dist/modules/sandboxes/index.d.mts +9 -69
  80. package/dist/modules/sandboxes/index.mjs +35 -95
  81. package/dist/modules/sandboxes/index.mjs.map +3 -3
  82. package/dist/modules/sandboxes/local.d.mts +28 -0
  83. package/dist/modules/sandboxes/local.mjs +499 -0
  84. package/dist/modules/sandboxes/local.mjs.map +7 -0
  85. package/dist/modules/sandboxes/session.d.mts +0 -3
  86. package/dist/modules/sandboxes/session.mjs +2 -22
  87. package/dist/modules/sandboxes/session.mjs.map +2 -2
  88. package/dist/modules/sandboxes/testing/fake-machine.mjs +0 -28
  89. package/dist/modules/sandboxes/testing/fake-machine.mjs.map +2 -2
  90. package/package.json +76 -104
  91. package/dist/modules/connections.d.mts +0 -11
  92. package/dist/modules/connections.mjs +0 -16
  93. package/dist/modules/connections.mjs.map +0 -7
  94. package/dist/modules/harnesses/acp-describe.d.mts +0 -20
  95. package/dist/modules/harnesses/acp-describe.mjs +0 -110
  96. package/dist/modules/harnesses/acp-describe.mjs.map +0 -7
  97. package/dist/modules/harnesses/local-stdio.d.mts +0 -47
  98. package/dist/modules/harnesses/local-stdio.mjs +0 -41
  99. package/dist/modules/harnesses/local-stdio.mjs.map +0 -7
  100. package/dist/modules/harnesses/remote-acp.d.mts +0 -76
  101. package/dist/modules/harnesses/remote-acp.mjs +0 -83
  102. package/dist/modules/harnesses/remote-acp.mjs.map +0 -7
  103. package/dist/modules/harnesses/remote-claude-code.d.mts +0 -88
  104. package/dist/modules/harnesses/remote-claude-code.mjs +0 -113
  105. package/dist/modules/harnesses/remote-claude-code.mjs.map +0 -7
  106. package/dist/modules/harnesses/remote-client-tls.d.mts +0 -35
  107. package/dist/modules/harnesses/remote-client-tls.mjs +0 -37
  108. package/dist/modules/harnesses/remote-client-tls.mjs.map +0 -7
  109. package/dist/modules/harnesses/remote-codex.d.mts +0 -98
  110. package/dist/modules/harnesses/remote-codex.mjs +0 -128
  111. package/dist/modules/harnesses/remote-codex.mjs.map +0 -7
  112. package/dist/modules/harnesses/remote-pi.d.mts +0 -78
  113. package/dist/modules/harnesses/remote-pi.mjs +0 -104
  114. package/dist/modules/harnesses/remote-pi.mjs.map +0 -7
  115. package/dist/modules/harnesses/remote-url.d.mts +0 -5
  116. package/dist/modules/harnesses/remote-url.mjs +0 -19
  117. package/dist/modules/harnesses/remote-url.mjs.map +0 -7
  118. package/dist/modules/harnesses/serverless-final.d.mts +0 -63
  119. package/dist/modules/harnesses/serverless-final.mjs +0 -88
  120. package/dist/modules/harnesses/serverless-final.mjs.map +0 -7
  121. package/dist/modules/harnesses/serverless-nanocode-claude.d.mts +0 -64
  122. package/dist/modules/harnesses/serverless-nanocode-claude.mjs +0 -105
  123. package/dist/modules/harnesses/serverless-nanocode-claude.mjs.map +0 -7
  124. package/dist/modules/harnesses/serverless-nanocode-codex.d.mts +0 -66
  125. package/dist/modules/harnesses/serverless-nanocode-codex.mjs +0 -113
  126. package/dist/modules/harnesses/serverless-nanocode-codex.mjs.map +0 -7
  127. package/dist/modules/harnesses/serverless-pi.d.mts +0 -64
  128. package/dist/modules/harnesses/serverless-pi.mjs +0 -98
  129. package/dist/modules/harnesses/serverless-pi.mjs.map +0 -7
  130. package/dist/modules/runtime/index.d.mts +0 -7
  131. package/dist/modules/runtime/index.mjs +0 -18
  132. package/dist/modules/runtime/index.mjs.map +0 -7
  133. package/dist/modules/runtime/local-stdio.d.mts +0 -10
  134. package/dist/modules/runtime/local-stdio.mjs +0 -106
  135. package/dist/modules/runtime/local-stdio.mjs.map +0 -7
  136. package/dist/modules/runtime/remote-acp.d.mts +0 -16
  137. package/dist/modules/runtime/remote-acp.mjs +0 -152
  138. package/dist/modules/runtime/remote-acp.mjs.map +0 -7
  139. package/dist/modules/runtime/remote-claude-code.d.mts +0 -5
  140. package/dist/modules/runtime/remote-claude-code.mjs +0 -47
  141. package/dist/modules/runtime/remote-claude-code.mjs.map +0 -7
  142. package/dist/modules/runtime/remote-codex.d.mts +0 -5
  143. package/dist/modules/runtime/remote-codex.mjs +0 -47
  144. package/dist/modules/runtime/remote-codex.mjs.map +0 -7
  145. package/dist/modules/runtime/remote-host.d.mts +0 -127
  146. package/dist/modules/runtime/remote-host.mjs +0 -387
  147. package/dist/modules/runtime/remote-host.mjs.map +0 -7
  148. package/dist/modules/runtime/remote-pi.d.mts +0 -5
  149. package/dist/modules/runtime/remote-pi.mjs +0 -44
  150. package/dist/modules/runtime/remote-pi.mjs.map +0 -7
  151. package/dist/modules/sandboxes/guide.d.mts +0 -35
  152. package/dist/modules/sandboxes/guide.mjs +0 -119
  153. package/dist/modules/sandboxes/guide.mjs.map +0 -7
  154. package/dist/modules/sandboxes/workspace-setup.d.mts +0 -42
  155. package/dist/modules/sandboxes/workspace-setup.mjs +0 -242
  156. package/dist/modules/sandboxes/workspace-setup.mjs.map +0 -7
  157. package/dist/modules/testing/harness.d.mts +0 -9
  158. package/dist/modules/testing/harness.mjs +0 -123
  159. package/dist/modules/testing/harness.mjs.map +0 -7
@@ -1,118 +1,58 @@
1
1
  import {
2
- awaitableOpenRequest,
3
- jsonObjectSchema,
4
- packageRef
2
+ jsonObjectSchema
5
3
  } from "@finalai/agent-provider";
6
- import * as z from "zod";
7
4
  import {
8
- COMPUTER_SANDBOX_SPECIFIER,
5
+ COMPUTER_PROVIDER,
9
6
  computerEnvironmentSchema,
10
- computerOpenOptionsSchema,
11
- DEVICE_SANDBOX_SPECIFIER,
7
+ DEVICE_PROVIDER,
12
8
  deviceEnvironmentSchema
13
9
  } from "./environment.mjs";
10
+ const WORKERS_PROVIDER = "workers";
14
11
  import {
15
- COMPUTER_SANDBOX_SPECIFIER as COMPUTER_SANDBOX_SPECIFIER2,
12
+ COMPUTER_PROVIDER as COMPUTER_PROVIDER2,
16
13
  computerEnvironmentSchema as computerEnvironmentSchema2,
17
- ComputerWorkspacePolicy,
14
+ DEFAULT_COMPUTER_IMAGE,
18
15
  DEVICE_API_ACTING_USER_HEADER,
19
- DEVICE_SANDBOX_SPECIFIER as DEVICE_SANDBOX_SPECIFIER2,
20
- deviceEnvironmentSchema as deviceEnvironmentSchema2,
21
- TemplateWhenMissing
16
+ DEVICE_PROVIDER as DEVICE_PROVIDER2,
17
+ deviceEnvironmentSchema as deviceEnvironmentSchema2
22
18
  } from "./environment.mjs";
23
- const recorded = (value) => jsonObjectSchema.parse(JSON.parse(JSON.stringify(value)));
24
- const validated = (schema, value, label) => {
25
- const parsed = schema.safeParse(value);
26
- if (!parsed.success) throw new Error(`invalid ${label}: ${parsed.error.message}`);
27
- return value;
28
- };
29
- const validatedOpen = (openOptions, providerName) => {
30
- const parsed = computerOpenOptionsSchema.safeParse(openOptions);
19
+ import {
20
+ defineSandboxSetup,
21
+ describeSandbox,
22
+ LATEST_SANDBOX_SETUP_VERSION
23
+ } from "@finalai/agent-provider/sandbox/setup";
24
+ const environmentValue = (args) => {
25
+ const parsed = args.schema.safeParse(args.input);
31
26
  if (!parsed.success)
32
- throw new Error(`invalid ${providerName} open options: ${parsed.error.message}`);
33
- return parsed.data;
34
- };
35
- const environmentFor = (args) => {
36
- const provider = packageRef(args.specifier);
27
+ throw new Error(`invalid ${args.provider} environment: ${parsed.error.message}`);
37
28
  return {
38
- provider,
39
- providerRef: provider,
40
- providerName: args.providerName,
41
- options: args.options,
42
- authoringWarnings: args.authoringWarnings,
43
- open: (openOptions) => awaitableOpenRequest({
44
- provider,
45
- providerRef: provider,
46
- providerName: args.providerName,
47
- environmentOptions: args.options,
48
- openOptions: recorded(validatedOpen(openOptions ?? {}, args.providerName)),
49
- authoringWarnings: args.authoringWarnings
50
- })
29
+ provider: args.provider,
30
+ environment: jsonObjectSchema.parse(JSON.parse(JSON.stringify(args.input)))
51
31
  };
52
32
  };
53
- const computerProviderRef = packageRef(COMPUTER_SANDBOX_SPECIFIER);
54
- const computerEnvironment = (options) => {
55
- const environment = {
56
- providerName: "computer",
57
- specifier: COMPUTER_SANDBOX_SPECIFIER,
58
- options: validated(computerEnvironmentSchema, options, "computer environment")
59
- };
60
- if (options["inline"] != null)
61
- environment.authoringWarnings = [
62
- "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."
63
- ];
64
- return environmentFor(environment);
65
- };
66
- const parametersOf = (input) => recorded({
67
- repositories: input.repositories,
68
- variables: input.variables,
69
- workspace: input.workspace,
70
- networkPolicy: input.networkPolicy,
71
- env: input.env
72
- });
73
- const guideReference = (input) => computerEnvironment({
74
- guide: { ref: input.ref, version: input.version ?? "latest" },
75
- parameters: parametersOf(input)
76
- });
77
- const inlineGuide = (input) => computerEnvironment({
78
- inline: recorded({
79
- image: input.image,
80
- template: input.template,
81
- repositories: input.repositories ?? [],
82
- variables: input.variables ?? []
83
- })
33
+ const computer = (options = {}) => environmentValue({
34
+ provider: COMPUTER_PROVIDER,
35
+ schema: computerEnvironmentSchema,
36
+ input: options
84
37
  });
85
- const computerSetupGuide = Object.assign(guideReference, {
86
- define: inlineGuide,
87
- providerRef: computerProviderRef
38
+ const device = (options) => environmentValue({ provider: DEVICE_PROVIDER, schema: deviceEnvironmentSchema, input: options });
39
+ const workers = () => ({
40
+ provider: WORKERS_PROVIDER,
41
+ environment: null
88
42
  });
89
- const computer = Object.assign(
90
- (input = {}) => {
91
- const parameters = parametersOf({ workspace: "ephemeral", ...input });
92
- return computerEnvironment(
93
- input.image == null ? { parameters } : { image: input.image, parameters }
94
- );
95
- },
96
- { providerRef: computerProviderRef }
97
- );
98
- const device = Object.assign(
99
- (input = {}) => environmentFor({
100
- providerName: "device",
101
- specifier: DEVICE_SANDBOX_SPECIFIER,
102
- options: validated(deviceEnvironmentSchema, recorded(input), "device environment")
103
- }),
104
- { providerRef: packageRef(DEVICE_SANDBOX_SPECIFIER) }
105
- );
106
43
  export {
107
- COMPUTER_SANDBOX_SPECIFIER2 as COMPUTER_SANDBOX_SPECIFIER,
108
- ComputerWorkspacePolicy,
44
+ COMPUTER_PROVIDER2 as COMPUTER_PROVIDER,
45
+ DEFAULT_COMPUTER_IMAGE,
109
46
  DEVICE_API_ACTING_USER_HEADER,
110
- DEVICE_SANDBOX_SPECIFIER2 as DEVICE_SANDBOX_SPECIFIER,
111
- TemplateWhenMissing,
47
+ DEVICE_PROVIDER2 as DEVICE_PROVIDER,
48
+ LATEST_SANDBOX_SETUP_VERSION,
49
+ WORKERS_PROVIDER,
112
50
  computer,
113
51
  computerEnvironmentSchema2 as computerEnvironmentSchema,
114
- computerSetupGuide,
52
+ defineSandboxSetup,
53
+ describeSandbox,
115
54
  device,
116
- deviceEnvironmentSchema2 as deviceEnvironmentSchema
55
+ deviceEnvironmentSchema2 as deviceEnvironmentSchema,
56
+ workers
117
57
  };
118
58
  //# sourceMappingURL=index.mjs.map
@@ -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_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": "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",
6
- "names": ["COMPUTER_SANDBOX_SPECIFIER", "computerEnvironmentSchema", "DEVICE_SANDBOX_SPECIFIER", "deviceEnvironmentSchema"]
4
+ "sourcesContent": ["import {\n jsonObjectSchema,\n type JsonObject,\n type SandboxEnvironmentValueIface,\n} from '@finalai/agent-provider';\nimport type * as z from 'zod';\nimport {\n COMPUTER_PROVIDER,\n computerEnvironmentSchema,\n DEVICE_PROVIDER,\n deviceEnvironmentSchema,\n type ComputerEnvironmentInputIface,\n type DeviceEnvironmentInputIface,\n} from \"./environment.mjs\";\n\n// Environments of Final's sandbox providers, as plain data a caller creates\n// sandboxes from: `project.sandboxes.create(computer({ image }), { setup })`.\n// What goes on the machine is the sandbox setup (`defineSandboxSetup`), which\n// works on any provider. The providers themselves live in\n// `./sandboxes/computer` and `./sandboxes/device`.\n\nexport const WORKERS_PROVIDER = 'workers';\n\nexport {\n COMPUTER_PROVIDER,\n computerEnvironmentSchema,\n DEFAULT_COMPUTER_IMAGE,\n DEVICE_API_ACTING_USER_HEADER,\n DEVICE_PROVIDER,\n deviceEnvironmentSchema,\n type ComputerBuildIface,\n type ComputerEnvironmentIface,\n type ComputerEnvironmentInputIface,\n type DeviceEnvironmentIface,\n type DeviceEnvironmentInputIface,\n} from \"./environment.mjs\";\nexport {\n defineSandboxSetup,\n describeSandbox,\n LATEST_SANDBOX_SETUP_VERSION,\n type SandboxDescriptionIface,\n type SandboxSetupIface,\n type SandboxSetupInputIface,\n} from '@finalai/agent-provider/sandbox/setup';\nexport type { SandboxEnvironmentValueIface } from '@finalai/agent-provider';\n\nconst environmentValue = (args: {\n provider: string;\n schema: z.ZodType;\n input: unknown;\n}): SandboxEnvironmentValueIface<JsonObject> => {\n const parsed = args.schema.safeParse(args.input);\n if (!parsed.success)\n throw new Error(`invalid ${args.provider} environment: ${parsed.error.message}`);\n // The input as written (defaults are the provider's), with undefined members dropped.\n return {\n provider: args.provider,\n environment: jsonObjectSchema.parse(JSON.parse(JSON.stringify(args.input))),\n };\n};\n\n// A Final computer: a VM from the Computers API, created from `image` (the\n// platform's sandbox lineage by default), with `build` baked into its base.\nexport const computer = (\n options: ComputerEnvironmentInputIface = {},\n): SandboxEnvironmentValueIface<JsonObject> =>\n environmentValue({\n provider: COMPUTER_PROVIDER,\n schema: computerEnvironmentSchema,\n input: options,\n });\n\n// A person's own computer running Final Device, by id or by an approved pairing code.\nexport const device = (\n options: DeviceEnvironmentInputIface,\n): SandboxEnvironmentValueIface<JsonObject> =>\n environmentValue({ provider: DEVICE_PROVIDER, schema: deviceEnvironmentSchema, input: options });\n\n// Final's Workers runtime: runs the worker programs of Final's harnesses\n// (`final`, `pi`, `nanocode-claude`, `nanocode-codex`) and offers the model no\n// files or shell. Clients create one, owned by the session or conversation,\n// for those harnesses' settings that name no `environment`.\nexport const workers = (): SandboxEnvironmentValueIface<null> => ({\n provider: WORKERS_PROVIDER,\n environment: null,\n});\n"],
5
+ "mappings": "AAAA;AAAA,EACE;AAAA,OAGK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAQA,MAAM,mBAAmB;AAEhC;AAAA,EACE,qBAAAA;AAAA,EACA,6BAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,mBAAAC;AAAA,EACA,2BAAAC;AAAA,OAMK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAGP,MAAM,mBAAmB,CAAC,SAIsB;AAC9C,QAAM,SAAS,KAAK,OAAO,UAAU,KAAK,KAAK;AAC/C,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,WAAW,KAAK,QAAQ,iBAAiB,OAAO,MAAM,OAAO,EAAE;AAEjF,SAAO;AAAA,IACL,UAAU,KAAK;AAAA,IACf,aAAa,iBAAiB,MAAM,KAAK,MAAM,KAAK,UAAU,KAAK,KAAK,CAAC,CAAC;AAAA,EAC5E;AACF;AAIO,MAAM,WAAW,CACtB,UAAyC,CAAC,MAE1C,iBAAiB;AAAA,EACf,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,OAAO;AACT,CAAC;AAGI,MAAM,SAAS,CACpB,YAEA,iBAAiB,EAAE,UAAU,iBAAiB,QAAQ,yBAAyB,OAAO,QAAQ,CAAC;AAM1F,MAAM,UAAU,OAA2C;AAAA,EAChE,UAAU;AAAA,EACV,aAAa;AACf;",
6
+ "names": ["COMPUTER_PROVIDER", "computerEnvironmentSchema", "DEVICE_PROVIDER", "deviceEnvironmentSchema"]
7
7
  }
@@ -0,0 +1,28 @@
1
+ import type { JsonValue } from '@finalai/agent-provider';
2
+ import { type NetworkSandboxSessionIface, type SandboxProviderIface } from '@finalai/agent-provider/sandbox';
3
+ import * as z from 'zod';
4
+ export declare const LOCAL_PROVIDER = "local";
5
+ export declare const LOCAL_INHERITED_ENV: string[];
6
+ export interface LocalSandboxOptionsIface {
7
+ root: string;
8
+ env?: Record<string, string>;
9
+ inheritEnv?: string[];
10
+ id?: string;
11
+ baseEnv?: () => Promise<Record<string, string>>;
12
+ }
13
+ export interface LocalSandboxIface extends NetworkSandboxSessionIface {
14
+ readonly root: string;
15
+ }
16
+ export declare const LOCAL_STOP_GRACE_MS = 2000;
17
+ export declare const createLocalSandbox: (options: LocalSandboxOptionsIface) => Promise<LocalSandboxIface>;
18
+ declare const localStateSchema: z.ZodObject<{
19
+ version: z.ZodLiteral<1>;
20
+ root: z.ZodString;
21
+ }, z.core.$strip>;
22
+ type LocalArtifact = {
23
+ version: 1;
24
+ root: string;
25
+ };
26
+ type LocalState = z.infer<typeof localStateSchema>;
27
+ export declare const createLocalSandboxProvider: () => SandboxProviderIface<JsonValue, LocalArtifact, LocalState, LocalSandboxIface>;
28
+ export {};