@parcha/agentrun-serve 0.1.0-beta.45 → 0.1.0-beta.47

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 (256) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/NOTICE +4 -0
  3. package/README.md +283 -47
  4. package/dist/acp-package.d.ts +35 -6
  5. package/dist/acp-package.js +3 -3
  6. package/dist/adapter-facts.d.ts +5 -2
  7. package/dist/adapter-facts.js +6 -3
  8. package/dist/adapters.d.ts +7 -0
  9. package/dist/adapters.js +39 -0
  10. package/dist/agents-store.d.ts +5 -3
  11. package/dist/agents-store.js +13 -8
  12. package/dist/api-only.d.ts +7 -10
  13. package/dist/api-only.js +7 -10
  14. package/dist/archil-routes.js +2 -1
  15. package/dist/cap.js +12 -2
  16. package/dist/chatgpt-plan.js +2 -1
  17. package/dist/cli.js +119 -44
  18. package/dist/composio-made.d.ts +19 -2
  19. package/dist/composio-made.js +17 -5
  20. package/dist/composio-preset.d.ts +42 -7
  21. package/dist/composio-preset.js +106 -70
  22. package/dist/composio-triggers.d.ts +9 -4
  23. package/dist/composio-triggers.js +20 -13
  24. package/dist/computer-attach.d.ts +11 -10
  25. package/dist/computer-attach.js +13 -14
  26. package/dist/computer-commands.d.ts +3 -0
  27. package/dist/computer-commands.js +3 -2
  28. package/dist/computer-lost.d.ts +4 -0
  29. package/dist/computer-lost.js +8 -3
  30. package/dist/computer-setting.d.ts +2 -0
  31. package/dist/computer-setting.js +2 -0
  32. package/dist/computers.d.ts +9 -75
  33. package/dist/computers.js +20 -66
  34. package/dist/console/assets/index-BBFzAxLB.js +715 -0
  35. package/dist/console/assets/index-BRi-Rgq6.css +1 -0
  36. package/dist/console/index.html +2 -2
  37. package/dist/cost-heal.d.ts +13 -0
  38. package/dist/cost-heal.js +27 -0
  39. package/dist/dial-relay.d.ts +6 -2
  40. package/dist/dial-relay.js +9 -12
  41. package/dist/email/routes.js +2 -1
  42. package/dist/errors.d.ts +2 -0
  43. package/dist/errors.js +5 -0
  44. package/dist/exa-keyless.d.ts +1 -1
  45. package/dist/exa-keyless.js +1 -1
  46. package/dist/faux-computers.d.ts +2 -3
  47. package/dist/faux-computers.js +9 -31
  48. package/dist/github-connection.js +2 -1
  49. package/dist/harness-archive.d.ts +19 -2
  50. package/dist/harness-archive.js +49 -15
  51. package/dist/harness-check.d.ts +73 -0
  52. package/dist/harness-check.js +489 -0
  53. package/dist/harness-cursor.d.ts +45 -0
  54. package/dist/harness-cursor.js +121 -0
  55. package/dist/harness-recipe.d.ts +127 -0
  56. package/dist/harness-recipe.js +357 -0
  57. package/dist/harness-table.d.ts +12 -0
  58. package/dist/harness-table.js +62 -2
  59. package/dist/harness.d.ts +2 -0
  60. package/dist/harness.js +3 -2
  61. package/dist/host-check.d.ts +6 -0
  62. package/dist/host-check.js +14 -0
  63. package/dist/host.d.ts +10 -3
  64. package/dist/host.js +17 -3
  65. package/dist/import-sources.d.ts +2 -0
  66. package/dist/import-sources.js +2 -0
  67. package/dist/import-summary.d.ts +15 -5
  68. package/dist/import-summary.js +24 -8
  69. package/dist/import.d.ts +34 -4
  70. package/dist/import.js +134 -32
  71. package/dist/key-refusal.d.ts +1 -0
  72. package/dist/key-refusal.js +8 -3
  73. package/dist/key-words.d.ts +1 -1
  74. package/dist/key-words.js +4 -4
  75. package/dist/learn/check.d.ts +3 -0
  76. package/dist/learn/check.js +31 -20
  77. package/dist/learn/compile.js +11 -4
  78. package/dist/learn/promote.d.ts +77 -4
  79. package/dist/learn/promote.js +123 -2
  80. package/dist/learned-nodes.d.ts +4 -3
  81. package/dist/learned-workflow.js +4 -1
  82. package/dist/learning-cost.d.ts +6 -16
  83. package/dist/learning-cost.js +6 -12
  84. package/dist/learning-setting.d.ts +17 -6
  85. package/dist/learning-setting.js +41 -5
  86. package/dist/learning-words.d.ts +2 -0
  87. package/dist/learning-words.js +1 -1
  88. package/dist/listen-first.d.ts +10 -0
  89. package/dist/listen-first.js +25 -1
  90. package/dist/llms.txt +1 -1
  91. package/dist/mcp-gateway.d.ts +2 -1
  92. package/dist/mcp-gateway.js +31 -15
  93. package/dist/mcp-probe.d.ts +18 -6
  94. package/dist/mcp-probe.js +41 -8
  95. package/dist/mcp-secret-writes.d.ts +8 -0
  96. package/dist/mcp-secret-writes.js +104 -4
  97. package/dist/mcp-servers-store.d.ts +11 -5
  98. package/dist/mcp-servers-store.js +46 -20
  99. package/dist/model-form.d.ts +2 -1
  100. package/dist/model-form.js +22 -8
  101. package/dist/model-gateway.d.ts +113 -0
  102. package/dist/model-gateway.js +433 -0
  103. package/dist/model.d.ts +2 -1
  104. package/dist/model.js +9 -7
  105. package/dist/monid.js +1 -1
  106. package/dist/native/binding.d.ts +4 -0
  107. package/dist/native/binding.js +9 -0
  108. package/dist/native/cli.d.ts +3 -2
  109. package/dist/native/cli.js +6 -5
  110. package/dist/openapi.d.ts +2 -0
  111. package/dist/openapi.js +326 -41
  112. package/dist/owner.d.ts +4 -2
  113. package/dist/owner.js +10 -4
  114. package/dist/page.d.ts +8 -0
  115. package/dist/page.js +9 -1
  116. package/dist/port-models.js +17 -10
  117. package/dist/provider.d.ts +3 -3
  118. package/dist/provider.js +12 -3
  119. package/dist/public-address.d.ts +28 -0
  120. package/dist/public-address.js +62 -0
  121. package/dist/run-launch.d.ts +1 -1
  122. package/dist/run-launch.js +1 -1
  123. package/dist/run-secrets.d.ts +3 -2
  124. package/dist/run-secrets.js +6 -4
  125. package/dist/runner/adapter-loop.d.ts +10 -7
  126. package/dist/runner/adapter-loop.js +57 -22
  127. package/dist/runner/adapter-run-spec.d.ts +12 -0
  128. package/dist/runner/adapter-run-spec.js +40 -6
  129. package/dist/runner/adapters/index.js +16 -0
  130. package/dist/runner/adapters/pi.d.ts +5 -2
  131. package/dist/runner/adapters/pi.js +7 -4
  132. package/dist/runner/audit.d.ts +7 -0
  133. package/dist/runner/audit.js +24 -6
  134. package/dist/runner/claim-secrets.js +5 -1
  135. package/dist/runner/cli-run-spec.js +15 -7
  136. package/dist/runner/compare-end.d.ts +43 -0
  137. package/dist/runner/compare-end.js +95 -0
  138. package/dist/runner/computer-journal.d.ts +3 -0
  139. package/dist/runner/computer-journal.js +22 -2
  140. package/dist/runner/conformance/harness.js +19 -8
  141. package/dist/runner/conformance/subject.d.ts +6 -0
  142. package/dist/runner/harness-loops.d.ts +6 -1
  143. package/dist/runner/harness-loops.js +94 -54
  144. package/dist/runner/held.d.ts +5 -4
  145. package/dist/runner/journal-kinds.d.ts +4 -1
  146. package/dist/runner/journal-kinds.js +3 -0
  147. package/dist/runner/loop-contract.d.ts +10 -0
  148. package/dist/runner/main.d.ts +5 -5
  149. package/dist/runner/main.js +81 -11
  150. package/dist/runner/mcp-claim.js +40 -12
  151. package/dist/runner/metrics.d.ts +26 -0
  152. package/dist/runner/metrics.js +44 -1
  153. package/dist/runner/presence.d.ts +41 -0
  154. package/dist/runner/presence.js +89 -0
  155. package/dist/runner/promotion.d.ts +10 -3
  156. package/dist/runner/promotion.js +42 -21
  157. package/dist/runner/run-child-host.js +52 -14
  158. package/dist/runner/runner.d.ts +5 -0
  159. package/dist/runner/runner.js +8 -0
  160. package/dist/runner/store-port.d.ts +3 -0
  161. package/dist/runner/store-secrets.js +19 -7
  162. package/dist/runner/workflow-first.d.ts +5 -2
  163. package/dist/runner/workflow-first.js +6 -3
  164. package/dist/runs-over-store.d.ts +6 -2
  165. package/dist/runs-over-store.js +14 -4
  166. package/dist/sdk/runs.d.ts +1 -1
  167. package/dist/sdk/runs.js +6 -1
  168. package/dist/sdk/schema.js +1 -1
  169. package/dist/secret-writes.d.ts +16 -3
  170. package/dist/secret-writes.js +28 -3
  171. package/dist/server-secrets-store.js +5 -0
  172. package/dist/server.d.ts +31 -2
  173. package/dist/server.js +326 -53
  174. package/dist/sign-ins-secrets.js +4 -1
  175. package/dist/skills/agentrun-serve/SKILL.md +11 -0
  176. package/dist/slack-url.d.ts +5 -0
  177. package/dist/slack-url.js +11 -0
  178. package/dist/slack.d.ts +107 -0
  179. package/dist/slack.js +292 -0
  180. package/dist/start-switches.d.ts +28 -0
  181. package/dist/start-switches.js +37 -0
  182. package/dist/stats.d.ts +1 -1
  183. package/dist/stats.js +2 -1
  184. package/dist/stop-signals.d.ts +11 -0
  185. package/dist/stop-signals.js +22 -0
  186. package/dist/store/agent-body.d.ts +1 -1
  187. package/dist/store/agent-body.js +2 -2
  188. package/dist/store/index.d.ts +3 -3
  189. package/dist/store/index.js +1 -1
  190. package/dist/store/postgres/migrations/0020_runners.sql +18 -0
  191. package/dist/store/postgres/store.d.ts +1 -1
  192. package/dist/store/postgres/store.js +4 -2
  193. package/dist/store/schema.d.ts +13 -5
  194. package/dist/store/schema.js +20 -11
  195. package/dist/store/seal.d.ts +16 -4
  196. package/dist/store/sqlite/store.d.ts +1 -1
  197. package/dist/store/sqlite/store.js +106 -27
  198. package/dist/store/store.d.ts +75 -23
  199. package/dist/store/store.js +11 -0
  200. package/dist/store-reads/analytics.js +3 -2
  201. package/dist/store-reads/cap.d.ts +7 -0
  202. package/dist/store-reads/cap.js +11 -1
  203. package/dist/store-reads/journal.js +27 -1
  204. package/dist/store-reads/learning.d.ts +23 -2
  205. package/dist/store-reads/learning.js +29 -8
  206. package/dist/store-reads/runs.d.ts +9 -0
  207. package/dist/store-reads/runs.js +19 -6
  208. package/dist/store-reads/stats.d.ts +4 -1
  209. package/dist/store-reads/stats.js +15 -6
  210. package/dist/store-view.d.ts +123 -14
  211. package/dist/store-view.js +154 -21
  212. package/dist/telemetry.d.ts +7 -7
  213. package/dist/telemetry.js +38 -15
  214. package/dist/templates.d.ts +6 -3
  215. package/dist/templates.js +38 -3
  216. package/dist/timeline/timeline.js +18 -0
  217. package/dist/tool-keys-store.js +2 -2
  218. package/dist/tool-keys.js +2 -1
  219. package/dist/tool-plane.js +2 -2
  220. package/dist/trigger-adapter.d.ts +3 -4
  221. package/dist/trigger-adapter.js +2 -2
  222. package/dist/trigger-composio.js +3 -3
  223. package/dist/trigger-email.js +0 -2
  224. package/dist/trigger-feed.js +0 -2
  225. package/dist/trigger-schedule.js +3 -0
  226. package/dist/trigger-secrets-shown.d.ts +6 -3
  227. package/dist/trigger-secrets-shown.js +22 -13
  228. package/dist/trigger-targets.d.ts +1 -1
  229. package/dist/trigger-targets.js +19 -8
  230. package/dist/triggers.d.ts +7 -3
  231. package/dist/triggers.js +2 -1
  232. package/dist/webhooks.d.ts +85 -9
  233. package/dist/webhooks.js +129 -46
  234. package/dist/wires.d.ts +6 -1
  235. package/dist/wires.js +5 -0
  236. package/dist/workspace/attach.d.ts +3 -2
  237. package/dist/workspace/attach.js +2 -1
  238. package/dist/workspace/attached-computers.d.ts +6 -8
  239. package/dist/workspace/attached-computers.js +27 -24
  240. package/dist/workspace/computer-deps.d.ts +2 -3
  241. package/dist/workspace/computer-deps.js +3 -6
  242. package/dist/workspace/computer-for-claim.js +72 -96
  243. package/dist/workspace/computer-kept.d.ts +0 -7
  244. package/dist/workspace/computer-kept.js +0 -17
  245. package/dist/workspace/resolve-computer.d.ts +18 -14
  246. package/dist/workspace/resolve-computer.js +47 -60
  247. package/dist/workspace/synced-folder.d.ts +20 -15
  248. package/dist/workspace/synced-folder.js +33 -43
  249. package/launcher/agentrun-serve +4 -1
  250. package/package.json +10 -10
  251. package/skills/agentrun-serve/SKILL.md +11 -0
  252. package/templates/README.md +1 -1
  253. package/templates/inbound-lead/agent.md +2 -1
  254. package/templates/kyb/agent.md +2 -1
  255. package/dist/console/assets/index-3O2Yl6hZ.js +0 -701
  256. package/dist/console/assets/index-DaFsZuzQ.css +0 -1
@@ -3,9 +3,10 @@ import { type Workspace } from "./workspace.js";
3
3
  /** What attach runs of D, passed in (the cutover passes D's own): the read-back a mount made as `spec` asks gives, and
4
4
  * the claim's epoch it is read back under (D reads an Archil mount back with the computer's claim epoch; a bind takes
5
5
  * none). `sync`: the claim made the computer a synced folder of the Workspace (resolve-computer.ts), so it reads back
6
- * as one, under the epoch. */
6
+ * as one, under the epoch. `readBackOf` may answer as a promise: a run's own process (run-child.ts) hands its check to
7
+ * the runner's Workspace across the run channel, where a function is a handle whose call is answered later. */
7
8
  export type MountCheck = {
8
- readonly readBackOf: (spec: MountSpec, epoch?: number) => MountReadBack;
9
+ readonly readBackOf: (spec: MountSpec, epoch?: number) => MountReadBack | Promise<MountReadBack>;
9
10
  readonly epoch?: number;
10
11
  readonly sync?: true;
11
12
  };
@@ -436,7 +436,8 @@ export async function checkReadBack(computer, spec, check) {
436
436
  const read = await computer.readBack();
437
437
  if (!read.ok)
438
438
  throw new WorkspaceError("UNAVAILABLE", `the computer ${computer.id} did not say what it mounts at ${MOUNT_AT}: ${read.error.message}`);
439
- const want = check.readBackOf(spec, check.epoch);
439
+ // Awaited: across the run channel the check's readBackOf is a handle, and an unawaited answer reads as no mount at all.
440
+ const want = await check.readBackOf(spec, check.epoch);
440
441
  if (keyOf(read.value) !== keyOf(want)) {
441
442
  throw new WorkspaceError("REFUSED", `the computer ${computer.id} does not hold this run's folder at ${MOUNT_AT}: it mounts ${shown(read.value)}, not ${shown(want)}`);
442
443
  }
@@ -29,20 +29,18 @@ export declare const pairedOf: (row: PairedComputerRow) => PairedComputer;
29
29
  /** What a driver's hello lacks to serve `kind`, by the kind registry's rule (the computer package's SETTING_KINDS, which
30
30
  * servingRefusals reads): "it says desktop but declares no input.pointer, input.keys", "it says android, which no
31
31
  * desktop computer is"; undefined when the hello serves the kind. The one source of a paired computer's words for a
32
- * kind it cannot serve: at pairing (servesNoKind) and at a run's start (withPaired's unservedWhy). */
32
+ * kind it cannot serve: at pairing (servesNoKind) and at a run's start (pairedEntry's unserved). */
33
33
  export declare function helloLacks(hello: Partial<HelloResult>, kind: ComputerSettingKind): string | undefined;
34
34
  /** Why `name`'s driver may not pair: its hello serves no kind an agent's computer can be, so no agent could pick it; in
35
35
  * words that say what it lacks and to update the driver. Undefined when it serves one. */
36
36
  export declare function servesNoKind(name: string, hello: Partial<HelloResult>): string | undefined;
37
37
  /** A paired computer as a provider of `registry`: named by its name and its os, as an agent's computer picker lists it;
38
- * the setting kinds its paired hello serves, no keys, the machine's own network ("open": a run never narrows a person's
39
- * own machine), never metered. A sandbox (a Linux box with files and exec) takes the run's folder as a synced folder
40
- * (the computer package's attachedProvider checks its /workspace); a desktop or a phone takes no mount. */
38
+ * the setting kinds its paired hello serves, why it serves each other one (unserved, pairedUnserved's words), no keys,
39
+ * the machine's own network ("open": a run never narrows a person's own machine), never metered. A sandbox (a Linux box
40
+ * with files and exec) takes the run's folder as a synced folder (the computer package's attachedProvider checks its
41
+ * /workspace); a desktop or a phone takes no mount. */
41
42
  export declare function pairedEntry(row: PairedComputerRow, registry: Pick<KindRegistry, "SETTING_KINDS" | "servingRefusals">): ProviderEntry;
42
- /** `registry` with each paired computer of `rows` as one more provider (pairedEntry), and the words for one that cannot
43
- * serve a kind an agent asks of it: it is a computer of the person's own, and either the attach path carries no such
44
- * kind (ATTACH_CANNOT: a browser), or it is a desktop or a phone asked to be a sandbox (PAIRED_SANDBOX), so the agent
45
- * takes it as the kind it serves, or its driver lacks what the kind needs (helloLacks), so the driver is what to update. */
43
+ /** `registry` with each paired computer of `rows` as one more provider (pairedEntry). */
46
44
  export declare function withPaired<R extends KindRegistry>(registry: R, rows: readonly PairedComputerRow[]): R;
47
45
  /** The provider of the paired computer `row`: attachedProvider over the hub, or a refusal in ONE_PROCESS_WORDS where this
48
46
  * process holds no hub. */
@@ -44,7 +44,7 @@ const PAIRED_SANDBOX = "only a Linux box paired with computerd and no display ca
44
44
  /** What a driver's hello lacks to serve `kind`, by the kind registry's rule (the computer package's SETTING_KINDS, which
45
45
  * servingRefusals reads): "it says desktop but declares no input.pointer, input.keys", "it says android, which no
46
46
  * desktop computer is"; undefined when the hello serves the kind. The one source of a paired computer's words for a
47
- * kind it cannot serve: at pairing (servesNoKind) and at a run's start (withPaired's unservedWhy). */
47
+ * kind it cannot serve: at pairing (servesNoKind) and at a run's start (pairedEntry's unserved). */
48
48
  export function helloLacks(hello, kind) {
49
49
  const spec = SETTING_KINDS[kind];
50
50
  const said = String(hello.kind ?? "nothing");
@@ -69,14 +69,33 @@ export function servesNoKind(name, hello) {
69
69
  const lack = near === undefined ? `it says ${String(hello.kind ?? "nothing")}, which no kind of computer is` : helloLacks(hello, near);
70
70
  return `${name}'s driver serves no kind: ${lack}: update the driver on ${name}`;
71
71
  }
72
+ /** Why the paired computer `row`, which serves `kinds`, gives no computer of `kind`: it is a computer of the person's
73
+ * own, and either the attach path carries no such kind (ATTACH_CANNOT: a browser), or it is a desktop or a phone asked
74
+ * to be a sandbox (PAIRED_SANDBOX), so the agent takes it as the kind it serves, or its driver lacks what the kind needs
75
+ * (helloLacks), so the driver is what to update. Undefined where none of these says why. */
76
+ function pairedUnserved(row, kinds, kind) {
77
+ const as = `give this agent ${row.name} as a ${kinds.join(" or ")} computer`;
78
+ if (kind in ATTACH_CANNOT && kinds.length > 0)
79
+ return `it is a computer of your own, and a paired computer can't be a ${kind} computer yet; ${as}`;
80
+ if (kind === "sandbox" && kinds.length > 0)
81
+ return `it is a computer of your own, and ${PAIRED_SANDBOX}; ${as}`;
82
+ const lack = helloLacks(row.hello, kind);
83
+ return lack === undefined ? undefined : `it is a computer of your own, and ${lack}; update the driver on ${row.name}`;
84
+ }
72
85
  /** A paired computer as a provider of `registry`: named by its name and its os, as an agent's computer picker lists it;
73
- * the setting kinds its paired hello serves, no keys, the machine's own network ("open": a run never narrows a person's
74
- * own machine), never metered. A sandbox (a Linux box with files and exec) takes the run's folder as a synced folder
75
- * (the computer package's attachedProvider checks its /workspace); a desktop or a phone takes no mount. */
86
+ * the setting kinds its paired hello serves, why it serves each other one (unserved, pairedUnserved's words), no keys,
87
+ * the machine's own network ("open": a run never narrows a person's own machine), never metered. A sandbox (a Linux box
88
+ * with files and exec) takes the run's folder as a synced folder (the computer package's attachedProvider checks its
89
+ * /workspace); a desktop or a phone takes no mount. */
76
90
  export function pairedEntry(row, registry) {
77
91
  const hello = row.hello;
78
92
  const configuration = { kind: String(hello.kind ?? ""), groups: Array.isArray(hello.groups) ? [...hello.groups] : [] };
79
- const kinds = Object.keys(registry.SETTING_KINDS).filter((kind) => kind !== "none" && !(kind in ATTACH_CANNOT) && registry.servingRefusals(configuration, kind).length === 0);
93
+ const named = Object.keys(registry.SETTING_KINDS).filter((kind) => kind !== "none");
94
+ const kinds = named.filter((kind) => !(kind in ATTACH_CANNOT) && registry.servingRefusals(configuration, kind).length === 0);
95
+ const unserved = Object.fromEntries(named.filter((kind) => !kinds.includes(kind)).flatMap((kind) => {
96
+ const why = pairedUnserved(row, kinds, kind);
97
+ return why === undefined ? [] : [[kind, why]];
98
+ }));
80
99
  return {
81
100
  id: row.id,
82
101
  label: typeof hello.os === "string" ? `${row.name} (${hello.os})` : row.name,
@@ -86,31 +105,15 @@ export function pairedEntry(row, registry) {
86
105
  network: ["open"],
87
106
  metered: false,
88
107
  capabilities: [configuration],
108
+ unserved,
89
109
  defaultImage: Object.fromEntries(kinds.map((kind) => [kind, ATTACHED_IMAGE])),
90
110
  };
91
111
  }
92
- /** `registry` with each paired computer of `rows` as one more provider (pairedEntry), and the words for one that cannot
93
- * serve a kind an agent asks of it: it is a computer of the person's own, and either the attach path carries no such
94
- * kind (ATTACH_CANNOT: a browser), or it is a desktop or a phone asked to be a sandbox (PAIRED_SANDBOX), so the agent
95
- * takes it as the kind it serves, or its driver lacks what the kind needs (helloLacks), so the driver is what to update. */
112
+ /** `registry` with each paired computer of `rows` as one more provider (pairedEntry). */
96
113
  export function withPaired(registry, rows) {
97
114
  if (rows.length === 0)
98
115
  return registry;
99
- const byId = new Map(rows.map((row) => [row.id, row]));
100
- const unservedWhy = (entry, kind) => {
101
- const row = byId.get(entry.id);
102
- if (row !== undefined && kind in ATTACH_CANNOT && entry.kinds.length > 0) {
103
- return `${row.name} is a computer of your own, and a paired computer can't be a ${kind} computer yet: give this agent ${row.name} as a ${entry.kinds.join(" or ")} computer`;
104
- }
105
- if (row !== undefined && kind === "sandbox" && entry.kinds.length > 0) {
106
- return `${row.name} is a computer of your own, and ${PAIRED_SANDBOX}: give this agent ${row.name} as a ${entry.kinds.join(" or ")} computer`;
107
- }
108
- const lack = row === undefined ? undefined : helloLacks(row.hello, kind);
109
- if (row === undefined || lack === undefined)
110
- return registry.unservedWhy?.(entry, kind);
111
- return `${row.name} is a computer of your own, and its driver gives no ${kind} computer: ${lack}. Update the driver on ${row.name}`;
112
- };
113
- return { ...registry, PROVIDERS: [...registry.PROVIDERS, ...rows.map((row) => pairedEntry(row, registry))], unservedWhy };
116
+ return { ...registry, PROVIDERS: [...registry.PROVIDERS, ...rows.map((row) => pairedEntry(row, registry))] };
114
117
  }
115
118
  /** The provider of the paired computer `row`: attachedProvider over the hub, or a refusal in ONE_PROCESS_WORDS where this
116
119
  * process holds no hub. */
@@ -4,6 +4,7 @@ import { type HostRead } from "../docker-host-addresses.js";
4
4
  import { type ProviderFactories } from "../computer-keys.js";
5
5
  import type { FauxComputers } from "../faux-computers.js";
6
6
  import { type KeyEnv } from "../key-meta.js";
7
+ import { BOX_CPUS_ENV, BOX_MEMORY_ENV, BOX_PIDS_ENV } from "../start-switches.js";
7
8
  import type { Store } from "../store/index.js";
8
9
  import { type ClaimComputer, type ClaimLaunch, computerForClaim, type ComputerForClaimDeps, type ComputerSaid, type KeptKind, type OpenComputerView, type Replaced } from "./computer-for-claim.js";
9
10
  import { type ProviderLoad } from "./computer-providers.js";
@@ -14,9 +15,7 @@ export declare const COMPUTER_LIFETIME_MS: number;
14
15
  /** The settings that size a Docker computer (a sandbox or a desktop): its CPUs, its memory (swap included) and how many
15
16
  * processes and threads it may hold at once. Unset, the Docker provider's own defaults hold. A vendor's computer sizes
16
17
  * itself and is never given them. */
17
- export declare const BOX_CPUS_ENV = "AGENTRUN_BOX_CPUS";
18
- export declare const BOX_MEMORY_ENV = "AGENTRUN_BOX_MEMORY";
19
- export declare const BOX_PIDS_ENV = "AGENTRUN_BOX_PIDS";
18
+ export { BOX_CPUS_ENV, BOX_MEMORY_ENV, BOX_PIDS_ENV };
20
19
  /** A Docker computer's size, as the Docker provider takes it on its spec. */
21
20
  export type DockerLimits = Pick<ComputerSpec, "cpus" | "memoryMb" | "pids">;
22
21
  /** A Docker computer's size from `env`'s AGENTRUN_BOX_CPUS, _MEMORY and _PIDS: each one set, as its spec field; none set,
@@ -25,6 +25,7 @@ import { unionOf } from "../docker-host-addresses.js";
25
25
  import { KEY_TABLE } from "../computer-keys.js";
26
26
  import { envValue, keyReader } from "../key-meta.js";
27
27
  import { boxAllowOf, boxAllowSetIn } from "../box-settings.js";
28
+ import { BOX_CPUS_ENV, BOX_MEMORY_ENV, BOX_PIDS_ENV } from "../start-switches.js";
28
29
  import { readLaunchBody } from "../run-launch.js";
29
30
  import { SERVER_NOTE_LABEL } from "@parcha/agentrun-kernel/kernel/cap";
30
31
  import { computerForClaim } from "./computer-for-claim.js";
@@ -40,9 +41,7 @@ const refused = (words) => Object.assign(new Error(words), { code: "computer_una
40
41
  /** The settings that size a Docker computer (a sandbox or a desktop): its CPUs, its memory (swap included) and how many
41
42
  * processes and threads it may hold at once. Unset, the Docker provider's own defaults hold. A vendor's computer sizes
42
43
  * itself and is never given them. */
43
- export const BOX_CPUS_ENV = "AGENTRUN_BOX_CPUS";
44
- export const BOX_MEMORY_ENV = "AGENTRUN_BOX_MEMORY";
45
- export const BOX_PIDS_ENV = "AGENTRUN_BOX_PIDS";
44
+ export { BOX_CPUS_ENV, BOX_MEMORY_ENV, BOX_PIDS_ENV };
46
45
  /** Each setting's spec field and what it takes, in an operator's words. */
47
46
  const LIMIT_SETTINGS = [
48
47
  { name: BOX_CPUS_ENV, field: "cpus", form: "a number of CPUs, such as 2 or 1.5" },
@@ -246,9 +245,7 @@ export function claimKinds(options) {
246
245
  const base = options.kinds ?? { SETTING_KINDS, PROVIDERS, servingRefusals };
247
246
  if (!options.faux)
248
247
  return base;
249
- // The faux registry is Settings' shape (computers.ts); the claim reads the same data as resolve-computer.ts's.
250
- const faux = options.faux.kinds;
251
- return { ...base, PROVIDERS: [...base.PROVIDERS, ...faux.PROVIDERS] };
248
+ return { ...base, PROVIDERS: [...base.PROVIDERS, ...options.faux.kinds.PROVIDERS] };
252
249
  }
253
250
  /** This machine's Docker daemon as the claim asks it once a Docker launch fails: one check per process (its answer
254
251
  * kept a while, docker-daemon.ts), in `env`. */
@@ -18,7 +18,8 @@
18
18
  // `lapsed`), and the run's tools and model are told (run-tools.ts, the adapter loop's computer note).
19
19
  //
20
20
  // A sandbox the claim made can be lost mid-run (its vendor deleted it, or no longer has it): the call that finds it lost
21
- // fails, and the next call of the run's tools starts a new one in its place under this claim (lostAware), its folder
21
+ // fails, saying so and that it was not run again (code gone, computer-lost.ts lostInCallWords), and is never sent to the
22
+ // new one; the next call of the run's tools starts a new one in its place under this claim (lostAware), its folder
22
23
  // mounted again (Mode 2: a new mount credential, the lost one's removed), said on the run's timeline, up to `recreates`
23
24
  // times a claim; the loss after that ends the run, code computer_unavailable. A provider error that is not a loss (a 5xx,
24
25
  // a timeout) starts nothing. A desktop, a phone, a paired computer and the agent's own are never started again so.
@@ -41,16 +42,16 @@ import { isBrowserProvider, ownerFilter, releaseOlder, RUN_LABEL, runLabels } fr
41
42
  import { startRecording } from "../computer-record.js";
42
43
  import { computerOfPlace } from "../computer-setting.js";
43
44
  import { KEY_TABLE, providerOptions, settingOptions } from "../computer-keys.js";
44
- import { LOST_RECREATES, lostEnd, lostRecreatedWords } from "../computer-lost.js";
45
+ import { LOST_RECREATES, lostEnd, lostInCallWords, lostRecreatedWords } from "../computer-lost.js";
45
46
  import { inToolCall, stopRun } from "../paid-calls.js";
46
47
  import { getSealedKey } from "../server-keys.js";
47
48
  import { agentComputerOf, forgetAgentComputer, holdAgentComputer, keepAgentComputer, liveHolderOf, reconcileAgentComputer, serverIdOf } from "./agent-computer.js";
48
49
  import { pairedProvider, withPaired } from "./attached-computers.js";
49
50
  import { computerHold, heldHands } from "./computer-hold.js";
50
- import { deleteKept, endKept, KEEP_MS, KEPT_DELETE_MS, KEPT_PULL_MS, keptEnded, readKept, takeKept, writeKept } from "./computer-kept.js";
51
+ import { deleteKept, endKept, KEEP_MS, readKept, takeKept, writeKept } from "./computer-kept.js";
51
52
  import { storeLedger } from "./computer-ledger.js";
52
53
  import { providerKeys, registryHere, resolveComputer } from "./resolve-computer.js";
53
- import { claimHolds, fencedStore, pullFolder, pushFolder, storedFolder } from "./synced-folder.js";
54
+ import { claimHolds, fencedStore, holdSynced, storedFolder } from "./synced-folder.js";
54
55
  /** A computer that cannot be had, with the code the run fails with and the server's words. */
55
56
  const unavailable = (words) => Object.assign(new Error(words), { code: "computer_unavailable" });
56
57
  /** The claim was lost (its live view's registration was fenced): the run's process holds it no more. */
@@ -257,17 +258,23 @@ async function providerLaunch(provider, claim, spec, signal) {
257
258
  /** The words a hosted provider's connection answers every call in once its vendor deleted the machine (the computer
258
259
  * package's hosted deletedSaid: "the computer <name> (<id>) was deleted: <vendor> no longer has it"). */
259
260
  const DELETED_SAID = /^the computer \S+ \(\S+\) was deleted: /;
261
+ /** Whether `error` says the computer that answered it is gone (its connection ended, or its vendor deleted it), as a call
262
+ * in flight on one another call found lost answers. */
263
+ const lossSaid = (error) => error.code === "gone" || (error.code === "not_found" && DELETED_SAID.test(error.message));
260
264
  /**
261
265
  * `first`, a sandbox the claim made through its provider (or took back from the run's park), held so its loss is not the
262
266
  * run's: a call it answers deleted (the hosted connection's own words, DELETED_SAID), or gone with its provider
263
- * confirming it no longer has it (attach answers not_found or gone), marks it lost, and that call answers as it did. The
267
+ * confirming it no longer has it (attach answers not_found or gone), marks it lost, and that call fails code gone in
268
+ * lostInCallWords (the computer was lost while it ran, and it was not run again), never not_found: a caller that reads
269
+ * not_found as a program or file not there (the shell's fallback from bash to sh) would send it again, to the new one. The
264
270
  * next call made inside one of the run's tool calls starts a new one in its place (`renewal.remake`, one at a time
265
271
  * however many calls ask) and goes to it: the lost one let go, the run's Timeline told (`started`). Each new one is the
266
272
  * claim's, under its epoch: a later claim lets it go as it lets any of the run's older computers go. A start that fails
267
273
  * answers its words and counts for nothing: the next call tries again under the same request, so a retry finds what an
268
274
  * earlier try made. Gone with the provider still reporting the machine, or its read failing (a 5xx, a timeout), is not
269
- * lost: the call's own answer stands, and so does a read that comes back after another call already replaced the one it
270
- * asked about. A loss once `renewal.max` new ones were started ends the run at once (`renewal.stop`, computer-lost.ts
275
+ * lost: the call's own answer stands. A call in flight on one another call found lost (or already replaced) is cut by the
276
+ * same loss: an answer that says gone fails in lostInCallWords too, and any other answer stands; neither marks the new
277
+ * one lost. A loss once `renewal.max` new ones were started ends the run at once (`renewal.stop`, computer-lost.ts
271
278
  * lostEnd's words, code computer_unavailable), the call that found it answering those words, as every later call does.
272
279
  * A call outside a tool call (the run's end sweeping its scratch, the owner's computer channel) gets the loss's own
273
280
  * answer and starts nothing.
@@ -293,17 +300,37 @@ function lostAware(first, renewal) {
293
300
  const found = await renewal.provider.attach({ id: held.ref.id }).catch(() => undefined);
294
301
  return found !== undefined && !found.ok && (found.error.code === "not_found" || found.error.code === "gone");
295
302
  };
296
- /** `why`, the current one's loss: past the bound, the run's end, at once. */
297
- const lose = async (why) => {
303
+ /** The answer of a call in flight on `held` when it was lost, `why` its own: inside one of the run's tool calls, gone in
304
+ * lostInCallWords; outside one (the run's end, the owner's computer channel), `why` itself, as every later call
305
+ * outside one answers the loss. */
306
+ const cutBy = (held, why) => (renewal.may() ? { code: "gone", message: lostInCallWords(held.ref.name, why.message) } : why);
307
+ /** `why`, the current one's (`held`'s) loss, as the call that found it answers: past the bound, the run's end, at once. */
308
+ const lose = async (held, why) => {
298
309
  if (made < renewal.max) {
299
310
  lost = why;
300
311
  letGo = false;
301
- return why;
312
+ return cutBy(held, why);
302
313
  }
303
314
  spent = { code: "not_found", message: lostEnd(renewal.max, why.message) };
304
315
  await renewal.stop(spent.message);
305
316
  return spent;
306
317
  };
318
+ /** `held`'s own client, for a synced folder's sync, which stays on the machine it holds and starts nothing: a loss it
319
+ * finds while `held` is the current one marks it lost as any call's does (lose), so the run's next call starts the new
320
+ * one before it runs. Its answers on a machine already lost or replaced stand. */
321
+ const ownOf = (held) => ({
322
+ async call(method, params, options) {
323
+ const answered = await held.client.call(method, params, options);
324
+ if (answered.ok || spent || held !== current || lost)
325
+ return answered;
326
+ if (!(await goneFrom(held, answered.error)) || spent || held !== current || lost)
327
+ return answered;
328
+ return { ok: false, error: await lose(held, answered.error) };
329
+ },
330
+ close() {
331
+ held.client.close();
332
+ },
333
+ });
307
334
  /** A new one in place of the lost one, or why the run has none now. */
308
335
  const renew = async (why) => {
309
336
  // The lost one's resources go first: a vendor's delete of one it no longer has is done already.
@@ -313,7 +340,7 @@ function lostAware(first, renewal) {
313
340
  }
314
341
  let fresh;
315
342
  try {
316
- fresh = await renewal.remake(made + 1);
343
+ fresh = await renewal.remake(made + 1, ownOf);
317
344
  }
318
345
  catch (error) {
319
346
  return { code: "gone", message: `${why.message}; a new sandbox could not be started: ${error instanceof Error ? error.message : String(error)}` };
@@ -342,13 +369,22 @@ function lostAware(first, renewal) {
342
369
  }
343
370
  const held = current;
344
371
  const answered = await held.client.call(method, params, options);
345
- if (answered.ok || held !== current || lost || spent)
372
+ if (answered.ok || spent)
346
373
  return answered;
374
+ // Another call found `held` lost, or replaced it, while this one was in flight on it (a command's stdout and stderr
375
+ // read side by side): an answer that says gone is this call's cut by the same loss, never sent again either. Any
376
+ // other answer stands, and starts nothing.
377
+ if (held !== current || lost)
378
+ return lossSaid(answered.error) ? { ok: false, error: cutBy(held, answered.error) } : answered;
347
379
  const gone = await goneFrom(held, answered.error);
348
- // Read back after another call replaced it, or found it lost, or the run ended: this answer alone stands.
349
- if (!gone || held !== current || lost || spent)
380
+ if (!gone)
381
+ return answered;
382
+ // Read back after another call replaced it, or found it lost, or the run ended: cut by that loss, nothing more.
383
+ if (spent)
350
384
  return answered;
351
- return { ok: false, error: await lose(answered.error) };
385
+ if (held !== current || lost)
386
+ return { ok: false, error: cutBy(held, answered.error) };
387
+ return { ok: false, error: await lose(held, answered.error) };
352
388
  },
353
389
  close() {
354
390
  current.client.close();
@@ -365,6 +401,10 @@ function lostAware(first, renewal) {
365
401
  machine: first.machine,
366
402
  hello: first.hello,
367
403
  client,
404
+ // The current one's own (ownOf): a synced folder's sync through it marks a loss it finds and starts nothing.
405
+ get own() {
406
+ return ownOf(current);
407
+ },
368
408
  readBack: () => current.readBack(),
369
409
  close: () => current.close(),
370
410
  async release() {
@@ -373,19 +413,6 @@ function lostAware(first, renewal) {
373
413
  },
374
414
  };
375
415
  }
376
- /** A kept computer's synced folder read back whole onto `store` (the run's disk) through a connection of its own, within
377
- * KEPT_PULL_MS, before its end deletes it. Throws in words where it can't be. */
378
- async function pullKept(provider, ref, store) {
379
- const connected = await provider.connect(ref);
380
- if (!connected.ok)
381
- throw new Error(connected.error.message);
382
- try {
383
- await pullFolder(store, connected.value.client, AbortSignal.timeout(KEPT_PULL_MS));
384
- }
385
- finally {
386
- await connected.value.close();
387
- }
388
- }
389
416
  /** The computer an earlier claim of the run kept at its park (`kept`), attached again through `provider` and connected,
390
417
  * or undefined when its provider no longer has it or it does not connect (one that does not is deleted). */
391
418
  async function keptLaunch(provider, kept, signal) {
@@ -551,6 +578,8 @@ store, deps) {
551
578
  const disk = deps.workspace.syncStore?.();
552
579
  return disk && holds ? fencedStore(disk, holds) : disk;
553
580
  };
581
+ /** The claim's synced folder, held at the start and again by each new sandbox in place of a lost one. */
582
+ const folderHeld = {};
554
583
  const table = deps.keyTable ?? KEY_TABLE;
555
584
  // The paired computers, each one more provider of the registry (attached-computers.ts): a setting names one by its id.
556
585
  const paired = deps.attached ? await deps.attached.rows() : [];
@@ -616,11 +645,11 @@ store, deps) {
616
645
  * this claim's labels and its own request (the claim's, then which new one), so a retry of it under this epoch finds
617
646
  * the one it made. Where it holds the run's folder (`folder`), the new one holds it too, read back before it serves a
618
647
  * call: a mount's credential of the lost one removed (Mode 2) and a new one asked for; a synced folder pushed in again
619
- * from the disk (synced-folder.ts), whose sync goes on from there (the claim's FolderSync lists the new one). */
648
+ * from the disk and held (synced-folder.ts holdSynced), so the claim's sync goes on from the new one's manifest. */
620
649
  const renewalOf = (provider, entry, specNow, folder) => ({
621
650
  provider,
622
651
  max: deps.recreates ?? LOST_RECREATES,
623
- async remake(times) {
652
+ async remake(times, own) {
624
653
  deps.onStarting?.({ provider: entry.label, kind: "sandbox" });
625
654
  const spec = await specNow();
626
655
  let mount;
@@ -649,7 +678,7 @@ store, deps) {
649
678
  if (mount) {
650
679
  try {
651
680
  if (store && stored)
652
- await pushFolder(store, again.client, stored, deps.signal);
681
+ folderHeld.folder = await holdSynced(store, own(again), stored, deps.signal);
653
682
  await deps.workspace.attach({ id: ref.id, client: again.client, readBack: () => again.readBack() }, { ...deps.check, epoch: deps.check.epoch ?? launch.epoch, ...(store ? { sync: true } : {}) });
654
683
  }
655
684
  catch (error) {
@@ -669,71 +698,29 @@ store, deps) {
669
698
  stop: (words) => (deps.stopRun ?? stopRun)(words),
670
699
  may: () => inToolCall() && deps.signal?.aborted !== true,
671
700
  });
672
- /** A kept synced computer this claim does not take back, ended before anything of this claim reads the run's folder off
673
- * the disk, so no write of the old one lands after: one whose end is under way (the parking runner's timer, reading
674
- * it back) is waited for (keptEnded); one this claim reaches (`providerOf`, its own provider's) it ends, reading it
675
- * back first; one it doesn't is left ending, read back by no one, for the janitor's next pass to delete. */
676
- const settleSynced = async (record, providerOf) => {
677
- const settings = store.settings;
678
- if (record.folder !== "sync" || !settings)
679
- return;
680
- const row = await readKept(settings, launch.runId).catch(() => undefined);
681
- if (!row || row.ended || row.id !== record.id)
682
- return;
683
- const wait = () => keptEnded(settings, launch.runId, KEPT_PULL_MS + KEPT_DELETE_MS, deps.signal);
684
- if (row.ending)
685
- return wait();
686
- const disk = diskOf();
687
- const ended = await endKept(settings, launch.runId, row, async () => {
688
- const provider = providerOf ? await providerOf() : undefined;
689
- if (!provider)
690
- throw new Error("left to the janitor");
691
- if (disk)
692
- await pullKept(provider, row, disk).catch(() => undefined);
693
- await deleteKept(provider, row);
694
- }).catch(() => true);
695
- if (!ended)
696
- await wait();
697
- };
698
701
  const side = {
699
702
  keysOf: providerKeys(kinds, keyOf),
700
703
  answers: deps.answers ?? (async () => false),
701
704
  ...(deps.daemon ? { daemon: deps.daemon } : {}),
702
- // The computer an earlier claim kept at the run's park, when it is this setting's (its provider and kind) and its
703
- // time is not over: taken off its row first (computer-kept.ts takeKept), so its end and this claim never both have it,
704
- // then attached and connected again. Its mount, where it has one, stays the one it was made with: its credential is
705
- // this claim's from here (inheritMount). Never the agent's own computer, a paired one or --faux's.
705
+ // The computer an earlier claim kept at the run's park, when it is this setting's (its provider and kind, holding the
706
+ // run's folder the same way) and its time is not over: taken off its row first (computer-kept.ts takeKept), so its
707
+ // end and this claim never both have it, then attached and connected again. Its mount, where it has one, stays the
708
+ // one it was made with: its credential is this claim's from here (inheritMount). Never the agent's own computer, a
709
+ // paired one or --faux's. One that isn't this setting's is left to the launch's releaseOlderClaims and its keep's end.
706
710
  async reattach(entry, { kind, keys, configuration, folder, gpu, persistent, signal }) {
707
711
  const record = kept;
708
712
  kept = undefined;
709
713
  if (!record || !store.settings)
710
714
  return undefined;
711
- if (persistent || paired.some((row) => row.id === entry.id) || (deps.launch && (deps.launches?.(entry.id) ?? true)) || record.provider !== entry.id || record.kind !== kind) {
712
- await settleSynced(record);
715
+ if (persistent || paired.some((row) => row.id === entry.id) || (deps.launch && (deps.launches?.(entry.id) ?? true)) || record.provider !== entry.id || record.kind !== kind || record.folder !== folder)
713
716
  return undefined;
714
- }
715
717
  try {
716
718
  // Its time over, or its end took it first (ending or ended): a new one, said so.
717
719
  if (record.ending || record.ended || now() >= record.until || !(await takeKept(store.settings, launch.runId, record))) {
718
720
  lapsed = true;
719
- await settleSynced(record, () => vendorProvider(entry, keys, configuration));
720
721
  return undefined;
721
722
  }
722
723
  const provider = await vendorProvider(entry, keys, configuration);
723
- // One kept holding the run's folder another way than this claim holds it (its provider's keys changed since the
724
- // park: an Archil mount where the run now takes a synced folder) is not taken back: it goes now (a synced folder
725
- // read back first), its mount's token with it, so nothing holds the folder but the new one.
726
- if (record.folder !== folder) {
727
- const disk = record.folder === "sync" ? diskOf() : undefined;
728
- if (disk)
729
- await pullKept(provider, record, disk).catch(() => undefined);
730
- await deleteKept(provider, record).catch(() => undefined);
731
- if (record.folder === "archil") {
732
- deps.inheritMount?.();
733
- await deps.revokeMount?.().catch(() => undefined);
734
- }
735
- return undefined;
736
- }
737
724
  const taken = await keptLaunch(provider, record, signal);
738
725
  if (!taken)
739
726
  return undefined;
@@ -828,13 +815,6 @@ store, deps) {
828
815
  const resolved = await resolveComputer(setting, deps.mode, kinds, side);
829
816
  if ("refused" in resolved)
830
817
  throw unavailable(resolved.refused);
831
- // A kept computer this setting can't take back (no computer now, or another kind or provider: reattach sees only its
832
- // own) is settled before anything reads the run's folder off the disk (settleSynced: a synced one's alone).
833
- if (kept && (resolved.kind !== kept.kind || resolved.provider !== kept.provider)) {
834
- const record = kept;
835
- kept = undefined;
836
- await settleSynced(record);
837
- }
838
818
  if (resolved.kind === "none")
839
819
  return { computer: undefined, release: noop };
840
820
  const refusedKind = deps.refuseKind?.(resolved.kind);
@@ -850,7 +830,8 @@ store, deps) {
850
830
  let started;
851
831
  try {
852
832
  // The mount check carries the claim's epoch (a disk read-back under another epoch is refused) unless it names one.
853
- started = await resolved.start({ workspace: deps.workspace, check: { ...deps.check, epoch: deps.check.epoch ?? launch.epoch }, ...(holds ? { holds } : {}), ...(deps.signal ? { signal: deps.signal } : {}) });
833
+ const disk = diskOf();
834
+ started = await resolved.start({ workspace: deps.workspace, check: { ...deps.check, epoch: deps.check.epoch ?? launch.epoch }, ...(disk ? { store: disk } : {}), held: folderHeld, ...(deps.signal ? { signal: deps.signal } : {}) });
854
835
  }
855
836
  catch (error) {
856
837
  await revoke().catch(() => undefined);
@@ -928,10 +909,8 @@ store, deps) {
928
909
  }
929
910
  const ref = keeps.computer.ref;
930
911
  // A synced folder's delta lands on the disk before the computer is kept (an Archil mount's modes and links are
931
- // recorded); one that does not land lets it go as the run's end does, and the park throws the release's words. The
932
- // timer's read-back below writes after this claim is gone: the kept row's end, which a later claim waits for or
933
- // takes first, is its fence, not the claim's.
934
- const synced = resolved.folder === "sync" ? deps.workspace.syncStore?.() : undefined;
912
+ // recorded); one that does not land lets it go as the run's end does, and the park throws the release's words.
913
+ // What is written in it after this is the disk's only if a claim takes it back (pullFolder).
935
914
  if (started.sync && !(await started.sync()).ok) {
936
915
  await release();
937
916
  return false;
@@ -955,13 +934,10 @@ store, deps) {
955
934
  await keeps.computer.close();
956
935
  })();
957
936
  await released;
958
- // Its end at its time, by this process; the janitor's (computer-kept.ts sweepKept) whatever becomes of it. A synced
959
- // folder is read back whole first, through a connection of its own: what its programs wrote since the park. Its
960
- // row reads ending meanwhile, so a claim that comes then waits for it (keptEnded) before it reads the disk.
937
+ // Its end at its time, by this process; the janitor's (computer-kept.ts sweepKept) whatever becomes of it. Either
938
+ // deletes it, a synced folder with no read-back.
961
939
  const timer = setTimeout(() => {
962
940
  void endKept(settings, launch.runId, row, async () => {
963
- if (synced)
964
- await pullKept(keeps.provider, ref, synced).catch(() => undefined);
965
941
  await deleteKept(keeps.provider, ref);
966
942
  await revoke().catch(() => undefined);
967
943
  }).catch(() => undefined);
@@ -42,13 +42,6 @@ export type Kept = {
42
42
  /** How long one delete of a kept computer may take at the janitor's pass: past it the pass goes on, the row is left
43
43
  * ending, and the next pass deletes it again (a Docker command has no timeout of its own). */
44
44
  export declare const KEPT_DELETE_MS = 60000;
45
- /** How long an end's read-back of a kept synced folder may take: past it the read stops, the delete goes on, and a
46
- * claim that waits on the end (keptEnded) goes on too. */
47
- export declare const KEPT_PULL_MS = 120000;
48
- /** Waits while `runId`'s kept row reads ending (its end under way: a synced folder read back onto the disk, then the
49
- * delete), at most `ms` of real time or until `signal` aborts. A claim does so before its computer reads the run's
50
- * folder off the disk, so no write of the old one lands after. A row that can't be read is not waited on. */
51
- export declare function keptEnded(settings: Pick<KeptSettings, "get">, runId: string, ms: number, signal?: AbortSignal): Promise<void>;
52
45
  /** The settings the kept rows live in. */
53
46
  export type KeptSettings = Pick<Settings, "get" | "put" | "replaceIf" | "removeIf" | "remove" | "all">;
54
47
  /** A row's value as a Kept, or undefined for anything else. */
@@ -25,23 +25,6 @@ export const keptKeyOf = (runId) => `${KEPT_PREFIX}${runId}`;
25
25
  /** How long one delete of a kept computer may take at the janitor's pass: past it the pass goes on, the row is left
26
26
  * ending, and the next pass deletes it again (a Docker command has no timeout of its own). */
27
27
  export const KEPT_DELETE_MS = 60_000;
28
- /** How long an end's read-back of a kept synced folder may take: past it the read stops, the delete goes on, and a
29
- * claim that waits on the end (keptEnded) goes on too. */
30
- export const KEPT_PULL_MS = 120_000;
31
- /** How often a claim waiting on a kept computer's end reads its row again. */
32
- const KEPT_POLL_MS = 250;
33
- /** Waits while `runId`'s kept row reads ending (its end under way: a synced folder read back onto the disk, then the
34
- * delete), at most `ms` of real time or until `signal` aborts. A claim does so before its computer reads the run's
35
- * folder off the disk, so no write of the old one lands after. A row that can't be read is not waited on. */
36
- export async function keptEnded(settings, runId, ms, signal) {
37
- const until = Date.now() + ms;
38
- while (Date.now() < until && signal?.aborted !== true) {
39
- const row = await readKept(settings, runId).catch(() => undefined);
40
- if (!row?.ending)
41
- return;
42
- await new Promise((resolve) => setTimeout(resolve, KEPT_POLL_MS));
43
- }
44
- }
45
28
  /** A row's value as a Kept, or undefined for anything else. */
46
29
  export function keptOf(value) {
47
30
  if (!value || typeof value !== "object")