@andorra-labs/code 0.1.11 → 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 (614) hide show
  1. package/README.md +8 -2
  2. package/THIRD_PARTY_NOTICES.md +15 -0
  3. package/dist/src/account-presentation.d.ts +1 -37
  4. package/dist/src/account-presentation.js +2 -42
  5. package/dist/src/activity.d.ts +0 -25
  6. package/dist/src/activity.js +1 -23
  7. package/dist/src/agent-definitions.d.ts +0 -26
  8. package/dist/src/agent-definitions.js +0 -43
  9. package/dist/src/agent-execution.d.ts +0 -2
  10. package/dist/src/agent-execution.js +59 -414
  11. package/dist/src/agent-mcp-catalog.d.ts +0 -8
  12. package/dist/src/agent-mcp-catalog.js +0 -2
  13. package/dist/src/agent-mcp.d.ts +0 -56
  14. package/dist/src/agent-mcp.js +14 -153
  15. package/dist/src/agent-modifiers.d.ts +0 -1
  16. package/dist/src/agent-modifiers.js +25 -68
  17. package/dist/src/analytics.d.ts +0 -66
  18. package/dist/src/analytics.js +0 -45
  19. package/dist/src/anthropic-console-auth.d.ts +0 -24
  20. package/dist/src/anthropic-console-auth.js +0 -37
  21. package/dist/src/anthropic-credentials.d.ts +0 -25
  22. package/dist/src/anthropic-credentials.js +0 -28
  23. package/dist/src/app-server/protocol.d.ts +19 -244
  24. package/dist/src/app-server/protocol.js +1 -132
  25. package/dist/src/app-server/reasoning.d.ts +0 -31
  26. package/dist/src/app-server/reasoning.js +0 -54
  27. package/dist/src/app-server/terminal.d.ts +0 -36
  28. package/dist/src/app-server/terminal.js +3 -39
  29. package/dist/src/app-server/workspace.d.ts +0 -167
  30. package/dist/src/app-server/workspace.js +4 -406
  31. package/dist/src/app-server.d.ts +33 -918
  32. package/dist/src/app-server.js +608 -2984
  33. package/dist/src/artifacts.d.ts +0 -10
  34. package/dist/src/artifacts.js +1 -11
  35. package/dist/src/attachments.d.ts +4 -98
  36. package/dist/src/attachments.js +10 -130
  37. package/dist/src/auth/AuthManager.d.ts +0 -93
  38. package/dist/src/auth/AuthManager.js +3 -165
  39. package/dist/src/auth/callback-page.d.ts +0 -1
  40. package/dist/src/auth/callback-page.js +0 -4
  41. package/dist/src/auth/callback.d.ts +0 -25
  42. package/dist/src/auth/callback.js +1 -29
  43. package/dist/src/auth/deployment.d.ts +0 -16
  44. package/dist/src/auth/deployment.js +0 -16
  45. package/dist/src/auth/index.d.ts +0 -11
  46. package/dist/src/auth/index.js +0 -11
  47. package/dist/src/auth/lock.d.ts +0 -1
  48. package/dist/src/auth/lock.js +0 -1
  49. package/dist/src/auth/store.d.ts +7 -108
  50. package/dist/src/auth/store.js +21 -129
  51. package/dist/src/auth/types.d.ts +0 -8
  52. package/dist/src/auth-commands.d.ts +0 -5
  53. package/dist/src/auth-commands.js +0 -1
  54. package/dist/src/automation-runner.d.ts +0 -9
  55. package/dist/src/automation-runner.js +0 -11
  56. package/dist/src/automation-service.d.ts +0 -10
  57. package/dist/src/automation-service.js +3 -17
  58. package/dist/src/automation-tool.js +0 -5
  59. package/dist/src/automation-worker-shutdown.d.ts +0 -1
  60. package/dist/src/automation-worker-shutdown.js +0 -3
  61. package/dist/src/automations.d.ts +23 -2
  62. package/dist/src/automations.js +91 -12
  63. package/dist/src/background-tasks.d.ts +0 -23
  64. package/dist/src/background-tasks.js +0 -11
  65. package/dist/src/boot-trace.d.ts +0 -13
  66. package/dist/src/boot-trace.js +1 -14
  67. package/dist/src/browser-activity.js +0 -2
  68. package/dist/src/browser-bridge.d.ts +0 -2
  69. package/dist/src/browser-bridge.js +0 -27
  70. package/dist/src/browser-captcha-tool.d.ts +0 -13
  71. package/dist/src/browser-captcha-tool.js +3 -35
  72. package/dist/src/browser-extensions-tool.d.ts +24 -0
  73. package/dist/src/browser-extensions-tool.js +137 -0
  74. package/dist/src/browser-extensions.d.ts +127 -0
  75. package/dist/src/browser-extensions.js +729 -0
  76. package/dist/src/browser-observation.d.ts +0 -15
  77. package/dist/src/browser-observation.js +1 -22
  78. package/dist/src/browser-panel-tool.d.ts +10 -25
  79. package/dist/src/browser-panel-tool.js +64 -60
  80. package/dist/src/browser-runner.d.ts +0 -1
  81. package/dist/src/browser-runner.js +7 -46
  82. package/dist/src/browser-server.d.ts +0 -6
  83. package/dist/src/browser-server.js +6 -229
  84. package/dist/src/browser-session.d.ts +0 -25
  85. package/dist/src/browser-session.js +1 -71
  86. package/dist/src/browser-stealth.d.ts +0 -12
  87. package/dist/src/browser-stealth.js +0 -36
  88. package/dist/src/browser-ui/app.js +7 -174
  89. package/dist/src/browser-ui/style.css +0 -68
  90. package/dist/src/browser-ui/tokens.css +11 -93
  91. package/dist/src/browser-view.d.ts +52 -290
  92. package/dist/src/browser-view.js +354 -567
  93. package/dist/src/capabilities.d.ts +0 -8
  94. package/dist/src/capabilities.js +0 -29
  95. package/dist/src/capsolver.d.ts +0 -13
  96. package/dist/src/capsolver.js +0 -15
  97. package/dist/src/clarification-ui.d.ts +0 -7
  98. package/dist/src/clarification-ui.js +0 -8
  99. package/dist/src/claude-executable.d.ts +0 -1
  100. package/dist/src/claude-executable.js +1 -2
  101. package/dist/src/claude-provider.d.ts +6 -19
  102. package/dist/src/claude-provider.js +166 -61
  103. package/dist/src/cli-executable.d.ts +0 -16
  104. package/dist/src/cli-executable.js +0 -7
  105. package/dist/src/cli-process.d.ts +0 -26
  106. package/dist/src/cli-process.js +0 -18
  107. package/dist/src/cli-sign-in.d.ts +0 -20
  108. package/dist/src/cli-sign-in.js +1 -17
  109. package/dist/src/cli.d.ts +3 -56
  110. package/dist/src/cli.js +193 -702
  111. package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
  112. package/dist/src/code-intelligence/CodeIntelligenceManager.js +27 -100
  113. package/dist/src/code-intelligence/ContextLedger.d.ts +0 -4
  114. package/dist/src/code-intelligence/ContextLedger.js +0 -10
  115. package/dist/src/code-intelligence/ContextRouter.d.ts +0 -6
  116. package/dist/src/code-intelligence/ContextRouter.js +0 -8
  117. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +0 -2
  118. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +5 -12
  119. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +0 -6
  120. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +0 -6
  121. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +0 -5
  122. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +1 -17
  123. package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +0 -5
  124. package/dist/src/code-intelligence/codegraph/repoExploreTool.js +0 -5
  125. package/dist/src/code-intelligence/repository.d.ts +0 -9
  126. package/dist/src/code-intelligence/repository.js +1 -11
  127. package/dist/src/code-intelligence/types.d.ts +0 -8
  128. package/dist/src/codex-auth.d.ts +0 -44
  129. package/dist/src/codex-auth.js +0 -45
  130. package/dist/src/codex-browser-auth.d.ts +0 -13
  131. package/dist/src/codex-browser-auth.js +3 -20
  132. package/dist/src/codex-errors.js +0 -2
  133. package/dist/src/codex-executable.d.ts +0 -2
  134. package/dist/src/codex-executable.js +1 -7
  135. package/dist/src/codex-provider.d.ts +0 -13
  136. package/dist/src/codex-provider.js +1 -26
  137. package/dist/src/codex-rpc.d.ts +0 -10
  138. package/dist/src/codex-rpc.js +0 -12
  139. package/dist/src/coding-tools.d.ts +6 -27
  140. package/dist/src/coding-tools.js +193 -205
  141. package/dist/src/command-metrics.d.ts +0 -4
  142. package/dist/src/command-output-tap.d.ts +0 -11
  143. package/dist/src/command-output-tap.js +0 -3
  144. package/dist/src/command-screens.d.ts +24 -0
  145. package/dist/src/command-screens.js +132 -100
  146. package/dist/src/commands.d.ts +6 -63
  147. package/dist/src/commands.js +20 -100
  148. package/dist/src/completion-gates.d.ts +0 -47
  149. package/dist/src/completion-gates.js +0 -14
  150. package/dist/src/completion.d.ts +2 -58
  151. package/dist/src/completion.js +90 -186
  152. package/dist/src/config.d.ts +12 -116
  153. package/dist/src/config.js +41 -171
  154. package/dist/src/context-budget.d.ts +0 -22
  155. package/dist/src/context-budget.js +0 -44
  156. package/dist/src/context-compaction.d.ts +29 -6
  157. package/dist/src/context-compaction.js +94 -25
  158. package/dist/src/context-selection.d.ts +0 -24
  159. package/dist/src/context-selection.js +0 -34
  160. package/dist/src/dashboard-view.d.ts +0 -2
  161. package/dist/src/dashboard-view.js +0 -35
  162. package/dist/src/dashboard.d.ts +0 -2
  163. package/dist/src/dashboard.js +0 -9
  164. package/dist/src/deadline.d.ts +0 -45
  165. package/dist/src/deadline.js +0 -54
  166. package/dist/src/decision/ContinuationAdapter.d.ts +0 -5
  167. package/dist/src/decision/ContinuationAdapter.js +0 -5
  168. package/dist/src/decision/DecisionEngine.d.ts +0 -4
  169. package/dist/src/decision/DecisionManager.d.ts +0 -1
  170. package/dist/src/decision/DecisionManager.js +2 -7
  171. package/dist/src/decision/DecisionPolicy.d.ts +0 -1
  172. package/dist/src/decision/DecisionPolicy.js +0 -1
  173. package/dist/src/decision/FactContinuations.d.ts +11 -43
  174. package/dist/src/decision/FactContinuations.js +126 -95
  175. package/dist/src/decision/FactServiceGate.d.ts +0 -1
  176. package/dist/src/decision/FactServiceGate.js +0 -4
  177. package/dist/src/decision/PreparedSteps.d.ts +0 -15
  178. package/dist/src/decision/PreparedSteps.js +1 -11
  179. package/dist/src/decision/applyToolMenu.d.ts +0 -1
  180. package/dist/src/decision/applyToolMenu.js +1 -5
  181. package/dist/src/decision/checks.d.ts +15 -28
  182. package/dist/src/decision/checks.js +118 -49
  183. package/dist/src/decision/facts.d.ts +0 -16
  184. package/dist/src/decision/facts.js +0 -30
  185. package/dist/src/decision/guidancePolicy.js +0 -1
  186. package/dist/src/decision/hostedPolicy.d.ts +0 -6
  187. package/dist/src/decision/hostedPolicy.js +0 -7
  188. package/dist/src/decision/hostedSkills.d.ts +0 -19
  189. package/dist/src/decision/hostedSkills.js +0 -19
  190. package/dist/src/decision/optimizationPolicy.d.ts +0 -3
  191. package/dist/src/decision/optimizationPolicy.js +1 -4
  192. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +0 -7
  193. package/dist/src/decision/providers/AndorraDecisionProvider.js +4 -27
  194. package/dist/src/decision/providers/HttpDecisionProvider.d.ts +0 -2
  195. package/dist/src/decision/providers/HttpDecisionProvider.js +0 -6
  196. package/dist/src/decision/routeTools.d.ts +0 -8
  197. package/dist/src/decision/routeTools.js +1 -8
  198. package/dist/src/decision/toolFamilies.d.ts +0 -1
  199. package/dist/src/decision/toolFamilies.js +0 -1
  200. package/dist/src/decision/toolMenu.d.ts +0 -3
  201. package/dist/src/decision/toolMenu.js +0 -4
  202. package/dist/src/decision/types.d.ts +0 -6
  203. package/dist/src/default-graph.d.ts +0 -9
  204. package/dist/src/default-graph.js +0 -9
  205. package/dist/src/delegation-changes.d.ts +0 -56
  206. package/dist/src/delegation-changes.js +15 -124
  207. package/dist/src/diff-preview.d.ts +1 -1
  208. package/dist/src/diff-preview.js +4 -12
  209. package/dist/src/duration.d.ts +0 -50
  210. package/dist/src/duration.js +0 -50
  211. package/dist/src/efficiency.d.ts +0 -39
  212. package/dist/src/efficiency.js +0 -16
  213. package/dist/src/engine/protocol.d.ts +0 -2
  214. package/dist/src/engine/protocol.js +0 -2
  215. package/dist/src/engine-streams.d.ts +13 -0
  216. package/dist/src/engine-streams.js +16 -0
  217. package/dist/src/extensions.d.ts +3 -2
  218. package/dist/src/extensions.js +76 -37
  219. package/dist/src/favicons.d.ts +0 -26
  220. package/dist/src/favicons.js +0 -34
  221. package/dist/src/file-diff.d.ts +2 -58
  222. package/dist/src/file-diff.js +0 -32
  223. package/dist/src/file-read-key.d.ts +1 -0
  224. package/dist/src/file-read-key.js +5 -0
  225. package/dist/src/file-read-state.d.ts +0 -1
  226. package/dist/src/file-read-state.js +0 -4
  227. package/dist/src/firefox-cookies.d.ts +0 -34
  228. package/dist/src/firefox-cookies.js +1 -55
  229. package/dist/src/git-identity-audit.d.ts +27 -0
  230. package/dist/src/git-identity-audit.js +286 -0
  231. package/dist/src/git-identity-guard.d.ts +4 -0
  232. package/dist/src/git-identity-guard.js +998 -0
  233. package/dist/src/git-identity-hold.d.ts +12 -0
  234. package/dist/src/git-identity-hold.js +81 -0
  235. package/dist/src/git-summary.d.ts +0 -58
  236. package/dist/src/git-summary.js +2 -212
  237. package/dist/src/goal-completion-verification.d.ts +2 -2
  238. package/dist/src/goal-completion-verification.js +3 -6
  239. package/dist/src/graph-account.d.ts +0 -21
  240. package/dist/src/graph-account.js +0 -17
  241. package/dist/src/graph-editor-session.d.ts +0 -1
  242. package/dist/src/graph-editor-session.js +1 -3
  243. package/dist/src/graph-health.d.ts +7 -49
  244. package/dist/src/graph-health.js +35 -46
  245. package/dist/src/graph-manager-chat.d.ts +27 -128
  246. package/dist/src/graph-manager-chat.js +36 -166
  247. package/dist/src/graph-provider-portability.d.ts +1 -21
  248. package/dist/src/graph-provider-portability.js +6 -45
  249. package/dist/src/graph-quota.d.ts +0 -33
  250. package/dist/src/graph-quota.js +1 -44
  251. package/dist/src/graph-runner.d.ts +0 -1
  252. package/dist/src/graph-runner.js +47 -387
  253. package/dist/src/graph-selection.d.ts +0 -14
  254. package/dist/src/graph-selection.js +0 -14
  255. package/dist/src/graph-server.d.ts +3 -11
  256. package/dist/src/graph-server.js +70 -111
  257. package/dist/src/graph-studio-features.d.ts +0 -5
  258. package/dist/src/graph-studio-features.js +2 -42
  259. package/dist/src/graph-sync.d.ts +0 -78
  260. package/dist/src/graph-sync.js +5 -201
  261. package/dist/src/graph-tool.d.ts +0 -18
  262. package/dist/src/graph-tool.js +0 -27
  263. package/dist/src/graph-ui/app.js +229 -498
  264. package/dist/src/graph-ui/compat.js +0 -7
  265. package/dist/src/graph-ui/controls.css +47 -43
  266. package/dist/src/graph-ui/controls.js +0 -88
  267. package/dist/src/graph-ui/drafts.js +0 -12
  268. package/dist/src/graph-ui/edge-router.js +0 -62
  269. package/dist/src/graph-ui/embed.js +0 -59
  270. package/dist/src/graph-ui/icons.js +2 -7
  271. package/dist/src/graph-ui/index.html +2 -2
  272. package/dist/src/graph-ui/library.css +0 -5
  273. package/dist/src/graph-ui/manager-markdown.js +0 -11
  274. package/dist/src/graph-ui/manager-state.js +110 -49
  275. package/dist/src/graph-ui/manager.css +2 -20
  276. package/dist/src/graph-ui/manager.js +251 -166
  277. package/dist/src/graph-ui/model-picker.js +250 -0
  278. package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
  279. package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
  280. package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
  281. package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
  282. package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
  283. package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
  284. package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
  285. package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
  286. package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
  287. package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
  288. package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
  289. package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
  290. package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
  291. package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
  292. package/dist/src/graph-ui/sidebar.js +2 -3
  293. package/dist/src/graph-ui/skill-picker.js +373 -39
  294. package/dist/src/graph-ui/studio-canvas.js +3 -38
  295. package/dist/src/graph-ui/studio.css +0 -18
  296. package/dist/src/graph-ui/studio.js +3 -71
  297. package/dist/src/graph-ui/style.css +11 -134
  298. package/dist/src/graph-ui/theme.js +1 -26
  299. package/dist/src/graph-ui/tokens.css +15 -114
  300. package/dist/src/graphs.d.ts +7 -156
  301. package/dist/src/graphs.js +72 -273
  302. package/dist/src/grep-regex-worker.js +0 -2
  303. package/dist/src/grep-regex.d.ts +1 -5
  304. package/dist/src/grep-regex.js +6 -8
  305. package/dist/src/grok-provider.d.ts +0 -17
  306. package/dist/src/grok-provider.js +1 -26
  307. package/dist/src/handoffs.d.ts +0 -11
  308. package/dist/src/handoffs.js +0 -13
  309. package/dist/src/hardened-runtime.d.ts +0 -10
  310. package/dist/src/hardened-runtime.js +8 -46
  311. package/dist/src/harness-home.d.ts +21 -0
  312. package/dist/src/harness-home.js +87 -0
  313. package/dist/src/host-process-guard.d.ts +0 -50
  314. package/dist/src/host-process-guard.js +0 -641
  315. package/dist/src/limits.d.ts +0 -64
  316. package/dist/src/limits.js +0 -62
  317. package/dist/src/managed-sign-in.d.ts +0 -12
  318. package/dist/src/managed-sign-in.js +0 -16
  319. package/dist/src/markdown.d.ts +0 -28
  320. package/dist/src/markdown.js +1 -175
  321. package/dist/src/mcp.d.ts +21 -82
  322. package/dist/src/mcp.js +228 -237
  323. package/dist/src/membership-errors.d.ts +0 -14
  324. package/dist/src/membership-errors.js +0 -13
  325. package/dist/src/membership.d.ts +2 -60
  326. package/dist/src/membership.js +0 -85
  327. package/dist/src/memory/LocalToolMemory.d.ts +0 -1
  328. package/dist/src/memory/LocalToolMemory.js +2 -7
  329. package/dist/src/memory/MemoryDistiller.js +0 -15
  330. package/dist/src/memory/MemoryManager.d.ts +0 -3
  331. package/dist/src/memory/MemoryManager.js +6 -18
  332. package/dist/src/memory/MemoryPolicy.d.ts +0 -2
  333. package/dist/src/memory/MemoryPolicy.js +0 -2
  334. package/dist/src/memory/MemoryProvider.d.ts +0 -6
  335. package/dist/src/memory/MemoryRetriever.js +0 -7
  336. package/dist/src/memory/PermissionMemoryProvider.d.ts +0 -1
  337. package/dist/src/memory/PermissionMemoryProvider.js +0 -1
  338. package/dist/src/memory/ProjectMemory.d.ts +42 -0
  339. package/dist/src/memory/ProjectMemory.js +285 -0
  340. package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
  341. package/dist/src/memory/ToolFailureLessons.js +0 -6
  342. package/dist/src/memory/index.d.ts +1 -0
  343. package/dist/src/memory/index.js +1 -0
  344. package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +0 -1
  345. package/dist/src/memory/providers/NoOpMemoryProvider.js +0 -1
  346. package/dist/src/memory/redaction.d.ts +0 -5
  347. package/dist/src/memory/redaction.js +0 -11
  348. package/dist/src/memory/repository.d.ts +0 -6
  349. package/dist/src/memory/repository.js +2 -12
  350. package/dist/src/memory/types.d.ts +0 -1
  351. package/dist/src/model-health-cache.d.ts +0 -38
  352. package/dist/src/model-health-cache.js +1 -49
  353. package/dist/src/model-metadata.d.ts +0 -18
  354. package/dist/src/model-metadata.js +2 -42
  355. package/dist/src/model-override.d.ts +0 -36
  356. package/dist/src/model-override.js +0 -43
  357. package/dist/src/model-tiers.d.ts +0 -13
  358. package/dist/src/model-tiers.js +0 -23
  359. package/dist/src/opencode-catalog.d.ts +0 -2
  360. package/dist/src/opencode-catalog.js +0 -11
  361. package/dist/src/opencode-cli-provider.d.ts +0 -35
  362. package/dist/src/opencode-cli-provider.js +1 -44
  363. package/dist/src/opencode-provider.d.ts +0 -2
  364. package/dist/src/opencode-provider.js +6 -22
  365. package/dist/src/package-name.d.ts +1 -0
  366. package/dist/src/package-name.js +1 -0
  367. package/dist/src/paged-transcript.d.ts +0 -11
  368. package/dist/src/paged-transcript.js +2 -20
  369. package/dist/src/palette.d.ts +0 -63
  370. package/dist/src/palette.js +0 -63
  371. package/dist/src/permissions.d.ts +0 -15
  372. package/dist/src/permissions.js +0 -17
  373. package/dist/src/powershell-pool.d.ts +0 -9
  374. package/dist/src/powershell-pool.js +3 -26
  375. package/dist/src/process-warnings.d.ts +4 -0
  376. package/dist/src/process-warnings.js +103 -0
  377. package/dist/src/profile.d.ts +0 -43
  378. package/dist/src/profile.js +0 -43
  379. package/dist/src/project-reservation.d.ts +11 -0
  380. package/dist/src/project-reservation.js +143 -0
  381. package/dist/src/provider-connection.d.ts +0 -18
  382. package/dist/src/provider-connection.js +0 -39
  383. package/dist/src/provider-engine.d.ts +0 -21
  384. package/dist/src/provider-engine.js +3 -98
  385. package/dist/src/provider-import.d.ts +0 -49
  386. package/dist/src/provider-import.js +0 -60
  387. package/dist/src/provider-keys.d.ts +1 -36
  388. package/dist/src/provider-keys.js +5 -48
  389. package/dist/src/provider-settings.d.ts +0 -2
  390. package/dist/src/provider-settings.js +0 -32
  391. package/dist/src/providers.d.ts +0 -217
  392. package/dist/src/providers.js +0 -315
  393. package/dist/src/pull-requests.d.ts +0 -173
  394. package/dist/src/pull-requests.js +5 -195
  395. package/dist/src/qa/browser/PlaywrightRunner.d.ts +0 -7
  396. package/dist/src/qa/browser/PlaywrightRunner.js +2 -16
  397. package/dist/src/qa/command-policy.d.ts +0 -23
  398. package/dist/src/qa/command-policy.js +0 -30
  399. package/dist/src/qa/guidance.d.ts +0 -21
  400. package/dist/src/qa/guidance.js +0 -20
  401. package/dist/src/qa/profile/ProjectInspector.d.ts +0 -4
  402. package/dist/src/qa/profile/ProjectInspector.js +0 -6
  403. package/dist/src/qa/profile/QaConfigLoader.d.ts +0 -7
  404. package/dist/src/qa/profile/QaConfigLoader.js +0 -6
  405. package/dist/src/qa/profile/QaProfile.d.ts +0 -7
  406. package/dist/src/qa/profile/QaProfile.js +0 -7
  407. package/dist/src/qa/profile/yaml.d.ts +0 -9
  408. package/dist/src/qa/profile/yaml.js +0 -13
  409. package/dist/src/qa/qa-authorize.d.ts +0 -19
  410. package/dist/src/qa/qa-authorize.js +4 -11
  411. package/dist/src/qa/runtime/ProcessManager.d.ts +0 -31
  412. package/dist/src/qa/runtime/ProcessManager.js +4 -41
  413. package/dist/src/qa/runtime/PtyManager.d.ts +0 -4
  414. package/dist/src/qa/runtime/PtyManager.js +2 -7
  415. package/dist/src/qa/runtime/changes.d.ts +0 -11
  416. package/dist/src/qa/runtime/changes.js +1 -3
  417. package/dist/src/qa/tools.d.ts +0 -10
  418. package/dist/src/qa/tools.js +0 -12
  419. package/dist/src/qa/types.d.ts +0 -13
  420. package/dist/src/react-runtime.d.ts +2 -21
  421. package/dist/src/react-runtime.js +106 -418
  422. package/dist/src/read-document-doc.d.ts +0 -6
  423. package/dist/src/read-document-doc.js +0 -55
  424. package/dist/src/read-document-docx.d.ts +0 -16
  425. package/dist/src/read-document-docx.js +2 -69
  426. package/dist/src/read-document-text.d.ts +0 -17
  427. package/dist/src/read-document-text.js +0 -22
  428. package/dist/src/read-document-tool.d.ts +0 -31
  429. package/dist/src/read-document-tool.js +0 -30
  430. package/dist/src/read-document.d.ts +0 -49
  431. package/dist/src/read-document.js +1 -67
  432. package/dist/src/read-image.d.ts +0 -32
  433. package/dist/src/read-image.js +0 -33
  434. package/dist/src/remote/cert.d.ts +1 -19
  435. package/dist/src/remote/cert.js +2 -51
  436. package/dist/src/remote/client.d.ts +0 -70
  437. package/dist/src/remote/client.js +2 -117
  438. package/dist/src/remote/command.js +0 -17
  439. package/dist/src/remote/engine-pool.d.ts +0 -152
  440. package/dist/src/remote/engine-pool.js +17 -335
  441. package/dist/src/remote/errors.d.ts +0 -15
  442. package/dist/src/remote/errors.js +0 -7
  443. package/dist/src/remote/network.d.ts +0 -26
  444. package/dist/src/remote/network.js +1 -34
  445. package/dist/src/remote/pairing.d.ts +16 -51
  446. package/dist/src/remote/pairing.js +50 -57
  447. package/dist/src/remote/pem.d.ts +2 -0
  448. package/dist/src/remote/pem.js +7 -0
  449. package/dist/src/remote/roots.d.ts +0 -20
  450. package/dist/src/remote/roots.js +0 -8
  451. package/dist/src/remote/serve.d.ts +0 -47
  452. package/dist/src/remote/serve.js +0 -30
  453. package/dist/src/remote/server.d.ts +0 -14
  454. package/dist/src/remote/server.js +1 -79
  455. package/dist/src/remote/types.d.ts +1 -32
  456. package/dist/src/remote/types.js +0 -10
  457. package/dist/src/run-control.d.ts +0 -7
  458. package/dist/src/run-control.js +0 -7
  459. package/dist/src/run-progress.d.ts +0 -170
  460. package/dist/src/run-progress.js +0 -285
  461. package/dist/src/run-records.d.ts +0 -443
  462. package/dist/src/run-records.js +44 -678
  463. package/dist/src/run-temp.d.ts +12 -0
  464. package/dist/src/run-temp.js +50 -0
  465. package/dist/src/runtime.d.ts +11 -227
  466. package/dist/src/runtime.js +0 -127
  467. package/dist/src/sandbox-child.js +0 -1
  468. package/dist/src/save-lock.d.ts +0 -12
  469. package/dist/src/save-lock.js +0 -28
  470. package/dist/src/screen-selection.d.ts +0 -23
  471. package/dist/src/screen-selection.js +0 -22
  472. package/dist/src/secret-redaction.d.ts +0 -12
  473. package/dist/src/secret-redaction.js +0 -45
  474. package/dist/src/session-changes.d.ts +4 -80
  475. package/dist/src/session-changes.js +25 -130
  476. package/dist/src/session-goal.d.ts +129 -0
  477. package/dist/src/session-goal.js +230 -0
  478. package/dist/src/session-monitor.d.ts +1 -10
  479. package/dist/src/session-monitor.js +2 -39
  480. package/dist/src/session-reaper.d.ts +0 -15
  481. package/dist/src/session-reaper.js +0 -14
  482. package/dist/src/session-skills.d.ts +15 -44
  483. package/dist/src/session-skills.js +75 -60
  484. package/dist/src/session-summary.d.ts +0 -26
  485. package/dist/src/session-summary.js +0 -32
  486. package/dist/src/session-title.d.ts +0 -1
  487. package/dist/src/session-title.js +0 -2
  488. package/dist/src/sessions.d.ts +2 -120
  489. package/dist/src/sessions.js +9 -178
  490. package/dist/src/shell.d.ts +3 -20
  491. package/dist/src/shell.js +8 -72
  492. package/dist/src/side-panel.d.ts +5 -99
  493. package/dist/src/side-panel.js +76 -133
  494. package/dist/src/sign-in-detection.d.ts +43 -0
  495. package/dist/src/sign-in-detection.js +154 -0
  496. package/dist/src/sign-in-offer.d.ts +17 -0
  497. package/dist/src/sign-in-offer.js +103 -0
  498. package/dist/src/skill-commands.d.ts +0 -1
  499. package/dist/src/skill-commands.js +1 -4
  500. package/dist/src/skills/bundled/control-browser/SKILL.md +1 -1
  501. package/dist/src/skills/bundled/graph-manager/SKILL.md +22 -4
  502. package/dist/src/skills/bundled/provenance.json +2 -2
  503. package/dist/src/skills/invocable-skills.d.ts +0 -18
  504. package/dist/src/skills/invocable-skills.js +0 -17
  505. package/dist/src/skills/project-skills.d.ts +0 -1
  506. package/dist/src/skills/project-skills.js +0 -3
  507. package/dist/src/skills/prompt-skills.js +0 -14
  508. package/dist/src/skills/runtime-skills.d.ts +1 -8
  509. package/dist/src/skills/runtime-skills.js +8 -32
  510. package/dist/src/stall-recovery.d.ts +0 -25
  511. package/dist/src/stall-recovery.js +0 -38
  512. package/dist/src/stray-files.d.ts +5 -0
  513. package/dist/src/stray-files.js +65 -0
  514. package/dist/src/structured-step.d.ts +0 -22
  515. package/dist/src/structured-step.js +0 -22
  516. package/dist/src/subagent-run.d.ts +0 -163
  517. package/dist/src/subagent-run.js +10 -374
  518. package/dist/src/subagent-tree.d.ts +32 -0
  519. package/dist/src/subagent-tree.js +128 -0
  520. package/dist/src/telemetry/aggregate.d.ts +0 -37
  521. package/dist/src/telemetry/aggregate.js +0 -40
  522. package/dist/src/telemetry/capture-core.d.ts +0 -87
  523. package/dist/src/telemetry/capture-core.js +0 -67
  524. package/dist/src/telemetry/capture.d.ts +0 -1
  525. package/dist/src/telemetry/capture.js +0 -3
  526. package/dist/src/telemetry/classify.d.ts +0 -58
  527. package/dist/src/telemetry/classify.js +0 -60
  528. package/dist/src/telemetry/decision-capture.d.ts +0 -1
  529. package/dist/src/telemetry/emitter.d.ts +0 -30
  530. package/dist/src/telemetry/emitter.js +1 -62
  531. package/dist/src/telemetry/gate.d.ts +0 -29
  532. package/dist/src/telemetry/gate.js +0 -22
  533. package/dist/src/telemetry/identity.d.ts +0 -13
  534. package/dist/src/telemetry/identity.js +0 -29
  535. package/dist/src/telemetry/outbox.d.ts +0 -64
  536. package/dist/src/telemetry/outbox.js +1 -108
  537. package/dist/src/telemetry/schema.d.ts +1 -49
  538. package/dist/src/telemetry/schema.js +1 -82
  539. package/dist/src/telemetry/state.d.ts +0 -53
  540. package/dist/src/telemetry/state.js +0 -64
  541. package/dist/src/telemetry/surface.d.ts +0 -31
  542. package/dist/src/telemetry/surface.js +1 -39
  543. package/dist/src/telemetry/uploader.d.ts +0 -11
  544. package/dist/src/telemetry/uploader.js +0 -46
  545. package/dist/src/telemetry/uploads.d.ts +0 -11
  546. package/dist/src/telemetry/uploads.js +0 -11
  547. package/dist/src/telemetry/version.d.ts +0 -4
  548. package/dist/src/telemetry/version.js +0 -14
  549. package/dist/src/telemetry/workspace.d.ts +0 -7
  550. package/dist/src/telemetry/workspace.js +1 -22
  551. package/dist/src/terminal-ui.d.ts +15 -524
  552. package/dist/src/terminal-ui.js +80 -876
  553. package/dist/src/test-edit-guard.d.ts +74 -0
  554. package/dist/src/test-edit-guard.js +269 -0
  555. package/dist/src/text.d.ts +0 -1
  556. package/dist/src/text.js +0 -1
  557. package/dist/src/time-limit.d.ts +0 -36
  558. package/dist/src/time-limit.js +0 -37
  559. package/dist/src/timers.d.ts +0 -161
  560. package/dist/src/timers.js +0 -126
  561. package/dist/src/todos.d.ts +0 -1
  562. package/dist/src/todos.js +0 -3
  563. package/dist/src/token-rate.d.ts +0 -94
  564. package/dist/src/token-rate.js +0 -154
  565. package/dist/src/tool-activity.d.ts +0 -6
  566. package/dist/src/tool-activity.js +1 -8
  567. package/dist/src/tool-availability.d.ts +0 -13
  568. package/dist/src/tool-availability.js +1 -14
  569. package/dist/src/tool-call-clock.d.ts +1 -4
  570. package/dist/src/tool-call-clock.js +0 -13
  571. package/dist/src/tool-catalog.d.ts +0 -11
  572. package/dist/src/tool-catalog.js +0 -23
  573. package/dist/src/tool-dependencies.d.ts +0 -5
  574. package/dist/src/tool-dependencies.js +0 -4
  575. package/dist/src/tool-diff-stats.d.ts +0 -23
  576. package/dist/src/tool-diff-stats.js +0 -49
  577. package/dist/src/tool-errors.d.ts +9 -7
  578. package/dist/src/tool-errors.js +13 -6
  579. package/dist/src/tool-failure-tracker.d.ts +3 -11
  580. package/dist/src/tool-failure-tracker.js +19 -27
  581. package/dist/src/tool-names.d.ts +0 -16
  582. package/dist/src/tool-names.js +0 -12
  583. package/dist/src/tool-profile.d.ts +6 -0
  584. package/dist/src/tool-profile.js +23 -0
  585. package/dist/src/tool-result-filter.d.ts +0 -19
  586. package/dist/src/tool-result-filter.js +1 -66
  587. package/dist/src/tool-schema-compatibility.d.ts +1 -2
  588. package/dist/src/tool-schema-compatibility.js +2 -7
  589. package/dist/src/tools.d.ts +0 -4
  590. package/dist/src/tools.js +11 -114
  591. package/dist/src/trajectory.d.ts +0 -13
  592. package/dist/src/trajectory.js +23 -79
  593. package/dist/src/transcript.d.ts +1 -37
  594. package/dist/src/transcript.js +11 -61
  595. package/dist/src/types.d.ts +2 -167
  596. package/dist/src/untracked-file-removal.d.ts +3 -0
  597. package/dist/src/untracked-file-removal.js +105 -0
  598. package/dist/src/update-check.d.ts +0 -14
  599. package/dist/src/update-check.js +2 -16
  600. package/dist/src/update.d.ts +4 -29
  601. package/dist/src/update.js +20 -98
  602. package/dist/src/usage-analytics.d.ts +17 -17
  603. package/dist/src/usage-analytics.js +168 -209
  604. package/dist/src/web-search.d.ts +0 -23
  605. package/dist/src/web-search.js +1 -27
  606. package/dist/src/widgets.d.ts +0 -25
  607. package/dist/src/widgets.js +0 -24
  608. package/dist/src/workspace-facts.d.ts +0 -12
  609. package/dist/src/workspace-facts.js +1 -18
  610. package/dist/src/workspace-git-metadata.d.ts +4 -5
  611. package/dist/src/workspace-git-metadata.js +37 -9
  612. package/dist/src/workspace-instructions.d.ts +3 -15
  613. package/dist/src/workspace-instructions.js +7 -20
  614. package/package.json +2 -2
@@ -1,39 +1,19 @@
1
- // Git operations behind Orchestrator delegation: snapshot the working folder, give a writing
2
- // subagent a worktree that starts from that snapshot, collect what it changed, and land the
3
- // change back as uncommitted edits with a three-way merge.
4
- //
5
- // Every operation here works on private objects. The user's index, refs, stash and branches are
6
- // never read for state or written: snapshots use a temporary index file and dangling commits, and
7
- // landing writes nothing but working-tree files, and puts every one of them back if it fails partway.
8
1
  import { execFile } from 'node:child_process';
9
2
  import { promisify } from 'node:util';
10
3
  import { chmod, copyFile, lstat, mkdir, mkdtemp, readFile, readdir, readlink, realpath, rm, rmdir, symlink, writeFile } from 'node:fs/promises';
11
4
  import { tmpdir } from 'node:os';
12
5
  import { basename, dirname, join } from 'node:path';
6
+ import { isWindowsDeviceName } from './stray-files.js';
13
7
  const exec = promisify(execFile);
14
- /** Characters of a change's diff that are inlined into the spawn observation. */
15
8
  export const DELEGATION_DIFF_LIMIT = 20_000;
16
9
  const WORKTREE_PREFIX = 'andorra-subagent-';
17
10
  const GIT_TIMEOUT_MS = 15_000;
18
- // Snapshotting and diffing a whole working folder is bounded by its size, not by a single status.
19
11
  const BULK_TIMEOUT_MS = 120_000;
20
12
  const DIFF_MAX_BUFFER = 256 * 1024 * 1024;
21
- // `git add -A` over a whole folder can print a warning per file (line-ending conversion notices).
22
13
  const ADD_MAX_BUFFER = 64 * 1024 * 1024;
23
- // A process a subagent started may still be letting go of a file when its worktree is removed.
24
14
  const REMOVE_RETRIES = { maxRetries: 5, retryDelay: 100 };
25
- // The hooks and fsmonitor settings are the same hardening the existing worktree path applies: a
26
- // repository must not get to run its own programs because a subagent was spawned. safecrlf is off
27
- // because a snapshot takes the files as they are: with `core.safecrlf=true` Git refuses to add a
28
- // file whose line endings its own conversion would change, and the snapshot would fail.
29
- const HARDENED = ['-c', 'core.hooksPath=', '-c', 'core.fsmonitor=false', '-c', 'core.safecrlf=false'];
30
- // Patches are made with the diff-tree plumbing, not porcelain `git diff`: porcelain honours the
31
- // user's diff.noprefix, diff.external, colour and textconv settings, any of which turns a clean
32
- // merge into a patch `git apply` rejects or rewrites. Plumbing ignores them by default; the
33
- // switches make that explicit.
15
+ const HARDENED = ['-c', 'core.hooksPath=', '-c', 'core.fsmonitor=false', '-c', 'core.safecrlf=false', '-c', 'core.longpaths=true'];
34
16
  const PATCH = ['diff-tree', '-r', '--no-color', '--no-ext-diff', '--no-textconv'];
35
- // Snapshot commits are private, so they carry a fixed identity rather than requiring the user to
36
- // have configured one.
37
17
  const SNAPSHOT_IDENTITY = {
38
18
  GIT_AUTHOR_NAME: 'Andorra', GIT_AUTHOR_EMAIL: 'andorra@localhost',
39
19
  GIT_COMMITTER_NAME: 'Andorra', GIT_COMMITTER_EMAIL: 'andorra@localhost',
@@ -45,14 +25,12 @@ async function git(cwd, args, options = {}) {
45
25
  });
46
26
  return stdout;
47
27
  }
48
- /** Removes a temporary directory this module made. A failure here never replaces the error that led to it. */
49
28
  async function removeQuietly(directory) {
50
29
  try {
51
30
  await rm(directory, { recursive: true, force: true, ...REMOVE_RETRIES });
52
31
  }
53
- catch { /* best effort */ }
32
+ catch { }
54
33
  }
55
- /** Runs the callback with a temporary index file that is removed afterwards. */
56
34
  async function withTemporaryIndex(callback) {
57
35
  const directory = await mkdtemp(join(tmpdir(), 'andorra-index-'));
58
36
  try {
@@ -62,32 +40,28 @@ async function withTemporaryIndex(callback) {
62
40
  await removeQuietly(directory);
63
41
  }
64
42
  }
65
- // Andorra's own runtime files (job logs of AsyncProcess, QA run output) are written under
66
- // `.andorra/runtime` of whichever folder a tool ran in, which for a writing subagent is inside its
67
- // worktree. They are by-products of running, not work: left in, a job that printed one line would
68
- // add its log to the change and land it in the user's folder. The same exclusion applies to every
69
- // tree made here (the snapshot, the change, the folder at landing), so the path never differs
70
- // between them. The glob form matches the folder at any depth, for a subfolder workspace.
71
43
  const RUNTIME_FILES = ':(exclude,glob)**/.andorra/runtime/**';
72
- /**
73
- * Writes a tree of the folder's files as they stand: the tracked files of `start` updated from disk,
74
- * plus untracked files that are not ignored, without Andorra's runtime files. The real index is not involved.
75
- */
76
44
  async function writeWorkingTree(root, start, signal) {
77
45
  return withTemporaryIndex(async (env) => {
78
46
  await git(root, ['read-tree', start], { signal, env });
79
- await git(root, ['add', '-A', '--', '.', RUNTIME_FILES], { signal, env, timeout: BULK_TIMEOUT_MS, maxBuffer: ADD_MAX_BUFFER });
47
+ const unreadable = await deviceNamedFiles(root, env, signal);
48
+ await git(root, ['add', '-A', '--', '.', RUNTIME_FILES, ...unreadable.map(path => `:(exclude,literal)${path}`)], { signal, env, timeout: BULK_TIMEOUT_MS, maxBuffer: ADD_MAX_BUFFER });
80
49
  return (await git(root, ['write-tree'], { signal, env })).trim();
81
50
  });
82
51
  }
83
- /** A dangling commit holding `tree`; it is never referenced by a ref. */
52
+ const DEVICE_NAMED_LIMIT = 100;
53
+ async function deviceNamedFiles(root, env, signal) {
54
+ if (process.platform !== 'win32')
55
+ return [];
56
+ const untracked = await git(root, ['ls-files', '-o', '--exclude-standard', '-z', '--', '.', RUNTIME_FILES], { signal, env, timeout: BULK_TIMEOUT_MS, maxBuffer: ADD_MAX_BUFFER });
57
+ return untracked.split('\0').filter(path => path && path.split('/').some(isWindowsDeviceName)).slice(0, DEVICE_NAMED_LIMIT);
58
+ }
84
59
  async function commitTree(root, tree, parent, message, signal) {
85
60
  return (await git(root, ['commit-tree', tree, '-p', parent, '-m', message], { signal, env: SNAPSHOT_IDENTITY })).trim();
86
61
  }
87
62
  function isGitFailure(error, code) {
88
63
  return error instanceof Error && error.code === code && typeof error.stdout === 'string';
89
64
  }
90
- /** The repository toplevel for a workspace, which may be a subfolder of the repository. */
91
65
  export async function repositoryRoot(workspace, signal) {
92
66
  let toplevel;
93
67
  try {
@@ -102,11 +76,9 @@ export async function repositoryRoot(workspace, signal) {
102
76
  throw new Error('Delegated writing needs the workspace to be a Git repository.');
103
77
  return realpath(toplevel);
104
78
  }
105
- /** Checks the Git the delegation path depends on before any worktree is created. */
106
79
  export async function assertDelegationGit(workspace, signal) {
107
80
  const version = /git version (\d+)\.(\d+)/.exec(await git(workspace, ['--version'], { signal }));
108
81
  const [major, minor] = version ? [Number(version[1]), Number(version[2])] : [0, 0];
109
- // `merge-tree --write-tree --merge-base` is what lands a change; it arrived in 2.40.
110
82
  if (major < 2 || (major === 2 && minor < 40))
111
83
  throw new Error('Delegated writing needs Git 2.40 or newer.');
112
84
  const root = await repositoryRoot(workspace, signal);
@@ -119,16 +91,11 @@ export async function assertDelegationGit(workspace, signal) {
119
91
  throw error;
120
92
  }
121
93
  }
122
- /**
123
- * A commit whose tree is the working folder as it stands (tracked plus untracked non-ignored files)
124
- * and whose parent is HEAD. It is the base a writing subagent starts from and is diffed against.
125
- */
126
94
  export async function snapshotWorkspace(workspace, signal) {
127
95
  const root = await repositoryRoot(workspace, signal);
128
96
  const tree = await writeWorkingTree(root, 'HEAD', signal);
129
97
  return commitTree(root, tree, 'HEAD', 'Andorra delegation snapshot', signal);
130
98
  }
131
- /** A detached worktree at `commit` under a fresh temporary directory. */
132
99
  export async function addChangeWorktree(workspace, commit, signal) {
133
100
  const directory = await mkdtemp(join(tmpdir(), WORKTREE_PREFIX));
134
101
  const worktree = join(directory, 'worktree');
@@ -141,10 +108,6 @@ export async function addChangeWorktree(workspace, commit, signal) {
141
108
  }
142
109
  return worktree;
143
110
  }
144
- /**
145
- * The worktree's final files against the snapshot it started from. Commits the subagent made inside
146
- * the worktree do not matter: the tree is taken from disk, the way the snapshot was.
147
- */
148
111
  export async function collectChange(worktree, base, signal) {
149
112
  const tree = await writeWorkingTree(worktree, base, signal);
150
113
  const range = [`${base}^{tree}`, tree];
@@ -155,7 +118,6 @@ export async function collectChange(worktree, base, signal) {
155
118
  const fields = status.split('\0');
156
119
  for (let index = 0; index + 1 < fields.length; index += 2) {
157
120
  const kind = fields[index][0];
158
- // A rename record carries the old path before the new one; the change is reported at its new path.
159
121
  if (kind === 'R') {
160
122
  files.push({ path: fields[index + 2], status: 'R' });
161
123
  paths.push(fields[index + 1], fields[index + 2]);
@@ -167,10 +129,6 @@ export async function collectChange(worktree, base, signal) {
167
129
  }
168
130
  return { tree, files, diff, paths };
169
131
  }
170
- /**
171
- * Landing wrote part of a change and could not put the working folder back. The message names the
172
- * snapshot commit that holds the folder as it was and the paths that were not restored.
173
- */
174
132
  export class LandingRestoreError extends Error {
175
133
  snapshot;
176
134
  paths;
@@ -184,14 +142,7 @@ export class LandingRestoreError extends Error {
184
142
  const missing = (error) => ['ENOENT', 'ENOTDIR'].includes(error.code ?? '');
185
143
  const present = (target) => lstat(target).catch((error) => { if (missing(error))
186
144
  return undefined; throw error; });
187
- /** How many folders deep a repository path is; Git prints paths with forward slashes. */
188
145
  const depth = (path) => path.split('/').length;
189
- /**
190
- * Copies the files a patch is about to touch into `directory`, byte for byte. The copies, not the
191
- * snapshot's blobs, are what a failed landing restores: a blob went through Git's line-ending and
192
- * filter conversion on the way in, so checking it out again is not guaranteed to give the same bytes.
193
- * Also records the directories the patch would have to create, so a restore can remove them again.
194
- */
195
146
  async function saveTouched(root, paths, directory) {
196
147
  const saved = [];
197
148
  const created = new Set();
@@ -209,18 +160,12 @@ async function saveTouched(root, paths, directory) {
209
160
  const copy = join(directory, String(index));
210
161
  await copyFile(target, copy);
211
162
  saved.push({ path, kind: 'file', copy, mode: info.mode & 0o777 });
212
- // A directory where the patch puts a file: the files under it are saved under their own paths.
213
163
  }
214
164
  else
215
165
  saved.push({ path, kind: info.isDirectory() ? 'directory' : 'other' });
216
166
  }
217
- // Deepest first, which is the order a restore removes them in.
218
167
  return { saved, created: [...created].sort((left, right) => right.length - left.length) };
219
168
  }
220
- /**
221
- * Removes a directory that holds nothing but empty directories. A file in it was not put there by
222
- * the landing (what the landing added is removed before this runs), so it stops the removal.
223
- */
224
169
  async function removeEmptyTree(directory) {
225
170
  for (const entry of await readdir(directory, { withFileTypes: true })) {
226
171
  if (!entry.isDirectory())
@@ -229,16 +174,7 @@ async function removeEmptyTree(directory) {
229
174
  }
230
175
  await rmdir(directory);
231
176
  }
232
- /** Takes away what stands at a path so that what was saved can go back there. */
233
177
  const clear = (target, info) => info.isDirectory() ? removeEmptyTree(target) : rm(target, { force: true });
234
- /**
235
- * Puts every saved path back as it was. Returns the paths that could not be restored, with the reason.
236
- *
237
- * A patch can change what kind of thing a path is: a file becomes a directory with files under it,
238
- * or a directory becomes a file. So the order matters. What the patch added goes first, deepest
239
- * first, together with the directories it made; only then are saved files put back, shallowest
240
- * first, each one replacing a directory that the patch left in its place.
241
- */
242
178
  async function restoreTouched(root, state) {
243
179
  const failed = new Map();
244
180
  const attempt = async (entry, action) => {
@@ -252,16 +188,13 @@ async function restoreTouched(root, state) {
252
188
  };
253
189
  const deepestFirst = [...state.saved].sort((left, right) => depth(right.path) - depth(left.path));
254
190
  for (const entry of deepestFirst) {
255
- // Nothing stood here: whatever is here now is the patch's.
256
191
  if (entry.kind === 'absent')
257
192
  await attempt(entry, async (target) => { const info = await present(target); if (info)
258
193
  await clear(target, info); });
259
- // A directory stood here: a file here now is the patch's, and the directory comes back below.
260
194
  if (entry.kind === 'directory')
261
195
  await attempt(entry, async (target) => { const info = await present(target); if (info && !info.isDirectory())
262
196
  await rm(target, { force: true }); });
263
197
  }
264
- // Only a directory the patch made, and only once it is empty again.
265
198
  for (const directory of state.created)
266
199
  await rmdir(directory).catch(() => { });
267
200
  for (const entry of deepestFirst.reverse()) {
@@ -280,7 +213,6 @@ async function restoreTouched(root, state) {
280
213
  if (entry.kind === 'file')
281
214
  await attempt(entry, async (target) => {
282
215
  const info = await present(target);
283
- // A file the patch never reached is left alone: rewriting it could only fail for no gain.
284
216
  if (info?.isFile() && (await readFile(target)).equals(await readFile(entry.copy))) {
285
217
  if ((info.mode & 0o777) !== entry.mode)
286
218
  await chmod(target, entry.mode);
@@ -295,25 +227,15 @@ async function restoreTouched(root, state) {
295
227
  }
296
228
  return [...failed].map(([path, reason]) => ({ path, reason }));
297
229
  }
298
- /**
299
- * Merges `tree` (a change collected against `base`) with the working folder as it stands, which is
300
- * "ours", so edits the user made since the snapshot are merged with the change rather than
301
- * overwritten. Nothing in the working folder is written: the result is the patch `applyLanding`
302
- * would apply and the paths it touches, so a caller can decide whether those paths may be written
303
- * before any of them is.
304
- */
305
230
  export async function prepareLanding(workspace, base, tree, signal) {
306
231
  const root = await repositoryRoot(workspace, signal);
307
232
  const ours = await snapshotWorkspace(root, signal);
308
- // Git 2.40's merge-tree takes commits for the sides it merges (later versions accept trees), so
309
- // the change is wrapped in a throwaway commit on its base.
310
233
  const theirs = await commitTree(root, tree, base, 'Andorra delegated change', signal);
311
234
  let merged;
312
235
  try {
313
236
  merged = (await git(root, ['merge-tree', '--write-tree', `--merge-base=${base}`, '--name-only', ours, theirs], { signal, timeout: BULK_TIMEOUT_MS, maxBuffer: DIFF_MAX_BUFFER })).trim();
314
237
  }
315
238
  catch (error) {
316
- // Exit 1 is a conflict, with the merged tree, the conflicted paths and a blank line before the messages.
317
239
  if (!isGitFailure(error, 1))
318
240
  throw error;
319
241
  const [, ...rest] = error.stdout.split('\n');
@@ -326,11 +248,9 @@ export async function prepareLanding(workspace, base, tree, signal) {
326
248
  return { ready: false, conflicts, detail: error.stdout.trim() };
327
249
  }
328
250
  const patch = await exec('git', [...HARDENED, ...PATCH, '-p', '--binary', ours, merged], { cwd: root, signal, windowsHide: true, timeout: BULK_TIMEOUT_MS, maxBuffer: DIFF_MAX_BUFFER, encoding: 'buffer' });
329
- // Without rename detection a moved file is listed at both of its paths: one is removed, one written.
330
251
  const files = (await git(root, [...PATCH, '--name-only', '-z', '--no-renames', ours, merged], { signal, timeout: BULK_TIMEOUT_MS, maxBuffer: DIFF_MAX_BUFFER })).split('\0').filter(Boolean);
331
252
  return { ready: true, landing: { root, ours, files, patch: patch.stdout } };
332
253
  }
333
- /** Whether the working folder no longer holds the files the snapshot commit `ours` recorded. */
334
254
  async function folderMoved(root, ours, signal) {
335
255
  try {
336
256
  return await writeWorkingTree(root, 'HEAD', signal) !== (await git(root, ['rev-parse', `${ours}^{tree}`], { signal })).trim();
@@ -339,34 +259,14 @@ async function folderMoved(root, ours, signal) {
339
259
  return false;
340
260
  }
341
261
  }
342
- /**
343
- * Writes a prepared landing to the working folder as uncommitted edits. Only the paths in
344
- * `landing.files` are written or removed: the patch is fixed, and `git apply` refuses it as a whole
345
- * when the folder no longer matches what it was made against.
346
- *
347
- * Landing is all or nothing. `git apply` checks a patch before it writes, but the writing itself is
348
- * not atomic: a file another program holds open, a full disk or a cancelled run stops it with some
349
- * files rewritten and others already removed. So the files the patch touches are copied aside
350
- * first, and any failure of the apply puts them back, removes what the patch added, and reports the
351
- * landing as not done, with `stale` set when the folder changed after the landing was prepared (a
352
- * new preparation may then work). If the folder cannot be put back, a `LandingRestoreError` names
353
- * the snapshot commit holding the folder as it was. The hooks exist for tests: `applied` runs after
354
- * an apply that worked, and a throw from it is handled as the apply failing once its writes were
355
- * made; `applyFailed` runs between a failed apply and the restore.
356
- */
357
262
  export async function applyLanding(landing, signal, hooks = {}) {
358
263
  const { root, ours, files, patch } = landing;
359
264
  if (patch.length === 0)
360
265
  return { landed: true, files };
361
- // The patch goes through a file rather than stdin so Git sees the exact bytes; `git apply` without
362
- // `--index` touches only the working tree, which is the snapshot's "ours" and so passes the check
363
- // `git apply` makes before it writes. `--whitespace=nowarn` overrides an apply.whitespace setting
364
- // that would strip or reject what the merge produced.
365
266
  const directory = await mkdtemp(join(tmpdir(), 'andorra-land-'));
366
267
  try {
367
268
  const file = join(directory, 'change.patch');
368
269
  await writeFile(file, patch);
369
- // Nothing is written to the folder yet, so failing to copy the files aside just fails the landing.
370
270
  const state = await saveTouched(root, files, directory);
371
271
  signal.throwIfAborted();
372
272
  try {
@@ -379,12 +279,11 @@ export async function applyLanding(landing, signal, hooks = {}) {
379
279
  try {
380
280
  await hooks.applyFailed?.();
381
281
  }
382
- catch { /* a test hook must not hide the failure */ }
282
+ catch { }
383
283
  const failed = await restoreTouched(root, state);
384
284
  if (failed.length) {
385
285
  throw new LandingRestoreError(`Landing failed partway and the working folder could not be put back. The folder as it was before the landing is in Git commit ${ours}; recover a file with: git show ${ours}:<path>. Not restored: ${failed.map(entry => `${entry.path} (${entry.reason})`).join('; ')}. The landing failed with: ${detail}`, ours, failed.map(entry => entry.path));
386
286
  }
387
- // The folder is as it was. A cancelled run still ends as a cancellation, not as a conflict.
388
287
  if (signal.aborted)
389
288
  throw error;
390
289
  return { landed: false, conflicts: [], detail, ...(await folderMoved(root, ours, signal) ? { stale: true } : {}) };
@@ -395,18 +294,12 @@ export async function applyLanding(landing, signal, hooks = {}) {
395
294
  }
396
295
  return { landed: true, files };
397
296
  }
398
- /**
399
- * Lands `tree` (a change collected against `base`) on the working folder as uncommitted edits:
400
- * `prepareLanding`, then `applyLanding`. On a conflict nothing is written. A caller that must
401
- * authorize the paths a landing writes uses the two steps itself.
402
- */
403
297
  export async function landChange(workspace, base, tree, signal, hooks = {}) {
404
298
  const prepared = await prepareLanding(workspace, base, tree, signal);
405
299
  if (!prepared.ready)
406
300
  return { landed: false, conflicts: prepared.conflicts, detail: prepared.detail };
407
301
  return applyLanding(prepared.landing, signal, hooks);
408
302
  }
409
- /** Removes a worktree made by `addChangeWorktree` and its temporary directory. Best effort; never throws. */
410
303
  export async function removeChangeWorktree(workspace, worktree) {
411
304
  let removed = true;
412
305
  try {
@@ -415,17 +308,15 @@ export async function removeChangeWorktree(workspace, worktree) {
415
308
  catch {
416
309
  removed = false;
417
310
  }
418
- // Only a directory this module created is deleted wholesale; anything else loses just the worktree.
419
311
  const parent = dirname(worktree);
420
312
  try {
421
313
  await rm(basename(parent).startsWith(WORKTREE_PREFIX) ? parent : worktree, { recursive: true, force: true, ...REMOVE_RETRIES });
422
314
  }
423
- catch { /* best effort */ }
424
- // Git forgets the worktree itself when the removal works; only a failed one leaves a record to prune.
315
+ catch { }
425
316
  if (!removed) {
426
317
  try {
427
318
  await git(workspace, ['worktree', 'prune']);
428
319
  }
429
- catch { /* best effort */ }
320
+ catch { }
430
321
  }
431
322
  }
@@ -2,5 +2,5 @@ export interface FileChangePreview {
2
2
  text: string;
3
3
  detail?: string;
4
4
  }
5
- /** Proposed tool arguments only: writes may overwrite an existing file. */
5
+ export declare function registerEditArgumentPreparer(prepare: ((args: Record<string, unknown>) => unknown) | undefined): void;
6
6
  export declare function formatFileChange(name: string, args: Record<string, unknown>): FileChangePreview | undefined;
@@ -1,13 +1,13 @@
1
1
  import { stripVTControlCharacters } from 'node:util';
2
2
  import { clipText } from './text.js';
3
3
  import { canonicalToolName } from './tool-names.js';
4
- import { andorraCreateEditTool } from '../vendor/engine/runtime/coding-agent/core/tools/edit.js';
5
4
  const PREVIEW_LINES = 12;
6
5
  const DETAIL_LINES = 200;
7
6
  const LINE_WIDTH = 300;
8
- // Construction only defines metadata. Previewing never invokes the tool executor.
9
- const prepareEditArguments = andorraCreateEditTool('.').prepareArguments;
10
- /** Keep file content from controlling the terminal or disguising diff markers. */
7
+ let prepareEditArguments;
8
+ export function registerEditArgumentPreparer(prepare) {
9
+ prepareEditArguments = prepare;
10
+ }
11
11
  function printable(value) {
12
12
  return stripVTControlCharacters(value)
13
13
  .replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, '')
@@ -17,7 +17,6 @@ function numbered(value, marker) {
17
17
  if (!value)
18
18
  return [];
19
19
  const lines = value.replace(/\r\n/g, '\n').split('\n');
20
- // A final line terminator does not introduce an extra content line.
21
20
  if (lines.at(-1) === '')
22
21
  lines.pop();
23
22
  const width = String(lines.length).length;
@@ -27,7 +26,6 @@ function numbered(value, marker) {
27
26
  return `${marker} ${String(index + 1).padStart(width)} | ${shown}`;
28
27
  });
29
28
  }
30
- /** Shared snippet rendering for every edit contract (canonical and adopted). */
31
29
  function renderEdits(edits) {
32
30
  return edits.flatMap((edit, index) => {
33
31
  const replacement = [...numbered(edit.oldText, '-'), ...numbered(edit.newText, '+')];
@@ -43,12 +41,10 @@ function render(header, lines, limit) {
43
41
  shown.push(`… ${lines.length - limit} more lines (preview truncated)`);
44
42
  return [header, ...shown].join('\n');
45
43
  }
46
- /** Proposed tool arguments only: writes may overwrite an existing file. */
47
44
  export function formatFileChange(name, args) {
48
45
  const canonical = canonicalToolName(name);
49
46
  if (canonical !== 'Write' && canonical !== 'Edit')
50
47
  return undefined;
51
- // Canonical tool spelling carries file_path; every adopted Pi/Andorra spelling carries path.
52
48
  const usesFilePath = name === 'Write' || name === 'Edit';
53
49
  const rawPath = usesFilePath ? args.file_path : args.path;
54
50
  if (typeof rawPath !== 'string')
@@ -67,8 +63,6 @@ export function formatFileChange(name, args) {
67
63
  else if (usesFilePath) {
68
64
  let edits = [];
69
65
  if (Array.isArray(args.edits)) {
70
- // The canonical Edit rejects an empty batch and an empty old_string, so previewing one
71
- // would advertise a call that can only fail.
72
66
  if (!args.edits.length)
73
67
  return undefined;
74
68
  for (const edit of args.edits) {
@@ -89,8 +83,6 @@ export function formatFileChange(name, args) {
89
83
  lines = renderEdits(edits);
90
84
  }
91
85
  else if (name === 'edit') {
92
- // Started events contain raw provider arguments. Use the executor's normalizer,
93
- // but copy the envelope because it can replace edits while parsing JSON input.
94
86
  if (prepareEditArguments)
95
87
  args = prepareEditArguments({ ...args });
96
88
  if (!Array.isArray(args.edits) || !args.edits.length)
@@ -1,55 +1,5 @@
1
- /**
2
- * Timing helpers for tool-call telemetry and user-facing surfaces (transcripts, status lines).
3
- *
4
- * Dependency-free and defensive by design: callers append the rendered suffix only when it is
5
- * defined, so missing or unusable input degrades to byte-identical prior output instead of
6
- * printing `NaN` or `undefined`.
7
- */
8
- /**
9
- * A non-negative finite duration in milliseconds, or `undefined` when the value cannot be
10
- * trusted (missing, non-numeric, `NaN`, infinite or negative).
11
- *
12
- * The runtime emits a duration beside the identity of the call it belongs to, so a value that
13
- * cannot be trusted must be dropped rather than coerced: `durationMs` returns `undefined` and the
14
- * event carries no `durationMs`, which keeps consumers from pairing a fabricated duration with a
15
- * real tool call. Only a number or a numeric string is accepted; other types are rejected instead
16
- * of being coerced through `Number()`, which would silently turn `[]` into a `0ms` reading.
17
- */
18
1
  export declare function durationMs(ms: unknown): number | undefined;
19
- /**
20
- * Whole seconds as spaced elapsed units: `45s`, `2m 3s`, `1h 2m 3s`.
21
- *
22
- * Every duration the terminal prints past a minute takes this one form: largest unit first, a
23
- * space between units, and every unit below the largest carried down to the second so a boundary
24
- * never hides where the figure stands (`1h 0m 5s`, not `1h 5s`). Minutes never run past 59 — a
25
- * stretch of 105 minutes reads `1h 45m 18s`. Fractions floor and negatives clamp to `0s`.
26
- */
27
2
  export declare function formatHms(totalSeconds: number): string;
28
- /**
29
- * Renders a duration for display: whole milliseconds below one second (`123ms`, `0ms`),
30
- * one-decimal seconds below a minute (`1.2s`, `59.4s`), then {@link formatHms} (`1m 5s`,
31
- * `1h 45m 18s`).
32
- *
33
- * The minute cutoff is taken on the rounded figure, so 59.96 s reads `1m 0s` rather than `60.0s`.
34
- * Returns `undefined` for anything `durationMs` rejects so the caller can omit the suffix
35
- * entirely; this function never returns `NaN` or `undefined` as text.
36
- */
37
3
  export declare function formatDuration(ms: unknown): string | undefined;
38
- /** Monotonic clock source for a per-call start reading. */
39
4
  export declare const monotonicNow: () => number;
40
- /**
41
- * Elapsed milliseconds between a monotonic start reading and now, or `undefined` when the start
42
- * cannot be trusted.
43
- *
44
- * `performance.now()` is monotonic, so a per-call reading cannot go negative if the system wall
45
- * clock is adjusted mid-run. The span is rounded to whole milliseconds: the value is rendered to
46
- * whole milliseconds or one-decimal seconds, and a raw `performance.now()` difference carries
47
- * float noise ("17.22060000000056") that a duration was never measured to. The emitted event is
48
- * what a run record persists, so the reading is fixed here rather than at each consumer. A host
49
- * that lacks `performance` yields `undefined` instead of throwing inside a tool-call event
50
- * emitter.
51
- *
52
- * Each call reads the clock independently, so concurrent branches of one batch can hold their own
53
- * reader while the events they emit stay paired with the right `toolCallId`.
54
- */
55
5
  export declare function elapsedMs(startedAt: number | undefined): number | undefined;
@@ -1,21 +1,4 @@
1
1
  import { performance } from 'node:perf_hooks';
2
- /**
3
- * Timing helpers for tool-call telemetry and user-facing surfaces (transcripts, status lines).
4
- *
5
- * Dependency-free and defensive by design: callers append the rendered suffix only when it is
6
- * defined, so missing or unusable input degrades to byte-identical prior output instead of
7
- * printing `NaN` or `undefined`.
8
- */
9
- /**
10
- * A non-negative finite duration in milliseconds, or `undefined` when the value cannot be
11
- * trusted (missing, non-numeric, `NaN`, infinite or negative).
12
- *
13
- * The runtime emits a duration beside the identity of the call it belongs to, so a value that
14
- * cannot be trusted must be dropped rather than coerced: `durationMs` returns `undefined` and the
15
- * event carries no `durationMs`, which keeps consumers from pairing a fabricated duration with a
16
- * real tool call. Only a number or a numeric string is accepted; other types are rejected instead
17
- * of being coerced through `Number()`, which would silently turn `[]` into a `0ms` reading.
18
- */
19
2
  export function durationMs(ms) {
20
3
  if (typeof ms !== 'number' && typeof ms !== 'string')
21
4
  return undefined;
@@ -26,14 +9,6 @@ export function durationMs(ms) {
26
9
  return undefined;
27
10
  return value;
28
11
  }
29
- /**
30
- * Whole seconds as spaced elapsed units: `45s`, `2m 3s`, `1h 2m 3s`.
31
- *
32
- * Every duration the terminal prints past a minute takes this one form: largest unit first, a
33
- * space between units, and every unit below the largest carried down to the second so a boundary
34
- * never hides where the figure stands (`1h 0m 5s`, not `1h 5s`). Minutes never run past 59 — a
35
- * stretch of 105 minutes reads `1h 45m 18s`. Fractions floor and negatives clamp to `0s`.
36
- */
37
12
  export function formatHms(totalSeconds) {
38
13
  const seconds = Math.max(0, Math.floor(totalSeconds));
39
14
  const hours = Math.floor(seconds / 3600);
@@ -45,15 +20,6 @@ export function formatHms(totalSeconds) {
45
20
  return `${minutes}m ${rest}s`;
46
21
  return `${rest}s`;
47
22
  }
48
- /**
49
- * Renders a duration for display: whole milliseconds below one second (`123ms`, `0ms`),
50
- * one-decimal seconds below a minute (`1.2s`, `59.4s`), then {@link formatHms} (`1m 5s`,
51
- * `1h 45m 18s`).
52
- *
53
- * The minute cutoff is taken on the rounded figure, so 59.96 s reads `1m 0s` rather than `60.0s`.
54
- * Returns `undefined` for anything `durationMs` rejects so the caller can omit the suffix
55
- * entirely; this function never returns `NaN` or `undefined` as text.
56
- */
57
23
  export function formatDuration(ms) {
58
24
  const value = durationMs(ms);
59
25
  if (value === undefined)
@@ -65,23 +31,7 @@ export function formatDuration(ms) {
65
31
  return `${seconds}s`;
66
32
  return formatHms(Math.round(value / 1000));
67
33
  }
68
- /** Monotonic clock source for a per-call start reading. */
69
34
  export const monotonicNow = () => performance.now();
70
- /**
71
- * Elapsed milliseconds between a monotonic start reading and now, or `undefined` when the start
72
- * cannot be trusted.
73
- *
74
- * `performance.now()` is monotonic, so a per-call reading cannot go negative if the system wall
75
- * clock is adjusted mid-run. The span is rounded to whole milliseconds: the value is rendered to
76
- * whole milliseconds or one-decimal seconds, and a raw `performance.now()` difference carries
77
- * float noise ("17.22060000000056") that a duration was never measured to. The emitted event is
78
- * what a run record persists, so the reading is fixed here rather than at each consumer. A host
79
- * that lacks `performance` yields `undefined` instead of throwing inside a tool-call event
80
- * emitter.
81
- *
82
- * Each call reads the clock independently, so concurrent branches of one batch can hold their own
83
- * reader while the events they emit stay paired with the right `toolCallId`.
84
- */
85
35
  export function elapsedMs(startedAt) {
86
36
  if (typeof startedAt !== 'number' || !Number.isFinite(startedAt))
87
37
  return undefined;
@@ -1,75 +1,39 @@
1
- /**
2
- * Independent controls for the efficiency optimizations layered on the agent runtime.
3
- *
4
- * Every switch here is off unless the configuration turns it on, so a configuration that names
5
- * none of them runs the shipped behavior byte for byte. Each feature is evaluated on its own
6
- * (`scripts/jev-efficiency-eval.mjs`), and the switches are independent so a feature whose
7
- * evaluation does not justify it can stay off while the others ship.
8
- *
9
- * None of the switches widens what the hosted decision service receives: the deterministic paths
10
- * run locally, and a semantic selection that would need excerpts the service is not contracted to
11
- * receive stays disabled rather than sending them (see `docs/concepts/jev-efficiency.md`).
12
- * @module efficiency
13
- */
14
- /** A model the adaptive router may select; it must name a configured provider and model. */
15
1
  export interface ModelTierTarget {
16
2
  provider: string;
17
3
  model?: string;
18
4
  }
19
- /**
20
- * User-supplied prices for cost reporting. Nothing here is invented by the runtime: a model
21
- * without an entry reports "cost unavailable", never zero.
22
- */
23
5
  export interface ModelPricing {
24
6
  inputPerMillionUsd: number;
25
7
  outputPerMillionUsd: number;
26
8
  cacheReadPerMillionUsd?: number;
27
9
  }
28
10
  export interface AdaptiveRoutingConfig {
29
- /** Off unless true; the tiers alone do not enable routing. */
30
11
  enabled?: boolean;
31
12
  tiers?: {
32
13
  economy?: ModelTierTarget;
33
14
  balanced?: ModelTierTarget;
34
15
  premium?: ModelTierTarget;
35
16
  };
36
- /** Upward re-tiering after a defined failure; 0 disables escalation. Default 1. */
37
17
  maxEscalations?: number;
38
- /** Prices keyed by `<provider>/<model>`, for reports only. */
39
18
  pricing?: Record<string, ModelPricing>;
40
19
  }
41
- /** Tool-menu routing is independently opt-in; shadow measures without trimming. */
42
20
  export interface ToolMenuRoutingConfig {
43
21
  mode?: 'off' | 'shadow' | 'lean';
44
22
  topK?: number;
45
23
  minSavingsChars?: number;
46
- /** Explicit host/node tools remain exposed. These names never grant permissions. */
47
24
  pinnedTools?: string[];
48
25
  }
49
26
  export interface EfficiencyConfig {
50
- /** Independent local finish/check machinery. Omission preserves the existing JEV-facts default. */
51
27
  deterministicContinuations?: boolean;
52
- /** False disables remote fact interpretation without disabling local continuations. */
53
28
  jevFactInterpretation?: boolean;
54
- /** Skip legacy preflight entirely without disabling fact or tool-menu decisions. */
55
29
  jevPreflight?: boolean;
56
- /** Pin project skill discovery independently of JEV. Undefined preserves the existing behavior. */
57
30
  projectSkillDiscovery?: boolean;
58
31
  toolMenuRouting?: ToolMenuRoutingConfig;
59
- /**
60
- * Prepared steps may declare `when: 'success' | 'failure' | 'always'`; a declared step runs
61
- * deterministically after the batch it followed, without a decision request.
62
- */
63
32
  preparedContinuations?: boolean;
64
- /** Skip the post-tool decision round when no prepared candidate could change execution. */
65
33
  postflightOnlyWithCandidates?: boolean;
66
- /** Parse bulky tool results before they enter the model-visible conversation. */
67
34
  toolResultFiltering?: boolean;
68
- /** Minimum output size, in characters, before a result is a filtering candidate. Default 6000. */
69
35
  toolResultFilterThresholdChars?: number;
70
- /** Workspace-fact gating of automatic retrieval and relevance selection of retrieved context. */
71
36
  contextSelection?: boolean;
72
- /** Deterministic task-appropriate tool catalog and lazy skill catalog ordering. */
73
37
  catalogSelection?: boolean;
74
38
  adaptiveRouting?: AdaptiveRoutingConfig;
75
39
  }
@@ -79,7 +43,6 @@ export declare const DEFAULT_TOOL_RESULT_FILTER_THRESHOLD = 6000;
79
43
  declare const TIERS: readonly ["economy", "balanced", "premium"];
80
44
  export type ModelTier = typeof TIERS[number];
81
45
  export declare const MODEL_TIERS: readonly ModelTier[];
82
- /** Fail closed on shape: a mistyped switch is an error, not a silently ignored optimization. */
83
46
  export declare function validateEfficiencyConfig(value: unknown): void;
84
47
  export interface ResolvedEfficiency {
85
48
  preparedContinuations: boolean;
@@ -93,9 +56,7 @@ export interface ResolvedEfficiency {
93
56
  maxEscalations: number;
94
57
  };
95
58
  }
96
- /** The effective switches; every absent value is the shipped behavior. */
97
59
  export declare function resolveEfficiency(config: EfficiencyConfig | undefined): ResolvedEfficiency;
98
- /** Fixed reason codes shared by every `efficiency.*` event; free text never rides an event. */
99
60
  export declare const EFFICIENCY_REASONS: readonly ["deterministic_continuation", "jev_selected", "no_candidates", "no_actionable_decision", "stale_task", "stale_permissions", "catalog_mismatch", "blocked", "denied", "invalid_arguments", "automatic_limit", "batch_failed", "batch_succeeded", "filtered", "below_threshold", "unknown_format", "protected_tool", "error_output", "expanded", "expansion_rejected", "empty_workspace", "index_unavailable", "memory_unavailable", "selected", "duplicate", "changed", "fallback", "economy", "balanced", "premium", "baseline", "pinned", "unconfigured", "low_confidence", "risk", "escalated", "escalation_limit", "omitted", "restored", "historical", "explicit"];
100
61
  export type EfficiencyReason = typeof EFFICIENCY_REASONS[number];
101
62
  export {};