@andorra-labs/code 0.1.12 → 0.1.14

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 (617) hide show
  1. package/dist/src/account-presentation.d.ts +1 -37
  2. package/dist/src/account-presentation.js +6 -43
  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 +347 -554
  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 +11 -155
  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/andorra/endpoint.d.ts +7 -0
  18. package/dist/src/andorra/endpoint.js +46 -0
  19. package/dist/src/andorra/entry.d.ts +21 -0
  20. package/dist/src/andorra/entry.js +100 -0
  21. package/dist/src/andorra/errors.d.ts +2 -0
  22. package/dist/src/andorra/errors.js +39 -0
  23. package/dist/src/andorra/hosted.d.ts +52 -0
  24. package/dist/src/andorra/hosted.js +126 -0
  25. package/dist/src/andorra/monitor.d.ts +151 -0
  26. package/dist/src/andorra/monitor.js +393 -0
  27. package/dist/src/andorra/notices.d.ts +7 -0
  28. package/dist/src/andorra/notices.js +15 -0
  29. package/dist/src/andorra/opt-in.d.ts +58 -0
  30. package/dist/src/andorra/opt-in.js +112 -0
  31. package/dist/src/andorra/request-watch.d.ts +6 -0
  32. package/dist/src/andorra/request-watch.js +10 -0
  33. package/dist/src/andorra/state.d.ts +86 -0
  34. package/dist/src/andorra/state.js +238 -0
  35. package/dist/src/andorra/terminal.d.ts +68 -0
  36. package/dist/src/andorra/terminal.js +125 -0
  37. package/dist/src/andorra/usage-format.d.ts +9 -0
  38. package/dist/src/andorra/usage-format.js +19 -0
  39. package/dist/src/anthropic-console-auth.d.ts +0 -24
  40. package/dist/src/anthropic-console-auth.js +0 -37
  41. package/dist/src/anthropic-credentials.d.ts +0 -25
  42. package/dist/src/anthropic-credentials.js +9 -29
  43. package/dist/src/app-server/protocol.d.ts +18 -246
  44. package/dist/src/app-server/protocol.js +1 -132
  45. package/dist/src/app-server/reasoning.d.ts +0 -31
  46. package/dist/src/app-server/reasoning.js +0 -54
  47. package/dist/src/app-server/terminal.d.ts +0 -36
  48. package/dist/src/app-server/terminal.js +3 -39
  49. package/dist/src/app-server/workspace.d.ts +0 -167
  50. package/dist/src/app-server/workspace.js +4 -406
  51. package/dist/src/app-server.d.ts +52 -925
  52. package/dist/src/app-server.js +828 -3076
  53. package/dist/src/artifacts.d.ts +0 -10
  54. package/dist/src/artifacts.js +1 -11
  55. package/dist/src/attachments.d.ts +4 -98
  56. package/dist/src/attachments.js +10 -130
  57. package/dist/src/auth/AuthManager.d.ts +9 -93
  58. package/dist/src/auth/AuthManager.js +164 -186
  59. package/dist/src/auth/callback-page.d.ts +0 -1
  60. package/dist/src/auth/callback-page.js +0 -4
  61. package/dist/src/auth/callback.d.ts +0 -25
  62. package/dist/src/auth/callback.js +1 -29
  63. package/dist/src/auth/deployment.d.ts +1 -16
  64. package/dist/src/auth/deployment.js +1 -16
  65. package/dist/src/auth/index.d.ts +1 -12
  66. package/dist/src/auth/index.js +1 -12
  67. package/dist/src/auth/lock.d.ts +0 -1
  68. package/dist/src/auth/lock.js +0 -1
  69. package/dist/src/auth/store.d.ts +33 -108
  70. package/dist/src/auth/store.js +55 -130
  71. package/dist/src/auth/types.d.ts +0 -8
  72. package/dist/src/auth-commands.d.ts +0 -5
  73. package/dist/src/auth-commands.js +0 -1
  74. package/dist/src/automation-runner.d.ts +0 -9
  75. package/dist/src/automation-runner.js +0 -11
  76. package/dist/src/automation-service.d.ts +0 -10
  77. package/dist/src/automation-service.js +3 -17
  78. package/dist/src/automation-tool.js +0 -5
  79. package/dist/src/automation-worker-shutdown.d.ts +0 -1
  80. package/dist/src/automation-worker-shutdown.js +0 -3
  81. package/dist/src/automations.d.ts +23 -2
  82. package/dist/src/automations.js +91 -12
  83. package/dist/src/background-tasks.d.ts +0 -23
  84. package/dist/src/background-tasks.js +0 -11
  85. package/dist/src/boot-trace.d.ts +0 -13
  86. package/dist/src/boot-trace.js +1 -14
  87. package/dist/src/browser-activity.js +0 -2
  88. package/dist/src/browser-bridge.d.ts +0 -2
  89. package/dist/src/browser-bridge.js +0 -27
  90. package/dist/src/browser-captcha-tool.d.ts +0 -13
  91. package/dist/src/browser-captcha-tool.js +3 -35
  92. package/dist/src/browser-extensions-tool.d.ts +24 -0
  93. package/dist/src/browser-extensions-tool.js +137 -0
  94. package/dist/src/browser-extensions.d.ts +127 -0
  95. package/dist/src/browser-extensions.js +729 -0
  96. package/dist/src/browser-observation.d.ts +0 -15
  97. package/dist/src/browser-observation.js +1 -22
  98. package/dist/src/browser-panel-tool.d.ts +1 -37
  99. package/dist/src/browser-panel-tool.js +3 -73
  100. package/dist/src/browser-runner.d.ts +0 -1
  101. package/dist/src/browser-runner.js +5 -46
  102. package/dist/src/browser-server.d.ts +0 -6
  103. package/dist/src/browser-server.js +6 -229
  104. package/dist/src/browser-session.d.ts +0 -25
  105. package/dist/src/browser-session.js +1 -71
  106. package/dist/src/browser-stealth.d.ts +19 -13
  107. package/dist/src/browser-stealth.js +22 -38
  108. package/dist/src/browser-ui/app.js +7 -174
  109. package/dist/src/browser-ui/style.css +0 -68
  110. package/dist/src/browser-ui/tokens.css +15 -97
  111. package/dist/src/browser-view.d.ts +106 -295
  112. package/dist/src/browser-view.js +551 -587
  113. package/dist/src/capabilities.d.ts +0 -8
  114. package/dist/src/capabilities.js +0 -29
  115. package/dist/src/capsolver.d.ts +0 -13
  116. package/dist/src/capsolver.js +0 -15
  117. package/dist/src/clarification-ui.d.ts +0 -7
  118. package/dist/src/clarification-ui.js +0 -8
  119. package/dist/src/claude-executable.d.ts +0 -1
  120. package/dist/src/claude-executable.js +1 -2
  121. package/dist/src/claude-provider.d.ts +6 -19
  122. package/dist/src/claude-provider.js +155 -63
  123. package/dist/src/cli-executable.d.ts +0 -16
  124. package/dist/src/cli-executable.js +0 -7
  125. package/dist/src/cli-process.d.ts +0 -26
  126. package/dist/src/cli-process.js +0 -18
  127. package/dist/src/cli-sign-in.d.ts +0 -20
  128. package/dist/src/cli-sign-in.js +1 -17
  129. package/dist/src/cli.d.ts +1 -55
  130. package/dist/src/cli.js +118 -742
  131. package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
  132. package/dist/src/code-intelligence/CodeIntelligenceManager.js +26 -99
  133. package/dist/src/code-intelligence/ContextLedger.d.ts +0 -4
  134. package/dist/src/code-intelligence/ContextLedger.js +0 -10
  135. package/dist/src/code-intelligence/ContextRouter.d.ts +0 -6
  136. package/dist/src/code-intelligence/ContextRouter.js +0 -8
  137. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +0 -2
  138. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +5 -12
  139. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +0 -6
  140. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +0 -6
  141. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +0 -5
  142. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +1 -17
  143. package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +0 -5
  144. package/dist/src/code-intelligence/codegraph/repoExploreTool.js +0 -5
  145. package/dist/src/code-intelligence/repository.d.ts +0 -9
  146. package/dist/src/code-intelligence/repository.js +1 -11
  147. package/dist/src/code-intelligence/types.d.ts +0 -8
  148. package/dist/src/codex-auth.d.ts +0 -44
  149. package/dist/src/codex-auth.js +0 -45
  150. package/dist/src/codex-browser-auth.d.ts +0 -13
  151. package/dist/src/codex-browser-auth.js +3 -20
  152. package/dist/src/codex-errors.js +0 -2
  153. package/dist/src/codex-executable.d.ts +0 -2
  154. package/dist/src/codex-executable.js +1 -7
  155. package/dist/src/codex-provider.d.ts +0 -13
  156. package/dist/src/codex-provider.js +0 -28
  157. package/dist/src/codex-rpc.d.ts +0 -10
  158. package/dist/src/codex-rpc.js +0 -12
  159. package/dist/src/coding-tools.d.ts +4 -26
  160. package/dist/src/coding-tools.js +161 -181
  161. package/dist/src/command-metrics.d.ts +0 -4
  162. package/dist/src/command-output-tap.d.ts +0 -11
  163. package/dist/src/command-output-tap.js +0 -3
  164. package/dist/src/command-screens.d.ts +41 -1
  165. package/dist/src/command-screens.js +316 -113
  166. package/dist/src/commands.d.ts +12 -63
  167. package/dist/src/commands.js +98 -127
  168. package/dist/src/completion-gates.d.ts +0 -47
  169. package/dist/src/completion-gates.js +0 -14
  170. package/dist/src/completion.d.ts +0 -98
  171. package/dist/src/completion.js +2 -239
  172. package/dist/src/config.d.ts +15 -115
  173. package/dist/src/config.js +123 -172
  174. package/dist/src/context-budget.d.ts +0 -22
  175. package/dist/src/context-budget.js +0 -44
  176. package/dist/src/context-compaction.d.ts +29 -6
  177. package/dist/src/context-compaction.js +94 -25
  178. package/dist/src/context-selection.d.ts +0 -24
  179. package/dist/src/context-selection.js +0 -34
  180. package/dist/src/dashboard-view.d.ts +2 -2
  181. package/dist/src/dashboard-view.js +11 -37
  182. package/dist/src/dashboard.d.ts +0 -2
  183. package/dist/src/dashboard.js +0 -9
  184. package/dist/src/deadline.d.ts +0 -45
  185. package/dist/src/deadline.js +0 -54
  186. package/dist/src/decision/ContinuationAdapter.d.ts +0 -5
  187. package/dist/src/decision/ContinuationAdapter.js +0 -5
  188. package/dist/src/decision/DecisionEngine.d.ts +0 -4
  189. package/dist/src/decision/DecisionManager.d.ts +0 -1
  190. package/dist/src/decision/DecisionManager.js +2 -7
  191. package/dist/src/decision/DecisionPolicy.d.ts +0 -1
  192. package/dist/src/decision/DecisionPolicy.js +0 -1
  193. package/dist/src/decision/FactContinuations.d.ts +11 -43
  194. package/dist/src/decision/FactContinuations.js +126 -95
  195. package/dist/src/decision/FactServiceGate.d.ts +0 -1
  196. package/dist/src/decision/FactServiceGate.js +0 -4
  197. package/dist/src/decision/PreparedSteps.d.ts +0 -15
  198. package/dist/src/decision/PreparedSteps.js +1 -11
  199. package/dist/src/decision/applyToolMenu.d.ts +0 -1
  200. package/dist/src/decision/applyToolMenu.js +2 -6
  201. package/dist/src/decision/checks.d.ts +15 -28
  202. package/dist/src/decision/checks.js +118 -49
  203. package/dist/src/decision/facts.d.ts +0 -16
  204. package/dist/src/decision/facts.js +0 -30
  205. package/dist/src/decision/guidancePolicy.js +0 -1
  206. package/dist/src/decision/hostedPolicy.d.ts +0 -6
  207. package/dist/src/decision/hostedPolicy.js +0 -7
  208. package/dist/src/decision/hostedSkills.d.ts +0 -19
  209. package/dist/src/decision/hostedSkills.js +0 -19
  210. package/dist/src/decision/optimizationPolicy.d.ts +0 -3
  211. package/dist/src/decision/optimizationPolicy.js +1 -4
  212. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +0 -7
  213. package/dist/src/decision/providers/AndorraDecisionProvider.js +4 -27
  214. package/dist/src/decision/providers/HttpDecisionProvider.d.ts +0 -2
  215. package/dist/src/decision/providers/HttpDecisionProvider.js +0 -6
  216. package/dist/src/decision/routeTools.d.ts +0 -8
  217. package/dist/src/decision/routeTools.js +1 -8
  218. package/dist/src/decision/toolFamilies.d.ts +0 -1
  219. package/dist/src/decision/toolFamilies.js +1 -2
  220. package/dist/src/decision/toolMenu.d.ts +0 -3
  221. package/dist/src/decision/toolMenu.js +0 -4
  222. package/dist/src/decision/types.d.ts +1 -6
  223. package/dist/src/default-graph.d.ts +0 -9
  224. package/dist/src/default-graph.js +0 -9
  225. package/dist/src/delegation-changes.d.ts +0 -56
  226. package/dist/src/delegation-changes.js +4 -130
  227. package/dist/src/diff-preview.d.ts +0 -1
  228. package/dist/src/diff-preview.js +0 -17
  229. package/dist/src/duration.d.ts +0 -50
  230. package/dist/src/duration.js +0 -50
  231. package/dist/src/efficiency.d.ts +0 -39
  232. package/dist/src/efficiency.js +0 -16
  233. package/dist/src/engine/protocol.d.ts +0 -2
  234. package/dist/src/engine/protocol.js +0 -2
  235. package/dist/src/engine-streams.d.ts +0 -9
  236. package/dist/src/extensions.d.ts +3 -2
  237. package/dist/src/extensions.js +63 -35
  238. package/dist/src/favicons.d.ts +0 -26
  239. package/dist/src/favicons.js +0 -34
  240. package/dist/src/file-diff.d.ts +2 -58
  241. package/dist/src/file-diff.js +0 -32
  242. package/dist/src/file-read-key.d.ts +0 -7
  243. package/dist/src/file-read-key.js +0 -7
  244. package/dist/src/file-read-state.d.ts +0 -1
  245. package/dist/src/file-read-state.js +0 -4
  246. package/dist/src/firefox-cookies.d.ts +0 -34
  247. package/dist/src/firefox-cookies.js +1 -55
  248. package/dist/src/git-identity-audit.d.ts +27 -0
  249. package/dist/src/git-identity-audit.js +286 -0
  250. package/dist/src/git-identity-guard.d.ts +4 -0
  251. package/dist/src/git-identity-guard.js +998 -0
  252. package/dist/src/git-identity-hold.d.ts +12 -0
  253. package/dist/src/git-identity-hold.js +81 -0
  254. package/dist/src/git-summary.d.ts +0 -58
  255. package/dist/src/git-summary.js +2 -212
  256. package/dist/src/goal-completion-verification.d.ts +2 -2
  257. package/dist/src/goal-completion-verification.js +3 -6
  258. package/dist/src/graph-account.d.ts +0 -21
  259. package/dist/src/graph-account.js +0 -17
  260. package/dist/src/graph-editor-session.d.ts +0 -1
  261. package/dist/src/graph-editor-session.js +0 -3
  262. package/dist/src/graph-health.d.ts +9 -61
  263. package/dist/src/graph-health.js +34 -59
  264. package/dist/src/graph-manager-chat.d.ts +36 -153
  265. package/dist/src/graph-manager-chat.js +161 -182
  266. package/dist/src/graph-provider-portability.d.ts +1 -21
  267. package/dist/src/graph-provider-portability.js +6 -45
  268. package/dist/src/graph-quota.d.ts +0 -33
  269. package/dist/src/graph-quota.js +1 -44
  270. package/dist/src/graph-runner.d.ts +0 -1
  271. package/dist/src/graph-runner.js +58 -391
  272. package/dist/src/graph-selection.d.ts +0 -14
  273. package/dist/src/graph-selection.js +2 -15
  274. package/dist/src/graph-server.d.ts +2 -10
  275. package/dist/src/graph-server.js +39 -101
  276. package/dist/src/graph-studio-features.d.ts +0 -5
  277. package/dist/src/graph-studio-features.js +2 -42
  278. package/dist/src/graph-sync.d.ts +0 -78
  279. package/dist/src/graph-sync.js +5 -201
  280. package/dist/src/graph-tool.d.ts +0 -18
  281. package/dist/src/graph-tool.js +0 -27
  282. package/dist/src/graph-ui/app.js +176 -492
  283. package/dist/src/graph-ui/compat.js +0 -7
  284. package/dist/src/graph-ui/controls.css +0 -48
  285. package/dist/src/graph-ui/controls.js +0 -88
  286. package/dist/src/graph-ui/drafts.js +0 -12
  287. package/dist/src/graph-ui/edge-router.js +0 -62
  288. package/dist/src/graph-ui/embed.js +0 -59
  289. package/dist/src/graph-ui/icons.js +0 -8
  290. package/dist/src/graph-ui/library.css +0 -5
  291. package/dist/src/graph-ui/manager-markdown.js +0 -11
  292. package/dist/src/graph-ui/manager-state.js +1 -78
  293. package/dist/src/graph-ui/manager.css +0 -18
  294. package/dist/src/graph-ui/manager.js +43 -185
  295. package/dist/src/graph-ui/model-picker.js +0 -29
  296. package/dist/src/graph-ui/sidebar.js +2 -3
  297. package/dist/src/graph-ui/skill-picker.js +373 -39
  298. package/dist/src/graph-ui/studio-canvas.js +3 -38
  299. package/dist/src/graph-ui/studio.css +0 -18
  300. package/dist/src/graph-ui/studio.js +3 -71
  301. package/dist/src/graph-ui/style.css +16 -136
  302. package/dist/src/graph-ui/theme.js +1 -26
  303. package/dist/src/graph-ui/tokens.css +19 -118
  304. package/dist/src/graphs.d.ts +6 -157
  305. package/dist/src/graphs.js +66 -269
  306. package/dist/src/grep-regex-worker.js +0 -2
  307. package/dist/src/grep-regex.d.ts +1 -5
  308. package/dist/src/grep-regex.js +6 -8
  309. package/dist/src/grok-provider.d.ts +0 -17
  310. package/dist/src/grok-provider.js +1 -26
  311. package/dist/src/handoffs.d.ts +0 -11
  312. package/dist/src/handoffs.js +0 -13
  313. package/dist/src/hardened-runtime.d.ts +0 -10
  314. package/dist/src/hardened-runtime.js +9 -47
  315. package/dist/src/harness-home.d.ts +21 -0
  316. package/dist/src/harness-home.js +87 -0
  317. package/dist/src/host-process-guard.d.ts +0 -50
  318. package/dist/src/host-process-guard.js +0 -641
  319. package/dist/src/limits.d.ts +0 -64
  320. package/dist/src/limits.js +0 -62
  321. package/dist/src/managed-sign-in.d.ts +0 -12
  322. package/dist/src/managed-sign-in.js +0 -16
  323. package/dist/src/markdown.d.ts +0 -28
  324. package/dist/src/markdown.js +1 -175
  325. package/dist/src/mcp.d.ts +0 -99
  326. package/dist/src/mcp.js +4 -170
  327. package/dist/src/membership-errors.d.ts +0 -14
  328. package/dist/src/membership-errors.js +1 -14
  329. package/dist/src/membership.d.ts +9 -59
  330. package/dist/src/membership.js +20 -91
  331. package/dist/src/memory/LocalToolMemory.d.ts +0 -1
  332. package/dist/src/memory/LocalToolMemory.js +2 -7
  333. package/dist/src/memory/MemoryDistiller.js +0 -15
  334. package/dist/src/memory/MemoryManager.d.ts +0 -3
  335. package/dist/src/memory/MemoryManager.js +6 -18
  336. package/dist/src/memory/MemoryPolicy.d.ts +0 -2
  337. package/dist/src/memory/MemoryPolicy.js +0 -2
  338. package/dist/src/memory/MemoryProvider.d.ts +0 -6
  339. package/dist/src/memory/MemoryRetriever.js +0 -7
  340. package/dist/src/memory/PermissionMemoryProvider.d.ts +0 -1
  341. package/dist/src/memory/PermissionMemoryProvider.js +0 -1
  342. package/dist/src/memory/ProjectMemory.d.ts +5 -40
  343. package/dist/src/memory/ProjectMemory.js +22 -47
  344. package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
  345. package/dist/src/memory/ToolFailureLessons.js +0 -6
  346. package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +0 -1
  347. package/dist/src/memory/providers/NoOpMemoryProvider.js +0 -1
  348. package/dist/src/memory/redaction.d.ts +0 -5
  349. package/dist/src/memory/redaction.js +0 -11
  350. package/dist/src/memory/repository.d.ts +0 -6
  351. package/dist/src/memory/repository.js +2 -12
  352. package/dist/src/memory/types.d.ts +0 -1
  353. package/dist/src/model-context-windows.d.ts +2 -0
  354. package/dist/src/model-context-windows.js +24 -0
  355. package/dist/src/model-health-cache.d.ts +0 -38
  356. package/dist/src/model-health-cache.js +2 -50
  357. package/dist/src/model-metadata.d.ts +1 -18
  358. package/dist/src/model-metadata.js +42 -45
  359. package/dist/src/model-override.d.ts +0 -36
  360. package/dist/src/model-override.js +0 -43
  361. package/dist/src/model-tiers.d.ts +0 -13
  362. package/dist/src/model-tiers.js +0 -23
  363. package/dist/src/opencode-catalog.d.ts +0 -2
  364. package/dist/src/opencode-catalog.js +0 -11
  365. package/dist/src/opencode-cli-provider.d.ts +0 -35
  366. package/dist/src/opencode-cli-provider.js +1 -44
  367. package/dist/src/opencode-provider.d.ts +0 -2
  368. package/dist/src/opencode-provider.js +1 -16
  369. package/dist/src/package-name.d.ts +0 -2
  370. package/dist/src/package-name.js +0 -2
  371. package/dist/src/paged-transcript.d.ts +0 -11
  372. package/dist/src/paged-transcript.js +2 -20
  373. package/dist/src/palette.d.ts +1 -63
  374. package/dist/src/palette.js +1 -64
  375. package/dist/src/permissions.d.ts +0 -15
  376. package/dist/src/permissions.js +17 -21
  377. package/dist/src/powershell-pool.d.ts +0 -9
  378. package/dist/src/powershell-pool.js +3 -26
  379. package/dist/src/process-warnings.d.ts +4 -0
  380. package/dist/src/process-warnings.js +103 -0
  381. package/dist/src/profile.d.ts +0 -43
  382. package/dist/src/profile.js +0 -43
  383. package/dist/src/project-reservation.d.ts +11 -0
  384. package/dist/src/project-reservation.js +143 -0
  385. package/dist/src/provider-connection.d.ts +0 -18
  386. package/dist/src/provider-connection.js +15 -39
  387. package/dist/src/provider-engine.d.ts +0 -21
  388. package/dist/src/provider-engine.js +1 -96
  389. package/dist/src/provider-import.d.ts +0 -49
  390. package/dist/src/provider-import.js +0 -60
  391. package/dist/src/provider-keys.d.ts +1 -36
  392. package/dist/src/provider-keys.js +5 -48
  393. package/dist/src/provider-settings.d.ts +16 -3
  394. package/dist/src/provider-settings.js +36 -52
  395. package/dist/src/providers.d.ts +14 -219
  396. package/dist/src/providers.js +69 -326
  397. package/dist/src/pull-requests.d.ts +0 -173
  398. package/dist/src/pull-requests.js +5 -195
  399. package/dist/src/qa/browser/PlaywrightRunner.d.ts +0 -7
  400. package/dist/src/qa/browser/PlaywrightRunner.js +2 -16
  401. package/dist/src/qa/command-policy.d.ts +0 -23
  402. package/dist/src/qa/command-policy.js +0 -30
  403. package/dist/src/qa/guidance.d.ts +0 -21
  404. package/dist/src/qa/guidance.js +0 -20
  405. package/dist/src/qa/profile/ProjectInspector.d.ts +0 -4
  406. package/dist/src/qa/profile/ProjectInspector.js +0 -6
  407. package/dist/src/qa/profile/QaConfigLoader.d.ts +0 -7
  408. package/dist/src/qa/profile/QaConfigLoader.js +0 -6
  409. package/dist/src/qa/profile/QaProfile.d.ts +0 -7
  410. package/dist/src/qa/profile/QaProfile.js +0 -7
  411. package/dist/src/qa/profile/yaml.d.ts +0 -9
  412. package/dist/src/qa/profile/yaml.js +0 -13
  413. package/dist/src/qa/qa-authorize.d.ts +0 -19
  414. package/dist/src/qa/qa-authorize.js +4 -11
  415. package/dist/src/qa/runtime/ProcessManager.d.ts +0 -31
  416. package/dist/src/qa/runtime/ProcessManager.js +4 -41
  417. package/dist/src/qa/runtime/PtyManager.d.ts +0 -4
  418. package/dist/src/qa/runtime/PtyManager.js +1 -7
  419. package/dist/src/qa/runtime/changes.d.ts +0 -11
  420. package/dist/src/qa/runtime/changes.js +1 -3
  421. package/dist/src/qa/tools.d.ts +0 -10
  422. package/dist/src/qa/tools.js +0 -12
  423. package/dist/src/qa/types.d.ts +0 -13
  424. package/dist/src/react-runtime.d.ts +2 -21
  425. package/dist/src/react-runtime.js +107 -422
  426. package/dist/src/read-document-doc.d.ts +0 -6
  427. package/dist/src/read-document-doc.js +0 -55
  428. package/dist/src/read-document-docx.d.ts +0 -16
  429. package/dist/src/read-document-docx.js +2 -69
  430. package/dist/src/read-document-text.d.ts +0 -17
  431. package/dist/src/read-document-text.js +0 -22
  432. package/dist/src/read-document-tool.d.ts +0 -31
  433. package/dist/src/read-document-tool.js +0 -30
  434. package/dist/src/read-document.d.ts +0 -49
  435. package/dist/src/read-document.js +1 -67
  436. package/dist/src/read-image.d.ts +0 -32
  437. package/dist/src/read-image.js +0 -33
  438. package/dist/src/remote/cert.d.ts +0 -18
  439. package/dist/src/remote/cert.js +0 -44
  440. package/dist/src/remote/client.d.ts +0 -70
  441. package/dist/src/remote/client.js +1 -116
  442. package/dist/src/remote/command.js +0 -17
  443. package/dist/src/remote/engine-pool.d.ts +0 -152
  444. package/dist/src/remote/engine-pool.js +22 -339
  445. package/dist/src/remote/errors.d.ts +0 -15
  446. package/dist/src/remote/errors.js +0 -7
  447. package/dist/src/remote/network.d.ts +0 -26
  448. package/dist/src/remote/network.js +1 -34
  449. package/dist/src/remote/pairing.d.ts +16 -51
  450. package/dist/src/remote/pairing.js +50 -57
  451. package/dist/src/remote/pem.d.ts +0 -4
  452. package/dist/src/remote/pem.js +0 -4
  453. package/dist/src/remote/roots.d.ts +0 -20
  454. package/dist/src/remote/roots.js +0 -8
  455. package/dist/src/remote/serve.d.ts +0 -47
  456. package/dist/src/remote/serve.js +0 -30
  457. package/dist/src/remote/server.d.ts +0 -14
  458. package/dist/src/remote/server.js +1 -79
  459. package/dist/src/remote/types.d.ts +1 -32
  460. package/dist/src/remote/types.js +0 -10
  461. package/dist/src/run-control.d.ts +2 -9
  462. package/dist/src/run-control.js +9 -13
  463. package/dist/src/run-progress.d.ts +0 -170
  464. package/dist/src/run-progress.js +0 -285
  465. package/dist/src/run-records.d.ts +0 -443
  466. package/dist/src/run-records.js +14 -687
  467. package/dist/src/run-temp.d.ts +12 -0
  468. package/dist/src/run-temp.js +50 -0
  469. package/dist/src/runtime.d.ts +12 -228
  470. package/dist/src/runtime.js +2 -128
  471. package/dist/src/sandbox-child.js +0 -1
  472. package/dist/src/save-lock.d.ts +0 -12
  473. package/dist/src/save-lock.js +0 -28
  474. package/dist/src/screen-selection.d.ts +0 -23
  475. package/dist/src/screen-selection.js +0 -22
  476. package/dist/src/secret-redaction.d.ts +0 -12
  477. package/dist/src/secret-redaction.js +0 -45
  478. package/dist/src/session-changes.d.ts +4 -80
  479. package/dist/src/session-changes.js +25 -130
  480. package/dist/src/session-goal.d.ts +129 -0
  481. package/dist/src/session-goal.js +230 -0
  482. package/dist/src/session-monitor.d.ts +1 -10
  483. package/dist/src/session-monitor.js +2 -39
  484. package/dist/src/session-reaper.d.ts +0 -15
  485. package/dist/src/session-reaper.js +0 -14
  486. package/dist/src/session-skills.d.ts +15 -44
  487. package/dist/src/session-skills.js +75 -60
  488. package/dist/src/session-summary.d.ts +0 -26
  489. package/dist/src/session-summary.js +0 -32
  490. package/dist/src/session-title.d.ts +0 -1
  491. package/dist/src/session-title.js +0 -2
  492. package/dist/src/sessions.d.ts +3 -122
  493. package/dist/src/sessions.js +9 -178
  494. package/dist/src/shell.d.ts +3 -20
  495. package/dist/src/shell.js +8 -72
  496. package/dist/src/side-panel.d.ts +5 -99
  497. package/dist/src/side-panel.js +76 -133
  498. package/dist/src/sign-in-detection.d.ts +0 -39
  499. package/dist/src/sign-in-detection.js +0 -43
  500. package/dist/src/sign-in-offer.d.ts +1 -19
  501. package/dist/src/sign-in-offer.js +0 -13
  502. package/dist/src/skill-commands.d.ts +0 -1
  503. package/dist/src/skill-commands.js +1 -4
  504. package/dist/src/skills/bundled/control-browser/SKILL.md +1 -1
  505. package/dist/src/skills/bundled/graph-manager/errors.md +1 -1
  506. package/dist/src/skills/bundled/provenance.json +738 -738
  507. package/dist/src/skills/invocable-skills.d.ts +0 -18
  508. package/dist/src/skills/invocable-skills.js +0 -17
  509. package/dist/src/skills/project-skills.d.ts +0 -1
  510. package/dist/src/skills/project-skills.js +0 -3
  511. package/dist/src/skills/prompt-skills.js +0 -14
  512. package/dist/src/skills/runtime-skills.d.ts +0 -13
  513. package/dist/src/skills/runtime-skills.js +0 -37
  514. package/dist/src/stall-recovery.d.ts +0 -25
  515. package/dist/src/stall-recovery.js +0 -38
  516. package/dist/src/stray-files.d.ts +0 -9
  517. package/dist/src/stray-files.js +0 -16
  518. package/dist/src/structured-step.d.ts +0 -22
  519. package/dist/src/structured-step.js +0 -22
  520. package/dist/src/subagent-run.d.ts +2 -163
  521. package/dist/src/subagent-run.js +18 -376
  522. package/dist/src/subagent-tree.d.ts +32 -0
  523. package/dist/src/subagent-tree.js +128 -0
  524. package/dist/src/telemetry/aggregate.d.ts +0 -37
  525. package/dist/src/telemetry/aggregate.js +0 -40
  526. package/dist/src/telemetry/capture-core.d.ts +0 -87
  527. package/dist/src/telemetry/capture-core.js +0 -67
  528. package/dist/src/telemetry/capture.d.ts +0 -1
  529. package/dist/src/telemetry/capture.js +0 -3
  530. package/dist/src/telemetry/classify.d.ts +0 -58
  531. package/dist/src/telemetry/classify.js +0 -60
  532. package/dist/src/telemetry/decision-capture.d.ts +0 -1
  533. package/dist/src/telemetry/emitter.d.ts +0 -30
  534. package/dist/src/telemetry/emitter.js +1 -62
  535. package/dist/src/telemetry/gate.d.ts +0 -29
  536. package/dist/src/telemetry/gate.js +0 -22
  537. package/dist/src/telemetry/identity.d.ts +0 -13
  538. package/dist/src/telemetry/identity.js +0 -29
  539. package/dist/src/telemetry/outbox.d.ts +0 -64
  540. package/dist/src/telemetry/outbox.js +1 -108
  541. package/dist/src/telemetry/schema.d.ts +1 -49
  542. package/dist/src/telemetry/schema.js +3 -84
  543. package/dist/src/telemetry/state.d.ts +0 -53
  544. package/dist/src/telemetry/state.js +0 -64
  545. package/dist/src/telemetry/surface.d.ts +0 -31
  546. package/dist/src/telemetry/surface.js +1 -39
  547. package/dist/src/telemetry/uploader.d.ts +0 -11
  548. package/dist/src/telemetry/uploader.js +0 -46
  549. package/dist/src/telemetry/uploads.d.ts +0 -11
  550. package/dist/src/telemetry/uploads.js +0 -11
  551. package/dist/src/telemetry/version.d.ts +0 -4
  552. package/dist/src/telemetry/version.js +0 -14
  553. package/dist/src/telemetry/workspace.d.ts +0 -7
  554. package/dist/src/telemetry/workspace.js +1 -22
  555. package/dist/src/terminal-ui.d.ts +33 -521
  556. package/dist/src/terminal-ui.js +145 -884
  557. package/dist/src/test-edit-guard.d.ts +74 -0
  558. package/dist/src/test-edit-guard.js +269 -0
  559. package/dist/src/text.d.ts +0 -1
  560. package/dist/src/text.js +0 -1
  561. package/dist/src/time-limit.d.ts +0 -36
  562. package/dist/src/time-limit.js +0 -37
  563. package/dist/src/timers.d.ts +0 -161
  564. package/dist/src/timers.js +0 -126
  565. package/dist/src/todos.d.ts +0 -1
  566. package/dist/src/todos.js +0 -3
  567. package/dist/src/token-rate.d.ts +0 -94
  568. package/dist/src/token-rate.js +0 -154
  569. package/dist/src/tool-activity.d.ts +0 -6
  570. package/dist/src/tool-activity.js +0 -7
  571. package/dist/src/tool-availability.d.ts +0 -13
  572. package/dist/src/tool-availability.js +1 -14
  573. package/dist/src/tool-call-clock.d.ts +1 -4
  574. package/dist/src/tool-call-clock.js +0 -13
  575. package/dist/src/tool-catalog.d.ts +0 -11
  576. package/dist/src/tool-catalog.js +0 -23
  577. package/dist/src/tool-dependencies.d.ts +0 -5
  578. package/dist/src/tool-dependencies.js +0 -4
  579. package/dist/src/tool-diff-stats.d.ts +0 -23
  580. package/dist/src/tool-diff-stats.js +0 -49
  581. package/dist/src/tool-errors.d.ts +9 -7
  582. package/dist/src/tool-errors.js +13 -6
  583. package/dist/src/tool-failure-tracker.d.ts +3 -11
  584. package/dist/src/tool-failure-tracker.js +19 -27
  585. package/dist/src/tool-names.d.ts +0 -16
  586. package/dist/src/tool-names.js +0 -12
  587. package/dist/src/tool-profile.d.ts +6 -0
  588. package/dist/src/tool-profile.js +23 -0
  589. package/dist/src/tool-result-filter.d.ts +0 -19
  590. package/dist/src/tool-result-filter.js +1 -66
  591. package/dist/src/tool-schema-compatibility.d.ts +0 -6
  592. package/dist/src/tool-schema-compatibility.js +0 -9
  593. package/dist/src/tools.d.ts +0 -4
  594. package/dist/src/tools.js +11 -114
  595. package/dist/src/trajectory.d.ts +0 -13
  596. package/dist/src/trajectory.js +23 -79
  597. package/dist/src/transcript.d.ts +0 -41
  598. package/dist/src/transcript.js +5 -60
  599. package/dist/src/types.d.ts +4 -168
  600. package/dist/src/untracked-file-removal.js +0 -20
  601. package/dist/src/update-check.d.ts +0 -14
  602. package/dist/src/update-check.js +1 -15
  603. package/dist/src/update.d.ts +0 -35
  604. package/dist/src/update.js +0 -100
  605. package/dist/src/usage-analytics.d.ts +17 -17
  606. package/dist/src/usage-analytics.js +168 -209
  607. package/dist/src/web-search.d.ts +0 -23
  608. package/dist/src/web-search.js +1 -27
  609. package/dist/src/widgets.d.ts +0 -25
  610. package/dist/src/widgets.js +0 -24
  611. package/dist/src/workspace-facts.d.ts +0 -12
  612. package/dist/src/workspace-facts.js +1 -18
  613. package/dist/src/workspace-git-metadata.d.ts +0 -16
  614. package/dist/src/workspace-git-metadata.js +0 -21
  615. package/dist/src/workspace-instructions.d.ts +3 -15
  616. package/dist/src/workspace-instructions.js +6 -19
  617. package/package.json +13 -2
@@ -1,77 +1,13 @@
1
- /**
2
- * Run bounds, and the single spelling of "unlimited".
3
- *
4
- * This module is deliberately dependency-free so configuration can describe bounds without
5
- * importing the runtime that enforces them. Routing that import through `runtime.ts` would
6
- * close a cycle (`runtime` re-exports the graph runner, which loads the configuration), so the
7
- * shared vocabulary lives here and both sides depend on it.
8
- * @module limits
9
- */
10
1
  export interface Limits {
11
- /**
12
- * Model iterations allowed per node attempt. Optional by design: an absent value means
13
- * no iteration ceiling, so a node keeps working until it completes, another limit stops
14
- * it, a repeated tool failure trips, or it is cancelled.
15
- */
16
2
  maxIterations?: number;
17
- /**
18
- * Wall-clock budget for the attempt, in milliseconds. Optional by design: an absent value
19
- * arms no timer at all, so a long task is never stopped merely for taking a long time.
20
- * Time spent waiting on the user is not charged to it; see `bindUserWaits`.
21
- */
22
3
  wallTimeMs?: number;
23
4
  maxContextChars: number;
24
5
  maxCompletionRepairs: number;
25
- /**
26
- * Tool calls allowed per node attempt. Optional by design: an absent value means
27
- * no tool-call ceiling at all, so a run continues until it finishes, another
28
- * limit stops it, or it is cancelled. Only an explicit value bounds tool calls.
29
- */
30
6
  maxToolCalls?: number;
31
7
  }
32
- /**
33
- * Every key `Limits` defines.
34
- *
35
- * Merging a node limit needs this list rather than `Object.hasOwn(DEFAULT_LIMITS, key)`:
36
- * the unlimited-by-default keys are absent from the defaults, and testing the defaults
37
- * would silently drop an explicitly configured node bound instead of applying it.
38
- */
39
8
  export declare const LIMIT_KEYS: readonly ["maxIterations", "maxToolCalls", "wallTimeMs", "maxContextChars", "maxCompletionRepairs"];
40
9
  export type LimitKey = typeof LIMIT_KEYS[number];
41
- /**
42
- * The bundled defaults: no wall clock and no iteration ceiling.
43
- *
44
- * A coding task that legitimately runs for hours must not be killed for being slow, and a
45
- * person reading a question must never be on the clock. Runaway work is still bounded by a
46
- * repeated tool failure, the context ceiling, an explicit config or graph bound, and
47
- * cancellation.
48
- */
49
10
  export declare const DEFAULT_LIMITS: Limits;
50
- /**
51
- * Whether a value is the explicit unlimited alias for a key rather than a real bound.
52
- *
53
- * Callers that *merge* bounds must consult this. Min-ing a zero alias against an enclosing
54
- * bound computes zero, which the budget reads as unlimited, so the narrower scope would
55
- * silently discard a bound it never intended to override instead of leaving it in force.
56
- * @param key - a `Limits` key.
57
- * @param value - the configured value.
58
- * @returns whether the value means unlimited rather than a ceiling.
59
- */
60
11
  export declare function isUnlimitedAlias(key: string, value: number | undefined): boolean;
61
- /**
62
- * Whether a configured bound means "no bound at all".
63
- *
64
- * Deliberately a plain boolean rather than a type predicate: this returns true for a literal
65
- * `0` as well as for `undefined`, so narrowing `value` to `undefined` on a true result would
66
- * be unsound for callers that received a real zero.
67
- * @param value - the configured bound, or undefined when unset.
68
- * @returns whether the bound is unlimited.
69
- */
70
12
  export declare function isUnlimited(value: number | undefined): boolean;
71
- /**
72
- * Normalize a caller-supplied bound set into effective limits.
73
- *
74
- * @param supplied - partial limits from config, a graph run, or an embedder.
75
- * @returns complete limits, with every unlimited bound left absent.
76
- */
77
13
  export declare function resolveLimits(supplied?: Partial<Limits>): Limits;
@@ -1,77 +1,15 @@
1
- /**
2
- * Run bounds, and the single spelling of "unlimited".
3
- *
4
- * This module is deliberately dependency-free so configuration can describe bounds without
5
- * importing the runtime that enforces them. Routing that import through `runtime.ts` would
6
- * close a cycle (`runtime` re-exports the graph runner, which loads the configuration), so the
7
- * shared vocabulary lives here and both sides depend on it.
8
- * @module limits
9
- */
10
- /**
11
- * Every key `Limits` defines.
12
- *
13
- * Merging a node limit needs this list rather than `Object.hasOwn(DEFAULT_LIMITS, key)`:
14
- * the unlimited-by-default keys are absent from the defaults, and testing the defaults
15
- * would silently drop an explicitly configured node bound instead of applying it.
16
- */
17
1
  export const LIMIT_KEYS = ['maxIterations', 'maxToolCalls', 'wallTimeMs', 'maxContextChars', 'maxCompletionRepairs'];
18
- /**
19
- * The bundled defaults: no wall clock and no iteration ceiling.
20
- *
21
- * A coding task that legitimately runs for hours must not be killed for being slow, and a
22
- * person reading a question must never be on the clock. Runaway work is still bounded by a
23
- * repeated tool failure, the context ceiling, an explicit config or graph bound, and
24
- * cancellation.
25
- */
26
2
  export const DEFAULT_LIMITS = {
27
- // No implicit character ceiling. The engine resolves its safety allowance from
28
- // the selected model; explicit configured character limits still tighten it.
29
3
  maxContextChars: Number.MAX_SAFE_INTEGER,
30
- // Each repair is one model turn; exhausting them ends a node whose work may already
31
- // be done. Two was too thin for small and self-hosted models — one artifact-shaped
32
- // rejection plus one mis-encoded retry could lose the whole attempt. The coercions
33
- // in parseCompletion handle the mechanical envelope mistakes; these repairs are the
34
- // model's own chances for everything else, so they are cheap next to what they save.
35
4
  maxCompletionRepairs: 4,
36
5
  };
37
- /**
38
- * The keys for which a literal `0` means "unlimited" rather than "no allowance".
39
- *
40
- * `maxToolCalls` is deliberately excluded: there a zero ceiling is meaningful, permitting a
41
- * node to complete without tools while refusing every call.
42
- */
43
6
  const UNLIMITED_ALIASES = ['wallTimeMs', 'maxIterations'];
44
- /**
45
- * Whether a value is the explicit unlimited alias for a key rather than a real bound.
46
- *
47
- * Callers that *merge* bounds must consult this. Min-ing a zero alias against an enclosing
48
- * bound computes zero, which the budget reads as unlimited, so the narrower scope would
49
- * silently discard a bound it never intended to override instead of leaving it in force.
50
- * @param key - a `Limits` key.
51
- * @param value - the configured value.
52
- * @returns whether the value means unlimited rather than a ceiling.
53
- */
54
7
  export function isUnlimitedAlias(key, value) {
55
8
  return value === 0 && UNLIMITED_ALIASES.includes(key);
56
9
  }
57
- /**
58
- * Whether a configured bound means "no bound at all".
59
- *
60
- * Deliberately a plain boolean rather than a type predicate: this returns true for a literal
61
- * `0` as well as for `undefined`, so narrowing `value` to `undefined` on a true result would
62
- * be unsound for callers that received a real zero.
63
- * @param value - the configured bound, or undefined when unset.
64
- * @returns whether the bound is unlimited.
65
- */
66
10
  export function isUnlimited(value) {
67
11
  return value === undefined || value === 0;
68
12
  }
69
- /**
70
- * Normalize a caller-supplied bound set into effective limits.
71
- *
72
- * @param supplied - partial limits from config, a graph run, or an embedder.
73
- * @returns complete limits, with every unlimited bound left absent.
74
- */
75
13
  export function resolveLimits(supplied = {}) {
76
14
  const resolved = { ...DEFAULT_LIMITS };
77
15
  for (const key of LIMIT_KEYS) {
@@ -1,26 +1,15 @@
1
1
  import { CliSignIn, type ManagedSignInState } from './cli-sign-in.js';
2
2
  import { type OpenCodeServerLike, type OpenCodeSignInOption } from './opencode-cli-provider.js';
3
- /** Claude subscription sign-in through the official Claude Code CLI's own login. */
4
3
  export declare function claudeSignIn(): CliSignIn;
5
- /** Grok subscription sign-in through the Grok CLI's device-code login, which opens no browser itself. */
6
4
  export declare function grokSignIn(): CliSignIn;
7
- /** OpenCode's state: the upstream providers it has connected, and the browser sign-ins it offers. */
8
5
  export interface OpenCodeSignInState extends ManagedSignInState {
9
6
  connected?: {
10
7
  id: string;
11
8
  name: string;
12
9
  }[];
13
10
  signInOptions?: OpenCodeSignInOption[];
14
- /** The upstream provider the attempt in progress signs in to. */
15
11
  signInProvider?: string;
16
12
  }
17
- /**
18
- * Sign-in to an upstream provider inside OpenCode, through its local server.
19
- *
20
- * OpenCode runs the OAuth exchange and stores the credential where its CLI keeps it; Andorra asks
21
- * the server to begin, opens the page it names, and waits for — or forwards the code to — its
22
- * callback. The connected providers are whatever OpenCode reports afterwards.
23
- */
24
13
  export declare class OpenCodeSignIn {
25
14
  private readonly server;
26
15
  private attempt?;
@@ -32,7 +21,6 @@ export declare class OpenCodeSignIn {
32
21
  private finish;
33
22
  submitCode(attemptId: string, code: string): Promise<OpenCodeSignInState>;
34
23
  cancel(attemptId: string): Promise<OpenCodeSignInState>;
35
- /** Sign one upstream provider out of OpenCode. */
36
24
  logout(providerId: unknown): Promise<OpenCodeSignInState>;
37
25
  close(): Promise<void>;
38
26
  }
@@ -4,7 +4,6 @@ import { claudeEnvironment, readClaudeSignIn } from './claude-provider.js';
4
4
  import { resolveClaudeExecutable } from './claude-executable.js';
5
5
  import { GROK_EXECUTABLE, grokEnvironment, readGrokCatalog } from './grok-provider.js';
6
6
  import { authorizeOpenCode, completeOpenCode, listOpenCodeSignIns, readOpenCodeCatalog, sharedOpenCodeServer, signOutOpenCode, } from './opencode-cli-provider.js';
7
- /** Claude subscription sign-in through the official Claude Code CLI's own login. */
8
7
  export function claudeSignIn() {
9
8
  return new CliSignIn({
10
9
  product: 'Claude',
@@ -17,7 +16,6 @@ export function claudeSignIn() {
17
16
  acceptsCode: true,
18
17
  });
19
18
  }
20
- /** Grok subscription sign-in through the Grok CLI's device-code login, which opens no browser itself. */
21
19
  export function grokSignIn() {
22
20
  return new CliSignIn({
23
21
  product: 'Grok',
@@ -30,13 +28,6 @@ export function grokSignIn() {
30
28
  deviceCode: true,
31
29
  });
32
30
  }
33
- /**
34
- * Sign-in to an upstream provider inside OpenCode, through its local server.
35
- *
36
- * OpenCode runs the OAuth exchange and stores the credential where its CLI keeps it; Andorra asks
37
- * the server to begin, opens the page it names, and waits for — or forwards the code to — its
38
- * callback. The connected providers are whatever OpenCode reports afterwards.
39
- */
40
31
  export class OpenCodeSignIn {
41
32
  server;
42
33
  attempt;
@@ -60,7 +51,6 @@ export class OpenCodeSignIn {
60
51
  const overview = await this.overview(AbortSignal.timeout(45_000));
61
52
  if (attemptId !== undefined && attempt)
62
53
  return { ...attempt.view, ...overview };
63
- // OpenCode is usable as soon as it serves a model, including its own free tier.
64
54
  return { state: overview.connected?.length ? 'signedIn' : 'signedOut', ...overview };
65
55
  }
66
56
  catch (error) {
@@ -92,12 +82,9 @@ export class OpenCodeSignIn {
92
82
  return { ...attempt.view };
93
83
  }
94
84
  attempt.mode = authorization.method;
95
- // A device flow (GitHub Copilot, for one) names the code to confirm inside its instructions; it
96
- // is lifted out so the panel can show it as prominently as a CLI's own device code.
97
85
  const userCode = authorization.instructions?.match(/\b([A-Z0-9]{4,5}-[A-Z0-9]{4,5})\b/)?.[1];
98
86
  attempt.view = { state: 'waiting', attemptId, signInProvider: providerId, ...(authorization.method === 'code' ? { acceptsCode: true } : {}),
99
87
  ...(userCode ? { userCode } : {}), ...(authorization.instructions ? { message: authorization.instructions } : {}) };
100
- // The automatic flow completes on OpenCode's own loopback callback; this call returns when it has.
101
88
  if (authorization.method === 'auto')
102
89
  void this.finish(attempt, undefined);
103
90
  return { ...attempt.view, authUrl: authorization.url };
@@ -127,8 +114,6 @@ export class OpenCodeSignIn {
127
114
  const value = code.trim();
128
115
  if (!value || value.length > 2000 || /[\s\u0000-\u001f\u007f]/.test(value))
129
116
  return { ...attempt.view, message: 'That code is not valid. Copy the whole code from the sign-in page.' };
130
- // The exchange can outlast a request's deadline, so it finishes in the background and the
131
- // panel's status polling reports the result.
132
117
  attempt.submitted = true;
133
118
  attempt.view = { ...attempt.view, acceptsCode: undefined, message: 'Checking the code with OpenCode…' };
134
119
  void this.finish(attempt, value);
@@ -145,7 +130,6 @@ export class OpenCodeSignIn {
145
130
  }
146
131
  return { ...attempt.view };
147
132
  }
148
- /** Sign one upstream provider out of OpenCode. */
149
133
  async logout(providerId) {
150
134
  if (this.attempt?.live)
151
135
  return { state: 'error', reason: 'busy', message: 'An OpenCode sign-in is in progress. Finish or cancel it before signing out.' };
@@ -1,36 +1,8 @@
1
- /**
2
- * Render the markdown an agent writes into the plain text the transcript shows.
3
- *
4
- * The transcript paints whole lines, never spans, and picks colors from trusted
5
- * presentation markers rather than provider-supplied ANSI. Markdown therefore
6
- * becomes text that carries those markers: fenced code loses its fences and
7
- * gains a `┆` gutter that reads as code, headings become `▌` lines, emphasis
8
- * markers are dropped, and links collapse to label plus target. Prose without
9
- * markdown passes through byte-identical, so non-markdown messages render
10
- * exactly as they did before this module existed.
11
- *
12
- * Code blocks collapse in the summary view when they are long by line count or
13
- * total size, with the full rendering returned as `detail` — the same contract
14
- * truncated tool output already uses, which the terminal binds to Ctrl+O.
15
- */
16
1
  export interface RenderedMarkdown {
17
2
  text: string;
18
3
  detail?: string;
19
4
  }
20
- /** Gutter prefix marking a rendered code-block line; `transcriptColor` maps it to gray. */
21
5
  export declare const CODE_GUTTER = "\u2506";
22
- /** Prefix marking a rendered heading line; `transcriptColor` maps it to white. */
23
6
  export declare const HEADING_PREFIX = "\u258C";
24
- /**
25
- * Whether a line ends the paragraph, so emphasis or a code span cannot span across it. Exported so
26
- * completion parsing finds the same multi-line code spans the transcript renders.
27
- */
28
7
  export declare const interruptsParagraph: (line: string) => boolean;
29
- /**
30
- * Render an agent message for the transcript.
31
- * @param source - the message text, already stripped of control characters, with outer
32
- * blank lines removed but first-line indentation preserved (it may be fence indentation).
33
- * @returns the summary text, plus the full rendering as `detail` when any code
34
- * block was collapsed.
35
- */
36
8
  export declare function renderMarkdown(source: string): RenderedMarkdown;
@@ -1,53 +1,17 @@
1
- /**
2
- * Render the markdown an agent writes into the plain text the transcript shows.
3
- *
4
- * The transcript paints whole lines, never spans, and picks colors from trusted
5
- * presentation markers rather than provider-supplied ANSI. Markdown therefore
6
- * becomes text that carries those markers: fenced code loses its fences and
7
- * gains a `┆` gutter that reads as code, headings become `▌` lines, emphasis
8
- * markers are dropped, and links collapse to label plus target. Prose without
9
- * markdown passes through byte-identical, so non-markdown messages render
10
- * exactly as they did before this module existed.
11
- *
12
- * Code blocks collapse in the summary view when they are long by line count or
13
- * total size, with the full rendering returned as `detail` — the same contract
14
- * truncated tool output already uses, which the terminal binds to Ctrl+O.
15
- */
16
1
  import { clipText } from './text.js';
17
- /** Gutter prefix marking a rendered code-block line; `transcriptColor` maps it to gray. */
18
2
  export const CODE_GUTTER = '┆';
19
- /** Prefix marking a rendered heading line; `transcriptColor` maps it to white. */
20
3
  export const HEADING_PREFIX = '▌';
21
- /** A code block longer than this many lines collapses in the summary view. */
22
4
  const COLLAPSE_OVER = 8;
23
- /** A code block whose content exceeds this many characters also collapses: a minified or
24
- * base64 single line would otherwise wrap into thousands of transcript rows. */
25
5
  const COLLAPSE_CHARS = 1_200;
26
- /** Leading code-block lines kept when a block collapses. */
27
6
  const COLLAPSE_KEEP = 3;
28
- /** Kept code lines are clipped to this width so one giant line cannot flood the summary. */
29
7
  const COLLAPSE_CLIP = 240;
30
8
  const FENCE = /^( {0,3})(`{3,}|~{3,})(.*)$/;
31
- /**
32
- * A line's opening code fence, or null for prose. GFM rejects a backtick fence whose
33
- * info string contains a backtick — such a line is ordinary text, not a fence, and
34
- * treating it as one would gutter everything after it.
35
- */
36
9
  function openingFence(line) {
37
10
  const match = FENCE.exec(line);
38
11
  if (match && match[2][0] === '`' && match[3].includes('`'))
39
12
  return null;
40
13
  return match;
41
14
  }
42
- /**
43
- * Split a message into prose, fenced-code, and indented-code segments. Fences are ``` or ~~~
44
- * runs at the start of a line (up to three leading spaces, per GFM); the closing fence
45
- * uses the same character and is at least as long. An unclosed fence runs to the
46
- * end of the message: a truncated response still deserves readable code rather
47
- * than a stray literal fence. A four-space-indented run after a blank line (or at
48
- * the message start) is an indented code block, which CommonMark forbids from
49
- * interrupting a paragraph — that is why only those positions start one.
50
- */
51
15
  function parseSegments(source) {
52
16
  const segments = [];
53
17
  const lines = source.split('\n');
@@ -64,8 +28,6 @@ function parseSegments(source) {
64
28
  flushProse();
65
29
  const marker = opening[2][0];
66
30
  const closing = new RegExp(`^ {0,3}${marker}{${opening[2].length},}[ \t]*$`);
67
- // GFM strips up to the opening fence's own indentation from every content line, so
68
- // an indented opener does not leak its spaces into the rendered (and copied) code.
69
31
  const dedent = new RegExp(`^ {0,${opening[1].length}}`);
70
32
  index++;
71
33
  const start = index;
@@ -81,7 +43,6 @@ function parseSegments(source) {
81
43
  const start = index;
82
44
  while (index < lines.length && (isIndentedCode(lines[index]) || lines[index].trim() === ''))
83
45
  index++;
84
- // Trailing blank lines belong to whatever prose follows the block.
85
46
  while (index - 1 > start && lines[index - 1].trim() === '')
86
47
  index--;
87
48
  flushProse();
@@ -94,18 +55,8 @@ function parseSegments(source) {
94
55
  flushProse();
95
56
  return segments;
96
57
  }
97
- /**
98
- * Strip emphasis markers; runs after more specific constructs are protected. Nested
99
- * emphasis (`**outer *inner* outer**`) converges across passes: inner delimiters match
100
- * first, then the freed outer run. The loop is bounded — every pass only removes text.
101
- * Flanking classes are Unicode-aware (`\p{L}\p{N}_`), so intraword underscores inside
102
- * non-ASCII words (`привет_мир_снова`) are never emphasis, per CommonMark.
103
- */
104
58
  const FLANK = '\\p{L}\\p{N}_';
105
59
  const EMPHASIS_PATTERNS = [
106
- // Asterisks may delimit intraword emphasis per CommonMark (`foo*bar*baz`); only the
107
- // run boundaries are guarded. Underscores keep the alphanumeric flanking rule,
108
- // because intraword `_` is never emphasis.
109
60
  /(?<!\*)\*\*(?!\s)((?:[^*]|\*(?!\*))+?)(?<!\s)\*\*(?!\*)/gu,
110
61
  new RegExp(`(?<![${FLANK}_])__(?!\\s)((?:[^_]|_(?!_))+?)(?<!\\s)__(?![${FLANK}_])`, 'gu'),
111
62
  /(?<!\*)\*(?!\s)([^*]+?)(?<!\s)\*(?!\*)/gu,
@@ -121,17 +72,6 @@ function stripEmphasis(text) {
121
72
  }
122
73
  return current;
123
74
  }
124
- /**
125
- * Parse the destination that follows a `](` at `labelEnd + 1`.
126
- *
127
- * Two forms are recognized: an angle-bracket destination `<...>`, which may contain
128
- * spaces (`[file](<./my-*draft* file.md>)`) and ends at the first `>` on the same line,
129
- * and the bare form, whose parentheses are balanced so
130
- * `(https://example.com/a_(b)_v_)` is one destination, optionally followed by a
131
- * double-quoted title. `url` is the destination as written (without angle brackets),
132
- * `end` is the index just past the construct, and `render` says whether the destination
133
- * is an http(s) URL the transcript renders as `label (url)`.
134
- */
135
75
  function parseLinkDestination(text, labelEnd) {
136
76
  let cursor = labelEnd + 2;
137
77
  if (text[cursor] === '<') {
@@ -166,32 +106,12 @@ function parseLinkDestination(text, labelEnd) {
166
106
  return undefined;
167
107
  return { url, end: cursor + (title ? title[0].length : 1), render: /^https?:\/\//.test(url) };
168
108
  }
169
- /**
170
- * Strip the inline markdown the transcript cannot style: emphasis markers and link syntax.
171
- * Link destinations are tokenized before emphasis runs — otherwise emphasis inside a URL
172
- * (`[docs](https://example.com/*path*)`) silently rewrites the target the user would open —
173
- * and the destination is scanned with balanced-parenthesis counting, so
174
- * `(https://example.com/a_(b)_v_)` is one destination, not a prefix. The label still gets
175
- * emphasis stripping; the destination is restored verbatim. Images stay untouched. Valid
176
- * non-HTTP destinations (relative paths, fragments) are not rendered as links but are still
177
- * tokenized verbatim, so emphasis inside `./__init__.py` or `#_section_` cannot rewrite them.
178
- *
179
- * The scan is single-pass: unmatched `[` openers stack with the output watermark at push
180
- * time, and each `]` pops the innermost one, so a label is only matched once even in prose
181
- * full of brackets — rendering is O(n) in the line length. A link found inside another
182
- * candidate's label supersedes it: the outer token truncates the inner one out of the
183
- * output, so `[![alt](img)](dest)` is one construct, never two overlapping tokens. A label
184
- * that contained such a construct keeps its text verbatim, since stripping emphasis inside
185
- * it would corrupt the nested destination.
186
- */
187
109
  function stripInlineMarkdown(text) {
188
110
  const links = [];
189
111
  const stack = [];
190
112
  let masked = '';
191
113
  let index = 0;
192
114
  while (index < text.length) {
193
- // An angle autolink (`<scheme:…>`, any URI scheme per CommonMark, case-insensitive)
194
- // is left verbatim: emphasis inside its URL must not rewrite the target the user copies.
195
115
  const autolink = /^<[A-Za-z][A-Za-z0-9+.-]{1,31}:[^\s<>]*>/.exec(text.slice(index));
196
116
  if (autolink) {
197
117
  links.push({ label: '', url: autolink[0], render: false, original: autolink[0], nested: false });
@@ -223,15 +143,10 @@ function stripInlineMarkdown(text) {
223
143
  index++;
224
144
  continue;
225
145
  }
226
- // Only http(s) destinations render as `label (url)`; every other well-formed
227
- // destination is protected verbatim so its punctuation survives emphasis stripping.
228
146
  const isImage = opener.pos > 0 && text[opener.pos - 1] === '!';
229
147
  const render = !isImage && parsed.render;
230
148
  const label = text.slice(opener.pos + 1, index);
231
149
  links.push({ label, url: parsed.url, render, original: text.slice(opener.pos, parsed.end), nested: links.length > opener.tokens });
232
- // The construct supersedes everything tokenized inside its label: taking the output
233
- // back to the opener's watermark drops inner tokens, and the label reproduces the
234
- // text they stood for, so `[![alt](img)](dest)` is one construct, never two overlapping.
235
150
  masked = masked.slice(0, opener.out) + `\u0001${links.length - 1}\u0001`;
236
151
  index = parsed.end;
237
152
  }
@@ -243,25 +158,8 @@ function stripInlineMarkdown(text) {
243
158
  return label === link.url ? link.url : `${label} (${link.url})`;
244
159
  });
245
160
  }
246
- /** The ASCII punctuation GFM lets a backslash escape. */
247
161
  const ESCAPABLE = new Set('!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~');
248
- /**
249
- * Whether a line ends the paragraph, so emphasis or a code span cannot span across it. Exported so
250
- * completion parsing finds the same multi-line code spans the transcript renders.
251
- */
252
162
  export const interruptsParagraph = (line) => line.trim() === '' || NON_PARAGRAPH.test(line) || THEMATIC_BREAK.test(line) || SETEXT_UNDERLINE.test(line);
253
- /**
254
- * Mask emphasis spans that cross a soft line break before the prose is split into lines.
255
- * Line-level rendering cannot match delimiters across `\n`, which would leave both halves
256
- * literal (`**first\nsecond**`). The token restores the fully rendered inline content with
257
- * its line break intact — the same protected processing a single line gets, because the
258
- * token bypasses `renderProseLine`: bare emphasis stripping here would let a link inside
259
- * the span (`**[module](./__init__.py)\nnow**`) have its destination rewritten. Single-line
260
- * matches are left for the line-level rules, which already run after link and code-span
261
- * protection. A span is never taken across a block boundary — a blank line, list item,
262
- * heading or blockquote ends the paragraph, so `**first\n- item\nlast**` leaves the list
263
- * line to the block transforms.
264
- */
265
163
  function maskSegmentMultilineEmphasis(source) {
266
164
  const tokens = [];
267
165
  let text = source;
@@ -276,20 +174,8 @@ function maskSegmentMultilineEmphasis(source) {
276
174
  }
277
175
  return { text, tokens };
278
176
  }
279
- /**
280
- * Mask links whose label crosses a soft line break at segment scope. Per-line rendering
281
- * would split `[long\nlabel](https://example.com)` in half and process the destination as
282
- * ordinary second-line text, corrupting the target the user would copy. The token restores
283
- * the fully rendered link with its line break intact; single-line links stay on the
284
- * line-level path, and images or non-HTTP destinations restore verbatim. A construct is
285
- * never taken across a paragraph boundary — a bracket pair spanning an interrupting block
286
- * line (`[first\n- item](url)`) is left for the block transforms.
287
- */
288
177
  function maskSegmentMultilineLinks(source) {
289
178
  const tokens = [];
290
- // Openers carry their masked-output watermark, like the single-line scanner: an inner
291
- // construct (a nested image) shortens `masked`, so slicing by source offsets would
292
- // eat the prose before the outer opener.
293
179
  const stack = [];
294
180
  let masked = '';
295
181
  let index = 0;
@@ -328,20 +214,6 @@ function maskSegmentMultilineLinks(source) {
328
214
  }
329
215
  return { text: masked, tokens };
330
216
  }
331
- /**
332
- * Mask code spans that may cross newlines before line-level rendering. A valid span is a
333
- * backtick run of length N closing at the next run of exactly length N (CommonMark), and
334
- * its contents — however many lines — must reach the transcript verbatim, so the whole
335
- * span becomes one token the per-line renderer passes through untouched. A span is never
336
- * taken across a paragraph boundary: a blank line or an interrupting block (list, heading,
337
- * blockquote, break) ends the paragraph, so `` `first\n- item\nlast` `` leaves the list
338
- * line to the block transforms instead of masking the whole range.
339
- *
340
- * Backslash escapes are consumed here and masked into their own tokens, each holding the
341
- * bare escaped punctuation: an escaped delimiter never opens a code span, emphasis run, or
342
- * link label in any later segment-level pass, and the per-line renderer never needs to
343
- * re-resolve the pair.
344
- */
345
217
  function maskSegmentCodeSpans(source) {
346
218
  const tokens = [];
347
219
  const runs = /`+/g;
@@ -360,8 +232,6 @@ function maskSegmentCodeSpans(source) {
360
232
  continue;
361
233
  }
362
234
  if (source[index] === '\\') {
363
- // A bare backslash (not an escape) is copied verbatim; nextSpecial would only
364
- // rediscover it here and stop making progress.
365
235
  masked += '\\';
366
236
  index++;
367
237
  continue;
@@ -396,14 +266,6 @@ function maskSegmentCodeSpans(source) {
396
266
  }
397
267
  return { text: masked, tokens };
398
268
  }
399
- /**
400
- * Strip inline markdown everywhere except inside protected tokens. Code spans — a backtick
401
- * run of length N closing at the next run of exactly length N, per CommonMark — backslash
402
- * escapes, and unmatched backtick runs are masked into placeholder tokens first, then the
403
- * emphasis and link substitutions run over the whole line, then the tokens are restored.
404
- * Masking is what lets delimiters match across a protected span: `**Run `npm ci` now**`
405
- * still loses its bold markers, while the span's contents stay verbatim for copying.
406
- */
407
269
  function renderInline(source) {
408
270
  const runs = /`+/g;
409
271
  const tokens = [];
@@ -421,7 +283,6 @@ function renderInline(source) {
421
283
  if (char === '\\') {
422
284
  const escaped = source[index + 1];
423
285
  if (escaped && ESCAPABLE.has(escaped)) {
424
- // A backslash escape displays the bare punctuation and never forms markdown.
425
286
  masked += protect(escaped);
426
287
  index += 2;
427
288
  }
@@ -449,7 +310,7 @@ function renderInline(source) {
449
310
  }
450
311
  }
451
312
  if (closing === -1) {
452
- masked += protect(opening); // An unmatched backtick run is literal text.
313
+ masked += protect(opening);
453
314
  index += opening.length;
454
315
  }
455
316
  else {
@@ -460,44 +321,21 @@ function renderInline(source) {
460
321
  }
461
322
  return stripInlineMarkdown(masked).replace(/\u0000(\d+)\u0000/g, (_match, slot) => tokens[Number(slot)]);
462
323
  }
463
- /** A GFM thematic break: three or more of the same marker, optionally spaced (`* * *`). */
464
324
  const THEMATIC_BREAK = /^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/;
465
- /** A setext underline: only dashes or equals, which double as the unspaced thematic break. */
466
325
  const SETEXT_UNDERLINE = /^ {0,3}(?:-+|=+)[ \t]*$/;
467
- /**
468
- * Lines that open a block other than a paragraph, so a following underline is not setext:
469
- * headings, unordered and ordered list items (GFM markers `1.` through `9.` with `.` or `)`),
470
- * and blockquotes.
471
- */
472
326
  const NON_PARAGRAPH = /^(?: {0,3}#{1,6}\s|\s*[-*+]\s| {0,3}\d{1,9}[.)]\s| {0,3}>)/;
473
- /** How a thematic break renders: a fixed rule rather than a misread list bullet. */
474
327
  const BREAK_RULE = '─'.repeat(16);
475
- /** Whether this line can close a setext heading: only paragraphs end in one. A setext
476
- * underline itself just closed a heading, so the next `---` is a thematic break. */
477
328
  const closesSetextHeading = (previous) => previous.trim() !== '' && !NON_PARAGRAPH.test(previous) && !THEMATIC_BREAK.test(previous) && !SETEXT_UNDERLINE.test(previous);
478
- /** Render one prose line's markdown syntax into marker-bearing plain text. */
479
329
  function renderProseLine(source) {
480
- // A trailing hash run only closes the heading when whitespace separates it from the text,
481
- // so `# C#` keeps its language-name hash.
482
330
  const heading = /^ {0,3}#{1,6}\s+(.+?)(?:\s+#+)?\s*$/.exec(source);
483
331
  let out = heading ? `${HEADING_PREFIX} ${heading[1]}` : source;
484
- // A thematic break takes precedence over list-item parsing in GFM.
485
332
  if (THEMATIC_BREAK.test(out))
486
333
  return BREAK_RULE;
487
- // GFM keeps one space of marker padding and treats the rest as content indentation
488
- // (`- code` is a code item), so only the first space is consumed.
489
334
  out = out.replace(/^(\s*)[-*+]([ \t]+)/, (_match, indent, padding) => padding.length >= 5 ? `${indent}• ${' '.repeat(padding.length - 1)}` : `${indent}• `);
490
335
  return renderInline(out);
491
336
  }
492
337
  const codeLine = (line) => (line ? `${CODE_GUTTER} ${line}` : CODE_GUTTER);
493
338
  const summaryCodeLine = (line) => (line.length > COLLAPSE_CLIP ? `${clipText(line, COLLAPSE_CLIP - 1)}…` : line);
494
- /**
495
- * Render an agent message for the transcript.
496
- * @param source - the message text, already stripped of control characters, with outer
497
- * blank lines removed but first-line indentation preserved (it may be fence indentation).
498
- * @returns the summary text, plus the full rendering as `detail` when any code
499
- * block was collapsed.
500
- */
501
339
  export function renderMarkdown(source) {
502
340
  const segments = parseSegments(source);
503
341
  const summary = [];
@@ -505,27 +343,15 @@ export function renderMarkdown(source) {
505
343
  let collapsedAny = false;
506
344
  for (const segment of segments) {
507
345
  if (segment.kind === 'prose') {
508
- // Code spans and escapes are masked across the whole segment first (a span may
509
- // cross a newline), then links whose label crosses one — before emphasis, so an
510
- // image label containing multiline emphasis (`![**alt\ntext**](src)`) is protected
511
- // whole — then emphasis spans that cross a soft line break, then the per-line
512
- // block transforms run.
513
346
  const codeMasked = maskSegmentCodeSpans(segment.lines.join('\n'));
514
347
  const linked = maskSegmentMultilineLinks(codeMasked.text);
515
348
  const masked = maskSegmentMultilineEmphasis(linked.text);
516
349
  let previous = '';
517
350
  const rendered = masked.text.split('\n').map(line => {
518
- // `---` closing a paragraph is a setext underline, not a thematic break; after a
519
- // heading, list item, break, or blockquote the same line is a real break.
520
351
  const passThrough = closesSetextHeading(previous) && SETEXT_UNDERLINE.test(line);
521
352
  previous = line;
522
353
  return passThrough ? line : renderProseLine(line);
523
354
  }).join('\n');
524
- // Restore emphasis tokens first (bounded loop: a multiline emphasis token's value
525
- // may itself contain link, code-span, or nested placeholders), then link tokens
526
- // (their values may contain code-span placeholders), then code spans and escapes.
527
- // Any other order would leave inner placeholders reaching the transcript, where
528
- // control-character cleanup turns them into stray digits.
529
355
  let restored = rendered;
530
356
  for (let round = 0; round < 6 && restored.includes('\u0004'); round++) {
531
357
  restored = restored.replace(/\u0004(\d+)\u0004/g, (_match, slot) => masked.tokens[Number(slot)]);