@parcha/agentrun-serve 0.1.0-beta.44 → 0.1.0-beta.46

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 (350) hide show
  1. package/CHANGELOG.md +148 -5
  2. package/README.md +385 -305
  3. package/dist/acp-package.d.ts +28 -0
  4. package/dist/acp-package.js +23 -0
  5. package/dist/adapter-facts.d.ts +8 -1
  6. package/dist/adapter-facts.js +9 -1
  7. package/dist/adapters.d.ts +5 -0
  8. package/dist/adapters.js +36 -3
  9. package/dist/agent-delete.d.ts +50 -0
  10. package/dist/agent-delete.js +125 -0
  11. package/dist/agents-store.d.ts +9 -3
  12. package/dist/agents-store.js +22 -8
  13. package/dist/agents.d.ts +5 -1
  14. package/dist/agents.js +8 -4
  15. package/dist/api-only.d.ts +8 -3
  16. package/dist/api-only.js +10 -4
  17. package/dist/archil-routes.d.ts +5 -1
  18. package/dist/archil-routes.js +57 -2
  19. package/dist/browser-wait-ended.d.ts +2 -0
  20. package/dist/browser-wait-ended.js +2 -0
  21. package/dist/calendar/ics-faux.d.ts +3 -1
  22. package/dist/calendar/ics-faux.js +12 -2
  23. package/dist/calendar/tools.js +5 -2
  24. package/dist/chatgpt-plan.js +3 -1
  25. package/dist/claude-login.d.ts +135 -0
  26. package/dist/claude-login.js +244 -0
  27. package/dist/cli.js +62 -19
  28. package/dist/composio-preset.js +69 -7
  29. package/dist/composio-triggers.d.ts +14 -0
  30. package/dist/composio-triggers.js +79 -15
  31. package/dist/computer-attach.d.ts +40 -5
  32. package/dist/computer-attach.js +130 -15
  33. package/dist/computer-keys.d.ts +3 -0
  34. package/dist/computer-keys.js +7 -1
  35. package/dist/computer-live.js +3 -2
  36. package/dist/computers.d.ts +21 -10
  37. package/dist/computers.js +39 -28
  38. package/dist/console/assets/index-C2MYaUBa.css +1 -0
  39. package/dist/console/assets/index-CZZeCReB.js +701 -0
  40. package/dist/console/index.html +2 -2
  41. package/dist/decisions.d.ts +1 -1
  42. package/dist/dial-relay.d.ts +29 -0
  43. package/dist/dial-relay.js +94 -0
  44. package/dist/email/tools.js +10 -5
  45. package/dist/env-proxy.d.ts +2 -0
  46. package/dist/env-proxy.js +35 -0
  47. package/dist/errors.d.ts +3 -1
  48. package/dist/errors.js +7 -4
  49. package/dist/faux-computers.d.ts +8 -2
  50. package/dist/faux-computers.js +83 -6
  51. package/dist/harness-archive.d.ts +67 -0
  52. package/dist/harness-archive.js +177 -0
  53. package/dist/harness-goose.d.ts +34 -0
  54. package/dist/harness-goose.js +87 -0
  55. package/dist/harness-install.d.ts +21 -0
  56. package/dist/harness-install.js +24 -11
  57. package/dist/harness-opencode/adapter.js +1 -1
  58. package/dist/harness-table.d.ts +9 -1
  59. package/dist/harness-table.js +20 -3
  60. package/dist/harness.d.ts +1 -2
  61. package/dist/harness.js +3 -4
  62. package/dist/host.js +2 -1
  63. package/dist/import.d.ts +10 -0
  64. package/dist/import.js +28 -8
  65. package/dist/key-check.js +3 -0
  66. package/dist/learn/audit.d.ts +6 -6
  67. package/dist/learn/audit.js +3 -7
  68. package/dist/learn/check.d.ts +23 -89
  69. package/dist/learn/check.js +57 -335
  70. package/dist/learn/commit.d.ts +63 -90
  71. package/dist/learn/commit.js +124 -316
  72. package/dist/learn/compile.d.ts +53 -50
  73. package/dist/learn/compile.js +89 -104
  74. package/dist/learn/corrections.d.ts +13 -0
  75. package/dist/learn/corrections.js +23 -0
  76. package/dist/learn/delete.d.ts +5 -5
  77. package/dist/learn/delete.js +8 -10
  78. package/dist/learn/folder.d.ts +35 -47
  79. package/dist/learn/folder.js +118 -134
  80. package/dist/learn/index.d.ts +3 -5
  81. package/dist/learn/index.js +6 -9
  82. package/dist/learn/learning.sh +45 -15
  83. package/dist/learn/promote.d.ts +23 -5
  84. package/dist/learn/promote.js +40 -2
  85. package/dist/learn/{skills.d.ts → workflow-draft.d.ts} +30 -38
  86. package/dist/learn/{skills.js → workflow-draft.js} +48 -58
  87. package/dist/learn/workflow-nodes.js +1 -1
  88. package/dist/learned-workflow.js +2 -2
  89. package/dist/learning-cost.d.ts +38 -24
  90. package/dist/learning-cost.js +41 -24
  91. package/dist/learning-routes.d.ts +91 -170
  92. package/dist/learning-routes.js +183 -421
  93. package/dist/learning-run.d.ts +19 -40
  94. package/dist/learning-run.js +23 -93
  95. package/dist/learning-setting.d.ts +21 -10
  96. package/dist/learning-setting.js +47 -11
  97. package/dist/learning-words.d.ts +28 -74
  98. package/dist/learning-words.js +64 -162
  99. package/dist/learning.d.ts +61 -392
  100. package/dist/learning.js +101 -651
  101. package/dist/live-reach.d.ts +25 -2
  102. package/dist/live-reach.js +46 -4
  103. package/dist/llms.txt +1 -1
  104. package/dist/local-models.d.ts +3 -11
  105. package/dist/local-models.js +5 -6
  106. package/dist/mcp-servers-store.d.ts +4 -4
  107. package/dist/model-form.js +6 -5
  108. package/dist/model.d.ts +4 -0
  109. package/dist/model.js +26 -9
  110. package/dist/native/binding.js +1 -1
  111. package/dist/native/connection.js +1 -1
  112. package/dist/native/discovery.js +1 -1
  113. package/dist/native/instructions.d.ts +3 -0
  114. package/dist/native/instructions.js +5 -3
  115. package/dist/native/remote-worker-bridge.js +9 -43
  116. package/dist/native/remote.d.ts +8 -15
  117. package/dist/native/remote.js +3 -3
  118. package/dist/native/schema.js +1 -1
  119. package/dist/native/types.d.ts +2 -2
  120. package/dist/openapi.js +273 -319
  121. package/dist/paid-calls.d.ts +8 -0
  122. package/dist/paid-calls.js +20 -0
  123. package/dist/particle-provider.d.ts +11 -0
  124. package/dist/particle-provider.js +135 -0
  125. package/dist/port-models.d.ts +12 -4
  126. package/dist/port-models.js +28 -11
  127. package/dist/print.d.ts +27 -0
  128. package/dist/print.js +21 -0
  129. package/dist/provider.d.ts +7 -0
  130. package/dist/provider.js +15 -1
  131. package/dist/reflect-range.js +2 -3
  132. package/dist/run-launch.d.ts +14 -28
  133. package/dist/run-launch.js +9 -12
  134. package/dist/run-learning-served.d.ts +15 -89
  135. package/dist/run-listing.d.ts +34 -0
  136. package/dist/run-listing.js +128 -0
  137. package/dist/run-model-key.js +1 -1
  138. package/dist/run-timeline-served.js +5 -3
  139. package/dist/run-trace.d.ts +97 -0
  140. package/dist/run-trace.js +253 -0
  141. package/dist/run-view.d.ts +15 -0
  142. package/dist/run-view.js +9 -0
  143. package/dist/runnable.js +2 -1
  144. package/dist/runner/adapter-loop.d.ts +8 -6
  145. package/dist/runner/adapter-loop.js +16 -12
  146. package/dist/runner/adapter-run-spec.d.ts +16 -4
  147. package/dist/runner/adapter-run-spec.js +64 -58
  148. package/dist/runner/adapters/index.js +22 -0
  149. package/dist/runner/adapters/pi.d.ts +4 -12
  150. package/dist/runner/adapters/pi.js +2 -2
  151. package/dist/runner/audit.d.ts +1 -1
  152. package/dist/runner/audit.js +30 -13
  153. package/dist/runner/beside.d.ts +6 -2
  154. package/dist/runner/beside.js +38 -9
  155. package/dist/runner/claim-secrets.d.ts +18 -2
  156. package/dist/runner/claim-secrets.js +42 -18
  157. package/dist/runner/cli-run-spec.js +55 -51
  158. package/dist/runner/conformance/harness.d.ts +6 -0
  159. package/dist/runner/conformance/harness.js +35 -13
  160. package/dist/runner/conformance/subject.d.ts +6 -0
  161. package/dist/runner/dispatch.d.ts +2 -2
  162. package/dist/runner/end-of-run.d.ts +6 -14
  163. package/dist/runner/end-of-run.js +8 -33
  164. package/dist/runner/feedback-round.d.ts +2 -2
  165. package/dist/runner/feedback-round.js +7 -7
  166. package/dist/runner/github-app.js +3 -1
  167. package/dist/runner/harness-loops.d.ts +0 -8
  168. package/dist/runner/harness-loops.js +11 -59
  169. package/dist/runner/held.d.ts +170 -0
  170. package/dist/runner/held.js +57 -0
  171. package/dist/runner/journal-kinds.d.ts +2 -3
  172. package/dist/runner/journal-kinds.js +2 -3
  173. package/dist/runner/learned-first.d.ts +40 -0
  174. package/dist/runner/learned-first.js +32 -0
  175. package/dist/runner/learning-end.d.ts +77 -69
  176. package/dist/runner/learning-end.js +250 -303
  177. package/dist/runner/learning-seed.d.ts +15 -33
  178. package/dist/runner/learning-seed.js +24 -45
  179. package/dist/runner/loop-contract.d.ts +2 -3
  180. package/dist/runner/main.d.ts +17 -9
  181. package/dist/runner/main.js +82 -20
  182. package/dist/runner/mcp-run.d.ts +11 -0
  183. package/dist/runner/mcp-run.js +67 -0
  184. package/dist/runner/memory-claim.d.ts +10 -5
  185. package/dist/runner/memory-claim.js +12 -6
  186. package/dist/runner/model-route.d.ts +7 -4
  187. package/dist/runner/model-route.js +22 -10
  188. package/dist/runner/native-loop.d.ts +0 -7
  189. package/dist/runner/native-loop.js +9 -101
  190. package/dist/runner/promotion.d.ts +12 -8
  191. package/dist/runner/promotion.js +37 -28
  192. package/dist/runner/reflect-hook.d.ts +64 -95
  193. package/dist/runner/reflect-hook.js +112 -225
  194. package/dist/runner/run-channel.d.ts +43 -0
  195. package/dist/runner/run-channel.js +467 -0
  196. package/dist/runner/run-child-host.d.ts +169 -0
  197. package/dist/runner/run-child-host.js +1230 -0
  198. package/dist/runner/run-child.d.ts +1 -0
  199. package/dist/runner/run-child.js +254 -0
  200. package/dist/runner/run-errors.d.ts +2 -0
  201. package/dist/runner/run-errors.js +20 -0
  202. package/dist/runner/runner.js +1 -5
  203. package/dist/runner/sdk-ask.d.ts +78 -0
  204. package/dist/runner/sdk-ask.js +158 -0
  205. package/dist/runner/sdk-loop.d.ts +2 -4
  206. package/dist/runner/sdk-loop.js +29 -49
  207. package/dist/runner/store-secrets.d.ts +5 -3
  208. package/dist/runner/store-secrets.js +5 -1
  209. package/dist/runner/workflow-first.d.ts +5 -0
  210. package/dist/runner/workflow-first.js +4 -0
  211. package/dist/runner/workflow-spec.js +7 -2
  212. package/dist/runs-over-store.d.ts +16 -28
  213. package/dist/runs-over-store.js +31 -38
  214. package/dist/sdk/runs.d.ts +6 -11
  215. package/dist/sdk/runs.js +20 -41
  216. package/dist/sdk/schema.js +3 -4
  217. package/dist/seal-key.d.ts +5 -0
  218. package/dist/seal-key.js +7 -0
  219. package/dist/secrets.d.ts +3 -0
  220. package/dist/secrets.js +16 -3
  221. package/dist/server.d.ts +55 -33
  222. package/dist/server.js +689 -322
  223. package/dist/sign-ins-store.d.ts +8 -0
  224. package/dist/sign-ins-store.js +36 -1
  225. package/dist/skills.js +1 -1
  226. package/dist/store/index.d.ts +2 -2
  227. package/dist/store/index.js +1 -1
  228. package/dist/store/journal/storage.js +3 -0
  229. package/dist/store/postgres/migrations/0017_run_listing.sql +83 -0
  230. package/dist/store/postgres/migrations/0018_trigger_template.sql +6 -0
  231. package/dist/store/postgres/migrations/0019_runner_relays.sql +28 -0
  232. package/dist/store/schema.d.ts +53 -4
  233. package/dist/store/schema.js +137 -6
  234. package/dist/store/sqlite/connection.d.ts +2 -0
  235. package/dist/store/sqlite/connection.js +3 -1
  236. package/dist/store/sqlite/run-patch.d.ts +0 -17
  237. package/dist/store/sqlite/run-patch.js +4 -33
  238. package/dist/store/sqlite/store.js +246 -63
  239. package/dist/store/sqlite/worker.js +25 -0
  240. package/dist/store/store.d.ts +193 -36
  241. package/dist/store/store.js +25 -3
  242. package/dist/store-reads/learning.d.ts +102 -204
  243. package/dist/store-reads/learning.js +159 -321
  244. package/dist/store-reads/loop.d.ts +0 -1
  245. package/dist/store-reads/loop.js +1 -1
  246. package/dist/store-view.d.ts +29 -1
  247. package/dist/store-view.js +97 -31
  248. package/dist/template-eval.d.ts +3 -6
  249. package/dist/template-eval.js +22 -36
  250. package/dist/templates.d.ts +8 -4
  251. package/dist/templates.js +44 -6
  252. package/dist/timeline/index.d.ts +1 -1
  253. package/dist/timeline/index.js +1 -1
  254. package/dist/timeline/timeline.d.ts +5 -1
  255. package/dist/timeline/timeline.js +16 -0
  256. package/dist/tool-gate.d.ts +0 -7
  257. package/dist/tool-gate.js +1 -15
  258. package/dist/tool-keys-store.d.ts +1 -1
  259. package/dist/tool-keys.d.ts +6 -4
  260. package/dist/tool-keys.js +12 -6
  261. package/dist/tools.d.ts +2 -2
  262. package/dist/tools.js +11 -4
  263. package/dist/triggers.d.ts +65 -6
  264. package/dist/triggers.js +125 -19
  265. package/dist/validate.js +1 -1
  266. package/dist/webhooks.d.ts +7 -2
  267. package/dist/webhooks.js +12 -5
  268. package/dist/workspace/agent-computer.d.ts +2 -0
  269. package/dist/workspace/agent-computer.js +2 -0
  270. package/dist/workspace/archil-claim.d.ts +7 -0
  271. package/dist/workspace/archil-claim.js +29 -0
  272. package/dist/workspace/archil.d.ts +9 -1
  273. package/dist/workspace/archil.js +165 -3
  274. package/dist/workspace/attach.d.ts +3 -1
  275. package/dist/workspace/attach.js +2 -0
  276. package/dist/workspace/attached-computers.d.ts +16 -5
  277. package/dist/workspace/attached-computers.js +25 -9
  278. package/dist/workspace/computer-deps.js +1 -1
  279. package/dist/workspace/computer-for-claim.d.ts +7 -3
  280. package/dist/workspace/computer-for-claim.js +119 -22
  281. package/dist/workspace/computer-hold.js +2 -1
  282. package/dist/workspace/computer-kept.d.ts +11 -1
  283. package/dist/workspace/computer-kept.js +24 -3
  284. package/dist/workspace/resolve-computer.d.ts +33 -19
  285. package/dist/workspace/resolve-computer.js +172 -64
  286. package/dist/workspace/revision-skills.d.ts +1 -2
  287. package/dist/workspace/revision-skills.js +3 -4
  288. package/dist/workspace/run-workspace.d.ts +1 -1
  289. package/dist/workspace/run-workspace.js +5 -0
  290. package/dist/workspace/synced-folder.d.ts +85 -0
  291. package/dist/workspace/synced-folder.js +230 -0
  292. package/dist/workspace/workspace.d.ts +4 -0
  293. package/launcher/agentrun-serve +1 -1
  294. package/package.json +10 -10
  295. package/templates/README.md +8 -8
  296. package/templates/inbound-lead/agent.md +5 -4
  297. package/templates/inbound-lead/evals/learned-correction/case.yaml +3 -3
  298. package/templates/inbound-lead/evals/learned-correction/fixtures/corrections.md +1 -0
  299. package/templates/inbound-lead/evals/learned-correction/graders/applies-correction.md +22 -0
  300. package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +1 -1
  301. package/templates/inbound-lead/evals/learned-correction/prompt.md +1 -1
  302. package/templates/inbound-lead/lead.schema.json +6 -5
  303. package/templates/inbound-lead/rules/RUBRIC.md +4 -4
  304. package/templates/inbound-lead/skills/lead/SKILL.md +4 -4
  305. package/templates/kyb/agent.md +2 -1
  306. package/templates/market-monitor/evals/learned-preference/case.yaml +4 -4
  307. package/templates/market-monitor/evals/learned-preference/fixtures/corrections.md +1 -0
  308. package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +3 -3
  309. package/templates/market-monitor/evals/learned-preference/prompt.md +1 -1
  310. package/templates/release-notes/evals/learned-style/case.yaml +4 -4
  311. package/templates/release-notes/evals/learned-style/fixtures/corrections.md +1 -0
  312. package/templates/release-notes/evals/learned-style/graders/same-changes.md +2 -2
  313. package/templates/release-notes/evals/learned-style/prompt.md +1 -1
  314. package/dist/console/assets/index-BUktRvS-.css +0 -1
  315. package/dist/console/assets/index-nB9kTfIN.js +0 -711
  316. package/dist/learn/grade.d.ts +0 -138
  317. package/dist/learn/grade.js +0 -682
  318. package/dist/learn/notes.d.ts +0 -81
  319. package/dist/learn/notes.js +0 -178
  320. package/dist/learn/reflect.d.ts +0 -77
  321. package/dist/learn/reflect.js +0 -228
  322. package/dist/learn/relevance.d.ts +0 -24
  323. package/dist/learn/relevance.js +0 -91
  324. package/dist/learn/seed-check.d.ts +0 -74
  325. package/dist/learn/seed-check.js +0 -103
  326. package/dist/learning-batch.d.ts +0 -291
  327. package/dist/learning-batch.js +0 -600
  328. package/dist/learning-evals.d.ts +0 -35
  329. package/dist/learning-evals.js +0 -99
  330. package/dist/native/context.d.ts +0 -6
  331. package/dist/native/context.js +0 -22
  332. package/dist/propose.d.ts +0 -52
  333. package/dist/propose.js +0 -224
  334. package/dist/runner/learning-ask.d.ts +0 -47
  335. package/dist/runner/learning-ask.js +0 -128
  336. package/dist/runner/learning-dispatch.d.ts +0 -45
  337. package/dist/runner/learning-dispatch.js +0 -99
  338. package/dist/runner/learning-factory.d.ts +0 -16
  339. package/dist/runner/learning-factory.js +0 -50
  340. package/dist/runner/learning-loop.d.ts +0 -273
  341. package/dist/runner/learning-loop.js +0 -521
  342. package/dist/usage.d.ts +0 -11
  343. package/dist/usage.js +0 -11
  344. package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +0 -1
  345. package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +0 -14
  346. package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +0 -21
  347. package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +0 -1
  348. package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +0 -8
  349. package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +0 -1
  350. package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +0 -13
@@ -40,16 +40,17 @@ import { randomUUID } from "node:crypto";
40
40
  import { isBrowserProvider, ownerFilter, releaseOlder, RUN_LABEL, runLabels } from "@parcha/agentrun-computer";
41
41
  import { startRecording } from "../computer-record.js";
42
42
  import { computerOfPlace } from "../computer-setting.js";
43
- import { KEY_TABLE, providerOptions } from "../computer-keys.js";
43
+ import { KEY_TABLE, providerOptions, settingOptions } from "../computer-keys.js";
44
44
  import { LOST_RECREATES, lostEnd, lostRecreatedWords } from "../computer-lost.js";
45
45
  import { inToolCall, stopRun } from "../paid-calls.js";
46
46
  import { getSealedKey } from "../server-keys.js";
47
47
  import { agentComputerOf, forgetAgentComputer, holdAgentComputer, keepAgentComputer, liveHolderOf, reconcileAgentComputer, serverIdOf } from "./agent-computer.js";
48
48
  import { pairedProvider, withPaired } from "./attached-computers.js";
49
49
  import { computerHold, heldHands } from "./computer-hold.js";
50
- import { deleteKept, endKept, KEEP_MS, readKept, takeKept, writeKept } from "./computer-kept.js";
50
+ import { deleteKept, endKept, KEEP_MS, KEPT_DELETE_MS, KEPT_PULL_MS, keptEnded, readKept, takeKept, writeKept } from "./computer-kept.js";
51
51
  import { storeLedger } from "./computer-ledger.js";
52
- import { providerKeys, resolveComputer } from "./resolve-computer.js";
52
+ import { providerKeys, registryHere, resolveComputer } from "./resolve-computer.js";
53
+ import { claimHolds, fencedStore, pullFolder, pushFolder, storedFolder } from "./synced-folder.js";
53
54
  /** A computer that cannot be had, with the code the run fails with and the server's words. */
54
55
  const unavailable = (words) => Object.assign(new Error(words), { code: "computer_unavailable" });
55
56
  /** The claim was lost (its live view's registration was fenced): the run's process holds it no more. */
@@ -372,6 +373,19 @@ function lostAware(first, renewal) {
372
373
  },
373
374
  };
374
375
  }
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
+ }
375
389
  /** The computer an earlier claim of the run kept at its park (`kept`), attached again through `provider` and connected,
376
390
  * or undefined when its provider no longer has it or it does not connect (one that does not is deleted). */
377
391
  async function keptLaunch(provider, kept, signal) {
@@ -527,12 +541,24 @@ async function ownedStart(provider, claim, spec, context, hold, signal) {
527
541
  /** The run's computer for this claim, started and registered; `{ computer: undefined }` for none. Throws with code
528
542
  * computer_unavailable and the server's words when the agent's computer cannot be had here. */
529
543
  export async function computerForClaim(launch,
530
- // `settings` and `runs`: the agent's own computer's record and its holder's run row, for a persistent setting alone.
544
+ // `settings` and `runs`: the agent's own computer's record and its holder's run row, for a persistent setting; and the
545
+ // run's own row, whose epoch and runner fence every write of the run's folder to its disk.
531
546
  store, deps) {
547
+ // The run's disk as this claim writes the folder on it: each write refused once a later claim has taken the run (Q1).
548
+ const runs = store.runs;
549
+ const holds = runs ? claimHolds((runId) => runs.get(runId), launch) : undefined;
550
+ const diskOf = () => {
551
+ const disk = deps.workspace.syncStore?.();
552
+ return disk && holds ? fencedStore(disk, holds) : disk;
553
+ };
532
554
  const table = deps.keyTable ?? KEY_TABLE;
533
555
  // The paired computers, each one more provider of the registry (attached-computers.ts): a setting names one by its id.
534
556
  const paired = deps.attached ? await deps.attached.rows() : [];
535
- const kinds = withPaired(deps.kinds, paired);
557
+ const keyOf = deps.keyOf ?? (async (name) => (deps.sealKey ? await getSealedKey(store, deps.sealKey, name) : undefined));
558
+ // Each provider as this server has it (registryHere: the mounts its keys turn on, whether the operator names its
559
+ // image, and no Archil mount where its settings make its machines dial this server), as a run's start reads it, so the
560
+ // claim holds the folder the start said it would.
561
+ const kinds = await registryHere(withPaired(deps.kinds, paired), keyOf, (provider) => settingOptions(provider, deps.settings ?? {}, table));
536
562
  /** The computer this claim started (one per claim): its ref id tags its live view, and its watch feeds it. */
537
563
  let made;
538
564
  /** The provider entry it was started from: a phone's platform where the computer did not say it. */
@@ -588,16 +614,24 @@ store, deps) {
588
614
  /** How a sandbox of `provider` this claim holds is started again once its provider lost it (lostAware): made from
589
615
  * `specNow` (the lost one's spec, or for one taken back from the park this claim's own, read when it is needed), under
590
616
  * this claim's labels and its own request (the claim's, then which new one), so a retry of it under this epoch finds
591
- * the one it made. Where it mounts the run's folder (`mounts`), the lost one's mount credential is removed (Mode 2) and
592
- * a new mount asked for, which is read back before the new one serves a call. */
593
- const renewalOf = (provider, entry, specNow, mounts) => ({
617
+ * 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
+ * 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). */
620
+ const renewalOf = (provider, entry, specNow, folder) => ({
594
621
  provider,
595
622
  max: deps.recreates ?? LOST_RECREATES,
596
623
  async remake(times) {
597
624
  deps.onStarting?.({ provider: entry.label, kind: "sandbox" });
598
625
  const spec = await specNow();
599
626
  let mount;
600
- if (mounts) {
627
+ // The store is read whole before anything is made, so a folder over a cap rents nothing.
628
+ const store = folder === "sync" ? diskOf() : undefined;
629
+ if (folder === "sync" && !store)
630
+ throw new Error("this runner keeps no synced folder for the run");
631
+ const stored = store ? await storedFolder(store) : undefined;
632
+ if (folder === "sync")
633
+ mount = { kind: "sync" };
634
+ else if (folder !== undefined) {
601
635
  await deps.revokeMount?.();
602
636
  mount = await deps.workspace.mountSpec();
603
637
  }
@@ -614,7 +648,9 @@ store, deps) {
614
648
  const again = providerComputer(provider, ref, connected.value);
615
649
  if (mount) {
616
650
  try {
617
- await deps.workspace.attach({ id: ref.id, client: again.client, readBack: () => again.readBack() }, { ...deps.check, epoch: deps.check.epoch ?? launch.epoch });
651
+ if (store && stored)
652
+ await pushFolder(store, again.client, stored, deps.signal);
653
+ await deps.workspace.attach({ id: ref.id, client: again.client, readBack: () => again.readBack() }, { ...deps.check, epoch: deps.check.epoch ?? launch.epoch, ...(store ? { sync: true } : {}) });
618
654
  }
619
655
  catch (error) {
620
656
  await again.release().catch(() => undefined);
@@ -633,37 +669,78 @@ store, deps) {
633
669
  stop: (words) => (deps.stopRun ?? stopRun)(words),
634
670
  may: () => inToolCall() && deps.signal?.aborted !== true,
635
671
  });
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
+ };
636
698
  const side = {
637
- keysOf: providerKeys(kinds, deps.keyOf ?? (async (name) => (deps.sealKey ? await getSealedKey(store, deps.sealKey, name) : undefined))),
699
+ keysOf: providerKeys(kinds, keyOf),
638
700
  answers: deps.answers ?? (async () => false),
639
701
  ...(deps.daemon ? { daemon: deps.daemon } : {}),
640
702
  // The computer an earlier claim kept at the run's park, when it is this setting's (its provider and kind) and its
641
703
  // time is not over: taken off its row first (computer-kept.ts takeKept), so its end and this claim never both have it,
642
704
  // then attached and connected again. Its mount, where it has one, stays the one it was made with: its credential is
643
705
  // this claim's from here (inheritMount). Never the agent's own computer, a paired one or --faux's.
644
- async reattach(entry, { kind, keys, configuration, gpu, persistent, signal }) {
706
+ async reattach(entry, { kind, keys, configuration, folder, gpu, persistent, signal }) {
645
707
  const record = kept;
646
708
  kept = undefined;
647
- if (!record || !store.settings || persistent || paired.some((row) => row.id === entry.id))
648
- return undefined;
649
- if (deps.launch && (deps.launches?.(entry.id) ?? true))
709
+ if (!record || !store.settings)
650
710
  return undefined;
651
- if (record.provider !== entry.id || record.kind !== kind)
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);
652
713
  return undefined;
714
+ }
653
715
  try {
654
716
  // Its time over, or its end took it first (ending or ended): a new one, said so.
655
717
  if (record.ending || record.ended || now() >= record.until || !(await takeKept(store.settings, launch.runId, record))) {
656
718
  lapsed = true;
719
+ await settleSynced(record, () => vendorProvider(entry, keys, configuration));
657
720
  return undefined;
658
721
  }
659
722
  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
+ }
660
737
  const taken = await keptLaunch(provider, record, signal);
661
738
  if (!taken)
662
739
  return undefined;
663
740
  deps.inheritMount?.();
664
741
  // A sandbox taken back is started again when it is lost as one this claim made (lostAware): the new one is this
665
742
  // claim's, made from this claim's spec, its folder mounted.
666
- const again = record.kind === "sandbox" ? lostAware(taken, renewalOf(provider, entry, () => specOf(entry, provider, kind, configuration, deps.signal, gpu), true)) : taken;
743
+ const again = record.kind === "sandbox" ? lostAware(taken, renewalOf(provider, entry, () => specOf(entry, provider, kind, configuration, deps.signal, gpu), folder)) : taken;
667
744
  keepable = { provider, entry: entry.id, kind: record.kind, computer: again, epoch: record.epoch };
668
745
  ownKind = record.kind;
669
746
  const screen = record.kind === "sandbox" ? undefined : record.kind;
@@ -686,7 +763,7 @@ store, deps) {
686
763
  // which stands in for the vendors', is not its.
687
764
  const pairedRow = paired.find((row) => row.id === entry.id);
688
765
  if (ownLaunch && !pairedRow) {
689
- const own = await ownLaunch(entry, { kind, keys, configuration, ...(mount ? { mount } : {}), ...(gpu ? { gpu } : {}), ...(signal ? { signal } : {}) });
766
+ const own = await ownLaunch(entry, { kind, keys, configuration, run: launch.runId, ...(mount ? { mount } : {}), ...(gpu ? { gpu } : {}), ...(signal ? { signal } : {}) });
690
767
  const ownWatch = own.watch;
691
768
  made = { id: own.id, ...(ownWatch ? { watch: ownWatch } : {}) };
692
769
  madeBy = entry;
@@ -731,7 +808,7 @@ store, deps) {
731
808
  // A sandbox the claim made is started again when its provider loses it mid-run (lostAware): never a paired
732
809
  // computer, nor a desktop or a phone (a person may hold or watch it), nor the agent's own (persistent, above).
733
810
  const { releasedOlder } = fresh;
734
- const held = kind === "sandbox" && !pairedRow ? lostAware(fresh, renewalOf(provider, entry, async () => spec, mount !== undefined)) : fresh;
811
+ const held = kind === "sandbox" && !pairedRow ? lostAware(fresh, renewalOf(provider, entry, async () => spec, mount?.kind)) : fresh;
735
812
  launched = held;
736
813
  if (!pairedRow)
737
814
  ownKind = kind;
@@ -751,6 +828,13 @@ store, deps) {
751
828
  const resolved = await resolveComputer(setting, deps.mode, kinds, side);
752
829
  if ("refused" in resolved)
753
830
  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
+ }
754
838
  if (resolved.kind === "none")
755
839
  return { computer: undefined, release: noop };
756
840
  const refusedKind = deps.refuseKind?.(resolved.kind);
@@ -766,7 +850,7 @@ store, deps) {
766
850
  let started;
767
851
  try {
768
852
  // The mount check carries the claim's epoch (a disk read-back under another epoch is refused) unless it names one.
769
- started = await resolved.start({ workspace: deps.workspace, check: { ...deps.check, epoch: deps.check.epoch ?? launch.epoch }, ...(deps.signal ? { signal: deps.signal } : {}) });
853
+ started = await resolved.start({ workspace: deps.workspace, check: { ...deps.check, epoch: deps.check.epoch ?? launch.epoch }, ...(holds ? { holds } : {}), ...(deps.signal ? { signal: deps.signal } : {}) });
770
854
  }
771
855
  catch (error) {
772
856
  await revoke().catch(() => undefined);
@@ -843,9 +927,18 @@ store, deps) {
843
927
  return false;
844
928
  }
845
929
  const ref = keeps.computer.ref;
930
+ // 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;
935
+ if (started.sync && !(await started.sync()).ok) {
936
+ await release();
937
+ return false;
938
+ }
846
939
  let row;
847
940
  try {
848
- row = await writeKept(settings, launch.runId, { provider: keeps.entry, kind: keeps.kind, id: ref.id, name: ref.name, epoch: keeps.epoch, until: now() + KEEP_MS });
941
+ row = await writeKept(settings, launch.runId, { provider: keeps.entry, kind: keeps.kind, id: ref.id, name: ref.name, epoch: keeps.epoch, until: now() + KEEP_MS, ...(resolved.folder ? { folder: resolved.folder } : {}) });
849
942
  }
850
943
  catch {
851
944
  // No row, nothing to find it by: it goes as at the run's end.
@@ -862,9 +955,13 @@ store, deps) {
862
955
  await keeps.computer.close();
863
956
  })();
864
957
  await released;
865
- // Its end at its time, by this process; the janitor's (computer-kept.ts sweepKept) whatever becomes of it.
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.
866
961
  const timer = setTimeout(() => {
867
962
  void endKept(settings, launch.runId, row, async () => {
963
+ if (synced)
964
+ await pullKept(keeps.provider, ref, synced).catch(() => undefined);
868
965
  await deleteKept(keeps.provider, ref);
869
966
  await revoke().catch(() => undefined);
870
967
  }).catch(() => undefined);
@@ -223,7 +223,8 @@ function heldPort(port, hold) {
223
223
  const what = actOf(port, op, args);
224
224
  if (what === undefined && !LOOKS.has(op))
225
225
  return port.call(op, args, signal);
226
- const parked = hold.state() !== "agent";
226
+ // Awaited: in a run's own process the hold is its runner's, and its state an answer over the channel (run-child.ts).
227
+ const parked = (await hold.state()) !== "agent";
227
228
  const leave = await hold.enter(signal);
228
229
  if (parked && what !== undefined) {
229
230
  leave();
@@ -1,4 +1,4 @@
1
- import type { ComputerProvider } from "@parcha/agentrun-computer";
1
+ import type { ComputerProvider, MountKind } from "@parcha/agentrun-computer";
2
2
  import { type Settings, type Store } from "../store/index.js";
3
3
  /** How long a park keeps the run's computer for its resume: 10 minutes. */
4
4
  export declare const KEEP_MS: number;
@@ -33,12 +33,22 @@ export type Kept = {
33
33
  readonly name: string;
34
34
  readonly epoch: number;
35
35
  readonly until: number;
36
+ /** The kind of the run's folder it holds (a bind, an Archil mount or a synced folder); none: it holds none. A claim
37
+ * takes it back only to hold the folder the same way (computer-for-claim.ts reattach). */
38
+ readonly folder?: MountKind;
36
39
  readonly ending?: true;
37
40
  readonly ended?: true;
38
41
  };
39
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
40
43
  * ending, and the next pass deletes it again (a Docker command has no timeout of its own). */
41
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>;
42
52
  /** The settings the kept rows live in. */
43
53
  export type KeptSettings = Pick<Settings, "get" | "put" | "replaceIf" | "removeIf" | "remove" | "all">;
44
54
  /** A row's value as a Kept, or undefined for anything else. */
@@ -25,22 +25,43 @@ 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
+ }
28
45
  /** A row's value as a Kept, or undefined for anything else. */
29
46
  export function keptOf(value) {
30
47
  if (!value || typeof value !== "object")
31
48
  return undefined;
32
- const { provider, kind, id, name, epoch, until, ending, ended } = value;
49
+ const { provider, kind, id, name, epoch, until, folder, ending, ended } = value;
33
50
  if (typeof provider !== "string" || (kind !== "desktop" && kind !== "phone" && kind !== "sandbox") || typeof id !== "string" || typeof name !== "string")
34
51
  return undefined;
35
52
  if (typeof epoch !== "number" || !Number.isSafeInteger(epoch) || typeof until !== "number" || !Number.isFinite(until))
36
53
  return undefined;
54
+ if (folder !== undefined && folder !== "bind" && folder !== "archil" && folder !== "sync")
55
+ return undefined;
56
+ const held = folder === undefined ? {} : { folder: folder };
37
57
  if (ended === true)
38
- return { provider, kind, id, name, epoch, until, ended: true };
39
- return { provider, kind, id, name, epoch, until, ...(ending === true ? { ending: true } : {}) };
58
+ return { provider, kind, id, name, epoch, until, ...held, ended: true };
59
+ return { provider, kind, id, name, epoch, until, ...held, ...(ending === true ? { ending: true } : {}) };
40
60
  }
41
61
  /** The row as written: its fields in one order, so a compare-and-set reads the same text. */
42
62
  const rowOf = (kept, state) => ({
43
63
  provider: kept.provider, kind: kept.kind, id: kept.id, name: kept.name, epoch: kept.epoch, until: kept.until,
64
+ ...(kept.folder === undefined ? {} : { folder: kept.folder }),
44
65
  ...(state === "ending" ? { ending: true } : state === "ended" ? { ended: true } : {}),
45
66
  });
46
67
  /** `runId`'s kept computer, as its row reads now; undefined when there is none. */
@@ -1,5 +1,5 @@
1
1
  import { type ShellPlace } from "@parcha/agentrun-kernel/kernel";
2
- import { type BrowserFeatures, type BrowserFile, type BrowserSpec, type ComputerClient, type ComputerSettingKind, type GpuSpec, type Group, type HelloResult, type KindCapabilities, type MountReadBack, type MountSpec, type ProviderEntry, type Result } from "@parcha/agentrun-computer";
2
+ import { type BrowserFeatures, type BrowserFile, type BrowserSpec, type ComputerClient, type ComputerSettingKind, type GpuSpec, type Group, type HelloResult, type KindCapabilities, type MountKind, type MountReadBack, type MountSpec, type ProviderEntry, type Result } from "@parcha/agentrun-computer";
3
3
  import { type DockerDaemon } from "../docker-daemon.js";
4
4
  import type { Recording, RecordWatch } from "../computer-record.js";
5
5
  import type { MountCheck } from "./attach.js";
@@ -111,11 +111,14 @@ export type ClaimSide = {
111
111
  }): Promise<LaunchedComputer>;
112
112
  /** The computer an earlier claim of the run kept at its park (computer-kept.ts), attached again in place of a launch,
113
113
  * or undefined to launch one. Asked first: a computer attached again mounts what it mounted, so no mount is made for
114
- * it, and its mount reads back under `epoch`, the claim epoch its labels carry. Never throws. Absent: always a launch. */
114
+ * it, and its mount reads back under `epoch`, the claim epoch its labels carry. `folder`: the kind of the run's folder
115
+ * in it, where it holds one: only a computer kept holding the folder so is taken back (computer-kept.ts Kept.folder),
116
+ * and a new one in place of it, once its provider loses it, holds the same. Never throws. Absent: always a launch. */
115
117
  reattach?(entry: ProviderEntry, spec: {
116
118
  readonly kind: ComputerSettingKind;
117
119
  readonly keys: Readonly<Record<string, string>>;
118
120
  readonly configuration: KindCapabilities;
121
+ readonly folder?: MountKind;
119
122
  readonly gpu?: GpuSpec;
120
123
  readonly persistent?: true;
121
124
  readonly signal?: AbortSignal;
@@ -132,6 +135,9 @@ export declare const providerKeys: (registry: Pick<KindRegistry, "PROVIDERS">, k
132
135
  /** What a provider is on this server beside its descriptor: the mounts the operator's keys turn on, and whether the
133
136
  * operator names its image here. */
134
137
  type HereFields = {
138
+ readonly label?: string;
139
+ /** Whether its machines dial this server: always, or as its connect option says (the computer package's connectOf). */
140
+ readonly connect?: "dial" | "either";
135
141
  readonly mounts: readonly string[];
136
142
  readonly unmounted?: Readonly<Partial<Record<string, string>>>;
137
143
  readonly mountsWith?: Readonly<Partial<Record<string, string>>>;
@@ -145,17 +151,23 @@ type HereFields = {
145
151
  * mount where DAYTONA_ARCHIL_EGRESS names a self-hosted target's Archil egress relay), and imageNamed where its
146
152
  * descriptor's imageEnv names its image here (Daytona's AGENTRUN_DAYTONA_SNAPSHOT). Any other entry as it is. Every
147
153
  * reader of an entry's mounts (Settings → Computers, the claim, a run's start, its shell) reads this, so the
148
- * provider made with those keys and the server agree on what it mounts. */
149
- export declare function entryHere<Entry extends HereFields>(entry: Entry, set: (name: string) => boolean): Entry;
154
+ * provider made with those keys and the server agree on what it mounts. `options`: the create() options its server
155
+ * settings give (computer-keys.ts settingOptions): where its machines dial this server by them (dialsBy), it takes no
156
+ * Archil mount (withoutArchil), so its folder is synced where Archil's would be. */
157
+ export declare function entryHere<Entry extends HereFields>(entry: Entry, set: (name: string) => boolean, options?: Readonly<Record<string, unknown>>): Entry;
150
158
  /** `registry` with each provider as this server has it (entryHere), reading only the names an entry's mountsWith or
151
- * imageEnv names, by `valueOf` (key-meta.ts keyReader: the environment's value, else the saved key). A value of
152
- * whitespace alone is none. */
159
+ * imageEnv names, by `valueOf` (key-meta.ts keyReader: the environment's value, else the saved key), and the options
160
+ * its server settings give, by `optionsOf` (settingOptions; absent: none). A value of whitespace alone is none. */
153
161
  export declare function registryHere<Registry extends {
154
162
  readonly PROVIDERS: readonly ProviderEntry[];
155
- }>(registry: Registry, valueOf: (name: string) => Promise<string | undefined>): Promise<Registry>;
156
- /** Whether a computer of `entry` that mounts the owner's Archil disk has Archil's image in the owner's vendor account:
157
- * its provider prepares it (prepareImage), or the operator names it here (imageNamed, entryHere). */
158
- export declare const archilImageHere: (entry: HereFields) => boolean;
163
+ }>(registry: Registry, valueOf: (name: string) => Promise<string | undefined>, optionsOf?: (provider: string) => Readonly<Record<string, unknown>>): Promise<Registry>;
164
+ /** The kind of the run's folder a sandbox or a desktop of `entry` with files and exec holds in `mode`, or undefined for
165
+ * none. Mode 1: a bind of this machine. Mode 2: an Archil mount where the provider takes one and Archil's image is here
166
+ * (archilImageHere), else a synced folder where it takes one (the runner keeps the folder on the disk: no Archil image
167
+ * or client is needed in the computer). `gpuMounts`: what its GPU computers take, where the setting asks for GPUs: a
168
+ * kind they leave out is not picked, unless they leave out every one, and then the kind with no GPU is (so the GPU's
169
+ * refusal says why). Settings (computers.ts) and the claim read this one rule. */
170
+ export declare function folderKindOf(entry: HereFields, mode: 1 | 2, gpuMounts?: readonly string[]): MountKind | undefined;
159
171
  /** Whether a provider's computers run only on the vendor's own network: the network forms it declares (its
160
172
  * descriptor's, its capabilities().network) are "open" alone, as a cloud phone's and a hosted browser's are. */
161
173
  export declare const vendorNetworkOnly: (network: readonly string[] | undefined) => boolean;
@@ -165,13 +177,6 @@ export declare const needsNetwork: (network: readonly string[] | undefined) => b
165
177
  /** A provider's label after its article, as it is said: "a Modal", "an E2B" (every label is said by its first letter's
166
178
  * sound). `start`: at a sentence's start, "A"/"An". */
167
179
  export declare const aLabel: (label: string, start?: boolean) => string;
168
- /** Why a sandbox or a desktop that would mount the owner's Archil disk can't start in Mode 2: the mount needs Archil's
169
- * image in the owner's own vendor account, and this server can't put it there yet. A provider that prepares its image
170
- * (prepareImage: Agent37 registers the box image in the owner's workspace, Modal pulls it, E2B starts its public
171
- * template) is never refused so, nor one whose image the operator names here (archilImageHere: Daytona's
172
- * AGENTRUN_DAYTONA_SNAPSHOT). For such a one, `imageEnv` says where to name it. Settings (computers.ts modeRefusal)
173
- * and a run's start (computerReadiness) say it. */
174
- export declare const mode2ArchilWhy: (label: string, kind: "sandbox" | "desktop", imageEnv?: string) => string;
175
180
  /** Why a computer that needs a network is refused where this server's AGENTRUN_BOX_ALLOW is none, in words that name the
176
181
  * fix: the operator said no network at all, and the computer can't run without one. */
177
182
  export declare const noNetworkRefusal: (label: string, kind: string) => string;
@@ -200,18 +205,27 @@ export declare function computerReadiness(setting: ComputerSetting, mode: 1 | 2,
200
205
  export type StartedComputer = {
201
206
  readonly computer: RunComputer | undefined;
202
207
  release(): Promise<void>;
208
+ /** What the run's disk keeps of the folder beyond what the computer wrote, now (a park lands it before the computer is
209
+ * kept): a synced folder's delta, or an Archil mount's modes and links in sync.json (recordMeta). */
210
+ readonly sync?: () => Promise<Result<void>>;
203
211
  };
204
212
  /** A setting resolved: its kind and provider, whether the run's folder is mounted, the ports, and how to start it. */
205
213
  export type ResolvedComputer = {
206
214
  readonly kind: ComputerSettingKind;
207
215
  readonly provider: string | null;
208
216
  readonly mounts: boolean;
217
+ /** The kind of the run's folder in it, where it mounts: a bind, an Archil mount or a synced folder (folderKindOf). */
218
+ readonly folder?: MountKind;
209
219
  readonly ports: readonly Port[];
210
- /** Starts the computer, mounting `workspace`'s folder when it mounts; `check` is the mount check attach runs (the
211
- * claim's epoch bound in). A computer that cannot be had throws with code computer_unavailable and the words. */
220
+ /** Starts the computer, mounting `workspace`'s folder when it mounts (a synced folder pushed in from the store
221
+ * `workspace` keeps it in before the computer is handed on); `check` is the mount check attach runs (the claim's
222
+ * epoch bound in); `holds`: whether the claim may still write the run's disk (synced-folder.ts claimHolds), asked
223
+ * before each write of the folder there (fencedStore). A computer that cannot be had throws with code
224
+ * computer_unavailable and the words. */
212
225
  start(run: {
213
226
  readonly workspace: Workspace;
214
227
  readonly check: MountCheck;
228
+ readonly holds?: () => Promise<boolean>;
215
229
  readonly signal?: AbortSignal;
216
230
  }): Promise<StartedComputer>;
217
231
  };