@andorra-labs/code 0.1.12 → 0.1.13

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 (592) hide show
  1. package/dist/src/account-presentation.d.ts +1 -37
  2. package/dist/src/account-presentation.js +2 -42
  3. package/dist/src/activity.d.ts +0 -25
  4. package/dist/src/activity.js +1 -23
  5. package/dist/src/agent-definitions.d.ts +0 -26
  6. package/dist/src/agent-definitions.js +0 -43
  7. package/dist/src/agent-execution.d.ts +0 -2
  8. package/dist/src/agent-execution.js +49 -416
  9. package/dist/src/agent-mcp-catalog.d.ts +0 -8
  10. package/dist/src/agent-mcp-catalog.js +0 -2
  11. package/dist/src/agent-mcp.d.ts +0 -56
  12. package/dist/src/agent-mcp.js +9 -153
  13. package/dist/src/agent-modifiers.d.ts +0 -1
  14. package/dist/src/agent-modifiers.js +25 -68
  15. package/dist/src/analytics.d.ts +0 -66
  16. package/dist/src/analytics.js +0 -45
  17. package/dist/src/anthropic-console-auth.d.ts +0 -24
  18. package/dist/src/anthropic-console-auth.js +0 -37
  19. package/dist/src/anthropic-credentials.d.ts +0 -25
  20. package/dist/src/anthropic-credentials.js +0 -28
  21. package/dist/src/app-server/protocol.d.ts +13 -245
  22. package/dist/src/app-server/protocol.js +1 -132
  23. package/dist/src/app-server/reasoning.d.ts +0 -31
  24. package/dist/src/app-server/reasoning.js +0 -54
  25. package/dist/src/app-server/terminal.d.ts +0 -36
  26. package/dist/src/app-server/terminal.js +3 -39
  27. package/dist/src/app-server/workspace.d.ts +0 -167
  28. package/dist/src/app-server/workspace.js +4 -406
  29. package/dist/src/app-server.d.ts +27 -927
  30. package/dist/src/app-server.js +537 -2992
  31. package/dist/src/artifacts.d.ts +0 -10
  32. package/dist/src/artifacts.js +1 -11
  33. package/dist/src/attachments.d.ts +4 -98
  34. package/dist/src/attachments.js +10 -130
  35. package/dist/src/auth/AuthManager.d.ts +0 -93
  36. package/dist/src/auth/AuthManager.js +3 -165
  37. package/dist/src/auth/callback-page.d.ts +0 -1
  38. package/dist/src/auth/callback-page.js +0 -4
  39. package/dist/src/auth/callback.d.ts +0 -25
  40. package/dist/src/auth/callback.js +1 -29
  41. package/dist/src/auth/deployment.d.ts +0 -16
  42. package/dist/src/auth/deployment.js +0 -16
  43. package/dist/src/auth/index.d.ts +0 -11
  44. package/dist/src/auth/index.js +0 -11
  45. package/dist/src/auth/lock.d.ts +0 -1
  46. package/dist/src/auth/lock.js +0 -1
  47. package/dist/src/auth/store.d.ts +7 -108
  48. package/dist/src/auth/store.js +21 -129
  49. package/dist/src/auth/types.d.ts +0 -8
  50. package/dist/src/auth-commands.d.ts +0 -5
  51. package/dist/src/auth-commands.js +0 -1
  52. package/dist/src/automation-runner.d.ts +0 -9
  53. package/dist/src/automation-runner.js +0 -11
  54. package/dist/src/automation-service.d.ts +0 -10
  55. package/dist/src/automation-service.js +3 -17
  56. package/dist/src/automation-tool.js +0 -5
  57. package/dist/src/automation-worker-shutdown.d.ts +0 -1
  58. package/dist/src/automation-worker-shutdown.js +0 -3
  59. package/dist/src/automations.d.ts +23 -2
  60. package/dist/src/automations.js +91 -12
  61. package/dist/src/background-tasks.d.ts +0 -23
  62. package/dist/src/background-tasks.js +0 -11
  63. package/dist/src/boot-trace.d.ts +0 -13
  64. package/dist/src/boot-trace.js +1 -14
  65. package/dist/src/browser-activity.js +0 -2
  66. package/dist/src/browser-bridge.d.ts +0 -2
  67. package/dist/src/browser-bridge.js +0 -27
  68. package/dist/src/browser-captcha-tool.d.ts +0 -13
  69. package/dist/src/browser-captcha-tool.js +3 -35
  70. package/dist/src/browser-extensions-tool.d.ts +24 -0
  71. package/dist/src/browser-extensions-tool.js +137 -0
  72. package/dist/src/browser-extensions.d.ts +127 -0
  73. package/dist/src/browser-extensions.js +729 -0
  74. package/dist/src/browser-observation.d.ts +0 -15
  75. package/dist/src/browser-observation.js +1 -22
  76. package/dist/src/browser-panel-tool.d.ts +1 -37
  77. package/dist/src/browser-panel-tool.js +3 -73
  78. package/dist/src/browser-runner.d.ts +0 -1
  79. package/dist/src/browser-runner.js +4 -45
  80. package/dist/src/browser-server.d.ts +0 -6
  81. package/dist/src/browser-server.js +6 -229
  82. package/dist/src/browser-session.d.ts +0 -25
  83. package/dist/src/browser-session.js +1 -71
  84. package/dist/src/browser-stealth.d.ts +0 -12
  85. package/dist/src/browser-stealth.js +0 -36
  86. package/dist/src/browser-ui/app.js +7 -174
  87. package/dist/src/browser-ui/style.css +0 -68
  88. package/dist/src/browser-ui/tokens.css +11 -93
  89. package/dist/src/browser-view.d.ts +47 -301
  90. package/dist/src/browser-view.js +333 -582
  91. package/dist/src/capabilities.d.ts +0 -8
  92. package/dist/src/capabilities.js +0 -29
  93. package/dist/src/capsolver.d.ts +0 -13
  94. package/dist/src/capsolver.js +0 -15
  95. package/dist/src/clarification-ui.d.ts +0 -7
  96. package/dist/src/clarification-ui.js +0 -8
  97. package/dist/src/claude-executable.d.ts +0 -1
  98. package/dist/src/claude-executable.js +1 -2
  99. package/dist/src/claude-provider.d.ts +6 -19
  100. package/dist/src/claude-provider.js +155 -63
  101. package/dist/src/cli-executable.d.ts +0 -16
  102. package/dist/src/cli-executable.js +0 -7
  103. package/dist/src/cli-process.d.ts +0 -26
  104. package/dist/src/cli-process.js +0 -18
  105. package/dist/src/cli-sign-in.d.ts +0 -20
  106. package/dist/src/cli-sign-in.js +1 -17
  107. package/dist/src/cli.d.ts +1 -55
  108. package/dist/src/cli.js +80 -721
  109. package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
  110. package/dist/src/code-intelligence/CodeIntelligenceManager.js +26 -99
  111. package/dist/src/code-intelligence/ContextLedger.d.ts +0 -4
  112. package/dist/src/code-intelligence/ContextLedger.js +0 -10
  113. package/dist/src/code-intelligence/ContextRouter.d.ts +0 -6
  114. package/dist/src/code-intelligence/ContextRouter.js +0 -8
  115. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +0 -2
  116. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +5 -12
  117. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +0 -6
  118. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +0 -6
  119. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +0 -5
  120. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +1 -17
  121. package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +0 -5
  122. package/dist/src/code-intelligence/codegraph/repoExploreTool.js +0 -5
  123. package/dist/src/code-intelligence/repository.d.ts +0 -9
  124. package/dist/src/code-intelligence/repository.js +1 -11
  125. package/dist/src/code-intelligence/types.d.ts +0 -8
  126. package/dist/src/codex-auth.d.ts +0 -44
  127. package/dist/src/codex-auth.js +0 -45
  128. package/dist/src/codex-browser-auth.d.ts +0 -13
  129. package/dist/src/codex-browser-auth.js +3 -20
  130. package/dist/src/codex-errors.js +0 -2
  131. package/dist/src/codex-executable.d.ts +0 -2
  132. package/dist/src/codex-executable.js +1 -7
  133. package/dist/src/codex-provider.d.ts +0 -13
  134. package/dist/src/codex-provider.js +0 -28
  135. package/dist/src/codex-rpc.d.ts +0 -10
  136. package/dist/src/codex-rpc.js +0 -12
  137. package/dist/src/coding-tools.d.ts +4 -26
  138. package/dist/src/coding-tools.js +161 -181
  139. package/dist/src/command-metrics.d.ts +0 -4
  140. package/dist/src/command-output-tap.d.ts +0 -11
  141. package/dist/src/command-output-tap.js +0 -3
  142. package/dist/src/command-screens.d.ts +24 -0
  143. package/dist/src/command-screens.js +132 -100
  144. package/dist/src/commands.d.ts +6 -63
  145. package/dist/src/commands.js +20 -100
  146. package/dist/src/completion-gates.d.ts +0 -47
  147. package/dist/src/completion-gates.js +0 -14
  148. package/dist/src/completion.d.ts +0 -98
  149. package/dist/src/completion.js +2 -239
  150. package/dist/src/config.d.ts +11 -116
  151. package/dist/src/config.js +39 -171
  152. package/dist/src/context-budget.d.ts +0 -22
  153. package/dist/src/context-budget.js +0 -44
  154. package/dist/src/context-compaction.d.ts +29 -6
  155. package/dist/src/context-compaction.js +94 -25
  156. package/dist/src/context-selection.d.ts +0 -24
  157. package/dist/src/context-selection.js +0 -34
  158. package/dist/src/dashboard-view.d.ts +0 -2
  159. package/dist/src/dashboard-view.js +0 -35
  160. package/dist/src/dashboard.d.ts +0 -2
  161. package/dist/src/dashboard.js +0 -9
  162. package/dist/src/deadline.d.ts +0 -45
  163. package/dist/src/deadline.js +0 -54
  164. package/dist/src/decision/ContinuationAdapter.d.ts +0 -5
  165. package/dist/src/decision/ContinuationAdapter.js +0 -5
  166. package/dist/src/decision/DecisionEngine.d.ts +0 -4
  167. package/dist/src/decision/DecisionManager.d.ts +0 -1
  168. package/dist/src/decision/DecisionManager.js +2 -7
  169. package/dist/src/decision/DecisionPolicy.d.ts +0 -1
  170. package/dist/src/decision/DecisionPolicy.js +0 -1
  171. package/dist/src/decision/FactContinuations.d.ts +11 -43
  172. package/dist/src/decision/FactContinuations.js +126 -95
  173. package/dist/src/decision/FactServiceGate.d.ts +0 -1
  174. package/dist/src/decision/FactServiceGate.js +0 -4
  175. package/dist/src/decision/PreparedSteps.d.ts +0 -15
  176. package/dist/src/decision/PreparedSteps.js +0 -10
  177. package/dist/src/decision/applyToolMenu.d.ts +0 -1
  178. package/dist/src/decision/applyToolMenu.js +1 -5
  179. package/dist/src/decision/checks.d.ts +15 -28
  180. package/dist/src/decision/checks.js +118 -49
  181. package/dist/src/decision/facts.d.ts +0 -16
  182. package/dist/src/decision/facts.js +0 -30
  183. package/dist/src/decision/guidancePolicy.js +0 -1
  184. package/dist/src/decision/hostedPolicy.d.ts +0 -6
  185. package/dist/src/decision/hostedPolicy.js +0 -7
  186. package/dist/src/decision/hostedSkills.d.ts +0 -19
  187. package/dist/src/decision/hostedSkills.js +0 -19
  188. package/dist/src/decision/optimizationPolicy.d.ts +0 -3
  189. package/dist/src/decision/optimizationPolicy.js +1 -4
  190. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +0 -7
  191. package/dist/src/decision/providers/AndorraDecisionProvider.js +4 -27
  192. package/dist/src/decision/providers/HttpDecisionProvider.d.ts +0 -2
  193. package/dist/src/decision/providers/HttpDecisionProvider.js +0 -6
  194. package/dist/src/decision/routeTools.d.ts +0 -8
  195. package/dist/src/decision/routeTools.js +1 -8
  196. package/dist/src/decision/toolFamilies.d.ts +0 -1
  197. package/dist/src/decision/toolFamilies.js +0 -1
  198. package/dist/src/decision/toolMenu.d.ts +0 -3
  199. package/dist/src/decision/toolMenu.js +0 -4
  200. package/dist/src/decision/types.d.ts +0 -6
  201. package/dist/src/default-graph.d.ts +0 -9
  202. package/dist/src/default-graph.js +0 -9
  203. package/dist/src/delegation-changes.d.ts +0 -56
  204. package/dist/src/delegation-changes.js +4 -130
  205. package/dist/src/diff-preview.d.ts +0 -1
  206. package/dist/src/diff-preview.js +0 -17
  207. package/dist/src/duration.d.ts +0 -50
  208. package/dist/src/duration.js +0 -50
  209. package/dist/src/efficiency.d.ts +0 -39
  210. package/dist/src/efficiency.js +0 -16
  211. package/dist/src/engine/protocol.d.ts +0 -2
  212. package/dist/src/engine/protocol.js +0 -2
  213. package/dist/src/engine-streams.d.ts +0 -9
  214. package/dist/src/extensions.d.ts +3 -2
  215. package/dist/src/extensions.js +63 -35
  216. package/dist/src/favicons.d.ts +0 -26
  217. package/dist/src/favicons.js +0 -34
  218. package/dist/src/file-diff.d.ts +2 -58
  219. package/dist/src/file-diff.js +0 -32
  220. package/dist/src/file-read-key.d.ts +0 -7
  221. package/dist/src/file-read-key.js +0 -7
  222. package/dist/src/file-read-state.d.ts +0 -1
  223. package/dist/src/file-read-state.js +0 -4
  224. package/dist/src/firefox-cookies.d.ts +0 -34
  225. package/dist/src/firefox-cookies.js +1 -55
  226. package/dist/src/git-identity-audit.d.ts +27 -0
  227. package/dist/src/git-identity-audit.js +286 -0
  228. package/dist/src/git-identity-guard.d.ts +4 -0
  229. package/dist/src/git-identity-guard.js +998 -0
  230. package/dist/src/git-identity-hold.d.ts +12 -0
  231. package/dist/src/git-identity-hold.js +81 -0
  232. package/dist/src/git-summary.d.ts +0 -58
  233. package/dist/src/git-summary.js +2 -212
  234. package/dist/src/goal-completion-verification.d.ts +2 -2
  235. package/dist/src/goal-completion-verification.js +3 -6
  236. package/dist/src/graph-account.d.ts +0 -21
  237. package/dist/src/graph-account.js +0 -17
  238. package/dist/src/graph-editor-session.d.ts +0 -1
  239. package/dist/src/graph-editor-session.js +0 -3
  240. package/dist/src/graph-health.d.ts +0 -63
  241. package/dist/src/graph-health.js +0 -57
  242. package/dist/src/graph-manager-chat.d.ts +5 -155
  243. package/dist/src/graph-manager-chat.js +2 -177
  244. package/dist/src/graph-provider-portability.d.ts +1 -21
  245. package/dist/src/graph-provider-portability.js +6 -45
  246. package/dist/src/graph-quota.d.ts +0 -33
  247. package/dist/src/graph-quota.js +1 -44
  248. package/dist/src/graph-runner.d.ts +0 -1
  249. package/dist/src/graph-runner.js +31 -391
  250. package/dist/src/graph-selection.d.ts +0 -14
  251. package/dist/src/graph-selection.js +0 -14
  252. package/dist/src/graph-server.d.ts +2 -10
  253. package/dist/src/graph-server.js +39 -101
  254. package/dist/src/graph-studio-features.d.ts +0 -5
  255. package/dist/src/graph-studio-features.js +2 -42
  256. package/dist/src/graph-sync.d.ts +0 -78
  257. package/dist/src/graph-sync.js +5 -201
  258. package/dist/src/graph-tool.d.ts +0 -18
  259. package/dist/src/graph-tool.js +0 -27
  260. package/dist/src/graph-ui/app.js +152 -491
  261. package/dist/src/graph-ui/compat.js +0 -7
  262. package/dist/src/graph-ui/controls.css +0 -48
  263. package/dist/src/graph-ui/controls.js +0 -88
  264. package/dist/src/graph-ui/drafts.js +0 -12
  265. package/dist/src/graph-ui/edge-router.js +0 -62
  266. package/dist/src/graph-ui/embed.js +0 -59
  267. package/dist/src/graph-ui/icons.js +0 -8
  268. package/dist/src/graph-ui/library.css +0 -5
  269. package/dist/src/graph-ui/manager-markdown.js +0 -11
  270. package/dist/src/graph-ui/manager-state.js +1 -78
  271. package/dist/src/graph-ui/manager.css +0 -18
  272. package/dist/src/graph-ui/manager.js +3 -180
  273. package/dist/src/graph-ui/model-picker.js +0 -29
  274. package/dist/src/graph-ui/sidebar.js +2 -3
  275. package/dist/src/graph-ui/skill-picker.js +373 -39
  276. package/dist/src/graph-ui/studio-canvas.js +3 -38
  277. package/dist/src/graph-ui/studio.css +0 -18
  278. package/dist/src/graph-ui/studio.js +3 -71
  279. package/dist/src/graph-ui/style.css +11 -134
  280. package/dist/src/graph-ui/theme.js +1 -26
  281. package/dist/src/graph-ui/tokens.css +15 -114
  282. package/dist/src/graphs.d.ts +6 -157
  283. package/dist/src/graphs.js +65 -266
  284. package/dist/src/grep-regex-worker.js +0 -2
  285. package/dist/src/grep-regex.d.ts +1 -5
  286. package/dist/src/grep-regex.js +6 -8
  287. package/dist/src/grok-provider.d.ts +0 -17
  288. package/dist/src/grok-provider.js +1 -26
  289. package/dist/src/handoffs.d.ts +0 -11
  290. package/dist/src/handoffs.js +0 -13
  291. package/dist/src/hardened-runtime.d.ts +0 -10
  292. package/dist/src/hardened-runtime.js +8 -46
  293. package/dist/src/harness-home.d.ts +21 -0
  294. package/dist/src/harness-home.js +87 -0
  295. package/dist/src/host-process-guard.d.ts +0 -50
  296. package/dist/src/host-process-guard.js +0 -641
  297. package/dist/src/limits.d.ts +0 -64
  298. package/dist/src/limits.js +0 -62
  299. package/dist/src/managed-sign-in.d.ts +0 -12
  300. package/dist/src/managed-sign-in.js +0 -16
  301. package/dist/src/markdown.d.ts +0 -28
  302. package/dist/src/markdown.js +1 -175
  303. package/dist/src/mcp.d.ts +0 -99
  304. package/dist/src/mcp.js +4 -170
  305. package/dist/src/membership-errors.d.ts +0 -14
  306. package/dist/src/membership-errors.js +0 -13
  307. package/dist/src/membership.d.ts +2 -60
  308. package/dist/src/membership.js +0 -85
  309. package/dist/src/memory/LocalToolMemory.d.ts +0 -1
  310. package/dist/src/memory/LocalToolMemory.js +2 -7
  311. package/dist/src/memory/MemoryDistiller.js +0 -15
  312. package/dist/src/memory/MemoryManager.d.ts +0 -3
  313. package/dist/src/memory/MemoryManager.js +6 -18
  314. package/dist/src/memory/MemoryPolicy.d.ts +0 -2
  315. package/dist/src/memory/MemoryPolicy.js +0 -2
  316. package/dist/src/memory/MemoryProvider.d.ts +0 -6
  317. package/dist/src/memory/MemoryRetriever.js +0 -7
  318. package/dist/src/memory/PermissionMemoryProvider.d.ts +0 -1
  319. package/dist/src/memory/PermissionMemoryProvider.js +0 -1
  320. package/dist/src/memory/ProjectMemory.d.ts +5 -40
  321. package/dist/src/memory/ProjectMemory.js +22 -47
  322. package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
  323. package/dist/src/memory/ToolFailureLessons.js +0 -6
  324. package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +0 -1
  325. package/dist/src/memory/providers/NoOpMemoryProvider.js +0 -1
  326. package/dist/src/memory/redaction.d.ts +0 -5
  327. package/dist/src/memory/redaction.js +0 -11
  328. package/dist/src/memory/repository.d.ts +0 -6
  329. package/dist/src/memory/repository.js +2 -12
  330. package/dist/src/memory/types.d.ts +0 -1
  331. package/dist/src/model-health-cache.d.ts +0 -38
  332. package/dist/src/model-health-cache.js +1 -49
  333. package/dist/src/model-metadata.d.ts +0 -18
  334. package/dist/src/model-metadata.js +2 -42
  335. package/dist/src/model-override.d.ts +0 -36
  336. package/dist/src/model-override.js +0 -43
  337. package/dist/src/model-tiers.d.ts +0 -13
  338. package/dist/src/model-tiers.js +0 -23
  339. package/dist/src/opencode-catalog.d.ts +0 -2
  340. package/dist/src/opencode-catalog.js +0 -11
  341. package/dist/src/opencode-cli-provider.d.ts +0 -35
  342. package/dist/src/opencode-cli-provider.js +1 -44
  343. package/dist/src/opencode-provider.d.ts +0 -2
  344. package/dist/src/opencode-provider.js +1 -16
  345. package/dist/src/package-name.d.ts +0 -2
  346. package/dist/src/package-name.js +0 -2
  347. package/dist/src/paged-transcript.d.ts +0 -11
  348. package/dist/src/paged-transcript.js +2 -20
  349. package/dist/src/palette.d.ts +0 -63
  350. package/dist/src/palette.js +0 -63
  351. package/dist/src/permissions.d.ts +0 -15
  352. package/dist/src/permissions.js +0 -17
  353. package/dist/src/powershell-pool.d.ts +0 -9
  354. package/dist/src/powershell-pool.js +3 -26
  355. package/dist/src/process-warnings.d.ts +4 -0
  356. package/dist/src/process-warnings.js +103 -0
  357. package/dist/src/profile.d.ts +0 -43
  358. package/dist/src/profile.js +0 -43
  359. package/dist/src/project-reservation.d.ts +11 -0
  360. package/dist/src/project-reservation.js +143 -0
  361. package/dist/src/provider-connection.d.ts +0 -18
  362. package/dist/src/provider-connection.js +0 -39
  363. package/dist/src/provider-engine.d.ts +0 -21
  364. package/dist/src/provider-engine.js +1 -96
  365. package/dist/src/provider-import.d.ts +0 -49
  366. package/dist/src/provider-import.js +0 -60
  367. package/dist/src/provider-keys.d.ts +1 -36
  368. package/dist/src/provider-keys.js +5 -48
  369. package/dist/src/provider-settings.d.ts +0 -2
  370. package/dist/src/provider-settings.js +0 -32
  371. package/dist/src/providers.d.ts +0 -217
  372. package/dist/src/providers.js +0 -315
  373. package/dist/src/pull-requests.d.ts +0 -173
  374. package/dist/src/pull-requests.js +5 -195
  375. package/dist/src/qa/browser/PlaywrightRunner.d.ts +0 -7
  376. package/dist/src/qa/browser/PlaywrightRunner.js +2 -16
  377. package/dist/src/qa/command-policy.d.ts +0 -23
  378. package/dist/src/qa/command-policy.js +0 -30
  379. package/dist/src/qa/guidance.d.ts +0 -21
  380. package/dist/src/qa/guidance.js +0 -20
  381. package/dist/src/qa/profile/ProjectInspector.d.ts +0 -4
  382. package/dist/src/qa/profile/ProjectInspector.js +0 -6
  383. package/dist/src/qa/profile/QaConfigLoader.d.ts +0 -7
  384. package/dist/src/qa/profile/QaConfigLoader.js +0 -6
  385. package/dist/src/qa/profile/QaProfile.d.ts +0 -7
  386. package/dist/src/qa/profile/QaProfile.js +0 -7
  387. package/dist/src/qa/profile/yaml.d.ts +0 -9
  388. package/dist/src/qa/profile/yaml.js +0 -13
  389. package/dist/src/qa/qa-authorize.d.ts +0 -19
  390. package/dist/src/qa/qa-authorize.js +4 -11
  391. package/dist/src/qa/runtime/ProcessManager.d.ts +0 -31
  392. package/dist/src/qa/runtime/ProcessManager.js +4 -41
  393. package/dist/src/qa/runtime/PtyManager.d.ts +0 -4
  394. package/dist/src/qa/runtime/PtyManager.js +1 -7
  395. package/dist/src/qa/runtime/changes.d.ts +0 -11
  396. package/dist/src/qa/runtime/changes.js +1 -3
  397. package/dist/src/qa/tools.d.ts +0 -10
  398. package/dist/src/qa/tools.js +0 -12
  399. package/dist/src/qa/types.d.ts +0 -13
  400. package/dist/src/react-runtime.d.ts +2 -21
  401. package/dist/src/react-runtime.js +95 -415
  402. package/dist/src/read-document-doc.d.ts +0 -6
  403. package/dist/src/read-document-doc.js +0 -55
  404. package/dist/src/read-document-docx.d.ts +0 -16
  405. package/dist/src/read-document-docx.js +2 -69
  406. package/dist/src/read-document-text.d.ts +0 -17
  407. package/dist/src/read-document-text.js +0 -22
  408. package/dist/src/read-document-tool.d.ts +0 -31
  409. package/dist/src/read-document-tool.js +0 -30
  410. package/dist/src/read-document.d.ts +0 -49
  411. package/dist/src/read-document.js +1 -67
  412. package/dist/src/read-image.d.ts +0 -32
  413. package/dist/src/read-image.js +0 -33
  414. package/dist/src/remote/cert.d.ts +0 -18
  415. package/dist/src/remote/cert.js +0 -44
  416. package/dist/src/remote/client.d.ts +0 -70
  417. package/dist/src/remote/client.js +1 -116
  418. package/dist/src/remote/command.js +0 -17
  419. package/dist/src/remote/engine-pool.d.ts +0 -152
  420. package/dist/src/remote/engine-pool.js +17 -335
  421. package/dist/src/remote/errors.d.ts +0 -15
  422. package/dist/src/remote/errors.js +0 -7
  423. package/dist/src/remote/network.d.ts +0 -26
  424. package/dist/src/remote/network.js +1 -34
  425. package/dist/src/remote/pairing.d.ts +16 -51
  426. package/dist/src/remote/pairing.js +50 -57
  427. package/dist/src/remote/pem.d.ts +0 -4
  428. package/dist/src/remote/pem.js +0 -4
  429. package/dist/src/remote/roots.d.ts +0 -20
  430. package/dist/src/remote/roots.js +0 -8
  431. package/dist/src/remote/serve.d.ts +0 -47
  432. package/dist/src/remote/serve.js +0 -30
  433. package/dist/src/remote/server.d.ts +0 -14
  434. package/dist/src/remote/server.js +1 -79
  435. package/dist/src/remote/types.d.ts +1 -32
  436. package/dist/src/remote/types.js +0 -10
  437. package/dist/src/run-control.d.ts +0 -7
  438. package/dist/src/run-control.js +0 -7
  439. package/dist/src/run-progress.d.ts +0 -170
  440. package/dist/src/run-progress.js +0 -285
  441. package/dist/src/run-records.d.ts +0 -443
  442. package/dist/src/run-records.js +14 -687
  443. package/dist/src/run-temp.d.ts +12 -0
  444. package/dist/src/run-temp.js +50 -0
  445. package/dist/src/runtime.d.ts +10 -228
  446. package/dist/src/runtime.js +0 -127
  447. package/dist/src/sandbox-child.js +0 -1
  448. package/dist/src/save-lock.d.ts +0 -12
  449. package/dist/src/save-lock.js +0 -28
  450. package/dist/src/screen-selection.d.ts +0 -23
  451. package/dist/src/screen-selection.js +0 -22
  452. package/dist/src/secret-redaction.d.ts +0 -12
  453. package/dist/src/secret-redaction.js +0 -45
  454. package/dist/src/session-changes.d.ts +4 -80
  455. package/dist/src/session-changes.js +25 -130
  456. package/dist/src/session-goal.d.ts +129 -0
  457. package/dist/src/session-goal.js +230 -0
  458. package/dist/src/session-monitor.d.ts +1 -10
  459. package/dist/src/session-monitor.js +2 -39
  460. package/dist/src/session-reaper.d.ts +0 -15
  461. package/dist/src/session-reaper.js +0 -14
  462. package/dist/src/session-skills.d.ts +15 -44
  463. package/dist/src/session-skills.js +75 -60
  464. package/dist/src/session-summary.d.ts +0 -26
  465. package/dist/src/session-summary.js +0 -32
  466. package/dist/src/session-title.d.ts +0 -1
  467. package/dist/src/session-title.js +0 -2
  468. package/dist/src/sessions.d.ts +2 -122
  469. package/dist/src/sessions.js +7 -178
  470. package/dist/src/shell.d.ts +3 -20
  471. package/dist/src/shell.js +8 -72
  472. package/dist/src/side-panel.d.ts +5 -99
  473. package/dist/src/side-panel.js +76 -133
  474. package/dist/src/sign-in-detection.d.ts +0 -39
  475. package/dist/src/sign-in-detection.js +0 -43
  476. package/dist/src/sign-in-offer.d.ts +1 -19
  477. package/dist/src/sign-in-offer.js +0 -13
  478. package/dist/src/skill-commands.d.ts +0 -1
  479. package/dist/src/skill-commands.js +1 -4
  480. package/dist/src/skills/bundled/control-browser/SKILL.md +1 -1
  481. package/dist/src/skills/bundled/provenance.json +1 -1
  482. package/dist/src/skills/invocable-skills.d.ts +0 -18
  483. package/dist/src/skills/invocable-skills.js +0 -17
  484. package/dist/src/skills/project-skills.d.ts +0 -1
  485. package/dist/src/skills/project-skills.js +0 -3
  486. package/dist/src/skills/prompt-skills.js +0 -14
  487. package/dist/src/skills/runtime-skills.d.ts +0 -13
  488. package/dist/src/skills/runtime-skills.js +0 -37
  489. package/dist/src/stall-recovery.d.ts +0 -25
  490. package/dist/src/stall-recovery.js +0 -38
  491. package/dist/src/stray-files.d.ts +0 -9
  492. package/dist/src/stray-files.js +0 -16
  493. package/dist/src/structured-step.d.ts +0 -22
  494. package/dist/src/structured-step.js +0 -22
  495. package/dist/src/subagent-run.d.ts +0 -163
  496. package/dist/src/subagent-run.js +4 -373
  497. package/dist/src/subagent-tree.d.ts +32 -0
  498. package/dist/src/subagent-tree.js +128 -0
  499. package/dist/src/telemetry/aggregate.d.ts +0 -37
  500. package/dist/src/telemetry/aggregate.js +0 -40
  501. package/dist/src/telemetry/capture-core.d.ts +0 -87
  502. package/dist/src/telemetry/capture-core.js +0 -67
  503. package/dist/src/telemetry/capture.d.ts +0 -1
  504. package/dist/src/telemetry/capture.js +0 -3
  505. package/dist/src/telemetry/classify.d.ts +0 -58
  506. package/dist/src/telemetry/classify.js +0 -60
  507. package/dist/src/telemetry/decision-capture.d.ts +0 -1
  508. package/dist/src/telemetry/emitter.d.ts +0 -30
  509. package/dist/src/telemetry/emitter.js +1 -62
  510. package/dist/src/telemetry/gate.d.ts +0 -29
  511. package/dist/src/telemetry/gate.js +0 -22
  512. package/dist/src/telemetry/identity.d.ts +0 -13
  513. package/dist/src/telemetry/identity.js +0 -29
  514. package/dist/src/telemetry/outbox.d.ts +0 -64
  515. package/dist/src/telemetry/outbox.js +1 -108
  516. package/dist/src/telemetry/schema.d.ts +1 -49
  517. package/dist/src/telemetry/schema.js +1 -82
  518. package/dist/src/telemetry/state.d.ts +0 -53
  519. package/dist/src/telemetry/state.js +0 -64
  520. package/dist/src/telemetry/surface.d.ts +0 -31
  521. package/dist/src/telemetry/surface.js +1 -39
  522. package/dist/src/telemetry/uploader.d.ts +0 -11
  523. package/dist/src/telemetry/uploader.js +0 -46
  524. package/dist/src/telemetry/uploads.d.ts +0 -11
  525. package/dist/src/telemetry/uploads.js +0 -11
  526. package/dist/src/telemetry/version.d.ts +0 -4
  527. package/dist/src/telemetry/version.js +0 -14
  528. package/dist/src/telemetry/workspace.d.ts +0 -7
  529. package/dist/src/telemetry/workspace.js +1 -22
  530. package/dist/src/terminal-ui.d.ts +14 -523
  531. package/dist/src/terminal-ui.js +74 -876
  532. package/dist/src/test-edit-guard.d.ts +74 -0
  533. package/dist/src/test-edit-guard.js +269 -0
  534. package/dist/src/text.d.ts +0 -1
  535. package/dist/src/text.js +0 -1
  536. package/dist/src/time-limit.d.ts +0 -36
  537. package/dist/src/time-limit.js +0 -37
  538. package/dist/src/timers.d.ts +0 -161
  539. package/dist/src/timers.js +0 -126
  540. package/dist/src/todos.d.ts +0 -1
  541. package/dist/src/todos.js +0 -3
  542. package/dist/src/token-rate.d.ts +0 -94
  543. package/dist/src/token-rate.js +0 -154
  544. package/dist/src/tool-activity.d.ts +0 -6
  545. package/dist/src/tool-activity.js +0 -7
  546. package/dist/src/tool-availability.d.ts +0 -13
  547. package/dist/src/tool-availability.js +1 -14
  548. package/dist/src/tool-call-clock.d.ts +1 -4
  549. package/dist/src/tool-call-clock.js +0 -13
  550. package/dist/src/tool-catalog.d.ts +0 -11
  551. package/dist/src/tool-catalog.js +0 -23
  552. package/dist/src/tool-dependencies.d.ts +0 -5
  553. package/dist/src/tool-dependencies.js +0 -4
  554. package/dist/src/tool-diff-stats.d.ts +0 -23
  555. package/dist/src/tool-diff-stats.js +0 -49
  556. package/dist/src/tool-errors.d.ts +9 -7
  557. package/dist/src/tool-errors.js +13 -6
  558. package/dist/src/tool-failure-tracker.d.ts +3 -11
  559. package/dist/src/tool-failure-tracker.js +19 -27
  560. package/dist/src/tool-names.d.ts +0 -16
  561. package/dist/src/tool-names.js +0 -12
  562. package/dist/src/tool-profile.d.ts +6 -0
  563. package/dist/src/tool-profile.js +23 -0
  564. package/dist/src/tool-result-filter.d.ts +0 -19
  565. package/dist/src/tool-result-filter.js +1 -66
  566. package/dist/src/tool-schema-compatibility.d.ts +0 -6
  567. package/dist/src/tool-schema-compatibility.js +0 -9
  568. package/dist/src/tools.d.ts +0 -4
  569. package/dist/src/tools.js +11 -114
  570. package/dist/src/trajectory.d.ts +0 -13
  571. package/dist/src/trajectory.js +23 -79
  572. package/dist/src/transcript.d.ts +0 -41
  573. package/dist/src/transcript.js +2 -60
  574. package/dist/src/types.d.ts +1 -168
  575. package/dist/src/untracked-file-removal.js +0 -20
  576. package/dist/src/update-check.d.ts +0 -14
  577. package/dist/src/update-check.js +1 -15
  578. package/dist/src/update.d.ts +0 -35
  579. package/dist/src/update.js +0 -100
  580. package/dist/src/usage-analytics.d.ts +17 -17
  581. package/dist/src/usage-analytics.js +168 -209
  582. package/dist/src/web-search.d.ts +0 -23
  583. package/dist/src/web-search.js +1 -27
  584. package/dist/src/widgets.d.ts +0 -25
  585. package/dist/src/widgets.js +0 -24
  586. package/dist/src/workspace-facts.d.ts +0 -12
  587. package/dist/src/workspace-facts.js +1 -18
  588. package/dist/src/workspace-git-metadata.d.ts +0 -16
  589. package/dist/src/workspace-git-metadata.js +0 -21
  590. package/dist/src/workspace-instructions.d.ts +3 -15
  591. package/dist/src/workspace-instructions.js +6 -19
  592. package/package.json +2 -2
@@ -1,22 +1,12 @@
1
1
  import { createHash, randomUUID } from 'node:crypto';
2
- import { commandLine, declaredCheckKind, isCheckCall, isReplaySafeCheck, isVerificationCheck, replayableCheck, stripOutputFilter } from './checks.js';
2
+ import { commandLine, declaredCheckKind, isCheckCall, isReplaySafeCheck, isVerificationCheck, onlyDisplaysOutput, replayableCheck, replayableTestRun, stripOutputFilter, testRunVerdict } from './checks.js';
3
3
  export const PREPARE_FINISH = 'prepare_finish';
4
4
  export const FACT_CONTINUATION_GUIDANCE = 'Minimize model turns: batch independent reads and related file writes. Do not spend a turn only announcing a plan. When prepare_finish is available, finish through it: put it LAST in the batch that makes your final edits, with the commands that verify the work and your final summary. The runtime runs them and completes the task without another model call, so do not run those commands yourself first, do not call complete_agent afterwards and do not add discretionary QA: one passing run of the checks the project already has is sufficient, so do not write throwaway scripts to prove the same thing again. If the verification is not a command, verify first, then call prepare_finish alone with checks []. After you edit files the runtime runs your latest check again by itself, so do not spend a turn rerunning it or marking todos done. Keep the final summary short, whatever other formatting guidance says: one or two sentences with the outcome, then at most five short bullets on what changed and how it was verified, about 100 words in all, with no headings, no code blocks, no restated diff and no remarks on things the task did not ask about (such as a pull request that was never requested), unless the user asked for that content. User instructions, workspace requirements and graph completion contracts still apply.';
5
- /** What the model writes once as its final answer; a retry reuses it instead of sending it again. */
6
5
  export const FINISH_SUMMARY_DESCRIPTION = 'Final answer shown to the user, as Markdown with \\n line breaks: one or two sentences with the outcome, then at most five short bullets on what changed and how it was verified. About 100 words, no headings. Omit it on a retry to reuse the one already saved.';
7
- /** The tool description, naming the shell the model actually has. */
8
6
  export function prepareFinishDescription(shell = 'PowerShell') {
9
7
  return `Finish the task. Call LAST in the batch that makes your final edits. checks: the commands that verify the work (tests, build, lint, typecheck), one command per entry, written exactly as you would run them with ${shell}, e.g. ["npm run build", "npm test"]; chain steps with && if needed, but no pipes, ";" or "||" (output is already bounded). summary: your final answer. The runtime runs the checks through normal approvals and, when all pass, closes the open todos and submits the summary without another coding-model call. If a check fails you receive its output: fix the problem and call prepare_finish again with the checks only, and the saved summary is reused unless you send a new one. After verifying some other way, call it alone with checks [] to submit.`;
10
8
  }
11
9
  const DEFAULT_CHECK_TIMEOUT_MS = 300_000;
12
- /**
13
- * Brings what a model sends into the one shape `stage` validates, repairing slips that would
14
- * otherwise cost a whole coding-model turn without changing what is verified: a check written as a
15
- * command line (the advertised form), as `{command}`, with its arguments beside its name or with a
16
- * note beside it; an output filter that would hide the exit status; the final answer written flat
17
- * (`summary`) or as a JSON string; and evidence lines in `tests`, which the runtime fills in itself.
18
- * Everything else is left for validation to reject.
19
- */
20
10
  export function prepareFinishArguments(args, tools) {
21
11
  if (!object(args))
22
12
  return args;
@@ -44,7 +34,6 @@ export function prepareFinishArguments(args, tools) {
44
34
  given = { command: name.trim() };
45
35
  name = tools.shell;
46
36
  }
47
- // A label where the tool name belongs, with the command beside it: the shell is what was meant.
48
37
  if (!tools.has(name) && tools.shell && object(given) && typeof given.command === 'string')
49
38
  name = tools.shell;
50
39
  if (name === tools.shell && object(given) && typeof given.command === 'string')
@@ -72,36 +61,28 @@ export function prepareFinishArguments(args, tools) {
72
61
  const object = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
73
62
  const canonical = (v) => Array.isArray(v) ? v.map(canonical) : object(v)
74
63
  ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a.localeCompare(b)).map(([k, x]) => [k, canonical(x)])) : v;
75
- // A note or a longer deadline does not change what a check verifies: the same command run again
76
- // with another description or timeout replaces its earlier evidence instead of standing beside it.
77
64
  const NOT_IDENTITY = new Set(['description', 'justification', 'timeout', 'timeout_ms']);
78
65
  export const checkKey = (call) => createHash('sha256').update(call.name + ':' + JSON.stringify(canonical(Object.fromEntries(Object.entries(call.arguments).filter(([key]) => !NOT_IDENTITY.has(key)))))).digest('hex');
79
66
  const metadata = new Set([PREPARE_FINISH, 'update_todos', 'update_widget']);
80
67
  const probability = (value, bar) => value === undefined || !Number.isFinite(value) || value < 0 || value > 1 ? undefined : value >= bar - 1e-9 ? true : value <= 1 - bar + 1e-9 ? false : undefined;
81
68
  const concrete = (o) => ({ name: o.call.name, arguments: structuredClone(o.args) });
82
69
  const description = (call) => commandLine(call.arguments) ?? call.name;
83
- /** What a failure looks like in the output of a command no runner pattern recognizes, even when it exits 0. */
84
70
  const OPAQUE_FAILURE_TEXT = /Traceback \(most recent call last\)|\b(?:AssertionError|assertion failed|Segmentation fault|core dumped|panicked at|Unhandled(?:Promise)?Rejection|not ok)\b|(?:^|\n)\s*(?:error|fatal)\b[:\s]|\b[1-9]\d* (?:errors?|failures?)\b/i;
85
71
  const FAILURE_TEXT = /(?:^|\n)\s*(?:Exit code: [1-9]\d*|[ℹ#]\s*fail\s+[1-9]\d*|Test Suites:\s*[1-9]\d* failed)|\b[1-9]\d* failed\b|\b(?:FAIL|FAILED)\b|error TS\d+/m;
86
- /** A JSON report's own verdict; null when the output is not a report that decides one. */
87
72
  function structuredVerdict(text) {
88
73
  let value;
89
74
  try {
90
75
  value = JSON.parse(text);
91
76
  }
92
77
  catch {
93
- return null; /* Shell text is handled by the caller. */
78
+ return null;
94
79
  }
95
80
  if (!object(value))
96
81
  return null;
97
- // QA reports contain an aggregate verdict, while the displayed result rows can be
98
- // truncated (qa.deep returns at most 25 of up to 32 checks). Never let passing
99
- // displayed rows override a failed or blocked overall run/merge gate.
100
82
  if (['issues', 'failed', 'blocked', 'dirty'].includes(String(value.verdict ?? value.status)))
101
83
  return false;
102
84
  if (object(value.gate) && ['failed', 'blocked'].includes(String(value.gate.verdict)))
103
85
  return false;
104
- // Unknown verdicts/gates are not positive verification evidence.
105
86
  if (value.verdict !== undefined && !['clean', 'ready'].includes(String(value.verdict)))
106
87
  return undefined;
107
88
  if (value.gate !== undefined && (!object(value.gate) || value.gate.verdict !== 'ready'))
@@ -109,26 +90,20 @@ function structuredVerdict(text) {
109
90
  const rows = Array.isArray(value.results) ? value.results : [value];
110
91
  if (rows.some(r => object(r) && ['failed', 'blocked'].includes(String(r.status))))
111
92
  return false;
112
- // A QA pipeline where every check was skipped is not verification.
113
93
  if (rows.length && rows.every(r => object(r) && ['passed', 'skipped'].includes(String(r.status)))) {
114
94
  return rows.some(r => object(r) && r.status === 'passed') ? true : undefined;
115
95
  }
116
96
  return null;
117
97
  }
118
- /** Exact owned outputs can be settled locally. Unknown or clipped formats are not a pass. */
119
98
  export function localCheckResult(observation) {
120
99
  if (observation.isError || !observation.executionSucceeded)
121
100
  return false;
122
101
  if (observation.localCheckStatus !== undefined)
123
102
  return observation.localCheckStatus;
124
103
  const text = observation.output.replace(/\x1b\[[0-9;]*m/g, '');
125
- // A report's own verdict comes first: exit 0 never turns a reported failure into a pass.
126
104
  const structured = structuredVerdict(text);
127
105
  if (structured === false)
128
106
  return false;
129
- // An exit status is exact even when the output was clipped: a standalone verification command
130
- // (no pipeline, isVerificationCheck) exits 0 only when it passed. A failure the runner printed
131
- // but did not exit on still counts, and a report that leaves its verdict open stays open.
132
107
  if (observation.exitCode !== undefined) {
133
108
  if (observation.exitCode !== 0 || FAILURE_TEXT.test(text))
134
109
  return false;
@@ -154,9 +129,6 @@ export function taskConstraints(task, nodeInstruction = '') {
154
129
  if (normalized && !commands.includes(normalized))
155
130
  commands.push(normalized);
156
131
  };
157
- // A required command is a task constraint even when it uses a custom script name
158
- // unknown to the check-runner allowlist. This list is for coverage, NOT permission
159
- // to auto-execute a command. Unsupported commands force the coding model to finish.
160
132
  for (const match of text.matchAll(/[`"]([^`"\n]+)[`"]/g)) {
161
133
  const command = match[1].trim();
162
134
  const preceding = text.slice(Math.max(0, (match.index ?? 0) - 100), match.index ?? 0);
@@ -164,8 +136,6 @@ export function taskConstraints(task, nodeInstruction = '') {
164
136
  if (isCheckCall('shell', 'shell', { command }) || requested && /^(?:npm|pnpm|yarn|bun|npx|node|python3?|pytest|cargo|go|make|dotnet|mvn|gradle|\.\/|\.\\\\)\s+\S+/i.test(command))
165
137
  addCommand(command);
166
138
  }
167
- // Also capture unquoted imperatives, e.g. "run npm run ci:local before
168
- // completing". Never infer an executable command merely from a script name.
169
139
  for (const match of text.matchAll(/\b(?:run|execute|rerun|re-run)\s+((?:(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?[\w:.-]+)|(?:(?:npx|node|python3?|pytest|cargo|go|make|dotnet|mvn)\s+[^\s`"',;]+))/gi)) {
170
140
  addCommand(match[1]);
171
141
  }
@@ -180,7 +150,7 @@ export function taskConstraints(task, nodeInstruction = '') {
180
150
  kinds.add('typecheck');
181
151
  return { noTests, noChecks, commands: noChecks ? [] : commands.filter(c => !noTests || checkKind(c) !== 'test'), kinds };
182
152
  }
183
- /** A follow-up check is worth a turn only while it is cheap: at most this often, and only a quick one. */
153
+ export const EMPTY_CHECKS_GUIDANCE = 'prepare_finish was called with checks [] but no command has run since the last file change, so nothing yet shows the change works. Put the checks you actually ran, or the commands that verify this change (the test file or build command that covers it), in checks: the runtime runs and records them. If the work cannot be verified by a command, call prepare_finish again with checks [] and say in the summary how it was verified; this is asked once.';
184
154
  const FOLLOW_UP_LIMIT = 8;
185
155
  const FOLLOW_UP_MAX_MS = 60_000;
186
156
  const VERIFICATION_TODO = /^(?:run|rerun|re-run|verify|test|check|lint|build|typecheck|smoke)(?:[ :\-]|$)/i;
@@ -195,7 +165,10 @@ function checkKind(line) {
195
165
  return 'test';
196
166
  return 'check';
197
167
  }
198
- /** Invocation-local policy. It never generates tool arguments or final answer text. */
168
+ const PASS_NUDGE_LIMIT = 2;
169
+ const TEST_RUN_ASK_LIMIT = 6;
170
+ const runKey = (line) => (replayableTestRun(line) ?? stripOutputFilter(line)).replace(/\s+/g, ' ').trim();
171
+ const TEST_WORD = /\btests?\b|\bspecs?\b|pytest|unittest/i;
199
172
  export class FactContinuations {
200
173
  options;
201
174
  revision = 0;
@@ -214,21 +187,21 @@ export class FactContinuations {
214
187
  constraints;
215
188
  syntheticCount = 0;
216
189
  finishHint = false;
217
- /** The model's own most recent check, in the form the runtime may run again after an edit. */
218
190
  lastCheck;
191
+ testRunAsks = 0;
192
+ /** Test commands whose latest run failed; one stays here until that same command passes. */
193
+ failedRuns = new Set();
219
194
  followUps = 0;
220
195
  followUpPassed;
221
196
  nextNudge;
222
- /**
223
- * The model has run a check of its own and read the result. Until then a finish reminder after an
224
- * edit invites a plan whose checks the model never sees run: on Terminal-Bench runs it finished
225
- * after its first write, on checks that passed but did not test what the task asked.
226
- */
197
+ passesSinceWrite = 0;
198
+ passNudges = 0;
199
+ everWrote = false;
227
200
  modelSawCheck = false;
228
- /** The final answer the model already wrote; a later plan may omit it instead of sending it again. */
229
201
  draft;
230
- /** Commands the model named as its verification that no runner pattern recognizes, by check key. */
231
202
  declared = new Map();
203
+ unverifiedWrite = false;
204
+ emptyChecksAsked = false;
232
205
  constructor(options) {
233
206
  this.options = options;
234
207
  this.task = options.task;
@@ -236,15 +209,8 @@ export class FactContinuations {
236
209
  }
237
210
  get finishing() { return this.finishHint; }
238
211
  get proposed() { return !!this.plan || !!this.staged; }
239
- /**
240
- * Where the model stands when nothing was run for it: it just edited files and has not checked
241
- * them, or its own check just failed. In both places the cheapest next move is one plan that
242
- * carries the checks and the answer, and a reminder there is what makes the model take it.
243
- */
244
212
  get nudge() { return this.nextNudge; }
245
- /** The check the runtime ran after the latest edits, when it passed on the current workspace. */
246
213
  get followUp() { return this.followUpPassed; }
247
- /** The model already wrote its final answer in an earlier plan. */
248
214
  get hasDraft() { return !!this.draft; }
249
215
  async emit(action, data = {}) {
250
216
  await this.options.emit('efficiency.facts.action', { action, ...data });
@@ -270,7 +236,6 @@ export class FactContinuations {
270
236
  this.constraints = taskConstraints(this.task, [this.options.nodeInstruction, this.options.workspaceInstructions].filter(Boolean).join('\n'));
271
237
  }
272
238
  }
273
- /** An actual model call expires unexecuted proposals; it does not discard check failures. */
274
239
  modelResumed() {
275
240
  this.plan = this.staged = undefined;
276
241
  this.queued = undefined;
@@ -295,7 +260,6 @@ export class FactContinuations {
295
260
  const given = args.completion;
296
261
  if (given && Object.keys(given).some(k => !['summary', 'tests', 'outcome', 'output', 'artifacts'].includes(k)))
297
262
  throw new Error('Unknown completion field.');
298
- // A retry sends only what changed: the saved answer supplies the rest.
299
263
  const value = { ...this.draft, ...given, tests: given?.tests ?? [] };
300
264
  if (typeof value.summary !== 'string' || !value.summary.trim() || !Array.isArray(value.tests) || value.tests.length) {
301
265
  throw new Error('Provide the complete proposed summary and tests: []; observed check evidence is filled in by the runtime.');
@@ -305,7 +269,6 @@ export class FactContinuations {
305
269
  this.stagePlan(args, value, alone);
306
270
  }
307
271
  catch (error) {
308
- // The answer is already written and kept, so the retry costs a few tokens, not the answer again.
309
272
  throw new Error(`${error instanceof Error ? error.message : String(error)} Your summary is saved: call prepare_finish again with only the corrected checks.`);
310
273
  }
311
274
  }
@@ -319,12 +282,9 @@ export class FactContinuations {
319
282
  throw new Error(`Unknown or unavailable tool "${input.name.slice(0, 80)}": a check is the shell tool's name with its arguments, e.g. {"name": "<shell>", "arguments": {"command": "npm test"}}.`);
320
283
  const call = { name: input.name, arguments: structuredClone(input.arguments) };
321
284
  if (!isVerificationCheck(input.name, tool.family, input.arguments)) {
322
- // A command the model names as its verification can still be prepared when its exit status
323
- // is faithful; what an exit 0 then proves depends on whether a known runner is in the line.
324
285
  const line = commandLine(input.arguments);
325
286
  const kind = tool.family === 'shell' && line && !('action' in input.arguments) ? declaredCheckKind(line) : undefined;
326
287
  if (!kind) {
327
- // Say which check and what to do instead: a retried plan costs a whole coding-model turn.
328
288
  const shown = (line ?? input.name).replace(/\s+/g, ' ').slice(0, 160);
329
289
  throw new Error(`"${shown}" is not a standalone command whose exit status reports the result, so it cannot be prepared. Give each command its own check and chain steps with && only: no ;, ||, pipes, redirects or substitutions, and no mode that changes files (--fix, --write, -u); run such a command yourself before preparing.`);
330
290
  }
@@ -343,12 +303,16 @@ export class FactContinuations {
343
303
  const todos = this.options.todos();
344
304
  if (ids.some(id => !todos.some(todo => todo.id === id)))
345
305
  throw new Error('Verification todo does not exist.');
346
- // Calling prepare_finish says the work is done, so the item in progress closes with it. An item
347
- // that was never started is unfinished work unless it only names the verification itself.
348
306
  if (todos.some(todo => todo.status === 'pending' && !VERIFICATION_TODO.test(todo.text)))
349
307
  throw new Error('A todo was never started. Finish it, or update the todo list, before preparing completion.');
350
308
  const closing = todos.filter(todo => todo.status !== 'completed').map(todo => todo.id);
351
309
  const direct = alone && !checks.length;
310
+ // Called alone with no checks, prepare_finish completes at once, as complete_agent would. When files were
311
+ // written and no command of any kind has run since, nothing has exercised the change: ask once for the checks.
312
+ if (direct && this.unverifiedWrite && !this.emptyChecksAsked && !this.constraints.noChecks && !this.constraints.noTests) {
313
+ this.emptyChecksAsked = true;
314
+ throw new Error(EMPTY_CHECKS_GUIDANCE);
315
+ }
352
316
  const alreadyPassed = [...this.checks.values()].filter(e => e.passed && e.pure && e.revision === this.revision).map(e => e.call);
353
317
  if (!direct && !this.coversRequirements([...alreadyPassed, ...checks]))
354
318
  throw new Error('The plan omits verification explicitly required by the task or node.');
@@ -361,13 +325,6 @@ export class FactContinuations {
361
325
  const kinds = new Set(calls.map(c => checkKind(description(c))));
362
326
  return this.constraints.commands.every(command => commands.has(command)) && [...this.constraints.kinds].every(kind => kinds.has(kind));
363
327
  }
364
- /**
365
- * The current workspace is verified: a check passed on it, and no earlier failure is left
366
- * unanswered. A failed test, lint or typecheck is answered by a later pass of the same kind on the
367
- * current workspace; a failed build or other command by any later pass, since a check that ran
368
- * built what it needed. A command whose result is unknown proves nothing either way: the model
369
- * saw its output and named the checks that decide.
370
- */
371
328
  verified() {
372
329
  const rows = [...this.checks.values()];
373
330
  const passing = rows.filter(e => e.passed === true && e.pure && e.revision === this.revision);
@@ -378,7 +335,6 @@ export class FactContinuations {
378
335
  async ask(input, signal) {
379
336
  return (await this.consult(input, signal)).value;
380
337
  }
381
- /** `answered` is false when the service gave no answer at all, as opposed to an unsure one. */
382
338
  async consult(input, signal) {
383
339
  signal.throwIfAborted();
384
340
  if (this.options.remoteFactsEnabled === false)
@@ -401,7 +357,6 @@ export class FactContinuations {
401
357
  if (this.taskNeedsChecks !== undefined)
402
358
  return this.taskNeedsChecks;
403
359
  const answer = await this.ask({ id: 'task_needs_checks', state: { task: [this.task, this.options.nodeInstruction ? `Node instruction (also part of the task):\n${this.options.nodeInstruction}` : ''].filter(Boolean).join('\n\n') } }, signal);
404
- // Do not cache a timeout/unavailable/uncertain answer as a permanent fact.
405
360
  if (answer !== undefined) {
406
361
  this.taskNeedsChecks = answer;
407
362
  this.taskNeedsChecksSource = 'jev';
@@ -419,7 +374,7 @@ export class FactContinuations {
419
374
  if (failed.some(o => o.readOnly || metadata.has(o.call.name)))
420
375
  this.revision++;
421
376
  const work = batch.filter(o => !metadata.has(o.call.name));
422
- let wrote = false, modelChecked = false;
377
+ let wrote = false, modelChecked = false, modelPassed = false, modelFailed = false, mayHaveChanged = false;
423
378
  for (const observation of work) {
424
379
  const call = concrete(observation);
425
380
  const key = checkKey(call);
@@ -427,45 +382,124 @@ export class FactContinuations {
427
382
  const check = !!declared || isCheckCall(call.name, observation.family, call.arguments);
428
383
  const pure = !!declared || isVerificationCheck(call.name, observation.family, call.arguments);
429
384
  if (!observation.readOnly && !pure) {
430
- this.revision++; // Failed writes/commands may have partially mutated the workspace too.
385
+ this.revision++;
431
386
  wrote ||= observation.family === 'filesystem-write' && !observation.isError && observation.executionSucceeded;
432
387
  }
433
- if (!check)
388
+ if (observation.family === 'filesystem-write' && !observation.isError && observation.executionSucceeded)
389
+ this.unverifiedWrite = true;
390
+ else if (observation.family === 'shell' || observation.family === 'qa' || observation.family === 'browser')
391
+ this.unverifiedWrite = false;
392
+ const line = observation.family === 'shell' && typeof call.arguments.command === 'string' ? call.arguments.command : undefined;
393
+ // What the runner printed is evidence of a test run even when the command is not in the runner table
394
+ // (a project's own `runtests.py` or `bin/test`) or its output passed through a display filter.
395
+ // A failing test run usually exits non-zero and so arrives as a failed call: its summary still says tests ran.
396
+ let summary = line && !automatic && !observation.truncated ? testRunVerdict(observation.output) : undefined;
397
+ if (summary === true && (observation.isError || !observation.executionSucceeded))
398
+ summary = false;
399
+ if (!check) {
400
+ // Anything that is neither read-only nor a recognised test run may have edited files (`sed -i`, a script).
401
+ if (!line) {
402
+ if (!observation.readOnly)
403
+ mayHaveChanged = true;
404
+ continue;
405
+ }
406
+ // Reading a saved log shows a summary but tests nothing, and changes nothing either.
407
+ if (onlyDisplaysOutput(line))
408
+ continue;
409
+ const replay = replayableTestRun(line);
410
+ let by = 'test_summary';
411
+ // No summary line the runtime can read, but the command names tests and could be rerun as it is: ask Jev
412
+ // whether this output is a passing test run. Only a yes is used; a no can mean "failed" or "not a test".
413
+ if (summary === undefined && replay && !automatic && !observation.truncated && !observation.isError && observation.output.trim()
414
+ && !this.constraints.noTests && !this.constraints.noChecks && TEST_WORD.test(line) && this.testRunAsks < TEST_RUN_ASK_LIMIT && !failed.length) {
415
+ this.testRunAsks++;
416
+ const answer = await this.consult({ id: 'checks_passed', state: { tool_results: [{ tool: call.name, command: line, succeeded: true, output: observation.output }] } }, signal);
417
+ if (answer.value === true) {
418
+ summary = true;
419
+ by = 'jev';
420
+ }
421
+ }
422
+ if (summary === undefined) {
423
+ if (!observation.readOnly)
424
+ mayHaveChanged = true;
425
+ continue;
426
+ }
427
+ modelChecked = true;
428
+ // A command the runtime would not rerun does more than run tests (`runtests; sed -i ...`): what it
429
+ // printed is still a result, but it may have changed files afterwards, so its pass is not credited.
430
+ if (!replay)
431
+ mayHaveChanged = true;
432
+ // Jev's yes means "a check passed", which also covers a build or a type check: enough to rerun the
433
+ // command after an edit, not enough to say that tests passed.
434
+ if (summary) {
435
+ if (replay && by === 'test_summary')
436
+ modelPassed = true;
437
+ this.failedRuns.delete(runKey(line));
438
+ }
439
+ else {
440
+ modelFailed = true;
441
+ this.failedRuns.add(runKey(line));
442
+ }
443
+ if (replay)
444
+ this.lastCheck = { call: { name: call.name, arguments: { ...call.arguments, command: replay } }, durationMs: observation.durationMs, source: by === 'jev' ? 'jev' : 'deterministic', test: true };
445
+ await this.options.emit('efficiency.checks.recognised', { by, passed: summary, replayable: !!replay });
434
446
  continue;
447
+ }
435
448
  if (!automatic) {
436
449
  modelChecked = true;
437
- // What a later edit is followed by: the model's own latest check, never one the runtime chose.
438
- const line = observation.family === 'shell' && typeof call.arguments.command === 'string' ? call.arguments.command : undefined;
439
- const replay = line ? replayableCheck(line) : undefined;
450
+ const replay = line ? replayableCheck(line) ?? (summary !== undefined ? replayableTestRun(line) : undefined) : undefined;
440
451
  if (replay)
441
- this.lastCheck = { call: { name: call.name, arguments: { ...call.arguments, command: replay } }, durationMs: observation.durationMs };
452
+ this.lastCheck = { call: { name: call.name, arguments: { ...call.arguments, command: replay } }, durationMs: observation.durationMs, test: summary !== undefined };
442
453
  }
443
454
  let passed = pure ? localCheckResult(observation) : undefined;
444
- // Exit 0 of a command nothing recognizes does not settle it: its output has to say it passed.
445
- // Only a clean exit qualifies at all; a report that leaves its own verdict open (every check
446
- // skipped) or names a failure never reaches this point as a pass.
447
455
  const cleanExit = declared === 'opaque' && passed === true;
448
456
  if (cleanExit)
449
457
  passed = undefined;
450
458
  let source = 'deterministic';
451
- // Only a result that can enable a continuation merits an external interpretation. A failed
452
- // execution is known false; a compound command never proves the final workspace verified.
453
459
  if (pure && passed === undefined && !observation.truncated && !failed.length && (this.plan || this.staged || this.options.todos().length > 0)) {
454
460
  const answer = await this.consult({ id: 'checks_passed', state: { tool_results: [{ tool: call.name, command: description(call), succeeded: observation.executionSucceeded && !observation.isError, output: observation.output }] } }, signal);
455
461
  passed = answer.value;
456
462
  if (passed !== undefined)
457
463
  source = 'jev';
458
- // No answer at all (the service is off, unreachable or does not speak this protocol) is not
459
- // an unsure answer. What remains is what the model itself would go by: the command it named
460
- // as its check exited 0 and nothing in its output reads as a failure.
461
464
  else if (!answer.answered && cleanExit && !OPAQUE_FAILURE_TEXT.test(observation.output))
462
465
  passed = true;
463
466
  }
464
- this.checks.delete(key); // Re-inserted last, so the map's order is the order checks ran.
467
+ // A failing summary overrides a clean exit status, for the runtime's own rerun as well: a wrapper that
468
+ // calls the runner and drops its return value exits 0 while printing "1 error".
469
+ if (passed === true && line && !observation.truncated && testRunVerdict(observation.output) === false)
470
+ passed = false;
471
+ if (!automatic) {
472
+ // Only a test run counts toward the finish reminder: a build or a lint passing twice says nothing about tests.
473
+ const outcome = passed ?? summary;
474
+ const ranTests = summary !== undefined || checkKind(description(call)) === 'test';
475
+ const onlyTests = !line || !!(replayableCheck(line) ?? replayableTestRun(line));
476
+ if (!onlyTests)
477
+ mayHaveChanged = true;
478
+ if (outcome === true && ranTests && onlyTests)
479
+ modelPassed = true;
480
+ else if (outcome === false)
481
+ modelFailed = true;
482
+ }
483
+ if (line && (passed ?? summary) !== undefined) {
484
+ if ((passed ?? summary) === true)
485
+ this.failedRuns.delete(runKey(line));
486
+ else
487
+ this.failedRuns.add(runKey(line));
488
+ }
489
+ this.checks.delete(key);
465
490
  this.checks.set(key, { call, passed, pure, source, revision: this.revision, seq: ++this.checkSeq, evidence: `${description(call).split('\n')[0].slice(0, 200)}: ${passed === true ? 'passed' : passed === false ? 'failed' : 'unconfirmed'}` });
466
491
  }
467
492
  if (modelChecked)
468
493
  this.modelSawCheck = true;
494
+ if (wrote)
495
+ this.everWrote = true;
496
+ if (wrote || mayHaveChanged)
497
+ this.passesSinceWrite = 0;
498
+ if (modelFailed || failed.length)
499
+ this.passesSinceWrite = 0;
500
+ // A batch that also changed files is not credited: the pass in it may have run before the change.
501
+ else if (modelPassed && !wrote && !mayHaveChanged)
502
+ this.passesSinceWrite++;
469
503
  if (automatic?.kind === 'recheck' && automatic.tool && !failed.length) {
470
504
  const evidence = this.checks.get(checkKey(automatic.tool));
471
505
  if (evidence?.passed === true && evidence.revision === this.revision)
@@ -475,8 +509,6 @@ export class FactContinuations {
475
509
  this.plan = this.staged = undefined;
476
510
  if (this.staged) {
477
511
  const declaration = batch.findIndex(o => o.call.name === PREPARE_FINISH);
478
- // The answer was written before these results existed, so the batch may only write files and
479
- // run checks: a read or another command in it is something the model has not seen yet.
480
512
  if (declaration < 0 || declaration !== batch.length - 1 || failed.length
481
513
  || work.some(o => o.family !== 'filesystem-write' && !this.declared.has(checkKey(concrete(o))) && !isVerificationCheck(o.call.name, o.family, o.args)))
482
514
  this.staged = undefined;
@@ -487,8 +519,6 @@ export class FactContinuations {
487
519
  await this.options.emit('efficiency.prepared.declared', { steps: this.plan.checks.length + 1, chars: JSON.stringify(this.plan).length, triggers: 0 });
488
520
  }
489
521
  }
490
- // Any later non-verification mutation invalidates the complete proposed result. A successful
491
- // check itself does not, and only the explicitly named verification todos may be ticked off.
492
522
  if (this.plan && (this.plan.revision !== this.revision || this.plan.permission !== this.options.permission()))
493
523
  this.plan = undefined;
494
524
  if (automatic?.kind === 'check' && this.plan) {
@@ -520,7 +550,6 @@ export class FactContinuations {
520
550
  this.queue('todos', { name: 'update_todos', arguments: { todos: todos.map(t => ids.includes(t.id) ? { ...t, status: 'completed' } : t) } }, noChecks ? this.taskNeedsChecksSource : this.verificationSource());
521
551
  }
522
552
  else {
523
- // Report what passed on the final workspace, not a compound command its parts superseded.
524
553
  const completion = { ...this.plan.completion, tests: [...this.checks.values()].filter(e => e.passed === true && e.pure && e.revision === this.revision).map(e => e.evidence) };
525
554
  this.queued = { id: randomUUID(), kind: 'complete', completion, permission: this.plan.permission, evidenceSource: noChecks ? this.taskNeedsChecksSource : this.verificationSource() };
526
555
  }
@@ -547,16 +576,19 @@ export class FactContinuations {
547
576
  this.nextNudge = 'after_failed_check';
548
577
  else if (!failed.length && wrote && !modelChecked && this.modelSawCheck)
549
578
  this.nextNudge = 'after_write';
579
+ // The model has run passing tests twice with no edit in between (typically the narrow test, then the
580
+ // wider one). A third run seldom adds anything, so say once that it can finish.
581
+ else if (!automatic && !failed.length && !wrote && modelPassed && !modelFailed && this.everWrote && this.passesSinceWrite >= 2
582
+ && this.passNudges < PASS_NUDGE_LIMIT && !this.constraints.noTests && !this.failedRuns.size
583
+ && ![...this.checks.values()].some(e => e.passed === false && e.revision === this.revision)) {
584
+ this.passNudges++;
585
+ this.nextNudge = 'after_passed_checks';
586
+ }
550
587
  }
551
- // After edits the model's next move is most often its own check again. Running it here costs
552
- // the check; having the model ask for it costs a whole turn. Only a check that was quick, in a
553
- // batch where the model did not already check, never twice for one state of the workspace, and
554
- // not while a todo was never started: the edit is then one step of several, and on real runs the
555
- // model went on writing twice as often as it checked.
556
588
  const follow = this.lastCheck;
557
589
  if (follow && !this.options.todos().some(t => t.status === 'pending' && !VERIFICATION_TODO.test(t.text)) && !this.taskUpdated && !failed.length && wrote && !modelChecked && !this.plan && !this.staged
558
590
  && this.syntheticCount < 3 && this.followUps < FOLLOW_UP_LIMIT && (follow.durationMs ?? 0) <= FOLLOW_UP_MAX_MS
559
- && !this.constraints.noChecks && !(this.constraints.noTests && checkKind(description(follow.call)) === 'test')) {
591
+ && !this.constraints.noChecks && !(this.constraints.noTests && (follow.test || checkKind(description(follow.call)) === 'test'))) {
560
592
  const key = `${this.revision}:${checkKey(follow.call)}`;
561
593
  if (!this.rechecked.has(key)) {
562
594
  this.rechecked.add(key);
@@ -564,7 +596,7 @@ export class FactContinuations {
564
596
  if (!isVerificationCheck(follow.call.name, this.options.catalog(follow.call.name)?.family, follow.call.arguments))
565
597
  this.declared.set(checkKey(follow.call), 'chain');
566
598
  this.nextNudge = undefined;
567
- this.queue('recheck', follow.call);
599
+ this.queue('recheck', follow.call, follow.source);
568
600
  return;
569
601
  }
570
602
  }
@@ -592,7 +624,6 @@ export class FactContinuations {
592
624
  queue(kind, tool, evidenceSource = 'deterministic') {
593
625
  this.queued = { id: randomUUID(), kind, tool: structuredClone(tool), permission: this.options.permission(), evidenceSource };
594
626
  }
595
- /** Called at the normal model boundary. Returning a value must not call the coding adapter. */
596
627
  take(allowedTools) {
597
628
  const next = this.queued;
598
629
  this.queued = undefined;
@@ -1,4 +1,3 @@
1
- /** A request-scoped circuit: errors never become answers, and an outage must not delay every turn. */
2
1
  export declare class FactServiceGate {
3
2
  private readonly now;
4
3
  private until;
@@ -1,4 +1,3 @@
1
- /** A request-scoped circuit: errors never become answers, and an outage must not delay every turn. */
2
1
  export class FactServiceGate {
3
2
  now;
4
3
  until = 0;
@@ -17,7 +16,6 @@ export class FactServiceGate {
17
16
  }
18
17
  get blockedReason() { return this.reason || 'decision_service_unavailable'; }
19
18
  success() {
20
- // An older concurrent success cannot reopen a circuit another request just tripped.
21
19
  if (this.until !== 0 && !this.probe)
22
20
  return;
23
21
  this.until = 0;
@@ -29,8 +27,6 @@ export class FactServiceGate {
29
27
  if (reason === 'cancelled' || reason === 'decision_input_too_large')
30
28
  return;
31
29
  this.reason = reason;
32
- // A new run gets a fresh gate. An unsupported protocol or rejected credentials cannot be
33
- // repaired by repeatedly issuing the same request inside the current run.
34
30
  this.until = ['decision_protocol_unsupported', 'authentication_required', 'decision_daily_limit_reached', 'decision_window_limit_reached', 'provider_unavailable'].includes(reason)
35
31
  ? Infinity : this.now() + 30_000;
36
32
  }
@@ -2,12 +2,6 @@ import type { Completion } from '../runtime.js';
2
2
  import type { ModelResponse, Tool } from '../types.js';
3
3
  import type { DecisionBatch, DecisionCandidate } from './types.js';
4
4
  export declare const PREPARE_STEPS = "prepare_steps";
5
- /**
6
- * A deterministic trigger: the step runs after the batch it followed without a decision request,
7
- * when that batch's outcome matches. `success` is every execution call succeeded; `failure` is at
8
- * least one failed; `always` is either. Only investigate and verify steps may declare one, and
9
- * every other restriction on automatic actions (catalog, approvals, limits) still applies.
10
- */
11
5
  export type PreparedTrigger = 'success' | 'failure' | 'always';
12
6
  export declare const PREPARED_TRIGGERS: readonly PreparedTrigger[];
13
7
  export interface PreparedStep extends DecisionCandidate {
@@ -19,9 +13,7 @@ export interface PreparedStep extends DecisionCandidate {
19
13
  when?: PreparedTrigger;
20
14
  }
21
15
  export interface PreparedStepsOptions {
22
- /** Accept `when` triggers; off keeps the shipped schema byte for byte. */
23
16
  continuations?: boolean;
24
- /** Preparation overhead, reported once per accepted call. */
25
17
  onDeclared?: (declared: {
26
18
  steps: number;
27
19
  chars: number;
@@ -29,20 +21,13 @@ export interface PreparedStepsOptions {
29
21
  }) => void;
30
22
  }
31
23
  export declare function boundedDecisionText(text: string, bytes: number): string;
32
- /** Deliberately narrower than tool families: no automatic retry of shell, browser or writes. */
33
24
  export declare function retrySafe(tool: Tool | undefined): boolean;
34
- /** Invocation-local concrete actions authored by the coding model; Jev may only select IDs. */
35
25
  export declare class PreparedSteps {
36
26
  private steps;
37
27
  clear(): void;
38
28
  candidates(): DecisionCandidate[];
39
29
  take(id: string): PreparedStep | undefined;
40
- /** How many steps are held; a cleared set reports zero. */
41
30
  get size(): number;
42
- /**
43
- * The first declared step whose trigger matches the batch outcome, removed from the set. The
44
- * declaration order is the model's preference order; no scoring happens here.
45
- */
46
31
  takeTriggered(outcome: 'success' | 'failure'): PreparedStep | undefined;
47
32
  tool(catalog: Tool[], options?: PreparedStepsOptions): Tool;
48
33
  }
@@ -5,8 +5,6 @@ export const PREPARE_STEPS = 'prepare_steps';
5
5
  export const PREPARED_TRIGGERS = ['success', 'failure', 'always'];
6
6
  const kinds = ['investigate', 'retry', 'change_strategy', 'verify', 'complete'];
7
7
  const triggerKinds = new Set(['investigate', 'verify']);
8
- // Landing or dropping a delegated change is a decision taken after reviewing it, so neither can be
9
- // prepared ahead and run before the review.
10
8
  const forbidden = new Set([PREPARE_STEPS, 'complete_agent', 'update_todos', 'ask_user', 'spawn_subagent', 'accept_change', 'discard_change', 'remove_untracked_file']);
11
9
  const object = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
12
10
  export function boundedDecisionText(text, bytes) {
@@ -21,12 +19,10 @@ export function boundedDecisionText(text, bytes) {
21
19
  }
22
20
  return result;
23
21
  }
24
- /** Deliberately narrower than tool families: no automatic retry of shell, browser or writes. */
25
22
  export function retrySafe(tool) {
26
23
  return !!tool && ['Read', 'Glob', 'Grep', 'read', 'ls', 'find', 'grep', 'read_file', 'list_files', 'search_files', 'repo_explore', 'memory_search', 'read_artifact', 'git_read'].includes(tool.name)
27
24
  && (!tool.capability || tool.capability === 'git.read' || tool.capability === 'github.read');
28
25
  }
29
- /** Invocation-local concrete actions authored by the coding model; Jev may only select IDs. */
30
26
  export class PreparedSteps {
31
27
  steps = [];
32
28
  clear() { this.steps = []; }
@@ -35,7 +31,6 @@ export class PreparedSteps {
35
31
  const description = step.completion
36
32
  ? JSON.stringify({ condition: step.description, proposedAnswer: { ...step.completion, tests: [] } })
37
33
  : JSON.stringify({ condition: step.description, tool: step.tool.name });
38
- // Completion selection must see the entire proposed answer, never just its author's label.
39
34
  const redacted = redactSecrets(description).text;
40
35
  if (step.completion && (redacted !== description || Buffer.byteLength(description) > 512))
41
36
  return [];
@@ -47,12 +42,7 @@ export class PreparedSteps {
47
42
  this.steps = this.steps.filter(item => item.id !== id);
48
43
  return step;
49
44
  }
50
- /** How many steps are held; a cleared set reports zero. */
51
45
  get size() { return this.steps.length; }
52
- /**
53
- * The first declared step whose trigger matches the batch outcome, removed from the set. The
54
- * declaration order is the model's preference order; no scoring happens here.
55
- */
56
46
  takeTriggered(outcome) {
57
47
  const step = this.steps.find(item => item.when !== undefined && (item.when === 'always' || item.when === outcome));
58
48
  if (!step)
@@ -1,3 +1,2 @@
1
1
  import type { HardenedRunOptions } from '../react-runtime.js';
2
- /** Optional boundary optimization; the existing executor still owns every permission and call. */
3
2
  export declare function applyToolMenu(options: HardenedRunOptions): Promise<HardenedRunOptions>;
@@ -2,7 +2,6 @@ import { createHash, randomUUID } from 'node:crypto';
2
2
  import { toolFamily } from './toolFamilies.js';
3
3
  import { clipFactText } from './facts.js';
4
4
  import { selectToolMenu } from './toolMenu.js';
5
- /** Optional boundary optimization; the existing executor still owns every permission and call. */
6
5
  export async function applyToolMenu(options) {
7
6
  const mode = options.efficiency?.toolMenuRouting?.mode ?? 'off';
8
7
  const manager = options.decisionManager;
@@ -23,7 +22,7 @@ export async function applyToolMenu(options) {
23
22
  try {
24
23
  await options.onEvent?.({ type: 'efficiency.tool_menu', time: new Date().toISOString(), data: { ...identity, mode, ...data } });
25
24
  }
26
- catch { /* Optional optimization telemetry cannot change execution. */ }
25
+ catch { }
27
26
  };
28
27
  try {
29
28
  const selected = await selectToolMenu({
@@ -34,7 +33,6 @@ export async function applyToolMenu(options) {
34
33
  signal, fresh: () => permission() === permittedUnder && control?.revision === revision,
35
34
  classify: (request, aborted) => manager.toolMenu(request, identity, aborted, options.onEvent),
36
35
  });
37
- // Do not add an awaited telemetry gap after the final freshness check.
38
36
  options.context.signal.throwIfAborted();
39
37
  if (pause?.aborted || permission() !== permittedUnder || control?.revision !== revision)
40
38
  return options;
@@ -44,8 +42,6 @@ export async function applyToolMenu(options) {
44
42
  if (!selected.omitted.length)
45
43
  return options;
46
44
  const kept = new Set(selected.tools.map(tool => tool.name));
47
- // Preserve the exact Tool objects and current narrowed definitions. Never replace a tool
48
- // with an older, wider descriptor merely because that descriptor exists in recoverTools.
49
45
  const recover = new Map((options.recoverTools ?? []).map(tool => [tool.name, tool]));
50
46
  for (const tool of options.tools)
51
47
  recover.set(tool.name, tool);