@orion-agents/orion-code 0.3.66 → 0.4.4

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 (384) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +78 -361
  3. package/README.zh-CN.md +71 -262
  4. package/bin/orion +4 -1
  5. package/dist/acp/session-updates.d.ts +35 -0
  6. package/dist/acp/session-updates.js +183 -0
  7. package/dist/acp/sessions.d.ts +32 -0
  8. package/dist/acp/sessions.js +328 -0
  9. package/dist/acp/stdio.d.ts +3 -0
  10. package/dist/acp/stdio.js +59 -0
  11. package/dist/cli.js +136 -185
  12. package/dist/commands/context-tool-command-handlers.d.ts +1 -1
  13. package/dist/commands/context-tool-command-handlers.js +24 -3
  14. package/dist/commands/core-command-handlers.js +10 -18
  15. package/dist/commands/diagnostic-command-handlers.js +58 -48
  16. package/dist/commands/diagnostic-commands.js +0 -12
  17. package/dist/commands/init-command.d.ts +3 -0
  18. package/dist/commands/init-command.js +131 -0
  19. package/dist/commands/model-command-handlers.d.ts +1 -2
  20. package/dist/commands/model-command-handlers.js +15 -100
  21. package/dist/commands/model-commands.js +0 -11
  22. package/dist/commands/registry.js +1 -19
  23. package/dist/commands/rsi-command.d.ts +2 -0
  24. package/dist/commands/rsi-command.js +180 -0
  25. package/dist/commands/session-command-handlers.js +28 -19
  26. package/dist/commands/system-commands.js +0 -1
  27. package/dist/commands/target-command.js +49 -6
  28. package/dist/commands/tool-commands.js +1 -1
  29. package/dist/commands/types.d.ts +4 -10
  30. package/dist/commands/types.js +1 -21
  31. package/dist/commands/workflow-command-handlers.js +13 -4
  32. package/dist/commands/workflow-commands.js +2 -2
  33. package/dist/framework/loop-budget-contract.d.ts +2 -8
  34. package/dist/framework/loop-budget-contract.js +0 -3
  35. package/dist/framework/loop-progress.d.ts +18 -0
  36. package/dist/framework/loop-progress.js +63 -0
  37. package/dist/framework/prompt.d.ts +0 -2
  38. package/dist/framework/prompt.js +9 -27
  39. package/dist/framework/query.d.ts +26 -31
  40. package/dist/framework/query.js +451 -292
  41. package/dist/framework/store.d.ts +6 -10
  42. package/dist/framework/store.js +2 -21
  43. package/dist/framework/tool-call-orchestrator.d.ts +7 -0
  44. package/dist/framework/tool-call-orchestrator.js +8 -3
  45. package/dist/framework/tool-state.d.ts +2 -0
  46. package/dist/framework/tool.d.ts +0 -23
  47. package/dist/framework/verification-command.d.ts +15 -0
  48. package/dist/framework/verification-command.js +32 -0
  49. package/dist/harness/assembler.d.ts +1 -0
  50. package/dist/harness/assembler.js +24 -0
  51. package/dist/harness/capsule.d.ts +1 -1
  52. package/dist/harness/capsule.js +33 -14
  53. package/dist/harness/context-harness.d.ts +37 -12
  54. package/dist/harness/context-harness.js +545 -35
  55. package/dist/harness/contract.js +1 -1
  56. package/dist/harness/drift-guard.d.ts +4 -0
  57. package/dist/harness/drift-guard.js +68 -16
  58. package/dist/harness/index.d.ts +1 -1
  59. package/dist/harness/intent.js +21 -0
  60. package/dist/harness/ledger.d.ts +7 -11
  61. package/dist/harness/ledger.js +50 -9
  62. package/dist/harness/progress-controller.d.ts +12 -7
  63. package/dist/harness/progress-controller.js +96 -29
  64. package/dist/harness/state.js +10 -1
  65. package/dist/harness/stop-controller.d.ts +0 -5
  66. package/dist/harness/stop-controller.js +11 -31
  67. package/dist/harness/task-checklist.d.ts +16 -0
  68. package/dist/harness/task-checklist.js +92 -0
  69. package/dist/harness/types.d.ts +78 -1
  70. package/dist/harness/verification.d.ts +19 -1
  71. package/dist/harness/verification.js +116 -29
  72. package/dist/index.d.ts +1 -1
  73. package/dist/index.js +1 -3
  74. package/dist/print-ui/event-stream.d.ts +43 -0
  75. package/dist/print-ui/event-stream.js +204 -0
  76. package/dist/print-ui/launch.d.ts +12 -1
  77. package/dist/print-ui/launch.js +173 -11
  78. package/dist/product/environment.d.ts +1 -1
  79. package/dist/product/environment.js +1 -1
  80. package/dist/product/identity.d.ts +1 -1
  81. package/dist/product/identity.js +1 -1
  82. package/dist/product/paths.d.ts +3 -2
  83. package/dist/product/paths.js +6 -2
  84. package/dist/runtime/agent-loop.d.ts +12 -2
  85. package/dist/runtime/agent-loop.js +172 -29
  86. package/dist/runtime/agent-runtime-controller.d.ts +14 -4
  87. package/dist/runtime/agent-runtime-controller.js +366 -192
  88. package/dist/runtime/agent-runtime-protocol.d.ts +10 -18
  89. package/dist/runtime/agent-runtime-runner.d.ts +10 -0
  90. package/dist/runtime/builtin-tool-provider.js +5 -1
  91. package/dist/runtime/capability-receipt-journal.js +1 -0
  92. package/dist/runtime/durable-tool-receipt-reader.js +2 -1
  93. package/dist/runtime/first-party-tool-services.d.ts +1 -0
  94. package/dist/runtime/first-party-tool-services.js +2 -12
  95. package/dist/runtime/first-party-tool-universe.d.ts +1 -0
  96. package/dist/runtime/first-party-tool-universe.js +1 -1
  97. package/dist/runtime/followup-queue-store.d.ts +16 -0
  98. package/dist/runtime/followup-queue-store.js +75 -0
  99. package/dist/runtime/goal-lifecycle-v2.d.ts +16 -4
  100. package/dist/runtime/goal-lifecycle-v2.js +217 -39
  101. package/dist/runtime/goal-runtime-coordinator.d.ts +14 -2
  102. package/dist/runtime/goal-runtime-coordinator.js +147 -36
  103. package/dist/runtime/goals/presentation.js +3 -1
  104. package/dist/runtime/goals/types.d.ts +1 -3
  105. package/dist/runtime/goals/types.js +0 -3
  106. package/dist/runtime/loop-budget.d.ts +0 -7
  107. package/dist/runtime/loop-budget.js +8 -52
  108. package/dist/runtime/mcp/first-party-mcp-adapter.d.ts +2 -0
  109. package/dist/runtime/mcp/first-party-mcp-adapter.js +23 -19
  110. package/dist/runtime/model-coordinator.js +2 -5
  111. package/dist/runtime/orion-runtime-v1.d.ts +18 -2
  112. package/dist/runtime/orion-runtime-v1.js +183 -46
  113. package/dist/runtime/orion-session-runner.d.ts +7 -0
  114. package/dist/runtime/orion-session-runner.js +82 -0
  115. package/dist/runtime/plan-review.d.ts +1 -0
  116. package/dist/runtime/plan-review.js +8 -4
  117. package/dist/runtime/product-bootstrap.d.ts +6 -0
  118. package/dist/runtime/product-bootstrap.js +41 -51
  119. package/dist/runtime/product-orion-runtime.js +129 -58
  120. package/dist/runtime/release-receipts.d.ts +24 -133
  121. package/dist/runtime/release-receipts.js +129 -693
  122. package/dist/runtime/rich-text/layout.js +108 -65
  123. package/dist/runtime/rsi/contracts.d.ts +50 -0
  124. package/dist/runtime/rsi/contracts.js +17 -0
  125. package/dist/runtime/rsi/diagnosis.d.ts +46 -0
  126. package/dist/runtime/rsi/diagnosis.js +98 -0
  127. package/dist/runtime/rsi/evaluation-suite.d.ts +25 -0
  128. package/dist/runtime/rsi/evaluation-suite.js +141 -0
  129. package/dist/runtime/rsi/evaluation-worker.d.ts +19 -0
  130. package/dist/runtime/rsi/evaluation-worker.js +64 -0
  131. package/dist/runtime/rsi/evaluation.d.ts +49 -0
  132. package/dist/runtime/rsi/evaluation.js +345 -0
  133. package/dist/runtime/rsi/lifecycle.d.ts +54 -0
  134. package/dist/runtime/rsi/lifecycle.js +279 -0
  135. package/dist/runtime/rsi/proposal.d.ts +39 -0
  136. package/dist/runtime/rsi/proposal.js +312 -0
  137. package/dist/runtime/rsi/receipt.d.ts +28 -0
  138. package/dist/runtime/rsi/receipt.js +138 -0
  139. package/dist/runtime/rsi/skill-state.d.ts +7 -0
  140. package/dist/runtime/rsi/skill-state.js +50 -0
  141. package/dist/runtime/rsi/trajectory.d.ts +19 -0
  142. package/dist/runtime/rsi/trajectory.js +314 -0
  143. package/dist/runtime/rsi/triage.d.ts +274 -0
  144. package/dist/runtime/rsi/triage.js +58 -0
  145. package/dist/runtime/session-composer-control.d.ts +5 -24
  146. package/dist/runtime/session-composer-control.js +27 -189
  147. package/dist/runtime/step-snapshot.d.ts +4 -1
  148. package/dist/runtime/step-snapshot.js +11 -1
  149. package/dist/runtime/subagent-thread-runtime.js +27 -5
  150. package/dist/runtime/subagents/policy.js +0 -1
  151. package/dist/runtime/subagents/production.js +1 -5
  152. package/dist/runtime/subagents/runtime-integration.js +2 -4
  153. package/dist/runtime/subagents/types.d.ts +0 -5
  154. package/dist/runtime/subagents/types.js +0 -2
  155. package/dist/runtime/task-context-recovery.d.ts +55 -0
  156. package/dist/runtime/task-context-recovery.js +349 -0
  157. package/dist/runtime/task-context-service.d.ts +20 -10
  158. package/dist/runtime/task-context-service.js +69 -9
  159. package/dist/runtime/thread-admission.d.ts +3 -1
  160. package/dist/runtime/thread-admission.js +21 -7
  161. package/dist/runtime/thread-event-store.d.ts +2 -2
  162. package/dist/runtime/thread-event-store.js +7 -2
  163. package/dist/runtime/thread-projection.js +4 -2
  164. package/dist/runtime/thread-runtime.d.ts +10 -0
  165. package/dist/runtime/thread-runtime.js +85 -3
  166. package/dist/runtime/thread-session-index.d.ts +8 -0
  167. package/dist/runtime/thread-session-index.js +50 -1
  168. package/dist/runtime/thread-session-view.d.ts +2 -1
  169. package/dist/runtime/thread-session-view.js +4 -0
  170. package/dist/runtime/thread-tool-journal.d.ts +1 -0
  171. package/dist/runtime/thread-tool-journal.js +6 -2
  172. package/dist/runtime/thread-ui-adapter.d.ts +1 -0
  173. package/dist/runtime/thread-ui-adapter.js +89 -22
  174. package/dist/runtime/tool-gateway.d.ts +9 -0
  175. package/dist/runtime/tool-gateway.js +24 -0
  176. package/dist/runtime/tool-receipt-validator.js +4 -0
  177. package/dist/runtime/tool-transcript-entry.d.ts +16 -0
  178. package/dist/runtime/tool-transcript-entry.js +73 -0
  179. package/dist/runtime/turn-commit.d.ts +4 -1
  180. package/dist/runtime/turn-commit.js +19 -15
  181. package/dist/runtime/ui-events.d.ts +15 -1
  182. package/dist/runtime/ui-view-model.d.ts +6 -5
  183. package/dist/runtime/ui-view-model.js +78 -61
  184. package/dist/runtime/workspace-runtime-kernel.js +0 -1
  185. package/dist/runtime/workspace-verification.d.ts +7 -0
  186. package/dist/runtime/workspace-verification.js +83 -0
  187. package/dist/services/atomic-write.d.ts +2 -0
  188. package/dist/services/atomic-write.js +12 -1
  189. package/dist/services/code-review/format.d.ts +4 -1
  190. package/dist/services/code-review/format.js +5 -1
  191. package/dist/services/code-review/runner.d.ts +2 -2
  192. package/dist/services/code-review/runner.js +86 -64
  193. package/dist/services/code-review/snapshot.d.ts +9 -9
  194. package/dist/services/code-review/snapshot.js +182 -166
  195. package/dist/services/compact/auto-compact.d.ts +21 -6
  196. package/dist/services/compact/auto-compact.js +148 -22
  197. package/dist/services/compact/background-candidate.d.ts +33 -0
  198. package/dist/services/compact/background-candidate.js +184 -0
  199. package/dist/services/compact/compact.d.ts +4 -1
  200. package/dist/services/compact/compact.js +30 -3
  201. package/dist/services/compact/coordinator.d.ts +10 -4
  202. package/dist/services/compact/coordinator.js +17 -7
  203. package/dist/services/compact/summary-generator.d.ts +4 -2
  204. package/dist/services/compact/summary-generator.js +17 -3
  205. package/dist/services/config.d.ts +5 -5
  206. package/dist/services/config.js +29 -48
  207. package/dist/services/doctor.js +85 -13
  208. package/dist/services/effort.d.ts +5 -5
  209. package/dist/services/effort.js +5 -11
  210. package/dist/services/file-lock.d.ts +9 -3
  211. package/dist/services/file-lock.js +92 -26
  212. package/dist/services/global-config.d.ts +26 -64
  213. package/dist/services/global-config.js +233 -193
  214. package/dist/services/llm.d.ts +42 -4
  215. package/dist/services/llm.js +177 -45
  216. package/dist/services/model-client-pool.d.ts +15 -9
  217. package/dist/services/model-client-pool.js +62 -33
  218. package/dist/services/model-context.d.ts +2 -1
  219. package/dist/services/model-context.js +15 -9
  220. package/dist/services/model-registry.d.ts +4 -15
  221. package/dist/services/model-registry.js +32 -101
  222. package/dist/services/provider-diagnostics.d.ts +8 -0
  223. package/dist/services/provider-diagnostics.js +17 -12
  224. package/dist/services/provider-resilience/coordinator.d.ts +1 -1
  225. package/dist/services/provider-resilience/coordinator.js +10 -6
  226. package/dist/services/provider-resilience/request-gate.d.ts +3 -0
  227. package/dist/services/provider-resilience/request-gate.js +29 -18
  228. package/dist/services/provider-resilience/types.d.ts +2 -0
  229. package/dist/services/session-storage.d.ts +7 -10
  230. package/dist/services/session-storage.js +57 -30
  231. package/dist/services/settings-coordinator.d.ts +0 -6
  232. package/dist/services/settings-coordinator.js +19 -56
  233. package/dist/services/settings-document-repository.d.ts +3 -10
  234. package/dist/services/settings-document-repository.js +7 -85
  235. package/dist/services/usage-state.d.ts +3 -3
  236. package/dist/services/usage-state.js +11 -42
  237. package/dist/terminal-ui/answer-format.d.ts +14 -0
  238. package/dist/terminal-ui/answer-format.js +119 -0
  239. package/dist/terminal-ui/launch.d.ts +7 -6
  240. package/dist/terminal-ui/launch.js +160 -70
  241. package/dist/terminal-ui/output-queue.d.ts +2 -1
  242. package/dist/terminal-ui/output-queue.js +1 -1
  243. package/dist/terminal-ui/raw-editor.d.ts +2 -1
  244. package/dist/terminal-ui/raw-editor.js +56 -15
  245. package/dist/tools/core/edit-file.js +6 -2
  246. package/dist/tools/core/write-file.js +9 -2
  247. package/dist/tools/lsp.d.ts +16 -1
  248. package/dist/tools/lsp.js +60 -19
  249. package/dist/tools/sandbox.d.ts +1 -1
  250. package/dist/tools/sandbox.js +3 -16
  251. package/dist/tools/todo.d.ts +4 -2
  252. package/dist/tools/todo.js +91 -30
  253. package/dist/tui-core/input-parser.d.ts +1 -0
  254. package/dist/tui-core/input-parser.js +6 -0
  255. package/dist/tui-core/style.d.ts +1 -8
  256. package/dist/tui-core/style.js +3 -110
  257. package/dist/tui-ui/chrome-view-model.d.ts +1 -1
  258. package/dist/tui-ui/chrome-view-model.js +36 -32
  259. package/dist/tui-ui/launch.js +14 -14
  260. package/dist/tui-ui/layout.d.ts +5 -7
  261. package/dist/tui-ui/layout.js +129 -124
  262. package/dist/tui-ui/runner.d.ts +11 -12
  263. package/dist/tui-ui/runner.js +88 -67
  264. package/dist/tui-ui/state.d.ts +0 -11
  265. package/dist/tui-ui/state.js +22 -33
  266. package/dist/tui-ui/terminal-image.js +22 -4
  267. package/dist/tui-ui/transcript-inspector-layout.js +6 -3
  268. package/dist/tui-ui/transcript-inspector.d.ts +1 -0
  269. package/dist/tui-ui/transcript-inspector.js +7 -1
  270. package/dist/tui-ui/transcript-layout.js +42 -6
  271. package/dist/utils/terminal-text.d.ts +11 -0
  272. package/dist/utils/terminal-text.js +114 -0
  273. package/docs/cli-guide.md +575 -0
  274. package/docs/orion.example.yaml +43 -0
  275. package/docs/readme.md +12 -57
  276. package/npm-shrinkwrap.json +484 -1855
  277. package/package.json +13 -63
  278. package/dist/migration/command.d.ts +0 -9
  279. package/dist/migration/command.js +0 -100
  280. package/dist/migration/index.d.ts +0 -7
  281. package/dist/migration/index.js +0 -14
  282. package/dist/migration/migrate.d.ts +0 -19
  283. package/dist/migration/migrate.js +0 -406
  284. package/dist/migration/types.d.ts +0 -55
  285. package/dist/migration/types.js +0 -6
  286. package/dist/services/tool-allowlist.d.ts +0 -110
  287. package/dist/services/tool-allowlist.js +0 -299
  288. package/dist/services/yaml-config.d.ts +0 -57
  289. package/dist/services/yaml-config.js +0 -178
  290. package/dist/web/cli-options.d.ts +0 -17
  291. package/dist/web/cli-options.js +0 -51
  292. package/dist/web/code-review-run-service.d.ts +0 -68
  293. package/dist/web/code-review-run-service.js +0 -228
  294. package/dist/web/context-text.d.ts +0 -17
  295. package/dist/web/context-text.js +0 -40
  296. package/dist/web/errors.d.ts +0 -6
  297. package/dist/web/errors.js +0 -13
  298. package/dist/web/event-hub.d.ts +0 -45
  299. package/dist/web/event-hub.js +0 -370
  300. package/dist/web/file-read-service.d.ts +0 -101
  301. package/dist/web/file-read-service.js +0 -593
  302. package/dist/web/file-write-service.d.ts +0 -16
  303. package/dist/web/file-write-service.js +0 -103
  304. package/dist/web/git-compare-service.d.ts +0 -45
  305. package/dist/web/git-compare-service.js +0 -160
  306. package/dist/web/git-diff-document.d.ts +0 -102
  307. package/dist/web/git-diff-document.js +0 -258
  308. package/dist/web/git-file-source.d.ts +0 -25
  309. package/dist/web/git-file-source.js +0 -21
  310. package/dist/web/git-history-service.d.ts +0 -151
  311. package/dist/web/git-history-service.js +0 -619
  312. package/dist/web/git-index-transaction.d.ts +0 -45
  313. package/dist/web/git-index-transaction.js +0 -174
  314. package/dist/web/git-patch-builder.d.ts +0 -30
  315. package/dist/web/git-patch-builder.js +0 -138
  316. package/dist/web/git-read-model-service.d.ts +0 -452
  317. package/dist/web/git-read-model-service.js +0 -1833
  318. package/dist/web/git-version-service.d.ts +0 -79
  319. package/dist/web/git-version-service.js +0 -279
  320. package/dist/web/host-daemon.d.ts +0 -70
  321. package/dist/web/host-daemon.js +0 -237
  322. package/dist/web/index.d.ts +0 -6
  323. package/dist/web/index.js +0 -28
  324. package/dist/web/launch.d.ts +0 -12
  325. package/dist/web/launch.js +0 -89
  326. package/dist/web/native-directory-picker.d.ts +0 -63
  327. package/dist/web/native-directory-picker.js +0 -169
  328. package/dist/web/protocol.d.ts +0 -705
  329. package/dist/web/protocol.js +0 -639
  330. package/dist/web/review-service.d.ts +0 -22
  331. package/dist/web/review-service.js +0 -68
  332. package/dist/web/server.d.ts +0 -20
  333. package/dist/web/server.js +0 -1453
  334. package/dist/web/session-runtime-registry.d.ts +0 -138
  335. package/dist/web/session-runtime-registry.js +0 -471
  336. package/dist/web/terminal-manager.d.ts +0 -156
  337. package/dist/web/terminal-manager.js +0 -779
  338. package/dist/web/terminal-server.d.ts +0 -8
  339. package/dist/web/terminal-server.js +0 -304
  340. package/dist/web/workbench-controller.d.ts +0 -395
  341. package/dist/web/workbench-controller.js +0 -3077
  342. package/dist/web/workspace-discovery.d.ts +0 -92
  343. package/dist/web/workspace-discovery.js +0 -324
  344. package/dist/web/workspace-mutation-arbiter.d.ts +0 -54
  345. package/dist/web/workspace-mutation-arbiter.js +0 -267
  346. package/dist/web/workspace-open-telemetry.d.ts +0 -55
  347. package/dist/web/workspace-open-telemetry.js +0 -73
  348. package/dist/web-client/assets/FilesPanel-CPDovK_K.js +0 -1
  349. package/dist/web-client/assets/GitPanel-DtU_TD61.js +0 -4
  350. package/dist/web-client/assets/ReviewPanel-vMO7BEA3.js +0 -6
  351. package/dist/web-client/assets/TerminalPanel-C9vDTAlS.js +0 -23
  352. package/dist/web-client/assets/TerminalPanel-DLuoa74B.css +0 -1
  353. package/dist/web-client/assets/index-CABdwh4l.css +0 -1
  354. package/dist/web-client/assets/index-KvshfEbl.js +0 -20
  355. package/dist/web-client/assets/useAutoNotice-IE1g2wcb.js +0 -1
  356. package/dist/web-client/favicon.svg +0 -9
  357. package/dist/web-client/index.html +0 -17
  358. package/docs/architecture/agent-mode-permission-contract.md +0 -87
  359. package/docs/architecture/v0.3.0-web-api.yaml +0 -1340
  360. package/docs/architecture/v0.3.1-web-api.yaml +0 -2338
  361. package/docs/architecture/v0.3.2-web-api.yaml +0 -3029
  362. package/docs/architecture/v0.3.3-web-api.yaml +0 -3205
  363. package/docs/architecture/v0.3.4-stabilization-contract.md +0 -32
  364. package/docs/migration/v0.1.9-to-v0.2.0.md +0 -98
  365. package/docs/migration/v0.2.2-to-v0.3.0-settings.md +0 -114
  366. package/docs/migration/v0.2.2-to-v0.3.0.md +0 -55
  367. package/docs/migration/v0.3.0-to-v0.3.1.md +0 -88
  368. package/docs/migration/v0.3.1-to-v0.3.2.md +0 -94
  369. package/docs/migration/v0.3.2-to-v0.3.3.md +0 -62
  370. package/docs/migration/v0.3.3-to-v0.3.4.md +0 -36
  371. package/docs/orion.example.json +0 -86
  372. package/docs/plan/v0.2.0-dsh-harness-redesign-plan.md +0 -1234
  373. package/docs/plan/v0.2.0-release-checklist.md +0 -91
  374. package/docs/plan/v0.3.0-node-runtime-compatibility-plan.md +0 -57
  375. package/docs/plan/v0.3.0-settings-integration-plan.md +0 -740
  376. package/docs/plan/v0.3.0-web-workbench-plan.md +0 -376
  377. package/docs/plan/v0.3.1-web-workbench-professional-shell-plan.md +0 -848
  378. package/docs/plan/v0.3.2-web-workbench-layout-and-composer-plan.md +0 -869
  379. package/docs/plan/v0.3.3-plan.md +0 -1113
  380. package/docs/plan/v0.3.4-stabilization-plan.md +0 -89
  381. package/docs/test/v0.3.1-web-workbench-e2e-plan.md +0 -140
  382. package/docs/test/v0.3.2-web-workbench-e2e-plan.md +0 -100
  383. package/docs/test/v0.3.3-web-workbench-e2e-plan.md +0 -79
  384. package/docs/test/v0.3.4-stabilization-e2e-plan.md +0 -54
@@ -0,0 +1,19 @@
1
+ import type { RsiTurnEvidenceV1 } from './contracts';
2
+ export interface RsiWorkerInput {
3
+ readonly path: string;
4
+ readonly skill: string;
5
+ readonly expected: string | null;
6
+ readonly prompt: string;
7
+ readonly baseCommit: string;
8
+ readonly timeoutMs: number;
9
+ }
10
+ export interface RsiWorkerResult {
11
+ readonly version: 1;
12
+ readonly evidence: RsiTurnEvidenceV1;
13
+ readonly requests: number;
14
+ readonly totalTokens: number;
15
+ readonly printExitCode: number;
16
+ readonly hitBudget: boolean;
17
+ readonly digest: string;
18
+ }
19
+ //# sourceMappingURL=evaluation-worker.d.ts.map
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const launch_1 = require("../../print-ui/launch");
4
+ const usage_state_1 = require("../../services/usage-state");
5
+ const product_bootstrap_1 = require("../product-bootstrap");
6
+ const legacy_thread_materializer_1 = require("../legacy-thread-materializer");
7
+ const evaluation_suite_1 = require("./evaluation-suite");
8
+ const receipt_1 = require("./receipt");
9
+ const skill_state_1 = require("./skill-state");
10
+ const trajectory_1 = require("./trajectory");
11
+ const turn_commit_1 = require("../turn-commit");
12
+ async function main() {
13
+ const [input, output] = process.argv.slice(2);
14
+ const request = (0, receipt_1.readRsiJson)(input);
15
+ setTimeout(() => process.exit(124), request.timeoutMs).unref();
16
+ const cwd = process.cwd();
17
+ const expected = await (0, skill_state_1.inspectRsiSkill)(cwd, request, request.expected ?? undefined);
18
+ const kernel = (0, product_bootstrap_1.createWorkspaceRuntimeKernelV1)({ cwd, toolNames: evaluation_suite_1.RSI_EVALUATION_TOOLS });
19
+ let printExitCode;
20
+ try {
21
+ const runtime = await (0, product_bootstrap_1.createProductUiRuntime)({ cwd, workspaceRuntimeKernel: kernel });
22
+ printExitCode = await (0, launch_1.launchPrintMode)(runtime, request.prompt, { outputFormat: 'json' });
23
+ }
24
+ finally {
25
+ kernel.releaseOwner();
26
+ }
27
+ const sessions = Object.keys((0, legacy_thread_materializer_1.loadThreadCutoverIndexV1)(cwd).sessions);
28
+ if (sessions.length !== 1)
29
+ throw new Error('RSI needs exactly one isolated Session.');
30
+ const [sessionId] = sessions;
31
+ const opened = (0, legacy_thread_materializer_1.openSessionStorageV1)(cwd, sessionId);
32
+ if (!('store' in opened))
33
+ throw new Error('RSI evaluation Session did not persist a Thread.');
34
+ const turns = Object.values(opened.store.loadProjection().turns);
35
+ if (turns.length !== 1)
36
+ throw new Error('RSI needs exactly one isolated turn.');
37
+ const [turn] = turns;
38
+ if (!turn.commit)
39
+ throw new Error('RSI evaluation turn did not commit.');
40
+ const commit = (0, turn_commit_1.parseTurnCommitV1)(turn.commit.receipt);
41
+ const hitBudget = commit.outcome !== undefined &&
42
+ JSON.parse(commit.outcome).finishReason === 'budget_exceeded';
43
+ const [evidence] = (0, trajectory_1.collectRsiEvidence)({
44
+ version: 1,
45
+ repository: cwd,
46
+ baseCommit: request.baseCommit,
47
+ turns: [
48
+ { sessionId, turnId: turn.turnId, category: 'missing_verification', result: 'accepted' },
49
+ ],
50
+ }, expected);
51
+ const usage = (0, usage_state_1.loadUsageLedger)();
52
+ (0, receipt_1.writeRsiState)(output, {
53
+ version: 1,
54
+ evidence,
55
+ requests: Math.max(usage.length, commit.capabilityReceiptDigests.length),
56
+ totalTokens: usage.reduce((total, entry) => total + entry.totalTokens, 0),
57
+ printExitCode,
58
+ hitBudget,
59
+ });
60
+ }
61
+ if (require.main === module) {
62
+ void main().then(() => process.exit(0), () => process.exit(1));
63
+ }
64
+ //# sourceMappingURL=evaluation-worker.js.map
@@ -0,0 +1,49 @@
1
+ import { type RsiEvaluationTask } from './evaluation-suite';
2
+ type Arm = 'baseline' | 'candidate';
3
+ type Verdict = 'screened_out' | 'improved' | 'unchanged' | 'regressed' | 'inconclusive';
4
+ export interface RsiArmResult {
5
+ readonly elapsedMs: number;
6
+ readonly score: 'pass' | 'fail' | 'unknown';
7
+ readonly reason?: 'runtime' | 'cancelled' | 'budget' | 'skill_unverified' | 'no_usage' | 'check_failed';
8
+ readonly guardViolation?: boolean;
9
+ readonly requests?: number;
10
+ readonly totalTokens?: number;
11
+ readonly expectedSkill?: string | null;
12
+ readonly proofDigest?: string;
13
+ readonly promptDigests?: readonly string[];
14
+ readonly tools?: readonly {
15
+ readonly name: string;
16
+ readonly success: boolean;
17
+ }[];
18
+ readonly matched?: number;
19
+ readonly expected?: number;
20
+ }
21
+ export interface RsiPair {
22
+ readonly taskId: string;
23
+ readonly split: RsiEvaluationTask['split'];
24
+ readonly category: RsiEvaluationTask['category'];
25
+ readonly repeat: number;
26
+ readonly order: readonly Arm[];
27
+ readonly state: 'running' | 'complete' | 'indeterminate';
28
+ readonly owner?: number;
29
+ readonly arms: Partial<Record<Arm, RsiArmResult>>;
30
+ }
31
+ interface RsiComparisonState {
32
+ readonly version: 1;
33
+ readonly proposalDigest: string;
34
+ readonly candidateDigest: string;
35
+ readonly suitePath: string;
36
+ readonly suiteDigest: string;
37
+ readonly executionProfileDigest: string;
38
+ readonly pairs: readonly RsiPair[];
39
+ readonly phase: 'evaluating' | 'cancelled' | 'awaiting_review' | 'evaluated';
40
+ readonly verdict?: Verdict;
41
+ }
42
+ export interface RsiComparisonReceiptV1 extends RsiComparisonState {
43
+ readonly digest: string;
44
+ }
45
+ export declare function readRsiComparison(directory: string, proposalDigest: string): RsiComparisonReceiptV1 | undefined;
46
+ export declare function judgeRsiPairs(pairs: readonly RsiPair[]): Verdict;
47
+ export declare function evaluateRsi(output: string, suiteFile: string | undefined, signal: AbortSignal): Promise<RsiComparisonReceiptV1>;
48
+ export {};
49
+ //# sourceMappingURL=evaluation.d.ts.map
@@ -0,0 +1,345 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readRsiComparison = readRsiComparison;
4
+ exports.judgeRsiPairs = judgeRsiPairs;
5
+ exports.evaluateRsi = evaluateRsi;
6
+ const child_process_1 = require("child_process");
7
+ const crypto_1 = require("crypto");
8
+ const fs_1 = require("fs");
9
+ const os_1 = require("os");
10
+ const path_1 = require("path");
11
+ const util_1 = require("util");
12
+ const file_lock_1 = require("../../services/file-lock");
13
+ const canonical_1 = require("../protocol/canonical");
14
+ const evaluation_suite_1 = require("./evaluation-suite");
15
+ const proposal_1 = require("./proposal");
16
+ const receipt_1 = require("./receipt");
17
+ const runChild = (0, util_1.promisify)(child_process_1.execFile);
18
+ function readRsiComparison(directory, proposalDigest) {
19
+ const receipt = (0, receipt_1.readRsiState)((0, path_1.join)(directory, 'comparison.json'));
20
+ if (receipt && receipt.proposalDigest !== proposalDigest) {
21
+ throw new Error('RSI comparison does not belong to this proposal.');
22
+ }
23
+ return receipt;
24
+ }
25
+ function installedRuntimeDigest() {
26
+ const root = (0, path_1.join)(__dirname, '..', '..');
27
+ const hash = (0, crypto_1.createHash)('sha256');
28
+ const visit = (base) => {
29
+ for (const entry of (0, fs_1.readdirSync)((0, path_1.join)(root, base), { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
30
+ const path = (0, path_1.join)(base, entry.name);
31
+ if (entry.isDirectory())
32
+ visit(path);
33
+ else if (entry.isFile() && /\.(?:js|json|md)$/u.test(path)) {
34
+ const file = (0, crypto_1.createHash)('sha256')
35
+ .update((0, fs_1.readFileSync)((0, path_1.join)(root, path)))
36
+ .digest('hex');
37
+ hash.update(`${path}\0${file}\n`);
38
+ }
39
+ }
40
+ };
41
+ visit('');
42
+ return hash.digest('hex');
43
+ }
44
+ function fixtureSnapshot(root, relative = '', depth = 0, files = new Map()) {
45
+ if (depth > 12)
46
+ throw new Error('RSI fixture exceeded maximum depth.');
47
+ for (const name of (0, fs_1.readdirSync)((0, path_1.join)(root, relative))) {
48
+ const path = relative ? `${relative}/${name}` : name;
49
+ const full = (0, path_1.join)(root, path);
50
+ const entry = (0, fs_1.lstatSync)(full);
51
+ if (entry.isDirectory()) {
52
+ fixtureSnapshot(root, path, depth + 1, files);
53
+ }
54
+ else {
55
+ if (!entry.isFile() || files.size >= 80 || entry.size > 64 * 1024) {
56
+ throw new Error('RSI fixture contains an unexpected file or exceeded its limits.');
57
+ }
58
+ files.set(path, (0, receipt_1.readRsiFile)(full));
59
+ }
60
+ }
61
+ return files;
62
+ }
63
+ async function runArm(task, suite, input, signal) {
64
+ const started = Date.now();
65
+ const timing = () => ({ elapsedMs: Date.now() - started });
66
+ const sandbox = (0, fs_1.realpathSync)((0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), 'orion-rsi-arm-')));
67
+ try {
68
+ const cwd = (0, path_1.join)(sandbox, 'fixture');
69
+ const config = (0, path_1.join)(sandbox, 'profile');
70
+ (0, fs_1.mkdirSync)(cwd, { mode: 0o700 });
71
+ (0, fs_1.mkdirSync)(config, { mode: 0o700 });
72
+ const write = (file, content) => {
73
+ (0, fs_1.mkdirSync)((0, path_1.dirname)(file), { recursive: true, mode: 0o700 });
74
+ (0, fs_1.writeFileSync)(file, content, { mode: 0o600 });
75
+ };
76
+ for (const [path, content] of Object.entries(task.files))
77
+ write((0, path_1.join)(cwd, path), content);
78
+ if (input.expected !== null)
79
+ write((0, path_1.join)(cwd, input.path), input.expected);
80
+ const before = fixtureSnapshot(cwd);
81
+ write((0, path_1.join)(config, 'orion.yaml'), JSON.stringify({
82
+ schemaVersion: 1,
83
+ providers: [
84
+ {
85
+ id: 'rsi-local',
86
+ baseUrl: suite.endpoint,
87
+ protocol: 'openai-completions',
88
+ apiKey: 'orion-rsi-local',
89
+ },
90
+ ],
91
+ models: [
92
+ {
93
+ id: 'rsi-evaluation',
94
+ provider: 'rsi-local',
95
+ model: suite.model,
96
+ maxOutputTokens: Math.min(2048, Math.floor(suite.maxTokens / suite.maxRequests)),
97
+ },
98
+ ],
99
+ defaultModel: 'rsi-evaluation',
100
+ subagents: { mode: 'off' },
101
+ agentLoop: { continuation: 'manual' },
102
+ }));
103
+ const inputPath = (0, path_1.join)(sandbox, 'input.json');
104
+ const outputPath = (0, path_1.join)(sandbox, 'arm.json');
105
+ write(inputPath, JSON.stringify(input));
106
+ const inherited = Object.fromEntries(Object.entries(process.env).filter(([key]) => ['PATH', 'Path', 'DEVELOPER_DIR', 'SystemRoot', 'WINDIR', 'TMPDIR', 'TEMP', 'TMP'].includes(key)));
107
+ let processFailed = false;
108
+ try {
109
+ await runChild(process.execPath, [(0, path_1.join)(__dirname, 'evaluation-worker.js'), inputPath, outputPath], {
110
+ cwd,
111
+ signal,
112
+ timeout: suite.timeoutMs,
113
+ killSignal: 'SIGKILL',
114
+ maxBuffer: 2 * 1024 * 1024,
115
+ env: {
116
+ ...inherited,
117
+ HOME: sandbox,
118
+ USERPROFILE: sandbox,
119
+ NO_COLOR: '1',
120
+ ORION_CODE_CONFIG_DIR: config,
121
+ ORION_CODE_DISABLE_ENV_FILES: '1',
122
+ },
123
+ });
124
+ }
125
+ catch {
126
+ processFailed = true;
127
+ }
128
+ let after;
129
+ try {
130
+ after = fixtureSnapshot(cwd);
131
+ }
132
+ catch {
133
+ return { ...timing(), score: 'fail', guardViolation: true, reason: 'check_failed' };
134
+ }
135
+ const checks = Object.entries(task.expected);
136
+ const changed = [...new Set([...before.keys(), ...after.keys()])].filter(path => before.get(path) !== after.get(path));
137
+ const guardViolation = changed.some(path => !Object.prototype.hasOwnProperty.call(task.expected, path));
138
+ const matched = checks.filter(([path, content]) => after.get(path) === content).length;
139
+ const report = (0, receipt_1.readRsiState)(outputPath);
140
+ const proof = report?.evidence.skillProof;
141
+ const tools = report?.evidence.toolReceipts.map(({ name, success }) => ({ name, success })) ?? [];
142
+ const result = {
143
+ ...timing(),
144
+ matched,
145
+ expected: checks.length,
146
+ guardViolation,
147
+ tools,
148
+ requests: report?.requests ?? 0,
149
+ totalTokens: report?.totalTokens ?? 0,
150
+ ...(proof
151
+ ? { expectedSkill: proof.descriptorDigest, promptDigests: proof.promptDigests }
152
+ : {}),
153
+ ...(report ? { proofDigest: report.evidence.turnCommitDigest } : {}),
154
+ };
155
+ if (guardViolation)
156
+ return { ...result, score: 'fail', reason: 'check_failed' };
157
+ if (processFailed || !report) {
158
+ return { ...result, score: 'unknown', reason: signal.aborted ? 'cancelled' : 'runtime' };
159
+ }
160
+ if (!proof?.verified)
161
+ return { ...result, score: 'unknown', reason: 'skill_unverified' };
162
+ if (report.requests === 0 || report.totalTokens === 0)
163
+ return { ...result, score: 'unknown', reason: 'no_usage' };
164
+ if (report.hitBudget ||
165
+ report.requests > suite.maxRequests ||
166
+ report.totalTokens > suite.maxTokens ||
167
+ tools.length > suite.maxTools) {
168
+ return { ...result, score: 'unknown', reason: 'budget' };
169
+ }
170
+ if (matched !== checks.length ||
171
+ report.printExitCode !== 0 ||
172
+ report.evidence.terminal !== 'completed' ||
173
+ tools.some(tool => !tool.success))
174
+ return { ...result, score: 'fail', reason: 'check_failed' };
175
+ return { ...result, score: 'pass' };
176
+ }
177
+ finally {
178
+ (0, fs_1.rmSync)(sandbox, { recursive: true, force: true });
179
+ }
180
+ }
181
+ function judgeRsiPairs(pairs) {
182
+ if (pairs.some(pair => pair.arms.candidate?.guardViolation ||
183
+ (pair.arms.baseline?.score === 'pass' && pair.arms.candidate?.score === 'fail'))) {
184
+ return 'regressed';
185
+ }
186
+ if (pairs.some(pair => pair.state !== 'complete' ||
187
+ !pair.arms.baseline ||
188
+ pair.arms.baseline.score === 'unknown' ||
189
+ !pair.arms.candidate ||
190
+ pair.arms.candidate.score === 'unknown'))
191
+ return 'inconclusive';
192
+ const delta = (pair) => (pair.arms.candidate?.tools?.length ?? 0) - (pair.arms.baseline?.tools?.length ?? 0);
193
+ const local = pairs
194
+ .filter(pair => pair.category === 'local_edit_cost')
195
+ .map(delta)
196
+ .sort((a, b) => a - b);
197
+ if ((local.length > 0 &&
198
+ (local[Math.floor((local.length - 1) / 2)] + local[Math.floor(local.length / 2)]) / 2 > 1) ||
199
+ pairs.some(pair => pair.category === 'missing_verification' && delta(pair) > 0))
200
+ return 'regressed';
201
+ return pairs.some(pair => pair.arms.baseline?.score === 'fail' && pair.arms.candidate?.score === 'pass')
202
+ ? 'improved'
203
+ : 'unchanged';
204
+ }
205
+ function isAlive(pid) {
206
+ try {
207
+ process.kill(pid, 0);
208
+ return true;
209
+ }
210
+ catch (error) {
211
+ return error.code !== 'ESRCH';
212
+ }
213
+ }
214
+ async function evaluateRsi(output, suiteFile, signal) {
215
+ const directory = (0, fs_1.realpathSync)((0, path_1.resolve)(output));
216
+ const receipt = (0, receipt_1.readRsiReceipt)(directory);
217
+ const candidate = receipt.proposal;
218
+ if (!('patch' in candidate))
219
+ throw new Error('This RSI proposal has no Skill candidate.');
220
+ const target = (0, path_1.join)(directory, 'comparison.json');
221
+ const existing = readRsiComparison(directory, receipt.digest);
222
+ const suitePath = suiteFile ? (0, path_1.resolve)(suiteFile) : existing?.suitePath;
223
+ if (!suitePath)
224
+ throw new Error('Supply --suite to start RSI evaluation.');
225
+ const suite = (0, evaluation_suite_1.parseRsiSuite)((0, receipt_1.readRsiJson)(suitePath));
226
+ const suiteDigest = (0, canonical_1.digestRuntimeValue)(suite);
227
+ // Tool manifest and runtime identity are frozen for resumption with the same install.
228
+ const executionProfileDigest = (0, canonical_1.digestRuntimeValue)({
229
+ node: process.version,
230
+ platform: process.platform,
231
+ arch: process.arch,
232
+ runtime: installedRuntimeDigest(),
233
+ tools: evaluation_suite_1.RSI_EVALUATION_TOOLS,
234
+ });
235
+ const { before, after } = await (0, proposal_1.resolveRsiCandidate)(receipt.repository, candidate);
236
+ const initial = {
237
+ version: 1,
238
+ proposalDigest: receipt.digest,
239
+ candidateDigest: candidate.candidateContentDigest,
240
+ suitePath,
241
+ suiteDigest,
242
+ executionProfileDigest,
243
+ pairs: [],
244
+ phase: 'evaluating',
245
+ };
246
+ const read = () => {
247
+ const current = readRsiComparison(directory, receipt.digest);
248
+ if (current &&
249
+ (current.suiteDigest !== suiteDigest ||
250
+ current.candidateDigest !== initial.candidateDigest ||
251
+ current.executionProfileDigest !== executionProfileDigest))
252
+ throw new Error('RSI suite, candidate, or execution profile changed. Use a new run.');
253
+ return current;
254
+ };
255
+ const save = (state, pairs, phase, verdict) => {
256
+ const { version, proposalDigest, candidateDigest, suitePath, suiteDigest, executionProfileDigest, } = state;
257
+ return (0, receipt_1.writeRsiState)(target, {
258
+ version,
259
+ proposalDigest,
260
+ candidateDigest,
261
+ suitePath,
262
+ suiteDigest,
263
+ executionProfileDigest,
264
+ pairs,
265
+ phase,
266
+ ...(verdict ? { verdict } : {}),
267
+ });
268
+ };
269
+ for (const task of suite.tasks) {
270
+ for (let repeat = 0; repeat < suite.repeats; repeat++) {
271
+ const next = (0, file_lock_1.withFileLockSync)(target, () => {
272
+ const state = read() ?? initial;
273
+ if (state.verdict)
274
+ return undefined;
275
+ const active = state.pairs.find(pair => pair.state === 'running');
276
+ if (active?.owner && isAlive(active.owner))
277
+ throw new Error('RSI evaluation is already running.');
278
+ const pairs = state.pairs.map(pair => pair.state === 'running'
279
+ ? { ...pair, state: 'indeterminate', owner: undefined }
280
+ : pair);
281
+ if (signal.aborted) {
282
+ save(state, pairs, 'cancelled');
283
+ return undefined;
284
+ }
285
+ if (task.split === 'holdout') {
286
+ const screen = judgeRsiPairs(pairs.filter(pair => pair.split === 'development'));
287
+ if (screen === 'inconclusive' || screen === 'regressed') {
288
+ save(state, pairs, 'evaluated', screen === 'inconclusive' ? screen : 'screened_out');
289
+ return undefined;
290
+ }
291
+ }
292
+ if (pairs.some(pair => pair.taskId === task.id && pair.repeat === repeat))
293
+ return undefined;
294
+ const pair = {
295
+ taskId: task.id,
296
+ repeat,
297
+ split: task.split,
298
+ category: task.category,
299
+ state: 'running',
300
+ owner: process.pid,
301
+ order: pairs.length % 2 === 0 ? ['baseline', 'candidate'] : ['candidate', 'baseline'],
302
+ arms: {},
303
+ };
304
+ save(state, [...pairs, pair], 'evaluating');
305
+ return pair;
306
+ });
307
+ if (!next)
308
+ continue;
309
+ for (const arm of next.order) {
310
+ if (signal.aborted)
311
+ break;
312
+ const measured = await runArm(task, suite, {
313
+ skill: candidate.skill,
314
+ path: candidate.path,
315
+ baseCommit: candidate.baseCommit,
316
+ timeoutMs: suite.timeoutMs,
317
+ expected: (arm === 'baseline' ? before : after) ?? null,
318
+ prompt: `$${candidate.skill} ${task.prompt}`,
319
+ }, signal);
320
+ (0, file_lock_1.withFileLockSync)(target, () => {
321
+ const state = read();
322
+ save(state, state.pairs.map(pair => pair.owner === process.pid && pair.state === 'running'
323
+ ? { ...pair, arms: { ...pair.arms, [arm]: measured } }
324
+ : pair), 'evaluating');
325
+ });
326
+ }
327
+ (0, file_lock_1.withFileLockSync)(target, () => {
328
+ const state = read();
329
+ save(state, state.pairs.map(pair => pair.owner === process.pid && pair.state === 'running'
330
+ ? { ...pair, state: signal.aborted ? 'indeterminate' : 'complete', owner: undefined }
331
+ : pair), signal.aborted ? 'cancelled' : 'evaluating');
332
+ });
333
+ }
334
+ }
335
+ return (0, file_lock_1.withFileLockSync)(target, () => {
336
+ const state = read();
337
+ if (state.verdict || signal.aborted)
338
+ return state;
339
+ if (state.pairs.some(pair => pair.state === 'running'))
340
+ throw new Error('RSI evaluation is already running.');
341
+ const verdict = judgeRsiPairs(state.pairs.filter(pair => pair.split === 'holdout'));
342
+ return save(state, state.pairs, verdict === 'improved' ? 'awaiting_review' : 'evaluated', verdict);
343
+ });
344
+ }
345
+ //# sourceMappingURL=evaluation.js.map
@@ -0,0 +1,54 @@
1
+ import type { RsiCategory, RsiTurnEvidenceV1 } from './contracts';
2
+ type LifecyclePhase = 'applying' | 'applied_to_review' | 'accepted' | 'observed' | 'rolling_back' | 'rollback_pending_commit' | 'rolled_back' | 'rollback_verified';
3
+ interface RsiObservation {
4
+ readonly workspace: string;
5
+ readonly commit: string;
6
+ readonly turns: readonly RsiTurnEvidenceV1[];
7
+ }
8
+ interface RsiLifecycleState {
9
+ readonly version: 1;
10
+ readonly proposalDigest: string;
11
+ readonly comparisonDigest: string;
12
+ readonly candidateDigest: string;
13
+ readonly worktree: string;
14
+ readonly phase: LifecyclePhase;
15
+ readonly accepted?: {
16
+ readonly commit: string;
17
+ readonly at: number;
18
+ };
19
+ readonly rollback?: {
20
+ readonly parent: string;
21
+ readonly commit?: string;
22
+ readonly at?: number;
23
+ };
24
+ readonly observations: readonly RsiObservation[];
25
+ readonly rollbackObservation?: RsiObservation;
26
+ }
27
+ export interface RsiLifecycleReceipt extends RsiLifecycleState {
28
+ readonly digest: string;
29
+ }
30
+ type LifecycleAction = {
31
+ readonly action: 'apply';
32
+ readonly candidate: string;
33
+ readonly worktree: string;
34
+ } | {
35
+ readonly action: 'accept';
36
+ readonly commit: string;
37
+ } | {
38
+ readonly action: 'observe';
39
+ readonly input: string;
40
+ } | {
41
+ readonly action: 'rollback';
42
+ readonly worktree: string;
43
+ readonly commit?: string;
44
+ };
45
+ export declare function readRsiLifecycle(output: string, proposalDigest: string, comparisonDigest?: string): RsiLifecycleReceipt | undefined;
46
+ export declare function summarizeRsiObservations(state: RsiLifecycleReceipt, category: RsiCategory): {
47
+ turns: number;
48
+ recurrences: number;
49
+ toolCalls: number;
50
+ elapsedMs: number;
51
+ } | undefined;
52
+ export declare function advanceRsi(output: string, request: LifecycleAction): Promise<RsiLifecycleReceipt>;
53
+ export {};
54
+ //# sourceMappingURL=lifecycle.d.ts.map