humanish 0.106.1 → 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 (453) hide show
  1. package/AGENTS.md +4 -4
  2. package/ARCHITECTURE.md +17 -16
  3. package/CHANGELOG.md +14 -0
  4. package/CONTEXT.md +42 -39
  5. package/CONTRIBUTING.md +8 -8
  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 +30 -3
  16. package/dist/actors/codex/qualified-versions.js +50 -5
  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 +9 -7
  45. package/dist/actors/local-agent/cli.js +1 -1
  46. package/dist/actors/scripted-browser/actor.d.ts +2 -2
  47. package/dist/actors/scripted-browser/journey.js +15 -4
  48. package/dist/actors/scripted-browser/steps.js +18 -0
  49. package/dist/actors/scripted-browser/types.d.ts +11 -1
  50. package/dist/actors/stop-conditions.js +1 -3
  51. package/dist/analysis/automatic-completion.d.ts +13 -8
  52. package/dist/analysis/automatic-completion.js +14 -8
  53. package/dist/analysis/automatic-config.d.ts +1 -1
  54. package/dist/analysis/automatic-config.js +2 -2
  55. package/dist/analysis/automatic.d.ts +10 -4
  56. package/dist/analysis/automatic.js +17 -13
  57. package/dist/analysis/diagnostics.d.ts +23 -0
  58. package/dist/analysis/diagnostics.js +112 -0
  59. package/dist/analysis/evidence-sources.js +2 -2
  60. package/dist/analysis/evidence.js +6 -6
  61. package/dist/analysis/execute.d.ts +7 -1
  62. package/dist/analysis/execute.js +39 -12
  63. package/dist/analysis/job.d.ts +8 -5
  64. package/dist/analysis/job.js +15 -14
  65. package/dist/analysis/load.d.ts +1 -1
  66. package/dist/analysis/load.js +5 -5
  67. package/dist/analysis/provider.d.ts +9 -1
  68. package/dist/analysis/restricted-codex.d.ts +2 -0
  69. package/dist/analysis/restricted-codex.js +10 -1
  70. package/dist/analysis/service.d.ts +2 -0
  71. package/dist/analysis/service.js +31 -12
  72. package/dist/analysis/sharing.d.ts +2 -2
  73. package/dist/analysis/sharing.js +5 -5
  74. package/dist/analysis/store-executions.d.ts +5 -5
  75. package/dist/analysis/store-executions.js +12 -12
  76. package/dist/analysis/store.d.ts +4 -4
  77. package/dist/analysis/store.js +13 -13
  78. package/dist/cli/commands/analysis-signals.d.ts +2 -1
  79. package/dist/cli/commands/analysis-signals.js +4 -1
  80. package/dist/cli/commands/analyze.js +4 -2
  81. package/dist/cli/commands/comms.js +8 -1
  82. package/dist/cli/commands/lab-route-computer-use.d.ts +0 -2
  83. package/dist/cli/commands/lab-route-computer-use.js +26 -14
  84. package/dist/cli/commands/lab-route-preview.d.ts +1 -3
  85. package/dist/cli/commands/lab-route-preview.js +3 -4
  86. package/dist/cli/commands/lab-route-run.d.ts +6 -4
  87. package/dist/cli/commands/lab-route-run.js +6 -2
  88. package/dist/cli/commands/lab-route-scripted.d.ts +0 -2
  89. package/dist/cli/commands/lab-route-scripted.js +0 -1
  90. package/dist/cli/commands/lab-route-shared-world.d.ts +0 -2
  91. package/dist/cli/commands/lab-route-shared-world.js +0 -1
  92. package/dist/cli/commands/lab-route-terminal.d.ts +0 -2
  93. package/dist/cli/commands/lab-route-terminal.js +0 -1
  94. package/dist/cli/commands/lab-run.js +76 -45
  95. package/dist/cli/commands/lab-scorer.d.ts +0 -2
  96. package/dist/cli/commands/lab.js +12 -6
  97. package/dist/cli/commands/observe.js +22 -0
  98. package/dist/cli/commands/run-signals.d.ts +30 -0
  99. package/dist/cli/commands/run-signals.js +146 -0
  100. package/dist/cli/commands/runs.js +10 -8
  101. package/dist/cli/commands/watch.js +12 -10
  102. package/dist/cli/doctor.d.ts +3 -0
  103. package/dist/cli/doctor.js +10 -2
  104. package/dist/cli/io.d.ts +5 -4
  105. package/dist/cli/io.js +12 -8
  106. package/dist/cli/program.js +3 -3
  107. package/dist/cli/renamed-options.d.ts +11 -0
  108. package/dist/cli/renamed-options.js +18 -0
  109. package/dist/cli/telemetry.d.ts +2 -2
  110. package/dist/cli/telemetry.js +1 -1
  111. package/dist/comms/capture-surface.d.ts +1 -1
  112. package/dist/comms/catch-host.d.ts +1 -1
  113. package/dist/comms/connections.js +4 -4
  114. package/dist/comms/external-evidence.d.ts +27 -0
  115. package/dist/comms/external-evidence.js +93 -0
  116. package/dist/comms/lease-store.js +7 -7
  117. package/dist/comms/types.js +1 -1
  118. package/dist/evidence/browser-hygiene.d.ts +1 -1
  119. package/dist/evidence/browser-hygiene.js +1 -1
  120. package/dist/evidence/redaction.js +1 -1
  121. package/dist/evidence/secret-scrub.d.ts +9 -0
  122. package/dist/evidence/secret-scrub.js +96 -0
  123. package/dist/feedback/draft.js +7 -9
  124. package/dist/feedback/export-bundle.js +4 -4
  125. package/dist/feedback/export.js +9 -9
  126. package/dist/feedback/feedback.d.ts +1 -1
  127. package/dist/index.d.ts +3 -6
  128. package/dist/index.js +3 -6
  129. package/dist/keys/key-resolution.d.ts +3 -1
  130. package/dist/keys/key-resolution.js +18 -16
  131. package/dist/lab/adapter-extension.d.ts +28 -6
  132. package/dist/lab/adapter-extension.js +65 -126
  133. package/dist/lab/adapter-scorer-loader.d.ts +25 -5
  134. package/dist/lab/adapter-scorer-loader.js +24 -0
  135. package/dist/lab/composition-rules.js +20 -20
  136. package/dist/lab/config.js +28 -26
  137. package/dist/lab/device-presets.d.ts +2 -2
  138. package/dist/lab/discover.js +1 -3
  139. package/dist/lab/doctor.d.ts +44 -9
  140. package/dist/lab/doctor.js +149 -41
  141. package/dist/lab/init-plan.js +1 -3
  142. package/dist/lab/keys.js +1 -1
  143. package/dist/lab/lab-deps.d.ts +85 -0
  144. package/dist/lab/lab-deps.js +4 -0
  145. package/dist/lab/parse/actors.js +8 -7
  146. package/dist/lab/parse/comms.js +3 -2
  147. package/dist/lab/parse/execution.js +3 -2
  148. package/dist/lab/parse/subject-state.js +2 -1
  149. package/dist/lab/parse/subject.js +2 -1
  150. package/dist/lab/parse/values.d.ts +0 -1
  151. package/dist/lab/parse/values.js +0 -3
  152. package/dist/lab/persona-resolve.d.ts +3 -3
  153. package/dist/lab/persona-resolve.js +4 -4
  154. package/dist/lab/persona.js +1 -3
  155. package/dist/lab/plan-base.d.ts +0 -2
  156. package/dist/lab/plan-base.js +6 -4
  157. package/dist/lab/plan-participants.d.ts +5 -5
  158. package/dist/lab/plan-participants.js +2 -2
  159. package/dist/lab/plan-types.d.ts +22 -4
  160. package/dist/lab/plan.d.ts +3 -11
  161. package/dist/lab/plan.js +18 -42
  162. package/dist/lab/preflight-result.js +0 -2
  163. package/dist/lab/preflight.d.ts +0 -3
  164. package/dist/lab/preflight.js +1 -1
  165. package/dist/lab/requirements.d.ts +20 -0
  166. package/dist/lab/requirements.js +54 -0
  167. package/dist/lab/route-inputs.d.ts +23 -12
  168. package/dist/lab/route-inputs.js +48 -51
  169. package/dist/lab/routing.d.ts +19 -24
  170. package/dist/lab/routing.js +14 -47
  171. package/dist/lab/run-lab-events.d.ts +6 -11
  172. package/dist/lab/run-lab-events.js +3 -11
  173. package/dist/lab/run-lab-homes.d.ts +64 -0
  174. package/dist/lab/run-lab-homes.js +3 -0
  175. package/dist/lab/run-lab-options.d.ts +12 -66
  176. package/dist/lab/run-lab-options.js +45 -275
  177. package/dist/lab/summary.d.ts +9 -4
  178. package/dist/lab/summary.js +15 -8
  179. package/dist/lab/types.d.ts +132 -132
  180. package/dist/lab/validation.d.ts +15 -15
  181. package/dist/lab/validation.js +28 -28
  182. package/dist/lab/warnings.js +20 -19
  183. package/dist/observer/artifact.d.ts +1 -1
  184. package/dist/observer/artifact.js +3 -3
  185. package/dist/observer/data.js +2 -2
  186. package/dist/observer/render.js +2 -2
  187. package/dist/observer/run-routes.d.ts +1 -1
  188. package/dist/observer/run-routes.js +5 -5
  189. package/dist/observer/serve.d.ts +17 -0
  190. package/dist/observer/serve.js +34 -3
  191. package/dist/routes/computer-use/bundle-parts.d.ts +1 -1
  192. package/dist/routes/computer-use/bundle-parts.js +10 -3
  193. package/dist/routes/computer-use/bundle.d.ts +4 -11
  194. package/dist/routes/computer-use/bundle.js +9 -15
  195. package/dist/routes/computer-use/diagnostics.d.ts +1 -1
  196. package/dist/routes/computer-use/diagnostics.js +1 -1
  197. package/dist/routes/computer-use/e2b-desktop/comms.d.ts +10 -10
  198. package/dist/routes/computer-use/e2b-desktop/comms.js +11 -14
  199. package/dist/routes/computer-use/e2b-desktop/desktop.d.ts +2 -2
  200. package/dist/routes/computer-use/e2b-desktop/desktop.js +4 -7
  201. package/dist/routes/computer-use/e2b-desktop/fidelity.d.ts +13 -13
  202. package/dist/routes/computer-use/e2b-desktop/fidelity.js +11 -11
  203. package/dist/routes/computer-use/e2b-desktop/prepare.d.ts +3 -3
  204. package/dist/routes/computer-use/e2b-desktop/prepare.js +33 -36
  205. package/dist/routes/computer-use/e2b-desktop/start.d.ts +1 -1
  206. package/dist/routes/computer-use/e2b-desktop/start.js +24 -23
  207. package/dist/routes/computer-use/e2b-desktop/state.d.ts +5 -4
  208. package/dist/routes/computer-use/e2b-desktop/state.js +5 -3
  209. package/dist/routes/computer-use/e2b-desktop/teardown.d.ts +1 -1
  210. package/dist/routes/computer-use/e2b-desktop/teardown.js +29 -17
  211. package/dist/routes/computer-use/external-comms.d.ts +4 -4
  212. package/dist/routes/computer-use/external-comms.js +19 -43
  213. package/dist/routes/computer-use/fanout-bundle.d.ts +3 -3
  214. package/dist/routes/computer-use/fanout-bundle.js +25 -29
  215. package/dist/routes/computer-use/{fanout-lanes.js → fanout-records.js} +25 -19
  216. package/dist/routes/computer-use/in-process-desktop.d.ts +3 -10
  217. package/dist/routes/computer-use/in-process-desktop.js +3 -9
  218. package/dist/routes/computer-use/live-flush.d.ts +7 -5
  219. package/dist/routes/computer-use/live-flush.js +19 -27
  220. package/dist/routes/computer-use/{run-lanes.js → live-phase.js} +12 -11
  221. package/dist/routes/computer-use/local-tree-pack.d.ts +3 -3
  222. package/dist/routes/computer-use/local-tree-pack.js +4 -5
  223. package/dist/routes/computer-use/local-vm.d.ts +11 -8
  224. package/dist/routes/computer-use/local-vm.js +39 -66
  225. package/dist/routes/computer-use/participant-desktop.d.ts +8 -23
  226. package/dist/routes/computer-use/participant-desktop.js +5 -25
  227. package/dist/routes/computer-use/{lanes.d.ts → participant-execution.d.ts} +10 -10
  228. package/dist/routes/computer-use/{lanes.js → participant-execution.js} +35 -22
  229. package/dist/routes/computer-use/participant-facts.d.ts +7 -1
  230. package/dist/routes/computer-use/participant-facts.js +12 -1
  231. package/dist/routes/computer-use/participant-model.d.ts +19 -11
  232. package/dist/routes/computer-use/participant-model.js +49 -25
  233. package/dist/routes/computer-use/participant-prompt.d.ts +3 -3
  234. package/dist/routes/computer-use/participant-prompt.js +4 -4
  235. package/dist/routes/computer-use/participant-runs.d.ts +6 -6
  236. package/dist/routes/computer-use/participant-runs.js +8 -8
  237. package/dist/routes/computer-use/plan.d.ts +21 -29
  238. package/dist/routes/computer-use/plan.js +52 -60
  239. package/dist/routes/computer-use/preflight.d.ts +3 -5
  240. package/dist/routes/computer-use/preflight.js +20 -16
  241. package/dist/routes/computer-use/rerun-selection.js +10 -6
  242. package/dist/routes/computer-use/result.d.ts +1 -1
  243. package/dist/routes/computer-use/result.js +40 -30
  244. package/dist/routes/computer-use/route.d.ts +3 -4
  245. package/dist/routes/computer-use/route.js +21 -19
  246. package/dist/routes/computer-use/self-report.d.ts +2 -2
  247. package/dist/routes/computer-use/self-report.js +4 -4
  248. package/dist/routes/computer-use/setup.d.ts +8 -14
  249. package/dist/routes/computer-use/setup.js +96 -72
  250. package/dist/routes/computer-use/single-bundle.d.ts +8 -11
  251. package/dist/routes/computer-use/single-bundle.js +20 -25
  252. package/dist/routes/computer-use/subject-projection.d.ts +5 -7
  253. package/dist/routes/computer-use/subject-projection.js +20 -19
  254. package/dist/routes/computer-use/types.d.ts +169 -210
  255. package/dist/routes/computer-use/types.js +13 -5
  256. package/dist/routes/preview.js +0 -1
  257. package/dist/routes/scripted/bundle.d.ts +3 -6
  258. package/dist/routes/scripted/bundle.js +11 -16
  259. package/dist/routes/scripted/plan.d.ts +5 -7
  260. package/dist/routes/scripted/plan.js +6 -4
  261. package/dist/routes/scripted/result.d.ts +4 -1
  262. package/dist/routes/scripted/result.js +10 -6
  263. package/dist/routes/scripted/route.js +10 -11
  264. package/dist/routes/scripted/scenario.d.ts +1 -1
  265. package/dist/routes/scripted/scenario.js +1 -1
  266. package/dist/routes/scripted/setup.d.ts +3 -2
  267. package/dist/routes/scripted/setup.js +22 -21
  268. package/dist/routes/scripted/subject.d.ts +8 -3
  269. package/dist/routes/scripted/subject.js +9 -5
  270. package/dist/routes/scripted/surface-records.js +1 -1
  271. package/dist/routes/scripted/surface-sessions.d.ts +2 -2
  272. package/dist/routes/scripted/surface-sessions.js +4 -4
  273. package/dist/routes/scripted/types.d.ts +19 -36
  274. package/dist/routes/scripted/types.js +1 -2
  275. package/dist/routes/shared-world/{seat-records.js → bundle-records.js} +8 -8
  276. package/dist/routes/shared-world/bundle.d.ts +2 -2
  277. package/dist/routes/shared-world/bundle.js +22 -26
  278. package/dist/routes/shared-world/checkpoints.d.ts +4 -4
  279. package/dist/routes/shared-world/checkpoints.js +4 -4
  280. package/dist/routes/shared-world/comms.d.ts +5 -4
  281. package/dist/routes/shared-world/comms.js +28 -41
  282. package/dist/routes/shared-world/external-public.d.ts +5 -5
  283. package/dist/routes/shared-world/external-public.js +19 -20
  284. package/dist/routes/shared-world/handoff.d.ts +4 -4
  285. package/dist/routes/shared-world/handoff.js +50 -50
  286. package/dist/routes/shared-world/lobby-code.d.ts +5 -5
  287. package/dist/routes/shared-world/lobby-code.js +13 -13
  288. package/dist/routes/shared-world/{seats.d.ts → participant-specs.d.ts} +8 -6
  289. package/dist/routes/shared-world/{seats.js → participant-specs.js} +43 -48
  290. package/dist/routes/shared-world/plan.d.ts +2 -6
  291. package/dist/routes/shared-world/plan.js +1 -2
  292. package/dist/routes/shared-world/provenance.d.ts +4 -4
  293. package/dist/routes/shared-world/provenance.js +4 -4
  294. package/dist/routes/shared-world/provisioned.d.ts +3 -2
  295. package/dist/routes/shared-world/provisioned.js +46 -40
  296. package/dist/routes/shared-world/result.js +31 -19
  297. package/dist/routes/shared-world/route.js +37 -41
  298. package/dist/routes/shared-world/setup.d.ts +5 -4
  299. package/dist/routes/shared-world/setup.js +12 -14
  300. package/dist/routes/shared-world/types.d.ts +53 -126
  301. package/dist/routes/shared-world/types.js +2 -2
  302. package/dist/routes/terminal/adapter.d.ts +8 -8
  303. package/dist/routes/terminal/adapter.js +28 -125
  304. package/dist/routes/terminal/bundle.d.ts +7 -12
  305. package/dist/routes/terminal/bundle.js +24 -34
  306. package/dist/routes/terminal/credentials.d.ts +2 -2
  307. package/dist/routes/terminal/credentials.js +16 -16
  308. package/dist/routes/terminal/dry-run.d.ts +1 -1
  309. package/dist/routes/terminal/dry-run.js +9 -11
  310. package/dist/routes/terminal/encoding.d.ts +1 -1
  311. package/dist/routes/terminal/encoding.js +2 -2
  312. package/dist/routes/terminal/ledger.d.ts +6 -6
  313. package/dist/routes/terminal/ledger.js +9 -9
  314. package/dist/routes/terminal/live-finish.d.ts +1 -2
  315. package/dist/routes/terminal/live-finish.js +21 -20
  316. package/dist/routes/terminal/live-sandbox.d.ts +3 -2
  317. package/dist/routes/terminal/live-sandbox.js +20 -20
  318. package/dist/routes/terminal/participant-text.d.ts +23 -0
  319. package/dist/routes/terminal/participant-text.js +165 -0
  320. package/dist/routes/terminal/plan.d.ts +2 -6
  321. package/dist/routes/terminal/plan.js +13 -9
  322. package/dist/routes/terminal/recorder.d.ts +6 -1
  323. package/dist/routes/terminal/recorder.js +12 -4
  324. package/dist/routes/terminal/result.js +4 -4
  325. package/dist/routes/terminal/route.js +26 -26
  326. package/dist/routes/terminal/runtime.d.ts +3 -2
  327. package/dist/routes/terminal/runtime.js +3 -3
  328. package/dist/routes/terminal/sandbox.d.ts +3 -3
  329. package/dist/routes/terminal/sandbox.js +9 -9
  330. package/dist/routes/terminal/session.js +16 -14
  331. package/dist/routes/terminal/token-usage.js +5 -5
  332. package/dist/routes/terminal/trace.d.ts +5 -8
  333. package/dist/routes/terminal/trace.js +9 -64
  334. package/dist/routes/terminal/types.d.ts +85 -93
  335. package/dist/routes/terminal/types.js +9 -4
  336. package/dist/run/active-runs.d.ts +13 -0
  337. package/dist/run/active-runs.js +12 -0
  338. package/dist/run/bundle-shape.d.ts +2 -1
  339. package/dist/run/bundle-shape.js +4 -4
  340. package/dist/run/bundle.d.ts +63 -56
  341. package/dist/run/bundle.js +9 -8
  342. package/dist/run/cost-summary.js +3 -2
  343. package/dist/run/costs.d.ts +6 -6
  344. package/dist/run/costs.js +10 -10
  345. package/dist/run/detail.d.ts +5 -5
  346. package/dist/run/detail.js +6 -6
  347. package/dist/run/dry-run.js +5 -12
  348. package/dist/run/{study-files.d.ts → evidence-files.d.ts} +4 -4
  349. package/dist/run/{study-files.js → evidence-files.js} +5 -5
  350. package/dist/run/feedback-shape.js +1 -1
  351. package/dist/run/judge.d.ts +16 -4
  352. package/dist/run/judge.js +24 -7
  353. package/dist/run/locate.d.ts +2 -0
  354. package/dist/run/locate.js +3 -1
  355. package/dist/run/outcomes.d.ts +3 -3
  356. package/dist/run/outcomes.js +3 -3
  357. package/dist/run/participant-records.d.ts +2 -2
  358. package/dist/run/participant-records.js +2 -2
  359. package/dist/run/paths.js +1 -1
  360. package/dist/run/pricing.d.ts +19 -9
  361. package/dist/run/pricing.js +30 -18
  362. package/dist/run/projection.d.ts +13 -13
  363. package/dist/run/projection.js +8 -8
  364. package/dist/run/reclaim.d.ts +6 -0
  365. package/dist/run/reclaim.js +13 -3
  366. package/dist/run/results.d.ts +1 -1
  367. package/dist/run/run-index.d.ts +1 -1
  368. package/dist/run/run-index.js +11 -11
  369. package/dist/run/run.d.ts +4 -2
  370. package/dist/run/run.js +9 -5
  371. package/dist/run/sandbox-receipts.d.ts +4 -4
  372. package/dist/run/sandbox-receipts.js +4 -4
  373. package/dist/run/shared-world-evidence.d.ts +47 -47
  374. package/dist/run/shared-world-shape.d.ts +3 -3
  375. package/dist/run/shared-world-shape.js +11 -11
  376. package/dist/run/stats.d.ts +5 -5
  377. package/dist/run/stats.js +8 -8
  378. package/dist/run/status.d.ts +16 -6
  379. package/dist/run/status.js +31 -8
  380. package/dist/run/streams.d.ts +26 -19
  381. package/dist/run/terminal-contract.d.ts +5 -5
  382. package/dist/run/terminal-contract.js +4 -4
  383. package/dist/run/transient-comms-secrets.d.ts +5 -0
  384. package/dist/run/transient-comms-secrets.js +12 -0
  385. package/dist/run-lab.d.ts +36 -34
  386. package/dist/run-lab.js +41 -37
  387. package/dist/subject/desktop-cli.d.ts +1 -1
  388. package/dist/subject/desktop-cli.js +1 -1
  389. package/dist/subject/local-tree-archive.d.ts +1 -1
  390. package/dist/subject/local-tree-archive.js +4 -4
  391. package/dist/subject/local-tree.d.ts +2 -2
  392. package/dist/subject/local-tree.js +1 -1
  393. package/dist/subject/node-bootstrap.d.ts +1 -1
  394. package/dist/subject/node-bootstrap.js +4 -4
  395. package/dist/subject/runtime.js +5 -5
  396. package/dist/subject/serve.js +1 -1
  397. package/dist/subject/steps.d.ts +4 -4
  398. package/dist/subject/steps.js +5 -5
  399. package/dist/substrates/e2b/cdp-probe.d.ts +2 -2
  400. package/dist/substrates/e2b/cdp-probe.js +1 -1
  401. package/dist/substrates/e2b/desktop-browser.d.ts +3 -3
  402. package/dist/substrates/e2b/desktop-browser.js +4 -4
  403. package/dist/substrates/e2b/desktop-cdp.d.ts +7 -7
  404. package/dist/substrates/e2b/desktop-cdp.js +4 -4
  405. package/dist/substrates/e2b/desktop-geometry.d.ts +4 -4
  406. package/dist/substrates/e2b/desktop-geometry.js +3 -3
  407. package/dist/substrates/e2b/desktop-media.js +2 -2
  408. package/dist/substrates/e2b/sandbox.js +1 -1
  409. package/dist/substrates/e2b/sdk.js +2 -2
  410. package/dist/substrates/local/runtime-host.d.ts +2 -0
  411. package/dist/substrates/local/runtime-host.js +6 -0
  412. package/dist/tui/actions.d.ts +7 -5
  413. package/dist/tui/actions.js +18 -9
  414. package/dist/tui-app.js +42 -42
  415. package/dist/verify/actor.d.ts +10 -10
  416. package/dist/verify/actor.js +15 -15
  417. package/dist/verify/artifacts.d.ts +1 -1
  418. package/dist/verify/artifacts.js +3 -3
  419. package/dist/verify/costs.d.ts +2 -2
  420. package/dist/verify/costs.js +2 -2
  421. package/dist/verify/liveness.d.ts +1 -1
  422. package/dist/verify/liveness.js +4 -1
  423. package/dist/verify/rerun.d.ts +1 -1
  424. package/dist/verify/rerun.js +1 -1
  425. package/dist/verify/shared-world.js +2 -2
  426. package/dist/verify/verify.js +6 -6
  427. package/docs/README.md +1 -1
  428. package/docs/architecture/actor-contract.md +60 -22
  429. package/docs/architecture/desktop-sessions.md +9 -9
  430. package/docs/architecture/external-public-shared-world.md +5 -0
  431. package/docs/architecture/observer.md +4 -4
  432. package/docs/architecture/restricted-codex-analysis.md +36 -2
  433. package/docs/architecture/state-driven-executor.md +4 -5
  434. package/docs/architecture/task-protocol-support.md +3 -5
  435. package/docs/architecture/{terminal-product-lane.md → terminal-product-route.md} +24 -16
  436. package/docs/contracts/run-bundle.md +10 -8
  437. package/docs/contracts/schemas.md +109 -53
  438. package/docs/contracts/study-analysis.md +24 -0
  439. package/docs/decisions/0004-participant-desktops-stay-in-the-route.md +2 -1
  440. package/docs/product/automatic-analysis.md +1 -0
  441. package/docs/ramp/README.md +2 -1
  442. package/package.json +4 -4
  443. package/skills/humanish/SKILL.md +3 -2
  444. package/skills/humanish/agents/openai.yaml +1 -1
  445. package/dist/deprecated.d.ts +0 -90
  446. package/dist/deprecated.js +0 -106
  447. package/dist/lab/bag-overrides.d.ts +0 -18
  448. package/dist/lab/bag-overrides.js +0 -121
  449. package/dist/routes/computer-use/legacy-lane-spec.d.ts +0 -62
  450. package/dist/routes/computer-use/legacy-lane-spec.js +0 -39
  451. /package/dist/routes/computer-use/{fanout-lanes.d.ts → fanout-records.d.ts} +0 -0
  452. /package/dist/routes/computer-use/{run-lanes.d.ts → live-phase.d.ts} +0 -0
  453. /package/dist/routes/shared-world/{seat-records.d.ts → bundle-records.d.ts} +0 -0
@@ -1,9 +1,6 @@
1
1
  import {} from "../../analysis/automatic-completion.js";
2
- import {} from "../../run/status.js";
3
- import {} from "../../substrates/e2b/sdk.js";
4
- import { renderObserver } from "../../observer/render.js";
5
2
  import {} from "../../run/bundle.js";
6
- /** Provider-neutral metadata constant: the lane's non-secret tag (mirrors CUA_ACTOR_LAB_PROVIDER_METADATA). */
3
+ /** Provider-neutral metadata constant: the route's non-secret tag (mirrors CUA_ACTOR_LAB_PROVIDER_METADATA). */
7
4
  export const TERMINAL_PRODUCT_LAB_PROVIDER_METADATA = {
8
5
  mode: "terminal-product-lab",
9
6
  tool: "humanish",
@@ -25,6 +22,14 @@ export const DEFAULT_REQUEST_TIMEOUT_MS = 60_000;
25
22
  export const PRODUCT_SETUP_TIMEOUT_MS = 300_000;
26
23
  // How much of a captured stream / log tail rides a (redacted) message field.
27
24
  export const TAIL_CHARS = 2000;
25
+ // How much of one decoded agent message or reasoning item the actor trace keeps.
26
+ export const MESSAGE_CHARS = 8000;
27
+ // How many message and reasoning items the actor trace keeps, and their total text bytes. Analysis
28
+ // reads at most 160 KiB of evidence text, and the trace is stored twice (actor.json and run.json).
29
+ export const TEXT_ITEMS_MAX = 200;
30
+ export const TEXT_ITEMS_BYTES = 128 * 1024;
31
+ // The longest stdout line the participant reader holds while waiting for its newline.
32
+ export const PENDING_LINE_CHARS = 1024 * 1024;
28
33
  // Hard cap on the retained event-stream + transcript size, so a runaway agent cannot balloon the
29
34
  // bundle. Redaction runs PRE-truncation so a cut can never split a secret past the scrubber.
30
35
  export const MAX_TRANSCRIPT_BYTES = 512 * 1024;
@@ -0,0 +1,13 @@
1
+ import type { PreparedRunArtifactPaths } from "./paths.js";
2
+ import type { RunStatusHandle } from "./status.js";
3
+ export interface ActiveRun {
4
+ cwd: string;
5
+ runId: string;
6
+ /** The run's own directory, so reclaim never resolves the id as an alias. */
7
+ paths: PreparedRunArtifactPaths;
8
+ status: Pick<RunStatusHandle, "interrupt">;
9
+ }
10
+ /** Register a started run; the returned function removes it. */
11
+ export declare function registerActiveRun(run: ActiveRun): () => void;
12
+ /** The runs started in this process that have not closed, oldest first. */
13
+ export declare function activeRuns(): ActiveRun[];
@@ -0,0 +1,12 @@
1
+ const active = new Set();
2
+ /** Register a started run; the returned function removes it. */
3
+ export function registerActiveRun(run) {
4
+ active.add(run);
5
+ return () => {
6
+ active.delete(run);
7
+ };
8
+ }
9
+ /** The runs started in this process that have not closed, oldest first. */
10
+ export function activeRuns() {
11
+ return [...active];
12
+ }
@@ -1,7 +1,8 @@
1
- import { type ReviewSummary, type RunBundle } from "./bundle.js";
1
+ import { type ReviewSummary, type RunAdapterScore, type RunBundle } from "./bundle.js";
2
2
  import { type StoredCleanupResult, type RunPointer } from "./results.js";
3
3
  export declare function isRunBundle(value: unknown): value is RunBundle;
4
4
  export declare function isCleanupResult(value: unknown): value is StoredCleanupResult;
5
+ export declare function isRunAdapterScore(value: unknown): value is RunAdapterScore;
5
6
  export declare const ARCHIVE_SHA256_PATTERN: RegExp;
6
7
  export declare function isReviewSummary(value: unknown): value is ReviewSummary;
7
8
  export declare function isRunPointer(value: unknown): value is RunPointer;
@@ -47,14 +47,14 @@ export function isRunBundle(value) {
47
47
  (value.subject === undefined || isRunSubjectProvenance(value.subject)) &&
48
48
  (value.desktopBrowser === undefined || isDesktopBrowserEvidence(value.desktopBrowser)) &&
49
49
  (value.rerun === undefined || isRunRerunLineage(value.rerun)) &&
50
- // Optional shared-world fields. Tolerant SHAPE guard only; the interaction semantics
50
+ // Optional shared-world fields. Tolerant shape guard only; the interaction semantics
51
51
  // (timeline well-formedness, single-plane, delta-on-pass) are the verify check's job.
52
52
  (value.attributionClass === undefined ||
53
53
  value.attributionClass === "isolated" ||
54
54
  value.attributionClass === "shared-world") &&
55
55
  (value.sharedWorld === undefined || isSharedWorldEvidence(value.sharedWorld)) &&
56
56
  // Optional, adapter-namespaced product score (the extension seam). When present, validate only
57
- // its SHAPE; core never reads the adapter's `data` payload.
57
+ // its shape; core never reads the adapter's `data` payload.
58
58
  (value.adapterScore === undefined || isRunAdapterScore(value.adapterScore)) &&
59
59
  // Optional scorer provenance. Library callers may omit it; when present it must be
60
60
  // well-shaped.
@@ -171,7 +171,7 @@ function isRunScorerProvenance(value) {
171
171
  value.exports.length > 0 &&
172
172
  value.exports.every((name) => name === "score" || name === "deriveFeedback" || name === "deriveArtifacts"));
173
173
  }
174
- function isRunAdapterScore(value) {
174
+ export function isRunAdapterScore(value) {
175
175
  return (isRecord(value) &&
176
176
  value.schema === "humanish.adapter-score.v1" &&
177
177
  typeof value.namespace === "string" &&
@@ -182,7 +182,7 @@ function isRunAdapterScore(value) {
182
182
  typeof value.summary === "string" &&
183
183
  (value.data === undefined || isRecord(value.data)));
184
184
  }
185
- // The local-tree archive content pin: sha256 hex, full 64 chars (NOT the repo's 16-char
185
+ // The local-tree archive content pin: sha256 hex, full 64 chars (unlike the repo's 16-char
186
186
  // display-digest convention -- this value is the provenance pin itself, persisted in full).
187
187
  export const ARCHIVE_SHA256_PATTERN = /^[a-f0-9]{64}$/;
188
188
  function isRunSubjectProvenance(value) {
@@ -14,9 +14,9 @@ export declare const PUBLIC_TARGET_CWD = "[target-cwd]";
14
14
  * #8). Core never reads its `data` and knows none of the adopter's nouns — the `namespace` (e.g.
15
15
  * `"acme-pixelforge"`) scopes the whole record so core schemas stay product-agnostic and a future
16
16
  * inert-field audit does not misfire on a noun core never owned. The adopter's real scorecard
17
- * (component weights, product rubric) lives in ITS repo and is summarized into the generic
18
- * status/score/summary; everything product-specific rides under `data`. This is NOT a built-in
19
- * product scorer — it is the SEAM the adopter's scorer plugs into without forking core.
17
+ * (component weights, product rubric) lives in the adopter's repo and is summarized into the generic
18
+ * status/score/summary; everything product-specific rides under `data`. Core ships no built-in
19
+ * product scorer; this is the seam the adopter's scorer plugs into without forking core.
20
20
  */
21
21
  export interface RunAdapterScore {
22
22
  schema: "humanish.adapter-score.v1";
@@ -56,14 +56,14 @@ export interface RunFeedbackCandidate {
56
56
  proposed_next_state: "watch" | "adapter-hardening" | "target-app-setup" | "actor-auth" | "setup-quality-review" | "study-quality-review";
57
57
  acceptance_proof: string[];
58
58
  /**
59
- * OPTIONAL, ADAPTER-NAMESPACED product-noun block (the layer-6 extension seam, issue #154
59
+ * Optional, adapter-namespaced product-noun block (the layer-6 extension seam, issue #154
60
60
  * acceptance #8 + the "record product-specific concepts as NON-core nouns" list). A thin adapter
61
61
  * records product-specific concepts — public CLI/product command observed, hosted product
62
62
  * success-or-blocker, feedback id/draft observed, media/job/asset ids, explicit
63
- * no-media/no-provider-spend proof, defection/friction risk — WITHOUT making any of them core
63
+ * no-media/no-provider-spend proof, defection/friction risk, without making any of them core
64
64
  * primitives. They ride under a single namespaced field so core's feedback enums
65
65
  * (`evidence.kind`, `proposed_next_state`) stay product-agnostic and a future inert-field audit
66
- * never misfires on a noun core never owned. Core validates only the SHAPE (a non-empty
66
+ * never misfires on a noun core never owned. Core validates only the shape (a non-empty
67
67
  * `namespace` + a `data` record); the keys inside `data` are the adapter's, never core's.
68
68
  */
69
69
  adapter?: {
@@ -89,19 +89,19 @@ export interface RunAdapterArtifact {
89
89
  /**
90
90
  * Provenance for a CONFIG-DECLARED adopter scorer (#316): the repo-relative entry path and a digest
91
91
  * of its ENTRY-MODULE bytes, recorded so a `review.scorer.ref`/`--scorer` run honestly states which
92
- * out-of-tree judgment it attached. Core-computed (path + digest), never adopter-supplied. A LIBRARY
93
- * caller (hooks passed directly through RunLabOptions) has implicit provenance — their code IS their
94
- * provenance — so this block is ABSENT there and every pre-#316 bundle stays byte-stable + verifiable.
92
+ * out-of-tree judgment it attached. Core-computed (path + digest), never adopter-supplied. A library
93
+ * caller (hooks passed directly through RunLabOptions) has implicit provenance, because its code is its
94
+ * provenance, so this block is absent there and every pre-#316 bundle stays byte-stable + verifiable.
95
95
  *
96
- * The digest pins the entry file's IDENTITY, not its behavioral closure: a `export { score } from
96
+ * The digest pins the entry file's identity only; modules it loads are outside it: a `export { score } from
97
97
  * "../outside.mjs"` re-export is not captured, and `import()` re-opens the path (a benign same-author
98
- * TOCTOU). Treat it as evidence-not-gate, and do NOT extend the loader to less-trusted config.
98
+ * TOCTOU). Treat it as evidence-not-gate, and do not extend the loader to less-trusted config.
99
99
  */
100
100
  export interface RunScorerProvenance {
101
101
  schema: "humanish.scorer-provenance.v1";
102
102
  /** Repo-relative entry path (e.g. "scorers/example.mjs"), clamped inside the target cwd. */
103
103
  ref: string;
104
- /** digestText over the readContainedRegularFile ENTRY bytes — the entry module only, not a lockfile of the executed graph. */
104
+ /** digestText over the readContainedRegularFile entry bytes: the entry module only, with no lockfile of the executed graph. */
105
105
  digest: string;
106
106
  /** Which door declared it: the committed manifest, or the CLI `--scorer` override. */
107
107
  source: "manifest" | "cli-flag";
@@ -135,7 +135,7 @@ export interface RunEvent {
135
135
  /**
136
136
  * One executed (or declared) subject-state seed step. Live records carry execution fields
137
137
  * (ok/exitCode/timedOut/durationMs); dry-run "declared, not run" records carry only the
138
- * declaration (name, phase, command DIGEST). The command itself never persists — the digest
138
+ * declaration (name, phase, command digest). The command itself never persists; the digest
139
139
  * pins "same recipe" across bundles while the lab YAML in the consumer's repo stays the
140
140
  * plaintext source of truth (publish-safe by construction).
141
141
  */
@@ -151,8 +151,8 @@ export interface RunSubjectStateStepRecord {
151
151
  durationMs?: number;
152
152
  }
153
153
  /**
154
- * Structured subject provenance (invariant 5): what the subject WAS — code pin (repo/commit,
155
- * or a local-tree archive digest) AND state story. Optional additive field on
154
+ * Structured subject provenance (invariant 5): what the subject was, as a code pin (repo/commit,
155
+ * or a local-tree archive digest) and state story. Optional additive field on
156
156
  * humanish.run-bundle.v1; absent on bundles from backends that have not adopted it (and on all
157
157
  * pre-existing bundles).
158
158
  */
@@ -165,7 +165,7 @@ export interface RunSubjectProvenance {
165
165
  commit?: string;
166
166
  /**
167
167
  * Local-tree-route only (additive): 64 lowercase-hex sha256 over the sorted packed-entries
168
- * list (docs/contracts/schemas.md). This is the provenance PIN for the local-tree route: a
168
+ * list (docs/contracts/schemas.md). This is the provenance pin for the local-tree route: a
169
169
  * dirty working tree cannot be commit-pinned, so the archive content digest stands in for it.
170
170
  */
171
171
  archiveSha256?: string;
@@ -174,11 +174,11 @@ export interface RunSubjectProvenance {
174
174
  * at pack time. Absent when the packed root was not a git work tree at all.
175
175
  */
176
176
  dirty?: boolean;
177
- /** Declared env NAMES provisioned for the subject — names only, values never. */
177
+ /** Declared env names provisioned for the subject; names only, never values. */
178
178
  envNames?: string[];
179
179
  state: {
180
180
  /**
181
- * seeded: live run, steps declared, ALL ran ok, no external state declared.
181
+ * seeded: live run, steps declared, all ran ok, no external state declared.
182
182
  * unpinned: external state declared (seed records, if any, still attached — migrating
183
183
  * an external DB is still unpinned overall).
184
184
  * declared-not-run: steps declared but not (all) executed ok — dry-run contract bundles
@@ -187,7 +187,7 @@ export interface RunSubjectProvenance {
187
187
  * "absence declared" marker invariant 5 requires.
188
188
  * external-public: (#164 phase 2) an operator-DECLARED, operator-OWNED public deployment used
189
189
  * directly as the shared plane — humanish neither provisioned nor seeded it (no getHost, no
190
- * clone, no in-sandbox filesystem). NOT "seeded" (nothing was seeded), NOT "unpinned" (this is
190
+ * clone, no in-sandbox filesystem). It is not "seeded" (nothing was seeded) and not "unpinned" (this is
191
191
  * an owned target, not an uncontrolled external DB). The honest marker for the external-public
192
192
  * plane class; verify asserts it in place of the getHost seeded gate.
193
193
  */
@@ -197,10 +197,10 @@ export interface RunSubjectProvenance {
197
197
  };
198
198
  }
199
199
  /**
200
- * How well a run attributed INTERACTION between actors — a new, ORTHOGONAL honesty axis to the
200
+ * How well a run attributed interaction between actors: a separate honesty axis, orthogonal to the
201
201
  * persona-sampling evidence classes (which answer "how representative is the actor?"). Absent ==
202
- * `isolated` (every existing bundle byte-stable). `shared-world` means N roles drove ONE mutable
203
- * plane and their per-role attribution is weaker (its ceiling is pinned in `sharedWorld.attributionLimits`).
202
+ * `isolated` (every existing bundle byte-stable). `shared-world` means N participants drove one
203
+ * mutable plane and their per-participant attribution is weaker (its ceiling is pinned in `sharedWorld.attributionLimits`).
204
204
  */
205
205
  type RunAttributionClass = "isolated" | "shared-world";
206
206
  export interface RunBundle {
@@ -259,15 +259,15 @@ export interface RunBundle {
259
259
  * everywhere else. */
260
260
  subject?: RunSubjectProvenance;
261
261
  /**
262
- * The custom E2B desktop TEMPLATE (image) the run's sandbox(es) actually launched on, from
263
- * `execution.desktop.template` — so the evidence shows WHICH image ran (a subject needing
262
+ * The custom E2B desktop template (image) the run's sandbox(es) actually launched on, from
263
+ * `execution.desktop.template`, so the evidence shows which image ran (a subject needing
264
264
  * runtimes the stock `desktop` image lacks runs on an adopter's template). Optional + additive:
265
265
  * present only when a template was configured (absent == the stock `desktop` template, every
266
266
  * pre-existing bundle byte-stable). A template name is public-safe (not a secret).
267
267
  */
268
268
  desktopTemplate?: string;
269
269
  /**
270
- * Browser family requested for hosted desktop actor lanes and the in-sandbox command that opened
270
+ * Browser family requested for hosted desktop participants and the in-sandbox command that opened
271
271
  * it, when explicitly configured. Optional + additive; absent means the historical default opener
272
272
  * path was used or the backend does not create a headed desktop.
273
273
  */
@@ -291,8 +291,8 @@ export interface RunBundle {
291
291
  };
292
292
  };
293
293
  /**
294
- * Optional lineage for a run that intentionally re-executes selected lanes from a prior
295
- * multi-lane run. This keeps retry-like workflows explicit: the new run is linked to the old
294
+ * Optional lineage for a run that intentionally re-executes selected participants from a
295
+ * prior multi-participant run. This keeps retry-like workflows explicit: the new run is linked to the old
296
296
  * evidence, but it never mutates or silently "fixes" the original verdict.
297
297
  */
298
298
  rerun?: RunRerunLineage;
@@ -307,20 +307,20 @@ export interface RunBundle {
307
307
  */
308
308
  sharedWorld?: SharedWorldEvidence;
309
309
  /**
310
- * OPTIONAL, ADAPTER-NAMESPACED product score (the layer-6 extension seam, issue #154 acceptance
311
- * #8). A thin adapter's `score` hook returns a `RunAdapterScore`; the lane attaches it here
312
- * WITHOUT core knowing any product noun (the score is namespaced + its breakdown lives in `data`).
310
+ * Optional, adapter-namespaced product score (the layer-6 extension seam, issue #154 acceptance
311
+ * #8). A thin adapter's `score` hook returns a `RunAdapterScore`; the route attaches it here
312
+ * without core knowing any product noun (the score is namespaced + its breakdown lives in `data`).
313
313
  * The default mission-based verdict (`review`) is unchanged when no scorer hook is given.
314
314
  */
315
315
  adapterScore?: RunAdapterScore;
316
316
  /**
317
- * OPTIONAL provenance for a CONFIG-DECLARED scorer (#316). Present only when the scorer was loaded
317
+ * Optional provenance for a config-declared scorer (#316). Present only when the scorer was loaded
318
318
  * from `review.scorer.ref` / `--scorer`; absent for library callers and every pre-#316 bundle
319
319
  * (tolerated-absent in isRunBundle so those still verify). Evidence, not a gate.
320
320
  */
321
321
  scorerProvenance?: RunScorerProvenance;
322
322
  /**
323
- * OPTIONAL, ADAPTER-NAMESPACED product/state proof artifacts. Core validates
323
+ * Optional, adapter-namespaced product/state proof artifacts. Core validates
324
324
  * shape and local relative artifact references, then verifies the referenced
325
325
  * files exist. The adapter owns the payload schema under `namespace`.
326
326
  */
@@ -339,31 +339,33 @@ export interface RunBundle {
339
339
  */
340
340
  lab?: RunLabProvenance;
341
341
  /**
342
- * OPTIONAL, ADDITIVE run-level cost ESTIMATE (humanish.run-cost-summary.v1): the sum of every
343
- * lane's model-token estimate PLUS the E2B desktop-minute estimate, carrying the SAME
342
+ * Optional, additive run-level cost estimate (humanish.run-cost-summary.v1): the sum of every
343
+ * participant's model-token estimate plus the E2B desktop-minute estimate, carrying the same
344
344
  * null-discipline the terminal cost ledger already ships. Absent on pre-existing bundles and
345
- * dry runs; a live run that spends nothing records an explicit zero with no lines. Every dollar figure here is an ESTIMATE,
345
+ * dry runs; a live run that spends nothing records an explicit zero with no lines. Every dollar figure here is an estimate,
346
346
  * never an authoritative charge; verify asserts its LABELING/provenance, never its magnitude.
347
347
  */
348
348
  cost?: RunCostSummary;
349
349
  }
350
350
  /**
351
- * One contributing cost line of a RunCostSummary. A line is PRESENT even when it cannot be priced
352
- * (records that we TRIED and could not) — an unpriceable line carries estimatedCostUsd: null + a
353
- * `reason` and contributes NOTHING to the summary total (invariant 5). `estimatedCostUsd` is NEVER
351
+ * One contributing cost line of a RunCostSummary. A line is present even when it cannot be priced
352
+ * (it records that we tried and could not): an unpriceable line carries estimatedCostUsd: null + a
353
+ * `reason` and contributes nothing to the summary total (invariant 5). `estimatedCostUsd` is never
354
354
  * coerced to 0.
355
355
  */
356
356
  export interface RunCostLine {
357
357
  kind: "model-tokens" | "desktop-minutes";
358
358
  laneId?: string;
359
359
  modelId?: string;
360
- /** null = NOT MEASURED / no rate; never coerced to 0. */
360
+ /** null = not measured / no rate; never coerced to 0. */
361
361
  estimatedCostUsd: number | null;
362
362
  reason?: "no_rate_for_model" | "no_rate_for_desktop" | "no_token_usage" | "no_duration" | "closing_usage_unreported" | "interaction_usage_unreported" | "no_desktop_resources" | "desktop_lifetime_incomplete" | "account_billing_unknown";
363
363
  /** Pricing provenance date; non-null iff estimatedCostUsd is non-null. */
364
364
  ratesAsOf: string | null;
365
365
  source?: string;
366
366
  placeholder?: boolean;
367
+ /** A model-tokens line priced from runtime-turn totals at the base tier (ActorEstimatedCost). */
368
+ basis?: "aggregated_turns_base_rate";
367
369
  /** Optional allocation evidence on newer desktop lines; older aggregate lines remain valid. */
368
370
  desktop?: {
369
371
  minutes: number | null;
@@ -378,15 +380,15 @@ export interface RunCostLine {
378
380
  };
379
381
  }
380
382
  /**
381
- * The run-level cost ESTIMATE. `estimatedTotalUsd` is the rounded sum of ONLY the non-null
382
- * `breakdown` lines; it is null iff EVERY line is null (never 0-coerced). `fullyEstimated` is
383
- * false when any applicable line is null (the total is then a LOWER BOUND). Every non-null dollar
383
+ * The run-level cost estimate. `estimatedTotalUsd` is the rounded sum of only the non-null
384
+ * `breakdown` lines; it is null iff every line is null (never 0-coerced). `fullyEstimated` is
385
+ * false when any applicable line is null (the total is then a lower bound). Every non-null dollar
384
386
  * figure carries `ratesAsOf`; `placeholder` is true when any contributing rate is a stand-in.
385
387
  */
386
388
  export interface RunCostSummary {
387
389
  schema: "humanish.run-cost-summary.v1";
388
390
  currency: "usd";
389
- /** Sum of the KNOWN (non-null) lines; null iff every applicable line is null; 0 with no lines
391
+ /** Sum of the known (non-null) lines; null iff every applicable line is null; 0 with no lines
390
392
  * for a spend-free run. */
391
393
  estimatedTotalUsd: number | null;
392
394
  /** Oldest asOf across contributing rates; null when nothing was priced. */
@@ -436,14 +438,14 @@ export interface RunRerunLineage {
436
438
  }>;
437
439
  }
438
440
  /**
439
- * What happened to the PARTICIPANTS in a study, with the denominator attached.
441
+ * What happened to the participants in a study, with the denominator attached.
440
442
  *
441
443
  * A stakeholder watching through the glass forms conclusions from vivid moments — that is the
442
444
  * classic failure of the viewing room, and it is why researchers synthesize rather than letting the
443
445
  * room decide. So anything shown to a stakeholder carries its count, or it becomes a machine for
444
446
  * manufacturing certainty from n=1 (docs/principles/three-roles.md).
445
447
  *
446
- * These are OUTCOMES, not scores. `abandoned` is the most valuable thing a usability study
448
+ * These are outcomes, not scores. `abandoned` is the most valuable thing a usability study
447
449
  * produces, and `harnessFailed` is the only member that says the instrument, rather than the
448
450
  * product, is what went wrong.
449
451
  */
@@ -463,7 +465,7 @@ export interface ParticipantOutcomes {
463
465
  /**
464
466
  * Participants who reported friction or a defect on the way, whatever their outcome.
465
467
  *
466
- * This is NOT a failure count and it overlaps the others on purpose — someone can reach the goal
468
+ * This is not a failure count, and it overlaps the others on purpose: someone can reach the goal
467
469
  * and still tell you the road there was broken. A live two-persona run made the case: both
468
470
  * participants signed in, so "2/2 reached the goal" was true, and the keyboard-first one also
469
471
  * reported that the signature step could not be completed without a mouse. Reporting only the
@@ -491,18 +493,18 @@ export interface ReviewSummary {
491
493
  * and at least one session produced a funnel. Absent means no protocol was measured, never that
492
494
  * everyone finished.
493
495
  */
494
- tasks?: StudyTaskFunnel;
496
+ tasks?: RunTaskFunnel;
495
497
  }
496
498
  /**
497
499
  * The study's task funnel: for each declared task, how many participants completed it, out of how
498
500
  * many sessions produced a funnel. This is "where did people get stuck" as data — the number a
499
501
  * researcher reads first — where the per-participant funnels answer it one journey at a time.
500
502
  *
501
- * Aggregated by task id in declaration order. Every lane in a run shares the actor's protocol, so
503
+ * Aggregated by task id in declaration order. Every participant in a run shares the actor's protocol, so
502
504
  * ids line up across participants; a funnel missing a task id (a future mixed-protocol route)
503
505
  * simply does not count toward that task's denominator.
504
506
  */
505
- export interface StudyTaskFunnel {
507
+ export interface RunTaskFunnel {
506
508
  /** Sessions that produced a funnel — the denominator for every count below. */
507
509
  sessions: number;
508
510
  tasks: Array<{
@@ -519,20 +521,25 @@ export interface StudyTaskFunnel {
519
521
  unmeasured: number;
520
522
  }>;
521
523
  }
524
+ /** The run a bundle belongs to: the Run startRun returned, or a test's stand-in. */
525
+ export interface BundleRun {
526
+ readonly runId: string;
527
+ readonly mode: RunBundle["mode"];
528
+ readonly createdAt: string;
529
+ /** The manifest the run came from (#455), as the plan carried it to startRun. */
530
+ readonly lab?: RunLabProvenance | undefined;
531
+ }
522
532
  /**
523
- * The fields every run bundle starts with, in the saved order. A route passes its run, mode and
524
- * participant count; the public target cwd and the run's own artifact root are the defaults.
533
+ * The fields every run bundle starts with, in the saved order. The run supplies its id, mode,
534
+ * start time and lab; the route passes the participant count and source. The public target cwd
535
+ * and the run's own artifact root are the defaults.
525
536
  */
526
- export declare function bundleHead(args: {
537
+ export declare function bundleHead(run: BundleRun, args: {
527
538
  /** Publication restrictions (real communications), saved right after the schema. */
528
539
  publication?: RunBundle["publication"];
529
- runId: string;
530
- mode: RunBundle["mode"];
531
540
  participants: number;
532
- createdAt: string;
533
541
  cwd?: string;
534
542
  artifactRoot?: string;
535
- lab?: RunLabProvenance;
536
543
  source: RunBundle["source"];
537
544
  }): Pick<RunBundle, "schema" | "publication" | "runId" | "mode" | "simCount" | "createdAt" | "cwd" | "artifactRoot" | "lab" | "source">;
538
545
  /** The files every run directory holds, as the bundle names them. */
@@ -6,20 +6,21 @@ export const RUN_BUNDLE_FILE = "run.json";
6
6
  export const REVIEW_SCHEMA = "humanish.review.v1";
7
7
  export const PUBLIC_TARGET_CWD = "[target-cwd]";
8
8
  /**
9
- * The fields every run bundle starts with, in the saved order. A route passes its run, mode and
10
- * participant count; the public target cwd and the run's own artifact root are the defaults.
9
+ * The fields every run bundle starts with, in the saved order. The run supplies its id, mode,
10
+ * start time and lab; the route passes the participant count and source. The public target cwd
11
+ * and the run's own artifact root are the defaults.
11
12
  */
12
- export function bundleHead(args) {
13
+ export function bundleHead(run, args) {
13
14
  return {
14
15
  schema: RUN_BUNDLE_SCHEMA,
15
16
  ...(args.publication === undefined ? {} : { publication: args.publication }),
16
- runId: args.runId,
17
- mode: args.mode,
17
+ runId: run.runId,
18
+ mode: run.mode,
18
19
  simCount: args.participants,
19
- createdAt: args.createdAt,
20
+ createdAt: run.createdAt,
20
21
  cwd: args.cwd ?? PUBLIC_TARGET_CWD,
21
- artifactRoot: args.artifactRoot ?? path.join(".humanish", "runs", args.runId),
22
- ...(args.lab === undefined ? {} : { lab: args.lab }),
22
+ artifactRoot: args.artifactRoot ?? path.join(".humanish", "runs", run.runId),
23
+ ...(run.lab === undefined ? {} : { lab: run.lab }),
23
24
  source: args.source,
24
25
  };
25
26
  }
@@ -66,6 +66,7 @@ function modelCostLines(participants) {
66
66
  ratesAsOf: est.ratesAsOf,
67
67
  ...(est.source === undefined ? {} : { source: est.source }),
68
68
  ...(est.placeholder ? { placeholder: true } : {}),
69
+ ...(est.basis === undefined ? {} : { basis: est.basis }),
69
70
  });
70
71
  }
71
72
  return breakdown;
@@ -123,8 +124,8 @@ function costTotals(breakdown) {
123
124
  let anyKnown = false;
124
125
  let anyNull = false;
125
126
  let placeholder = false;
126
- // Aggregate freshness is CONSERVATIVE: an aggregate estimate is only as current as its OLDEST
127
- // contributing rate, so ratesAsOf takes the MIN (oldest) asOf — MAX would overclaim freshness the
127
+ // Aggregate freshness is conservative: an aggregate estimate is only as current as its oldest
128
+ // contributing rate, so ratesAsOf takes the minimum (oldest) asOf; the maximum would overclaim freshness the
128
129
  // moment operator-edited rates in src/run/pricing.ts diverge. Each breakdown line keeps its own true asOf.
129
130
  let minRatesAsOf = null;
130
131
  for (const line of breakdown) {
@@ -1,6 +1,6 @@
1
1
  import type { RunIndexEntry } from "./run-index.js";
2
2
  /** Additive accounting for retained attempts. Null means no estimate, never an invented zero. */
3
- export interface StudyCosts {
3
+ export interface CostTotals {
4
4
  estimatedTotalUsd: number | null;
5
5
  runEstimatedUsd: number | null;
6
6
  analysisEstimatedUsd: number | null;
@@ -16,12 +16,12 @@ export interface StudyCosts {
16
16
  /** No retained history, legacy report-only usage, or unreadable/conflicting accounting. */
17
17
  analysisHistoryUncertainRuns: number;
18
18
  }
19
- export interface StudyCostRow {
19
+ export interface CostRow {
20
20
  runId: string;
21
- costs: StudyCosts;
21
+ costs: CostTotals;
22
22
  warnings: string[];
23
23
  }
24
- export declare function emptyStudyCosts(): StudyCosts;
25
- export declare function addStudyCosts(into: StudyCosts, next: StudyCosts): void;
24
+ export declare function emptyCostTotals(): CostTotals;
25
+ export declare function addCostTotals(into: CostTotals, next: CostTotals): void;
26
26
  /** A read-only, bounded accounting pass. Never validates findings, dispatches, repairs or writes. */
27
- export declare function readStudyCosts(cwd: string, entry: RunIndexEntry): Promise<StudyCostRow>;
27
+ export declare function readCostTotals(cwd: string, entry: RunIndexEntry): Promise<CostRow>;
package/dist/run/costs.js CHANGED
@@ -2,11 +2,11 @@ import { round6 } from "./pricing.js";
2
2
  import { bindExistingRunArtifactPaths } from "./paths.js";
3
3
  import { contradictsAccountBilling } from "../verify/costs.js";
4
4
  import { EVIDENCE_LIMITS } from "../analysis/evidence.js";
5
- import { readBoundedStudyFile } from "./study-files.js";
6
- import { readAutomaticStudyAnalysisAccounting } from "../analysis/job.js";
7
- import { readStudyAnalysisAccountingRecords } from "../analysis/store-executions.js";
5
+ import { readBoundedFile } from "./evidence-files.js";
6
+ import { readAutomaticAnalysisAccounting } from "../analysis/job.js";
7
+ import { readAnalysisAccountingRecords } from "../analysis/store-executions.js";
8
8
  import { RUN_BUNDLE_FILE } from "./bundle.js";
9
- export function emptyStudyCosts() {
9
+ export function emptyCostTotals() {
10
10
  return {
11
11
  estimatedTotalUsd: null,
12
12
  runEstimatedUsd: null,
@@ -24,7 +24,7 @@ const isKnownUsd = (value) => typeof value === "number" && Number.isFinite(value
24
24
  function sumKnown(a, b) {
25
25
  return a === null && b === null ? null : round6((a ?? 0) + (b ?? 0));
26
26
  }
27
- export function addStudyCosts(into, next) {
27
+ export function addCostTotals(into, next) {
28
28
  for (const key of ["estimatedTotalUsd", "runEstimatedUsd", "analysisEstimatedUsd"]) {
29
29
  into[key] = sumKnown(into[key], next[key]);
30
30
  }
@@ -41,8 +41,8 @@ export function addStudyCosts(into, next) {
41
41
  }
42
42
  }
43
43
  /** A read-only, bounded accounting pass. Never validates findings, dispatches, repairs or writes. */
44
- export async function readStudyCosts(cwd, entry) {
45
- const costs = emptyStudyCosts();
44
+ export async function readCostTotals(cwd, entry) {
45
+ const costs = emptyCostTotals();
46
46
  // Run-cost and analysis-history warnings stay apart: only the second kind makes the history
47
47
  // uncertain, whatever a run-cost warning is named.
48
48
  const runWarnings = [];
@@ -50,7 +50,7 @@ export async function readStudyCosts(cwd, entry) {
50
50
  costs.runEstimatedUsd = isKnownUsd(entry.estimatedCostUsd) ? entry.estimatedCostUsd : null;
51
51
  try {
52
52
  const prepared = await bindExistingRunArtifactPaths(cwd, entry.runId);
53
- const bytes = await readBoundedStudyFile(prepared, RUN_BUNDLE_FILE, EVIDENCE_LIMITS.sourceBytes);
53
+ const bytes = await readBoundedFile(prepared, RUN_BUNDLE_FILE, EVIDENCE_LIMITS.sourceBytes);
54
54
  let bundle = null;
55
55
  try {
56
56
  bundle = bytes ? JSON.parse(bytes.toString("utf8")) : null;
@@ -82,8 +82,8 @@ export async function readStudyCosts(cwd, entry) {
82
82
  runWarnings.push("RUN_COST_COMPLETENESS_UNKNOWN");
83
83
  }
84
84
  const [history, automatic] = await Promise.all([
85
- readStudyAnalysisAccountingRecords(prepared),
86
- readAutomaticStudyAnalysisAccounting(prepared),
85
+ readAnalysisAccountingRecords(prepared),
86
+ readAutomaticAnalysisAccounting(prepared),
87
87
  ]);
88
88
  analysisWarnings.push(...history.warnings);
89
89
  const records = new Map(history.records.map((record) => [record.id, record]));
@@ -9,9 +9,9 @@ interface RunThought {
9
9
  at?: string;
10
10
  }
11
11
  export interface RunParticipant {
12
- /** Stream id — stable within a run, and what distinguishes lanes of one study. */
12
+ /** Stream id — stable within a run, and what distinguishes participants of one study. */
13
13
  id: string;
14
- /** What to call them on screen: the lane's own label, else the persona id. */
14
+ /** What to call them on screen: the participant's own label, else the persona id. */
15
15
  label: string;
16
16
  /** The persona id, when the trace recorded one. */
17
17
  personaId?: string;
@@ -21,7 +21,7 @@ export interface RunParticipant {
21
21
  * name alone does not.
22
22
  */
23
23
  traits: string[];
24
- /** `running`, `passed`, `failed`, `contract_proof_only` — the lane's own word for itself. */
24
+ /** `running`, `passed`, `failed`, `contract_proof_only` — the participant's own word for itself. */
25
25
  status?: string;
26
26
  /** Why the actor stopped, when it has. */
27
27
  completionReason?: string;
@@ -29,7 +29,7 @@ export interface RunParticipant {
29
29
  turns?: number;
30
30
  actions?: number;
31
31
  /**
32
- * Thoughts recorded so far. The mid-run flush carries the trace ITEMS but not the `counts` block,
32
+ * Thoughts recorded so far. The mid-run flush carries the trace items but not the `counts` block,
33
33
  * so a live participant has no turn count to show — but the thoughts can be counted directly, and
34
34
  * "8 thoughts" is a true statement about progress rather than an inferred turn number.
35
35
  */
@@ -52,7 +52,7 @@ export interface RunDetail {
52
52
  * Read one run's participants. Returns null when the run has no readable bundle yet — an ordinary
53
53
  * state for a run that has just started, not a failure.
54
54
  *
55
- * Reads the bundle NARROWLY rather than through `loadRunBundle`, which applies the strict
55
+ * Reads the bundle narrowly rather than through `loadRunBundle`, which applies the strict
56
56
  * evidence-of-record guard. That guard is right for verification and wrong here: a mid-run flush is
57
57
  * a partial document by definition, so validating it as a complete bundle would make the live view
58
58
  * — the only view that needs this — the one case that never renders. Nothing read here is treated