@orion-agents/orion-code 0.1.1 → 0.1.2

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 (602) hide show
  1. package/README.md +93 -68
  2. package/README.zh-CN.md +181 -216
  3. package/dist/cli.js +13 -17
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/index.d.ts.map +1 -1
  6. package/dist/commands/index.js +213 -114
  7. package/dist/commands/index.js.map +1 -1
  8. package/dist/commands/target-command.d.ts.map +1 -1
  9. package/dist/commands/target-command.js +42 -8
  10. package/dist/commands/target-command.js.map +1 -1
  11. package/dist/core/agent.d.ts.map +1 -1
  12. package/dist/core/agent.js +2 -2
  13. package/dist/core/agent.js.map +1 -1
  14. package/dist/framework/external-assertion.d.ts +65 -0
  15. package/dist/framework/external-assertion.d.ts.map +1 -0
  16. package/dist/framework/external-assertion.js +571 -0
  17. package/dist/framework/external-assertion.js.map +1 -0
  18. package/dist/framework/index.d.ts +6 -4
  19. package/dist/framework/index.d.ts.map +1 -1
  20. package/dist/framework/index.js +4 -1
  21. package/dist/framework/index.js.map +1 -1
  22. package/dist/framework/query.d.ts +15 -1
  23. package/dist/framework/query.d.ts.map +1 -1
  24. package/dist/framework/query.js +42 -23
  25. package/dist/framework/query.js.map +1 -1
  26. package/dist/framework/tool-scheduler.d.ts +2 -0
  27. package/dist/framework/tool-scheduler.d.ts.map +1 -1
  28. package/dist/framework/tool-scheduler.js +23 -9
  29. package/dist/framework/tool-scheduler.js.map +1 -1
  30. package/dist/framework/tool-serializer.d.ts.map +1 -1
  31. package/dist/framework/tool-serializer.js +20 -4
  32. package/dist/framework/tool-serializer.js.map +1 -1
  33. package/dist/framework/tool.d.ts +11 -5
  34. package/dist/framework/tool.d.ts.map +1 -1
  35. package/dist/framework/tool.js.map +1 -1
  36. package/dist/harness/safety.d.ts.map +1 -1
  37. package/dist/harness/safety.js +19 -3
  38. package/dist/harness/safety.js.map +1 -1
  39. package/dist/init.d.ts +1 -1
  40. package/dist/init.d.ts.map +1 -1
  41. package/dist/init.js +115 -34
  42. package/dist/init.js.map +1 -1
  43. package/dist/memory/storage.d.ts.map +1 -1
  44. package/dist/memory/storage.js +1 -0
  45. package/dist/memory/storage.js.map +1 -1
  46. package/dist/memory/store.d.ts.map +1 -1
  47. package/dist/memory/store.js +11 -5
  48. package/dist/memory/store.js.map +1 -1
  49. package/dist/print-ui/launch.d.ts +4 -0
  50. package/dist/print-ui/launch.d.ts.map +1 -1
  51. package/dist/print-ui/launch.js +102 -9
  52. package/dist/print-ui/launch.js.map +1 -1
  53. package/dist/product/identity.d.ts +2 -2
  54. package/dist/product/identity.d.ts.map +1 -1
  55. package/dist/product/identity.js +2 -2
  56. package/dist/product/identity.js.map +1 -1
  57. package/dist/product/index.d.ts +2 -1
  58. package/dist/product/index.d.ts.map +1 -1
  59. package/dist/product/index.js +5 -1
  60. package/dist/product/index.js.map +1 -1
  61. package/dist/product/version.d.ts +12 -0
  62. package/dist/product/version.d.ts.map +1 -0
  63. package/dist/product/version.js +31 -0
  64. package/dist/product/version.js.map +1 -0
  65. package/dist/runtime/agent-runtime-controller.d.ts +34 -0
  66. package/dist/runtime/agent-runtime-controller.d.ts.map +1 -1
  67. package/dist/runtime/agent-runtime-controller.js +953 -148
  68. package/dist/runtime/agent-runtime-controller.js.map +1 -1
  69. package/dist/runtime/agent-runtime-protocol.d.ts +7 -2
  70. package/dist/runtime/agent-runtime-protocol.d.ts.map +1 -1
  71. package/dist/runtime/agent-runtime-protocol.js +6 -0
  72. package/dist/runtime/agent-runtime-protocol.js.map +1 -1
  73. package/dist/runtime/chat-controller.d.ts +6 -0
  74. package/dist/runtime/chat-controller.d.ts.map +1 -1
  75. package/dist/runtime/chat-controller.js +200 -19
  76. package/dist/runtime/chat-controller.js.map +1 -1
  77. package/dist/runtime/goals/accounting.d.ts +28 -0
  78. package/dist/runtime/goals/accounting.d.ts.map +1 -1
  79. package/dist/runtime/goals/accounting.js +69 -0
  80. package/dist/runtime/goals/accounting.js.map +1 -1
  81. package/dist/runtime/goals/completion-audit.d.ts +13 -8
  82. package/dist/runtime/goals/completion-audit.d.ts.map +1 -1
  83. package/dist/runtime/goals/completion-audit.js +598 -16
  84. package/dist/runtime/goals/completion-audit.js.map +1 -1
  85. package/dist/runtime/goals/coordinator.d.ts +44 -5
  86. package/dist/runtime/goals/coordinator.d.ts.map +1 -1
  87. package/dist/runtime/goals/coordinator.js +1124 -58
  88. package/dist/runtime/goals/coordinator.js.map +1 -1
  89. package/dist/runtime/goals/evidence.d.ts +37 -0
  90. package/dist/runtime/goals/evidence.d.ts.map +1 -0
  91. package/dist/runtime/goals/evidence.js +300 -0
  92. package/dist/runtime/goals/evidence.js.map +1 -0
  93. package/dist/runtime/goals/presentation.d.ts +4 -0
  94. package/dist/runtime/goals/presentation.d.ts.map +1 -0
  95. package/dist/runtime/goals/presentation.js +50 -0
  96. package/dist/runtime/goals/presentation.js.map +1 -0
  97. package/dist/runtime/goals/prompt.d.ts.map +1 -1
  98. package/dist/runtime/goals/prompt.js +38 -8
  99. package/dist/runtime/goals/prompt.js.map +1 -1
  100. package/dist/runtime/goals/tools.d.ts +18 -1
  101. package/dist/runtime/goals/tools.d.ts.map +1 -1
  102. package/dist/runtime/goals/tools.js +308 -28
  103. package/dist/runtime/goals/tools.js.map +1 -1
  104. package/dist/runtime/goals/types.d.ts +241 -7
  105. package/dist/runtime/goals/types.d.ts.map +1 -1
  106. package/dist/runtime/goals/types.js +8 -2
  107. package/dist/runtime/goals/types.js.map +1 -1
  108. package/dist/runtime/subagents/child-executor-guard.d.ts +12 -4
  109. package/dist/runtime/subagents/child-executor-guard.d.ts.map +1 -1
  110. package/dist/runtime/subagents/child-executor-guard.js +397 -61
  111. package/dist/runtime/subagents/child-executor-guard.js.map +1 -1
  112. package/dist/runtime/subagents/presets.d.ts +4 -5
  113. package/dist/runtime/subagents/presets.d.ts.map +1 -1
  114. package/dist/runtime/subagents/presets.js +18 -33
  115. package/dist/runtime/subagents/presets.js.map +1 -1
  116. package/dist/runtime/subagents/production.d.ts +3 -1
  117. package/dist/runtime/subagents/production.d.ts.map +1 -1
  118. package/dist/runtime/subagents/production.js +37 -7
  119. package/dist/runtime/subagents/production.js.map +1 -1
  120. package/dist/runtime/subagents/runner.d.ts.map +1 -1
  121. package/dist/runtime/subagents/runner.js +24 -3
  122. package/dist/runtime/subagents/runner.js.map +1 -1
  123. package/dist/runtime/subagents/runtime-integration.d.ts +3 -0
  124. package/dist/runtime/subagents/runtime-integration.d.ts.map +1 -1
  125. package/dist/runtime/subagents/runtime-integration.js +18 -7
  126. package/dist/runtime/subagents/runtime-integration.js.map +1 -1
  127. package/dist/runtime/subagents/supervisor.d.ts +4 -4
  128. package/dist/runtime/subagents/supervisor.d.ts.map +1 -1
  129. package/dist/runtime/subagents/supervisor.js +39 -19
  130. package/dist/runtime/subagents/supervisor.js.map +1 -1
  131. package/dist/runtime/subagents/types.d.ts +7 -0
  132. package/dist/runtime/subagents/types.d.ts.map +1 -1
  133. package/dist/runtime/subagents/types.js +12 -1
  134. package/dist/runtime/subagents/types.js.map +1 -1
  135. package/dist/runtime/ui-events.d.ts +6 -0
  136. package/dist/runtime/ui-events.d.ts.map +1 -1
  137. package/dist/runtime/ui-events.js +5 -5
  138. package/dist/runtime/ui-events.js.map +1 -1
  139. package/dist/services/config.d.ts +1 -1
  140. package/dist/services/config.d.ts.map +1 -1
  141. package/dist/services/config.js +53 -48
  142. package/dist/services/config.js.map +1 -1
  143. package/dist/services/doctor.d.ts.map +1 -1
  144. package/dist/services/doctor.js +163 -17
  145. package/dist/services/doctor.js.map +1 -1
  146. package/dist/services/goal-storage.d.ts +9 -4
  147. package/dist/services/goal-storage.d.ts.map +1 -1
  148. package/dist/services/goal-storage.js +1113 -75
  149. package/dist/services/goal-storage.js.map +1 -1
  150. package/dist/services/llm.d.ts +19 -0
  151. package/dist/services/llm.d.ts.map +1 -1
  152. package/dist/services/llm.js +153 -20
  153. package/dist/services/llm.js.map +1 -1
  154. package/dist/services/model-registry.d.ts +1 -1
  155. package/dist/services/model-registry.d.ts.map +1 -1
  156. package/dist/services/model-registry.js +69 -19
  157. package/dist/services/model-registry.js.map +1 -1
  158. package/dist/services/provider-resilience/coordinator.d.ts +2 -1
  159. package/dist/services/provider-resilience/coordinator.d.ts.map +1 -1
  160. package/dist/services/provider-resilience/coordinator.js +7 -6
  161. package/dist/services/provider-resilience/coordinator.js.map +1 -1
  162. package/dist/services/provider-resilience/error-classifier.d.ts.map +1 -1
  163. package/dist/services/provider-resilience/error-classifier.js +67 -17
  164. package/dist/services/provider-resilience/error-classifier.js.map +1 -1
  165. package/dist/services/provider-resilience/types.d.ts +1 -1
  166. package/dist/services/provider-resilience/types.d.ts.map +1 -1
  167. package/dist/services/provider-resilience/types.js.map +1 -1
  168. package/dist/services/redaction.d.ts.map +1 -1
  169. package/dist/services/redaction.js +9 -1
  170. package/dist/services/redaction.js.map +1 -1
  171. package/dist/services/session-storage.d.ts +12 -1
  172. package/dist/services/session-storage.d.ts.map +1 -1
  173. package/dist/services/session-storage.js +23 -7
  174. package/dist/services/session-storage.js.map +1 -1
  175. package/dist/services/storage-maintenance.d.ts +73 -3
  176. package/dist/services/storage-maintenance.d.ts.map +1 -1
  177. package/dist/services/storage-maintenance.js +771 -104
  178. package/dist/services/storage-maintenance.js.map +1 -1
  179. package/dist/services/task-manager.d.ts.map +1 -1
  180. package/dist/services/task-manager.js +2 -2
  181. package/dist/services/task-manager.js.map +1 -1
  182. package/dist/services/web-search-adapters.d.ts.map +1 -1
  183. package/dist/services/web-search-adapters.js +89 -49
  184. package/dist/services/web-search-adapters.js.map +1 -1
  185. package/dist/services/web-search-mcp.d.ts.map +1 -1
  186. package/dist/services/web-search-mcp.js +34 -37
  187. package/dist/services/web-search-mcp.js.map +1 -1
  188. package/dist/services/workspace-state.d.ts +4 -0
  189. package/dist/services/workspace-state.d.ts.map +1 -1
  190. package/dist/services/workspace-state.js +30 -9
  191. package/dist/services/workspace-state.js.map +1 -1
  192. package/dist/terminal-ui/launch.d.ts +2 -0
  193. package/dist/terminal-ui/launch.d.ts.map +1 -1
  194. package/dist/terminal-ui/launch.js +21 -7
  195. package/dist/terminal-ui/launch.js.map +1 -1
  196. package/dist/tools/git.d.ts.map +1 -1
  197. package/dist/tools/git.js +275 -27
  198. package/dist/tools/git.js.map +1 -1
  199. package/dist/tools/index.d.ts.map +1 -1
  200. package/dist/tools/index.js +23 -4
  201. package/dist/tools/index.js.map +1 -1
  202. package/dist/tools/mcp.d.ts.map +1 -1
  203. package/dist/tools/mcp.js +20 -12
  204. package/dist/tools/mcp.js.map +1 -1
  205. package/dist/tools/web.d.ts.map +1 -1
  206. package/dist/tools/web.js +38 -14
  207. package/dist/tools/web.js.map +1 -1
  208. package/dist/tui-ui/layout.d.ts.map +1 -1
  209. package/dist/tui-ui/layout.js +36 -23
  210. package/dist/tui-ui/layout.js.map +1 -1
  211. package/dist/tui-ui/pickers.d.ts.map +1 -1
  212. package/dist/tui-ui/pickers.js +4 -3
  213. package/dist/tui-ui/pickers.js.map +1 -1
  214. package/dist/tui-ui/runner.d.ts +1 -0
  215. package/dist/tui-ui/runner.d.ts.map +1 -1
  216. package/dist/tui-ui/runner.js +14 -0
  217. package/dist/tui-ui/runner.js.map +1 -1
  218. package/dist/tui-ui/state.d.ts +6 -0
  219. package/dist/tui-ui/state.d.ts.map +1 -1
  220. package/dist/tui-ui/state.js +60 -30
  221. package/dist/tui-ui/state.js.map +1 -1
  222. package/package.json +13 -9
  223. package/dist/core/state.d.ts +0 -94
  224. package/dist/core/state.d.ts.map +0 -1
  225. package/dist/core/state.js +0 -178
  226. package/dist/core/state.js.map +0 -1
  227. package/dist/ink/bidi.d.ts +0 -16
  228. package/dist/ink/bidi.d.ts.map +0 -1
  229. package/dist/ink/bidi.js +0 -124
  230. package/dist/ink/bidi.js.map +0 -1
  231. package/dist/ink/clearTerminal.d.ts +0 -14
  232. package/dist/ink/clearTerminal.d.ts.map +0 -1
  233. package/dist/ink/clearTerminal.js +0 -63
  234. package/dist/ink/clearTerminal.js.map +0 -1
  235. package/dist/ink/colorize.d.ts +0 -17
  236. package/dist/ink/colorize.d.ts.map +0 -1
  237. package/dist/ink/colorize.js +0 -208
  238. package/dist/ink/colorize.js.map +0 -1
  239. package/dist/ink/components/App.d.ts +0 -73
  240. package/dist/ink/components/App.d.ts.map +0 -1
  241. package/dist/ink/components/App.js +0 -646
  242. package/dist/ink/components/App.js.map +0 -1
  243. package/dist/ink/components/AppContext.d.ts +0 -12
  244. package/dist/ink/components/AppContext.d.ts.map +0 -1
  245. package/dist/ink/components/AppContext.js +0 -14
  246. package/dist/ink/components/AppContext.js.map +0 -1
  247. package/dist/ink/components/Box.d.ts +0 -44
  248. package/dist/ink/components/Box.d.ts.map +0 -1
  249. package/dist/ink/components/Box.js +0 -191
  250. package/dist/ink/components/Box.js.map +0 -1
  251. package/dist/ink/components/ClockContext.d.ts +0 -9
  252. package/dist/ink/components/ClockContext.d.ts.map +0 -1
  253. package/dist/ink/components/ClockContext.js +0 -146
  254. package/dist/ink/components/ClockContext.js.map +0 -1
  255. package/dist/ink/components/CursorDeclarationContext.d.ts +0 -23
  256. package/dist/ink/components/CursorDeclarationContext.d.ts.map +0 -1
  257. package/dist/ink/components/CursorDeclarationContext.js +0 -6
  258. package/dist/ink/components/CursorDeclarationContext.js.map +0 -1
  259. package/dist/ink/components/ErrorOverview.d.ts +0 -6
  260. package/dist/ink/components/ErrorOverview.d.ts.map +0 -1
  261. package/dist/ink/components/ErrorOverview.js +0 -27
  262. package/dist/ink/components/ErrorOverview.js.map +0 -1
  263. package/dist/ink/components/Newline.d.ts +0 -13
  264. package/dist/ink/components/Newline.d.ts.map +0 -1
  265. package/dist/ink/components/Newline.js +0 -36
  266. package/dist/ink/components/Newline.js.map +0 -1
  267. package/dist/ink/components/NoSelect.d.ts +0 -20
  268. package/dist/ink/components/NoSelect.d.ts.map +0 -1
  269. package/dist/ink/components/NoSelect.js +0 -63
  270. package/dist/ink/components/NoSelect.js.map +0 -1
  271. package/dist/ink/components/RawAnsi.d.ts +0 -17
  272. package/dist/ink/components/RawAnsi.d.ts.map +0 -1
  273. package/dist/ink/components/RawAnsi.js +0 -52
  274. package/dist/ink/components/RawAnsi.js.map +0 -1
  275. package/dist/ink/components/Spacer.d.ts +0 -6
  276. package/dist/ink/components/Spacer.d.ts.map +0 -1
  277. package/dist/ink/components/Spacer.js +0 -26
  278. package/dist/ink/components/Spacer.js.map +0 -1
  279. package/dist/ink/components/StdinContext.d.ts +0 -28
  280. package/dist/ink/components/StdinContext.d.ts.map +0 -1
  281. package/dist/ink/components/StdinContext.js +0 -19
  282. package/dist/ink/components/StdinContext.js.map +0 -1
  283. package/dist/ink/components/TerminalFocusContext.d.ts +0 -10
  284. package/dist/ink/components/TerminalFocusContext.d.ts.map +0 -1
  285. package/dist/ink/components/TerminalFocusContext.js +0 -81
  286. package/dist/ink/components/TerminalFocusContext.js.map +0 -1
  287. package/dist/ink/components/TerminalSizeContext.d.ts +0 -6
  288. package/dist/ink/components/TerminalSizeContext.d.ts.map +0 -1
  289. package/dist/ink/components/TerminalSizeContext.js +0 -6
  290. package/dist/ink/components/TerminalSizeContext.js.map +0 -1
  291. package/dist/ink/components/Text.d.ts +0 -56
  292. package/dist/ink/components/Text.d.ts.map +0 -1
  293. package/dist/ink/components/Text.js +0 -201
  294. package/dist/ink/components/Text.js.map +0 -1
  295. package/dist/ink/constants.d.ts +0 -2
  296. package/dist/ink/constants.d.ts.map +0 -1
  297. package/dist/ink/constants.js +0 -6
  298. package/dist/ink/constants.js.map +0 -1
  299. package/dist/ink/devtools.d.ts +0 -3
  300. package/dist/ink/devtools.d.ts.map +0 -1
  301. package/dist/ink/devtools.js +0 -5
  302. package/dist/ink/devtools.js.map +0 -1
  303. package/dist/ink/dom.d.ts +0 -77
  304. package/dist/ink/dom.d.ts.map +0 -1
  305. package/dist/ink/dom.js +0 -322
  306. package/dist/ink/dom.js.map +0 -1
  307. package/dist/ink/events/click-event.d.ts +0 -32
  308. package/dist/ink/events/click-event.d.ts.map +0 -1
  309. package/dist/ink/events/click-event.js +0 -30
  310. package/dist/ink/events/click-event.js.map +0 -1
  311. package/dist/ink/events/dispatcher.d.ts +0 -41
  312. package/dist/ink/events/dispatcher.d.ts.map +0 -1
  313. package/dist/ink/events/dispatcher.js +0 -181
  314. package/dist/ink/events/dispatcher.js.map +0 -1
  315. package/dist/ink/events/emitter.d.ts +0 -6
  316. package/dist/ink/events/emitter.d.ts.map +0 -1
  317. package/dist/ink/events/emitter.js +0 -36
  318. package/dist/ink/events/emitter.js.map +0 -1
  319. package/dist/ink/events/event-handlers.d.ts +0 -47
  320. package/dist/ink/events/event-handlers.d.ts.map +0 -1
  321. package/dist/ink/events/event-handlers.js +0 -34
  322. package/dist/ink/events/event-handlers.js.map +0 -1
  323. package/dist/ink/events/event.d.ts +0 -6
  324. package/dist/ink/events/event.d.ts.map +0 -1
  325. package/dist/ink/events/event.js +0 -16
  326. package/dist/ink/events/event.js.map +0 -1
  327. package/dist/ink/events/focus-event.d.ts +0 -14
  328. package/dist/ink/events/focus-event.d.ts.map +0 -1
  329. package/dist/ink/events/focus-event.js +0 -20
  330. package/dist/ink/events/focus-event.js.map +0 -1
  331. package/dist/ink/events/input-event.d.ts +0 -31
  332. package/dist/ink/events/input-event.d.ts.map +0 -1
  333. package/dist/ink/events/input-event.js +0 -163
  334. package/dist/ink/events/input-event.js.map +0 -1
  335. package/dist/ink/events/keyboard-event.d.ts +0 -20
  336. package/dist/ink/events/keyboard-event.d.ts.map +0 -1
  337. package/dist/ink/events/keyboard-event.js +0 -44
  338. package/dist/ink/events/keyboard-event.js.map +0 -1
  339. package/dist/ink/events/terminal-event.d.ts +0 -55
  340. package/dist/ink/events/terminal-event.d.ts.map +0 -1
  341. package/dist/ink/events/terminal-event.js +0 -79
  342. package/dist/ink/events/terminal-event.js.map +0 -1
  343. package/dist/ink/events/terminal-focus-event.d.ts +0 -14
  344. package/dist/ink/events/terminal-focus-event.d.ts.map +0 -1
  345. package/dist/ink/events/terminal-focus-event.js +0 -19
  346. package/dist/ink/events/terminal-focus-event.js.map +0 -1
  347. package/dist/ink/focus.d.ts +0 -44
  348. package/dist/ink/focus.d.ts.map +0 -1
  349. package/dist/ink/focus.js +0 -164
  350. package/dist/ink/focus.js.map +0 -1
  351. package/dist/ink/frame.d.ts +0 -95
  352. package/dist/ink/frame.d.ts.map +0 -1
  353. package/dist/ink/frame.js +0 -35
  354. package/dist/ink/frame.js.map +0 -1
  355. package/dist/ink/get-max-width.d.ts +0 -18
  356. package/dist/ink/get-max-width.d.ts.map +0 -1
  357. package/dist/ink/get-max-width.js +0 -26
  358. package/dist/ink/get-max-width.js.map +0 -1
  359. package/dist/ink/hit-test.d.ts +0 -34
  360. package/dist/ink/hit-test.d.ts.map +0 -1
  361. package/dist/ink/hit-test.js +0 -119
  362. package/dist/ink/hit-test.js.map +0 -1
  363. package/dist/ink/hooks/use-animation-frame.d.ts +0 -27
  364. package/dist/ink/hooks/use-animation-frame.d.ts.map +0 -1
  365. package/dist/ink/hooks/use-animation-frame.js +0 -52
  366. package/dist/ink/hooks/use-animation-frame.js.map +0 -1
  367. package/dist/ink/hooks/use-app.d.ts +0 -6
  368. package/dist/ink/hooks/use-app.d.ts.map +0 -1
  369. package/dist/ink/hooks/use-app.js +0 -13
  370. package/dist/ink/hooks/use-app.js.map +0 -1
  371. package/dist/ink/hooks/use-declared-cursor.d.ts +0 -27
  372. package/dist/ink/hooks/use-declared-cursor.d.ts.map +0 -1
  373. package/dist/ink/hooks/use-declared-cursor.js +0 -67
  374. package/dist/ink/hooks/use-declared-cursor.js.map +0 -1
  375. package/dist/ink/hooks/use-input.d.ts +0 -38
  376. package/dist/ink/hooks/use-input.d.ts.map +0 -1
  377. package/dist/ink/hooks/use-input.js +0 -86
  378. package/dist/ink/hooks/use-input.js.map +0 -1
  379. package/dist/ink/hooks/use-interval.d.ts +0 -19
  380. package/dist/ink/hooks/use-interval.d.ts.map +0 -1
  381. package/dist/ink/hooks/use-interval.js +0 -59
  382. package/dist/ink/hooks/use-interval.js.map +0 -1
  383. package/dist/ink/hooks/use-search-highlight.d.ts +0 -31
  384. package/dist/ink/hooks/use-search-highlight.d.ts.map +0 -1
  385. package/dist/ink/hooks/use-search-highlight.js +0 -39
  386. package/dist/ink/hooks/use-search-highlight.js.map +0 -1
  387. package/dist/ink/hooks/use-selection.d.ts +0 -40
  388. package/dist/ink/hooks/use-selection.d.ts.map +0 -1
  389. package/dist/ink/hooks/use-selection.js +0 -68
  390. package/dist/ink/hooks/use-selection.js.map +0 -1
  391. package/dist/ink/hooks/use-stdin.d.ts +0 -6
  392. package/dist/ink/hooks/use-stdin.d.ts.map +0 -1
  393. package/dist/ink/hooks/use-stdin.js +0 -13
  394. package/dist/ink/hooks/use-stdin.js.map +0 -1
  395. package/dist/ink/hooks/use-tab-status.d.ts +0 -14
  396. package/dist/ink/hooks/use-tab-status.d.ts.map +0 -1
  397. package/dist/ink/hooks/use-tab-status.js +0 -61
  398. package/dist/ink/hooks/use-tab-status.js.map +0 -1
  399. package/dist/ink/hooks/use-terminal-focus.d.ts +0 -11
  400. package/dist/ink/hooks/use-terminal-focus.d.ts.map +0 -1
  401. package/dist/ink/hooks/use-terminal-focus.js +0 -22
  402. package/dist/ink/hooks/use-terminal-focus.js.map +0 -1
  403. package/dist/ink/hooks/use-terminal-title.d.ts +0 -13
  404. package/dist/ink/hooks/use-terminal-title.d.ts.map +0 -1
  405. package/dist/ink/hooks/use-terminal-title.js +0 -36
  406. package/dist/ink/hooks/use-terminal-title.js.map +0 -1
  407. package/dist/ink/hooks/use-terminal-viewport.d.ts +0 -30
  408. package/dist/ink/hooks/use-terminal-viewport.d.ts.map +0 -1
  409. package/dist/ink/hooks/use-terminal-viewport.js +0 -81
  410. package/dist/ink/hooks/use-terminal-viewport.js.map +0 -1
  411. package/dist/ink/ink.d.ts +0 -371
  412. package/dist/ink/ink.d.ts.map +0 -1
  413. package/dist/ink/ink.js +0 -1686
  414. package/dist/ink/ink.js.map +0 -1
  415. package/dist/ink/instances.d.ts +0 -4
  416. package/dist/ink/instances.d.ts.map +0 -1
  417. package/dist/ink/instances.js +0 -10
  418. package/dist/ink/instances.js.map +0 -1
  419. package/dist/ink/line-width-cache.d.ts +0 -2
  420. package/dist/ink/line-width-cache.d.ts.map +0 -1
  421. package/dist/ink/line-width-cache.js +0 -23
  422. package/dist/ink/line-width-cache.js.map +0 -1
  423. package/dist/ink/log-update.d.ts +0 -18
  424. package/dist/ink/log-update.d.ts.map +0 -1
  425. package/dist/ink/log-update.js +0 -637
  426. package/dist/ink/log-update.js.map +0 -1
  427. package/dist/ink/measure-element.d.ts +0 -17
  428. package/dist/ink/measure-element.d.ts.map +0 -1
  429. package/dist/ink/measure-element.js +0 -11
  430. package/dist/ink/measure-element.js.map +0 -1
  431. package/dist/ink/measure-text.d.ts +0 -7
  432. package/dist/ink/measure-text.d.ts.map +0 -1
  433. package/dist/ink/measure-text.js +0 -38
  434. package/dist/ink/measure-text.js.map +0 -1
  435. package/dist/ink/node-cache.d.ts +0 -21
  436. package/dist/ink/node-cache.d.ts.map +0 -1
  437. package/dist/ink/node-cache.js +0 -36
  438. package/dist/ink/node-cache.js.map +0 -1
  439. package/dist/ink/optimizer.d.ts +0 -16
  440. package/dist/ink/optimizer.d.ts.map +0 -1
  441. package/dist/ink/optimizer.js +0 -85
  442. package/dist/ink/optimizer.js.map +0 -1
  443. package/dist/ink/output.d.ts +0 -120
  444. package/dist/ink/output.d.ts.map +0 -1
  445. package/dist/ink/output.js +0 -559
  446. package/dist/ink/output.js.map +0 -1
  447. package/dist/ink/parse-keypress.d.ts +0 -112
  448. package/dist/ink/parse-keypress.d.ts.map +0 -1
  449. package/dist/ink/parse-keypress.js +0 -719
  450. package/dist/ink/parse-keypress.js.map +0 -1
  451. package/dist/ink/parse-keypress.test.d.ts +0 -2
  452. package/dist/ink/parse-keypress.test.d.ts.map +0 -1
  453. package/dist/ink/parse-keypress.test.js +0 -37
  454. package/dist/ink/parse-keypress.test.js.map +0 -1
  455. package/dist/ink/reconciler.d.ts +0 -12
  456. package/dist/ink/reconciler.d.ts.map +0 -1
  457. package/dist/ink/reconciler.js +0 -456
  458. package/dist/ink/reconciler.js.map +0 -1
  459. package/dist/ink/render-border.d.ts +0 -25
  460. package/dist/ink/render-border.d.ts.map +0 -1
  461. package/dist/ink/render-border.js +0 -141
  462. package/dist/ink/render-border.js.map +0 -1
  463. package/dist/ink/render-node-to-output.d.ts +0 -46
  464. package/dist/ink/render-node-to-output.d.ts.map +0 -1
  465. package/dist/ink/render-node-to-output.js +0 -1257
  466. package/dist/ink/render-node-to-output.js.map +0 -1
  467. package/dist/ink/render-to-screen.d.ts +0 -47
  468. package/dist/ink/render-to-screen.d.ts.map +0 -1
  469. package/dist/ink/render-to-screen.js +0 -213
  470. package/dist/ink/render-to-screen.js.map +0 -1
  471. package/dist/ink/renderer.d.ts +0 -15
  472. package/dist/ink/renderer.d.ts.map +0 -1
  473. package/dist/ink/renderer.js +0 -169
  474. package/dist/ink/renderer.js.map +0 -1
  475. package/dist/ink/root.d.ts +0 -75
  476. package/dist/ink/root.d.ts.map +0 -1
  477. package/dist/ink/root.js +0 -89
  478. package/dist/ink/root.js.map +0 -1
  479. package/dist/ink/screen.d.ts +0 -270
  480. package/dist/ink/screen.d.ts.map +0 -1
  481. package/dist/ink/screen.js +0 -1194
  482. package/dist/ink/screen.js.map +0 -1
  483. package/dist/ink/searchHighlight.d.ts +0 -21
  484. package/dist/ink/searchHighlight.d.ts.map +0 -1
  485. package/dist/ink/searchHighlight.js +0 -82
  486. package/dist/ink/searchHighlight.js.map +0 -1
  487. package/dist/ink/selection.d.ts +0 -230
  488. package/dist/ink/selection.d.ts.map +0 -1
  489. package/dist/ink/selection.js +0 -814
  490. package/dist/ink/selection.js.map +0 -1
  491. package/dist/ink/squash-text-nodes.d.ts +0 -23
  492. package/dist/ink/squash-text-nodes.d.ts.map +0 -1
  493. package/dist/ink/squash-text-nodes.js +0 -60
  494. package/dist/ink/squash-text-nodes.js.map +0 -1
  495. package/dist/ink/stringWidth.d.ts +0 -2
  496. package/dist/ink/stringWidth.d.ts.map +0 -1
  497. package/dist/ink/stringWidth.js +0 -207
  498. package/dist/ink/stringWidth.js.map +0 -1
  499. package/dist/ink/styles.d.ts +0 -307
  500. package/dist/ink/styles.d.ts.map +0 -1
  501. package/dist/ink/styles.js +0 -302
  502. package/dist/ink/styles.js.map +0 -1
  503. package/dist/ink/supports-hyperlinks.d.ts +0 -14
  504. package/dist/ink/supports-hyperlinks.d.ts.map +0 -1
  505. package/dist/ink/supports-hyperlinks.js +0 -48
  506. package/dist/ink/supports-hyperlinks.js.map +0 -1
  507. package/dist/ink/tabstops.d.ts +0 -2
  508. package/dist/ink/tabstops.d.ts.map +0 -1
  509. package/dist/ink/tabstops.js +0 -43
  510. package/dist/ink/tabstops.js.map +0 -1
  511. package/dist/ink/terminal-focus-state.d.ts +0 -7
  512. package/dist/ink/terminal-focus-state.d.ts.map +0 -1
  513. package/dist/ink/terminal-focus-state.js +0 -43
  514. package/dist/ink/terminal-focus-state.js.map +0 -1
  515. package/dist/ink/terminal-querier.d.ts +0 -130
  516. package/dist/ink/terminal-querier.d.ts.map +0 -1
  517. package/dist/ink/terminal-querier.js +0 -184
  518. package/dist/ink/terminal-querier.js.map +0 -1
  519. package/dist/ink/terminal.d.ts +0 -56
  520. package/dist/ink/terminal.d.ts.map +0 -1
  521. package/dist/ink/terminal.js +0 -249
  522. package/dist/ink/terminal.js.map +0 -1
  523. package/dist/ink/termio/csi.d.ts +0 -166
  524. package/dist/ink/termio/csi.d.ts.map +0 -1
  525. package/dist/ink/termio/csi.js +0 -285
  526. package/dist/ink/termio/csi.js.map +0 -1
  527. package/dist/ink/termio/dec.d.ts +0 -38
  528. package/dist/ink/termio/dec.d.ts.map +0 -1
  529. package/dist/ink/termio/dec.js +0 -59
  530. package/dist/ink/termio/dec.js.map +0 -1
  531. package/dist/ink/termio.d.ts +0 -25
  532. package/dist/ink/termio.d.ts.map +0 -1
  533. package/dist/ink/termio.js +0 -32
  534. package/dist/ink/termio.js.map +0 -1
  535. package/dist/ink/useTerminalNotification.d.ts +0 -27
  536. package/dist/ink/useTerminalNotification.d.ts.map +0 -1
  537. package/dist/ink/useTerminalNotification.js +0 -62
  538. package/dist/ink/useTerminalNotification.js.map +0 -1
  539. package/dist/ink/warn.d.ts +0 -2
  540. package/dist/ink/warn.d.ts.map +0 -1
  541. package/dist/ink/warn.js +0 -14
  542. package/dist/ink/warn.js.map +0 -1
  543. package/dist/ink/widest-line.d.ts +0 -2
  544. package/dist/ink/widest-line.d.ts.map +0 -1
  545. package/dist/ink/widest-line.js +0 -18
  546. package/dist/ink/widest-line.js.map +0 -1
  547. package/dist/ink/wrap-text.d.ts +0 -3
  548. package/dist/ink/wrap-text.d.ts.map +0 -1
  549. package/dist/ink/wrap-text.js +0 -61
  550. package/dist/ink/wrap-text.js.map +0 -1
  551. package/dist/ink/wrapAnsi.d.ts +0 -8
  552. package/dist/ink/wrapAnsi.d.ts.map +0 -1
  553. package/dist/ink/wrapAnsi.js +0 -13
  554. package/dist/ink/wrapAnsi.js.map +0 -1
  555. package/dist/ink-ui/components/TerminalCursor.d.ts +0 -15
  556. package/dist/ink-ui/components/TerminalCursor.d.ts.map +0 -1
  557. package/dist/ink-ui/components/TerminalCursor.js +0 -49
  558. package/dist/ink-ui/components/TerminalCursor.js.map +0 -1
  559. package/dist/ink-ui/runtime/stdout.d.ts +0 -11
  560. package/dist/ink-ui/runtime/stdout.d.ts.map +0 -1
  561. package/dist/ink-ui/runtime/stdout.js +0 -82
  562. package/dist/ink-ui/runtime/stdout.js.map +0 -1
  563. package/dist/runtime/goal-coordinator.d.ts +0 -66
  564. package/dist/runtime/goal-coordinator.d.ts.map +0 -1
  565. package/dist/runtime/goal-coordinator.js +0 -200
  566. package/dist/runtime/goal-coordinator.js.map +0 -1
  567. package/dist/screens/REPL.d.ts +0 -21
  568. package/dist/screens/REPL.d.ts.map +0 -1
  569. package/dist/screens/REPL.js +0 -139
  570. package/dist/screens/REPL.js.map +0 -1
  571. package/dist/services/goal-sidecar.d.ts +0 -96
  572. package/dist/services/goal-sidecar.d.ts.map +0 -1
  573. package/dist/services/goal-sidecar.js +0 -145
  574. package/dist/services/goal-sidecar.js.map +0 -1
  575. package/dist/tools/goal.d.ts +0 -17
  576. package/dist/tools/goal.d.ts.map +0 -1
  577. package/dist/tools/goal.js +0 -191
  578. package/dist/tools/goal.js.map +0 -1
  579. package/dist/ui/ink/components/App.d.ts +0 -6
  580. package/dist/ui/ink/components/App.d.ts.map +0 -1
  581. package/dist/ui/ink/components/App.js +0 -38
  582. package/dist/ui/ink/components/App.js.map +0 -1
  583. package/dist/ui/ink/components/CommandPanel.d.ts +0 -13
  584. package/dist/ui/ink/components/CommandPanel.d.ts.map +0 -1
  585. package/dist/ui/ink/components/CommandPanel.js +0 -41
  586. package/dist/ui/ink/components/CommandPanel.js.map +0 -1
  587. package/dist/ui/ink/components/InputLine.d.ts +0 -8
  588. package/dist/ui/ink/components/InputLine.d.ts.map +0 -1
  589. package/dist/ui/ink/components/InputLine.js +0 -15
  590. package/dist/ui/ink/components/InputLine.js.map +0 -1
  591. package/dist/ui/ink/components/StatusBar.d.ts +0 -9
  592. package/dist/ui/ink/components/StatusBar.d.ts.map +0 -1
  593. package/dist/ui/ink/components/StatusBar.js +0 -18
  594. package/dist/ui/ink/components/StatusBar.js.map +0 -1
  595. package/dist/ui/ink/components/index.d.ts +0 -5
  596. package/dist/ui/ink/components/index.d.ts.map +0 -1
  597. package/dist/ui/ink/components/index.js +0 -5
  598. package/dist/ui/ink/components/index.js.map +0 -1
  599. package/dist/utils/chalk.d.ts +0 -9
  600. package/dist/utils/chalk.d.ts.map +0 -1
  601. package/dist/utils/chalk.js +0 -16
  602. package/dist/utils/chalk.js.map +0 -1
@@ -1,28 +1,609 @@
1
1
  "use strict";
2
- /**
3
- * v0.2.24 — Goal Completion & Blocked Audit.
4
- *
5
- * Two-phase terminal-state audit. Model requests complete/blocked via
6
- * update_goal tool; Coordinator runs audit after turn persistence.
7
- */
2
+ /** Goal completion and blocked audits. Terminal state changes are runtime-owned. */
8
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.hasUnnegatedActionMatch = hasUnnegatedActionMatch;
5
+ exports.criterionRequiresExternalCompletionEvidence = criterionRequiresExternalCompletionEvidence;
9
6
  exports.auditCompletion = auditCompletion;
10
7
  exports.auditBlocked = auditBlocked;
11
8
  exports.blockerFingerprint = blockerFingerprint;
12
9
  exports.blockersMatch = blockersMatch;
10
+ const evidence_1 = require("./evidence");
11
+ const WORKSPACE_BOUND_EVIDENCE = new Set(['test', 'build', 'lint', 'file', 'runtime']);
12
+ const MAX_EVIDENCE_TRUNCATION_COUNT = 1000000000;
13
+ function evidenceLedgerTruncationRequirement(truncation, objectiveRevision) {
14
+ if (truncation === undefined)
15
+ return null;
16
+ const fields = Object.keys(truncation);
17
+ const counts = [
18
+ truncation.droppedPassed,
19
+ truncation.droppedFailed,
20
+ truncation.droppedInconclusive,
21
+ ];
22
+ const valid = fields.length === 4 &&
23
+ fields.every(field => ['objectiveRevision', 'droppedPassed', 'droppedFailed', 'droppedInconclusive'].includes(field)) &&
24
+ Number.isSafeInteger(truncation.objectiveRevision) &&
25
+ truncation.objectiveRevision === objectiveRevision &&
26
+ counts.every(count => Number.isSafeInteger(count) && count >= 0 && count <= MAX_EVIDENCE_TRUNCATION_COUNT) &&
27
+ counts.some(count => count > 0);
28
+ if (!valid) {
29
+ return ('Completion is fail-closed because evidence-ledger truncation metadata is invalid or ' +
30
+ 'does not belong to the current objective revision. Use /target edit to start a new ' +
31
+ 'objective epoch, then rerun every criterion-specific verification.');
32
+ }
33
+ if (truncation.droppedFailed === 0 && truncation.droppedInconclusive === 0)
34
+ return null;
35
+ return (`Completion is fail-closed because the bounded evidence ledger discarded ` +
36
+ `${truncation.droppedFailed} failed and ${truncation.droppedInconclusive} ` +
37
+ `inconclusive record(s) for objective revision ${truncation.objectiveRevision}. ` +
38
+ 'Use /target edit to start a new objective epoch, then rerun every criterion-specific verification.');
39
+ }
40
+ const SEMANTIC_STOP_WORDS = new Set([
41
+ 'a',
42
+ 'an',
43
+ 'and',
44
+ 'are',
45
+ 'be',
46
+ 'been',
47
+ 'complete',
48
+ 'completed',
49
+ 'criterion',
50
+ 'derived',
51
+ 'evidence',
52
+ 'file',
53
+ 'for',
54
+ 'from',
55
+ 'goal',
56
+ 'in',
57
+ 'is',
58
+ 'of',
59
+ 'on',
60
+ 'or',
61
+ 'pass',
62
+ 'passed',
63
+ 'passes',
64
+ 'primary',
65
+ 'requirement',
66
+ 'result',
67
+ 'runtime',
68
+ 'suite',
69
+ 'test',
70
+ 'the',
71
+ 'to',
72
+ 'verify',
73
+ 'verified',
74
+ 'verification',
75
+ 'with',
76
+ ]);
77
+ function canonicalToken(value) {
78
+ const lower = value.toLowerCase();
79
+ const actionStem = lower.match(/^(publish|release|merge|create|open|submit|raise|push)(?:s|es|ed|d|ing)?$/u);
80
+ if (actionStem)
81
+ return actionStem[1];
82
+ if (/^[a-z0-9_-]+$/u.test(lower) && lower.length > 4 && lower.endsWith('s')) {
83
+ return lower.slice(0, -1);
84
+ }
85
+ return lower;
86
+ }
87
+ function semanticTokens(value) {
88
+ const result = new Set();
89
+ for (const raw of value.match(/[\p{L}\p{N}][\p{L}\p{N}_-]*/gu) ?? []) {
90
+ const token = canonicalToken(raw);
91
+ if (token.length >= 3 && !SEMANTIC_STOP_WORDS.has(token))
92
+ result.add(token);
93
+ if (/\p{Script=Han}/u.test(raw)) {
94
+ const characters = Array.from(raw);
95
+ for (let index = 0; index < characters.length - 1; index += 1) {
96
+ result.add(`${characters[index]}${characters[index + 1]}`);
97
+ }
98
+ }
99
+ }
100
+ return result;
101
+ }
102
+ const ACTION_NEGATION_PATTERN = /\b(?:do\s+not|don't|must\s+not|should\s+not|cannot|can't|never|not\b(?!\s+only\b)|without)\b|不要|禁止|不得|不允许|尚未|不(?:发布|上线|创建|提交|打开|合并|部署|删除|推送|上传)|未(?:发布|上线|创建|提交|打开|合并|部署|删除|推送|上传)/iu;
103
+ // A contrast or a strong sentence boundary ends the scope of an earlier
104
+ // negation. Ordinary conjunctions deliberately do not: "do not publish and
105
+ // merge" negates both actions, while "do not merge, but publish" resets at
106
+ // "but" and preserves the positive publish action.
107
+ const NEGATION_SCOPE_RESET_PATTERN = /[.;;。\n]+|\b(?:but|however|yet|then)\b|(?:但是|但|不过|然而|然后)/giu;
108
+ function negationScopeStart(value, actionIndex) {
109
+ const matcher = new RegExp(NEGATION_SCOPE_RESET_PATTERN.source, NEGATION_SCOPE_RESET_PATTERN.flags);
110
+ let start = 0;
111
+ let match;
112
+ while ((match = matcher.exec(value)) && match.index < actionIndex) {
113
+ start = matcher.lastIndex;
114
+ }
115
+ return start;
116
+ }
117
+ /** Return true when at least one pattern match is outside a local negation scope. */
118
+ function hasUnnegatedActionMatch(value, pattern) {
119
+ const flags = `${pattern.flags.replace(/[gy]/gu, '')}g`;
120
+ const matcher = new RegExp(pattern.source, flags);
121
+ let match;
122
+ while ((match = matcher.exec(value))) {
123
+ const scope = value.slice(negationScopeStart(value, match.index), matcher.lastIndex);
124
+ if (!ACTION_NEGATION_PATTERN.test(scope))
125
+ return true;
126
+ if (match[0].length === 0)
127
+ matcher.lastIndex += 1;
128
+ }
129
+ return false;
130
+ }
131
+ function criterionCompletionActions(value) {
132
+ return evidence_1.EXTERNAL_COMPLETION_ACTION_RULES.filter(rule => hasUnnegatedActionMatch(value, rule.criterionPattern)).map(rule => rule.action);
133
+ }
134
+ function completedEvidenceActions(evidence, allowConfirmedAction) {
135
+ if (evidence.externalAssertion?.status === 'passed') {
136
+ return [evidence.externalAssertion.action];
137
+ }
138
+ const evidenceText = `${evidence.subject} ${evidence.sourceRef}`;
139
+ return evidence_1.EXTERNAL_COMPLETION_ACTION_RULES.filter(rule => hasUnnegatedActionMatch(evidenceText, allowConfirmedAction ? rule.criterionPattern : rule.completedEvidencePattern)).map(rule => rule.action);
140
+ }
141
+ function normalizeVersion(value) {
142
+ return value.toLowerCase().replace(/^v/u, '');
143
+ }
144
+ function exactRequiredVersion(statement) {
145
+ const packageVersion = statement.match(/(?:^|[\s("'`])(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+@(v?\d+\.\d+\.\d+(?:[-+][0-9a-z.-]+)?)/iu)?.[1];
146
+ if (packageVersion)
147
+ return normalizeVersion(packageVersion);
148
+ const versions = statement.match(/\bv?\d+\.\d+\.\d+(?:[-+][0-9a-z.-]+)?\b/giu) ?? [];
149
+ return versions.length > 0 ? normalizeVersion(versions[versions.length - 1]) : undefined;
150
+ }
151
+ function exactRequiredVersions(statement) {
152
+ return [
153
+ ...new Set((statement.match(/\bv?\d+\.\d+\.\d+(?:[-+][0-9a-z.-]+)?\b/giu) ?? []).map(normalizeVersion)),
154
+ ];
155
+ }
156
+ function exactRequiredPackages(statement) {
157
+ const packages = new Set();
158
+ for (const match of statement.matchAll(/@[a-z0-9._-]+\/[a-z0-9._-]+/giu)) {
159
+ packages.add(match[0].toLowerCase());
160
+ }
161
+ for (const match of statement.matchAll(/(?:^|[\s("'`])((?:@[a-z0-9._-]+\/)?[a-z0-9._-]+)@v?\d+\.\d+\.\d+(?:[-+][0-9a-z.-]+)?/giu)) {
162
+ packages.add(match[1].toLowerCase());
163
+ }
164
+ // A release criterion commonly names unversioned packages as a conjunction,
165
+ // for example "Publish orion-code and orion-sdk to npm". Those names do not
166
+ // carry the scoped-package or @version signals above, but they are still
167
+ // exact targets and must not be collapsed into one generic npm action.
168
+ for (const match of statement.matchAll(/\b(?:publish|release)(?:es|ed|d|ing)?\s+(.+?)\s+(?:to|on)\s+(?:the\s+)?npm\b/giu)) {
169
+ const clause = match[1].replace(/\b(?:both|the)\b/giu, ' ').replace(/\bpackages?\b/giu, ' ');
170
+ for (const rawCandidate of clause.split(/\s*(?:,|\band\b|&)\s*/iu)) {
171
+ const candidate = rawCandidate.trim().replace(/^[`'"]+|[`'".]+$/gu, '');
172
+ const packageMatch = candidate.match(/^((?:@[a-z0-9._-]+\/)?[a-z0-9][a-z0-9._-]*)(?:@v?\d+\.\d+\.\d+(?:[-+][0-9a-z.-]+)?)?$/iu);
173
+ if (packageMatch)
174
+ packages.add(packageMatch[1].toLowerCase());
175
+ }
176
+ }
177
+ return [...packages];
178
+ }
179
+ function exactRequiredNpmTargets(statement) {
180
+ const targets = new Map();
181
+ for (const match of statement.matchAll(/(?:^|[\s("'`])((?:@[a-z0-9._-]+\/)?[a-z0-9._-]+)@(v?\d+\.\d+\.\d+(?:[-+][0-9a-z.-]+)?)/giu)) {
182
+ const packageName = match[1].toLowerCase();
183
+ targets.set(packageName, { packageName, version: normalizeVersion(match[2]) });
184
+ }
185
+ const sharedVersion = exactRequiredVersion(statement);
186
+ for (const packageName of exactRequiredPackages(statement)) {
187
+ if (!targets.has(packageName)) {
188
+ targets.set(packageName, { packageName, version: sharedVersion });
189
+ }
190
+ }
191
+ return [...targets.values()];
192
+ }
193
+ function formatRequiredNpmTarget(target) {
194
+ return target.version ? `${target.packageName}@${target.version}` : target.packageName;
195
+ }
196
+ function exactRequiredGithubPullRequests(statement) {
197
+ const targets = new Map();
198
+ const sharedRepository = exactRequiredGithubRepository(statement);
199
+ const targetToken = String.raw `(?:[a-z0-9_.-]+\/[a-z0-9_.-]+)?#?\d+`;
200
+ const targetList = String.raw `${targetToken}(?:\s*(?:,\s*(?:and\s+)?|and\s+|&\s*)${targetToken})*`;
201
+ const pullRequestPattern = /\b(?:prs?|pull[\s_-]?requests?)\b/giu;
202
+ for (const pullRequestMatch of statement.matchAll(pullRequestPattern)) {
203
+ const matchIndex = pullRequestMatch.index ?? 0;
204
+ const before = statement.slice(0, matchIndex);
205
+ const after = statement.slice(matchIndex + pullRequestMatch[0].length);
206
+ const adjacentLists = [
207
+ after.match(new RegExp(`^\\s*(${targetList})`, 'iu'))?.[1],
208
+ before.match(new RegExp(`(${targetList})\\s*$`, 'iu'))?.[1],
209
+ ];
210
+ for (const list of adjacentLists) {
211
+ if (!list)
212
+ continue;
213
+ for (const match of list.matchAll(/(?:([a-z0-9_.-]+\/[a-z0-9_.-]+))?#?(\d+)\b/giu)) {
214
+ const repository = match[1]?.toLowerCase() ?? sharedRepository;
215
+ const prNumber = Number(match[2]);
216
+ targets.set(`${repository ?? '*'}#${prNumber}`, { repository, prNumber });
217
+ }
218
+ }
219
+ }
220
+ return [...targets.values()];
221
+ }
222
+ function exactRequiredGithubReleaseRepositories(statement) {
223
+ const repositories = new Set();
224
+ const statementWithoutGithubUrls = statement.replace(/(?:https?:\/\/)?github\.com\/([a-z0-9_.-]+\/[a-z0-9_.-]+)/giu, (_url, repository) => {
225
+ repositories.add(repository.toLowerCase());
226
+ return ' ';
227
+ });
228
+ for (const match of statementWithoutGithubUrls.matchAll(/\b([a-z0-9_.-]+\/[a-z0-9_.-]+)\b/giu)) {
229
+ repositories.add(match[1].toLowerCase());
230
+ }
231
+ return [...repositories];
232
+ }
233
+ function exactRequiredGithubRepository(statement) {
234
+ return (statement.match(/github\.com\/([a-z0-9_.-]+\/[a-z0-9_.-]+)/iu)?.[1] ??
235
+ statement.match(/\b(?:repo(?:sitory)?|github)\s+[`'"]?([a-z0-9_.-]+\/[a-z0-9_.-]+)/iu)?.[1] ??
236
+ statement.match(/\b([a-z0-9_.-]+\/[a-z0-9_.-]+)#\d+\b/iu)?.[1])?.toLowerCase();
237
+ }
238
+ function exactRequiredBranch(statement) {
239
+ return (statement.match(/\bbranch\s+[`'"]?([a-z0-9._\/-]+)/iu)?.[1] ??
240
+ statement.match(/\bpush(?:ed|ing)?\s+(?:the\s+)?[`'"]?([a-z0-9._\/-]+)\s+branch\b/iu)?.[1]);
241
+ }
242
+ function exactRequiredRemote(statement) {
243
+ return (statement.match(/\bremote\s+[`'"]?([a-z0-9._\/-]+)/iu)?.[1] ??
244
+ statement.match(/\bpush(?:ed|ing)?\s+to\s+[`'"]?([a-z0-9._\/-]+)/iu)?.[1]);
245
+ }
246
+ function externalAssertionMatchesCriterion(assertion, statement) {
247
+ if (assertion.status !== 'passed' || !assertion.details)
248
+ return false;
249
+ const statementLower = statement.toLowerCase();
250
+ if (assertion.details.kind === 'npm') {
251
+ const npmDetails = assertion.details;
252
+ if (assertion.provider !== 'npm')
253
+ return false;
254
+ if (assertion.action === 'publish' && npmDetails.field !== 'publish')
255
+ return false;
256
+ if (assertion.action === 'registry' && npmDetails.field === 'publish')
257
+ return false;
258
+ const requiredTargets = exactRequiredNpmTargets(statement);
259
+ if (requiredTargets.length > 0 &&
260
+ !requiredTargets.some(target => npmDetails.packageName.toLowerCase() === target.packageName &&
261
+ (!target.version || normalizeVersion(npmDetails.version ?? '') === target.version))) {
262
+ return false;
263
+ }
264
+ return true;
265
+ }
266
+ if (assertion.details.kind === 'github_pr') {
267
+ if (assertion.provider !== 'github')
268
+ return false;
269
+ if (assertion.action === 'merge' && assertion.details.state !== 'MERGED')
270
+ return false;
271
+ if (assertion.action === 'pull_request' && assertion.details.state !== 'OPEN')
272
+ return false;
273
+ const prDetails = assertion.details;
274
+ const requiredPullRequests = exactRequiredGithubPullRequests(statement);
275
+ if (requiredPullRequests.length > 0 &&
276
+ !requiredPullRequests.some(target => target.prNumber === prDetails.prNumber &&
277
+ (!target.repository || prDetails.repository?.toLowerCase() === target.repository))) {
278
+ return false;
279
+ }
280
+ return !/\bnpm\b/iu.test(statement);
281
+ }
282
+ if (assertion.details.kind === 'github_release') {
283
+ if (assertion.provider !== 'github' ||
284
+ assertion.action !== 'publish' ||
285
+ assertion.details.isDraft !== false ||
286
+ !assertion.details.publishedAt) {
287
+ return false;
288
+ }
289
+ if (/\bnpm\b/iu.test(statement))
290
+ return false;
291
+ const requiredRepositories = exactRequiredGithubReleaseRepositories(statement);
292
+ const requiredVersions = exactRequiredVersions(statement);
293
+ // Pairing several repositories with several tags is ambiguous without an
294
+ // explicit structured contract. Fail closed and require separate atomic
295
+ // criteria instead of accepting a cross-paired set of assertions.
296
+ if (requiredRepositories.length > 1 && requiredVersions.length > 1)
297
+ return false;
298
+ if (requiredRepositories.length > 0 &&
299
+ !requiredRepositories.includes(assertion.details.repository?.toLowerCase() ?? '')) {
300
+ return false;
301
+ }
302
+ if (requiredVersions.length > 0 &&
303
+ !requiredVersions.includes(normalizeVersion(assertion.details.tagName ?? ''))) {
304
+ return false;
305
+ }
306
+ return true;
307
+ }
308
+ if (assertion.details.kind === 'git_push') {
309
+ if (assertion.provider !== 'git' || assertion.action !== 'push')
310
+ return false;
311
+ const requiredBranch = exactRequiredBranch(statement);
312
+ if (requiredBranch && assertion.details.branch !== requiredBranch)
313
+ return false;
314
+ const requiredRemote = exactRequiredRemote(statement);
315
+ if (requiredRemote && assertion.details.remote !== requiredRemote)
316
+ return false;
317
+ return !statementLower.includes('npm');
318
+ }
319
+ return false;
320
+ }
321
+ function criterionRequiresExternalCompletionEvidence(statement) {
322
+ return criterionCompletionActions(statement).length > 0;
323
+ }
324
+ function completionActionLabel(action) {
325
+ return evidence_1.EXTERNAL_COMPLETION_ACTION_RULES.find(rule => rule.action === action)?.label ?? action;
326
+ }
327
+ function evidenceMatchesCriterion(evidence, criterion, allCriteria) {
328
+ const requiredActions = criterionCompletionActions(criterion.statement);
329
+ const requiresExternalCompletion = requiredActions.length > 0;
330
+ const allowedKind = requiresExternalCompletion
331
+ ? evidence.kind === 'external' || evidence.kind === 'user'
332
+ : criterion.requiredEvidenceKinds.includes(evidence.kind);
333
+ if (!allowedKind) {
334
+ return { matched: false, reason: 'kind_mismatch', sharedTokens: [], coveredActions: [] };
335
+ }
336
+ if (!evidence.sourceRef.trim() || !evidence.subject.trim()) {
337
+ return { matched: false, reason: 'missing_metadata', sharedTokens: [], coveredActions: [] };
338
+ }
339
+ if (evidence.kind === 'user') {
340
+ const matched = evidence.sourceRef === 'user:/target-confirm' && evidence.subject.includes(criterion.id);
341
+ const coveredActions = completedEvidenceActions(evidence, true).filter(action => requiredActions.includes(action));
342
+ const coversRequiredAction = requiredActions.length === 0 || coveredActions.length > 0;
343
+ return {
344
+ matched: matched && coversRequiredAction,
345
+ reason: matched && !coversRequiredAction
346
+ ? 'missing_completion_action'
347
+ : matched
348
+ ? 'matched_criterion_id'
349
+ : 'user_confirmation_mismatch',
350
+ sharedTokens: [],
351
+ coveredActions,
352
+ };
353
+ }
354
+ if (requiresExternalCompletion &&
355
+ evidence.kind === 'external' &&
356
+ evidence.sourceRef.startsWith('tool:') &&
357
+ !evidence.externalAssertion) {
358
+ return {
359
+ matched: false,
360
+ reason: 'untrusted_completion_source',
361
+ sharedTokens: [],
362
+ coveredActions: [],
363
+ };
364
+ }
365
+ if (requiresExternalCompletion &&
366
+ evidence.externalAssertion &&
367
+ !externalAssertionMatchesCriterion(evidence.externalAssertion, criterion.statement)) {
368
+ return {
369
+ matched: false,
370
+ reason: 'external_assertion_mismatch',
371
+ sharedTokens: [],
372
+ coveredActions: [],
373
+ };
374
+ }
375
+ const coveredActions = completedEvidenceActions(evidence, false).filter(action => requiredActions.includes(action));
376
+ if (requiresExternalCompletion && coveredActions.length === 0) {
377
+ return {
378
+ matched: false,
379
+ reason: 'missing_completion_action',
380
+ sharedTokens: [],
381
+ coveredActions: [],
382
+ };
383
+ }
384
+ if (evidence.subject.toLowerCase().includes(criterion.id.toLowerCase()) ||
385
+ evidence.sourceRef.toLowerCase().includes(criterion.id.toLowerCase())) {
386
+ return { matched: true, reason: 'matched_criterion_id', sharedTokens: [], coveredActions };
387
+ }
388
+ const criterionTokens = semanticTokens(criterion.statement);
389
+ if (criterionTokens.size === 0) {
390
+ return { matched: false, reason: 'no_semantic_overlap', sharedTokens: [], coveredActions };
391
+ }
392
+ const evidenceTokens = semanticTokens(evidence.subject);
393
+ const sharedTokens = [...criterionTokens].filter(token => evidenceTokens.has(token));
394
+ if (sharedTokens.length === 0) {
395
+ return { matched: false, reason: 'no_semantic_overlap', sharedTokens: [], coveredActions };
396
+ }
397
+ // Terms repeated across criteria identify the overall goal topic, not the
398
+ // individual requirement. For example, "package smoke" cannot distinguish
399
+ // a registry-entry check from a binary-start check. At least one overlapping
400
+ // term must be unique to this criterion within the current contract.
401
+ const otherCriterionTokens = new Set(allCriteria
402
+ .filter(item => item.id !== criterion.id)
403
+ .flatMap(item => [...semanticTokens(item.statement)]));
404
+ const discriminativeTokens = sharedTokens.filter(token => !otherCriterionTokens.has(token));
405
+ if (discriminativeTokens.length > 0) {
406
+ return {
407
+ matched: true,
408
+ reason: 'matched_discriminative_token',
409
+ sharedTokens: discriminativeTokens,
410
+ coveredActions,
411
+ };
412
+ }
413
+ return { matched: false, reason: 'ambiguous_shared_tokens', sharedTokens, coveredActions };
414
+ }
415
+ function evidenceIsFresh(evidence, input, now, requireExternalExpiry = false) {
416
+ if (evidence.goalId !== input.goalId)
417
+ return false;
418
+ if (evidence.goalRevision > input.goalRevision)
419
+ return false;
420
+ if (evidence.objectiveRevision !== input.contract.objectiveRevision)
421
+ return false;
422
+ if (evidence.capturedAt > now)
423
+ return false;
424
+ if (requireExternalExpiry &&
425
+ evidence.kind === 'external' &&
426
+ evidence.expiresAt === undefined &&
427
+ // Legacy registry adapters emit a typed registry source instead of an
428
+ // explicit expiry. Keep those records only when they were captured for
429
+ // this completion request; generic external/tool claims remain fail-closed.
430
+ !(evidence.sourceRef.startsWith('registry:') && evidence.capturedAt >= input.requestedAt))
431
+ return false;
432
+ if (evidence.expiresAt !== undefined && evidence.expiresAt <= now)
433
+ return false;
434
+ if (evidence.externalAssertion) {
435
+ const observedAt = evidence.externalAssertion.observedAt;
436
+ // Bind freshness to the time of the external observation, not merely to
437
+ // when a ledger record was created. This prevents a stale assertion from
438
+ // being copied into a fresh-looking evidence envelope.
439
+ if (observedAt > evidence.capturedAt || observedAt > now)
440
+ return false;
441
+ if (requireExternalExpiry && now - observedAt >= 5 * 60000)
442
+ return false;
443
+ }
444
+ if (WORKSPACE_BOUND_EVIDENCE.has(evidence.kind)) {
445
+ if (!input.workspaceFingerprint || !evidence.workspaceFingerprint)
446
+ return false;
447
+ if (evidence.workspaceFingerprint !== input.workspaceFingerprint)
448
+ return false;
449
+ }
450
+ if (input.workspaceFingerprint &&
451
+ evidence.workspaceFingerprint &&
452
+ evidence.workspaceFingerprint !== input.workspaceFingerprint)
453
+ return false;
454
+ return true;
455
+ }
13
456
  function auditCompletion(input) {
14
- const now = Date.now();
15
- const passed = input.evidenceRefs.length > 0 && input.verificationSummary.length > 0;
457
+ const now = input.now ?? Date.now();
458
+ const evidenceById = new Map(input.evidenceLedger.map(record => [record.id, record]));
459
+ const criterionResults = input.contract.successCriteria.map(criterion => {
460
+ const records = criterion.evidenceRefs
461
+ .map(ref => evidenceById.get(ref))
462
+ .filter((record) => Boolean(record));
463
+ const mappedMatches = records.map(record => ({
464
+ record,
465
+ match: evidenceMatchesCriterion(record, criterion, input.contract.successCriteria),
466
+ }));
467
+ const mappedRelevant = mappedMatches.filter(item => item.match.matched);
468
+ const requiredActions = criterionCompletionActions(criterion.statement);
469
+ const requireExternalExpiry = requiredActions.length > 0;
470
+ const relevantMatches = mappedRelevant.filter(item => item.record.result === 'passed' &&
471
+ evidenceIsFresh(item.record, input, now, requireExternalExpiry));
472
+ const relevant = relevantMatches.map(item => item.record);
473
+ const hasTrustedUserConfirmation = relevant.some(record => record.kind === 'user');
474
+ // Audit the whole ledger, not only model-selected refs. Otherwise a model
475
+ // can omit a relevant failed record and cherry-pick a passing record.
476
+ const failedRecords = input.evidenceLedger.filter(record => record.result === 'failed' &&
477
+ evidenceMatchesCriterion(record, criterion, input.contract.successCriteria).matched &&
478
+ evidenceIsFresh(record, input, now, requireExternalExpiry));
479
+ const failed = failedRecords.length > 0;
480
+ const coveredActions = new Set(relevantMatches.flatMap(item => item.match.coveredActions));
481
+ const missingActions = requiredActions.filter(action => !coveredActions.has(action));
482
+ const requiredNpmTargets = exactRequiredNpmTargets(criterion.statement);
483
+ const npmAssertions = relevantMatches
484
+ .map(item => item.record.externalAssertion)
485
+ .filter((assertion) => assertion?.details?.kind === 'npm');
486
+ // A structured npm assertion proves exactly one package target. When a
487
+ // criterion names several packages, require a fresh matching assertion
488
+ // for every target instead of letting any one package close the whole
489
+ // conjunction.
490
+ const missingNpmTargets = !hasTrustedUserConfirmation &&
491
+ requiredNpmTargets.length > 0 &&
492
+ (npmAssertions.length > 0 || requiredNpmTargets.length > 1)
493
+ ? requiredNpmTargets.filter(target => !npmAssertions.some(assertion => assertion.details.packageName.toLowerCase() === target.packageName &&
494
+ (!target.version ||
495
+ normalizeVersion(assertion.details.version ?? '') === target.version)))
496
+ : [];
497
+ const requiredPullRequests = exactRequiredGithubPullRequests(criterion.statement);
498
+ const pullRequestAssertions = relevantMatches
499
+ .map(item => item.record.externalAssertion)
500
+ .filter((assertion) => assertion?.details?.kind === 'github_pr');
501
+ const missingPullRequests = !hasTrustedUserConfirmation &&
502
+ requiredPullRequests.length > 0 &&
503
+ (pullRequestAssertions.length > 0 || requiredPullRequests.length > 1)
504
+ ? requiredPullRequests.filter(target => !pullRequestAssertions.some(assertion => assertion.details.prNumber === target.prNumber &&
505
+ (!target.repository ||
506
+ assertion.details.repository?.toLowerCase() === target.repository)))
507
+ : [];
508
+ const requiresGithubReleaseTargets = requiredActions.includes('publish') &&
509
+ requiredNpmTargets.length === 0 &&
510
+ !/\bnpm\b/iu.test(criterion.statement);
511
+ const requiredReleaseRepositories = requiresGithubReleaseTargets
512
+ ? exactRequiredGithubReleaseRepositories(criterion.statement)
513
+ : [];
514
+ const releaseAssertions = relevantMatches
515
+ .map(item => item.record.externalAssertion)
516
+ .filter((assertion) => assertion?.details?.kind === 'github_release');
517
+ const missingReleaseRepositories = !hasTrustedUserConfirmation &&
518
+ requiredReleaseRepositories.length > 0 &&
519
+ (releaseAssertions.length > 0 || requiredReleaseRepositories.length > 1)
520
+ ? requiredReleaseRepositories.filter(repository => !releaseAssertions.some(assertion => assertion.details.repository?.toLowerCase() === repository))
521
+ : [];
522
+ const requiredReleaseVersions = requiresGithubReleaseTargets
523
+ ? exactRequiredVersions(criterion.statement)
524
+ : [];
525
+ const missingReleaseVersions = !hasTrustedUserConfirmation &&
526
+ requiredReleaseVersions.length > 0 &&
527
+ (releaseAssertions.length > 0 || requiredReleaseVersions.length > 1)
528
+ ? requiredReleaseVersions.filter(version => !releaseAssertions.some(assertion => normalizeVersion(assertion.details.tagName ?? '') === version))
529
+ : [];
530
+ const missingExternalTargets = [
531
+ ...missingNpmTargets.map(formatRequiredNpmTarget),
532
+ ...missingPullRequests.map(target => `${target.repository ?? 'requested repository'}#${target.prNumber}`),
533
+ ...missingReleaseRepositories.map(repository => `GitHub release ${repository}`),
534
+ ...missingReleaseVersions.map(version => `GitHub release tag ${version}`),
535
+ ];
536
+ const passed = relevant.length > 0 &&
537
+ missingActions.length === 0 &&
538
+ missingExternalTargets.length === 0 &&
539
+ !failed;
540
+ const stale = mappedRelevant.some(item => !evidenceIsFresh(item.record, input, now, requireExternalExpiry));
541
+ const irrelevant = records.length > 0 && mappedRelevant.length === 0;
542
+ const ambiguousTokens = [
543
+ ...new Set(mappedMatches
544
+ .filter(item => item.match.reason === 'ambiguous_shared_tokens')
545
+ .flatMap(item => item.match.sharedTokens)),
546
+ ];
547
+ const status = passed
548
+ ? 'passed'
549
+ : failed
550
+ ? 'failed'
551
+ : stale
552
+ ? 'stale'
553
+ : 'pending';
554
+ let reason;
555
+ if (!passed) {
556
+ reason =
557
+ status === 'failed'
558
+ ? `[${criterion.id}] ${criterion.statement}: relevant verification failed (${failedRecords
559
+ .slice(0, 3)
560
+ .map(record => record.id)
561
+ .join(', ')}). Rerun the criterion-specific verification after fixing the failure.`
562
+ : status === 'stale'
563
+ ? `[${criterion.id}] ${criterion.statement}: referenced evidence is stale or lacks the required workspace fingerprint. Rerun a criterion-specific ${criterion.requiredEvidenceKinds.join('/')} check.`
564
+ : missingExternalTargets.length > 0
565
+ ? `[${criterion.id}] ${criterion.statement}: fresh external evidence is missing for required target(s): ${missingExternalTargets.join(', ')}.`
566
+ : missingActions.length > 0
567
+ ? `[${criterion.id}] ${criterion.statement}: completion requires fresh external or user evidence covering the completed action/status (${missingActions.map(completionActionLabel).join(', ')}). Local runtime, build, file, or version output cannot prove this external state.`
568
+ : irrelevant && ambiguousTokens.length > 0
569
+ ? `[${criterion.id}] ${criterion.statement}: mapped evidence overlaps only on terms shared by multiple criteria (${ambiguousTokens.slice(0, 4).join(', ')}). Include a criterion-specific term or the exact criterion id in the evidence subject.`
570
+ : irrelevant
571
+ ? `[${criterion.id}] ${criterion.statement}: mapped evidence is not semantically related to this criterion. Run a specifically named ${criterion.requiredEvidenceKinds.join('/')} check.`
572
+ : `[${criterion.id}] ${criterion.statement}: fresh relevant evidence is required. Run a criterion-specific ${criterion.requiredEvidenceKinds.join('/')} check.`;
573
+ }
574
+ return {
575
+ criterionId: criterion.id,
576
+ passed,
577
+ status,
578
+ evidenceRefs: relevant.map(record => record.id),
579
+ reason,
580
+ };
581
+ });
582
+ const remainingRequirements = criterionResults
583
+ .filter(result => !result.passed)
584
+ .map(result => result.reason ?? `Criterion ${result.criterionId} is not verified.`);
585
+ const truncationRequirement = evidenceLedgerTruncationRequirement(input.evidenceLedgerTruncation, input.contract.objectiveRevision);
586
+ if (truncationRequirement)
587
+ remainingRequirements.push(truncationRequirement);
588
+ const passed = criterionResults.length > 0 && remainingRequirements.length === 0;
16
589
  return {
17
- requestedAt: now,
590
+ requestedAt: input.requestedAt,
18
591
  auditedAt: now,
19
592
  passed,
20
- verificationSummary: input.verificationSummary || 'No verification evidence provided.',
21
- remainingRequirements: passed ? [] : ['Verification evidence required before completion.'],
22
- evidenceRefs: input.evidenceRefs,
593
+ verificationSummary: input.verificationSummary.trim() ||
594
+ (passed ? 'All success criteria have fresh runtime evidence.' : 'Completion audit failed.'),
595
+ remainingRequirements,
596
+ evidenceRefs: [...new Set(criterionResults.flatMap(result => result.evidenceRefs))],
597
+ criterionResults,
23
598
  };
24
599
  }
25
600
  function auditBlocked(input) {
601
+ if (!['user_input', 'permission', 'external_state'].includes(input.blocker.category)) {
602
+ return { allowed: false, reason: 'Blocker category is not eligible for terminal blocked.' };
603
+ }
604
+ if (input.blocker.retryable !== false) {
605
+ return { allowed: false, reason: 'Retryable blockers cannot become terminal blocked.' };
606
+ }
26
607
  if (input.blocker.consecutiveTurns < 3) {
27
608
  return {
28
609
  allowed: false,
@@ -35,14 +616,15 @@ function auditBlocked(input) {
35
616
  reason: 'Progress was made in recent turns; blocking not justified.',
36
617
  };
37
618
  }
38
- return { allowed: true, reason: `Blocker persisted for ${input.blocker.consecutiveTurns} consecutive turns with no progress.` };
619
+ return {
620
+ allowed: true,
621
+ reason: `Blocker persisted for ${input.blocker.consecutiveTurns} consecutive turns with no progress.`,
622
+ };
39
623
  }
40
624
  function blockerFingerprint(category, resource, reason) {
41
625
  return `${category}:${resource}:${reason}`;
42
626
  }
43
627
  function blockersMatch(a, fingerprint) {
44
- if (!a)
45
- return false;
46
- return a.fingerprint === fingerprint;
628
+ return Boolean(a && a.fingerprint === fingerprint);
47
629
  }
48
630
  //# sourceMappingURL=completion-audit.js.map