@finalai/final-agent-provider 0.10.1 → 0.12.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 (198) hide show
  1. package/HOSTING.md +334 -245
  2. package/README.md +125 -46
  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 +29 -0
  83. package/dist/modules/sandboxes/local.mjs +555 -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 +73 -137
  91. package/dist/modules/authoring-final-channel.d.mts +0 -3
  92. package/dist/modules/authoring-final-channel.mjs +0 -10
  93. package/dist/modules/authoring-final-channel.mjs.map +0 -7
  94. package/dist/modules/channel-factories.d.mts +0 -40
  95. package/dist/modules/channel-factories.mjs +0 -212
  96. package/dist/modules/channel-factories.mjs.map +0 -7
  97. package/dist/modules/channels/content.d.mts +0 -6
  98. package/dist/modules/channels/content.mjs +0 -31
  99. package/dist/modules/channels/content.mjs.map +0 -7
  100. package/dist/modules/channels/delivery.d.mts +0 -54
  101. package/dist/modules/channels/delivery.mjs +0 -243
  102. package/dist/modules/channels/delivery.mjs.map +0 -7
  103. package/dist/modules/channels/direct-messaging.d.mts +0 -5
  104. package/dist/modules/channels/direct-messaging.mjs +0 -8
  105. package/dist/modules/channels/direct-messaging.mjs.map +0 -7
  106. package/dist/modules/channels/fake-platform.d.mts +0 -36
  107. package/dist/modules/channels/fake-platform.mjs +0 -168
  108. package/dist/modules/channels/fake-platform.mjs.map +0 -7
  109. package/dist/modules/channels/group-messaging.d.mts +0 -5
  110. package/dist/modules/channels/group-messaging.mjs +0 -8
  111. package/dist/modules/channels/group-messaging.mjs.map +0 -7
  112. package/dist/modules/channels/inbound.d.mts +0 -52
  113. package/dist/modules/channels/inbound.mjs +0 -42
  114. package/dist/modules/channels/inbound.mjs.map +0 -7
  115. package/dist/modules/channels/index.d.mts +0 -9
  116. package/dist/modules/channels/index.mjs +0 -10
  117. package/dist/modules/channels/index.mjs.map +0 -7
  118. package/dist/modules/channels/messaging-channel.d.mts +0 -7
  119. package/dist/modules/channels/messaging-channel.mjs +0 -99
  120. package/dist/modules/channels/messaging-channel.mjs.map +0 -7
  121. package/dist/modules/channels/projection.d.mts +0 -36
  122. package/dist/modules/channels/projection.mjs +0 -233
  123. package/dist/modules/channels/projection.mjs.map +0 -7
  124. package/dist/modules/channels/prompt.d.mts +0 -72
  125. package/dist/modules/channels/prompt.mjs +0 -208
  126. package/dist/modules/channels/prompt.mjs.map +0 -7
  127. package/dist/modules/channels/routing.d.mts +0 -5
  128. package/dist/modules/channels/routing.mjs +0 -53
  129. package/dist/modules/channels/routing.mjs.map +0 -7
  130. package/dist/modules/connections.d.mts +0 -11
  131. package/dist/modules/connections.mjs +0 -16
  132. package/dist/modules/connections.mjs.map +0 -7
  133. package/dist/modules/harnesses/acp-describe.d.mts +0 -20
  134. package/dist/modules/harnesses/acp-describe.mjs +0 -110
  135. package/dist/modules/harnesses/acp-describe.mjs.map +0 -7
  136. package/dist/modules/harnesses/local-stdio.d.mts +0 -47
  137. package/dist/modules/harnesses/local-stdio.mjs +0 -41
  138. package/dist/modules/harnesses/local-stdio.mjs.map +0 -7
  139. package/dist/modules/harnesses/remote-acp.d.mts +0 -76
  140. package/dist/modules/harnesses/remote-acp.mjs +0 -83
  141. package/dist/modules/harnesses/remote-acp.mjs.map +0 -7
  142. package/dist/modules/harnesses/remote-claude-code.d.mts +0 -88
  143. package/dist/modules/harnesses/remote-claude-code.mjs +0 -113
  144. package/dist/modules/harnesses/remote-claude-code.mjs.map +0 -7
  145. package/dist/modules/harnesses/remote-client-tls.d.mts +0 -35
  146. package/dist/modules/harnesses/remote-client-tls.mjs +0 -37
  147. package/dist/modules/harnesses/remote-client-tls.mjs.map +0 -7
  148. package/dist/modules/harnesses/remote-codex.d.mts +0 -98
  149. package/dist/modules/harnesses/remote-codex.mjs +0 -128
  150. package/dist/modules/harnesses/remote-codex.mjs.map +0 -7
  151. package/dist/modules/harnesses/remote-pi.d.mts +0 -78
  152. package/dist/modules/harnesses/remote-pi.mjs +0 -104
  153. package/dist/modules/harnesses/remote-pi.mjs.map +0 -7
  154. package/dist/modules/harnesses/remote-url.d.mts +0 -5
  155. package/dist/modules/harnesses/remote-url.mjs +0 -19
  156. package/dist/modules/harnesses/remote-url.mjs.map +0 -7
  157. package/dist/modules/harnesses/serverless-final.d.mts +0 -63
  158. package/dist/modules/harnesses/serverless-final.mjs +0 -88
  159. package/dist/modules/harnesses/serverless-final.mjs.map +0 -7
  160. package/dist/modules/harnesses/serverless-nanocode-claude.d.mts +0 -64
  161. package/dist/modules/harnesses/serverless-nanocode-claude.mjs +0 -105
  162. package/dist/modules/harnesses/serverless-nanocode-claude.mjs.map +0 -7
  163. package/dist/modules/harnesses/serverless-nanocode-codex.d.mts +0 -66
  164. package/dist/modules/harnesses/serverless-nanocode-codex.mjs +0 -113
  165. package/dist/modules/harnesses/serverless-nanocode-codex.mjs.map +0 -7
  166. package/dist/modules/harnesses/serverless-pi.d.mts +0 -64
  167. package/dist/modules/harnesses/serverless-pi.mjs +0 -98
  168. package/dist/modules/harnesses/serverless-pi.mjs.map +0 -7
  169. package/dist/modules/runtime/index.d.mts +0 -7
  170. package/dist/modules/runtime/index.mjs +0 -18
  171. package/dist/modules/runtime/index.mjs.map +0 -7
  172. package/dist/modules/runtime/local-stdio.d.mts +0 -10
  173. package/dist/modules/runtime/local-stdio.mjs +0 -106
  174. package/dist/modules/runtime/local-stdio.mjs.map +0 -7
  175. package/dist/modules/runtime/remote-acp.d.mts +0 -16
  176. package/dist/modules/runtime/remote-acp.mjs +0 -152
  177. package/dist/modules/runtime/remote-acp.mjs.map +0 -7
  178. package/dist/modules/runtime/remote-claude-code.d.mts +0 -5
  179. package/dist/modules/runtime/remote-claude-code.mjs +0 -47
  180. package/dist/modules/runtime/remote-claude-code.mjs.map +0 -7
  181. package/dist/modules/runtime/remote-codex.d.mts +0 -5
  182. package/dist/modules/runtime/remote-codex.mjs +0 -47
  183. package/dist/modules/runtime/remote-codex.mjs.map +0 -7
  184. package/dist/modules/runtime/remote-host.d.mts +0 -127
  185. package/dist/modules/runtime/remote-host.mjs +0 -387
  186. package/dist/modules/runtime/remote-host.mjs.map +0 -7
  187. package/dist/modules/runtime/remote-pi.d.mts +0 -5
  188. package/dist/modules/runtime/remote-pi.mjs +0 -44
  189. package/dist/modules/runtime/remote-pi.mjs.map +0 -7
  190. package/dist/modules/sandboxes/guide.d.mts +0 -35
  191. package/dist/modules/sandboxes/guide.mjs +0 -119
  192. package/dist/modules/sandboxes/guide.mjs.map +0 -7
  193. package/dist/modules/sandboxes/workspace-setup.d.mts +0 -42
  194. package/dist/modules/sandboxes/workspace-setup.mjs +0 -242
  195. package/dist/modules/sandboxes/workspace-setup.mjs.map +0 -7
  196. package/dist/modules/testing/harness.d.mts +0 -9
  197. package/dist/modules/testing/harness.mjs +0 -123
  198. package/dist/modules/testing/harness.mjs.map +0 -7
@@ -1,44 +0,0 @@
1
- import {} from "@finalai/agent-provider";
2
- import { parseHarnessConfig, toJsonObject } from "../harnesses/config-fields.mjs";
3
- import {
4
- buildRemoteProgramConfig,
5
- createRemoteHarness,
6
- RemoteProgram
7
- } from "./remote-host.mjs";
8
- import { SPECIFIER, remotePiConfigSchema, REMOTE_PI_DESCRIPTION } from "../harnesses/remote-pi.mjs";
9
- const spec = {
10
- specifier: SPECIFIER,
11
- program: RemoteProgram.Pi,
12
- description: REMOTE_PI_DESCRIPTION,
13
- settings: (raw) => {
14
- const parsed = parseHarnessConfig({
15
- specifier: SPECIFIER,
16
- schema: remotePiConfigSchema,
17
- config: raw
18
- });
19
- return {
20
- url: parsed.url,
21
- tls: parsed.tls ?? null,
22
- hop: parsed.hop,
23
- cwd: parsed.cwd ?? null,
24
- executable: parsed.executable ?? null,
25
- // The runtime's Pi program takes `<provider>/<vendor model id>`.
26
- model: parsed.model ?? null,
27
- reasoning: parsed.reasoning ?? null,
28
- permissionMode: parsed.permissionMode ?? null,
29
- approvalPolicy: null,
30
- sandboxMode: null,
31
- allowedTools: null,
32
- instructions: parsed.instructions,
33
- skills: []
34
- };
35
- }
36
- };
37
- const programConfig = (args) => toJsonObject(buildRemoteProgramConfig({ spec, open: args }));
38
- const createRemotePiHarness = (config = {}) => createRemoteHarness(spec, config);
39
- export * from "../harnesses/remote-pi.mjs";
40
- export {
41
- createRemotePiHarness,
42
- programConfig
43
- };
44
- //# sourceMappingURL=remote-pi.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/runtime/remote-pi.ts"],
4
- "sourcesContent": ["import { type JsonObject, type OpenHarnessSessionArgsIface } from '@finalai/agent-provider';\nimport { parseHarnessConfig, toJsonObject } from \"../harnesses/config-fields.mjs\";\n\nimport {\n buildRemoteProgramConfig,\n createRemoteHarness,\n RemoteProgram,\n type RemoteHarnessFactoryConfigIface,\n type RemoteHarnessIface,\n type RemoteProgramSpecIface,\n} from \"./remote-host.mjs\";\nimport { SPECIFIER, remotePiConfigSchema, REMOTE_PI_DESCRIPTION } from \"../harnesses/remote-pi.mjs\";\n\nconst spec: RemoteProgramSpecIface = {\n specifier: SPECIFIER,\n program: RemoteProgram.Pi,\n description: REMOTE_PI_DESCRIPTION,\n settings: (raw) => {\n const parsed = parseHarnessConfig({\n specifier: SPECIFIER,\n schema: remotePiConfigSchema,\n config: raw,\n });\n return {\n url: parsed.url,\n tls: parsed.tls ?? null,\n hop: parsed.hop,\n cwd: parsed.cwd ?? null,\n executable: parsed.executable ?? null,\n // The runtime's Pi program takes `<provider>/<vendor model id>`.\n model: parsed.model ?? null,\n reasoning: parsed.reasoning ?? null,\n permissionMode: parsed.permissionMode ?? null,\n approvalPolicy: null,\n sandboxMode: null,\n allowedTools: null,\n instructions: parsed.instructions,\n skills: [],\n };\n },\n};\n\n// The program config this harness registers with the runtime.\nexport const programConfig = (args: OpenHarnessSessionArgsIface): JsonObject =>\n toJsonObject(buildRemoteProgramConfig({ spec, open: args }));\n\nexport const createRemotePiHarness = (\n config: RemoteHarnessFactoryConfigIface = {},\n): RemoteHarnessIface => createRemoteHarness(spec, config);\n\nexport * from \"../harnesses/remote-pi.mjs\";\n"],
5
- "mappings": "AAAA,eAAkE;AAClE,SAAS,oBAAoB,oBAAoB;AAEjD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,WAAW,sBAAsB,6BAA6B;AAEvE,MAAM,OAA+B;AAAA,EACnC,WAAW;AAAA,EACX,SAAS,cAAc;AAAA,EACvB,aAAa;AAAA,EACb,UAAU,CAAC,QAAQ;AACjB,UAAM,SAAS,mBAAmB;AAAA,MAChC,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV,CAAC;AACD,WAAO;AAAA,MACL,KAAK,OAAO;AAAA,MACZ,KAAK,OAAO,OAAO;AAAA,MACnB,KAAK,OAAO;AAAA,MACZ,KAAK,OAAO,OAAO;AAAA,MACnB,YAAY,OAAO,cAAc;AAAA;AAAA,MAEjC,OAAO,OAAO,SAAS;AAAA,MACvB,WAAW,OAAO,aAAa;AAAA,MAC/B,gBAAgB,OAAO,kBAAkB;AAAA,MACzC,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,cAAc;AAAA,MACd,cAAc,OAAO;AAAA,MACrB,QAAQ,CAAC;AAAA,IACX;AAAA,EACF;AACF;AAGO,MAAM,gBAAgB,CAAC,SAC5B,aAAa,yBAAyB,EAAE,MAAM,MAAM,KAAK,CAAC,CAAC;AAEtD,MAAM,wBAAwB,CACnC,SAA0C,CAAC,MACpB,oBAAoB,MAAM,MAAM;AAEzD,cAAc;",
6
- "names": []
7
- }
@@ -1,35 +0,0 @@
1
- import { NetworkPolicy, type SandboxGuidesIface, type SandboxGuideVersionIface } from '@finalai/agent-provider';
2
- import { ComputerWorkspacePolicy, type ComputerEnvironmentOptions, type ComputerParametersIface, type ComputerRepositoryIface, type ComputerTemplateIface } from "./environment.mjs";
3
- export type ComputerGuideVersionIface = SandboxGuideVersionIface;
4
- export interface ResolvedNetworkPolicyIface {
5
- mode: NetworkPolicy;
6
- allow: string[];
7
- }
8
- export interface ResolvedComputerParametersIface {
9
- repositories: ComputerRepositoryIface[];
10
- variables: string[];
11
- workspace: ComputerWorkspacePolicy;
12
- networkPolicy: ResolvedNetworkPolicyIface;
13
- env: Record<string, string>;
14
- }
15
- export interface ResolvedComputerSpecIface {
16
- image: string;
17
- template: ComputerTemplateIface;
18
- parameters: ResolvedComputerParametersIface;
19
- guide: Pick<ComputerGuideVersionIface, 'guideId' | 'versionId' | 'slug' | 'title' | 'number' | 'preparedArtifact'> | null;
20
- instructionsMarkdown: string | null;
21
- }
22
- export declare const DEFAULT_COMPUTER_IMAGE = "lineage:sandbox";
23
- export interface ComputerBuildInputsIface {
24
- image: string;
25
- template: ComputerTemplateIface;
26
- diskGb: number | null;
27
- }
28
- export declare const computerNeedsBuild: (inputs: Pick<ComputerBuildInputsIface, "template">) => boolean;
29
- export declare const computeComputerArtifactKey: (inputs: ComputerBuildInputsIface) => Promise<string>;
30
- export declare const mergeComputerParameters: (base: ComputerParametersIface, override: ComputerParametersIface) => ResolvedComputerParametersIface;
31
- export declare const resolveComputerSpec: (args: {
32
- options: ComputerEnvironmentOptions;
33
- guides: SandboxGuidesIface;
34
- defaultImage: string;
35
- }) => Promise<ResolvedComputerSpecIface>;
@@ -1,119 +0,0 @@
1
- import {
2
- NetworkPolicy
3
- } from "@finalai/agent-provider";
4
- import { canonicalJson, sha256Hex } from "./bytes.mjs";
5
- import {
6
- computerParametersSchema,
7
- computerTemplateSchema,
8
- ComputerWorkspacePolicy
9
- } from "./environment.mjs";
10
- const ARTIFACT_KEY_VERSION = 1;
11
- const PROJECT_ARTIFACT_CAPTURE_PROTOCOL_VERSION = 2;
12
- const DEFAULT_COMPUTER_IMAGE = "lineage:sandbox";
13
- const computerNeedsBuild = (inputs) => inputs.template.build.steps.length > 0 || inputs.template.build.verify.length > 0;
14
- const computeComputerArtifactKey = async (inputs) => {
15
- if (!computerNeedsBuild(inputs)) {
16
- const hex2 = await sha256Hex(canonicalJson({ v: ARTIFACT_KEY_VERSION, image: inputs.image }));
17
- return `img-${hex2.slice(0, 16)}`;
18
- }
19
- const hex = await sha256Hex(
20
- canonicalJson({
21
- v: ARTIFACT_KEY_VERSION,
22
- image: inputs.image,
23
- build: inputs.template.build,
24
- diskGb: inputs.diskGb
25
- })
26
- );
27
- return `pa-g${hex.slice(0, 16)}-c${PROJECT_ARTIFACT_CAPTURE_PROTOCOL_VERSION}`;
28
- };
29
- const toNetworkPolicy = (option) => {
30
- if (option == null) return void 0;
31
- if (option instanceof Object) return { mode: option.mode, allow: option.allow };
32
- return { mode: option, allow: [] };
33
- };
34
- const mergeComputerParameters = (base, override) => {
35
- const repositories = /* @__PURE__ */ new Map();
36
- for (const repository of [...base.repositories ?? [], ...override.repositories ?? []]) {
37
- repositories.set(repository.alias, repository);
38
- }
39
- return {
40
- repositories: [...repositories.values()],
41
- variables: [.../* @__PURE__ */ new Set([...base.variables ?? [], ...override.variables ?? []])],
42
- workspace: override.workspace ?? base.workspace ?? ComputerWorkspacePolicy.Session,
43
- networkPolicy: toNetworkPolicy(override.networkPolicy) ?? toNetworkPolicy(base.networkPolicy) ?? { mode: NetworkPolicy.AllowAll, allow: [] },
44
- env: { ...base.env, ...override.env }
45
- };
46
- };
47
- const fromVersion = (version, override) => {
48
- const template = computerTemplateSchema.safeParse(version.templateConfig);
49
- if (!template.success) {
50
- throw new Error(
51
- `computer setup guide ${version.slug} v${version.number} has an invalid template`
52
- );
53
- }
54
- const defaults = computerParametersSchema.safeParse(version.defaultParameters);
55
- if (!defaults.success) {
56
- throw new Error(
57
- `computer setup guide ${version.slug} v${version.number} has invalid default parameters`
58
- );
59
- }
60
- return {
61
- image: version.image,
62
- template: template.data,
63
- parameters: mergeComputerParameters(defaults.data, override),
64
- guide: {
65
- guideId: version.guideId,
66
- versionId: version.versionId,
67
- slug: version.slug,
68
- title: version.title,
69
- number: version.number,
70
- preparedArtifact: version.preparedArtifact
71
- },
72
- instructionsMarkdown: version.instructionsMarkdown
73
- };
74
- };
75
- const imageOnly = (image, override) => ({
76
- image,
77
- template: computerTemplateSchema.parse({}),
78
- parameters: mergeComputerParameters({ workspace: ComputerWorkspacePolicy.Ephemeral }, override),
79
- guide: null,
80
- instructionsMarkdown: null
81
- });
82
- const resolveComputerSpec = async (args) => {
83
- const { options } = args;
84
- if ("guide" in options) {
85
- const version = await args.guides.get({
86
- ref: options.guide.ref,
87
- version: options.guide.version
88
- });
89
- if (version == null) {
90
- throw new Error(
91
- `computer setup guide ${options.guide.ref}@${options.guide.version} was not found`
92
- );
93
- }
94
- return fromVersion(version, options.parameters);
95
- }
96
- if ("inline" in options) {
97
- return {
98
- image: options.inline.image,
99
- template: options.inline.template,
100
- parameters: mergeComputerParameters(
101
- { repositories: options.inline.repositories, variables: options.inline.variables },
102
- options.parameters
103
- ),
104
- guide: null,
105
- instructionsMarkdown: null
106
- };
107
- }
108
- if ("image" in options) return imageOnly(options.image, options.parameters);
109
- const fallback = await args.guides.default();
110
- return fallback == null ? imageOnly(args.defaultImage, options.parameters) : fromVersion(fallback, options.parameters);
111
- };
112
- export {
113
- DEFAULT_COMPUTER_IMAGE,
114
- computeComputerArtifactKey,
115
- computerNeedsBuild,
116
- mergeComputerParameters,
117
- resolveComputerSpec
118
- };
119
- //# sourceMappingURL=guide.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/sandboxes/guide.ts"],
4
- "sourcesContent": ["import {\n NetworkPolicy,\n type SandboxGuidesIface,\n type SandboxGuideVersionIface,\n} from '@finalai/agent-provider';\nimport { canonicalJson, sha256Hex } from \"./bytes.mjs\";\nimport {\n computerParametersSchema,\n computerTemplateSchema,\n ComputerWorkspacePolicy,\n type ComputerEnvironmentOptions,\n type ComputerNetworkPolicyOption,\n type ComputerParametersIface,\n type ComputerRepositoryIface,\n type ComputerTemplateIface,\n} from \"./environment.mjs\";\n\n// Computer setup guides: resolving a reference (or an inline guide) into the\n// build-time inputs that define the base and the start-time inputs applied per\n// computer.\n\n// One saved version (agent.computer_setup_guide_versions), as the platform\n// serves it to every provider through the contract's `guides` reader.\nexport type ComputerGuideVersionIface = SandboxGuideVersionIface;\n\nexport interface ResolvedNetworkPolicyIface {\n mode: NetworkPolicy;\n allow: string[];\n}\n\nexport interface ResolvedComputerParametersIface {\n repositories: ComputerRepositoryIface[];\n variables: string[];\n workspace: ComputerWorkspacePolicy;\n networkPolicy: ResolvedNetworkPolicyIface;\n env: Record<string, string>;\n}\n\nexport interface ResolvedComputerSpecIface {\n image: string;\n template: ComputerTemplateIface;\n parameters: ResolvedComputerParametersIface;\n guide: Pick<\n ComputerGuideVersionIface,\n 'guideId' | 'versionId' | 'slug' | 'title' | 'number' | 'preparedArtifact'\n > | null;\n instructionsMarkdown: string | null;\n}\n\n// Bumped when the meaning of the build inputs changes (forces rebuilds).\nconst ARTIFACT_KEY_VERSION = 1;\n// Part of a built base's key; bumping it rebuilds every guide's base.\nconst PROJECT_ARTIFACT_CAPTURE_PROTOCOL_VERSION = 2;\nexport const DEFAULT_COMPUTER_IMAGE = 'lineage:sandbox';\n\nexport interface ComputerBuildInputsIface {\n image: string;\n template: ComputerTemplateIface;\n diskGb: number | null;\n}\n\n// Build steps and verify steps are the only build-time inputs besides the image.\nexport const computerNeedsBuild = (inputs: Pick<ComputerBuildInputsIface, 'template'>): boolean =>\n inputs.template.build.steps.length > 0 || inputs.template.build.verify.length > 0;\n\n// The base's identity: a hash of the build-time inputs only (no guide id, no\n// start-time inputs), so identical guides share one base. B6 stores the same key in\n// computer_setup_guide_versions.build_artifact_key.\nexport const computeComputerArtifactKey = async (\n inputs: ComputerBuildInputsIface,\n): Promise<string> => {\n if (!computerNeedsBuild(inputs)) {\n const hex = await sha256Hex(canonicalJson({ v: ARTIFACT_KEY_VERSION, image: inputs.image }));\n return `img-${hex.slice(0, 16)}`;\n }\n const hex = await sha256Hex(\n canonicalJson({\n v: ARTIFACT_KEY_VERSION,\n image: inputs.image,\n build: inputs.template.build,\n diskGb: inputs.diskGb,\n }),\n );\n return `pa-g${hex.slice(0, 16)}-c${PROJECT_ARTIFACT_CAPTURE_PROTOCOL_VERSION}`;\n};\n\nconst toNetworkPolicy = (\n option: ComputerNetworkPolicyOption | undefined,\n): ResolvedNetworkPolicyIface | undefined => {\n if (option == null) return undefined;\n if (option instanceof Object) return { mode: option.mode, allow: option.allow };\n return { mode: option, allow: [] };\n};\n\n// Saved defaults overridden by the binding: repositories merge by alias, variables\n// union by name, env merges by key, scalars replace.\nexport const mergeComputerParameters = (\n base: ComputerParametersIface,\n override: ComputerParametersIface,\n): ResolvedComputerParametersIface => {\n const repositories = new Map<string, ComputerRepositoryIface>();\n for (const repository of [...(base.repositories ?? []), ...(override.repositories ?? [])]) {\n repositories.set(repository.alias, repository);\n }\n return {\n repositories: [...repositories.values()],\n variables: [...new Set([...(base.variables ?? []), ...(override.variables ?? [])])],\n workspace: override.workspace ?? base.workspace ?? ComputerWorkspacePolicy.Session,\n networkPolicy: toNetworkPolicy(override.networkPolicy) ??\n toNetworkPolicy(base.networkPolicy) ?? { mode: NetworkPolicy.AllowAll, allow: [] },\n env: { ...base.env, ...override.env },\n };\n};\n\nconst fromVersion = (\n version: ComputerGuideVersionIface,\n override: ComputerParametersIface,\n): ResolvedComputerSpecIface => {\n const template = computerTemplateSchema.safeParse(version.templateConfig);\n if (!template.success) {\n throw new Error(\n `computer setup guide ${version.slug} v${version.number} has an invalid template`,\n );\n }\n const defaults = computerParametersSchema.safeParse(version.defaultParameters);\n if (!defaults.success) {\n throw new Error(\n `computer setup guide ${version.slug} v${version.number} has invalid default parameters`,\n );\n }\n return {\n image: version.image,\n template: template.data,\n parameters: mergeComputerParameters(defaults.data, override),\n guide: {\n guideId: version.guideId,\n versionId: version.versionId,\n slug: version.slug,\n title: version.title,\n number: version.number,\n preparedArtifact: version.preparedArtifact,\n },\n instructionsMarkdown: version.instructionsMarkdown,\n };\n};\n\nconst imageOnly = (\n image: string,\n override: ComputerParametersIface,\n): ResolvedComputerSpecIface => ({\n image,\n template: computerTemplateSchema.parse({}),\n parameters: mergeComputerParameters({ workspace: ComputerWorkspacePolicy.Ephemeral }, override),\n guide: null,\n instructionsMarkdown: null,\n});\n\n// Guides come from the contract's `guides` reader (the session's organization).\nexport const resolveComputerSpec = async (args: {\n options: ComputerEnvironmentOptions;\n guides: SandboxGuidesIface;\n defaultImage: string;\n}): Promise<ResolvedComputerSpecIface> => {\n const { options } = args;\n if ('guide' in options) {\n const version = await args.guides.get({\n ref: options.guide.ref,\n version: options.guide.version,\n });\n if (version == null) {\n throw new Error(\n `computer setup guide ${options.guide.ref}@${options.guide.version} was not found`,\n );\n }\n return fromVersion(version, options.parameters);\n }\n if ('inline' in options) {\n return {\n image: options.inline.image,\n template: options.inline.template,\n parameters: mergeComputerParameters(\n { repositories: options.inline.repositories, variables: options.inline.variables },\n options.parameters,\n ),\n guide: null,\n instructionsMarkdown: null,\n };\n }\n if ('image' in options) return imageOnly(options.image, options.parameters);\n const fallback = await args.guides.default();\n return fallback == null\n ? imageOnly(args.defaultImage, options.parameters)\n : fromVersion(fallback, options.parameters);\n};\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AAAA,EACP,sBAAsB;AACxB;AAGO,MAAM,sBAAsB,OAAO,SAIA;AACxC,QAAM,EAAE,QAAQ,IAAI;AACpB,MAAI,WAAW,SAAS;AACtB,UAAM,UAAU,MAAM,KAAK,OAAO,IAAI;AAAA,MACpC,KAAK,QAAQ,MAAM;AAAA,MACnB,SAAS,QAAQ,MAAM;AAAA,IACzB,CAAC;AACD,QAAI,WAAW,MAAM;AACnB,YAAM,IAAI;AAAA,QACR,wBAAwB,QAAQ,MAAM,GAAG,IAAI,QAAQ,MAAM,OAAO;AAAA,MACpE;AAAA,IACF;AACA,WAAO,YAAY,SAAS,QAAQ,UAAU;AAAA,EAChD;AACA,MAAI,YAAY,SAAS;AACvB,WAAO;AAAA,MACL,OAAO,QAAQ,OAAO;AAAA,MACtB,UAAU,QAAQ,OAAO;AAAA,MACzB,YAAY;AAAA,QACV,EAAE,cAAc,QAAQ,OAAO,cAAc,WAAW,QAAQ,OAAO,UAAU;AAAA,QACjF,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,MACP,sBAAsB;AAAA,IACxB;AAAA,EACF;AACA,MAAI,WAAW,QAAS,QAAO,UAAU,QAAQ,OAAO,QAAQ,UAAU;AAC1E,QAAM,WAAW,MAAM,KAAK,OAAO,QAAQ;AAC3C,SAAO,YAAY,OACf,UAAU,KAAK,cAAc,QAAQ,UAAU,IAC/C,YAAY,UAAU,QAAQ,UAAU;AAC9C;",
6
- "names": ["hex"]
7
- }
@@ -1,42 +0,0 @@
1
- import type { NetworkSandboxSessionIface, SandboxRepositoriesIface, SandboxRepositoryCloneSourceIface } from '@finalai/agent-provider/sandbox';
2
- import { type ComputerRepositoryIface, type ComputerTemplateIface } from "./environment.mjs";
3
- import type { SandboxTransportIface } from "./transport.mjs";
4
- export declare const WORKSPACE_ROOT = "/workspaces";
5
- export interface GuideCommandIface {
6
- name: string;
7
- path: string;
8
- description: string | null;
9
- cwd: string;
10
- timeoutMs: number;
11
- }
12
- export declare const guideCommands: (template: ComputerTemplateIface) => Promise<GuideCommandIface[]>;
13
- export declare const GUIDE_COMMAND_PROTOCOL = "guide-command-v1";
14
- export declare const installGuideCommands: (args: {
15
- sandbox: Pick<NetworkSandboxSessionIface, "run">;
16
- template: ComputerTemplateIface;
17
- }) => Promise<void>;
18
- export type RepositoryCloneSourceIface = SandboxRepositoryCloneSourceIface;
19
- export interface SetupLogIface {
20
- (message: string, fields?: Record<string, string | number | boolean | null>): void;
21
- }
22
- export declare const repositoryPath: (alias: string) => string;
23
- export declare const mountRepositories: (args: {
24
- sandbox: NetworkSandboxSessionIface;
25
- repositories: ComputerRepositoryIface[];
26
- resolver: SandboxRepositoriesIface;
27
- log: SetupLogIface;
28
- }) => Promise<void>;
29
- export declare const runWorkspaceSetup: (args: {
30
- sandbox: NetworkSandboxSessionIface;
31
- template: ComputerTemplateIface;
32
- repositories: ComputerRepositoryIface[];
33
- log: SetupLogIface;
34
- }) => Promise<string | null>;
35
- export declare const startServices: (args: {
36
- sandbox: NetworkSandboxSessionIface;
37
- transport: SandboxTransportIface;
38
- template: ComputerTemplateIface;
39
- env: Record<string, string>;
40
- randomUuid: () => string;
41
- log: SetupLogIface;
42
- }) => Promise<string[]>;
@@ -1,242 +0,0 @@
1
- import { canonicalJson, sha256Hex } from "./bytes.mjs";
2
- import {
3
- TemplateWhenMissing
4
- } from "./environment.mjs";
5
- import { shellQuote } from "./paths.mjs";
6
- const WORKSPACE_ROOT = "/workspaces";
7
- const SETUP_MARKER_ROOT = "/workspaces/.final/setup";
8
- const guideCommands = async (template) => {
9
- const hash = await sha256Hex(canonicalJson(template.commands));
10
- return Object.entries(template.commands).map(([name, command]) => ({
11
- name,
12
- path: `${WORKSPACE_ROOT}/.final/commands/${hash}/${name}`,
13
- description: command.description,
14
- cwd: stepCwd(command.cwd),
15
- timeoutMs: command.timeoutMinutes * 6e4
16
- }));
17
- };
18
- const GUIDE_COMMAND_PROTOCOL = "guide-command-v1";
19
- const INSTALL_GUIDE_COMMANDS_SCRIPT = `# ${GUIDE_COMMAND_PROTOCOL}
20
- import json, os, stat, sys, uuid
21
- p = json.load(sys.stdin)
22
- flags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW
23
- root = os.open('/', flags)
24
- try:
25
- for part in p['root'].split('/'):
26
- if not part:
27
- continue
28
- if part in ('.', '..'):
29
- raise ValueError('invalid command root')
30
- try:
31
- os.mkdir(part, dir_fd=root)
32
- except FileExistsError:
33
- pass
34
- child = os.open(part, flags, dir_fd=root)
35
- os.close(root)
36
- root = child
37
- for name, content in p['files'].items():
38
- if '/' in name or name in ('.', '..'):
39
- raise ValueError('invalid command name')
40
- temporary = '.command-' + uuid.uuid4().hex
41
- try:
42
- fd = os.open(temporary, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o700, dir_fd=root)
43
- with os.fdopen(fd, 'wb') as f:
44
- f.write(content.encode('utf-8'))
45
- try:
46
- os.link(temporary, name, src_dir_fd=root, dst_dir_fd=root, follow_symlinks=False)
47
- except FileExistsError:
48
- fd = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=root)
49
- with os.fdopen(fd, 'rb') as f:
50
- if not stat.S_ISREG(os.fstat(f.fileno()).st_mode) or f.read(len(content.encode('utf-8')) + 1) != content.encode('utf-8'):
51
- raise ValueError('guide command differs from its pinned source')
52
- finally:
53
- os.unlink(temporary, dir_fd=root)
54
- finally:
55
- os.close(root)
56
- `;
57
- const installGuideCommands = async (args) => {
58
- const commands = await guideCommands(args.template);
59
- const first = commands[0];
60
- if (first == null) return;
61
- const files = {};
62
- for (const command of commands) {
63
- const source = args.template.commands[command.name];
64
- if (source == null) throw new Error("guide command source is missing");
65
- const missingExit = source.whenMissing === TemplateWhenMissing.Fail ? 1 : 0;
66
- files[command.name] = `#!/bin/bash
67
- set -eu
68
- if [ ! -d ${shellQuote(command.cwd)} ]; then
69
- printf '%s\\n' ${shellQuote(`guide command ${command.name}: missing ${command.cwd}`)} >&2
70
- exit ${missingExit}
71
- fi
72
- cd -- ${shellQuote(command.cwd)}
73
- exec timeout --signal=TERM --kill-after=10s ${source.timeoutMinutes * 60}s bash -c ${shellQuote(source.run)} ${shellQuote(command.name)} "$@"
74
- `;
75
- }
76
- const result = await args.sandbox.run({
77
- command: "python3",
78
- args: ["-c", INSTALL_GUIDE_COMMANDS_SCRIPT],
79
- cwd: "/",
80
- stdin: JSON.stringify({ root: first.path.slice(0, first.path.lastIndexOf("/")), files }),
81
- timeoutMs: 6e4
82
- });
83
- if (result.exitCode !== 0)
84
- throw new Error(`guide command installation failed: ${result.stderr.trim().slice(-2e3)}`);
85
- };
86
- const isGitUrl = (value) => /^(https?:\/\/|ssh:\/\/|git@)/.test(value);
87
- const repositoryPath = (alias) => `${WORKSPACE_ROOT}/${alias}`;
88
- const stepCwd = (cwd) => cwd === "." ? WORKSPACE_ROOT : repositoryPath(cwd);
89
- const runOrThrow = async (sandbox, label, options) => {
90
- const result = await sandbox.run(options);
91
- if (result.exitCode !== 0) {
92
- throw new Error(
93
- `${label} failed (exit ${result.exitCode}): ${result.stderr.trim().slice(-2e3)}`
94
- );
95
- }
96
- };
97
- const mountRepositories = async (args) => {
98
- for (const repository of args.repositories) {
99
- const destination = repositoryPath(repository.alias);
100
- if (await args.sandbox.stat({ path: `${destination}/.git` }) != null) {
101
- await runOrThrow(args.sandbox, `existing checkout ${repository.alias}`, {
102
- command: `git -C ${shellQuote(destination)} rev-parse --verify HEAD`,
103
- shell: true,
104
- cwd: "/",
105
- timeoutMs: 3e4
106
- });
107
- continue;
108
- }
109
- const source = await args.resolver.cloneSource({
110
- repository: repository.repository,
111
- ref: repository.ref
112
- }) ?? (isGitUrl(repository.repository) ? { url: repository.repository, ref: repository.ref, authorization: null } : null);
113
- if (source == null) {
114
- throw new Error(
115
- `repository ${repository.repository} (${repository.alias}) cannot be resolved to a clone source`
116
- );
117
- }
118
- const env = source.authorization == null ? {} : {
119
- GIT_CONFIG_COUNT: "1",
120
- GIT_CONFIG_KEY_0: "http.extraHeader",
121
- GIT_CONFIG_VALUE_0: `Authorization: ${source.authorization}`
122
- };
123
- const checkout = source.ref == null ? "" : ` && git -C ${shellQuote(destination)} checkout --quiet ${shellQuote(source.ref)}`;
124
- args.log("computer_sandbox.repository_clone", { alias: repository.alias });
125
- await runOrThrow(args.sandbox, `clone ${repository.alias}`, {
126
- command: `set -eu; mkdir -p ${WORKSPACE_ROOT}; git clone --quiet -- ${shellQuote(source.url)} ${shellQuote(destination)}${checkout} && git -C ${shellQuote(destination)} rev-parse --verify HEAD`,
127
- shell: true,
128
- cwd: "/",
129
- env: { GIT_TERMINAL_PROMPT: "0", ...env },
130
- timeoutMs: 20 * 6e4
131
- });
132
- }
133
- };
134
- const aliasMissing = async (sandbox, cwd) => cwd !== "." && await sandbox.stat({ path: repositoryPath(cwd) }) == null;
135
- const runWorkspaceSetup = async (args) => {
136
- const steps = args.template.workspace.setup;
137
- if (steps.length === 0) return null;
138
- const hash = (await sha256Hex(
139
- canonicalJson({
140
- steps,
141
- repositories: args.repositories.map((repository) => [
142
- repository.alias,
143
- repository.repository,
144
- repository.ref
145
- ])
146
- })
147
- )).slice(0, 24);
148
- const marker = `${SETUP_MARKER_ROOT}/${hash}`;
149
- if (await args.sandbox.stat({ path: marker }) != null) return hash;
150
- for (const [index, step] of steps.entries()) {
151
- if (await aliasMissing(args.sandbox, step.cwd)) {
152
- if (step.whenMissing === TemplateWhenMissing.Fail) {
153
- throw new Error(
154
- `workspace setup step ${index + 1} needs /workspaces/${step.cwd}, which is missing`
155
- );
156
- }
157
- continue;
158
- }
159
- args.log("computer_sandbox.setup_step", { index });
160
- try {
161
- await runOrThrow(args.sandbox, `workspace setup step ${index + 1}`, {
162
- command: `set -eu
163
- ${step.run}`,
164
- shell: true,
165
- cwd: stepCwd(step.cwd),
166
- timeoutMs: step.timeoutMinutes * 6e4
167
- });
168
- } catch (error) {
169
- if (step.required) throw error;
170
- args.log("computer_sandbox.setup_step_failed", { index, required: false });
171
- }
172
- }
173
- await args.sandbox.writeTextFile({ path: marker, content: (/* @__PURE__ */ new Date()).toISOString() });
174
- return hash;
175
- };
176
- const readyScript = (url, timeoutSeconds) => `
177
- end=$(( $(date +%s) + ${timeoutSeconds} ))
178
- while :; do
179
- code=$(curl -s -o /dev/null -w '%{http_code}' ${shellQuote(url)} || true)
180
- if [ "$code" -ge 200 ] 2>/dev/null && [ "$code" -lt 500 ]; then exit 0; fi
181
- if [ "$(date +%s)" -ge "$end" ]; then exit 1; fi
182
- sleep 2
183
- done`;
184
- const startServices = async (args) => {
185
- const started = [];
186
- for (const service of args.template.services) {
187
- if (await aliasMissing(args.sandbox, service.cwd)) {
188
- if (service.whenMissing === TemplateWhenMissing.Fail) {
189
- throw new Error(
190
- `service ${service.name} needs /workspaces/${service.cwd}, which is missing`
191
- );
192
- }
193
- continue;
194
- }
195
- await args.transport.exec({
196
- id: args.randomUuid(),
197
- command: `exec bash -lc ${shellQuote(service.run)}`,
198
- cwd: stepCwd(service.cwd),
199
- env: args.env,
200
- timeoutMs: null
201
- });
202
- started.push(service.name);
203
- args.log("computer_sandbox.service_started", { service: service.name });
204
- }
205
- await Promise.all(
206
- args.template.services.filter((service) => service.ready != null && started.includes(service.name)).map(async (service) => {
207
- const ready = service.ready;
208
- if (ready == null) return;
209
- const result = await args.sandbox.run({
210
- command: readyScript(ready.url, ready.timeoutSeconds),
211
- shell: true,
212
- cwd: "/",
213
- timeoutMs: (ready.timeoutSeconds + 30) * 1e3
214
- });
215
- if (result.exitCode === 0) {
216
- args.log("computer_sandbox.service_ready", { service: service.name });
217
- return;
218
- }
219
- if (service.required) {
220
- throw new Error(
221
- `service ${service.name} was not ready at ${ready.url} within ${ready.timeoutSeconds} s`
222
- );
223
- }
224
- args.log("computer_sandbox.service_ready_timeout", {
225
- service: service.name,
226
- required: false
227
- });
228
- })
229
- );
230
- return started;
231
- };
232
- export {
233
- GUIDE_COMMAND_PROTOCOL,
234
- WORKSPACE_ROOT,
235
- guideCommands,
236
- installGuideCommands,
237
- mountRepositories,
238
- repositoryPath,
239
- runWorkspaceSetup,
240
- startServices
241
- };
242
- //# sourceMappingURL=workspace-setup.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/sandboxes/workspace-setup.ts"],
4
- "sourcesContent": ["import type {\n NetworkSandboxSessionIface,\n SandboxRepositoriesIface,\n SandboxRepositoryCloneSourceIface,\n} from '@finalai/agent-provider/sandbox';\nimport { canonicalJson, sha256Hex } from \"./bytes.mjs\";\nimport {\n TemplateWhenMissing,\n type ComputerRepositoryIface,\n type ComputerTemplateIface,\n} from \"./environment.mjs\";\nimport { shellQuote } from \"./paths.mjs\";\nimport type { SandboxTransportIface } from \"./transport.mjs\";\n\n// Start-time inputs: repositories, named commands, setup once per workspace and services.\n\nexport const WORKSPACE_ROOT = '/workspaces';\nconst SETUP_MARKER_ROOT = '/workspaces/.final/setup';\n\nexport interface GuideCommandIface {\n name: string;\n path: string;\n description: string | null;\n cwd: string;\n timeoutMs: number;\n}\n\nexport const guideCommands = async (\n template: ComputerTemplateIface,\n): Promise<GuideCommandIface[]> => {\n const hash = await sha256Hex(canonicalJson(template.commands));\n return Object.entries(template.commands).map(([name, command]) => ({\n name,\n path: `${WORKSPACE_ROOT}/.final/commands/${hash}/${name}`,\n description: command.description,\n cwd: stepCwd(command.cwd),\n timeoutMs: command.timeoutMinutes * 60_000,\n }));\n};\n\n// Pin directories and publish complete scripts without following workspace symlinks.\nexport const GUIDE_COMMAND_PROTOCOL = 'guide-command-v1';\nconst INSTALL_GUIDE_COMMANDS_SCRIPT = `# ${GUIDE_COMMAND_PROTOCOL}\nimport json, os, stat, sys, uuid\np = json.load(sys.stdin)\nflags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW\nroot = os.open('/', flags)\ntry:\n for part in p['root'].split('/'):\n if not part:\n continue\n if part in ('.', '..'):\n raise ValueError('invalid command root')\n try:\n os.mkdir(part, dir_fd=root)\n except FileExistsError:\n pass\n child = os.open(part, flags, dir_fd=root)\n os.close(root)\n root = child\n for name, content in p['files'].items():\n if '/' in name or name in ('.', '..'):\n raise ValueError('invalid command name')\n temporary = '.command-' + uuid.uuid4().hex\n try:\n fd = os.open(temporary, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o700, dir_fd=root)\n with os.fdopen(fd, 'wb') as f:\n f.write(content.encode('utf-8'))\n try:\n os.link(temporary, name, src_dir_fd=root, dst_dir_fd=root, follow_symlinks=False)\n except FileExistsError:\n fd = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=root)\n with os.fdopen(fd, 'rb') as f:\n if not stat.S_ISREG(os.fstat(f.fileno()).st_mode) or f.read(len(content.encode('utf-8')) + 1) != content.encode('utf-8'):\n raise ValueError('guide command differs from its pinned source')\n finally:\n os.unlink(temporary, dir_fd=root)\nfinally:\n os.close(root)\n`;\n\nexport const installGuideCommands = async (args: {\n sandbox: Pick<NetworkSandboxSessionIface, 'run'>;\n template: ComputerTemplateIface;\n}): Promise<void> => {\n const commands = await guideCommands(args.template);\n const first = commands[0];\n if (first == null) return;\n const files: Record<string, string> = {};\n for (const command of commands) {\n const source = args.template.commands[command.name];\n if (source == null) throw new Error('guide command source is missing');\n const missingExit = source.whenMissing === TemplateWhenMissing.Fail ? 1 : 0;\n files[command.name] =\n `#!/bin/bash\\nset -eu\\nif [ ! -d ${shellQuote(command.cwd)} ]; then\\n printf '%s\\\\n' ${shellQuote(`guide command ${command.name}: missing ${command.cwd}`)} >&2\\n exit ${missingExit}\\nfi\\ncd -- ${shellQuote(command.cwd)}\\nexec timeout --signal=TERM --kill-after=10s ${source.timeoutMinutes * 60}s bash -c ${shellQuote(source.run)} ${shellQuote(command.name)} \"$@\"\\n`;\n }\n const result = await args.sandbox.run({\n command: 'python3',\n args: ['-c', INSTALL_GUIDE_COMMANDS_SCRIPT],\n cwd: '/',\n stdin: JSON.stringify({ root: first.path.slice(0, first.path.lastIndexOf('/')), files }),\n timeoutMs: 60_000,\n });\n if (result.exitCode !== 0)\n throw new Error(`guide command installation failed: ${result.stderr.trim().slice(-2000)}`);\n};\n\nexport type RepositoryCloneSourceIface = SandboxRepositoryCloneSourceIface;\n\nexport interface SetupLogIface {\n (message: string, fields?: Record<string, string | number | boolean | null>): void;\n}\n\nconst isGitUrl = (value: string): boolean => /^(https?:\\/\\/|ssh:\\/\\/|git@)/.test(value);\n\nexport const repositoryPath = (alias: string): string => `${WORKSPACE_ROOT}/${alias}`;\n\nconst stepCwd = (cwd: string): string => (cwd === '.' ? WORKSPACE_ROOT : repositoryPath(cwd));\n\nconst runOrThrow = async (\n sandbox: Pick<NetworkSandboxSessionIface, 'run'>,\n label: string,\n options: Parameters<NetworkSandboxSessionIface['run']>[0],\n): Promise<void> => {\n const result = await sandbox.run(options);\n if (result.exitCode !== 0) {\n throw new Error(\n `${label} failed (exit ${result.exitCode}): ${result.stderr.trim().slice(-2000)}`,\n );\n }\n};\n\nexport const mountRepositories = async (args: {\n sandbox: NetworkSandboxSessionIface;\n repositories: ComputerRepositoryIface[];\n // The contract's repository credentials (the start context's `repositories`).\n resolver: SandboxRepositoriesIface;\n log: SetupLogIface;\n}): Promise<void> => {\n for (const repository of args.repositories) {\n const destination = repositoryPath(repository.alias);\n if ((await args.sandbox.stat({ path: `${destination}/.git` })) != null) {\n await runOrThrow(args.sandbox, `existing checkout ${repository.alias}`, {\n command: `git -C ${shellQuote(destination)} rev-parse --verify HEAD`,\n shell: true,\n cwd: '/',\n timeoutMs: 30_000,\n });\n continue;\n }\n const source =\n (await args.resolver.cloneSource({\n repository: repository.repository,\n ref: repository.ref,\n })) ??\n (isGitUrl(repository.repository)\n ? { url: repository.repository, ref: repository.ref, authorization: null }\n : null);\n if (source == null) {\n throw new Error(\n `repository ${repository.repository} (${repository.alias}) cannot be resolved to a clone source`,\n );\n }\n // GIT_CONFIG_* applies the header for this process only.\n const env: Record<string, string> =\n source.authorization == null\n ? {}\n : {\n GIT_CONFIG_COUNT: '1',\n GIT_CONFIG_KEY_0: 'http.extraHeader',\n GIT_CONFIG_VALUE_0: `Authorization: ${source.authorization}`,\n };\n const checkout =\n source.ref == null\n ? ''\n : ` && git -C ${shellQuote(destination)} checkout --quiet ${shellQuote(source.ref)}`;\n args.log('computer_sandbox.repository_clone', { alias: repository.alias });\n await runOrThrow(args.sandbox, `clone ${repository.alias}`, {\n command: `set -eu; mkdir -p ${WORKSPACE_ROOT}; git clone --quiet -- ${shellQuote(source.url)} ${shellQuote(destination)}${checkout} && git -C ${shellQuote(destination)} rev-parse --verify HEAD`,\n shell: true,\n cwd: '/',\n env: { GIT_TERMINAL_PROMPT: '0', ...env },\n timeoutMs: 20 * 60_000,\n });\n }\n};\n\nconst aliasMissing = async (sandbox: NetworkSandboxSessionIface, cwd: string): Promise<boolean> =>\n cwd !== '.' && (await sandbox.stat({ path: repositoryPath(cwd) })) == null;\n\nexport const runWorkspaceSetup = async (args: {\n sandbox: NetworkSandboxSessionIface;\n template: ComputerTemplateIface;\n repositories: ComputerRepositoryIface[];\n log: SetupLogIface;\n}): Promise<string | null> => {\n const steps = args.template.workspace.setup;\n if (steps.length === 0) return null;\n const hash = (\n await sha256Hex(\n canonicalJson({\n steps,\n repositories: args.repositories.map((repository) => [\n repository.alias,\n repository.repository,\n repository.ref,\n ]),\n }),\n )\n ).slice(0, 24);\n const marker = `${SETUP_MARKER_ROOT}/${hash}`;\n if ((await args.sandbox.stat({ path: marker })) != null) return hash;\n for (const [index, step] of steps.entries()) {\n if (await aliasMissing(args.sandbox, step.cwd)) {\n if (step.whenMissing === TemplateWhenMissing.Fail) {\n throw new Error(\n `workspace setup step ${index + 1} needs /workspaces/${step.cwd}, which is missing`,\n );\n }\n continue;\n }\n args.log('computer_sandbox.setup_step', { index });\n try {\n await runOrThrow(args.sandbox, `workspace setup step ${index + 1}`, {\n command: `set -eu\\n${step.run}`,\n shell: true,\n cwd: stepCwd(step.cwd),\n timeoutMs: step.timeoutMinutes * 60_000,\n });\n } catch (error) {\n if (step.required) throw error;\n args.log('computer_sandbox.setup_step_failed', { index, required: false });\n }\n }\n await args.sandbox.writeTextFile({ path: marker, content: new Date().toISOString() });\n return hash;\n};\n\nconst readyScript = (url: string, timeoutSeconds: number): string => `\nend=$(( $(date +%s) + ${timeoutSeconds} ))\nwhile :; do\n code=$(curl -s -o /dev/null -w '%{http_code}' ${shellQuote(url)} || true)\n if [ \"$code\" -ge 200 ] 2>/dev/null && [ \"$code\" -lt 500 ]; then exit 0; fi\n if [ \"$(date +%s)\" -ge \"$end\" ]; then exit 1; fi\n sleep 2\ndone`;\n\n// Starts each service as a managed process (not followed, so nothing polls its\n// output) and waits for the required ones to answer their ready check.\nexport const startServices = async (args: {\n sandbox: NetworkSandboxSessionIface;\n transport: SandboxTransportIface;\n template: ComputerTemplateIface;\n env: Record<string, string>;\n randomUuid: () => string;\n log: SetupLogIface;\n}): Promise<string[]> => {\n const started: string[] = [];\n for (const service of args.template.services) {\n if (await aliasMissing(args.sandbox, service.cwd)) {\n if (service.whenMissing === TemplateWhenMissing.Fail) {\n throw new Error(\n `service ${service.name} needs /workspaces/${service.cwd}, which is missing`,\n );\n }\n continue;\n }\n await args.transport.exec({\n id: args.randomUuid(),\n command: `exec bash -lc ${shellQuote(service.run)}`,\n cwd: stepCwd(service.cwd),\n env: args.env,\n timeoutMs: null,\n });\n started.push(service.name);\n args.log('computer_sandbox.service_started', { service: service.name });\n }\n await Promise.all(\n args.template.services\n .filter((service) => service.ready != null && started.includes(service.name))\n .map(async (service) => {\n const ready = service.ready;\n if (ready == null) return;\n const result = await args.sandbox.run({\n command: readyScript(ready.url, ready.timeoutSeconds),\n shell: true,\n cwd: '/',\n timeoutMs: (ready.timeoutSeconds + 30) * 1000,\n });\n if (result.exitCode === 0) {\n args.log('computer_sandbox.service_ready', { service: service.name });\n return;\n }\n if (service.required) {\n throw new Error(\n `service ${service.name} was not ready at ${ready.url} within ${ready.timeoutSeconds} s`,\n );\n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ACA,UAAI,QAAQ,UAAU;AACpB,cAAM,IAAI;AAAA,UACR,WAAW,QAAQ,IAAI,qBAAqB,MAAM,GAAG,WAAW,MAAM,cAAc;AAAA,QACtF;AAAA,MACF;AACA,WAAK,IAAI,0CAA0C;AAAA,QACjD,SAAS,QAAQ;AAAA,QACjB,UAAU;AAAA,MACZ,CAAC;AAAA,IACH,CAAC;AAAA,EACL;AACA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,9 +0,0 @@
1
- import { type OpenHarnessSessionArgsIface, type ResolvedAgentManifestIface, type SandboxTargetEndpointIface } from '@finalai/agent-provider';
2
- export declare const SESSION_ID = "0192f7a0-0000-7000-8000-000000000001";
3
- export declare const HARNESS_SESSION_ID = "0192f7a0-0000-7000-8000-0000000000aa";
4
- export declare const EXPIRES_AT = "2026-10-10T00:15:00.000Z";
5
- export declare const computerEndpoint: SandboxTargetEndpointIface;
6
- export declare const deviceEndpoint: SandboxTargetEndpointIface;
7
- export declare const resolvedManifest: () => ResolvedAgentManifestIface;
8
- export declare const openArgs: (config: unknown, secrets?: Record<string, string>) => OpenHarnessSessionArgsIface;
9
- export declare const idSequence: (prefix: string) => (() => string);