humanish 0.108.0 → 0.109.1

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 (461) hide show
  1. package/ARCHITECTURE.md +58 -59
  2. package/CHANGELOG.md +22 -0
  3. package/CONTEXT.md +44 -44
  4. package/README.md +3 -3
  5. package/TELEMETRY.md +2 -2
  6. package/dist/actors/codex/app-server-trace.js +2 -1
  7. package/dist/actors/codex/restricted-participant.js +12 -12
  8. package/dist/actors/codex/restricted-session.d.ts +2 -2
  9. package/dist/actors/computer-use/actor.d.ts +6 -6
  10. package/dist/actors/computer-use/actor.js +2 -2
  11. package/dist/actors/computer-use/admission-limit.d.ts +2 -2
  12. package/dist/actors/computer-use/admission-limit.js +3 -3
  13. package/dist/actors/computer-use/executor-error.d.ts +2 -2
  14. package/dist/actors/computer-use/executor-error.js +3 -3
  15. package/dist/actors/computer-use/loop/actions.js +5 -5
  16. package/dist/actors/computer-use/loop/debrief.js +2 -2
  17. package/dist/actors/computer-use/loop/ending.d.ts +1 -1
  18. package/dist/actors/computer-use/loop/ending.js +12 -11
  19. package/dist/actors/computer-use/loop/observation.js +6 -5
  20. package/dist/actors/computer-use/loop/provider-call.js +11 -11
  21. package/dist/actors/computer-use/loop/session.d.ts +4 -4
  22. package/dist/actors/computer-use/loop/session.js +2 -2
  23. package/dist/actors/computer-use/loop/trace.js +3 -2
  24. package/dist/actors/computer-use/loop/types.d.ts +24 -24
  25. package/dist/actors/computer-use/loop/usage.d.ts +2 -2
  26. package/dist/actors/computer-use/loop.d.ts +6 -1
  27. package/dist/actors/computer-use/loop.js +26 -4
  28. package/dist/actors/computer-use/openai-provider.d.ts +2 -2
  29. package/dist/actors/computer-use/openai-provider.js +8 -8
  30. package/dist/actors/computer-use/provider-error.d.ts +4 -4
  31. package/dist/actors/computer-use/provider-error.js +6 -6
  32. package/dist/actors/contract.d.ts +4 -4
  33. package/dist/actors/contract.js +1 -1
  34. package/dist/actors/local-agent/claude-session.js +3 -3
  35. package/dist/actors/local-agent/cli.d.ts +1 -1
  36. package/dist/actors/local-agent/cli.js +1 -1
  37. package/dist/actors/reasoning-effort.js +3 -3
  38. package/dist/actors/registry.d.ts +2 -2
  39. package/dist/actors/registry.js +3 -3
  40. package/dist/actors/scripted-browser/actor.d.ts +2 -2
  41. package/dist/actors/scripted-browser/actor.js +1 -1
  42. package/dist/analysis/automatic-completion.d.ts +7 -7
  43. package/dist/analysis/automatic-completion.js +1 -1
  44. package/dist/analysis/automatic-config.d.ts +6 -6
  45. package/dist/analysis/automatic-config.js +1 -1
  46. package/dist/analysis/execute.d.ts +1 -1
  47. package/dist/analysis/execute.js +1 -1
  48. package/dist/analysis/types.d.ts +6 -0
  49. package/dist/browser-control/client.js +16 -16
  50. package/dist/browser-control/dispatcher.js +4 -4
  51. package/dist/browser-control/protocol.js +14 -14
  52. package/dist/browser-control/recording-transfer.js +4 -4
  53. package/dist/browser-control/transport.js +7 -7
  54. package/dist/cli/commands/analysis-signals.d.ts +2 -2
  55. package/dist/cli/commands/comms.js +14 -22
  56. package/dist/cli/commands/migrate.js +15 -4
  57. package/dist/cli/commands/observe.d.ts +0 -1
  58. package/dist/cli/commands/observe.js +0 -15
  59. package/dist/cli/commands/run-command.d.ts +2 -2
  60. package/dist/cli/commands/run-command.js +3 -3
  61. package/dist/cli/commands/runs.js +9 -7
  62. package/dist/cli/commands/setup.js +5 -7
  63. package/dist/cli/commands/study-format.d.ts +9 -0
  64. package/dist/cli/commands/{lab-format.js → study-format.js} +5 -5
  65. package/dist/cli/commands/{lab-route-computer-use.d.ts → study-route-computer-use.d.ts} +6 -6
  66. package/dist/cli/commands/{lab-route-computer-use.js → study-route-computer-use.js} +12 -12
  67. package/dist/cli/commands/{lab-route-open.d.ts → study-route-open.d.ts} +4 -4
  68. package/dist/cli/commands/{lab-route-open.js → study-route-open.js} +2 -2
  69. package/dist/cli/commands/{lab-route-preview.d.ts → study-route-preview.d.ts} +7 -7
  70. package/dist/cli/commands/{lab-route-preview.js → study-route-preview.js} +3 -3
  71. package/dist/cli/commands/study-route-run.d.ts +19 -0
  72. package/dist/cli/commands/{lab-route-run.js → study-route-run.js} +6 -6
  73. package/dist/cli/commands/study-route-scripted.d.ts +17 -0
  74. package/dist/cli/commands/{lab-route-scripted.js → study-route-scripted.js} +4 -4
  75. package/dist/cli/commands/{lab-route-shared-world.d.ts → study-route-shared-world.d.ts} +5 -5
  76. package/dist/cli/commands/{lab-route-shared-world.js → study-route-shared-world.js} +7 -7
  77. package/dist/cli/commands/study-route-terminal.d.ts +17 -0
  78. package/dist/cli/commands/{lab-route-terminal.js → study-route-terminal.js} +4 -4
  79. package/dist/cli/commands/study-run.d.ts +9 -0
  80. package/dist/cli/commands/{lab-run.js → study-run.js} +34 -34
  81. package/dist/cli/commands/{lab-scorer.d.ts → study-scorer.d.ts} +5 -5
  82. package/dist/cli/commands/{lab-scorer.js → study-scorer.js} +1 -1
  83. package/dist/cli/commands/study.js +13 -49
  84. package/dist/cli/commands/tui.js +12 -12
  85. package/dist/cli/commands/watch.js +30 -65
  86. package/dist/cli/deprecations.d.ts +1 -13
  87. package/dist/cli/deprecations.js +0 -30
  88. package/dist/cli/doctor.d.ts +3 -3
  89. package/dist/cli/doctor.js +16 -16
  90. package/dist/cli/first-run-path.d.ts +4 -4
  91. package/dist/cli/first-run-path.js +7 -7
  92. package/dist/cli/io.d.ts +3 -3
  93. package/dist/cli/io.js +2 -2
  94. package/dist/cli/observer-follow.d.ts +2 -2
  95. package/dist/cli/observer-follow.js +2 -2
  96. package/dist/cli/orientation.d.ts +4 -4
  97. package/dist/cli/orientation.js +58 -20
  98. package/dist/cli/program.js +3 -4
  99. package/dist/cli/telemetry.d.ts +1 -1
  100. package/dist/cli/telemetry.js +14 -20
  101. package/dist/comms/catch-host.d.ts +1 -1
  102. package/dist/comms/catch-host.js +3 -3
  103. package/dist/comms/connections.d.ts +1 -1
  104. package/dist/comms/connections.js +2 -2
  105. package/dist/comms/external-evidence.d.ts +5 -5
  106. package/dist/comms/external-evidence.js +4 -3
  107. package/dist/comms/fake-inbox.d.ts +2 -2
  108. package/dist/comms/fake-inbox.js +2 -2
  109. package/dist/comms/receiving-runtime.d.ts +4 -4
  110. package/dist/comms/sandbox-catch.d.ts +2 -2
  111. package/dist/comms/sandbox-catch.js +2 -2
  112. package/dist/comms/setup.d.ts +2 -2
  113. package/dist/comms/setup.js +29 -32
  114. package/dist/evidence/redaction.d.ts +11 -0
  115. package/dist/evidence/redaction.js +43 -0
  116. package/dist/feedback/draft.js +2 -2
  117. package/dist/feedback/export-bundle.js +5 -4
  118. package/dist/feedback/export.js +3 -2
  119. package/dist/feedback/proof.d.ts +1 -1
  120. package/dist/feedback/proof.js +2 -2
  121. package/dist/guest/bootstrap.js +6 -6
  122. package/dist/guest/browser-tools.js +8 -8
  123. package/dist/guest/chromium-text.js +17 -17
  124. package/dist/guest/desktop-executor.d.ts +2 -2
  125. package/dist/guest/desktop-executor.js +20 -20
  126. package/dist/guest/desktop-keys.js +4 -4
  127. package/dist/guest/desktop-media.d.ts +2 -2
  128. package/dist/guest/desktop-media.js +16 -16
  129. package/dist/guest/desktop-native.js +10 -10
  130. package/dist/guest/runtime-desktop.js +2 -2
  131. package/dist/guest/runtime-processes.d.ts +2 -2
  132. package/dist/guest/runtime-processes.js +2 -2
  133. package/dist/guest/runtime.js +5 -5
  134. package/dist/index.d.ts +13 -15
  135. package/dist/index.js +6 -8
  136. package/dist/observer/artifact.d.ts +1 -1
  137. package/dist/observer/artifact.js +1 -1
  138. package/dist/observer/data.d.ts +1 -1
  139. package/dist/observer/library.d.ts +2 -0
  140. package/dist/observer/library.js +4 -1
  141. package/dist/observer/render.js +7 -1
  142. package/dist/observer/run-routes.d.ts +1 -0
  143. package/dist/observer/run-routes.js +37 -12
  144. package/dist/observer/serve.d.ts +1 -1
  145. package/dist/observer-app.html +1 -1
  146. package/dist/routes/computer-use/bundle-parts.js +3 -2
  147. package/dist/routes/computer-use/bundle.d.ts +2 -2
  148. package/dist/routes/computer-use/bundle.js +7 -6
  149. package/dist/routes/computer-use/e2b-desktop/comms.d.ts +5 -5
  150. package/dist/routes/computer-use/e2b-desktop/comms.js +5 -4
  151. package/dist/routes/computer-use/e2b-desktop/fidelity.d.ts +1 -1
  152. package/dist/routes/computer-use/e2b-desktop/prepare.d.ts +1 -1
  153. package/dist/routes/computer-use/e2b-desktop/prepare.js +3 -3
  154. package/dist/routes/computer-use/e2b-desktop/start.js +3 -4
  155. package/dist/routes/computer-use/e2b-desktop/state.d.ts +2 -2
  156. package/dist/routes/computer-use/e2b-desktop/teardown.js +2 -3
  157. package/dist/routes/computer-use/external-comms.d.ts +3 -3
  158. package/dist/routes/computer-use/fanout-bundle.js +11 -10
  159. package/dist/routes/computer-use/fanout-records.js +2 -2
  160. package/dist/routes/computer-use/in-process-desktop.js +1 -1
  161. package/dist/routes/computer-use/live-flush.d.ts +3 -3
  162. package/dist/routes/computer-use/live-phase.d.ts +2 -3
  163. package/dist/routes/computer-use/live-phase.js +3 -3
  164. package/dist/routes/computer-use/local-tree-pack.d.ts +5 -5
  165. package/dist/routes/computer-use/local-tree-pack.js +1 -1
  166. package/dist/routes/computer-use/local-vm.d.ts +8 -8
  167. package/dist/routes/computer-use/local-vm.js +2 -2
  168. package/dist/routes/computer-use/participant-desktop.d.ts +3 -3
  169. package/dist/routes/computer-use/participant-desktop.js +1 -1
  170. package/dist/routes/computer-use/participant-execution.js +1 -1
  171. package/dist/routes/computer-use/participant-model.js +3 -3
  172. package/dist/routes/computer-use/participant-prompt.d.ts +5 -5
  173. package/dist/routes/computer-use/participant-prompt.js +3 -3
  174. package/dist/routes/computer-use/participant-runs.d.ts +10 -10
  175. package/dist/routes/computer-use/participant-runs.js +14 -13
  176. package/dist/routes/computer-use/plan.d.ts +12 -12
  177. package/dist/routes/computer-use/plan.js +27 -27
  178. package/dist/routes/computer-use/preflight.d.ts +5 -5
  179. package/dist/routes/computer-use/preflight.js +5 -5
  180. package/dist/routes/computer-use/rerun-selection.d.ts +1 -1
  181. package/dist/routes/computer-use/rerun-selection.js +3 -2
  182. package/dist/routes/computer-use/result.d.ts +4 -4
  183. package/dist/routes/computer-use/result.js +13 -12
  184. package/dist/routes/computer-use/route.d.ts +12 -12
  185. package/dist/routes/computer-use/route.js +19 -19
  186. package/dist/routes/computer-use/self-report.js +1 -1
  187. package/dist/routes/computer-use/setup.d.ts +22 -22
  188. package/dist/routes/computer-use/setup.js +15 -15
  189. package/dist/routes/computer-use/single-bundle.d.ts +4 -4
  190. package/dist/routes/computer-use/single-bundle.js +14 -13
  191. package/dist/routes/computer-use/subject-projection.d.ts +3 -3
  192. package/dist/routes/computer-use/types.d.ts +34 -34
  193. package/dist/routes/computer-use/types.js +3 -3
  194. package/dist/routes/preview.d.ts +6 -6
  195. package/dist/routes/preview.js +5 -5
  196. package/dist/routes/scripted/bundle.d.ts +6 -6
  197. package/dist/routes/scripted/bundle.js +10 -9
  198. package/dist/routes/scripted/plan.d.ts +7 -7
  199. package/dist/routes/scripted/plan.js +6 -6
  200. package/dist/routes/scripted/result.d.ts +3 -3
  201. package/dist/routes/scripted/result.js +9 -9
  202. package/dist/routes/scripted/route.d.ts +9 -9
  203. package/dist/routes/scripted/route.js +11 -11
  204. package/dist/routes/scripted/scenario.d.ts +1 -1
  205. package/dist/routes/scripted/scenario.js +3 -3
  206. package/dist/routes/scripted/setup.d.ts +6 -6
  207. package/dist/routes/scripted/setup.js +4 -4
  208. package/dist/routes/scripted/subject.d.ts +5 -5
  209. package/dist/routes/scripted/subject.js +3 -3
  210. package/dist/routes/scripted/surface-records.d.ts +1 -1
  211. package/dist/routes/scripted/surface-records.js +2 -2
  212. package/dist/routes/scripted/surface-sessions.d.ts +3 -3
  213. package/dist/routes/scripted/types.d.ts +17 -17
  214. package/dist/routes/scripted/types.js +1 -1
  215. package/dist/routes/shared-world/bundle-records.js +3 -3
  216. package/dist/routes/shared-world/bundle.js +15 -14
  217. package/dist/routes/shared-world/checkpoints.d.ts +3 -3
  218. package/dist/routes/shared-world/checkpoints.js +1 -1
  219. package/dist/routes/shared-world/comms.d.ts +9 -9
  220. package/dist/routes/shared-world/comms.js +6 -5
  221. package/dist/routes/shared-world/participant-specs.d.ts +3 -3
  222. package/dist/routes/shared-world/participant-specs.js +7 -7
  223. package/dist/routes/shared-world/plan.d.ts +9 -9
  224. package/dist/routes/shared-world/plan.js +9 -9
  225. package/dist/routes/shared-world/provisioned.d.ts +8 -8
  226. package/dist/routes/shared-world/provisioned.js +4 -4
  227. package/dist/routes/shared-world/result.d.ts +6 -6
  228. package/dist/routes/shared-world/result.js +11 -10
  229. package/dist/routes/shared-world/route.d.ts +11 -11
  230. package/dist/routes/shared-world/route.js +19 -19
  231. package/dist/routes/shared-world/setup.d.ts +13 -13
  232. package/dist/routes/shared-world/setup.js +19 -19
  233. package/dist/routes/shared-world/types.d.ts +27 -27
  234. package/dist/routes/terminal/adapter.d.ts +2 -2
  235. package/dist/routes/terminal/adapter.js +4 -4
  236. package/dist/routes/terminal/bundle.d.ts +11 -11
  237. package/dist/routes/terminal/bundle.js +12 -12
  238. package/dist/routes/terminal/credentials.d.ts +4 -4
  239. package/dist/routes/terminal/credentials.js +5 -5
  240. package/dist/routes/terminal/dry-run.d.ts +4 -4
  241. package/dist/routes/terminal/dry-run.js +9 -9
  242. package/dist/routes/terminal/ledger.d.ts +2 -2
  243. package/dist/routes/terminal/lifetime.d.ts +1 -1
  244. package/dist/routes/terminal/lifetime.js +1 -1
  245. package/dist/routes/terminal/live-finish.d.ts +2 -2
  246. package/dist/routes/terminal/live-finish.js +7 -7
  247. package/dist/routes/terminal/live-sandbox.d.ts +2 -2
  248. package/dist/routes/terminal/live-sandbox.js +3 -2
  249. package/dist/routes/terminal/participant-text.js +2 -1
  250. package/dist/routes/terminal/persona.d.ts +2 -2
  251. package/dist/routes/terminal/persona.js +2 -2
  252. package/dist/routes/terminal/plan.d.ts +7 -7
  253. package/dist/routes/terminal/plan.js +5 -5
  254. package/dist/routes/terminal/result.d.ts +5 -5
  255. package/dist/routes/terminal/result.js +7 -7
  256. package/dist/routes/terminal/route.d.ts +9 -9
  257. package/dist/routes/terminal/route.js +14 -14
  258. package/dist/routes/terminal/session.d.ts +5 -5
  259. package/dist/routes/terminal/session.js +7 -7
  260. package/dist/routes/terminal/trace.d.ts +2 -2
  261. package/dist/routes/terminal/types.d.ts +24 -24
  262. package/dist/routes/terminal/types.js +2 -2
  263. package/dist/run/bundle.d.ts +7 -7
  264. package/dist/run/bundle.js +2 -2
  265. package/dist/run/costs.d.ts +23 -0
  266. package/dist/run/costs.js +72 -43
  267. package/dist/run/dry-run-inputs.d.ts +1 -1
  268. package/dist/run/dry-run-inputs.js +1 -1
  269. package/dist/run/dry-run.js +2 -2
  270. package/dist/run/outcomes.d.ts +1 -1
  271. package/dist/run/participant.d.ts +1 -1
  272. package/dist/run/preflight-receipts.js +1 -1
  273. package/dist/run/pricing.js +2 -2
  274. package/dist/run/projection.d.ts +32 -32
  275. package/dist/run/projection.js +44 -44
  276. package/dist/run/reclaim.d.ts +1 -1
  277. package/dist/run/reclaim.js +1 -1
  278. package/dist/run/results.d.ts +2 -2
  279. package/dist/run/run-cost.d.ts +53 -0
  280. package/dist/run/run-cost.js +105 -0
  281. package/dist/run/run-index-analysis.d.ts +15 -0
  282. package/dist/run/run-index-analysis.js +77 -0
  283. package/dist/run/run-index.d.ts +11 -1
  284. package/dist/run/run-index.js +63 -49
  285. package/dist/run/run.d.ts +3 -3
  286. package/dist/run/run.js +2 -2
  287. package/dist/run/shared-world-evidence.d.ts +1 -1
  288. package/dist/run/shared-world-shape.js +1 -1
  289. package/dist/run/stats.d.ts +3 -3
  290. package/dist/run/stats.js +14 -14
  291. package/dist/run/status.d.ts +10 -2
  292. package/dist/run/status.js +6 -3
  293. package/dist/run/streams.d.ts +2 -2
  294. package/dist/run/study-provenance.d.ts +4 -2
  295. package/dist/run/study-provenance.js +7 -4
  296. package/dist/run/study-result.d.ts +0 -5
  297. package/dist/run/study-result.js +1 -1
  298. package/dist/run-study.d.ts +112 -0
  299. package/dist/{run-lab.js → run-study.js} +52 -45
  300. package/dist/{lab → study}/adapter-extension.d.ts +8 -20
  301. package/dist/{lab → study}/adapter-extension.js +2 -14
  302. package/dist/{lab → study}/adapter-scorer-loader.d.ts +10 -10
  303. package/dist/{lab → study}/adapter-scorer-loader.js +3 -3
  304. package/dist/study/composition-rules.d.ts +7 -0
  305. package/dist/{lab → study}/composition-rules.js +12 -12
  306. package/dist/study/config.d.ts +15 -0
  307. package/dist/{lab → study}/config.js +37 -20
  308. package/dist/study/convert.d.ts +1 -1
  309. package/dist/study/convert.js +15 -15
  310. package/dist/{lab → study}/device-presets.d.ts +2 -2
  311. package/dist/{lab → study}/discover.d.ts +29 -23
  312. package/dist/{lab → study}/discover.js +97 -118
  313. package/dist/{lab → study}/doctor.d.ts +11 -11
  314. package/dist/{lab → study}/doctor.js +18 -18
  315. package/dist/study/files.d.ts +2 -2
  316. package/dist/study/files.js +6 -5
  317. package/dist/{lab → study}/init-templates.d.ts +2 -2
  318. package/dist/{lab → study}/init-templates.js +16 -11
  319. package/dist/{lab → study}/init.d.ts +1 -1
  320. package/dist/{lab → study}/init.js +7 -4
  321. package/dist/{lab → study}/keys.d.ts +2 -2
  322. package/dist/{lab → study}/keys.js +10 -10
  323. package/dist/study/migrate.d.ts +8 -3
  324. package/dist/study/migrate.js +60 -4
  325. package/dist/{lab → study}/parse/actors.d.ts +5 -5
  326. package/dist/{lab → study}/parse/actors.js +5 -5
  327. package/dist/study/parse/comms.d.ts +12 -0
  328. package/dist/study/parse/execution.d.ts +19 -0
  329. package/dist/{lab → study}/parse/study-v3.d.ts +3 -5
  330. package/dist/{lab → study}/parse/study-v3.js +3 -3
  331. package/dist/{lab → study}/parse/subject-state.d.ts +8 -8
  332. package/dist/{lab → study}/parse/subject-state.js +4 -4
  333. package/dist/{lab → study}/parse/subject.d.ts +3 -3
  334. package/dist/{lab → study}/parse/subject.js +8 -8
  335. package/dist/{lab → study}/parse/values.d.ts +2 -2
  336. package/dist/{lab → study}/persona-resolve.d.ts +4 -4
  337. package/dist/{lab → study}/persona-resolve.js +2 -2
  338. package/dist/{lab → study}/plan-base.d.ts +7 -7
  339. package/dist/{lab → study}/plan-base.js +1 -1
  340. package/dist/{lab → study}/plan-participants.d.ts +10 -10
  341. package/dist/{lab → study}/plan-participants.js +4 -4
  342. package/dist/{lab → study}/plan-types.d.ts +28 -28
  343. package/dist/{lab → study}/plan-types.js +2 -2
  344. package/dist/study/plan.d.ts +13 -0
  345. package/dist/{lab → study}/plan.js +20 -20
  346. package/dist/study/preflight-probes.d.ts +3 -0
  347. package/dist/{lab → study}/preflight-probes.js +9 -8
  348. package/dist/study/preflight-result.d.ts +8 -0
  349. package/dist/{lab → study}/preflight-result.js +3 -3
  350. package/dist/{lab → study}/preflight.d.ts +31 -31
  351. package/dist/{lab → study}/preflight.js +8 -8
  352. package/dist/{lab → study}/requirements.d.ts +3 -3
  353. package/dist/{lab → study}/requirements.js +1 -1
  354. package/dist/study/route-inputs.d.ts +28 -0
  355. package/dist/{lab → study}/route-inputs.js +1 -1
  356. package/dist/{lab → study}/routing.d.ts +12 -12
  357. package/dist/{lab/run-lab-events.d.ts → study/run-study-events.d.ts} +10 -10
  358. package/dist/{lab/run-lab-events.js → study/run-study-events.js} +4 -4
  359. package/dist/{lab/run-lab-homes.d.ts → study/run-study-homes.d.ts} +8 -17
  360. package/dist/study/run-study-homes.js +3 -0
  361. package/dist/study/run-study-options.d.ts +28 -0
  362. package/dist/{lab/run-lab-options.js → study/run-study-options.js} +16 -15
  363. package/dist/{lab/lab-deps.d.ts → study/study-deps.d.ts} +2 -2
  364. package/dist/{lab/lab-deps.js → study/study-deps.js} +2 -2
  365. package/dist/{lab → study}/summary.d.ts +10 -10
  366. package/dist/{lab → study}/summary.js +15 -15
  367. package/dist/{lab → study}/tasks.d.ts +3 -3
  368. package/dist/{lab → study}/tasks.js +1 -1
  369. package/dist/{lab → study}/types.d.ts +104 -104
  370. package/dist/{lab → study}/types.js +1 -1
  371. package/dist/{lab → study}/validation.d.ts +19 -19
  372. package/dist/{lab → study}/validation.js +13 -13
  373. package/dist/{lab → study}/warnings.d.ts +4 -4
  374. package/dist/{lab → study}/warnings.js +1 -1
  375. package/dist/subject/clone.d.ts +6 -6
  376. package/dist/subject/clone.js +2 -2
  377. package/dist/subject/local-tree-archive.d.ts +2 -2
  378. package/dist/subject/local-tree-archive.js +3 -3
  379. package/dist/subject/local-tree.d.ts +3 -3
  380. package/dist/subject/runtime.js +2 -2
  381. package/dist/subject/serve.d.ts +4 -4
  382. package/dist/subject/state.d.ts +3 -3
  383. package/dist/subject/state.js +1 -1
  384. package/dist/subject/steps.d.ts +1 -1
  385. package/dist/subject/steps.js +1 -1
  386. package/dist/substrates/desktop-session.js +2 -2
  387. package/dist/substrates/detached.d.ts +1 -1
  388. package/dist/substrates/e2b/desktop-browser.d.ts +4 -4
  389. package/dist/substrates/e2b/desktop-browser.js +1 -1
  390. package/dist/substrates/e2b/desktop-cdp.d.ts +1 -1
  391. package/dist/substrates/e2b/desktop-cdp.js +1 -1
  392. package/dist/substrates/e2b/desktop-executor.d.ts +1 -1
  393. package/dist/substrates/e2b/desktop-executor.js +12 -12
  394. package/dist/substrates/e2b/desktop-geometry.d.ts +1 -1
  395. package/dist/substrates/e2b/desktop-geometry.js +1 -1
  396. package/dist/substrates/e2b/desktop-media.d.ts +3 -3
  397. package/dist/substrates/e2b/lifetime.js +1 -1
  398. package/dist/substrates/e2b/sandbox.d.ts +3 -3
  399. package/dist/substrates/e2b/sandbox.js +1 -1
  400. package/dist/substrates/e2b/sdk.d.ts +1 -1
  401. package/dist/substrates/e2b/sdk.js +1 -1
  402. package/dist/substrates/local/runtime-config.d.ts +4 -4
  403. package/dist/substrates/local/runtime-config.js +4 -4
  404. package/dist/tui/contract.d.ts +8 -8
  405. package/dist/tui/contract.js +2 -2
  406. package/dist/tui/launch.d.ts +3 -3
  407. package/dist/tui/launch.js +22 -16
  408. package/dist/tui-app.js +139 -139
  409. package/dist/verify/subject.d.ts +1 -1
  410. package/dist/verify/subject.js +1 -1
  411. package/dist/verify/verify.js +2 -1
  412. package/docs/architecture/actor-contract.md +5 -5
  413. package/docs/architecture/browser-control.md +1 -1
  414. package/docs/architecture/external-public-shared-world.md +8 -7
  415. package/docs/architecture/github-feedback-loop.md +1 -1
  416. package/docs/architecture/task-protocol-support.md +1 -1
  417. package/docs/architecture/terminal-product-route.md +18 -18
  418. package/docs/contracts/adapter-fixtures.md +2 -2
  419. package/docs/contracts/errors.md +8 -8
  420. package/docs/contracts/run-bundle.md +6 -4
  421. package/docs/contracts/schemas.md +61 -42
  422. package/docs/contracts/study-analysis.md +4 -1
  423. package/docs/contracts/study-costs.md +17 -2
  424. package/examples/README.md +1 -1
  425. package/examples/scorer/scorer.mjs +3 -3
  426. package/package.json +2 -1
  427. package/skills/humanish/SKILL.md +8 -6
  428. package/skills/humanish/agents/openai.yaml +1 -1
  429. package/dist/cli/commands/lab-format.d.ts +0 -9
  430. package/dist/cli/commands/lab-route-run.d.ts +0 -19
  431. package/dist/cli/commands/lab-route-scripted.d.ts +0 -17
  432. package/dist/cli/commands/lab-route-terminal.d.ts +0 -17
  433. package/dist/cli/commands/lab-run.d.ts +0 -9
  434. package/dist/lab/composition-rules.d.ts +0 -7
  435. package/dist/lab/config.d.ts +0 -7
  436. package/dist/lab/deprecated-fields.d.ts +0 -10
  437. package/dist/lab/deprecated-fields.js +0 -24
  438. package/dist/lab/parse/comms.d.ts +0 -12
  439. package/dist/lab/parse/execution.d.ts +0 -19
  440. package/dist/lab/plan.d.ts +0 -13
  441. package/dist/lab/preflight-probes.d.ts +0 -3
  442. package/dist/lab/preflight-result.d.ts +0 -8
  443. package/dist/lab/route-inputs.d.ts +0 -28
  444. package/dist/lab/run-lab-homes.js +0 -7
  445. package/dist/lab/run-lab-options.d.ts +0 -28
  446. package/dist/library-aliases.d.ts +0 -56
  447. package/dist/library-aliases.js +0 -22
  448. package/dist/run-lab.d.ts +0 -112
  449. /package/dist/{lab → study}/device-presets.js +0 -0
  450. /package/dist/{lab → study}/init-paths.d.ts +0 -0
  451. /package/dist/{lab → study}/init-paths.js +0 -0
  452. /package/dist/{lab → study}/init-plan.d.ts +0 -0
  453. /package/dist/{lab → study}/init-plan.js +0 -0
  454. /package/dist/{lab → study}/parse/comms.js +0 -0
  455. /package/dist/{lab → study}/parse/execution.js +0 -0
  456. /package/dist/{lab → study}/parse/values.js +0 -0
  457. /package/dist/{lab → study}/participant-assignment.d.ts +0 -0
  458. /package/dist/{lab → study}/participant-assignment.js +0 -0
  459. /package/dist/{lab → study}/persona.d.ts +0 -0
  460. /package/dist/{lab → study}/persona.js +0 -0
  461. /package/dist/{lab → study}/routing.js +0 -0
@@ -1,6 +1,6 @@
1
1
  import {} from "../contract.js";
2
2
  import { defaultCodexCliVersion, untestedOperatorReleaseWarning } from "./codex-admission.js";
3
- import { CuaProviderError, isCuaProviderError, } from "../computer-use/provider-error.js";
3
+ import { ComputerUseProviderError, isComputerUseProviderError, } from "../computer-use/provider-error.js";
4
4
  import { validateBrowserControlPng, validateHeardSpeech } from "../../browser-control/protocol.js";
5
5
  import { createRestrictedCodexSession, } from "./restricted-session.js";
6
6
  import { PARTICIPANT_PROFILE, PARTICIPANT_LIMITS as L, PARTICIPANT_FINAL_SCHEMA, participantToolSchema, parseParticipantTool, parseParticipantFinal, } from "./restricted-participant-policy.js";
@@ -150,15 +150,15 @@ const runReceipt = (result) => ({
150
150
  */
151
151
  function finalTurn(result, receipt, usage, stopped) {
152
152
  if (stopped.stopped)
153
- throw new CuaProviderError(stopped.failedCleanup ? "cleanup_unconfirmed" : "cancelled", receipt, usage, result.failurePhase);
153
+ throw new ComputerUseProviderError(stopped.failedCleanup ? "cleanup_unconfirmed" : "cancelled", receipt, usage, result.failurePhase);
154
154
  if (result.status !== "completed" || result.errorCode !== null)
155
- throw new CuaProviderError(codeOf(result.errorCode), receipt, usage, result.failurePhase);
155
+ throw new ComputerUseProviderError(codeOf(result.errorCode), receipt, usage, result.failurePhase);
156
156
  let turn;
157
157
  try {
158
158
  turn = parseParticipantFinal(result.output);
159
159
  }
160
160
  catch {
161
- throw new CuaProviderError("invalid_response", receipt, usage, "response");
161
+ throw new ComputerUseProviderError("invalid_response", receipt, usage, "response");
162
162
  }
163
163
  return {
164
164
  ...turn,
@@ -340,9 +340,9 @@ function launchNativeRun(settings, state, req, imageUrl) {
340
340
  catch (error) {
341
341
  revokeParticipant(state);
342
342
  state.events.emit({
343
- error: isCuaProviderError(error)
343
+ error: isComputerUseProviderError(error)
344
344
  ? error
345
- : new CuaProviderError("process_failed", { dispatched: "unknown", usageComplete: false, cleanup: "unconfirmed" }, usage),
345
+ : new ComputerUseProviderError("process_failed", { dispatched: "unknown", usageComplete: false, cleanup: "unconfirmed" }, usage),
346
346
  });
347
347
  }
348
348
  finally {
@@ -356,7 +356,7 @@ async function runParticipantTurn(settings, state, req, signal, debrief) {
356
356
  return state.events.next();
357
357
  if (signal.aborted) {
358
358
  revokeParticipant(state);
359
- throw new CuaProviderError("cancelled", noDispatch());
359
+ throw new ComputerUseProviderError("cancelled", noDispatch());
360
360
  }
361
361
  const conversation = {
362
362
  instructions: state.instructions,
@@ -365,7 +365,7 @@ async function runParticipantTurn(settings, state, req, signal, debrief) {
365
365
  lastActionCount: state.lastActionCount,
366
366
  };
367
367
  if (rejectsParticipantRequest(req, conversation))
368
- throw new CuaProviderError("request_rejected", noDispatch());
368
+ throw new ComputerUseProviderError("request_rejected", noDispatch());
369
369
  const onAbort = () => {
370
370
  revokeParticipant(state);
371
371
  };
@@ -382,7 +382,7 @@ async function runParticipantTurn(settings, state, req, signal, debrief) {
382
382
  else if (!state.active)
383
383
  launchNativeRun(settings, state, req, imageUrl);
384
384
  else
385
- throw new CuaProviderError("busy", noDispatch());
385
+ throw new ComputerUseProviderError("busy", noDispatch());
386
386
  return await state.events.next();
387
387
  }
388
388
  finally {
@@ -426,7 +426,7 @@ function participantProvider(settings, state, start) {
426
426
  export function createRestrictedCodexParticipant(options = {}) {
427
427
  const timeoutMs = options.requestTimeoutMs ?? L.requestMs;
428
428
  if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > L.requestMs)
429
- throw new CuaProviderError("request_rejected", noDispatch());
429
+ throw new ComputerUseProviderError("request_rejected", noDispatch());
430
430
  const operator = options.authMode === "operator";
431
431
  const speechEnabled = options.speechEnabled === true;
432
432
  const settings = {
@@ -458,9 +458,9 @@ export function createRestrictedCodexParticipant(options = {}) {
458
458
  let pending, closing;
459
459
  const start = (req, signal, debrief) => {
460
460
  if (state.closed && !state.events.waiting)
461
- return Promise.reject(new CuaProviderError("request_rejected", noDispatch()));
461
+ return Promise.reject(new ComputerUseProviderError("request_rejected", noDispatch()));
462
462
  if (pending)
463
- return Promise.reject(new CuaProviderError("busy", noDispatch()));
463
+ return Promise.reject(new ComputerUseProviderError("busy", noDispatch()));
464
464
  const task = runParticipantTurn(settings, state, req, signal, debrief);
465
465
  pending = task;
466
466
  void task
@@ -13,8 +13,8 @@ export interface RestrictedCodexSessionOptions {
13
13
  cliVersion?: string;
14
14
  /**
15
15
  * Bypasses launch admission: admits exactly this list. It exists only so
16
- * scripts/codex-qualify.mjs can launch a candidate admission would refuse. No library export, lab
17
- * manifest, CLI flag, RunLabOptions field or LabDeps seam reaches it
16
+ * scripts/codex-qualify.mjs can launch a candidate admission would refuse. No library export, study
17
+ * manifest, CLI flag, RunStudyOptions field or StudyDeps seam reaches it
18
18
  * (tests/actors/codex/cli-versions-seam.test.ts).
19
19
  */
20
20
  cliVersions?: readonly string[];
@@ -4,7 +4,7 @@ import { type E2BDesktopExecutorOptions, type E2BDesktopLike } from "../../subst
4
4
  import { type OpenAiResponsesProviderOptions } from "./openai-provider.js";
5
5
  import { type RedactionHooks } from "../../evidence/redaction.js";
6
6
  import type { DwellWindow, StopWhen } from "../stop-conditions.js";
7
- import type { LabTask } from "../../lab/tasks.js";
7
+ import type { StudyTask } from "../../study/tasks.js";
8
8
  export interface CuaActorSessionOptions {
9
9
  /** The composed mission (persona + scenario/participant instruction) handed to the model. */
10
10
  instructions: string;
@@ -51,10 +51,10 @@ export interface CuaActorSessionOptions {
51
51
  stopWhen?: StopWhen;
52
52
  /** A declared observation window, forwarded to the loop. */
53
53
  dwell?: DwellWindow;
54
- /** The lab's declared protocol; the loop records a corroborated task funnel on the trace.
54
+ /** The study's declared protocol; the loop records a corroborated task funnel on the trace.
55
55
  * Only the `success` criteria are read here; the participant-facing goals are already composed
56
56
  * into `instructions` upstream, and the criteria never reach the prompt. */
57
- tasks?: readonly LabTask[];
57
+ tasks?: readonly StudyTask[];
58
58
  /** Fail-closed spend cap (USD) threaded to the loop; absent = uncapped. See CuaLoopOptions.maxUsd. */
59
59
  maxUsd?: number;
60
60
  /** Injected pure per-turn cost estimator paired with `maxUsd`. See CuaLoopOptions.estimateTurnCostUsd. */
@@ -64,12 +64,12 @@ export interface CuaActorSessionOptions {
64
64
  /** Stricter unknown-usage policy for capped sessions (see CuaLoopOptions); it also makes the
65
65
  * OpenAI provider send one HTTP dispatch per turn. Library-only. */
66
66
  requireReportedUsageForSpendCap?: boolean;
67
- /** Runtime-only observed-URL callback threaded to the loop; see CuaLoopOptions.onObservedUrl. Used by
67
+ /** Runtime-only observed-URL callback threaded to the loop; see LoopTaps.onObservedUrl. Used by
68
68
  * the concurrent shared-world handoff barrier to latch a host's live /lobby/CODE URL. */
69
69
  onObservedUrl?: (url: string | undefined) => void;
70
- /** Runtime-only per-turn narration callback threaded to the loop; see CuaLoopOptions.onMessage. */
70
+ /** Runtime-only per-turn narration callback threaded to the loop; see LoopTaps.onMessage. */
71
71
  onMessage?: (text: string) => void;
72
- /** Runtime-only per-turn raw-frame callback threaded to the loop; see CuaLoopOptions.onScreenshot. */
72
+ /** Runtime-only per-turn raw-frame callback threaded to the loop; see LoopTaps.onScreenshot. */
73
73
  onScreenshot?: (frame: Buffer) => void;
74
74
  /** Per-turn trace snapshot callback threaded to the loop; see CuaLoopOptions.onTrace. */
75
75
  onTrace?: (items: readonly ActorTraceItem[], usage: ActorTokenUsage, metadata?: CuaLiveMetadata) => void;
@@ -7,7 +7,7 @@
7
7
  //
8
8
  // The loop already returns a fully-formed ActorTrace at result.trace, so there is no separate
9
9
  // toActorTrace mapper: runCuaActorSession returns the CuaLoopResult unchanged.
10
- import { runComputerUseLoop, } from "./loop.js";
10
+ import { runComputerUseLoopWithTaps, } from "./loop.js";
11
11
  import { createE2BDesktopExecutor, } from "../../substrates/e2b/desktop-executor.js";
12
12
  import { createOpenAiResponsesProvider, } from "./openai-provider.js";
13
13
  import { defaultRedactionHooks } from "../../evidence/redaction.js";
@@ -55,7 +55,7 @@ export async function runCuaActorSession(options) {
55
55
  ...(options.onScreenshot === undefined ? {} : { onScreenshot: options.onScreenshot }),
56
56
  ...(options.onTrace === undefined ? {} : { onTrace: options.onTrace }),
57
57
  };
58
- const result = await runComputerUseLoop(loopOptions);
58
+ const result = await runComputerUseLoopWithTaps(loopOptions);
59
59
  if (result.trace.executionProfile?.billing === "account-unknown") {
60
60
  result.trace.estimatedCost = estimateActorCostForExecution(result.trace.tokenUsage, result.trace.ids.model, result.trace.executionProfile);
61
61
  }
@@ -5,8 +5,8 @@
5
5
  * outcome or usage is unknown. Import this class from the same humanish installation as the
6
6
  * loop/provider; names, message text and lookalike objects are not the contract.
7
7
  */
8
- export declare class CuaAdmissionLimitError extends Error {
8
+ export declare class ComputerUseAdmissionLimitError extends Error {
9
9
  constructor();
10
10
  }
11
11
  /** Internal nominal check: neither a matching payload nor a forged prototype is a declaration. */
12
- export declare function isCuaAdmissionLimitError(error: unknown): error is CuaAdmissionLimitError;
12
+ export declare function isComputerUseAdmissionLimitError(error: unknown): error is ComputerUseAdmissionLimitError;
@@ -6,14 +6,14 @@ const admissionLimits = new WeakSet();
6
6
  * outcome or usage is unknown. Import this class from the same humanish installation as the
7
7
  * loop/provider; names, message text and lookalike objects are not the contract.
8
8
  */
9
- export class CuaAdmissionLimitError extends Error {
9
+ export class ComputerUseAdmissionLimitError extends Error {
10
10
  constructor() {
11
11
  super("The adapter refused the request before provider dispatch because a local admission limit was reached.");
12
- this.name = "CuaAdmissionLimitError";
12
+ this.name = "ComputerUseAdmissionLimitError";
13
13
  admissionLimits.add(this);
14
14
  }
15
15
  }
16
16
  /** Internal nominal check: neither a matching payload nor a forged prototype is a declaration. */
17
- export function isCuaAdmissionLimitError(error) {
17
+ export function isComputerUseAdmissionLimitError(error) {
18
18
  return typeof error === "object" && error !== null && admissionLimits.has(error);
19
19
  }
@@ -21,11 +21,11 @@ export declare function isCuaExecutorErrorCode(value: unknown): value is CuaExec
21
21
  * began; a lost acknowledgement or partial action is `outcome_uncertain`, never a retry.
22
22
  * Import from the same installation as the loop: names and lookalike objects do not qualify.
23
23
  */
24
- export declare class CuaExecutorError extends Error {
24
+ export declare class ComputerUseExecutorError extends Error {
25
25
  readonly code: CuaExecutorErrorCode;
26
26
  readonly disposition: CuaExecutorDisposition;
27
27
  constructor(code: CuaExecutorErrorCode, disposition: CuaExecutorDisposition);
28
28
  }
29
29
  /** A forged prototype is not an executor declaration. */
30
- export declare function isCuaExecutorError(error: unknown): error is CuaExecutorError;
30
+ export declare function isComputerUseExecutorError(error: unknown): error is ComputerUseExecutorError;
31
31
  export {};
@@ -22,7 +22,7 @@ const executorErrors = new WeakSet();
22
22
  * began; a lost acknowledgement or partial action is `outcome_uncertain`, never a retry.
23
23
  * Import from the same installation as the loop: names and lookalike objects do not qualify.
24
24
  */
25
- export class CuaExecutorError extends Error {
25
+ export class ComputerUseExecutorError extends Error {
26
26
  code;
27
27
  disposition;
28
28
  constructor(code, disposition) {
@@ -31,7 +31,7 @@ export class CuaExecutorError extends Error {
31
31
  throw new TypeError("Invalid desktop executor error declaration.");
32
32
  }
33
33
  super(messages[code]);
34
- this.name = "CuaExecutorError";
34
+ this.name = "ComputerUseExecutorError";
35
35
  this.code = code;
36
36
  this.disposition = disposition;
37
37
  // Keep the values used in durable diagnostics finite even for JavaScript callers.
@@ -43,6 +43,6 @@ export class CuaExecutorError extends Error {
43
43
  }
44
44
  }
45
45
  /** A forged prototype is not an executor declaration. */
46
- export function isCuaExecutorError(error) {
46
+ export function isComputerUseExecutorError(error) {
47
47
  return typeof error === "object" && error !== null && executorErrors.has(error);
48
48
  }
@@ -1,6 +1,6 @@
1
1
  import { classifyCuaAction } from "../../affordance.js";
2
2
  import { commandFailureInfo, isCommandExitError } from "../../../substrates/command-failure.js";
3
- import { CuaExecutorError, isCuaExecutorError } from "../executor-error.js";
3
+ import { ComputerUseExecutorError, isComputerUseExecutorError } from "../executor-error.js";
4
4
  import { CuaAbortError, CuaDeadlineError, CuaStallError, raceCallBound, raceSessionDeadline, requestScope, } from "./race.js";
5
5
  import { notice } from "./trace.js";
6
6
  // The participant's actions: their public labels, what counts as a material action, and how one
@@ -131,7 +131,7 @@ export async function runActionBatch(session, actions) {
131
131
  status = await dispatchAction(session, action, title);
132
132
  }
133
133
  catch (error) {
134
- const declared = isCuaExecutorError(error)
134
+ const declared = isComputerUseExecutorError(error)
135
135
  ? error.disposition
136
136
  : isCommandExitError(error)
137
137
  ? "skipped"
@@ -139,7 +139,7 @@ export async function runActionBatch(session, actions) {
139
139
  if (declared !== undefined)
140
140
  execution.actions.push({ index, status: declared });
141
141
  countAttempt(session, action, title, declared);
142
- if (isCuaExecutorError(error) &&
142
+ if (isComputerUseExecutorError(error) &&
143
143
  error.code === "action_rejected" &&
144
144
  error.disposition === "not_dispatched") {
145
145
  // Later actions may depend on this one (type, then submit). Return
@@ -150,7 +150,7 @@ export async function runActionBatch(session, actions) {
150
150
  trace.record("notice", () => notice("warn", "action rejected before dispatch", session.redactNarration(`action: ${title}; code: action_rejected; disposition: not_dispatched; remaining batch actions not dispatched: ${actions.length - index - 1}`)));
151
151
  return { execution, hint: rejectedActionHint(title) };
152
152
  }
153
- if (isCuaExecutorError(error) || !isCommandExitError(error))
153
+ if (isComputerUseExecutorError(error) || !isCommandExitError(error))
154
154
  throw error;
155
155
  // A skipped action changes nothing on screen, so a persistently-failing run makes no
156
156
  // progress and still terminates via the idle/no-progress backstop (gave_up),
@@ -213,7 +213,7 @@ async function executeAction(session, action, title, boundMs) {
213
213
  }
214
214
  catch (error) {
215
215
  if (error instanceof CuaStallError && session.executor.stallRecovery === "fail_closed") {
216
- throw new CuaExecutorError("deadline_exceeded", "outcome_uncertain");
216
+ throw new ComputerUseExecutorError("deadline_exceeded", "outcome_uncertain");
217
217
  }
218
218
  if (error instanceof CuaDeadlineError || error instanceof CuaAbortError) {
219
219
  // The loop's deadline/abort may win before the executor can report whether its
@@ -1,4 +1,4 @@
1
- import { isCuaAdmissionLimitError } from "../admission-limit.js";
1
+ import { isComputerUseAdmissionLimitError } from "../admission-limit.js";
2
2
  import { singleDispatch } from "./provider-call.js";
3
3
  import { CuaDeadlineError, raceSessionDeadline, requestScope } from "./race.js";
4
4
  import { notice } from "./trace.js";
@@ -110,7 +110,7 @@ async function debriefExchange(session, provider, context, trigger, boundMs, rec
110
110
  }
111
111
  catch (error) {
112
112
  // A failed optional report cannot rewrite the already observed structured completion.
113
- if (isCuaAdmissionLimitError(error)) {
113
+ if (isComputerUseAdmissionLimitError(error)) {
114
114
  return record("skipped", "the adapter reported a local admission limit before provider dispatch; no closing request was sent");
115
115
  }
116
116
  const detail = signal?.aborted
@@ -69,7 +69,7 @@ export declare function providerInterrupted(interruption: NonNullable<CuaTurn["i
69
69
  * Safety-check categories are provider-defined enums (e.g. "malicious_instructions"), not free
70
70
  * text; the evidence records them (redacted for defense-in-depth) so it shows why the run paused.
71
71
  */
72
- export declare function blockedOnSafetyChecks(checks: string): Stop;
72
+ export declare function blockedOnSafetyChecks(checks: string, count: number): Stop;
73
73
  /**
74
74
  * A vision provider against a screenshot-less observation is a fail-closed harness error, not a
75
75
  * silent crash. The provider sets requiresFrame; a state-reasoning provider omits it.
@@ -1,7 +1,8 @@
1
- import { isCuaExecutorError } from "../executor-error.js";
2
- import { isCuaPromptRefusedError, isCuaProviderError } from "../provider-error.js";
1
+ import { isComputerUseExecutorError } from "../executor-error.js";
2
+ import { isComputerUsePromptRefusedError, isComputerUseProviderError } from "../provider-error.js";
3
3
  import { CuaAbortError, CuaDeadlineError } from "./race.js";
4
4
  import { notice } from "./trace.js";
5
+ import { plural } from "../../../run/text.js";
5
6
  /**
6
7
  * Read the fixed closing line the prompt asks for: the first non-empty line of the
7
8
  * participant's last message, exactly one of three phrases, punctuation and case forgiven. Anything
@@ -67,8 +68,8 @@ export function timeLimit(session) {
67
68
  return {
68
69
  completionReason: "budget_reached",
69
70
  reason: session.actionHistory.interruptedActionOutcome
70
- ? `reached the ${timeoutMs}ms time budget with ${materialActions} material action attempt(s), ${turns} turn(s); the latest action outcome is uncertain`
71
- : `reached the ${timeoutMs}ms time budget after productive activity (${materialActions} material action(s), ${turns} turn(s))`,
71
+ ? `reached the ${timeoutMs}ms time budget with ${plural(materialActions, "material action attempt")}, ${plural(turns, "turn")}; the latest action outcome is uncertain`
72
+ : `reached the ${timeoutMs}ms time budget after productive activity (${plural(materialActions, "material action")}, ${plural(turns, "turn")})`,
72
73
  stopCause: "time_limit",
73
74
  };
74
75
  }
@@ -82,11 +83,11 @@ export function spendLimit(session, estimate, maxUsd) {
82
83
  const booked = session.usage.reservedRequests;
83
84
  const spend = booked === 0
84
85
  ? `estimated spend $${estimate}`
85
- : `estimated spend $${estimate}, including the worst case of ${booked} lost request(s),`;
86
+ : `estimated spend $${estimate}, including the worst case of ${plural(booked, "lost request")},`;
86
87
  return {
87
88
  completionReason: "budget_reached",
88
89
  reason: materialActions > 0
89
- ? `Stopped before the next model turn: ${spend} passed execution.caps.maxUsd=$${maxUsd} after productive activity (${materialActions} material action(s), ${turns} turn(s))`
90
+ ? `Stopped before the next model turn: ${spend} passed execution.caps.maxUsd=$${maxUsd} after productive activity (${plural(materialActions, "material action")}, ${plural(turns, "turn")})`
90
91
  : `Stopped before the next model turn: ${spend} passed execution.caps.maxUsd=$${maxUsd} with no material progress`,
91
92
  stopCause: "spend_limit",
92
93
  };
@@ -180,10 +181,10 @@ export function providerInterrupted(interruption) {
180
181
  * Safety-check categories are provider-defined enums (e.g. "malicious_instructions"), not free
181
182
  * text; the evidence records them (redacted for defense-in-depth) so it shows why the run paused.
182
183
  */
183
- export function blockedOnSafetyChecks(checks) {
184
+ export function blockedOnSafetyChecks(checks, count) {
184
185
  return {
185
186
  completionReason: "blocked_approval",
186
- reason: `paused on model safety check(s): ${checks}; not acknowledged`,
187
+ reason: `paused on ${count === 1 ? "a model safety check" : `${count} model safety checks`}: ${checks}; not acknowledged`,
187
188
  evidence: {
188
189
  kind: "approval",
189
190
  body: () => ({ lifecycle: "completed", status: "blocked", title: `safety check: ${checks}` }),
@@ -258,7 +259,7 @@ export function stopForError(session, error) {
258
259
  const { lastActionTitle } = session.actionHistory;
259
260
  const lastAction = () => lastActionTitle === undefined ? undefined : `last action: ${redact(lastActionTitle)}`;
260
261
  const screenshot = session.lastScreenshotRef === undefined ? {} : { screenshotRef: session.lastScreenshotRef };
261
- if (isCuaPromptRefusedError(error)) {
262
+ if (isComputerUsePromptRefusedError(error)) {
262
263
  // The provider's policy decision about the prompt, not a harness fault; never resent.
263
264
  const reason = `${error.message}; the prompt was not sent again`;
264
265
  return {
@@ -268,7 +269,7 @@ export function stopForError(session, error) {
268
269
  evidence: noticeEvidence("error", "provider refused the prompt", `phase: ${redact(session.phase)}; ${reason}`),
269
270
  };
270
271
  }
271
- if (isCuaProviderError(error)) {
272
+ if (isComputerUseProviderError(error)) {
272
273
  const reason = `participant provider error: ${error.code}${error.failurePhase ? ` during ${error.failurePhase}` : ""}; cleanup: ${error.receipt.cleanup}`;
273
274
  return {
274
275
  completionReason: "harness_error",
@@ -276,7 +277,7 @@ export function stopForError(session, error) {
276
277
  evidence: noticeEvidence("error", "participant provider error", reason),
277
278
  };
278
279
  }
279
- if (isCuaExecutorError(error)) {
280
+ if (isComputerUseExecutorError(error)) {
280
281
  const detail = () => [
281
282
  `phase: ${redact(session.phase)}`,
282
283
  `code: ${error.code}`,
@@ -1,9 +1,10 @@
1
1
  import { evaluateStopWhen } from "../../stop-conditions.js";
2
- import { CuaExecutorError, isCuaExecutorError } from "../executor-error.js";
2
+ import { ComputerUseExecutorError, isComputerUseExecutorError } from "../executor-error.js";
3
3
  import { CUA_SPEECH_LIMITS } from "../speech.js";
4
4
  import { dwellCompleted, missingFrame, stopWhenMatched } from "./ending.js";
5
5
  import { CuaAbortError, CuaStallError, raceCallBound } from "./race.js";
6
6
  import { notice } from "./trace.js";
7
+ import { plural } from "../../../run/text.js";
7
8
  // One projection feeds both the stop guard and the task tracker, so a criterion that would stop
8
9
  // the run and a criterion that completes a task can never see different evidence for one turn.
9
10
  function stopObservationOf(observation) {
@@ -114,7 +115,7 @@ export class DesktopObserver {
114
115
  this.observeTasks(final, turnNumber);
115
116
  }
116
117
  catch (error) {
117
- if (isCuaExecutorError(error))
118
+ if (isComputerUseExecutorError(error))
118
119
  throw error;
119
120
  }
120
121
  }
@@ -133,7 +134,7 @@ export class DesktopObserver {
133
134
  if (executor.stallRecovery === "fail_closed") {
134
135
  // The outer bound says nothing about whether the still-pending request completed.
135
136
  // The owning session will close it; this loop must not send a replacement request.
136
- throw new CuaExecutorError("deadline_exceeded", "outcome_uncertain");
137
+ throw new ComputerUseExecutorError("deadline_exceeded", "outcome_uncertain");
137
138
  }
138
139
  session.trace.record("notice", () => notice("warn", "observation stalled; retrying once", `${error.what} produced nothing within ${error.afterMs}ms; asking the desktop again`));
139
140
  return await raceCallBound(`observe (${label}, retry)`, executor.observe(), session.remaining(), session.observationTimeoutMs, session.signal);
@@ -153,7 +154,7 @@ export class DesktopObserver {
153
154
  this.session.trace.record("notice", () => notice("ok", "speech heard", this.session.redactNarration(utterance.text)));
154
155
  }
155
156
  if (this.pendingHeardSpeech.length > CUA_SPEECH_LIMITS.utterances) {
156
- throw new CuaExecutorError("invalid_response", "outcome_uncertain");
157
+ throw new ComputerUseExecutorError("invalid_response", "outcome_uncertain");
157
158
  }
158
159
  return this.pendingHeardSpeech.length === 0
159
160
  ? observation
@@ -240,7 +241,7 @@ export class DesktopObserver {
240
241
  session.trace.record("notice", () => notice(
241
242
  // A window that ends the session is structured, harness-owned completion evidence, the
242
243
  // same class as a matched stopWhen, and the verdict resolver reads it that way.
243
- dwell.then === "stop" ? "matched" : "ok", "dwell window complete", `${frames} frame(s) over ${heldMs}ms; no model turn was requested during the window`));
244
+ dwell.then === "stop" ? "matched" : "ok", "dwell window complete", `${plural(frames, "frame")} over ${heldMs}ms; no model turn was requested during the window`));
244
245
  return { next: dwell.then, heldMs };
245
246
  }
246
247
  }
@@ -1,5 +1,5 @@
1
- import { isCuaAdmissionLimitError } from "../admission-limit.js";
2
- import { CuaProviderError, isCuaProviderError } from "../provider-error.js";
1
+ import { isComputerUseAdmissionLimitError } from "../admission-limit.js";
2
+ import { ComputerUseProviderError, isComputerUseProviderError } from "../provider-error.js";
3
3
  import { adapterLimit, providerStalledTwice, usageUnreported } from "./ending.js";
4
4
  import { CuaAbortError, CuaDeadlineError, CuaStallError, raceCallBound, requestScope, } from "./race.js";
5
5
  import { bookLostRequest, LostRequestRefused, spendGate } from "./spend.js";
@@ -32,7 +32,7 @@ export async function requestTurn(session, request, turnNumber) {
32
32
  catch (error) {
33
33
  // Stops are concluded here, before `finally` ends the request scope, so their notices are
34
34
  // recorded before any abort listener runs.
35
- if (isCuaAdmissionLimitError(error))
35
+ if (isComputerUseAdmissionLimitError(error))
36
36
  return { stop: session.conclude(adapterLimit) };
37
37
  if (error instanceof LostRequestRefused)
38
38
  return { stop: session.conclude(error.stop) };
@@ -73,7 +73,7 @@ async function retryStalledTurn(session, request, turnNumber, stall, stalled) {
73
73
  };
74
74
  }
75
75
  catch (retryError) {
76
- if (isCuaAdmissionLimitError(retryError))
76
+ if (isComputerUseAdmissionLimitError(retryError))
77
77
  return { stop: session.conclude(adapterLimit) };
78
78
  if (retryError instanceof LostRequestRefused)
79
79
  return { stop: session.conclude(retryError.stop) };
@@ -101,7 +101,7 @@ export async function singleDispatch(session, kind, dispatch, boundMs) {
101
101
  const pending = Promise.resolve()
102
102
  .then(() => {
103
103
  if (scope.signal.aborted)
104
- throw new CuaProviderError("cancelled", {
104
+ throw new ComputerUseProviderError("cancelled", {
105
105
  dispatched: false,
106
106
  usageComplete: false,
107
107
  cleanup: "confirmed",
@@ -135,11 +135,11 @@ export async function singleDispatch(session, kind, dispatch, boundMs) {
135
135
  }
136
136
  const failure = "error" in outcome ? outcome.error : undefined;
137
137
  const requestSettlement = settlementRef.current;
138
- const providerError = isCuaProviderError(failure)
138
+ const providerError = isComputerUseProviderError(failure)
139
139
  ? failure
140
140
  : requestSettlement &&
141
141
  "error" in requestSettlement &&
142
- isCuaProviderError(requestSettlement.error)
142
+ isComputerUseProviderError(requestSettlement.error)
143
143
  ? requestSettlement.error
144
144
  : undefined;
145
145
  const turn = requestSettlement && "turn" in requestSettlement ? requestSettlement.turn : undefined;
@@ -157,8 +157,8 @@ export async function singleDispatch(session, kind, dispatch, boundMs) {
157
157
  if (failure instanceof CuaAbortError || failure instanceof CuaDeadlineError)
158
158
  throw failure;
159
159
  if (failure instanceof CuaStallError)
160
- throw new CuaProviderError("timeout", receipt, usage, providerError?.failurePhase);
161
- throw providerError ?? new CuaProviderError("process_failed", receipt, usage);
160
+ throw new ComputerUseProviderError("timeout", receipt, usage, providerError?.failurePhase);
161
+ throw providerError ?? new ComputerUseProviderError("process_failed", receipt, usage);
162
162
  }
163
163
  /**
164
164
  * Whether a single-dispatch turn is a valid turn from a continuing request (see
@@ -175,7 +175,7 @@ function isContinuingTurn(kind, turn) {
175
175
  turn.usage !== undefined ||
176
176
  turn.interruption !== undefined ||
177
177
  turn.closingReport !== undefined) {
178
- throw new CuaProviderError("invalid_response", {
178
+ throw new ComputerUseProviderError("invalid_response", {
179
179
  dispatched: "unknown",
180
180
  usageComplete: false,
181
181
  cleanup: "unconfirmed",
@@ -188,7 +188,7 @@ function isContinuingTurn(kind, turn) {
188
188
  r.dispatched !== true ||
189
189
  typeof r.usageComplete !== "boolean" ||
190
190
  r.cleanup !== "confirmed") {
191
- throw new CuaProviderError("invalid_response", { dispatched: "unknown", usageComplete: false, cleanup: "unconfirmed" }, turn.usage);
191
+ throw new ComputerUseProviderError("invalid_response", { dispatched: "unknown", usageComplete: false, cleanup: "unconfirmed" }, turn.usage);
192
192
  }
193
193
  return false;
194
194
  }
@@ -1,9 +1,9 @@
1
1
  import type { ActorTraceItem, ParticipantDeclaredOutcome } from "../../contract.js";
2
2
  import type { AffordanceObservation } from "../../affordance.js";
3
- import { TaskTracker } from "../../../lab/tasks.js";
3
+ import { TaskTracker } from "../../../study/tasks.js";
4
4
  import type { DebriefTrigger, Stop } from "./ending.js";
5
5
  import { TraceRecorder } from "./trace.js";
6
- import type { CuaExecutor, CuaLoopOptions, CuaProvider, CuaSafetyCheck } from "./types.js";
6
+ import type { CuaExecutor, CuaProvider, CuaSafetyCheck, LoopRunOptions } from "./types.js";
7
7
  import { UsageLedger } from "./usage.js";
8
8
  export type ScreenshotRef = NonNullable<ActorTraceItem["screenshotRef"]>;
9
9
  /**
@@ -11,7 +11,7 @@ export type ScreenshotRef = NonNullable<ActorTraceItem["screenshotRef"]>;
11
11
  * wrapped callbacks are fields on LoopSession instead. Callers destructure hooks to call them.
12
12
  */
13
13
  export type LoopSettings = {
14
- readonly [K in "instructions" | "persona" | "redaction" | "stopWhen" | "dwell" | "tasks" | "maxUsd" | "overRunBudget" | "estimateTurnCostUsd" | "onObservedUrl" | "onMessage" | "onScreenshot" | "onTrace"]: CuaLoopOptions[K];
14
+ readonly [K in "instructions" | "persona" | "redaction" | "stopWhen" | "dwell" | "tasks" | "maxUsd" | "overRunBudget" | "estimateTurnCostUsd" | "onObservedUrl" | "onMessage" | "onScreenshot" | "onTrace"]: LoopRunOptions[K];
15
15
  };
16
16
  /** The participant's dispatched actions, as the backstop and failure notices describe them. */
17
17
  export interface ActionHistory {
@@ -63,7 +63,7 @@ export declare class LoopSession {
63
63
  debriefTrigger: DebriefTrigger | undefined;
64
64
  private stopCause;
65
65
  private readonly scrubText;
66
- constructor(options: CuaLoopOptions);
66
+ constructor(options: LoopRunOptions);
67
67
  remaining(): number;
68
68
  redactNarration(text: string): string;
69
69
  /** Hand a watcher the trace so far with the running usage, without waiting on it. */
@@ -1,4 +1,4 @@
1
- import { TaskTracker } from "../../../lab/tasks.js";
1
+ import { TaskTracker } from "../../../study/tasks.js";
2
2
  import { TraceRecorder } from "./trace.js";
3
3
  import { UsageLedger } from "./usage.js";
4
4
  // The state one loop session shares across its phases: the options as read at entry, the session
@@ -107,7 +107,7 @@ export class LoopSession {
107
107
  }
108
108
  // Model-authored narration: literal-scrub known provisioned values, then pattern-redact.
109
109
  // A value the model transcribes (a DB password it read on screen) has no shape, so redactText
110
- // alone cannot catch it; the lab's scrubKnownValues, injected as scrubText, closes that.
110
+ // alone cannot catch it; the run's scrubKnownValues, injected as scrubText, closes that.
111
111
  redactNarration(text) {
112
112
  return this.settings.redaction.redactText(this.scrubText(text));
113
113
  }
@@ -1,5 +1,6 @@
1
1
  import { summarizeAffordanceUse } from "../../affordance.js";
2
2
  import { ACTOR_TRACE_SCHEMA, } from "../../contract.js";
3
+ import { plural } from "../../../run/text.js";
3
4
  export function notice(status, title, text) {
4
5
  return { lifecycle: "completed", status, title, text };
5
6
  }
@@ -76,8 +77,8 @@ export function loopResult(session, stop, debrief) {
76
77
  const screenshotNote = !(counts.screenshots > 0)
77
78
  ? "no screenshots captured"
78
79
  : session.redactScreenshots
79
- ? `${counts.screenshots} screenshot(s) redacted to blurred thumbnails via RedactionHooks`
80
- : `${counts.screenshots} unblurred screenshot(s) kept for local use and not redacted for publishing; set redactScreenshots to blur screenshots in a bundle you plan to share`;
80
+ ? `${plural(counts.screenshots, "screenshot")} redacted to blurred thumbnails via RedactionHooks`
81
+ : `${plural(counts.screenshots, "unblurred screenshot")} kept for local use and not redacted for publishing; set redactScreenshots to blur screenshots in a bundle you plan to share`;
81
82
  // Self-describing artifact: when any observation carried structured app state,
82
83
  // the trace says how the loop handled it: it fed progress and task checks and was not written to
83
84
  // the trace. The appState itself never appears in this bundle.