humanish 0.106.0 → 0.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (459) hide show
  1. package/AGENTS.md +4 -2
  2. package/ARCHITECTURE.md +17 -16
  3. package/CHANGELOG.md +24 -0
  4. package/CONTEXT.md +42 -39
  5. package/CONTRIBUTING.md +8 -6
  6. package/README.md +8 -3
  7. package/dist/actors/codex/app-server-client.js +2 -1
  8. package/dist/actors/codex/app-server-trace.d.ts +0 -1
  9. package/dist/actors/codex/app-server-trace.js +1 -3
  10. package/dist/actors/codex/app-server.js +2 -1
  11. package/dist/actors/codex/protocol-compat.d.ts +27 -0
  12. package/dist/actors/codex/protocol-compat.js +357 -0
  13. package/dist/actors/codex/protocol-contract.d.ts +61 -0
  14. package/dist/actors/codex/protocol-contract.js +471 -0
  15. package/dist/actors/codex/qualified-versions.d.ts +31 -4
  16. package/dist/actors/codex/qualified-versions.js +51 -6
  17. package/dist/actors/codex/restricted-executable.d.ts +24 -0
  18. package/dist/actors/codex/restricted-executable.js +97 -22
  19. package/dist/actors/codex/restricted-launch.d.ts +7 -1
  20. package/dist/actors/codex/restricted-launch.js +42 -3
  21. package/dist/actors/codex/restricted-notifications.d.ts +101 -0
  22. package/dist/actors/codex/restricted-notifications.js +277 -0
  23. package/dist/actors/codex/restricted-participant.d.ts +30 -0
  24. package/dist/actors/codex/restricted-participant.js +60 -2
  25. package/dist/actors/codex/restricted-policy.d.ts +9 -1
  26. package/dist/actors/codex/restricted-session.d.ts +14 -1
  27. package/dist/actors/codex/restricted-session.js +50 -17
  28. package/dist/actors/codex/restricted-transport.d.ts +29 -0
  29. package/dist/actors/codex/restricted-transport.js +139 -27
  30. package/dist/actors/codex/restricted-turn.d.ts +19 -4
  31. package/dist/actors/codex/restricted-turn.js +43 -30
  32. package/dist/actors/computer-use/actor.d.ts +1 -1
  33. package/dist/actors/computer-use/actor.js +4 -4
  34. package/dist/actors/computer-use/loop/backstop.js +1 -1
  35. package/dist/actors/computer-use/loop/ending.d.ts +2 -2
  36. package/dist/actors/computer-use/loop/ending.js +2 -2
  37. package/dist/actors/computer-use/loop/spend.d.ts +1 -1
  38. package/dist/actors/computer-use/loop/spend.js +3 -3
  39. package/dist/actors/computer-use/loop/trace.js +2 -2
  40. package/dist/actors/computer-use/loop/types.d.ts +14 -5
  41. package/dist/actors/computer-use/loop.js +4 -4
  42. package/dist/actors/computer-use/openai-provider.d.ts +1 -1
  43. package/dist/actors/computer-use/openai-provider.js +2 -2
  44. package/dist/actors/contract.d.ts +10 -8
  45. package/dist/actors/contract.js +7 -1
  46. package/dist/actors/local-agent/cli.js +1 -1
  47. package/dist/actors/scripted-browser/actor.d.ts +2 -2
  48. package/dist/actors/scripted-browser/journey.js +15 -4
  49. package/dist/actors/scripted-browser/steps.js +18 -0
  50. package/dist/actors/scripted-browser/types.d.ts +11 -1
  51. package/dist/actors/stop-conditions.js +1 -3
  52. package/dist/analysis/automatic-completion.d.ts +13 -8
  53. package/dist/analysis/automatic-completion.js +14 -8
  54. package/dist/analysis/automatic-config.d.ts +1 -1
  55. package/dist/analysis/automatic-config.js +2 -2
  56. package/dist/analysis/automatic.d.ts +10 -4
  57. package/dist/analysis/automatic.js +17 -13
  58. package/dist/analysis/diagnostics.d.ts +23 -0
  59. package/dist/analysis/diagnostics.js +112 -0
  60. package/dist/analysis/evidence-sources.js +2 -2
  61. package/dist/analysis/evidence.js +6 -6
  62. package/dist/analysis/execute.d.ts +7 -1
  63. package/dist/analysis/execute.js +39 -12
  64. package/dist/analysis/job.d.ts +8 -5
  65. package/dist/analysis/job.js +15 -14
  66. package/dist/analysis/load.d.ts +1 -1
  67. package/dist/analysis/load.js +5 -5
  68. package/dist/analysis/provider.d.ts +9 -1
  69. package/dist/analysis/restricted-codex.d.ts +2 -0
  70. package/dist/analysis/restricted-codex.js +10 -1
  71. package/dist/analysis/service.d.ts +2 -0
  72. package/dist/analysis/service.js +31 -12
  73. package/dist/analysis/sharing.d.ts +2 -2
  74. package/dist/analysis/sharing.js +5 -5
  75. package/dist/analysis/store-executions.d.ts +5 -5
  76. package/dist/analysis/store-executions.js +12 -12
  77. package/dist/analysis/store.d.ts +4 -4
  78. package/dist/analysis/store.js +13 -13
  79. package/dist/cli/commands/analysis-signals.d.ts +2 -1
  80. package/dist/cli/commands/analysis-signals.js +4 -1
  81. package/dist/cli/commands/analyze.js +4 -2
  82. package/dist/cli/commands/comms.js +8 -1
  83. package/dist/cli/commands/lab-route-computer-use.d.ts +0 -2
  84. package/dist/cli/commands/lab-route-computer-use.js +26 -14
  85. package/dist/cli/commands/lab-route-preview.d.ts +1 -3
  86. package/dist/cli/commands/lab-route-preview.js +3 -4
  87. package/dist/cli/commands/lab-route-run.d.ts +6 -4
  88. package/dist/cli/commands/lab-route-run.js +6 -2
  89. package/dist/cli/commands/lab-route-scripted.d.ts +0 -2
  90. package/dist/cli/commands/lab-route-scripted.js +0 -1
  91. package/dist/cli/commands/lab-route-shared-world.d.ts +0 -2
  92. package/dist/cli/commands/lab-route-shared-world.js +0 -1
  93. package/dist/cli/commands/lab-route-terminal.d.ts +0 -2
  94. package/dist/cli/commands/lab-route-terminal.js +0 -1
  95. package/dist/cli/commands/lab-run.js +76 -45
  96. package/dist/cli/commands/lab-scorer.d.ts +0 -2
  97. package/dist/cli/commands/lab.js +12 -6
  98. package/dist/cli/commands/observe.js +22 -0
  99. package/dist/cli/commands/run-signals.d.ts +30 -0
  100. package/dist/cli/commands/run-signals.js +146 -0
  101. package/dist/cli/commands/runs.js +10 -8
  102. package/dist/cli/commands/watch.js +12 -10
  103. package/dist/cli/doctor.d.ts +3 -0
  104. package/dist/cli/doctor.js +10 -2
  105. package/dist/cli/io.d.ts +5 -4
  106. package/dist/cli/io.js +12 -8
  107. package/dist/cli/program.js +3 -3
  108. package/dist/cli/renamed-options.d.ts +11 -0
  109. package/dist/cli/renamed-options.js +18 -0
  110. package/dist/cli/telemetry.d.ts +2 -2
  111. package/dist/cli/telemetry.js +1 -1
  112. package/dist/comms/capture-surface.d.ts +1 -1
  113. package/dist/comms/catch-host.d.ts +1 -1
  114. package/dist/comms/connections.js +4 -4
  115. package/dist/comms/external-evidence.d.ts +27 -0
  116. package/dist/comms/external-evidence.js +93 -0
  117. package/dist/comms/lease-store.js +7 -7
  118. package/dist/comms/types.js +1 -1
  119. package/dist/evidence/browser-hygiene.d.ts +1 -1
  120. package/dist/evidence/browser-hygiene.js +1 -1
  121. package/dist/evidence/redaction.js +1 -1
  122. package/dist/evidence/secret-scrub.d.ts +9 -0
  123. package/dist/evidence/secret-scrub.js +96 -0
  124. package/dist/feedback/draft.js +7 -9
  125. package/dist/feedback/export-bundle.js +4 -4
  126. package/dist/feedback/export.js +9 -9
  127. package/dist/feedback/feedback.d.ts +1 -1
  128. package/dist/index.d.ts +3 -6
  129. package/dist/index.js +3 -6
  130. package/dist/keys/key-resolution.d.ts +3 -1
  131. package/dist/keys/key-resolution.js +18 -16
  132. package/dist/lab/adapter-extension.d.ts +28 -6
  133. package/dist/lab/adapter-extension.js +65 -126
  134. package/dist/lab/adapter-scorer-loader.d.ts +25 -5
  135. package/dist/lab/adapter-scorer-loader.js +24 -0
  136. package/dist/lab/composition-rules.d.ts +2 -0
  137. package/dist/lab/composition-rules.js +35 -26
  138. package/dist/lab/config.js +28 -26
  139. package/dist/lab/device-presets.d.ts +2 -2
  140. package/dist/lab/discover.js +1 -3
  141. package/dist/lab/doctor.d.ts +44 -9
  142. package/dist/lab/doctor.js +149 -41
  143. package/dist/lab/init-plan.js +1 -3
  144. package/dist/lab/keys.js +1 -1
  145. package/dist/lab/lab-deps.d.ts +85 -0
  146. package/dist/lab/lab-deps.js +4 -0
  147. package/dist/lab/parse/actors.js +8 -7
  148. package/dist/lab/parse/comms.js +3 -2
  149. package/dist/lab/parse/execution.js +3 -2
  150. package/dist/lab/parse/subject-state.js +2 -1
  151. package/dist/lab/parse/subject.js +2 -1
  152. package/dist/lab/parse/values.d.ts +0 -1
  153. package/dist/lab/parse/values.js +0 -3
  154. package/dist/lab/persona-resolve.d.ts +3 -3
  155. package/dist/lab/persona-resolve.js +4 -4
  156. package/dist/lab/persona.js +1 -3
  157. package/dist/lab/plan-base.d.ts +6 -2
  158. package/dist/lab/plan-base.js +22 -7
  159. package/dist/lab/plan-participants.d.ts +5 -5
  160. package/dist/lab/plan-participants.js +2 -2
  161. package/dist/lab/plan-types.d.ts +33 -7
  162. package/dist/lab/plan.d.ts +3 -11
  163. package/dist/lab/plan.js +18 -42
  164. package/dist/lab/preflight-result.js +0 -2
  165. package/dist/lab/preflight.d.ts +0 -3
  166. package/dist/lab/preflight.js +1 -1
  167. package/dist/lab/requirements.d.ts +20 -0
  168. package/dist/lab/requirements.js +54 -0
  169. package/dist/lab/route-inputs.d.ts +23 -12
  170. package/dist/lab/route-inputs.js +48 -51
  171. package/dist/lab/routing.d.ts +19 -24
  172. package/dist/lab/routing.js +14 -47
  173. package/dist/lab/run-lab-events.d.ts +6 -11
  174. package/dist/lab/run-lab-events.js +3 -11
  175. package/dist/lab/run-lab-homes.d.ts +64 -0
  176. package/dist/lab/run-lab-homes.js +3 -0
  177. package/dist/lab/run-lab-options.d.ts +12 -66
  178. package/dist/lab/run-lab-options.js +45 -275
  179. package/dist/lab/summary.d.ts +9 -4
  180. package/dist/lab/summary.js +15 -8
  181. package/dist/lab/types.d.ts +132 -132
  182. package/dist/lab/validation.d.ts +15 -15
  183. package/dist/lab/validation.js +28 -28
  184. package/dist/lab/warnings.js +20 -19
  185. package/dist/observer/artifact.d.ts +1 -1
  186. package/dist/observer/artifact.js +3 -3
  187. package/dist/observer/data.js +2 -2
  188. package/dist/observer/render.js +2 -2
  189. package/dist/observer/run-routes.d.ts +1 -1
  190. package/dist/observer/run-routes.js +5 -5
  191. package/dist/observer/serve.d.ts +17 -0
  192. package/dist/observer/serve.js +34 -3
  193. package/dist/observer-app.html +1 -1
  194. package/dist/routes/computer-use/bundle-parts.d.ts +1 -1
  195. package/dist/routes/computer-use/bundle-parts.js +10 -3
  196. package/dist/routes/computer-use/bundle.d.ts +4 -11
  197. package/dist/routes/computer-use/bundle.js +9 -15
  198. package/dist/routes/computer-use/diagnostics.d.ts +1 -1
  199. package/dist/routes/computer-use/diagnostics.js +1 -1
  200. package/dist/routes/computer-use/e2b-desktop/comms.d.ts +10 -10
  201. package/dist/routes/computer-use/e2b-desktop/comms.js +11 -14
  202. package/dist/routes/computer-use/e2b-desktop/desktop.d.ts +2 -2
  203. package/dist/routes/computer-use/e2b-desktop/desktop.js +4 -7
  204. package/dist/routes/computer-use/e2b-desktop/fidelity.d.ts +13 -13
  205. package/dist/routes/computer-use/e2b-desktop/fidelity.js +11 -11
  206. package/dist/routes/computer-use/e2b-desktop/prepare.d.ts +3 -3
  207. package/dist/routes/computer-use/e2b-desktop/prepare.js +33 -36
  208. package/dist/routes/computer-use/e2b-desktop/start.d.ts +1 -1
  209. package/dist/routes/computer-use/e2b-desktop/start.js +24 -23
  210. package/dist/routes/computer-use/e2b-desktop/state.d.ts +5 -4
  211. package/dist/routes/computer-use/e2b-desktop/state.js +5 -3
  212. package/dist/routes/computer-use/e2b-desktop/teardown.d.ts +1 -1
  213. package/dist/routes/computer-use/e2b-desktop/teardown.js +29 -17
  214. package/dist/routes/computer-use/external-comms.d.ts +4 -4
  215. package/dist/routes/computer-use/external-comms.js +19 -43
  216. package/dist/routes/computer-use/fanout-bundle.d.ts +3 -3
  217. package/dist/routes/computer-use/fanout-bundle.js +25 -29
  218. package/dist/routes/computer-use/{fanout-lanes.js → fanout-records.js} +25 -19
  219. package/dist/routes/computer-use/in-process-desktop.d.ts +3 -10
  220. package/dist/routes/computer-use/in-process-desktop.js +3 -9
  221. package/dist/routes/computer-use/live-flush.d.ts +7 -5
  222. package/dist/routes/computer-use/live-flush.js +19 -27
  223. package/dist/routes/computer-use/{run-lanes.js → live-phase.js} +14 -13
  224. package/dist/routes/computer-use/local-tree-pack.d.ts +3 -3
  225. package/dist/routes/computer-use/local-tree-pack.js +4 -5
  226. package/dist/routes/computer-use/local-vm.d.ts +11 -8
  227. package/dist/routes/computer-use/local-vm.js +39 -66
  228. package/dist/routes/computer-use/participant-desktop.d.ts +8 -23
  229. package/dist/routes/computer-use/participant-desktop.js +5 -25
  230. package/dist/routes/computer-use/{lanes.d.ts → participant-execution.d.ts} +10 -10
  231. package/dist/routes/computer-use/{lanes.js → participant-execution.js} +35 -22
  232. package/dist/routes/computer-use/participant-facts.d.ts +7 -1
  233. package/dist/routes/computer-use/participant-facts.js +12 -1
  234. package/dist/routes/computer-use/participant-model.d.ts +19 -11
  235. package/dist/routes/computer-use/participant-model.js +58 -33
  236. package/dist/routes/computer-use/participant-prompt.d.ts +3 -3
  237. package/dist/routes/computer-use/participant-prompt.js +4 -4
  238. package/dist/routes/computer-use/participant-runs.d.ts +6 -6
  239. package/dist/routes/computer-use/participant-runs.js +8 -8
  240. package/dist/routes/computer-use/plan.d.ts +21 -29
  241. package/dist/routes/computer-use/plan.js +59 -65
  242. package/dist/routes/computer-use/preflight.d.ts +6 -11
  243. package/dist/routes/computer-use/preflight.js +26 -18
  244. package/dist/routes/computer-use/rerun-selection.js +10 -6
  245. package/dist/routes/computer-use/result.d.ts +1 -1
  246. package/dist/routes/computer-use/result.js +40 -30
  247. package/dist/routes/computer-use/route.d.ts +3 -4
  248. package/dist/routes/computer-use/route.js +21 -19
  249. package/dist/routes/computer-use/self-report.d.ts +2 -2
  250. package/dist/routes/computer-use/self-report.js +4 -4
  251. package/dist/routes/computer-use/setup.d.ts +8 -17
  252. package/dist/routes/computer-use/setup.js +98 -86
  253. package/dist/routes/computer-use/single-bundle.d.ts +8 -11
  254. package/dist/routes/computer-use/single-bundle.js +20 -25
  255. package/dist/routes/computer-use/subject-projection.d.ts +5 -7
  256. package/dist/routes/computer-use/subject-projection.js +20 -19
  257. package/dist/routes/computer-use/types.d.ts +169 -211
  258. package/dist/routes/computer-use/types.js +13 -6
  259. package/dist/routes/preview.js +0 -1
  260. package/dist/routes/scripted/bundle.d.ts +3 -6
  261. package/dist/routes/scripted/bundle.js +11 -16
  262. package/dist/routes/scripted/plan.d.ts +5 -7
  263. package/dist/routes/scripted/plan.js +6 -4
  264. package/dist/routes/scripted/result.d.ts +4 -1
  265. package/dist/routes/scripted/result.js +10 -6
  266. package/dist/routes/scripted/route.js +10 -11
  267. package/dist/routes/scripted/scenario.d.ts +1 -1
  268. package/dist/routes/scripted/scenario.js +1 -1
  269. package/dist/routes/scripted/setup.d.ts +3 -2
  270. package/dist/routes/scripted/setup.js +22 -21
  271. package/dist/routes/scripted/subject.d.ts +8 -3
  272. package/dist/routes/scripted/subject.js +11 -6
  273. package/dist/routes/scripted/surface-records.js +1 -1
  274. package/dist/routes/scripted/surface-sessions.d.ts +2 -2
  275. package/dist/routes/scripted/surface-sessions.js +4 -4
  276. package/dist/routes/scripted/types.d.ts +19 -36
  277. package/dist/routes/scripted/types.js +1 -2
  278. package/dist/routes/shared-world/{seat-records.js → bundle-records.js} +8 -8
  279. package/dist/routes/shared-world/bundle.d.ts +2 -2
  280. package/dist/routes/shared-world/bundle.js +22 -26
  281. package/dist/routes/shared-world/checkpoints.d.ts +4 -4
  282. package/dist/routes/shared-world/checkpoints.js +4 -4
  283. package/dist/routes/shared-world/comms.d.ts +5 -4
  284. package/dist/routes/shared-world/comms.js +28 -41
  285. package/dist/routes/shared-world/external-public.d.ts +5 -5
  286. package/dist/routes/shared-world/external-public.js +19 -20
  287. package/dist/routes/shared-world/handoff.d.ts +4 -4
  288. package/dist/routes/shared-world/handoff.js +50 -50
  289. package/dist/routes/shared-world/lobby-code.d.ts +5 -5
  290. package/dist/routes/shared-world/lobby-code.js +13 -13
  291. package/dist/routes/shared-world/{seats.d.ts → participant-specs.d.ts} +8 -6
  292. package/dist/routes/shared-world/{seats.js → participant-specs.js} +46 -51
  293. package/dist/routes/shared-world/plan.d.ts +2 -6
  294. package/dist/routes/shared-world/plan.js +1 -2
  295. package/dist/routes/shared-world/provenance.d.ts +4 -4
  296. package/dist/routes/shared-world/provenance.js +4 -4
  297. package/dist/routes/shared-world/provisioned.d.ts +3 -2
  298. package/dist/routes/shared-world/provisioned.js +48 -41
  299. package/dist/routes/shared-world/result.js +31 -19
  300. package/dist/routes/shared-world/route.js +37 -41
  301. package/dist/routes/shared-world/setup.d.ts +5 -4
  302. package/dist/routes/shared-world/setup.js +12 -14
  303. package/dist/routes/shared-world/types.d.ts +53 -126
  304. package/dist/routes/shared-world/types.js +2 -2
  305. package/dist/routes/terminal/adapter.d.ts +8 -8
  306. package/dist/routes/terminal/adapter.js +28 -125
  307. package/dist/routes/terminal/bundle.d.ts +7 -12
  308. package/dist/routes/terminal/bundle.js +24 -34
  309. package/dist/routes/terminal/credentials.d.ts +2 -2
  310. package/dist/routes/terminal/credentials.js +16 -16
  311. package/dist/routes/terminal/dry-run.d.ts +1 -1
  312. package/dist/routes/terminal/dry-run.js +9 -11
  313. package/dist/routes/terminal/encoding.d.ts +1 -1
  314. package/dist/routes/terminal/encoding.js +2 -2
  315. package/dist/routes/terminal/ledger.d.ts +6 -6
  316. package/dist/routes/terminal/ledger.js +9 -9
  317. package/dist/routes/terminal/live-finish.d.ts +1 -2
  318. package/dist/routes/terminal/live-finish.js +21 -20
  319. package/dist/routes/terminal/live-sandbox.d.ts +4 -2
  320. package/dist/routes/terminal/live-sandbox.js +25 -21
  321. package/dist/routes/terminal/participant-text.d.ts +23 -0
  322. package/dist/routes/terminal/participant-text.js +165 -0
  323. package/dist/routes/terminal/plan.d.ts +2 -6
  324. package/dist/routes/terminal/plan.js +13 -9
  325. package/dist/routes/terminal/recorder.d.ts +6 -1
  326. package/dist/routes/terminal/recorder.js +12 -4
  327. package/dist/routes/terminal/result.js +4 -4
  328. package/dist/routes/terminal/route.js +26 -26
  329. package/dist/routes/terminal/runtime.d.ts +3 -2
  330. package/dist/routes/terminal/runtime.js +3 -3
  331. package/dist/routes/terminal/sandbox.d.ts +5 -3
  332. package/dist/routes/terminal/sandbox.js +13 -16
  333. package/dist/routes/terminal/session.js +16 -14
  334. package/dist/routes/terminal/token-usage.js +5 -5
  335. package/dist/routes/terminal/trace.d.ts +5 -8
  336. package/dist/routes/terminal/trace.js +9 -64
  337. package/dist/routes/terminal/types.d.ts +85 -93
  338. package/dist/routes/terminal/types.js +9 -4
  339. package/dist/run/active-runs.d.ts +13 -0
  340. package/dist/run/active-runs.js +12 -0
  341. package/dist/run/bundle-shape.d.ts +2 -1
  342. package/dist/run/bundle-shape.js +4 -4
  343. package/dist/run/bundle.d.ts +63 -56
  344. package/dist/run/bundle.js +9 -8
  345. package/dist/run/cost-summary.js +3 -2
  346. package/dist/run/costs.d.ts +6 -6
  347. package/dist/run/costs.js +10 -10
  348. package/dist/run/detail.d.ts +5 -5
  349. package/dist/run/detail.js +6 -6
  350. package/dist/run/dry-run.js +5 -12
  351. package/dist/run/{study-files.d.ts → evidence-files.d.ts} +4 -4
  352. package/dist/run/{study-files.js → evidence-files.js} +5 -5
  353. package/dist/run/feedback-shape.js +1 -1
  354. package/dist/run/judge.d.ts +16 -4
  355. package/dist/run/judge.js +24 -7
  356. package/dist/run/locate.d.ts +2 -0
  357. package/dist/run/locate.js +3 -1
  358. package/dist/run/outcomes.d.ts +3 -3
  359. package/dist/run/outcomes.js +3 -3
  360. package/dist/run/participant-records.d.ts +2 -2
  361. package/dist/run/participant-records.js +2 -2
  362. package/dist/run/paths.js +1 -1
  363. package/dist/run/pricing.d.ts +19 -9
  364. package/dist/run/pricing.js +30 -18
  365. package/dist/run/projection.d.ts +13 -13
  366. package/dist/run/projection.js +8 -8
  367. package/dist/run/reclaim.d.ts +7 -1
  368. package/dist/run/reclaim.js +24 -4
  369. package/dist/run/results.d.ts +1 -1
  370. package/dist/run/run-index.d.ts +1 -1
  371. package/dist/run/run-index.js +11 -11
  372. package/dist/run/run.d.ts +4 -2
  373. package/dist/run/run.js +9 -5
  374. package/dist/run/sandbox-receipts.d.ts +4 -4
  375. package/dist/run/sandbox-receipts.js +4 -4
  376. package/dist/run/shared-world-evidence.d.ts +47 -47
  377. package/dist/run/shared-world-shape.d.ts +3 -3
  378. package/dist/run/shared-world-shape.js +11 -11
  379. package/dist/run/stats.d.ts +5 -5
  380. package/dist/run/stats.js +8 -8
  381. package/dist/run/status.d.ts +16 -6
  382. package/dist/run/status.js +31 -8
  383. package/dist/run/streams.d.ts +26 -19
  384. package/dist/run/terminal-contract.d.ts +5 -5
  385. package/dist/run/terminal-contract.js +4 -4
  386. package/dist/run/transient-comms-secrets.d.ts +5 -0
  387. package/dist/run/transient-comms-secrets.js +12 -0
  388. package/dist/run-lab.d.ts +36 -34
  389. package/dist/run-lab.js +41 -37
  390. package/dist/subject/desktop-cli.d.ts +1 -1
  391. package/dist/subject/desktop-cli.js +1 -1
  392. package/dist/subject/local-tree-archive.d.ts +1 -1
  393. package/dist/subject/local-tree-archive.js +4 -4
  394. package/dist/subject/local-tree.d.ts +2 -2
  395. package/dist/subject/local-tree.js +1 -1
  396. package/dist/subject/node-bootstrap.d.ts +1 -1
  397. package/dist/subject/node-bootstrap.js +4 -4
  398. package/dist/subject/runtime.js +5 -5
  399. package/dist/subject/serve.js +1 -1
  400. package/dist/subject/steps.d.ts +4 -4
  401. package/dist/subject/steps.js +5 -5
  402. package/dist/substrates/desktop-session.d.ts +2 -0
  403. package/dist/substrates/e2b/cdp-probe.d.ts +2 -2
  404. package/dist/substrates/e2b/cdp-probe.js +1 -1
  405. package/dist/substrates/e2b/desktop-browser.d.ts +3 -3
  406. package/dist/substrates/e2b/desktop-browser.js +4 -4
  407. package/dist/substrates/e2b/desktop-cdp.d.ts +7 -7
  408. package/dist/substrates/e2b/desktop-cdp.js +4 -4
  409. package/dist/substrates/e2b/desktop-geometry.d.ts +4 -4
  410. package/dist/substrates/e2b/desktop-geometry.js +3 -3
  411. package/dist/substrates/e2b/desktop-media.js +2 -2
  412. package/dist/substrates/e2b/sandbox.d.ts +2 -0
  413. package/dist/substrates/e2b/sandbox.js +22 -8
  414. package/dist/substrates/e2b/sdk.d.ts +12 -1
  415. package/dist/substrates/e2b/sdk.js +30 -9
  416. package/dist/substrates/local/runtime-host.d.ts +2 -0
  417. package/dist/substrates/local/runtime-host.js +6 -0
  418. package/dist/tui/actions.d.ts +7 -5
  419. package/dist/tui/actions.js +18 -9
  420. package/dist/tui-app.js +42 -42
  421. package/dist/verify/actor.d.ts +10 -10
  422. package/dist/verify/actor.js +15 -15
  423. package/dist/verify/artifacts.d.ts +1 -1
  424. package/dist/verify/artifacts.js +3 -3
  425. package/dist/verify/costs.d.ts +2 -2
  426. package/dist/verify/costs.js +2 -2
  427. package/dist/verify/liveness.d.ts +1 -1
  428. package/dist/verify/liveness.js +4 -1
  429. package/dist/verify/rerun.d.ts +1 -1
  430. package/dist/verify/rerun.js +1 -1
  431. package/dist/verify/shared-world.js +2 -2
  432. package/dist/verify/verify.js +6 -6
  433. package/docs/README.md +1 -1
  434. package/docs/architecture/actor-contract.md +60 -22
  435. package/docs/architecture/desktop-sessions.md +9 -9
  436. package/docs/architecture/external-public-shared-world.md +5 -0
  437. package/docs/architecture/observer.md +4 -4
  438. package/docs/architecture/restricted-codex-analysis.md +40 -4
  439. package/docs/architecture/state-driven-executor.md +4 -5
  440. package/docs/architecture/task-protocol-support.md +3 -5
  441. package/docs/architecture/{terminal-product-lane.md → terminal-product-route.md} +24 -16
  442. package/docs/contracts/run-bundle.md +10 -8
  443. package/docs/contracts/schemas.md +109 -53
  444. package/docs/contracts/study-analysis.md +24 -0
  445. package/docs/decisions/0004-participant-desktops-stay-in-the-route.md +2 -1
  446. package/docs/product/automatic-analysis.md +1 -0
  447. package/docs/ramp/README.md +2 -1
  448. package/package.json +4 -4
  449. package/skills/humanish/SKILL.md +3 -2
  450. package/skills/humanish/agents/openai.yaml +1 -1
  451. package/dist/deprecated.d.ts +0 -90
  452. package/dist/deprecated.js +0 -106
  453. package/dist/lab/bag-overrides.d.ts +0 -18
  454. package/dist/lab/bag-overrides.js +0 -121
  455. package/dist/routes/computer-use/legacy-lane-spec.d.ts +0 -62
  456. package/dist/routes/computer-use/legacy-lane-spec.js +0 -39
  457. /package/dist/routes/computer-use/{fanout-lanes.d.ts → fanout-records.d.ts} +0 -0
  458. /package/dist/routes/computer-use/{run-lanes.d.ts → live-phase.d.ts} +0 -0
  459. /package/dist/routes/shared-world/{seat-records.d.ts → bundle-records.d.ts} +0 -0
@@ -13,7 +13,7 @@ export declare function resolveCommittedPersona(projectRoot: PreparedSelectedOut
13
13
  warnings: string[];
14
14
  }>;
15
15
  /**
16
- * Resolve every distinct persona id a run will use, once, before lane specs are built. Returning a
16
+ * Resolve every distinct persona id a run will use, once, before participant specs are built. Returning a
17
17
  * map keeps the plan builder PURE (it is exported npm surface and asserted pure by tests): the
18
18
  * async file reads happen here, and the composer only does a lookup.
19
19
  */
@@ -22,8 +22,8 @@ export declare function resolveCommittedPersonas(projectRoot: PreparedSelectedOu
22
22
  warnings: string[];
23
23
  }>;
24
24
  /**
25
- * Every persona id a lab config could put on a browser lane: the per-lane roster when one is
26
- * declared, otherwise the actor-level persona that every fan-out lane inherits.
25
+ * Every persona id a lab config could put on a browser participant: the roster when one is
26
+ * declared, otherwise the actor-level persona that every fan-out participant inherits.
27
27
  */
28
28
  export declare function labPersonaIds(config: {
29
29
  actors?: readonly Pick<LabActor, "persona" | "lanes">[];
@@ -6,7 +6,7 @@ import { prepareSelectedOutputDirectory, readContainedRegularFile, } from "../ru
6
6
  import { digestText, redactText } from "../evidence/redaction.js";
7
7
  import { realpath } from "node:fs/promises";
8
8
  import { rosterOf } from "./parse/actors.js";
9
- /** Persona ids are file-name segments, never paths: the same grammar the terminal lane enforces. */
9
+ /** Persona ids are file-name segments, never paths: the same grammar the terminal route enforces. */
10
10
  const PERSONA_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
11
11
  /** Title-case an id for the fallback display name (`skeptical-power-user` -> `Skeptical Power User`). */
12
12
  export function personaTitleFromId(personaId) {
@@ -65,7 +65,7 @@ export async function resolveCommittedPersona(projectRoot, personaId) {
65
65
  };
66
66
  }
67
67
  /**
68
- * Resolve every distinct persona id a run will use, once, before lane specs are built. Returning a
68
+ * Resolve every distinct persona id a run will use, once, before participant specs are built. Returning a
69
69
  * map keeps the plan builder PURE (it is exported npm surface and asserted pure by tests): the
70
70
  * async file reads happen here, and the composer only does a lookup.
71
71
  */
@@ -81,8 +81,8 @@ export async function resolveCommittedPersonas(projectRoot, personaIds) {
81
81
  return { personas, warnings };
82
82
  }
83
83
  /**
84
- * Every persona id a lab config could put on a browser lane: the per-lane roster when one is
85
- * declared, otherwise the actor-level persona that every fan-out lane inherits.
84
+ * Every persona id a lab config could put on a browser participant: the roster when one is
85
+ * declared, otherwise the actor-level persona that every fan-out participant inherits.
86
86
  */
87
87
  export function labPersonaIds(config) {
88
88
  const ids = [];
@@ -1,4 +1,5 @@
1
1
  import { digestText, redactText } from "../evidence/redaction.js";
2
+ import { isRecord } from "../run/type-guards.js";
2
3
  export const PERSONA_BACKGROUND_MAX_BYTES = 32 * 1024;
3
4
  const PERSONA_COMPILER_VERSION = 2;
4
5
  export class PersonaConfigError extends Error {
@@ -18,9 +19,6 @@ const PERSONA_FIELDS = new Set([
18
19
  "constraints",
19
20
  ]);
20
21
  const TRAIT_FIELDS = new Set(["patience", "technical_confidence", "accessibility_needs"]);
21
- function isRecord(value) {
22
- return typeof value === "object" && value !== null && !Array.isArray(value);
23
- }
24
22
  function cleanText(value) {
25
23
  return value
26
24
  .replace(/\r\n?/g, "\n")
@@ -1,4 +1,3 @@
1
- import type { RunLabProvenance } from "../run/status.js";
2
1
  import type { Brain, ComputerUsePlan, NonEmpty, PlannedAnalysis, ProvisionedSubject, Requirement } from "./plan-types.js";
3
2
  import type { LabConfig } from "./types.js";
4
3
  export type Base = Omit<ComputerUsePlan, "route" | "actor" | "runner" | "concurrency" | "sessionBudgetMs" | "sandboxMs" | "caps" | "rerun">;
@@ -13,10 +12,15 @@ export declare function desktopRequirements(config: LabConfig, args: {
13
12
  externalCatch: boolean;
14
13
  }): Requirement[];
15
14
  export declare function brainOf(config: LabConfig, callerProvider: boolean): Brain;
15
+ /** The brain of a run whose provider the library caller supplies. */
16
+ export declare function callerBrainOf(config: LabConfig): Extract<Brain, {
17
+ kind: "caller";
18
+ }>;
19
+ /** The model a participant's spend is priced at when its provider reports none. */
20
+ export declare function pricedModel(brain: Brain): string;
16
21
  /** The fields every plan shares, from a config whose analysis already resolved. */
17
22
  export declare function planBase(config: LabConfig, input: {
18
23
  readonly dryRun: boolean;
19
- readonly lab?: RunLabProvenance;
20
24
  readonly analysis?: {
21
25
  readonly config?: PlannedAnalysis["config"] | undefined;
22
26
  readonly preferLargerOutput?: boolean | undefined;
@@ -1,10 +1,13 @@
1
1
  // What every route planner shares: the plan fields common to all routes, the frozen residual config,
2
2
  // and the requirement and subject helpers.
3
3
  import { DEFAULT_OPENAI_CU_MODEL } from "../actors/computer-use/openai-provider.js";
4
- function deepFreeze(value) {
5
- if (typeof value === "object" && value !== null) {
4
+ // A YAML alias can make a parsed record contain itself (an inline persona that names its own
5
+ // anchor), and structuredClone keeps the cycle, so each object is frozen once.
6
+ function deepFreeze(value, frozen = new WeakSet()) {
7
+ if (typeof value === "object" && value !== null && !frozen.has(value)) {
8
+ frozen.add(value);
6
9
  for (const child of Object.values(value))
7
- deepFreeze(child);
10
+ deepFreeze(child, frozen);
8
11
  Object.freeze(value);
9
12
  }
10
13
  return value;
@@ -85,10 +88,23 @@ export function desktopRequirements(config, args) {
85
88
  export function brainOf(config, callerProvider) {
86
89
  const actor = config.actors[0];
87
90
  if (callerProvider)
88
- return { kind: "caller" };
91
+ return callerBrainOf(config);
92
+ const declared = declaredModelOf(config);
89
93
  if (actor?.type === "local-agent")
90
- return { kind: "local-agent", agent: actor.localAgent ?? "codex" };
91
- return { kind: "openai", model: actor?.model ?? DEFAULT_OPENAI_CU_MODEL };
94
+ return { kind: "local-agent", agent: actor.localAgent ?? "codex", ...declared };
95
+ return { kind: "openai", model: actor?.model ?? DEFAULT_OPENAI_CU_MODEL, ...declared };
96
+ }
97
+ /** The brain of a run whose provider the library caller supplies. */
98
+ export function callerBrainOf(config) {
99
+ return { kind: "caller", ...declaredModelOf(config) };
100
+ }
101
+ function declaredModelOf(config) {
102
+ const model = config.actors[0]?.model;
103
+ return model === undefined ? {} : { declaredModel: model };
104
+ }
105
+ /** The model a participant's spend is priced at when its provider reports none. */
106
+ export function pricedModel(brain) {
107
+ return brain.declaredModel ?? DEFAULT_OPENAI_CU_MODEL;
92
108
  }
93
109
  /** The fields every plan shares, from a config whose analysis already resolved. */
94
110
  export function planBase(config, input) {
@@ -96,7 +112,6 @@ export function planBase(config, input) {
96
112
  return {
97
113
  labId: config.id,
98
114
  ...(config.title === undefined ? {} : { title: config.title }),
99
- ...(input.lab === undefined ? {} : { lab: input.lab }),
100
115
  residual: residualOf(config),
101
116
  dryRun: input.dryRun,
102
117
  ...(analysis === undefined
@@ -5,7 +5,7 @@ import type { LabTask } from "./tasks.js";
5
5
  import type { LabConfig } from "./types.js";
6
6
  /** Who one participant is. Every route with participants carries this record. */
7
7
  export interface Participant {
8
- /** Declared roster id, else `lane-NN` (independent lanes) or `role-NN` (shared-world seats). */
8
+ /** Declared roster id, else `lane-NN` (independent participants) or `role-NN` (shared-world participants). */
9
9
  readonly id: string;
10
10
  /** 0-based position in the roster. Bundle `sim-NNN` and `stream-NNN` ids derive from it. */
11
11
  readonly index: number;
@@ -30,7 +30,7 @@ interface DesktopParticipant extends Participant {
30
30
  readonly preset: DevicePreset;
31
31
  readonly resolution: [number, number];
32
32
  };
33
- /** Lane value, else actor value, else absent (the provider default is recorded in the trace). */
33
+ /** The `lanes[]` entry's value, else actor value, else absent (the provider default is recorded in the trace). */
34
34
  readonly limits: {
35
35
  readonly stopWhen?: StopWhen;
36
36
  readonly dwell?: DwellWindow;
@@ -38,10 +38,10 @@ interface DesktopParticipant extends Participant {
38
38
  readonly maxOutputTokens?: number;
39
39
  };
40
40
  }
41
- /** Only independent computer-use lanes consume a task protocol and a per-lane target. */
41
+ /** Only independent computer-use participants consume a task protocol and their own target. */
42
42
  export interface ComputerUseParticipant extends DesktopParticipant {
43
43
  readonly tasks?: readonly LabTask[];
44
- /** app-url fan-out only: this lane's own entry URL; absent means the subject URL. */
44
+ /** app-url fan-out only: this participant's own entry URL; absent means the subject URL. */
45
45
  readonly targetUrl?: string;
46
46
  }
47
47
  /** A seat on a provisioned plane: an optional same-origin path under `serve.url`. */
@@ -68,7 +68,7 @@ export type SharedWorldRoster = {
68
68
  /** One shared-world participant on either plane. */
69
69
  export type SharedWorldParticipant = ProvisionedParticipant | ExternalPublicParticipant;
70
70
  /**
71
- * The lanes of a computer-use lab: the declared roster, else `count` identical lanes. A count
71
+ * The participants of a computer-use lab: the declared roster, else `count` identical ones. A count
72
72
  * override (`--count`) applies only when no roster is declared.
73
73
  */
74
74
  export declare function computerUseParticipants(config: LabConfig, countOverride?: number): ComputerUseParticipant[];
@@ -1,5 +1,5 @@
1
1
  // Who takes part in a lab: one record per participant, built from the declared roster or a count.
2
- // Computer-use lanes and shared-world seats share the desktop fields; each kind adds its own.
2
+ // Computer-use and shared-world participants share the desktop fields; each kind adds its own.
3
3
  import { resolveParticipantDevice } from "./device-presets.js";
4
4
  import { isSharedWorldComposition, participantIdAt } from "./routing.js";
5
5
  import { focusOf, rosterOf } from "./parse/actors.js";
@@ -35,7 +35,7 @@ function desktopParticipant(config, entry, index, kind, focus) {
35
35
  };
36
36
  }
37
37
  /**
38
- * The lanes of a computer-use lab: the declared roster, else `count` identical lanes. A count
38
+ * The participants of a computer-use lab: the declared roster, else `count` identical ones. A count
39
39
  * override (`--count`) applies only when no roster is declared.
40
40
  */
41
41
  export function computerUseParticipants(config, countOverride) {
@@ -11,7 +11,10 @@ import type { ComputerUseParticipant, ExternalPublicParticipant, ProvisionedPart
11
11
  import type { LabConfig, LabExecutionTerminal, LabRuntimeAuth, LabScenarioCaps, LabSubjectProduct, LabSubjectServe, LabSubjectState, LabSubjectStateCheckpoint } from "./types.js";
12
12
  export type NonEmpty<T> = readonly [T, ...T[]];
13
13
  type AtLeastTwo<T> = readonly [T, T, ...T[]];
14
- /** Something a route checks right before acquisition. Doctor, the TUI and preflight list the same set. */
14
+ /**
15
+ * Something a route checks right before acquisition. Preflight refuses on, and doctor and the TUI
16
+ * report, the keys and subject env listed here, through src/lab/requirements.ts.
17
+ */
15
18
  export type Requirement = {
16
19
  readonly kind: "key";
17
20
  readonly name: "OPENAI_API_KEY" | "E2B_API_KEY";
@@ -39,7 +42,12 @@ export type Requirement = {
39
42
  readonly kind: "external-catch";
40
43
  readonly url: string;
41
44
  };
42
- /** Config fields no plan field decides. Routes read nothing else from the config. */
45
+ /**
46
+ * Config fields no plan field decides. After admission, computer use reads the config only to pass
47
+ * it to the caller's createProvider and inProcess executor; its planner, refusal envelopes and local
48
+ * VM study read it before a plan exists. Shared world, terminal and scripted still read some config
49
+ * fields at run time.
50
+ */
43
51
  export type ResidualConfig = Pick<LabConfig, "comms" | "policies" | "personas" | "defaults" | "review"> & {
44
52
  readonly execution?: Pick<NonNullable<LabConfig["execution"]>, "desktop" | "target">;
45
53
  readonly subject: Pick<LabConfig["subject"], "clone" | "localTree" | "repos" | "envValues">;
@@ -73,15 +81,23 @@ interface PreviewPlan extends PlanBase {
73
81
  /** A safe integer of at least 1. */
74
82
  readonly participantCount: number;
75
83
  }
76
- /** The model driving a desktop participant. `caller` is the library caller's buildProvider. */
84
+ /**
85
+ * The model driving a desktop participant. `caller` is the library caller's createProvider.
86
+ * `declaredModel` is actors[0].model as the lab wrote it, absent when undeclared: the providers
87
+ * take it as written, and spend is priced at it, else the default (pricedModel). An openai
88
+ * brain's `model` is the one its provider runs, with that default applied.
89
+ */
77
90
  export type Brain = {
78
91
  readonly kind: "openai";
79
92
  readonly model: string;
93
+ readonly declaredModel?: string;
80
94
  } | {
81
95
  readonly kind: "local-agent";
82
96
  readonly agent: LocalAgentId;
97
+ readonly declaredModel?: string;
83
98
  } | {
84
99
  readonly kind: "caller";
100
+ readonly declaredModel?: string;
85
101
  };
86
102
  export type ProvisionedSubject = {
87
103
  readonly kind: "clone";
@@ -99,6 +115,11 @@ export interface AppUrlSubject {
99
115
  readonly kind: "app-url";
100
116
  readonly appUrl: string;
101
117
  readonly publicTargets: boolean;
118
+ /**
119
+ * A `subject.serve.url` declared on this subject, which the parser refuses and only a library
120
+ * config can carry. Participants map links to it back to their own app.
121
+ */
122
+ readonly serveUrl?: string;
102
123
  }
103
124
  /**
104
125
  * Supported subject and desktop pairings. The local VM also takes public targets: the route runs
@@ -111,6 +132,8 @@ export type ComputerUseRunner = {
111
132
  readonly subject: AppUrlSubject | ProvisionedSubject | {
112
133
  readonly kind: "desktop-cli";
113
134
  readonly product: LabSubjectProduct;
135
+ /** As on AppUrlSubject: a library config's declared `subject.serve.url`. */
136
+ readonly serveUrl?: string;
114
137
  };
115
138
  } | {
116
139
  readonly desktop: "local-vm";
@@ -121,9 +144,9 @@ export type ComputerUseRunner = {
121
144
  /** The caller's executor and provider together; one participant. */
122
145
  | {
123
146
  readonly desktop: "in-process";
124
- readonly brain: {
125
- readonly kind: "caller";
126
- };
147
+ readonly brain: Extract<Brain, {
148
+ kind: "caller";
149
+ }>;
127
150
  readonly participants: readonly [ComputerUseParticipant];
128
151
  readonly subject: AppUrlSubject | {
129
152
  readonly kind: "local-app";
@@ -193,7 +216,10 @@ export type TerminalPlan = PlanBase & {
193
216
  readonly mission?: string;
194
217
  readonly runtime: {
195
218
  readonly version?: string;
196
- readonly model?: string;
219
+ /** Passed to Codex as `--model` on every run, so the bundle can name and price it. */
220
+ readonly model: string;
221
+ /** `declared` by the lab's actor, or humanish's participant default. */
222
+ readonly modelSource: "declared" | "humanish_default";
197
223
  readonly reasoningEffort?: ReasoningEffort;
198
224
  readonly auth?: LabRuntimeAuth;
199
225
  };
@@ -1,17 +1,9 @@
1
- import type { RunLabOptions } from "../run-lab.js";
1
+ import type { InternalRunLabOptions } from "../run-lab.js";
2
+ import type { LabDeps } from "./lab-deps.js";
2
3
  import type { PlanResult } from "./plan-types.js";
3
4
  import type { LabConfig } from "./types.js";
4
5
  /** The five execution paths a lab can take. */
5
6
  export type LabRoute = "preview" | "computer-use" | "shared-world" | "terminal" | "scripted";
6
- /** A route's older name, kept in `LabOutcome.backend` and the preflight result's `backend`. */
7
- export type LabBackend = "synthetic" | "cua" | "scripted" | "terminal" | "concurrent-shared-world";
8
- /** The backend name older callers and wire fields use for a route. */
9
- export declare function backendOf(route: LabRoute): LabBackend;
10
- /**
11
- * The backend a config runs on: `routeOf`, under its older name.
12
- * @deprecated Use `routeOf`, and `backendOf` for the older backend name. This goes in the next minor.
13
- */
14
- export declare function selectLabBackend(config: LabConfig): LabBackend;
15
7
  /**
16
8
  * The route a config takes. It never refuses: a config no route can run still gets the route
17
9
  * whose own checks refuse it with the most precise reason.
@@ -24,4 +16,4 @@ export declare function resolveLabDryRun(config: LabConfig, override: boolean |
24
16
  * makes every refusal that route makes, in the route's order and with its codes and messages; the
25
17
  * route's exported runner calls the same planner.
26
18
  */
27
- export declare function planLab(config: LabConfig, options: RunLabOptions): PlanResult;
19
+ export declare function planLab(config: LabConfig, options: InternalRunLabOptions, deps?: LabDeps): PlanResult;
package/dist/lab/plan.js CHANGED
@@ -1,10 +1,9 @@
1
1
  // The route decision. A lab's route follows from its composition (subject.source,
2
2
  // execution.target, the first actor's registered lane, subject.topology), never from a declared
3
- // kind. This is the only function that decides it; backendOf maps its answer to the older
4
- // backend names.
3
+ // kind. This is the only function that decides it.
5
4
  import { resolveAutomaticAnalysis } from "../analysis/automatic-config.js";
6
- import { planComputerUseLab } from "../routes/computer-use/plan.js";
7
- import { planScriptedLab } from "../routes/scripted/plan.js";
5
+ import { callerDrivingOf, planComputerUseLab } from "../routes/computer-use/plan.js";
6
+ import { injectedBrowser, planScriptedLab } from "../routes/scripted/plan.js";
8
7
  import { planSharedWorldLab } from "../routes/shared-world/plan.js";
9
8
  import { planTerminalLab } from "../routes/terminal/plan.js";
10
9
  import { localBrowserDefaults } from "../substrates/local/runtime-config.js";
@@ -12,24 +11,6 @@ import { THIS_REPO_DRY_RUN_ONLY } from "./composition-rules.js";
12
11
  import { planBase } from "./plan-base.js";
13
12
  import { isComputerUseComposition, isScriptedBrowserComposition, isSharedWorldComposition, isTerminalProductComposition, } from "./routing.js";
14
13
  import { automaticAnalysisRouteReason, taskProtocolValidationReason } from "./validation.js";
15
- const BACKENDS = {
16
- preview: "synthetic",
17
- "computer-use": "cua",
18
- "shared-world": "concurrent-shared-world",
19
- terminal: "terminal",
20
- scripted: "scripted",
21
- };
22
- /** The backend name older callers and wire fields use for a route. */
23
- export function backendOf(route) {
24
- return BACKENDS[route];
25
- }
26
- /**
27
- * The backend a config runs on: `routeOf`, under its older name.
28
- * @deprecated Use `routeOf`, and `backendOf` for the older backend name. This goes in the next minor.
29
- */
30
- export function selectLabBackend(config) {
31
- return backendOf(routeOf(config));
32
- }
33
14
  /**
34
15
  * The route a config takes. It never refuses: a config no route can run still gets the route
35
16
  * whose own checks refuse it with the most precise reason.
@@ -43,8 +24,8 @@ export function routeOf(config) {
43
24
  // route refuses the actor instead of another route running something else.
44
25
  if (isTerminalProductComposition(config) || source === "terminal-product")
45
26
  return "terminal";
46
- // Checked before computer use: the same composition without the topology declaration runs as
47
- // independent lanes.
27
+ // Checked before computer use: the same composition without the topology declaration runs
28
+ // independent participants.
48
29
  if (isSharedWorldComposition(config))
49
30
  return "shared-world";
50
31
  // A CLI studied at a desktop is a computer-use study whose subject is a terminal window.
@@ -115,42 +96,37 @@ function planPreview(config, options, input) {
115
96
  * makes every refusal that route makes, in the route's order and with its codes and messages; the
116
97
  * route's exported runner calls the same planner.
117
98
  */
118
- export function planLab(config, options) {
99
+ export function planLab(config, options, deps = {}) {
119
100
  const lab = localBrowserDefaults(config);
120
- const input = {
121
- dryRun: resolveLabDryRun(lab, options.dryRun, true) ?? true,
122
- ...(options.lab === undefined ? {} : { lab: options.lab }),
123
- };
124
- const result = planRoute(routeOf(config), lab, options, input);
101
+ const input = { dryRun: resolveLabDryRun(lab, options.dryRun, true) ?? true };
102
+ const result = planRoute(routeOf(config), lab, options, input, deps);
125
103
  if (!result.ok)
126
104
  return result;
127
- return { ok: true, planned: { plan: result.plan } };
105
+ // The manifest the CLI resolved (#455) enters the plan here and nowhere else; the routes read
106
+ // plan.lab for the run's status record and bundle.
107
+ const plan = options.lab === undefined ? result.plan : { ...result.plan, lab: options.lab };
108
+ return { ok: true, planned: { plan } };
128
109
  }
129
- function planRoute(route, lab, options, input) {
110
+ function planRoute(route, lab, options, input, deps) {
130
111
  switch (route) {
131
112
  case "preview":
132
113
  return planPreview(lab, options, input);
133
114
  case "computer-use":
134
115
  return planComputerUseLab(lab, {
135
116
  ...input,
136
- ...(options.cuaHooks === undefined ? {} : { hooks: options.cuaHooks }),
117
+ hasRunSession: deps.runSession !== undefined,
118
+ driving: callerDrivingOf(options),
137
119
  ...(options.count === undefined ? {} : { countOverride: options.count }),
138
120
  ...(options.rerun === undefined ? {} : { rerun: options.rerun }),
139
121
  });
140
122
  case "shared-world":
141
123
  return planSharedWorldLab(lab, {
142
124
  ...input,
143
- ...(options.sharedWorldHooks === undefined ? {} : { hooks: options.sharedWorldHooks }),
125
+ hasRunSession: deps.runSession !== undefined,
144
126
  });
145
127
  case "terminal":
146
- return planTerminalLab(lab, {
147
- ...input,
148
- ...(options.terminalHooks === undefined ? {} : { hooks: options.terminalHooks }),
149
- });
128
+ return planTerminalLab(lab, { ...input, hasCostProbe: deps.costProbe !== undefined });
150
129
  case "scripted":
151
- return planScriptedLab(lab, {
152
- ...input,
153
- ...(options.scriptedHooks === undefined ? {} : { hooks: options.scriptedHooks }),
154
- });
130
+ return planScriptedLab(lab, { ...input, injectedBrowser: injectedBrowser(deps) });
155
131
  }
156
132
  }
@@ -1,6 +1,5 @@
1
1
  // The preflight result a run returns, built from its context. preflight.ts and the probes in
2
2
  // preflight-probes.ts both finish through these, so they live below both.
3
- import { backendOf } from "./plan.js";
4
3
  import { automaticAnalysisBudget } from "../analysis/automatic-config.js";
5
4
  import { digestText } from "../evidence/redaction.js";
6
5
  export const LAB_PREFLIGHT_SCHEMA = "humanish.lab-preflight-result.v1";
@@ -17,7 +16,6 @@ export function finalize(ctx, args) {
17
16
  labId: ctx.labId,
18
17
  origin: ctx.origin,
19
18
  path: ctx.path,
20
- backend: backendOf(ctx.route),
21
19
  route: ctx.route,
22
20
  reachability: ctx.reachability,
23
21
  checks,
@@ -2,7 +2,6 @@ import type { AutomaticAnalysisBudget } from "../analysis/automatic-config.js";
2
2
  import type { E2BDesktopModule } from "../substrates/e2b/sdk.js";
3
3
  import { type LabConfig } from "./types.js";
4
4
  import { LAB_PREFLIGHT_SCHEMA } from "./preflight-result.js";
5
- import type { LabBackend } from "./plan.js";
6
5
  import { type LabRoute } from "./plan.js";
7
6
  import { type LabResolveFailure } from "./discover.js";
8
7
  export type LabPreflightReachabilityMode = "metadata" | "public-preview" | "sandbox-loopback" | "prepared-host";
@@ -46,8 +45,6 @@ export interface LabPreflightResult {
46
45
  labId?: string;
47
46
  origin?: string;
48
47
  path?: string;
49
- /** The route's older name; `route` is the current one. */
50
- backend?: LabBackend;
51
48
  route?: LabRoute;
52
49
  reachability: LabPreflightReachabilityMode;
53
50
  checks: LabPreflightCheck[];
@@ -48,7 +48,7 @@ export async function runLabPreflight(options) {
48
48
  hooks: options.hooks ?? {},
49
49
  checks: [
50
50
  { name: "lab manifest", ok: true, message: `resolved ${resolved.origin} lab manifest` },
51
- { name: "backend", ok: true, message: `selected the ${route} route` },
51
+ { name: "route", ok: true, message: `selected the ${route} route` },
52
52
  ],
53
53
  targets: collectTargets(resolved.config),
54
54
  sandbox: { created: false },
@@ -0,0 +1,20 @@
1
+ import type { LabPlan, Requirement } from "./plan-types.js";
2
+ /** The `key` requirements whose value `env` lacks, OPENAI_API_KEY before E2B_API_KEY. */
3
+ export declare function missingKeys(requirements: readonly Requirement[], env: Record<string, string | undefined>): string[];
4
+ /** The subject env names the requirements list and `env` lacks, in declaration order. */
5
+ export declare function missingSubjectEnv(requirements: readonly Requirement[], env: Record<string, string | undefined>): string[];
6
+ /**
7
+ * The provider keys the requirements name, in plan order. A `key-one-of` names the first of its
8
+ * keys that `isPresent` reports, else OPENAI_API_KEY.
9
+ */
10
+ export declare function requiredKeys(requirements: readonly Requirement[], isPresent: (name: string) => boolean): string[];
11
+ /** The subject env names the requirements list, in declaration order. */
12
+ export declare function requiredSubjectEnv(requirements: readonly Requirement[]): string[];
13
+ /**
14
+ * The provider keys a live run of `plan` is known to read: its `key` and `key-one-of` names, its
15
+ * subject env, the external catch's token variable, ANTHROPIC_API_KEY for a Claude Code
16
+ * participant, and OPENAI_API_KEY when automatic analysis runs on OpenAI. `lab run` prints a
17
+ * key-source line for these only. Discovery still fills every key it finds: other readers, such as
18
+ * a declared scorer's host code, are not in the plan.
19
+ */
20
+ export declare function keyNamesOf(plan: LabPlan): ReadonlySet<string>;
@@ -0,0 +1,54 @@
1
+ /** Provider keys in the order the routes name them in a refusal. */
2
+ const KEY_ORDER = ["OPENAI_API_KEY", "E2B_API_KEY"];
3
+ const present = (env, name) => (env[name]?.trim() ?? "") !== "";
4
+ /** The `key` requirements whose value `env` lacks, OPENAI_API_KEY before E2B_API_KEY. */
5
+ export function missingKeys(requirements, env) {
6
+ const required = new Set(requirements.flatMap((requirement) => (requirement.kind === "key" ? [requirement.name] : [])));
7
+ return KEY_ORDER.filter((name) => required.has(name) && !present(env, name));
8
+ }
9
+ /** The subject env names the requirements list and `env` lacks, in declaration order. */
10
+ export function missingSubjectEnv(requirements, env) {
11
+ return requiredSubjectEnv(requirements).filter((name) => !present(env, name));
12
+ }
13
+ /**
14
+ * The provider keys the requirements name, in plan order. A `key-one-of` names the first of its
15
+ * keys that `isPresent` reports, else OPENAI_API_KEY.
16
+ */
17
+ export function requiredKeys(requirements, isPresent) {
18
+ return requirements.flatMap((requirement) => {
19
+ if (requirement.kind === "key")
20
+ return [requirement.name];
21
+ if (requirement.kind === "key-one-of")
22
+ return [requirement.names.find(isPresent) ?? requirement.names[1]];
23
+ return [];
24
+ });
25
+ }
26
+ /** The subject env names the requirements list, in declaration order. */
27
+ export function requiredSubjectEnv(requirements) {
28
+ return requirements.flatMap((requirement) => requirement.kind === "subject-env" ? requirement.names : []);
29
+ }
30
+ /**
31
+ * The provider keys a live run of `plan` is known to read: its `key` and `key-one-of` names, its
32
+ * subject env, the external catch's token variable, ANTHROPIC_API_KEY for a Claude Code
33
+ * participant, and OPENAI_API_KEY when automatic analysis runs on OpenAI. `lab run` prints a
34
+ * key-source line for these only. Discovery still fills every key it finds: other readers, such as
35
+ * a declared scorer's host code, are not in the plan.
36
+ */
37
+ export function keyNamesOf(plan) {
38
+ const names = new Set();
39
+ for (const requirement of plan.requirements) {
40
+ if (requirement.kind === "key")
41
+ names.add(requirement.name);
42
+ if (requirement.kind === "key-one-of" || requirement.kind === "subject-env")
43
+ for (const name of requirement.names)
44
+ names.add(name);
45
+ if (requirement.kind === "local-agent" && requirement.agent === "claude")
46
+ names.add("ANTHROPIC_API_KEY");
47
+ }
48
+ const catchToken = plan.residual.comms?.email?.external?.authTokenEnv;
49
+ if (catchToken !== undefined)
50
+ names.add(catchToken);
51
+ if (plan.analysis !== undefined && plan.analysis.config.provider !== "codex")
52
+ names.add("OPENAI_API_KEY");
53
+ return names;
54
+ }
@@ -1,17 +1,28 @@
1
- import type { RunLabOptions } from "../run-lab.js";
1
+ import type { InternalRunLabOptions } from "../run-lab.js";
2
+ import type { RunScorerProvenance } from "../run/bundle.js";
3
+ import { type AdapterScorerModule } from "./adapter-scorer-loader.js";
4
+ import type { LabDeps } from "./lab-deps.js";
5
+ import type { LabEvent } from "./run-lab-events.js";
2
6
  import type { ComputerUseRunInput } from "../routes/computer-use/types.js";
3
7
  import type { ScriptedRunInput } from "../routes/scripted/types.js";
4
8
  import type { SharedWorldRunInput } from "../routes/shared-world/types.js";
5
9
  import type { TerminalRunInput } from "../routes/terminal/types.js";
6
- export declare function computerUseInput(options: RunLabOptions): ComputerUseRunInput;
7
- export declare function scriptedInput(options: RunLabOptions): ScriptedRunInput;
8
- export declare function terminalInput(options: RunLabOptions): TerminalRunInput;
9
- export declare function sharedWorldInput(options: RunLabOptions): SharedWorldRunInput;
10
+ export declare function computerUseInput(options: InternalRunLabOptions, deps: LabDeps, emit: LabEmit | undefined): ComputerUseRunInput;
11
+ export declare function scriptedInput(options: InternalRunLabOptions, deps: LabDeps, emit: LabEmit | undefined): ScriptedRunInput;
12
+ export declare function terminalInput(options: InternalRunLabOptions, deps: LabDeps, emit: LabEmit | undefined): TerminalRunInput;
13
+ export declare function sharedWorldInput(options: InternalRunLabOptions, deps: LabDeps, emit: LabEmit | undefined): SharedWorldRunInput;
10
14
  /** A scorer the CLI loads after the route's local checks, and the provenance it stamps on the run. */
11
- export type LateScorer = Pick<RunLabOptions, "scorer" | "scorerProvenance">;
12
- /** The computer-use input with a scorer loaded after admission (see withLateScorer). */
13
- export declare function computerUseInputWithScorer(input: ComputerUseRunInput, late: LateScorer | undefined): ComputerUseRunInput;
14
- /** The shared-world input with a scorer loaded after admission (see withLateScorer). */
15
- export declare function sharedWorldInputWithScorer(input: SharedWorldRunInput, late: LateScorer | undefined): SharedWorldRunInput;
16
- /** The terminal input with a scorer loaded after admission. Terminal runs take no deriveArtifacts. */
17
- export declare function terminalInputWithScorer(input: TerminalRunInput, late: LateScorer | undefined): TerminalRunInput;
15
+ export type LateScorer = Pick<InternalRunLabOptions, "scorer" | "scorerProvenance">;
16
+ /** Narrows RunLabOptions.scorer to the context the route passes (adapter-scorer-loader.ts). */
17
+ type NarrowScorer<S> = (scorer: AdapterScorerModule) => S;
18
+ /**
19
+ * A route's input with a scorer loaded after admission, and the scorer's provenance, as if the
20
+ * caller had passed them up front. The rest of the input is the one the route's checks admitted.
21
+ */
22
+ export declare function withLateScorer<S, I extends {
23
+ scorer?: S;
24
+ scorerProvenance?: RunScorerProvenance;
25
+ }>(input: I, late: LateScorer | undefined, narrow: NarrowScorer<S>): I;
26
+ /** Reports a LabEvent to onEvent without waiting (normalizeRunLabOptions builds it). */
27
+ type LabEmit = (event: LabEvent) => void;
28
+ export {};