@gajae-code/coding-agent 0.1.1

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 (1775) hide show
  1. package/CHANGELOG.md +8662 -0
  2. package/README.md +37 -0
  3. package/dist/types/async/index.d.ts +2 -0
  4. package/dist/types/async/job-manager.d.ts +101 -0
  5. package/dist/types/async/support.d.ts +2 -0
  6. package/dist/types/autoresearch/dashboard.d.ts +4 -0
  7. package/dist/types/autoresearch/git.d.ts +36 -0
  8. package/dist/types/autoresearch/helpers.d.ts +24 -0
  9. package/dist/types/autoresearch/index.d.ts +2 -0
  10. package/dist/types/autoresearch/state.d.ts +17 -0
  11. package/dist/types/autoresearch/storage.d.ts +142 -0
  12. package/dist/types/autoresearch/tools/init-experiment.d.ts +31 -0
  13. package/dist/types/autoresearch/tools/log-experiment.d.ts +23 -0
  14. package/dist/types/autoresearch/tools/run-experiment.d.ts +8 -0
  15. package/dist/types/autoresearch/tools/update-notes.d.ts +12 -0
  16. package/dist/types/autoresearch/types.d.ts +154 -0
  17. package/dist/types/capability/context-file.d.ts +17 -0
  18. package/dist/types/capability/extension-module.d.ts +15 -0
  19. package/dist/types/capability/extension.d.ts +28 -0
  20. package/dist/types/capability/fs.d.ts +20 -0
  21. package/dist/types/capability/hook.d.ts +19 -0
  22. package/dist/types/capability/index.d.ts +80 -0
  23. package/dist/types/capability/instruction.d.ts +17 -0
  24. package/dist/types/capability/mcp.d.ts +45 -0
  25. package/dist/types/capability/prompt.d.ts +15 -0
  26. package/dist/types/capability/rule.d.ts +61 -0
  27. package/dist/types/capability/settings.d.ts +15 -0
  28. package/dist/types/capability/skill.d.ts +36 -0
  29. package/dist/types/capability/slash-command.d.ts +17 -0
  30. package/dist/types/capability/ssh.d.ts +23 -0
  31. package/dist/types/capability/system-prompt.d.ts +15 -0
  32. package/dist/types/capability/tool.d.ts +19 -0
  33. package/dist/types/capability/types.d.ts +154 -0
  34. package/dist/types/cli/agents-cli.d.ts +12 -0
  35. package/dist/types/cli/args.d.ts +53 -0
  36. package/dist/types/cli/auth-broker-cli.d.ts +25 -0
  37. package/dist/types/cli/auth-gateway-cli.d.ts +18 -0
  38. package/dist/types/cli/classify-install-target.d.ts +18 -0
  39. package/dist/types/cli/commands/init-xdg.d.ts +1 -0
  40. package/dist/types/cli/config-cli.d.ts +22 -0
  41. package/dist/types/cli/file-processor.d.ts +11 -0
  42. package/dist/types/cli/grep-cli.d.ts +17 -0
  43. package/dist/types/cli/initial-message.d.ts +17 -0
  44. package/dist/types/cli/list-models.d.ts +30 -0
  45. package/dist/types/cli/plugin-cli.d.ts +32 -0
  46. package/dist/types/cli/read-cli.d.ts +4 -0
  47. package/dist/types/cli/session-picker.d.ts +3 -0
  48. package/dist/types/cli/setup-cli.d.ts +31 -0
  49. package/dist/types/cli/shell-cli.d.ts +8 -0
  50. package/dist/types/cli/ssh-cli.d.ts +21 -0
  51. package/dist/types/cli/stats-cli.d.ts +17 -0
  52. package/dist/types/cli/update-cli.d.ts +38 -0
  53. package/dist/types/cli/web-search-cli.d.ts +20 -0
  54. package/dist/types/cli/worktree-cli.d.ts +26 -0
  55. package/dist/types/cli.d.ts +3 -0
  56. package/dist/types/commands/acp.d.ts +12 -0
  57. package/dist/types/commands/agents.d.ts +34 -0
  58. package/dist/types/commands/auth-broker.d.ts +54 -0
  59. package/dist/types/commands/auth-gateway.d.ts +32 -0
  60. package/dist/types/commands/codex-native-hook.d.ts +6 -0
  61. package/dist/types/commands/commit.d.ts +27 -0
  62. package/dist/types/commands/config.d.ts +30 -0
  63. package/dist/types/commands/deep-interview.d.ts +7 -0
  64. package/dist/types/commands/gjc-runtime-bridge.d.ts +6 -0
  65. package/dist/types/commands/grep.d.ts +42 -0
  66. package/dist/types/commands/launch.d.ts +121 -0
  67. package/dist/types/commands/plugin.d.ts +52 -0
  68. package/dist/types/commands/question.d.ts +7 -0
  69. package/dist/types/commands/ralplan.d.ts +7 -0
  70. package/dist/types/commands/read.d.ts +15 -0
  71. package/dist/types/commands/setup.d.ts +48 -0
  72. package/dist/types/commands/shell.d.ts +21 -0
  73. package/dist/types/commands/ssh.d.ts +48 -0
  74. package/dist/types/commands/state.d.ts +7 -0
  75. package/dist/types/commands/stats.d.ts +25 -0
  76. package/dist/types/commands/team.d.ts +24 -0
  77. package/dist/types/commands/ultragoal.d.ts +7 -0
  78. package/dist/types/commands/update.d.ts +20 -0
  79. package/dist/types/commands/web-search.d.ts +33 -0
  80. package/dist/types/commands/worktree.d.ts +34 -0
  81. package/dist/types/commit/agentic/agent.d.ts +31 -0
  82. package/dist/types/commit/agentic/fallback.d.ts +5 -0
  83. package/dist/types/commit/agentic/index.d.ts +2 -0
  84. package/dist/types/commit/agentic/state.d.ts +58 -0
  85. package/dist/types/commit/agentic/tools/analyze-file.d.ts +19 -0
  86. package/dist/types/commit/agentic/tools/git-file-diff.d.ts +10 -0
  87. package/dist/types/commit/agentic/tools/git-hunk.d.ts +9 -0
  88. package/dist/types/commit/agentic/tools/git-overview.d.ts +9 -0
  89. package/dist/types/commit/agentic/tools/index.d.ts +16 -0
  90. package/dist/types/commit/agentic/tools/propose-changelog.d.ts +28 -0
  91. package/dist/types/commit/agentic/tools/propose-commit.d.ts +36 -0
  92. package/dist/types/commit/agentic/tools/recent-commits.d.ts +7 -0
  93. package/dist/types/commit/agentic/tools/schemas.d.ts +27 -0
  94. package/dist/types/commit/agentic/tools/split-commit.d.ts +53 -0
  95. package/dist/types/commit/agentic/topo-sort.d.ts +4 -0
  96. package/dist/types/commit/agentic/trivial.d.ts +7 -0
  97. package/dist/types/commit/agentic/validation.d.ts +20 -0
  98. package/dist/types/commit/analysis/conventional.d.ts +22 -0
  99. package/dist/types/commit/analysis/index.d.ts +4 -0
  100. package/dist/types/commit/analysis/scope.d.ts +6 -0
  101. package/dist/types/commit/analysis/summary.d.ts +19 -0
  102. package/dist/types/commit/analysis/validation.d.ts +8 -0
  103. package/dist/types/commit/changelog/detect.d.ts +2 -0
  104. package/dist/types/commit/changelog/generate.d.ts +30 -0
  105. package/dist/types/commit/changelog/index.d.ts +30 -0
  106. package/dist/types/commit/changelog/parse.d.ts +2 -0
  107. package/dist/types/commit/cli.d.ts +3 -0
  108. package/dist/types/commit/git/diff.d.ts +5 -0
  109. package/dist/types/commit/index.d.ts +4 -0
  110. package/dist/types/commit/map-reduce/index.d.ts +28 -0
  111. package/dist/types/commit/map-reduce/map-phase.d.ts +17 -0
  112. package/dist/types/commit/map-reduce/reduce-phase.d.ts +13 -0
  113. package/dist/types/commit/map-reduce/utils.d.ts +2 -0
  114. package/dist/types/commit/message.d.ts +2 -0
  115. package/dist/types/commit/model-selection.d.ts +15 -0
  116. package/dist/types/commit/pipeline.d.ts +5 -0
  117. package/dist/types/commit/shared-llm.d.ts +54 -0
  118. package/dist/types/commit/types.d.ts +78 -0
  119. package/dist/types/commit/utils/exclusions.d.ts +4 -0
  120. package/dist/types/commit/utils.d.ts +20 -0
  121. package/dist/types/config/config-file.d.ts +58 -0
  122. package/dist/types/config/file-lock.d.ts +6 -0
  123. package/dist/types/config/keybindings.d.ts +334 -0
  124. package/dist/types/config/model-equivalence.d.ts +24 -0
  125. package/dist/types/config/model-registry.d.ts +390 -0
  126. package/dist/types/config/model-resolver.d.ts +230 -0
  127. package/dist/types/config/models-config-schema.d.ts +504 -0
  128. package/dist/types/config/prompt-templates.d.ts +32 -0
  129. package/dist/types/config/resolve-config-value.d.ts +17 -0
  130. package/dist/types/config/settings-schema.d.ts +3337 -0
  131. package/dist/types/config/settings.d.ts +132 -0
  132. package/dist/types/config/skill-settings-defaults.d.ts +14 -0
  133. package/dist/types/config.d.ts +66 -0
  134. package/dist/types/cursor.d.ts +24 -0
  135. package/dist/types/dap/client.d.ts +38 -0
  136. package/dist/types/dap/config.d.ts +6 -0
  137. package/dist/types/dap/index.d.ts +4 -0
  138. package/dist/types/dap/session.d.ts +108 -0
  139. package/dist/types/dap/types.d.ts +524 -0
  140. package/dist/types/debug/index.d.ts +15 -0
  141. package/dist/types/debug/log-formatting.d.ts +4 -0
  142. package/dist/types/debug/log-viewer.d.ts +68 -0
  143. package/dist/types/debug/profiler.d.ts +24 -0
  144. package/dist/types/debug/raw-sse-buffer.d.ts +44 -0
  145. package/dist/types/debug/raw-sse.d.ts +16 -0
  146. package/dist/types/debug/report-bundle.d.ts +55 -0
  147. package/dist/types/debug/system-info.d.ts +26 -0
  148. package/dist/types/defaults/gjc-defaults.d.ts +44 -0
  149. package/dist/types/discovery/agents-md.d.ts +1 -0
  150. package/dist/types/discovery/agents.d.ts +12 -0
  151. package/dist/types/discovery/builtin.d.ts +1 -0
  152. package/dist/types/discovery/claude-plugins.d.ts +1 -0
  153. package/dist/types/discovery/claude.d.ts +1 -0
  154. package/dist/types/discovery/cline.d.ts +1 -0
  155. package/dist/types/discovery/codex.d.ts +1 -0
  156. package/dist/types/discovery/cursor.d.ts +16 -0
  157. package/dist/types/discovery/gemini.d.ts +1 -0
  158. package/dist/types/discovery/github.d.ts +1 -0
  159. package/dist/types/discovery/helpers.d.ts +268 -0
  160. package/dist/types/discovery/index.d.ts +48 -0
  161. package/dist/types/discovery/mcp-json.d.ts +1 -0
  162. package/dist/types/discovery/opencode.d.ts +1 -0
  163. package/dist/types/discovery/plugin-dir-roots.d.ts +15 -0
  164. package/dist/types/discovery/ssh.d.ts +1 -0
  165. package/dist/types/discovery/substitute-plugin-root.d.ts +5 -0
  166. package/dist/types/discovery/vscode.d.ts +1 -0
  167. package/dist/types/discovery/windsurf.d.ts +13 -0
  168. package/dist/types/edit/apply-patch/index.d.ts +35 -0
  169. package/dist/types/edit/apply-patch/parser.d.ts +34 -0
  170. package/dist/types/edit/diff.d.ts +59 -0
  171. package/dist/types/edit/file-read-cache.d.ts +25 -0
  172. package/dist/types/edit/index.d.ts +58 -0
  173. package/dist/types/edit/modes/apply-patch.d.ts +24 -0
  174. package/dist/types/edit/modes/patch.d.ts +99 -0
  175. package/dist/types/edit/modes/replace.d.ts +142 -0
  176. package/dist/types/edit/normalize.d.ts +43 -0
  177. package/dist/types/edit/notebook.d.ts +23 -0
  178. package/dist/types/edit/read-file.d.ts +2 -0
  179. package/dist/types/edit/renderer.d.ts +110 -0
  180. package/dist/types/edit/streaming.d.ts +66 -0
  181. package/dist/types/eval/backend.d.ts +40 -0
  182. package/dist/types/eval/index.d.ts +4 -0
  183. package/dist/types/eval/js/context-manager.d.ts +24 -0
  184. package/dist/types/eval/js/executor.d.ts +28 -0
  185. package/dist/types/eval/js/index.d.ts +10 -0
  186. package/dist/types/eval/js/shared/helpers.d.ts +38 -0
  187. package/dist/types/eval/js/shared/indirect-eval.d.ts +14 -0
  188. package/dist/types/eval/js/shared/prelude.d.ts +1 -0
  189. package/dist/types/eval/js/shared/rewrite-imports.d.ts +6 -0
  190. package/dist/types/eval/js/shared/runtime.d.ts +47 -0
  191. package/dist/types/eval/js/shared/types.d.ts +24 -0
  192. package/dist/types/eval/js/tool-bridge.d.ts +18 -0
  193. package/dist/types/eval/js/worker-core.d.ts +5 -0
  194. package/dist/types/eval/js/worker-entry.d.ts +1 -0
  195. package/dist/types/eval/js/worker-protocol.d.ts +77 -0
  196. package/dist/types/eval/py/display.d.ts +25 -0
  197. package/dist/types/eval/py/executor.d.ts +83 -0
  198. package/dist/types/eval/py/index.d.ts +10 -0
  199. package/dist/types/eval/py/kernel.d.ts +61 -0
  200. package/dist/types/eval/py/prelude.d.ts +1 -0
  201. package/dist/types/eval/py/runtime.d.ts +21 -0
  202. package/dist/types/eval/py/tool-bridge.d.ts +20 -0
  203. package/dist/types/eval/types.d.ts +52 -0
  204. package/dist/types/exa/factory.d.ts +13 -0
  205. package/dist/types/exa/index.d.ts +20 -0
  206. package/dist/types/exa/mcp-client.d.ts +45 -0
  207. package/dist/types/exa/render.d.ts +19 -0
  208. package/dist/types/exa/researcher.d.ts +9 -0
  209. package/dist/types/exa/search.d.ts +9 -0
  210. package/dist/types/exa/types.d.ts +155 -0
  211. package/dist/types/exa/websets.d.ts +9 -0
  212. package/dist/types/exec/bash-executor.d.ts +41 -0
  213. package/dist/types/exec/exec.d.ts +25 -0
  214. package/dist/types/exec/idle-timeout-watchdog.d.ts +18 -0
  215. package/dist/types/exec/non-interactive-env.d.ts +1 -0
  216. package/dist/types/export/custom-share.d.ts +20 -0
  217. package/dist/types/export/html/index.d.ts +10 -0
  218. package/dist/types/export/html/template.generated.d.ts +1 -0
  219. package/dist/types/export/html/template.macro.d.ts +5 -0
  220. package/dist/types/export/ttsr.d.ts +44 -0
  221. package/dist/types/extensibility/custom-commands/bundled/ci-green/index.d.ts +9 -0
  222. package/dist/types/extensibility/custom-commands/bundled/review/index.d.ts +10 -0
  223. package/dist/types/extensibility/custom-commands/index.d.ts +2 -0
  224. package/dist/types/extensibility/custom-commands/loader.d.ts +29 -0
  225. package/dist/types/extensibility/custom-commands/types.d.ts +106 -0
  226. package/dist/types/extensibility/custom-tools/index.d.ts +6 -0
  227. package/dist/types/extensibility/custom-tools/loader.d.ts +69 -0
  228. package/dist/types/extensibility/custom-tools/types.d.ts +226 -0
  229. package/dist/types/extensibility/custom-tools/wrapper.d.ts +23 -0
  230. package/dist/types/extensibility/extensions/compact-handler.d.ts +26 -0
  231. package/dist/types/extensibility/extensions/get-commands-handler.d.ts +29 -0
  232. package/dist/types/extensibility/extensions/index.d.ts +8 -0
  233. package/dist/types/extensibility/extensions/loader.d.ts +43 -0
  234. package/dist/types/extensibility/extensions/runner.d.ts +134 -0
  235. package/dist/types/extensibility/extensions/types.d.ts +864 -0
  236. package/dist/types/extensibility/extensions/wrapper.d.ts +54 -0
  237. package/dist/types/extensibility/hooks/index.d.ts +5 -0
  238. package/dist/types/extensibility/hooks/loader.d.ts +89 -0
  239. package/dist/types/extensibility/hooks/runner.d.ts +126 -0
  240. package/dist/types/extensibility/hooks/tool-wrapper.d.ts +25 -0
  241. package/dist/types/extensibility/hooks/types.d.ts +431 -0
  242. package/dist/types/extensibility/plugins/doctor.d.ts +3 -0
  243. package/dist/types/extensibility/plugins/git-url.d.ts +34 -0
  244. package/dist/types/extensibility/plugins/index.d.ts +7 -0
  245. package/dist/types/extensibility/plugins/installer.d.ts +5 -0
  246. package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +2 -0
  247. package/dist/types/extensibility/plugins/loader.d.ts +31 -0
  248. package/dist/types/extensibility/plugins/manager.d.ts +65 -0
  249. package/dist/types/extensibility/plugins/marketplace/cache.d.ts +41 -0
  250. package/dist/types/extensibility/plugins/marketplace/fetcher.d.ts +48 -0
  251. package/dist/types/extensibility/plugins/marketplace/index.d.ts +6 -0
  252. package/dist/types/extensibility/plugins/marketplace/manager.d.ts +57 -0
  253. package/dist/types/extensibility/plugins/marketplace/registry.d.ts +34 -0
  254. package/dist/types/extensibility/plugins/marketplace/source-resolver.d.ts +28 -0
  255. package/dist/types/extensibility/plugins/marketplace/types.d.ts +130 -0
  256. package/dist/types/extensibility/plugins/parser.d.ts +52 -0
  257. package/dist/types/extensibility/plugins/types.d.ts +149 -0
  258. package/dist/types/extensibility/shared-events.d.ts +279 -0
  259. package/dist/types/extensibility/skills.d.ts +74 -0
  260. package/dist/types/extensibility/slash-commands.d.ts +48 -0
  261. package/dist/types/extensibility/tool-proxy.d.ts +4 -0
  262. package/dist/types/extensibility/typebox.d.ts +155 -0
  263. package/dist/types/extensibility/utils.d.ts +12 -0
  264. package/dist/types/gjc-runtime/goal-mode-request.d.ts +46 -0
  265. package/dist/types/gjc-runtime/launch-tmux.d.ts +45 -0
  266. package/dist/types/gjc-runtime/launch-worktree.d.ts +46 -0
  267. package/dist/types/gjc-runtime/team-runtime.d.ts +204 -0
  268. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +85 -0
  269. package/dist/types/goals/index.d.ts +3 -0
  270. package/dist/types/goals/runtime.d.ts +68 -0
  271. package/dist/types/goals/state.d.ts +35 -0
  272. package/dist/types/goals/tools/goal-tool.d.ts +128 -0
  273. package/dist/types/hashline/anchors.d.ts +20 -0
  274. package/dist/types/hashline/apply.d.ts +14 -0
  275. package/dist/types/hashline/constants.d.ts +19 -0
  276. package/dist/types/hashline/diff-preview.d.ts +2 -0
  277. package/dist/types/hashline/diff.d.ts +17 -0
  278. package/dist/types/hashline/execute.d.ts +4 -0
  279. package/dist/types/hashline/hash.d.ts +123 -0
  280. package/dist/types/hashline/index.d.ts +13 -0
  281. package/dist/types/hashline/input.d.ts +11 -0
  282. package/dist/types/hashline/parser.d.ts +7 -0
  283. package/dist/types/hashline/prefixes.d.ts +7 -0
  284. package/dist/types/hashline/recovery.d.ts +27 -0
  285. package/dist/types/hashline/stream.d.ts +2 -0
  286. package/dist/types/hashline/types.d.ts +77 -0
  287. package/dist/types/hindsight/backend.d.ts +13 -0
  288. package/dist/types/hindsight/bank.d.ts +54 -0
  289. package/dist/types/hindsight/client.d.ts +224 -0
  290. package/dist/types/hindsight/config.d.ts +51 -0
  291. package/dist/types/hindsight/content.d.ts +70 -0
  292. package/dist/types/hindsight/index.d.ts +8 -0
  293. package/dist/types/hindsight/mental-models.d.ts +125 -0
  294. package/dist/types/hindsight/state.d.ts +99 -0
  295. package/dist/types/hindsight/transcript.d.ts +28 -0
  296. package/dist/types/hooks/codex-native-hooks-config.d.ts +29 -0
  297. package/dist/types/hooks/native-skill-hook.d.ts +16 -0
  298. package/dist/types/hooks/skill-keywords.d.ts +17 -0
  299. package/dist/types/hooks/skill-state.d.ts +80 -0
  300. package/dist/types/index.d.ts +33 -0
  301. package/dist/types/internal-urls/agent-protocol.d.ts +12 -0
  302. package/dist/types/internal-urls/artifact-protocol.d.ts +6 -0
  303. package/dist/types/internal-urls/docs-index.generated.d.ts +2 -0
  304. package/dist/types/internal-urls/gjc-protocol.d.ts +12 -0
  305. package/dist/types/internal-urls/index.d.ts +20 -0
  306. package/dist/types/internal-urls/issue-pr-protocol.d.ts +17 -0
  307. package/dist/types/internal-urls/json-query.d.ts +30 -0
  308. package/dist/types/internal-urls/local-protocol.d.ts +39 -0
  309. package/dist/types/internal-urls/mcp-protocol.d.ts +12 -0
  310. package/dist/types/internal-urls/memory-protocol.d.ts +23 -0
  311. package/dist/types/internal-urls/parse.d.ts +19 -0
  312. package/dist/types/internal-urls/registry-helpers.d.ts +10 -0
  313. package/dist/types/internal-urls/router.d.ts +14 -0
  314. package/dist/types/internal-urls/rule-protocol.d.ts +6 -0
  315. package/dist/types/internal-urls/skill-protocol.d.ts +13 -0
  316. package/dist/types/internal-urls/types.d.ts +105 -0
  317. package/dist/types/lsp/client.d.ts +65 -0
  318. package/dist/types/lsp/clients/biome-client.d.ts +16 -0
  319. package/dist/types/lsp/clients/index.d.ts +19 -0
  320. package/dist/types/lsp/clients/lsp-linter-client.d.ts +16 -0
  321. package/dist/types/lsp/clients/swiftlint-client.d.ts +20 -0
  322. package/dist/types/lsp/config.d.ts +65 -0
  323. package/dist/types/lsp/edits.d.ts +23 -0
  324. package/dist/types/lsp/index.d.ts +130 -0
  325. package/dist/types/lsp/lspmux.d.ts +58 -0
  326. package/dist/types/lsp/render.d.ts +32 -0
  327. package/dist/types/lsp/startup-events.d.ts +11 -0
  328. package/dist/types/lsp/types.d.ts +302 -0
  329. package/dist/types/lsp/utils.d.ts +108 -0
  330. package/dist/types/main.d.ts +50 -0
  331. package/dist/types/memories/index.d.ts +28 -0
  332. package/dist/types/memories/storage.d.ts +110 -0
  333. package/dist/types/memory-backend/index.d.ts +4 -0
  334. package/dist/types/memory-backend/local-backend.d.ts +9 -0
  335. package/dist/types/memory-backend/off-backend.d.ts +7 -0
  336. package/dist/types/memory-backend/resolve.d.ts +15 -0
  337. package/dist/types/memory-backend/types.d.ts +61 -0
  338. package/dist/types/modes/acp/acp-agent.d.ts +61 -0
  339. package/dist/types/modes/acp/acp-client-bridge.d.ts +9 -0
  340. package/dist/types/modes/acp/acp-event-mapper.d.ts +32 -0
  341. package/dist/types/modes/acp/acp-mode.d.ts +5 -0
  342. package/dist/types/modes/acp/index.d.ts +2 -0
  343. package/dist/types/modes/acp/terminal-auth.d.ts +6 -0
  344. package/dist/types/modes/components/agent-dashboard.d.ts +21 -0
  345. package/dist/types/modes/components/assistant-message.d.ts +16 -0
  346. package/dist/types/modes/components/bash-execution.d.ts +29 -0
  347. package/dist/types/modes/components/bordered-loader.d.ts +11 -0
  348. package/dist/types/modes/components/branch-summary-message.d.ts +13 -0
  349. package/dist/types/modes/components/btw-panel.d.ts +16 -0
  350. package/dist/types/modes/components/compaction-summary-message.d.ts +13 -0
  351. package/dist/types/modes/components/countdown-timer.d.ts +14 -0
  352. package/dist/types/modes/components/custom-editor.d.ts +47 -0
  353. package/dist/types/modes/components/custom-message.d.ts +15 -0
  354. package/dist/types/modes/components/diff.d.ts +11 -0
  355. package/dist/types/modes/components/dynamic-border.d.ts +14 -0
  356. package/dist/types/modes/components/eval-execution.d.ts +23 -0
  357. package/dist/types/modes/components/execution-shared.d.ts +46 -0
  358. package/dist/types/modes/components/extensions/extension-dashboard.d.ts +26 -0
  359. package/dist/types/modes/components/extensions/extension-list.d.ts +39 -0
  360. package/dist/types/modes/components/extensions/index.d.ts +8 -0
  361. package/dist/types/modes/components/extensions/inspector-panel.d.ts +8 -0
  362. package/dist/types/modes/components/extensions/state-manager.d.ts +50 -0
  363. package/dist/types/modes/components/extensions/types.d.ts +151 -0
  364. package/dist/types/modes/components/footer.d.ts +30 -0
  365. package/dist/types/modes/components/history-search.d.ts +7 -0
  366. package/dist/types/modes/components/hook-editor.d.ts +18 -0
  367. package/dist/types/modes/components/hook-input.d.ts +15 -0
  368. package/dist/types/modes/components/hook-message.d.ts +15 -0
  369. package/dist/types/modes/components/hook-selector.d.ts +23 -0
  370. package/dist/types/modes/components/index.d.ts +35 -0
  371. package/dist/types/modes/components/keybinding-hints.d.ts +40 -0
  372. package/dist/types/modes/components/login-dialog.d.ts +32 -0
  373. package/dist/types/modes/components/message-frame.d.ts +42 -0
  374. package/dist/types/modes/components/model-selector.d.ts +26 -0
  375. package/dist/types/modes/components/oauth-selector.d.ts +14 -0
  376. package/dist/types/modes/components/plugin-selector.d.ts +26 -0
  377. package/dist/types/modes/components/plugin-settings.d.ts +66 -0
  378. package/dist/types/modes/components/provider-onboarding-selector.d.ts +7 -0
  379. package/dist/types/modes/components/queue-mode-selector.d.ts +9 -0
  380. package/dist/types/modes/components/read-tool-group.d.ts +30 -0
  381. package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +25 -0
  382. package/dist/types/modes/components/session-observer-overlay.d.ts +11 -0
  383. package/dist/types/modes/components/session-selector.d.ts +30 -0
  384. package/dist/types/modes/components/settings-defs.d.ts +50 -0
  385. package/dist/types/modes/components/settings-selector.d.ts +54 -0
  386. package/dist/types/modes/components/show-images-selector.d.ts +9 -0
  387. package/dist/types/modes/components/skill-hud/render.d.ts +2 -0
  388. package/dist/types/modes/components/skill-message.d.ts +9 -0
  389. package/dist/types/modes/components/status-line/context-thresholds.d.ts +4 -0
  390. package/dist/types/modes/components/status-line/git-utils.d.ts +22 -0
  391. package/dist/types/modes/components/status-line/index.d.ts +4 -0
  392. package/dist/types/modes/components/status-line/presets.d.ts +3 -0
  393. package/dist/types/modes/components/status-line/segments.d.ts +5 -0
  394. package/dist/types/modes/components/status-line/separators.d.ts +3 -0
  395. package/dist/types/modes/components/status-line/token-rate.d.ts +10 -0
  396. package/dist/types/modes/components/status-line/types.d.ts +80 -0
  397. package/dist/types/modes/components/status-line.d.ts +80 -0
  398. package/dist/types/modes/components/theme-selector.d.ts +10 -0
  399. package/dist/types/modes/components/thinking-selector.d.ts +10 -0
  400. package/dist/types/modes/components/todo-reminder.d.ts +13 -0
  401. package/dist/types/modes/components/tool-execution.d.ts +53 -0
  402. package/dist/types/modes/components/tree-selector.d.ts +31 -0
  403. package/dist/types/modes/components/ttsr-notification.d.ts +13 -0
  404. package/dist/types/modes/components/user-message-selector.d.ts +28 -0
  405. package/dist/types/modes/components/user-message.d.ts +7 -0
  406. package/dist/types/modes/components/visual-truncate.d.ts +19 -0
  407. package/dist/types/modes/components/welcome.d.ts +34 -0
  408. package/dist/types/modes/controllers/btw-controller.d.ts +10 -0
  409. package/dist/types/modes/controllers/command-controller-shared.d.ts +47 -0
  410. package/dist/types/modes/controllers/command-controller.d.ts +36 -0
  411. package/dist/types/modes/controllers/event-controller.d.ts +12 -0
  412. package/dist/types/modes/controllers/extension-ui-controller.d.ts +80 -0
  413. package/dist/types/modes/controllers/input-controller.d.ts +35 -0
  414. package/dist/types/modes/controllers/runtime-mcp-command-controller.d.ts +10 -0
  415. package/dist/types/modes/controllers/selector-controller.d.ts +46 -0
  416. package/dist/types/modes/controllers/ssh-command-controller.d.ts +10 -0
  417. package/dist/types/modes/controllers/todo-command-controller.d.ts +7 -0
  418. package/dist/types/modes/emoji-autocomplete.d.ts +16 -0
  419. package/dist/types/modes/index.d.ts +9 -0
  420. package/dist/types/modes/interactive-mode.d.ts +271 -0
  421. package/dist/types/modes/loop-limit.d.ts +22 -0
  422. package/dist/types/modes/oauth-manual-input.d.ts +8 -0
  423. package/dist/types/modes/print-mode.d.ts +27 -0
  424. package/dist/types/modes/prompt-action-autocomplete.d.ts +46 -0
  425. package/dist/types/modes/rpc/host-tools.d.ts +16 -0
  426. package/dist/types/modes/rpc/host-uris.d.ts +38 -0
  427. package/dist/types/modes/rpc/rpc-client.d.ts +249 -0
  428. package/dist/types/modes/rpc/rpc-mode.d.ts +17 -0
  429. package/dist/types/modes/rpc/rpc-types.d.ts +586 -0
  430. package/dist/types/modes/runtime-init.d.ts +21 -0
  431. package/dist/types/modes/session-observer-registry.d.ts +26 -0
  432. package/dist/types/modes/shared.d.ts +15 -0
  433. package/dist/types/modes/theme/defaults/index.d.ts +9559 -0
  434. package/dist/types/modes/theme/mermaid-cache.d.ts +9 -0
  435. package/dist/types/modes/theme/shimmer.d.ts +38 -0
  436. package/dist/types/modes/theme/theme.d.ts +273 -0
  437. package/dist/types/modes/types.d.ts +278 -0
  438. package/dist/types/modes/utils/context-usage.d.ts +47 -0
  439. package/dist/types/modes/utils/hotkeys-markdown.d.ts +5 -0
  440. package/dist/types/modes/utils/keybinding-matchers.d.ts +10 -0
  441. package/dist/types/modes/utils/tools-markdown.d.ts +5 -0
  442. package/dist/types/modes/utils/ui-helpers.d.ts +53 -0
  443. package/dist/types/plan-mode/approved-plan.d.ts +49 -0
  444. package/dist/types/plan-mode/state.d.ts +6 -0
  445. package/dist/types/registry/agent-registry.d.ts +62 -0
  446. package/dist/types/runtime-mcp/client.d.ts +74 -0
  447. package/dist/types/runtime-mcp/config-writer.d.ts +53 -0
  448. package/dist/types/runtime-mcp/config.d.ts +75 -0
  449. package/dist/types/runtime-mcp/discoverable-tool-metadata.d.ts +7 -0
  450. package/dist/types/runtime-mcp/index.d.ts +18 -0
  451. package/dist/types/runtime-mcp/json-rpc.d.ts +22 -0
  452. package/dist/types/runtime-mcp/loader.d.ts +43 -0
  453. package/dist/types/runtime-mcp/manager.d.ts +193 -0
  454. package/dist/types/runtime-mcp/oauth-discovery.d.ts +40 -0
  455. package/dist/types/runtime-mcp/oauth-flow.d.ts +59 -0
  456. package/dist/types/runtime-mcp/render.d.ts +25 -0
  457. package/dist/types/runtime-mcp/smithery-auth.d.ts +16 -0
  458. package/dist/types/runtime-mcp/smithery-connect.d.ts +38 -0
  459. package/dist/types/runtime-mcp/smithery-registry.d.ts +51 -0
  460. package/dist/types/runtime-mcp/tool-bridge.d.ts +86 -0
  461. package/dist/types/runtime-mcp/tool-cache.d.ts +8 -0
  462. package/dist/types/runtime-mcp/transports/http.d.ts +36 -0
  463. package/dist/types/runtime-mcp/transports/index.d.ts +5 -0
  464. package/dist/types/runtime-mcp/transports/stdio.d.ts +32 -0
  465. package/dist/types/runtime-mcp/types.d.ts +333 -0
  466. package/dist/types/sdk.d.ts +216 -0
  467. package/dist/types/secrets/index.d.ts +9 -0
  468. package/dist/types/secrets/obfuscator.d.ts +23 -0
  469. package/dist/types/secrets/regex.d.ts +2 -0
  470. package/dist/types/session/agent-session.d.ts +930 -0
  471. package/dist/types/session/agent-storage.d.ts +100 -0
  472. package/dist/types/session/artifacts.d.ts +61 -0
  473. package/dist/types/session/auth-broker-config.d.ts +13 -0
  474. package/dist/types/session/auth-storage.d.ts +6 -0
  475. package/dist/types/session/blob-store.d.ts +63 -0
  476. package/dist/types/session/client-bridge.d.ts +88 -0
  477. package/dist/types/session/history-storage.d.ts +16 -0
  478. package/dist/types/session/messages.d.ts +162 -0
  479. package/dist/types/session/session-dump-format.d.ts +22 -0
  480. package/dist/types/session/session-manager.d.ts +549 -0
  481. package/dist/types/session/session-storage.d.ts +82 -0
  482. package/dist/types/session/streaming-output.d.ts +185 -0
  483. package/dist/types/session/tool-choice-queue.d.ts +78 -0
  484. package/dist/types/session/yield-queue.d.ts +24 -0
  485. package/dist/types/setup/model-onboarding-guidance.d.ts +8 -0
  486. package/dist/types/setup/provider-onboarding.d.ts +28 -0
  487. package/dist/types/skill-state/active-state.d.ts +50 -0
  488. package/dist/types/slash-commands/acp-builtins.d.ts +18 -0
  489. package/dist/types/slash-commands/builtin-registry.d.ts +23 -0
  490. package/dist/types/slash-commands/helpers/context-report.d.ts +7 -0
  491. package/dist/types/slash-commands/helpers/format.d.ts +10 -0
  492. package/dist/types/slash-commands/helpers/mcp.d.ts +3 -0
  493. package/dist/types/slash-commands/helpers/parse.d.ts +33 -0
  494. package/dist/types/slash-commands/helpers/ssh.d.ts +3 -0
  495. package/dist/types/slash-commands/helpers/todo.d.ts +3 -0
  496. package/dist/types/slash-commands/helpers/usage-report.d.ts +7 -0
  497. package/dist/types/slash-commands/types.d.ts +118 -0
  498. package/dist/types/ssh/config-writer.d.ts +49 -0
  499. package/dist/types/ssh/connection-manager.d.ts +33 -0
  500. package/dist/types/ssh/ssh-executor.d.ts +37 -0
  501. package/dist/types/ssh/sshfs-mount.d.ts +6 -0
  502. package/dist/types/ssh/utils.d.ts +2 -0
  503. package/dist/types/stt/downloader.d.ts +9 -0
  504. package/dist/types/stt/index.d.ts +3 -0
  505. package/dist/types/stt/recorder.d.ts +13 -0
  506. package/dist/types/stt/setup.d.ts +18 -0
  507. package/dist/types/stt/stt-controller.d.ts +16 -0
  508. package/dist/types/stt/transcriber.d.ts +16 -0
  509. package/dist/types/system-prompt.d.ts +93 -0
  510. package/dist/types/task/agents.d.ts +28 -0
  511. package/dist/types/task/commands.d.ts +35 -0
  512. package/dist/types/task/discovery.d.ts +19 -0
  513. package/dist/types/task/executor.d.ts +106 -0
  514. package/dist/types/task/gjc-command.d.ts +7 -0
  515. package/dist/types/task/index.d.ts +38 -0
  516. package/dist/types/task/name-generator.d.ts +16 -0
  517. package/dist/types/task/output-manager.d.ts +36 -0
  518. package/dist/types/task/parallel.d.ts +34 -0
  519. package/dist/types/task/render.d.ts +22 -0
  520. package/dist/types/task/simple-mode.d.ts +8 -0
  521. package/dist/types/task/subprocess-tool-registry.d.ts +72 -0
  522. package/dist/types/task/types.d.ts +295 -0
  523. package/dist/types/task/worktree.d.ts +94 -0
  524. package/dist/types/thinking.d.ts +30 -0
  525. package/dist/types/tool-discovery/tool-index.d.ts +112 -0
  526. package/dist/types/tools/archive-reader.d.ts +40 -0
  527. package/dist/types/tools/ask.d.ts +109 -0
  528. package/dist/types/tools/ast-edit.d.ts +77 -0
  529. package/dist/types/tools/ast-grep.d.ts +69 -0
  530. package/dist/types/tools/auto-generated-guard.d.ts +17 -0
  531. package/dist/types/tools/bash-command-fixup.d.ts +11 -0
  532. package/dist/types/tools/bash-interactive.d.ts +16 -0
  533. package/dist/types/tools/bash-interceptor.d.ts +24 -0
  534. package/dist/types/tools/bash-pty-selection.d.ts +7 -0
  535. package/dist/types/tools/bash-skill-urls.d.ts +31 -0
  536. package/dist/types/tools/bash.d.ts +130 -0
  537. package/dist/types/tools/browser/attach.d.ts +34 -0
  538. package/dist/types/tools/browser/launch.d.ts +62 -0
  539. package/dist/types/tools/browser/readable.d.ts +17 -0
  540. package/dist/types/tools/browser/registry.d.ts +42 -0
  541. package/dist/types/tools/browser/render.d.ts +50 -0
  542. package/dist/types/tools/browser/tab-protocol.d.ts +144 -0
  543. package/dist/types/tools/browser/tab-supervisor.d.ts +63 -0
  544. package/dist/types/tools/browser/tab-worker-entry.d.ts +1 -0
  545. package/dist/types/tools/browser/tab-worker.d.ts +19 -0
  546. package/dist/types/tools/browser.d.ts +114 -0
  547. package/dist/types/tools/calculator.d.ts +76 -0
  548. package/dist/types/tools/checkpoint.d.ts +63 -0
  549. package/dist/types/tools/conflict-detect.d.ts +205 -0
  550. package/dist/types/tools/context.d.ts +19 -0
  551. package/dist/types/tools/debug.d.ts +209 -0
  552. package/dist/types/tools/eval.d.ts +108 -0
  553. package/dist/types/tools/fetch.d.ts +61 -0
  554. package/dist/types/tools/file-recorder.d.ts +13 -0
  555. package/dist/types/tools/find.d.ts +95 -0
  556. package/dist/types/tools/fs-cache-invalidation.d.ts +15 -0
  557. package/dist/types/tools/gh-format.d.ts +6 -0
  558. package/dist/types/tools/gh-renderer.d.ts +25 -0
  559. package/dist/types/tools/gh.d.ts +356 -0
  560. package/dist/types/tools/github-cache.d.ts +103 -0
  561. package/dist/types/tools/grouped-file-output.d.ts +36 -0
  562. package/dist/types/tools/hindsight-recall.d.ts +23 -0
  563. package/dist/types/tools/hindsight-reflect.d.ts +25 -0
  564. package/dist/types/tools/hindsight-retain.d.ts +29 -0
  565. package/dist/types/tools/image-gen.d.ts +78 -0
  566. package/dist/types/tools/index.d.ts +242 -0
  567. package/dist/types/tools/inspect-image-renderer.d.ts +26 -0
  568. package/dist/types/tools/inspect-image.d.ts +31 -0
  569. package/dist/types/tools/irc.d.ts +79 -0
  570. package/dist/types/tools/job.d.ts +65 -0
  571. package/dist/types/tools/json-tree.d.ts +23 -0
  572. package/dist/types/tools/jtd-to-json-schema.d.ts +29 -0
  573. package/dist/types/tools/jtd-to-typescript.d.ts +26 -0
  574. package/dist/types/tools/jtd-utils.d.ts +42 -0
  575. package/dist/types/tools/list-limit.d.ts +12 -0
  576. package/dist/types/tools/match-line-format.d.ts +11 -0
  577. package/dist/types/tools/output-meta.d.ts +204 -0
  578. package/dist/types/tools/path-utils.d.ts +146 -0
  579. package/dist/types/tools/plan-mode-guard.d.ts +18 -0
  580. package/dist/types/tools/read.d.ts +85 -0
  581. package/dist/types/tools/recipe/index.d.ts +45 -0
  582. package/dist/types/tools/recipe/render.d.ts +36 -0
  583. package/dist/types/tools/recipe/runner.d.ts +60 -0
  584. package/dist/types/tools/recipe/runners/cargo.d.ts +16 -0
  585. package/dist/types/tools/recipe/runners/index.d.ts +2 -0
  586. package/dist/types/tools/recipe/runners/just.d.ts +2 -0
  587. package/dist/types/tools/recipe/runners/make.d.ts +2 -0
  588. package/dist/types/tools/recipe/runners/pkg.d.ts +2 -0
  589. package/dist/types/tools/recipe/runners/task.d.ts +2 -0
  590. package/dist/types/tools/render-mermaid.d.ts +37 -0
  591. package/dist/types/tools/render-utils.d.ts +158 -0
  592. package/dist/types/tools/renderers.d.ts +26 -0
  593. package/dist/types/tools/resolve.d.ts +90 -0
  594. package/dist/types/tools/review.d.ts +63 -0
  595. package/dist/types/tools/search-tool-bm25.d.ts +65 -0
  596. package/dist/types/tools/search.d.ts +93 -0
  597. package/dist/types/tools/sqlite-reader.d.ts +93 -0
  598. package/dist/types/tools/ssh.d.ts +67 -0
  599. package/dist/types/tools/subagent.d.ts +58 -0
  600. package/dist/types/tools/todo-write.d.ts +120 -0
  601. package/dist/types/tools/tool-errors.d.ts +33 -0
  602. package/dist/types/tools/tool-result.d.ts +30 -0
  603. package/dist/types/tools/tool-timeouts.d.ts +51 -0
  604. package/dist/types/tools/vim.d.ts +58 -0
  605. package/dist/types/tools/write.d.ts +59 -0
  606. package/dist/types/tools/yield.d.ts +25 -0
  607. package/dist/types/tui/code-cell.d.ts +32 -0
  608. package/dist/types/tui/file-list.d.ts +22 -0
  609. package/dist/types/tui/hyperlink.d.ts +42 -0
  610. package/dist/types/tui/index.d.ts +11 -0
  611. package/dist/types/tui/output-block.d.ts +28 -0
  612. package/dist/types/tui/status-line.d.ts +18 -0
  613. package/dist/types/tui/tree-list.d.ts +19 -0
  614. package/dist/types/tui/types.d.ts +13 -0
  615. package/dist/types/tui/utils.d.ts +36 -0
  616. package/dist/types/utils/changelog.d.ts +20 -0
  617. package/dist/types/utils/clipboard.d.ts +22 -0
  618. package/dist/types/utils/command-args.d.ts +9 -0
  619. package/dist/types/utils/commit-message-generator.d.ts +7 -0
  620. package/dist/types/utils/edit-mode.d.ts +13 -0
  621. package/dist/types/utils/event-bus.d.ts +6 -0
  622. package/dist/types/utils/external-editor.d.ts +17 -0
  623. package/dist/types/utils/file-display-mode.d.ts +27 -0
  624. package/dist/types/utils/file-mentions.d.ts +11 -0
  625. package/dist/types/utils/git.d.ts +361 -0
  626. package/dist/types/utils/image-loading.d.ts +26 -0
  627. package/dist/types/utils/image-resize.d.ts +39 -0
  628. package/dist/types/utils/lang-from-path.d.ts +8 -0
  629. package/dist/types/utils/markit.d.ts +7 -0
  630. package/dist/types/utils/open.d.ts +2 -0
  631. package/dist/types/utils/session-color.d.ts +10 -0
  632. package/dist/types/utils/shell-snapshot.d.ts +5 -0
  633. package/dist/types/utils/sixel.d.ts +21 -0
  634. package/dist/types/utils/title-generator.d.ts +31 -0
  635. package/dist/types/utils/tool-choice.d.ts +7 -0
  636. package/dist/types/utils/tools-manager.d.ts +9 -0
  637. package/dist/types/vim/buffer.d.ts +41 -0
  638. package/dist/types/vim/commands.d.ts +6 -0
  639. package/dist/types/vim/engine.d.ts +47 -0
  640. package/dist/types/vim/parser.d.ts +3 -0
  641. package/dist/types/vim/render.d.ts +25 -0
  642. package/dist/types/vim/types.d.ts +182 -0
  643. package/dist/types/web/kagi.d.ts +23 -0
  644. package/dist/types/web/parallel.d.ts +58 -0
  645. package/dist/types/web/scrapers/artifacthub.d.ts +6 -0
  646. package/dist/types/web/scrapers/arxiv.d.ts +5 -0
  647. package/dist/types/web/scrapers/aur.d.ts +5 -0
  648. package/dist/types/web/scrapers/biorxiv.d.ts +5 -0
  649. package/dist/types/web/scrapers/bluesky.d.ts +5 -0
  650. package/dist/types/web/scrapers/brew.d.ts +5 -0
  651. package/dist/types/web/scrapers/cheatsh.d.ts +8 -0
  652. package/dist/types/web/scrapers/chocolatey.d.ts +5 -0
  653. package/dist/types/web/scrapers/choosealicense.d.ts +2 -0
  654. package/dist/types/web/scrapers/cisa-kev.d.ts +5 -0
  655. package/dist/types/web/scrapers/clojars.d.ts +5 -0
  656. package/dist/types/web/scrapers/coingecko.d.ts +5 -0
  657. package/dist/types/web/scrapers/crates-io.d.ts +5 -0
  658. package/dist/types/web/scrapers/crossref.d.ts +2 -0
  659. package/dist/types/web/scrapers/devto.d.ts +5 -0
  660. package/dist/types/web/scrapers/discogs.d.ts +8 -0
  661. package/dist/types/web/scrapers/discourse.d.ts +5 -0
  662. package/dist/types/web/scrapers/dockerhub.d.ts +5 -0
  663. package/dist/types/web/scrapers/docs-rs.d.ts +2 -0
  664. package/dist/types/web/scrapers/fdroid.d.ts +5 -0
  665. package/dist/types/web/scrapers/firefox-addons.d.ts +2 -0
  666. package/dist/types/web/scrapers/flathub.d.ts +2 -0
  667. package/dist/types/web/scrapers/github-gist.d.ts +5 -0
  668. package/dist/types/web/scrapers/github.d.ts +12 -0
  669. package/dist/types/web/scrapers/gitlab.d.ts +5 -0
  670. package/dist/types/web/scrapers/go-pkg.d.ts +5 -0
  671. package/dist/types/web/scrapers/hackage.d.ts +5 -0
  672. package/dist/types/web/scrapers/hackernews.d.ts +2 -0
  673. package/dist/types/web/scrapers/hex.d.ts +5 -0
  674. package/dist/types/web/scrapers/huggingface.d.ts +2 -0
  675. package/dist/types/web/scrapers/iacr.d.ts +5 -0
  676. package/dist/types/web/scrapers/index.d.ts +84 -0
  677. package/dist/types/web/scrapers/jetbrains-marketplace.d.ts +2 -0
  678. package/dist/types/web/scrapers/lemmy.d.ts +2 -0
  679. package/dist/types/web/scrapers/lobsters.d.ts +5 -0
  680. package/dist/types/web/scrapers/mastodon.d.ts +5 -0
  681. package/dist/types/web/scrapers/maven.d.ts +6 -0
  682. package/dist/types/web/scrapers/mdn.d.ts +2 -0
  683. package/dist/types/web/scrapers/metacpan.d.ts +5 -0
  684. package/dist/types/web/scrapers/musicbrainz.d.ts +5 -0
  685. package/dist/types/web/scrapers/npm.d.ts +5 -0
  686. package/dist/types/web/scrapers/nuget.d.ts +5 -0
  687. package/dist/types/web/scrapers/nvd.d.ts +5 -0
  688. package/dist/types/web/scrapers/ollama.d.ts +2 -0
  689. package/dist/types/web/scrapers/open-vsx.d.ts +5 -0
  690. package/dist/types/web/scrapers/opencorporates.d.ts +5 -0
  691. package/dist/types/web/scrapers/openlibrary.d.ts +5 -0
  692. package/dist/types/web/scrapers/orcid.d.ts +5 -0
  693. package/dist/types/web/scrapers/osv.d.ts +5 -0
  694. package/dist/types/web/scrapers/packagist.d.ts +5 -0
  695. package/dist/types/web/scrapers/pub-dev.d.ts +5 -0
  696. package/dist/types/web/scrapers/pubmed.d.ts +5 -0
  697. package/dist/types/web/scrapers/pypi.d.ts +5 -0
  698. package/dist/types/web/scrapers/rawg.d.ts +2 -0
  699. package/dist/types/web/scrapers/readthedocs.d.ts +2 -0
  700. package/dist/types/web/scrapers/reddit.d.ts +5 -0
  701. package/dist/types/web/scrapers/repology.d.ts +5 -0
  702. package/dist/types/web/scrapers/rfc.d.ts +5 -0
  703. package/dist/types/web/scrapers/rubygems.d.ts +5 -0
  704. package/dist/types/web/scrapers/searchcode.d.ts +2 -0
  705. package/dist/types/web/scrapers/sec-edgar.d.ts +5 -0
  706. package/dist/types/web/scrapers/semantic-scholar.d.ts +2 -0
  707. package/dist/types/web/scrapers/snapcraft.d.ts +2 -0
  708. package/dist/types/web/scrapers/sourcegraph.d.ts +2 -0
  709. package/dist/types/web/scrapers/spdx.d.ts +5 -0
  710. package/dist/types/web/scrapers/spotify.d.ts +8 -0
  711. package/dist/types/web/scrapers/stackoverflow.d.ts +6 -0
  712. package/dist/types/web/scrapers/terraform.d.ts +5 -0
  713. package/dist/types/web/scrapers/tldr.d.ts +7 -0
  714. package/dist/types/web/scrapers/twitter.d.ts +5 -0
  715. package/dist/types/web/scrapers/types.d.ts +78 -0
  716. package/dist/types/web/scrapers/utils.d.ts +26 -0
  717. package/dist/types/web/scrapers/vimeo.d.ts +5 -0
  718. package/dist/types/web/scrapers/vscode-marketplace.d.ts +5 -0
  719. package/dist/types/web/scrapers/w3c.d.ts +2 -0
  720. package/dist/types/web/scrapers/wikidata.d.ts +5 -0
  721. package/dist/types/web/scrapers/wikipedia.d.ts +5 -0
  722. package/dist/types/web/scrapers/youtube.d.ts +5 -0
  723. package/dist/types/web/search/index.d.ts +84 -0
  724. package/dist/types/web/search/provider.d.ts +21 -0
  725. package/dist/types/web/search/providers/anthropic.d.ts +32 -0
  726. package/dist/types/web/search/providers/base.d.ts +67 -0
  727. package/dist/types/web/search/providers/brave.d.ts +27 -0
  728. package/dist/types/web/search/providers/codex.d.ts +35 -0
  729. package/dist/types/web/search/providers/exa.d.ts +52 -0
  730. package/dist/types/web/search/providers/gemini.d.ts +57 -0
  731. package/dist/types/web/search/providers/jina.d.ts +26 -0
  732. package/dist/types/web/search/providers/kagi.d.ts +24 -0
  733. package/dist/types/web/search/providers/kimi.d.ts +27 -0
  734. package/dist/types/web/search/providers/parallel.d.ts +15 -0
  735. package/dist/types/web/search/providers/perplexity.d.ts +38 -0
  736. package/dist/types/web/search/providers/searxng.d.ts +44 -0
  737. package/dist/types/web/search/providers/synthetic.d.ts +21 -0
  738. package/dist/types/web/search/providers/tavily.d.ts +29 -0
  739. package/dist/types/web/search/providers/utils.d.ts +52 -0
  740. package/dist/types/web/search/providers/zai.d.ts +28 -0
  741. package/dist/types/web/search/render.d.ts +35 -0
  742. package/dist/types/web/search/types.d.ts +344 -0
  743. package/dist/types/web/search/utils.d.ts +4 -0
  744. package/dist/types/workspace-tree.d.ts +42 -0
  745. package/examples/README.md +21 -0
  746. package/examples/custom-tools/README.md +104 -0
  747. package/examples/custom-tools/hello/index.ts +20 -0
  748. package/examples/extensions/README.md +141 -0
  749. package/examples/extensions/api-demo.ts +79 -0
  750. package/examples/extensions/chalk-logger.ts +25 -0
  751. package/examples/extensions/hello.ts +31 -0
  752. package/examples/extensions/pirate.ts +43 -0
  753. package/examples/extensions/plan-mode.ts +549 -0
  754. package/examples/extensions/reload-runtime.ts +38 -0
  755. package/examples/extensions/tools.ts +144 -0
  756. package/examples/extensions/with-deps/index.ts +36 -0
  757. package/examples/extensions/with-deps/package-lock.json +31 -0
  758. package/examples/extensions/with-deps/package.json +16 -0
  759. package/examples/hooks/README.md +56 -0
  760. package/examples/hooks/auto-commit-on-exit.ts +48 -0
  761. package/examples/hooks/confirm-destructive.ts +58 -0
  762. package/examples/hooks/custom-compaction.ts +115 -0
  763. package/examples/hooks/dirty-repo-guard.ts +51 -0
  764. package/examples/hooks/file-trigger.ts +40 -0
  765. package/examples/hooks/git-checkpoint.ts +52 -0
  766. package/examples/hooks/handoff.ts +149 -0
  767. package/examples/hooks/permission-gate.ts +33 -0
  768. package/examples/hooks/protected-paths.ts +29 -0
  769. package/examples/hooks/qna.ts +118 -0
  770. package/examples/hooks/status-line.ts +39 -0
  771. package/examples/sdk/01-minimal.ts +21 -0
  772. package/examples/sdk/02-custom-model.ts +49 -0
  773. package/examples/sdk/03-custom-prompt.ts +46 -0
  774. package/examples/sdk/04-skills.ts +43 -0
  775. package/examples/sdk/06-extensions.ts +82 -0
  776. package/examples/sdk/06-hooks.ts +61 -0
  777. package/examples/sdk/07-context-files.ts +35 -0
  778. package/examples/sdk/08-prompt-templates.ts +41 -0
  779. package/examples/sdk/08-slash-commands.ts +46 -0
  780. package/examples/sdk/09-api-keys-and-oauth.ts +54 -0
  781. package/examples/sdk/11-sessions.ts +47 -0
  782. package/examples/sdk/README.md +172 -0
  783. package/package.json +533 -0
  784. package/scripts/build-binary.ts +77 -0
  785. package/scripts/format-prompts.ts +68 -0
  786. package/scripts/generate-docs-index.ts +71 -0
  787. package/scripts/generate-template.ts +33 -0
  788. package/src/async/index.ts +2 -0
  789. package/src/async/job-manager.ts +586 -0
  790. package/src/async/support.ts +6 -0
  791. package/src/autoresearch/command-resume.md +14 -0
  792. package/src/autoresearch/dashboard.ts +446 -0
  793. package/src/autoresearch/git.ts +319 -0
  794. package/src/autoresearch/helpers.ts +218 -0
  795. package/src/autoresearch/index.ts +536 -0
  796. package/src/autoresearch/prompt-setup.md +43 -0
  797. package/src/autoresearch/prompt.md +103 -0
  798. package/src/autoresearch/resume-message.md +10 -0
  799. package/src/autoresearch/state.ts +273 -0
  800. package/src/autoresearch/storage.ts +699 -0
  801. package/src/autoresearch/tools/init-experiment.ts +272 -0
  802. package/src/autoresearch/tools/log-experiment.ts +524 -0
  803. package/src/autoresearch/tools/run-experiment.ts +475 -0
  804. package/src/autoresearch/tools/update-notes.ts +109 -0
  805. package/src/autoresearch/types.ts +168 -0
  806. package/src/bun-imports.d.ts +28 -0
  807. package/src/capability/context-file.ts +44 -0
  808. package/src/capability/extension-module.ts +34 -0
  809. package/src/capability/extension.ts +47 -0
  810. package/src/capability/fs.ts +107 -0
  811. package/src/capability/hook.ts +40 -0
  812. package/src/capability/index.ts +436 -0
  813. package/src/capability/instruction.ts +37 -0
  814. package/src/capability/mcp.ts +74 -0
  815. package/src/capability/prompt.ts +35 -0
  816. package/src/capability/rule.ts +244 -0
  817. package/src/capability/settings.ts +34 -0
  818. package/src/capability/skill.ts +56 -0
  819. package/src/capability/slash-command.ts +40 -0
  820. package/src/capability/ssh.ts +41 -0
  821. package/src/capability/system-prompt.ts +34 -0
  822. package/src/capability/tool.ts +38 -0
  823. package/src/capability/types.ts +168 -0
  824. package/src/cli/agents-cli.ts +138 -0
  825. package/src/cli/args.ts +269 -0
  826. package/src/cli/auth-broker-cli.ts +746 -0
  827. package/src/cli/auth-gateway-cli.ts +411 -0
  828. package/src/cli/classify-install-target.ts +50 -0
  829. package/src/cli/commands/init-xdg.ts +27 -0
  830. package/src/cli/config-cli.ts +418 -0
  831. package/src/cli/file-processor.ts +123 -0
  832. package/src/cli/grep-cli.ts +160 -0
  833. package/src/cli/initial-message.ts +58 -0
  834. package/src/cli/list-models.ts +194 -0
  835. package/src/cli/plugin-cli.ts +942 -0
  836. package/src/cli/read-cli.ts +57 -0
  837. package/src/cli/session-picker.ts +52 -0
  838. package/src/cli/setup-cli.ts +433 -0
  839. package/src/cli/shell-cli.ts +176 -0
  840. package/src/cli/ssh-cli.ts +179 -0
  841. package/src/cli/stats-cli.ts +238 -0
  842. package/src/cli/update-cli.ts +408 -0
  843. package/src/cli/web-search-cli.ts +133 -0
  844. package/src/cli/worktree-cli.ts +291 -0
  845. package/src/cli.ts +99 -0
  846. package/src/commands/acp.ts +24 -0
  847. package/src/commands/agents.ts +57 -0
  848. package/src/commands/auth-broker.ts +96 -0
  849. package/src/commands/auth-gateway.ts +63 -0
  850. package/src/commands/codex-native-hook.ts +11 -0
  851. package/src/commands/commit.ts +46 -0
  852. package/src/commands/config.ts +51 -0
  853. package/src/commands/deep-interview.ts +12 -0
  854. package/src/commands/gjc-runtime-bridge.ts +81 -0
  855. package/src/commands/grep.ts +48 -0
  856. package/src/commands/launch.ts +161 -0
  857. package/src/commands/plugin.ts +78 -0
  858. package/src/commands/question.ts +12 -0
  859. package/src/commands/ralplan.ts +12 -0
  860. package/src/commands/read.ts +35 -0
  861. package/src/commands/setup.ts +52 -0
  862. package/src/commands/shell.ts +29 -0
  863. package/src/commands/ssh.ts +60 -0
  864. package/src/commands/state.ts +12 -0
  865. package/src/commands/stats.ts +29 -0
  866. package/src/commands/team.ts +130 -0
  867. package/src/commands/ultragoal.ts +32 -0
  868. package/src/commands/update.ts +21 -0
  869. package/src/commands/web-search.ts +42 -0
  870. package/src/commands/worktree.ts +56 -0
  871. package/src/commit/agentic/agent.ts +316 -0
  872. package/src/commit/agentic/fallback.ts +96 -0
  873. package/src/commit/agentic/index.ts +355 -0
  874. package/src/commit/agentic/prompts/analyze-file.md +22 -0
  875. package/src/commit/agentic/prompts/session-user.md +25 -0
  876. package/src/commit/agentic/prompts/split-confirm.md +1 -0
  877. package/src/commit/agentic/prompts/system.md +38 -0
  878. package/src/commit/agentic/state.ts +60 -0
  879. package/src/commit/agentic/tools/analyze-file.ts +127 -0
  880. package/src/commit/agentic/tools/git-file-diff.ts +191 -0
  881. package/src/commit/agentic/tools/git-hunk.ts +50 -0
  882. package/src/commit/agentic/tools/git-overview.ts +81 -0
  883. package/src/commit/agentic/tools/index.ts +54 -0
  884. package/src/commit/agentic/tools/propose-changelog.ts +144 -0
  885. package/src/commit/agentic/tools/propose-commit.ts +109 -0
  886. package/src/commit/agentic/tools/recent-commits.ts +81 -0
  887. package/src/commit/agentic/tools/schemas.ts +23 -0
  888. package/src/commit/agentic/tools/split-commit.ts +238 -0
  889. package/src/commit/agentic/topo-sort.ts +44 -0
  890. package/src/commit/agentic/trivial.ts +51 -0
  891. package/src/commit/agentic/validation.ts +183 -0
  892. package/src/commit/analysis/conventional.ts +64 -0
  893. package/src/commit/analysis/index.ts +4 -0
  894. package/src/commit/analysis/scope.ts +242 -0
  895. package/src/commit/analysis/summary.ts +105 -0
  896. package/src/commit/analysis/validation.ts +66 -0
  897. package/src/commit/changelog/detect.ts +40 -0
  898. package/src/commit/changelog/generate.ts +97 -0
  899. package/src/commit/changelog/index.ts +234 -0
  900. package/src/commit/changelog/parse.ts +44 -0
  901. package/src/commit/cli.ts +85 -0
  902. package/src/commit/git/diff.ts +148 -0
  903. package/src/commit/index.ts +5 -0
  904. package/src/commit/map-reduce/index.ts +69 -0
  905. package/src/commit/map-reduce/map-phase.ts +193 -0
  906. package/src/commit/map-reduce/reduce-phase.ts +49 -0
  907. package/src/commit/map-reduce/utils.ts +9 -0
  908. package/src/commit/message.ts +11 -0
  909. package/src/commit/model-selection.ts +66 -0
  910. package/src/commit/pipeline.ts +243 -0
  911. package/src/commit/prompts/analysis-system.md +148 -0
  912. package/src/commit/prompts/analysis-user.md +38 -0
  913. package/src/commit/prompts/changelog-system.md +50 -0
  914. package/src/commit/prompts/changelog-user.md +18 -0
  915. package/src/commit/prompts/file-observer-system.md +24 -0
  916. package/src/commit/prompts/file-observer-user.md +8 -0
  917. package/src/commit/prompts/reduce-system.md +50 -0
  918. package/src/commit/prompts/reduce-user.md +17 -0
  919. package/src/commit/prompts/summary-retry.md +3 -0
  920. package/src/commit/prompts/summary-system.md +38 -0
  921. package/src/commit/prompts/summary-user.md +13 -0
  922. package/src/commit/prompts/types-description.md +2 -0
  923. package/src/commit/shared-llm.ts +77 -0
  924. package/src/commit/types.ts +118 -0
  925. package/src/commit/utils/exclusions.ts +42 -0
  926. package/src/commit/utils.ts +58 -0
  927. package/src/config/config-file.ts +232 -0
  928. package/src/config/file-lock.ts +121 -0
  929. package/src/config/keybindings.ts +493 -0
  930. package/src/config/mcp-schema.json +230 -0
  931. package/src/config/model-equivalence.ts +811 -0
  932. package/src/config/model-registry.ts +2384 -0
  933. package/src/config/model-resolver.ts +1398 -0
  934. package/src/config/models-config-schema.ts +175 -0
  935. package/src/config/prompt-templates.ts +310 -0
  936. package/src/config/resolve-config-value.ts +94 -0
  937. package/src/config/settings-schema.ts +2939 -0
  938. package/src/config/settings.ts +919 -0
  939. package/src/config/skill-settings-defaults.ts +27 -0
  940. package/src/config.ts +212 -0
  941. package/src/cursor.ts +350 -0
  942. package/src/dap/client.ts +675 -0
  943. package/src/dap/config.ts +150 -0
  944. package/src/dap/defaults.json +211 -0
  945. package/src/dap/index.ts +4 -0
  946. package/src/dap/session.ts +1306 -0
  947. package/src/dap/types.ts +600 -0
  948. package/src/debug/index.ts +459 -0
  949. package/src/debug/log-formatting.ts +58 -0
  950. package/src/debug/log-viewer.ts +908 -0
  951. package/src/debug/profiler.ts +162 -0
  952. package/src/debug/raw-sse-buffer.ts +270 -0
  953. package/src/debug/raw-sse.ts +213 -0
  954. package/src/debug/report-bundle.ts +365 -0
  955. package/src/debug/system-info.ts +111 -0
  956. package/src/defaults/gjc/skills/deep-interview/SKILL.md +795 -0
  957. package/src/defaults/gjc/skills/ralplan/SKILL.md +142 -0
  958. package/src/defaults/gjc/skills/team/SKILL.md +373 -0
  959. package/src/defaults/gjc/skills/ultragoal/SKILL.md +176 -0
  960. package/src/defaults/gjc-defaults.ts +151 -0
  961. package/src/discovery/agents-md.ts +67 -0
  962. package/src/discovery/agents.ts +230 -0
  963. package/src/discovery/builtin.ts +932 -0
  964. package/src/discovery/claude-plugins.ts +387 -0
  965. package/src/discovery/claude.ts +313 -0
  966. package/src/discovery/cline.ts +83 -0
  967. package/src/discovery/codex.ts +330 -0
  968. package/src/discovery/cursor.ts +220 -0
  969. package/src/discovery/gemini.ts +383 -0
  970. package/src/discovery/github.ts +118 -0
  971. package/src/discovery/helpers.ts +964 -0
  972. package/src/discovery/index.ts +76 -0
  973. package/src/discovery/mcp-json.ts +171 -0
  974. package/src/discovery/opencode.ts +398 -0
  975. package/src/discovery/plugin-dir-roots.ts +28 -0
  976. package/src/discovery/ssh.ts +153 -0
  977. package/src/discovery/substitute-plugin-root.ts +29 -0
  978. package/src/discovery/vscode.ts +105 -0
  979. package/src/discovery/windsurf.ts +147 -0
  980. package/src/edit/apply-patch/index.ts +87 -0
  981. package/src/edit/apply-patch/parser.ts +174 -0
  982. package/src/edit/diff.ts +810 -0
  983. package/src/edit/file-read-cache.ts +95 -0
  984. package/src/edit/index.ts +528 -0
  985. package/src/edit/modes/apply-patch.lark +19 -0
  986. package/src/edit/modes/apply-patch.ts +53 -0
  987. package/src/edit/modes/patch.ts +1835 -0
  988. package/src/edit/modes/replace.ts +1103 -0
  989. package/src/edit/normalize.ts +375 -0
  990. package/src/edit/notebook.ts +222 -0
  991. package/src/edit/read-file.ts +25 -0
  992. package/src/edit/renderer.ts +683 -0
  993. package/src/edit/streaming.ts +561 -0
  994. package/src/eval/backend.ts +43 -0
  995. package/src/eval/index.ts +4 -0
  996. package/src/eval/js/context-manager.ts +414 -0
  997. package/src/eval/js/executor.ts +134 -0
  998. package/src/eval/js/index.ts +46 -0
  999. package/src/eval/js/shared/helpers.ts +237 -0
  1000. package/src/eval/js/shared/indirect-eval.ts +30 -0
  1001. package/src/eval/js/shared/prelude.ts +2 -0
  1002. package/src/eval/js/shared/prelude.txt +70 -0
  1003. package/src/eval/js/shared/rewrite-imports.ts +416 -0
  1004. package/src/eval/js/shared/runtime.ts +301 -0
  1005. package/src/eval/js/shared/types.ts +18 -0
  1006. package/src/eval/js/tool-bridge.ts +144 -0
  1007. package/src/eval/js/worker-core.ts +146 -0
  1008. package/src/eval/js/worker-entry.ts +24 -0
  1009. package/src/eval/js/worker-protocol.ts +41 -0
  1010. package/src/eval/py/display.ts +71 -0
  1011. package/src/eval/py/executor.ts +602 -0
  1012. package/src/eval/py/index.ts +58 -0
  1013. package/src/eval/py/kernel.ts +668 -0
  1014. package/src/eval/py/prelude.py +462 -0
  1015. package/src/eval/py/prelude.ts +3 -0
  1016. package/src/eval/py/runner.py +910 -0
  1017. package/src/eval/py/runtime.ts +210 -0
  1018. package/src/eval/py/tool-bridge.ts +137 -0
  1019. package/src/eval/types.ts +48 -0
  1020. package/src/exa/factory.ts +60 -0
  1021. package/src/exa/index.ts +27 -0
  1022. package/src/exa/mcp-client.ts +364 -0
  1023. package/src/exa/render.ts +244 -0
  1024. package/src/exa/researcher.ts +36 -0
  1025. package/src/exa/search.ts +47 -0
  1026. package/src/exa/types.ts +166 -0
  1027. package/src/exa/websets.ts +248 -0
  1028. package/src/exec/bash-executor.ts +309 -0
  1029. package/src/exec/exec.ts +53 -0
  1030. package/src/exec/idle-timeout-watchdog.ts +126 -0
  1031. package/src/exec/non-interactive-env.ts +48 -0
  1032. package/src/export/custom-share.ts +65 -0
  1033. package/src/export/html/index.ts +164 -0
  1034. package/src/export/html/template.css +1060 -0
  1035. package/src/export/html/template.generated.ts +2 -0
  1036. package/src/export/html/template.html +47 -0
  1037. package/src/export/html/template.js +2268 -0
  1038. package/src/export/html/template.macro.ts +25 -0
  1039. package/src/export/html/vendor/highlight.min.js +1213 -0
  1040. package/src/export/html/vendor/marked.min.js +6 -0
  1041. package/src/export/ttsr.ts +434 -0
  1042. package/src/extensibility/custom-commands/bundled/ci-green/index.ts +25 -0
  1043. package/src/extensibility/custom-commands/bundled/review/index.ts +456 -0
  1044. package/src/extensibility/custom-commands/index.ts +2 -0
  1045. package/src/extensibility/custom-commands/loader.ts +238 -0
  1046. package/src/extensibility/custom-commands/types.ts +113 -0
  1047. package/src/extensibility/custom-tools/index.ts +7 -0
  1048. package/src/extensibility/custom-tools/loader.ts +245 -0
  1049. package/src/extensibility/custom-tools/types.ts +254 -0
  1050. package/src/extensibility/custom-tools/wrapper.ts +47 -0
  1051. package/src/extensibility/extensions/compact-handler.ts +40 -0
  1052. package/src/extensibility/extensions/get-commands-handler.ts +80 -0
  1053. package/src/extensibility/extensions/index.ts +15 -0
  1054. package/src/extensibility/extensions/loader.ts +545 -0
  1055. package/src/extensibility/extensions/runner.ts +900 -0
  1056. package/src/extensibility/extensions/types.ts +1259 -0
  1057. package/src/extensibility/extensions/wrapper.ts +189 -0
  1058. package/src/extensibility/hooks/index.ts +5 -0
  1059. package/src/extensibility/hooks/loader.ts +257 -0
  1060. package/src/extensibility/hooks/runner.ts +425 -0
  1061. package/src/extensibility/hooks/tool-wrapper.ts +107 -0
  1062. package/src/extensibility/hooks/types.ts +599 -0
  1063. package/src/extensibility/plugins/doctor.ts +66 -0
  1064. package/src/extensibility/plugins/git-url.ts +281 -0
  1065. package/src/extensibility/plugins/index.ts +9 -0
  1066. package/src/extensibility/plugins/installer.ts +192 -0
  1067. package/src/extensibility/plugins/legacy-pi-compat.ts +336 -0
  1068. package/src/extensibility/plugins/loader.ts +288 -0
  1069. package/src/extensibility/plugins/manager.ts +731 -0
  1070. package/src/extensibility/plugins/marketplace/cache.ts +136 -0
  1071. package/src/extensibility/plugins/marketplace/fetcher.ts +317 -0
  1072. package/src/extensibility/plugins/marketplace/index.ts +6 -0
  1073. package/src/extensibility/plugins/marketplace/manager.ts +770 -0
  1074. package/src/extensibility/plugins/marketplace/registry.ts +196 -0
  1075. package/src/extensibility/plugins/marketplace/source-resolver.ts +147 -0
  1076. package/src/extensibility/plugins/marketplace/types.ts +191 -0
  1077. package/src/extensibility/plugins/parser.ts +105 -0
  1078. package/src/extensibility/plugins/types.ts +194 -0
  1079. package/src/extensibility/shared-events.ts +343 -0
  1080. package/src/extensibility/skills.ts +391 -0
  1081. package/src/extensibility/slash-commands.ts +227 -0
  1082. package/src/extensibility/tool-proxy.ts +25 -0
  1083. package/src/extensibility/typebox.ts +418 -0
  1084. package/src/extensibility/utils.ts +44 -0
  1085. package/src/gjc-runtime/goal-mode-request.ts +212 -0
  1086. package/src/gjc-runtime/launch-tmux.ts +162 -0
  1087. package/src/gjc-runtime/launch-worktree.ts +291 -0
  1088. package/src/gjc-runtime/team-runtime.ts +2025 -0
  1089. package/src/gjc-runtime/ultragoal-runtime.ts +564 -0
  1090. package/src/goals/index.ts +3 -0
  1091. package/src/goals/runtime.ts +524 -0
  1092. package/src/goals/state.ts +37 -0
  1093. package/src/goals/tools/goal-tool.ts +371 -0
  1094. package/src/hashline/anchors.ts +113 -0
  1095. package/src/hashline/apply.ts +737 -0
  1096. package/src/hashline/bigrams.json +649 -0
  1097. package/src/hashline/constants.ts +25 -0
  1098. package/src/hashline/diff-preview.ts +43 -0
  1099. package/src/hashline/diff.ts +56 -0
  1100. package/src/hashline/execute.ts +267 -0
  1101. package/src/hashline/grammar.lark +21 -0
  1102. package/src/hashline/hash.ts +173 -0
  1103. package/src/hashline/index.ts +13 -0
  1104. package/src/hashline/input.ts +130 -0
  1105. package/src/hashline/parser.ts +246 -0
  1106. package/src/hashline/prefixes.ts +101 -0
  1107. package/src/hashline/recovery.ts +113 -0
  1108. package/src/hashline/stream.ts +123 -0
  1109. package/src/hashline/types.ts +68 -0
  1110. package/src/hindsight/backend.ts +205 -0
  1111. package/src/hindsight/bank.ts +131 -0
  1112. package/src/hindsight/client.ts +598 -0
  1113. package/src/hindsight/config.ts +175 -0
  1114. package/src/hindsight/content.ts +210 -0
  1115. package/src/hindsight/index.ts +8 -0
  1116. package/src/hindsight/mental-models.ts +382 -0
  1117. package/src/hindsight/seeds.json +32 -0
  1118. package/src/hindsight/state.ts +469 -0
  1119. package/src/hindsight/transcript.ts +71 -0
  1120. package/src/hooks/codex-native-hooks-config.ts +143 -0
  1121. package/src/hooks/native-skill-hook.ts +279 -0
  1122. package/src/hooks/skill-keywords.ts +86 -0
  1123. package/src/hooks/skill-state.ts +416 -0
  1124. package/src/index.ts +56 -0
  1125. package/src/internal-urls/agent-protocol.ts +129 -0
  1126. package/src/internal-urls/artifact-protocol.ts +80 -0
  1127. package/src/internal-urls/docs-index.generated.ts +81 -0
  1128. package/src/internal-urls/gjc-protocol.ts +83 -0
  1129. package/src/internal-urls/index.ts +21 -0
  1130. package/src/internal-urls/issue-pr-protocol.ts +577 -0
  1131. package/src/internal-urls/json-query.ts +126 -0
  1132. package/src/internal-urls/local-protocol.ts +249 -0
  1133. package/src/internal-urls/mcp-protocol.ts +151 -0
  1134. package/src/internal-urls/memory-protocol.ts +164 -0
  1135. package/src/internal-urls/parse.ts +72 -0
  1136. package/src/internal-urls/registry-helpers.ts +25 -0
  1137. package/src/internal-urls/router.ts +78 -0
  1138. package/src/internal-urls/rule-protocol.ts +38 -0
  1139. package/src/internal-urls/skill-protocol.ts +103 -0
  1140. package/src/internal-urls/types.ts +110 -0
  1141. package/src/lsp/client.ts +951 -0
  1142. package/src/lsp/clients/biome-client.ts +202 -0
  1143. package/src/lsp/clients/index.ts +50 -0
  1144. package/src/lsp/clients/lsp-linter-client.ts +93 -0
  1145. package/src/lsp/clients/swiftlint-client.ts +120 -0
  1146. package/src/lsp/config.ts +492 -0
  1147. package/src/lsp/defaults.json +493 -0
  1148. package/src/lsp/edits.ts +166 -0
  1149. package/src/lsp/index.ts +2282 -0
  1150. package/src/lsp/lspmux.ts +233 -0
  1151. package/src/lsp/render.ts +692 -0
  1152. package/src/lsp/startup-events.ts +13 -0
  1153. package/src/lsp/types.ts +443 -0
  1154. package/src/lsp/utils.ts +678 -0
  1155. package/src/main.ts +961 -0
  1156. package/src/memories/index.ts +1135 -0
  1157. package/src/memories/storage.ts +577 -0
  1158. package/src/memory-backend/index.ts +4 -0
  1159. package/src/memory-backend/local-backend.ts +30 -0
  1160. package/src/memory-backend/off-backend.ts +16 -0
  1161. package/src/memory-backend/resolve.ts +24 -0
  1162. package/src/memory-backend/types.ts +79 -0
  1163. package/src/modes/acp/acp-agent.ts +2170 -0
  1164. package/src/modes/acp/acp-client-bridge.ts +154 -0
  1165. package/src/modes/acp/acp-event-mapper.ts +879 -0
  1166. package/src/modes/acp/acp-mode.ts +23 -0
  1167. package/src/modes/acp/index.ts +2 -0
  1168. package/src/modes/acp/terminal-auth.ts +37 -0
  1169. package/src/modes/components/agent-dashboard.ts +1120 -0
  1170. package/src/modes/components/assistant-message.ts +231 -0
  1171. package/src/modes/components/bash-execution.ts +228 -0
  1172. package/src/modes/components/bordered-loader.ts +41 -0
  1173. package/src/modes/components/branch-summary-message.ts +45 -0
  1174. package/src/modes/components/btw-panel.ts +104 -0
  1175. package/src/modes/components/compaction-summary-message.ts +51 -0
  1176. package/src/modes/components/countdown-timer.ts +75 -0
  1177. package/src/modes/components/custom-editor.ts +237 -0
  1178. package/src/modes/components/custom-message.ts +65 -0
  1179. package/src/modes/components/diff.ts +266 -0
  1180. package/src/modes/components/dynamic-border.ts +25 -0
  1181. package/src/modes/components/eval-execution.ts +164 -0
  1182. package/src/modes/components/execution-shared.ts +102 -0
  1183. package/src/modes/components/extensions/extension-dashboard.ts +350 -0
  1184. package/src/modes/components/extensions/extension-list.ts +492 -0
  1185. package/src/modes/components/extensions/index.ts +9 -0
  1186. package/src/modes/components/extensions/inspector-panel.ts +317 -0
  1187. package/src/modes/components/extensions/state-manager.ts +628 -0
  1188. package/src/modes/components/extensions/types.ts +191 -0
  1189. package/src/modes/components/footer.ts +270 -0
  1190. package/src/modes/components/history-search.ts +158 -0
  1191. package/src/modes/components/hook-editor.ts +151 -0
  1192. package/src/modes/components/hook-input.ts +79 -0
  1193. package/src/modes/components/hook-message.ts +68 -0
  1194. package/src/modes/components/hook-selector.ts +190 -0
  1195. package/src/modes/components/index.ts +36 -0
  1196. package/src/modes/components/keybinding-hints.ts +65 -0
  1197. package/src/modes/components/login-dialog.ts +164 -0
  1198. package/src/modes/components/message-frame.ts +88 -0
  1199. package/src/modes/components/model-selector.ts +794 -0
  1200. package/src/modes/components/oauth-selector.ts +248 -0
  1201. package/src/modes/components/plugin-selector.ts +95 -0
  1202. package/src/modes/components/plugin-settings.ts +488 -0
  1203. package/src/modes/components/provider-onboarding-selector.ts +88 -0
  1204. package/src/modes/components/queue-mode-selector.ts +56 -0
  1205. package/src/modes/components/read-tool-group.ts +267 -0
  1206. package/src/modes/components/runtime-mcp-add-wizard.ts +1341 -0
  1207. package/src/modes/components/session-observer-overlay.ts +839 -0
  1208. package/src/modes/components/session-selector.ts +343 -0
  1209. package/src/modes/components/settings-defs.ts +175 -0
  1210. package/src/modes/components/settings-selector.ts +635 -0
  1211. package/src/modes/components/show-images-selector.ts +45 -0
  1212. package/src/modes/components/skill-hud/render.ts +47 -0
  1213. package/src/modes/components/skill-message.ts +90 -0
  1214. package/src/modes/components/status-line/context-thresholds.ts +68 -0
  1215. package/src/modes/components/status-line/git-utils.ts +42 -0
  1216. package/src/modes/components/status-line/index.ts +4 -0
  1217. package/src/modes/components/status-line/presets.ts +105 -0
  1218. package/src/modes/components/status-line/segments.ts +560 -0
  1219. package/src/modes/components/status-line/separators.ts +55 -0
  1220. package/src/modes/components/status-line/token-rate.ts +66 -0
  1221. package/src/modes/components/status-line/types.ts +93 -0
  1222. package/src/modes/components/status-line.ts +839 -0
  1223. package/src/modes/components/theme-selector.ts +63 -0
  1224. package/src/modes/components/thinking-selector.ts +52 -0
  1225. package/src/modes/components/todo-reminder.ts +40 -0
  1226. package/src/modes/components/tool-execution.ts +830 -0
  1227. package/src/modes/components/tree-selector.ts +930 -0
  1228. package/src/modes/components/ttsr-notification.ts +80 -0
  1229. package/src/modes/components/user-message-selector.ts +141 -0
  1230. package/src/modes/components/user-message.ts +51 -0
  1231. package/src/modes/components/visual-truncate.ts +63 -0
  1232. package/src/modes/components/welcome.ts +389 -0
  1233. package/src/modes/controllers/btw-controller.ts +105 -0
  1234. package/src/modes/controllers/command-controller-shared.ts +108 -0
  1235. package/src/modes/controllers/command-controller.ts +1630 -0
  1236. package/src/modes/controllers/event-controller.ts +786 -0
  1237. package/src/modes/controllers/extension-ui-controller.ts +927 -0
  1238. package/src/modes/controllers/input-controller.ts +858 -0
  1239. package/src/modes/controllers/runtime-mcp-command-controller.ts +1934 -0
  1240. package/src/modes/controllers/selector-controller.ts +1039 -0
  1241. package/src/modes/controllers/ssh-command-controller.ts +384 -0
  1242. package/src/modes/controllers/todo-command-controller.ts +485 -0
  1243. package/src/modes/data/emojis.json +1 -0
  1244. package/src/modes/emoji-autocomplete.ts +285 -0
  1245. package/src/modes/index.ts +34 -0
  1246. package/src/modes/interactive-mode.ts +2756 -0
  1247. package/src/modes/loop-limit.ts +140 -0
  1248. package/src/modes/oauth-manual-input.ts +42 -0
  1249. package/src/modes/print-mode.ts +121 -0
  1250. package/src/modes/prompt-action-autocomplete.ts +345 -0
  1251. package/src/modes/rpc/host-tools.ts +186 -0
  1252. package/src/modes/rpc/host-uris.ts +235 -0
  1253. package/src/modes/rpc/rpc-client.ts +810 -0
  1254. package/src/modes/rpc/rpc-mode.ts +851 -0
  1255. package/src/modes/rpc/rpc-types.ts +378 -0
  1256. package/src/modes/runtime-init.ts +116 -0
  1257. package/src/modes/session-observer-registry.ts +146 -0
  1258. package/src/modes/shared.ts +55 -0
  1259. package/src/modes/theme/dark.json +95 -0
  1260. package/src/modes/theme/defaults/alabaster.json +93 -0
  1261. package/src/modes/theme/defaults/amethyst.json +96 -0
  1262. package/src/modes/theme/defaults/anthracite.json +93 -0
  1263. package/src/modes/theme/defaults/basalt.json +91 -0
  1264. package/src/modes/theme/defaults/birch.json +95 -0
  1265. package/src/modes/theme/defaults/dark-abyss.json +91 -0
  1266. package/src/modes/theme/defaults/dark-arctic.json +104 -0
  1267. package/src/modes/theme/defaults/dark-aurora.json +95 -0
  1268. package/src/modes/theme/defaults/dark-catppuccin.json +107 -0
  1269. package/src/modes/theme/defaults/dark-cavern.json +91 -0
  1270. package/src/modes/theme/defaults/dark-copper.json +95 -0
  1271. package/src/modes/theme/defaults/dark-cosmos.json +90 -0
  1272. package/src/modes/theme/defaults/dark-cyberpunk.json +102 -0
  1273. package/src/modes/theme/defaults/dark-dracula.json +98 -0
  1274. package/src/modes/theme/defaults/dark-eclipse.json +91 -0
  1275. package/src/modes/theme/defaults/dark-ember.json +95 -0
  1276. package/src/modes/theme/defaults/dark-equinox.json +90 -0
  1277. package/src/modes/theme/defaults/dark-forest.json +96 -0
  1278. package/src/modes/theme/defaults/dark-github.json +105 -0
  1279. package/src/modes/theme/defaults/dark-gruvbox.json +112 -0
  1280. package/src/modes/theme/defaults/dark-lavender.json +95 -0
  1281. package/src/modes/theme/defaults/dark-lunar.json +89 -0
  1282. package/src/modes/theme/defaults/dark-midnight.json +95 -0
  1283. package/src/modes/theme/defaults/dark-monochrome.json +94 -0
  1284. package/src/modes/theme/defaults/dark-monokai.json +98 -0
  1285. package/src/modes/theme/defaults/dark-nebula.json +90 -0
  1286. package/src/modes/theme/defaults/dark-nord.json +97 -0
  1287. package/src/modes/theme/defaults/dark-ocean.json +101 -0
  1288. package/src/modes/theme/defaults/dark-one.json +100 -0
  1289. package/src/modes/theme/defaults/dark-poimandres.json +142 -0
  1290. package/src/modes/theme/defaults/dark-rainforest.json +91 -0
  1291. package/src/modes/theme/defaults/dark-reef.json +91 -0
  1292. package/src/modes/theme/defaults/dark-retro.json +92 -0
  1293. package/src/modes/theme/defaults/dark-rose-pine.json +96 -0
  1294. package/src/modes/theme/defaults/dark-sakura.json +95 -0
  1295. package/src/modes/theme/defaults/dark-slate.json +95 -0
  1296. package/src/modes/theme/defaults/dark-solarized.json +97 -0
  1297. package/src/modes/theme/defaults/dark-solstice.json +90 -0
  1298. package/src/modes/theme/defaults/dark-starfall.json +91 -0
  1299. package/src/modes/theme/defaults/dark-sunset.json +99 -0
  1300. package/src/modes/theme/defaults/dark-swamp.json +90 -0
  1301. package/src/modes/theme/defaults/dark-synthwave.json +103 -0
  1302. package/src/modes/theme/defaults/dark-taiga.json +91 -0
  1303. package/src/modes/theme/defaults/dark-terminal.json +95 -0
  1304. package/src/modes/theme/defaults/dark-tokyo-night.json +101 -0
  1305. package/src/modes/theme/defaults/dark-tundra.json +91 -0
  1306. package/src/modes/theme/defaults/dark-twilight.json +91 -0
  1307. package/src/modes/theme/defaults/dark-volcanic.json +91 -0
  1308. package/src/modes/theme/defaults/graphite.json +92 -0
  1309. package/src/modes/theme/defaults/index.ts +201 -0
  1310. package/src/modes/theme/defaults/light-arctic.json +107 -0
  1311. package/src/modes/theme/defaults/light-aurora-day.json +91 -0
  1312. package/src/modes/theme/defaults/light-canyon.json +91 -0
  1313. package/src/modes/theme/defaults/light-catppuccin.json +106 -0
  1314. package/src/modes/theme/defaults/light-cirrus.json +90 -0
  1315. package/src/modes/theme/defaults/light-coral.json +95 -0
  1316. package/src/modes/theme/defaults/light-cyberpunk.json +96 -0
  1317. package/src/modes/theme/defaults/light-dawn.json +90 -0
  1318. package/src/modes/theme/defaults/light-dunes.json +91 -0
  1319. package/src/modes/theme/defaults/light-eucalyptus.json +95 -0
  1320. package/src/modes/theme/defaults/light-forest.json +100 -0
  1321. package/src/modes/theme/defaults/light-frost.json +95 -0
  1322. package/src/modes/theme/defaults/light-github.json +115 -0
  1323. package/src/modes/theme/defaults/light-glacier.json +91 -0
  1324. package/src/modes/theme/defaults/light-gruvbox.json +108 -0
  1325. package/src/modes/theme/defaults/light-haze.json +90 -0
  1326. package/src/modes/theme/defaults/light-honeycomb.json +95 -0
  1327. package/src/modes/theme/defaults/light-lagoon.json +91 -0
  1328. package/src/modes/theme/defaults/light-lavender.json +95 -0
  1329. package/src/modes/theme/defaults/light-meadow.json +91 -0
  1330. package/src/modes/theme/defaults/light-mint.json +95 -0
  1331. package/src/modes/theme/defaults/light-monochrome.json +101 -0
  1332. package/src/modes/theme/defaults/light-ocean.json +99 -0
  1333. package/src/modes/theme/defaults/light-one.json +99 -0
  1334. package/src/modes/theme/defaults/light-opal.json +91 -0
  1335. package/src/modes/theme/defaults/light-orchard.json +91 -0
  1336. package/src/modes/theme/defaults/light-paper.json +95 -0
  1337. package/src/modes/theme/defaults/light-poimandres.json +142 -0
  1338. package/src/modes/theme/defaults/light-prism.json +90 -0
  1339. package/src/modes/theme/defaults/light-retro.json +98 -0
  1340. package/src/modes/theme/defaults/light-sand.json +95 -0
  1341. package/src/modes/theme/defaults/light-savanna.json +91 -0
  1342. package/src/modes/theme/defaults/light-solarized.json +102 -0
  1343. package/src/modes/theme/defaults/light-soleil.json +90 -0
  1344. package/src/modes/theme/defaults/light-sunset.json +99 -0
  1345. package/src/modes/theme/defaults/light-synthwave.json +98 -0
  1346. package/src/modes/theme/defaults/light-tokyo-night.json +111 -0
  1347. package/src/modes/theme/defaults/light-wetland.json +91 -0
  1348. package/src/modes/theme/defaults/light-zenith.json +89 -0
  1349. package/src/modes/theme/defaults/limestone.json +94 -0
  1350. package/src/modes/theme/defaults/mahogany.json +97 -0
  1351. package/src/modes/theme/defaults/marble.json +93 -0
  1352. package/src/modes/theme/defaults/obsidian.json +91 -0
  1353. package/src/modes/theme/defaults/onyx.json +91 -0
  1354. package/src/modes/theme/defaults/pearl.json +93 -0
  1355. package/src/modes/theme/defaults/porcelain.json +91 -0
  1356. package/src/modes/theme/defaults/quartz.json +96 -0
  1357. package/src/modes/theme/defaults/red-claw.json +123 -0
  1358. package/src/modes/theme/defaults/sandstone.json +95 -0
  1359. package/src/modes/theme/defaults/titanium.json +90 -0
  1360. package/src/modes/theme/light.json +93 -0
  1361. package/src/modes/theme/mermaid-cache.ts +29 -0
  1362. package/src/modes/theme/shimmer.ts +219 -0
  1363. package/src/modes/theme/theme-schema.json +429 -0
  1364. package/src/modes/theme/theme.ts +2413 -0
  1365. package/src/modes/types.ts +313 -0
  1366. package/src/modes/utils/context-usage.ts +335 -0
  1367. package/src/modes/utils/hotkeys-markdown.ts +59 -0
  1368. package/src/modes/utils/keybinding-matchers.ts +30 -0
  1369. package/src/modes/utils/tools-markdown.ts +27 -0
  1370. package/src/modes/utils/ui-helpers.ts +741 -0
  1371. package/src/plan-mode/approved-plan.ts +163 -0
  1372. package/src/plan-mode/state.ts +6 -0
  1373. package/src/priority.json +37 -0
  1374. package/src/prompts/agents/architect.md +79 -0
  1375. package/src/prompts/agents/critic.md +55 -0
  1376. package/src/prompts/agents/executor.md +45 -0
  1377. package/src/prompts/agents/explore.md +58 -0
  1378. package/src/prompts/agents/frontmatter.md +12 -0
  1379. package/src/prompts/agents/init.md +34 -0
  1380. package/src/prompts/agents/plan.md +49 -0
  1381. package/src/prompts/agents/planner.md +49 -0
  1382. package/src/prompts/agents/reviewer.md +141 -0
  1383. package/src/prompts/agents/task.md +16 -0
  1384. package/src/prompts/ci-green-request.md +36 -0
  1385. package/src/prompts/commands/orchestrate.md +49 -0
  1386. package/src/prompts/goals/goal-budget-limit.md +16 -0
  1387. package/src/prompts/goals/goal-continuation.md +28 -0
  1388. package/src/prompts/goals/goal-mode-active.md +23 -0
  1389. package/src/prompts/memories/consolidation.md +30 -0
  1390. package/src/prompts/memories/read-path.md +11 -0
  1391. package/src/prompts/memories/stage_one_input.md +6 -0
  1392. package/src/prompts/memories/stage_one_system.md +21 -0
  1393. package/src/prompts/review-request.md +70 -0
  1394. package/src/prompts/system/agent-creation-architect.md +75 -0
  1395. package/src/prompts/system/agent-creation-user.md +6 -0
  1396. package/src/prompts/system/auto-continue.md +1 -0
  1397. package/src/prompts/system/btw-user.md +8 -0
  1398. package/src/prompts/system/commit-message-system.md +2 -0
  1399. package/src/prompts/system/custom-system-prompt.md +64 -0
  1400. package/src/prompts/system/eager-todo.md +13 -0
  1401. package/src/prompts/system/irc-incoming.md +8 -0
  1402. package/src/prompts/system/plan-mode-active.md +116 -0
  1403. package/src/prompts/system/plan-mode-approved.md +28 -0
  1404. package/src/prompts/system/plan-mode-compact-instructions.md +16 -0
  1405. package/src/prompts/system/plan-mode-reference.md +14 -0
  1406. package/src/prompts/system/plan-mode-subagent.md +34 -0
  1407. package/src/prompts/system/plan-mode-tool-decision-reminder.md +9 -0
  1408. package/src/prompts/system/project-prompt.md +46 -0
  1409. package/src/prompts/system/subagent-system-prompt.md +54 -0
  1410. package/src/prompts/system/subagent-user-prompt.md +3 -0
  1411. package/src/prompts/system/subagent-yield-reminder.md +12 -0
  1412. package/src/prompts/system/system-prompt.md +267 -0
  1413. package/src/prompts/system/title-system.md +2 -0
  1414. package/src/prompts/system/ttsr-interrupt.md +7 -0
  1415. package/src/prompts/system/ttsr-tool-reminder.md +5 -0
  1416. package/src/prompts/system/web-search.md +25 -0
  1417. package/src/prompts/tools/apply-patch.md +65 -0
  1418. package/src/prompts/tools/ask.md +29 -0
  1419. package/src/prompts/tools/ast-edit.md +39 -0
  1420. package/src/prompts/tools/ast-grep.md +42 -0
  1421. package/src/prompts/tools/async-result.md +8 -0
  1422. package/src/prompts/tools/bash.md +39 -0
  1423. package/src/prompts/tools/browser.md +70 -0
  1424. package/src/prompts/tools/calculator.md +10 -0
  1425. package/src/prompts/tools/checkpoint.md +16 -0
  1426. package/src/prompts/tools/create-goal.md +3 -0
  1427. package/src/prompts/tools/debug.md +33 -0
  1428. package/src/prompts/tools/eval.md +75 -0
  1429. package/src/prompts/tools/find.md +34 -0
  1430. package/src/prompts/tools/get-goal.md +3 -0
  1431. package/src/prompts/tools/github.md +20 -0
  1432. package/src/prompts/tools/goal.md +18 -0
  1433. package/src/prompts/tools/hashline.md +130 -0
  1434. package/src/prompts/tools/image-gen.md +7 -0
  1435. package/src/prompts/tools/inspect-image-system.md +20 -0
  1436. package/src/prompts/tools/inspect-image.md +32 -0
  1437. package/src/prompts/tools/irc.md +49 -0
  1438. package/src/prompts/tools/job.md +19 -0
  1439. package/src/prompts/tools/lsp.md +42 -0
  1440. package/src/prompts/tools/patch.md +70 -0
  1441. package/src/prompts/tools/read.md +82 -0
  1442. package/src/prompts/tools/recall.md +5 -0
  1443. package/src/prompts/tools/recipe.md +16 -0
  1444. package/src/prompts/tools/reflect.md +5 -0
  1445. package/src/prompts/tools/render-mermaid.md +9 -0
  1446. package/src/prompts/tools/replace.md +36 -0
  1447. package/src/prompts/tools/resolve.md +9 -0
  1448. package/src/prompts/tools/retain.md +6 -0
  1449. package/src/prompts/tools/rewind.md +13 -0
  1450. package/src/prompts/tools/search-tool-bm25.md +33 -0
  1451. package/src/prompts/tools/search.md +25 -0
  1452. package/src/prompts/tools/ssh.md +35 -0
  1453. package/src/prompts/tools/subagent.md +21 -0
  1454. package/src/prompts/tools/task-summary.md +28 -0
  1455. package/src/prompts/tools/task.md +79 -0
  1456. package/src/prompts/tools/todo-write.md +50 -0
  1457. package/src/prompts/tools/update-goal.md +3 -0
  1458. package/src/prompts/tools/vim.md +98 -0
  1459. package/src/prompts/tools/web-search.md +10 -0
  1460. package/src/prompts/tools/write.md +14 -0
  1461. package/src/registry/agent-registry.ts +140 -0
  1462. package/src/runtime-mcp/client.ts +482 -0
  1463. package/src/runtime-mcp/config-writer.ts +225 -0
  1464. package/src/runtime-mcp/config.ts +365 -0
  1465. package/src/runtime-mcp/discoverable-tool-metadata.ts +25 -0
  1466. package/src/runtime-mcp/index.ts +29 -0
  1467. package/src/runtime-mcp/json-rpc.ts +84 -0
  1468. package/src/runtime-mcp/loader.ts +124 -0
  1469. package/src/runtime-mcp/manager.ts +1172 -0
  1470. package/src/runtime-mcp/oauth-discovery.ts +349 -0
  1471. package/src/runtime-mcp/oauth-flow.ts +407 -0
  1472. package/src/runtime-mcp/render.ts +123 -0
  1473. package/src/runtime-mcp/smithery-auth.ts +104 -0
  1474. package/src/runtime-mcp/smithery-connect.ts +145 -0
  1475. package/src/runtime-mcp/smithery-registry.ts +477 -0
  1476. package/src/runtime-mcp/tool-bridge.ts +416 -0
  1477. package/src/runtime-mcp/tool-cache.ts +117 -0
  1478. package/src/runtime-mcp/transports/http.ts +477 -0
  1479. package/src/runtime-mcp/transports/index.ts +6 -0
  1480. package/src/runtime-mcp/transports/stdio.ts +325 -0
  1481. package/src/runtime-mcp/types.ts +423 -0
  1482. package/src/sdk.ts +2064 -0
  1483. package/src/secrets/index.ts +116 -0
  1484. package/src/secrets/obfuscator.ts +277 -0
  1485. package/src/secrets/regex.ts +21 -0
  1486. package/src/session/agent-session.ts +8794 -0
  1487. package/src/session/agent-storage.ts +466 -0
  1488. package/src/session/artifacts.ts +135 -0
  1489. package/src/session/auth-broker-config.ts +102 -0
  1490. package/src/session/auth-storage.ts +23 -0
  1491. package/src/session/blob-store.ts +168 -0
  1492. package/src/session/client-bridge.ts +85 -0
  1493. package/src/session/history-storage.ts +311 -0
  1494. package/src/session/messages.ts +403 -0
  1495. package/src/session/session-dump-format.ts +209 -0
  1496. package/src/session/session-manager.ts +3333 -0
  1497. package/src/session/session-storage.ts +389 -0
  1498. package/src/session/streaming-output.ts +1093 -0
  1499. package/src/session/tool-choice-queue.ts +213 -0
  1500. package/src/session/yield-queue.ts +155 -0
  1501. package/src/setup/model-onboarding-guidance.ts +36 -0
  1502. package/src/setup/provider-onboarding.ts +195 -0
  1503. package/src/skill-state/active-state.ts +272 -0
  1504. package/src/slash-commands/acp-builtins.ts +46 -0
  1505. package/src/slash-commands/builtin-registry.ts +955 -0
  1506. package/src/slash-commands/helpers/context-report.ts +39 -0
  1507. package/src/slash-commands/helpers/format.ts +46 -0
  1508. package/src/slash-commands/helpers/mcp.ts +532 -0
  1509. package/src/slash-commands/helpers/parse.ts +85 -0
  1510. package/src/slash-commands/helpers/ssh.ts +195 -0
  1511. package/src/slash-commands/helpers/todo.ts +279 -0
  1512. package/src/slash-commands/helpers/usage-report.ts +91 -0
  1513. package/src/slash-commands/types.ts +125 -0
  1514. package/src/ssh/config-writer.ts +183 -0
  1515. package/src/ssh/connection-manager.ts +482 -0
  1516. package/src/ssh/ssh-executor.ts +133 -0
  1517. package/src/ssh/sshfs-mount.ts +140 -0
  1518. package/src/ssh/utils.ts +8 -0
  1519. package/src/stt/downloader.ts +71 -0
  1520. package/src/stt/index.ts +3 -0
  1521. package/src/stt/recorder.ts +351 -0
  1522. package/src/stt/setup.ts +52 -0
  1523. package/src/stt/stt-controller.ts +160 -0
  1524. package/src/stt/transcribe.py +70 -0
  1525. package/src/stt/transcriber.ts +91 -0
  1526. package/src/system-prompt.ts +581 -0
  1527. package/src/task/agents.ts +162 -0
  1528. package/src/task/commands.ts +135 -0
  1529. package/src/task/discovery.ts +130 -0
  1530. package/src/task/executor.ts +1564 -0
  1531. package/src/task/gjc-command.ts +26 -0
  1532. package/src/task/index.ts +1366 -0
  1533. package/src/task/name-generator.ts +1577 -0
  1534. package/src/task/output-manager.ts +107 -0
  1535. package/src/task/parallel.ts +116 -0
  1536. package/src/task/render.ts +1136 -0
  1537. package/src/task/simple-mode.ts +27 -0
  1538. package/src/task/subprocess-tool-registry.ts +88 -0
  1539. package/src/task/types.ts +315 -0
  1540. package/src/task/worktree.ts +506 -0
  1541. package/src/thinking.ts +87 -0
  1542. package/src/tool-discovery/tool-index.ts +400 -0
  1543. package/src/tools/archive-reader.ts +321 -0
  1544. package/src/tools/ask.ts +790 -0
  1545. package/src/tools/ast-edit.ts +542 -0
  1546. package/src/tools/ast-grep.ts +423 -0
  1547. package/src/tools/auto-generated-guard.ts +305 -0
  1548. package/src/tools/bash-command-fixup.ts +37 -0
  1549. package/src/tools/bash-interactive.ts +388 -0
  1550. package/src/tools/bash-interceptor.ts +67 -0
  1551. package/src/tools/bash-pty-selection.ts +14 -0
  1552. package/src/tools/bash-skill-urls.ts +248 -0
  1553. package/src/tools/bash.ts +1061 -0
  1554. package/src/tools/browser/attach.ts +175 -0
  1555. package/src/tools/browser/launch.ts +651 -0
  1556. package/src/tools/browser/readable.ts +95 -0
  1557. package/src/tools/browser/registry.ts +194 -0
  1558. package/src/tools/browser/render.ts +212 -0
  1559. package/src/tools/browser/tab-protocol.ts +105 -0
  1560. package/src/tools/browser/tab-supervisor.ts +577 -0
  1561. package/src/tools/browser/tab-worker-entry.ts +21 -0
  1562. package/src/tools/browser/tab-worker.ts +1054 -0
  1563. package/src/tools/browser.ts +301 -0
  1564. package/src/tools/calculator.ts +540 -0
  1565. package/src/tools/checkpoint.ts +134 -0
  1566. package/src/tools/conflict-detect.ts +672 -0
  1567. package/src/tools/context.ts +39 -0
  1568. package/src/tools/debug.ts +1014 -0
  1569. package/src/tools/eval.ts +1101 -0
  1570. package/src/tools/fetch.ts +1482 -0
  1571. package/src/tools/file-recorder.ts +35 -0
  1572. package/src/tools/find.ts +540 -0
  1573. package/src/tools/fs-cache-invalidation.ts +28 -0
  1574. package/src/tools/gh-format.ts +12 -0
  1575. package/src/tools/gh-renderer.ts +428 -0
  1576. package/src/tools/gh.ts +3499 -0
  1577. package/src/tools/github-cache.ts +548 -0
  1578. package/src/tools/grouped-file-output.ts +96 -0
  1579. package/src/tools/hindsight-recall.ts +68 -0
  1580. package/src/tools/hindsight-reflect.ts +57 -0
  1581. package/src/tools/hindsight-retain.ts +56 -0
  1582. package/src/tools/image-gen.ts +1248 -0
  1583. package/src/tools/index.ts +519 -0
  1584. package/src/tools/inspect-image-renderer.ts +103 -0
  1585. package/src/tools/inspect-image.ts +165 -0
  1586. package/src/tools/irc.ts +239 -0
  1587. package/src/tools/job.ts +520 -0
  1588. package/src/tools/json-tree.ts +243 -0
  1589. package/src/tools/jtd-to-json-schema.ts +219 -0
  1590. package/src/tools/jtd-to-typescript.ts +136 -0
  1591. package/src/tools/jtd-utils.ts +102 -0
  1592. package/src/tools/list-limit.ts +40 -0
  1593. package/src/tools/match-line-format.ts +22 -0
  1594. package/src/tools/output-meta.ts +754 -0
  1595. package/src/tools/path-utils.ts +739 -0
  1596. package/src/tools/plan-mode-guard.ts +68 -0
  1597. package/src/tools/puppeteer/00_stealth_tampering.txt +63 -0
  1598. package/src/tools/puppeteer/01_stealth_activity.txt +20 -0
  1599. package/src/tools/puppeteer/02_stealth_hairline.txt +11 -0
  1600. package/src/tools/puppeteer/03_stealth_botd.txt +384 -0
  1601. package/src/tools/puppeteer/04_stealth_iframe.txt +81 -0
  1602. package/src/tools/puppeteer/05_stealth_webgl.txt +75 -0
  1603. package/src/tools/puppeteer/06_stealth_screen.txt +72 -0
  1604. package/src/tools/puppeteer/07_stealth_fonts.txt +97 -0
  1605. package/src/tools/puppeteer/08_stealth_audio.txt +51 -0
  1606. package/src/tools/puppeteer/09_stealth_locale.txt +46 -0
  1607. package/src/tools/puppeteer/10_stealth_plugins.txt +206 -0
  1608. package/src/tools/puppeteer/11_stealth_hardware.txt +8 -0
  1609. package/src/tools/puppeteer/12_stealth_codecs.txt +40 -0
  1610. package/src/tools/puppeteer/13_stealth_worker.txt +74 -0
  1611. package/src/tools/read.ts +2332 -0
  1612. package/src/tools/recipe/index.ts +80 -0
  1613. package/src/tools/recipe/render.ts +19 -0
  1614. package/src/tools/recipe/runner.ts +219 -0
  1615. package/src/tools/recipe/runners/cargo.ts +131 -0
  1616. package/src/tools/recipe/runners/index.ts +8 -0
  1617. package/src/tools/recipe/runners/just.ts +73 -0
  1618. package/src/tools/recipe/runners/make.ts +101 -0
  1619. package/src/tools/recipe/runners/pkg.ts +167 -0
  1620. package/src/tools/recipe/runners/task.ts +72 -0
  1621. package/src/tools/render-mermaid.ts +68 -0
  1622. package/src/tools/render-utils.ts +774 -0
  1623. package/src/tools/renderers.ts +75 -0
  1624. package/src/tools/resolve.ts +258 -0
  1625. package/src/tools/review.ts +252 -0
  1626. package/src/tools/search-tool-bm25.ts +360 -0
  1627. package/src/tools/search.ts +786 -0
  1628. package/src/tools/sqlite-reader.ts +736 -0
  1629. package/src/tools/ssh.ts +310 -0
  1630. package/src/tools/subagent.ts +312 -0
  1631. package/src/tools/todo-write.ts +695 -0
  1632. package/src/tools/tool-errors.ts +62 -0
  1633. package/src/tools/tool-result.ts +86 -0
  1634. package/src/tools/tool-timeouts.ts +30 -0
  1635. package/src/tools/vim.ts +949 -0
  1636. package/src/tools/write.ts +953 -0
  1637. package/src/tools/yield.ts +268 -0
  1638. package/src/tui/code-cell.ts +201 -0
  1639. package/src/tui/file-list.ts +55 -0
  1640. package/src/tui/hyperlink.ts +126 -0
  1641. package/src/tui/index.ts +12 -0
  1642. package/src/tui/output-block.ts +150 -0
  1643. package/src/tui/status-line.ts +39 -0
  1644. package/src/tui/tree-list.ts +84 -0
  1645. package/src/tui/types.ts +15 -0
  1646. package/src/tui/utils.ts +103 -0
  1647. package/src/utils/changelog.ts +98 -0
  1648. package/src/utils/clipboard.ts +156 -0
  1649. package/src/utils/command-args.ts +76 -0
  1650. package/src/utils/commit-message-generator.ts +142 -0
  1651. package/src/utils/edit-mode.ts +42 -0
  1652. package/src/utils/event-bus.ts +33 -0
  1653. package/src/utils/external-editor.ts +65 -0
  1654. package/src/utils/file-display-mode.ts +45 -0
  1655. package/src/utils/file-mentions.ts +376 -0
  1656. package/src/utils/git.ts +1536 -0
  1657. package/src/utils/image-loading.ts +102 -0
  1658. package/src/utils/image-resize.ts +309 -0
  1659. package/src/utils/lang-from-path.ts +239 -0
  1660. package/src/utils/markit.ts +89 -0
  1661. package/src/utils/open.ts +20 -0
  1662. package/src/utils/session-color.ts +43 -0
  1663. package/src/utils/shell-snapshot.ts +187 -0
  1664. package/src/utils/sixel.ts +69 -0
  1665. package/src/utils/title-generator.ts +223 -0
  1666. package/src/utils/tool-choice.ts +33 -0
  1667. package/src/utils/tools-manager.ts +363 -0
  1668. package/src/vim/buffer.ts +309 -0
  1669. package/src/vim/commands.ts +382 -0
  1670. package/src/vim/engine.ts +2409 -0
  1671. package/src/vim/parser.ts +134 -0
  1672. package/src/vim/render.ts +252 -0
  1673. package/src/vim/types.ts +197 -0
  1674. package/src/web/kagi.ts +183 -0
  1675. package/src/web/parallel.ts +349 -0
  1676. package/src/web/scrapers/artifacthub.ts +207 -0
  1677. package/src/web/scrapers/arxiv.ts +83 -0
  1678. package/src/web/scrapers/aur.ts +162 -0
  1679. package/src/web/scrapers/biorxiv.ts +133 -0
  1680. package/src/web/scrapers/bluesky.ts +262 -0
  1681. package/src/web/scrapers/brew.ts +172 -0
  1682. package/src/web/scrapers/cheatsh.ts +68 -0
  1683. package/src/web/scrapers/chocolatey.ts +196 -0
  1684. package/src/web/scrapers/choosealicense.ts +95 -0
  1685. package/src/web/scrapers/cisa-kev.ts +87 -0
  1686. package/src/web/scrapers/clojars.ts +154 -0
  1687. package/src/web/scrapers/coingecko.ts +177 -0
  1688. package/src/web/scrapers/crates-io.ts +97 -0
  1689. package/src/web/scrapers/crossref.ts +136 -0
  1690. package/src/web/scrapers/devto.ts +147 -0
  1691. package/src/web/scrapers/discogs.ts +306 -0
  1692. package/src/web/scrapers/discourse.ts +197 -0
  1693. package/src/web/scrapers/dockerhub.ts +138 -0
  1694. package/src/web/scrapers/docs-rs.ts +653 -0
  1695. package/src/web/scrapers/fdroid.ts +134 -0
  1696. package/src/web/scrapers/firefox-addons.ts +191 -0
  1697. package/src/web/scrapers/flathub.ts +223 -0
  1698. package/src/web/scrapers/github-gist.ts +58 -0
  1699. package/src/web/scrapers/github.ts +452 -0
  1700. package/src/web/scrapers/gitlab.ts +401 -0
  1701. package/src/web/scrapers/go-pkg.ts +266 -0
  1702. package/src/web/scrapers/hackage.ts +140 -0
  1703. package/src/web/scrapers/hackernews.ts +189 -0
  1704. package/src/web/scrapers/hex.ts +105 -0
  1705. package/src/web/scrapers/huggingface.ts +321 -0
  1706. package/src/web/scrapers/iacr.ts +89 -0
  1707. package/src/web/scrapers/index.ts +252 -0
  1708. package/src/web/scrapers/jetbrains-marketplace.ts +159 -0
  1709. package/src/web/scrapers/lemmy.ts +203 -0
  1710. package/src/web/scrapers/lobsters.ts +175 -0
  1711. package/src/web/scrapers/mastodon.ts +292 -0
  1712. package/src/web/scrapers/maven.ts +138 -0
  1713. package/src/web/scrapers/mdn.ts +173 -0
  1714. package/src/web/scrapers/metacpan.ts +222 -0
  1715. package/src/web/scrapers/musicbrainz.ts +250 -0
  1716. package/src/web/scrapers/npm.ts +98 -0
  1717. package/src/web/scrapers/nuget.ts +183 -0
  1718. package/src/web/scrapers/nvd.ts +222 -0
  1719. package/src/web/scrapers/ollama.ts +239 -0
  1720. package/src/web/scrapers/open-vsx.ts +106 -0
  1721. package/src/web/scrapers/opencorporates.ts +292 -0
  1722. package/src/web/scrapers/openlibrary.ts +336 -0
  1723. package/src/web/scrapers/orcid.ts +286 -0
  1724. package/src/web/scrapers/osv.ts +176 -0
  1725. package/src/web/scrapers/packagist.ts +160 -0
  1726. package/src/web/scrapers/pub-dev.ts +143 -0
  1727. package/src/web/scrapers/pubmed.ts +211 -0
  1728. package/src/web/scrapers/pypi.ts +112 -0
  1729. package/src/web/scrapers/rawg.ts +110 -0
  1730. package/src/web/scrapers/readthedocs.ts +120 -0
  1731. package/src/web/scrapers/reddit.ts +95 -0
  1732. package/src/web/scrapers/repology.ts +251 -0
  1733. package/src/web/scrapers/rfc.ts +201 -0
  1734. package/src/web/scrapers/rubygems.ts +103 -0
  1735. package/src/web/scrapers/searchcode.ts +189 -0
  1736. package/src/web/scrapers/sec-edgar.ts +261 -0
  1737. package/src/web/scrapers/semantic-scholar.ts +171 -0
  1738. package/src/web/scrapers/snapcraft.ts +187 -0
  1739. package/src/web/scrapers/sourcegraph.ts +336 -0
  1740. package/src/web/scrapers/spdx.ts +108 -0
  1741. package/src/web/scrapers/spotify.ts +198 -0
  1742. package/src/web/scrapers/stackoverflow.ts +120 -0
  1743. package/src/web/scrapers/terraform.ts +277 -0
  1744. package/src/web/scrapers/tldr.ts +47 -0
  1745. package/src/web/scrapers/twitter.ts +93 -0
  1746. package/src/web/scrapers/types.ts +318 -0
  1747. package/src/web/scrapers/utils.ts +109 -0
  1748. package/src/web/scrapers/vimeo.ts +133 -0
  1749. package/src/web/scrapers/vscode-marketplace.ts +187 -0
  1750. package/src/web/scrapers/w3c.ts +156 -0
  1751. package/src/web/scrapers/wikidata.ts +344 -0
  1752. package/src/web/scrapers/wikipedia.ts +84 -0
  1753. package/src/web/scrapers/youtube.ts +319 -0
  1754. package/src/web/search/index.ts +288 -0
  1755. package/src/web/search/provider.ts +173 -0
  1756. package/src/web/search/providers/anthropic.ts +302 -0
  1757. package/src/web/search/providers/base.ts +71 -0
  1758. package/src/web/search/providers/brave.ts +149 -0
  1759. package/src/web/search/providers/codex.ts +556 -0
  1760. package/src/web/search/providers/exa.ts +193 -0
  1761. package/src/web/search/providers/gemini.ts +455 -0
  1762. package/src/web/search/providers/jina.ts +101 -0
  1763. package/src/web/search/providers/kagi.ts +75 -0
  1764. package/src/web/search/providers/kimi.ts +171 -0
  1765. package/src/web/search/providers/parallel.ts +210 -0
  1766. package/src/web/search/providers/perplexity.ts +575 -0
  1767. package/src/web/search/providers/searxng.ts +309 -0
  1768. package/src/web/search/providers/synthetic.ts +108 -0
  1769. package/src/web/search/providers/tavily.ts +173 -0
  1770. package/src/web/search/providers/utils.ts +128 -0
  1771. package/src/web/search/providers/zai.ts +320 -0
  1772. package/src/web/search/render.ts +299 -0
  1773. package/src/web/search/types.ts +436 -0
  1774. package/src/web/search/utils.ts +17 -0
  1775. package/src/workspace-tree.ts +286 -0
@@ -0,0 +1,1093 @@
1
+ import type { AgentToolUpdateCallback } from "@gajae-code/agent-core";
2
+ import { sanitizeText } from "@gajae-code/utils";
3
+ import { formatBytes } from "../tools/render-utils";
4
+ import { sanitizeWithOptionalSixelPassthrough } from "../utils/sixel";
5
+
6
+ // =============================================================================
7
+ // Constants
8
+ // =============================================================================
9
+
10
+ export const DEFAULT_MAX_LINES = 3000;
11
+ export const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB
12
+ export const DEFAULT_MAX_COLUMN = 1024; // Max chars per grep match line
13
+
14
+ const NL = "\n";
15
+ const ELLIPSIS = "…";
16
+
17
+ // =============================================================================
18
+ // Interfaces
19
+ // =============================================================================
20
+
21
+ export interface OutputSummary {
22
+ output: string;
23
+ truncated: boolean;
24
+ totalLines: number;
25
+ totalBytes: number;
26
+ outputLines: number;
27
+ outputBytes: number;
28
+ /** Bytes elided from the middle when head-retain mode is active. */
29
+ elidedBytes?: number;
30
+ /** Lines elided from the middle when head-retain mode is active. */
31
+ elidedLines?: number;
32
+ /** Bytes dropped by the per-line column cap (sum across all lines). */
33
+ columnDroppedBytes?: number;
34
+ /** Number of distinct lines that hit the per-line column cap. */
35
+ columnTruncatedLines?: number;
36
+ /** Artifact ID for internal URL access (artifact://<id>) when truncated */
37
+ artifactId?: string;
38
+ }
39
+
40
+ export interface OutputSinkOptions {
41
+ artifactPath?: string;
42
+ artifactId?: string;
43
+ /** Tail buffer budget (bytes). Default DEFAULT_MAX_BYTES. */
44
+ spillThreshold?: number;
45
+ /**
46
+ * When > 0, the sink keeps the first `headBytes` of output in addition to
47
+ * the rolling tail window. Output between the two windows is elided
48
+ * (middle elision). Default 0 = tail-only behavior.
49
+ */
50
+ headBytes?: number;
51
+ /**
52
+ * Per-line byte cap. When > 0, lines wider than `maxColumns` bytes are
53
+ * truncated with an ellipsis at write time; remaining bytes up to the next
54
+ * `\n` are dropped. Cap state persists across chunks so split-mid-line
55
+ * writes still respect the budget. Default 0 = no per-line cap.
56
+ */
57
+ maxColumns?: number;
58
+ onChunk?: (chunk: string) => void;
59
+ /** Minimum ms between onChunk calls. 0 = every chunk (default). */
60
+ chunkThrottleMs?: number;
61
+ }
62
+
63
+ export interface TruncationResult {
64
+ content: string;
65
+ truncated?: boolean;
66
+ truncatedBy?: "lines" | "bytes" | "middle";
67
+ totalLines: number;
68
+ totalBytes: number;
69
+ outputLines?: number;
70
+ outputBytes?: number;
71
+ /** Bytes elided from the middle (truncateMiddle only). */
72
+ elidedBytes?: number;
73
+ /** Lines elided from the middle (truncateMiddle only). */
74
+ elidedLines?: number;
75
+ lastLinePartial?: boolean;
76
+ firstLineExceedsLimit?: boolean;
77
+ }
78
+
79
+ export interface TruncationOptions {
80
+ /** Maximum number of lines (default: 3000) */
81
+ maxLines?: number;
82
+ /** Maximum number of bytes (default: 50KB) */
83
+ maxBytes?: number;
84
+ /**
85
+ * For `truncateMiddle`: bytes reserved for the head window. The tail
86
+ * window receives `maxBytes - maxHeadBytes`. Default `floor(maxBytes/2)`.
87
+ */
88
+ maxHeadBytes?: number;
89
+ /**
90
+ * For `truncateMiddle`: lines reserved for the head window. The tail
91
+ * window receives `maxLines - maxHeadLines`. Default `floor(maxLines/2)`.
92
+ */
93
+ maxHeadLines?: number;
94
+ }
95
+
96
+ /** Result from byte-level truncation helpers. */
97
+ export interface ByteTruncationResult {
98
+ text: string;
99
+ bytes: number;
100
+ }
101
+
102
+ export interface TailTruncationNoticeOptions {
103
+ fullOutputPath?: string;
104
+ originalContent?: string;
105
+ suffix?: string;
106
+ }
107
+
108
+ export interface HeadTruncationNoticeOptions {
109
+ startLine?: number;
110
+ totalFileLines?: number;
111
+ }
112
+
113
+ // =============================================================================
114
+ // Internal low-level helpers
115
+ // =============================================================================
116
+
117
+ /** Count newline characters via native substring search. */
118
+ function countNewlines(text: string): number {
119
+ let count = 0;
120
+ let pos = text.indexOf(NL);
121
+ while (pos !== -1) {
122
+ count++;
123
+ pos = text.indexOf(NL, pos + 1);
124
+ }
125
+ return count;
126
+ }
127
+
128
+ /** Zero-copy view of a Uint8Array as a Buffer (copies only if already a Buffer). */
129
+ function asBuffer(data: Uint8Array): Buffer {
130
+ return Buffer.isBuffer(data) ? (data as Buffer) : Buffer.from(data.buffer, data.byteOffset, data.byteLength);
131
+ }
132
+
133
+ /** Advance past UTF-8 continuation bytes (10xxxxxx) to a leading byte. */
134
+ function findUtf8BoundaryForward(buf: Buffer, pos: number): number {
135
+ let i = Math.max(0, pos);
136
+ while (i < buf.length && (buf[i] & 0xc0) === 0x80) i++;
137
+ return i;
138
+ }
139
+
140
+ /** Retreat past UTF-8 continuation bytes to land on a leading byte. */
141
+ function findUtf8BoundaryBackward(buf: Buffer, cut: number): number {
142
+ let i = Math.min(buf.length, Math.max(0, cut));
143
+ // If the cut is at end-of-buffer, it's already a valid boundary.
144
+ if (i >= buf.length) return buf.length;
145
+ while (i > 0 && (buf[i] & 0xc0) === 0x80) i--;
146
+ return i;
147
+ }
148
+
149
+ // =============================================================================
150
+ // Byte-level truncation (windowed encoding)
151
+ // =============================================================================
152
+
153
+ function truncateBytesWindowed(
154
+ data: string | Uint8Array,
155
+ maxBytesRaw: number,
156
+ mode: "head" | "tail",
157
+ ): ByteTruncationResult {
158
+ const maxBytes = maxBytesRaw;
159
+ if (maxBytes === 0) return { text: "", bytes: 0 };
160
+
161
+ // --------------------------
162
+ // String path (windowed)
163
+ // --------------------------
164
+ if (typeof data === "string") {
165
+ // Fast non-truncation check only when it *might* fit.
166
+ if (data.length <= maxBytes) {
167
+ const len = Buffer.byteLength(data, "utf-8");
168
+ if (len <= maxBytes) return { text: data, bytes: len };
169
+ // else: multibyte-heavy string; fall through to truncation using full string as window.
170
+ }
171
+
172
+ const window =
173
+ mode === "head"
174
+ ? data.substring(0, Math.min(data.length, maxBytes))
175
+ : data.substring(Math.max(0, data.length - maxBytes));
176
+
177
+ const buf = Buffer.from(window, "utf-8");
178
+
179
+ if (mode === "head") {
180
+ const end = findUtf8BoundaryBackward(buf, maxBytes);
181
+ if (end <= 0) return { text: "", bytes: 0 };
182
+ const slice = buf.subarray(0, end);
183
+ return { text: slice.toString("utf-8"), bytes: slice.length };
184
+ } else {
185
+ const startAt = Math.max(0, buf.length - maxBytes);
186
+ const start = findUtf8BoundaryForward(buf, startAt);
187
+ const slice = buf.subarray(start);
188
+ return { text: slice.toString("utf-8"), bytes: slice.length };
189
+ }
190
+ }
191
+
192
+ // --------------------------
193
+ // Uint8Array / Buffer path
194
+ // --------------------------
195
+ const buf = asBuffer(data);
196
+ if (buf.length <= maxBytes) return { text: buf.toString("utf-8"), bytes: buf.length };
197
+
198
+ if (mode === "head") {
199
+ const end = findUtf8BoundaryBackward(buf, maxBytes);
200
+ if (end <= 0) return { text: "", bytes: 0 };
201
+ const slice = buf.subarray(0, end);
202
+ return { text: slice.toString("utf-8"), bytes: slice.length };
203
+ } else {
204
+ const startAt = buf.length - maxBytes;
205
+ const start = findUtf8BoundaryForward(buf, startAt);
206
+ const slice = buf.subarray(start);
207
+ return { text: slice.toString("utf-8"), bytes: slice.length };
208
+ }
209
+ }
210
+
211
+ /**
212
+ * Truncate a string/buffer to fit within a byte limit, keeping the tail.
213
+ * Handles multi-byte UTF-8 boundaries correctly.
214
+ */
215
+ export function truncateTailBytes(data: string | Uint8Array, maxBytes: number): ByteTruncationResult {
216
+ return truncateBytesWindowed(data, maxBytes, "tail");
217
+ }
218
+
219
+ /**
220
+ * Truncate a string/buffer to fit within a byte limit, keeping the head.
221
+ * Handles multi-byte UTF-8 boundaries correctly.
222
+ */
223
+ export function truncateHeadBytes(data: string | Uint8Array, maxBytes: number): ByteTruncationResult {
224
+ return truncateBytesWindowed(data, maxBytes, "head");
225
+ }
226
+
227
+ // =============================================================================
228
+ // Line-level utilities
229
+ // =============================================================================
230
+
231
+ /**
232
+ * Truncate a single line to max characters, appending '…' if truncated.
233
+ */
234
+ export function truncateLine(
235
+ line: string,
236
+ maxChars: number = DEFAULT_MAX_COLUMN,
237
+ ): { text: string; wasTruncated: boolean } {
238
+ if (line.length <= maxChars) return { text: line, wasTruncated: false };
239
+ return { text: `${line.slice(0, maxChars)}…`, wasTruncated: true };
240
+ }
241
+
242
+ // =============================================================================
243
+ // Content truncation (line + byte aware, no full Buffer allocation)
244
+ // =============================================================================
245
+
246
+ /** Shared helper to build a no-truncation result. */
247
+ export function noTruncResult(content: string, totalLines?: number, totalBytes?: number): TruncationResult {
248
+ if (totalLines == null) totalLines = countNewlines(content) + 1;
249
+ if (totalBytes == null) totalBytes = Buffer.byteLength(content, "utf-8");
250
+ return { content, totalLines, totalBytes };
251
+ }
252
+
253
+ /**
254
+ * Truncate content from the head (keep first N lines/bytes).
255
+ * Never returns partial lines. If the first line exceeds the byte limit,
256
+ * returns empty content with firstLineExceedsLimit=true.
257
+ *
258
+ * This implementation avoids Buffer.from(content) for the whole input.
259
+ * It only computes UTF-8 byteLength for candidate lines that can still fit.
260
+ */
261
+ export function truncateHead(content: string, options: TruncationOptions = {}): TruncationResult {
262
+ const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;
263
+ const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
264
+
265
+ const totalBytes = Buffer.byteLength(content, "utf-8");
266
+ const totalLines = countNewlines(content) + 1;
267
+
268
+ if (totalLines <= maxLines && totalBytes <= maxBytes) {
269
+ return noTruncResult(content, totalLines, totalBytes);
270
+ }
271
+
272
+ let includedLines = 0;
273
+ let bytesUsed = 0;
274
+ let cutIndex = 0; // char index where we cut (exclusive)
275
+ let cursor = 0;
276
+
277
+ let truncatedBy: "lines" | "bytes" = "lines";
278
+
279
+ while (includedLines < maxLines) {
280
+ const nl = content.indexOf(NL, cursor);
281
+ const lineEnd = nl === -1 ? content.length : nl;
282
+
283
+ const sepBytes = includedLines > 0 ? 1 : 0;
284
+ const remaining = maxBytes - bytesUsed - sepBytes;
285
+
286
+ // No room even for separators / bytes.
287
+ if (remaining < 0) {
288
+ truncatedBy = "bytes";
289
+ break;
290
+ }
291
+
292
+ // Fast reject huge lines without slicing/encoding:
293
+ // UTF-8 bytes >= UTF-16 code units, so if code units exceed remaining, bytes must exceed too.
294
+ const lineCodeUnits = lineEnd - cursor;
295
+ if (lineCodeUnits > remaining) {
296
+ truncatedBy = "bytes";
297
+ if (includedLines === 0) {
298
+ return {
299
+ content: "",
300
+ truncated: true,
301
+ truncatedBy: "bytes",
302
+ totalLines,
303
+ totalBytes,
304
+ outputLines: 0,
305
+ outputBytes: 0,
306
+ lastLinePartial: false,
307
+ firstLineExceedsLimit: true,
308
+ };
309
+ }
310
+ break;
311
+ }
312
+
313
+ // Small slice (bounded by remaining <= maxBytes) for exact UTF-8 byte count.
314
+ const lineText = content.slice(cursor, lineEnd);
315
+ const lineBytes = Buffer.byteLength(lineText, "utf-8");
316
+
317
+ if (lineBytes > remaining) {
318
+ truncatedBy = "bytes";
319
+ if (includedLines === 0) {
320
+ return {
321
+ content: "",
322
+ truncated: true,
323
+ truncatedBy: "bytes",
324
+ totalLines,
325
+ totalBytes,
326
+ outputLines: 0,
327
+ outputBytes: 0,
328
+ lastLinePartial: false,
329
+ firstLineExceedsLimit: true,
330
+ };
331
+ }
332
+ break;
333
+ }
334
+
335
+ // Include the line (join semantics: no trailing newline after the last included line).
336
+ bytesUsed += sepBytes + lineBytes;
337
+ includedLines++;
338
+
339
+ cutIndex = nl === -1 ? content.length : nl; // exclude the newline after the last included line
340
+ if (nl === -1) break;
341
+ cursor = nl + 1;
342
+ }
343
+
344
+ if (includedLines >= maxLines && bytesUsed <= maxBytes) truncatedBy = "lines";
345
+
346
+ return {
347
+ content: content.slice(0, cutIndex),
348
+ truncated: true,
349
+ truncatedBy,
350
+ totalLines,
351
+ totalBytes,
352
+ outputLines: includedLines,
353
+ outputBytes: bytesUsed,
354
+ lastLinePartial: false,
355
+ firstLineExceedsLimit: false,
356
+ };
357
+ }
358
+
359
+ /**
360
+ * Truncate content from the tail (keep last N lines/bytes).
361
+ * May return a partial first line if the last line exceeds the byte limit.
362
+ *
363
+ * Also avoids Buffer.from(content) for the whole input.
364
+ */
365
+ export function truncateTail(content: string, options: TruncationOptions = {}): TruncationResult {
366
+ const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;
367
+ const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
368
+
369
+ const totalBytes = Buffer.byteLength(content, "utf-8");
370
+ const totalLines = countNewlines(content) + 1;
371
+
372
+ if (totalLines <= maxLines && totalBytes <= maxBytes) {
373
+ return noTruncResult(content, totalLines, totalBytes);
374
+ }
375
+
376
+ let includedLines = 0;
377
+ let bytesUsed = 0;
378
+ let startIndex = content.length; // char index where output starts
379
+ let end = content.length; // char index where current line ends (exclusive)
380
+
381
+ let truncatedBy: "lines" | "bytes" = "lines";
382
+
383
+ while (includedLines < maxLines) {
384
+ const nl = content.lastIndexOf(NL, end - 1);
385
+ const lineStart = nl === -1 ? 0 : nl + 1;
386
+
387
+ const sepBytes = includedLines > 0 ? 1 : 0;
388
+ const remaining = maxBytes - bytesUsed - sepBytes;
389
+
390
+ if (remaining < 0) {
391
+ truncatedBy = "bytes";
392
+ break;
393
+ }
394
+
395
+ const lineCodeUnits = end - lineStart;
396
+
397
+ // Fast reject huge line without slicing/encoding.
398
+ if (lineCodeUnits > remaining) {
399
+ truncatedBy = "bytes";
400
+ if (includedLines === 0) {
401
+ // Window the line substring to avoid materializing a giant string.
402
+ const windowStart = Math.max(lineStart, end - maxBytes);
403
+ const window = content.substring(windowStart, end);
404
+ const tail = truncateTailBytes(window, maxBytes);
405
+ return {
406
+ content: tail.text,
407
+ truncated: true,
408
+ truncatedBy: "bytes",
409
+ totalLines,
410
+ totalBytes,
411
+ outputLines: 1,
412
+ outputBytes: tail.bytes,
413
+ lastLinePartial: true,
414
+ firstLineExceedsLimit: false,
415
+ };
416
+ }
417
+ break;
418
+ }
419
+
420
+ const lineText = content.slice(lineStart, end);
421
+ const lineBytes = Buffer.byteLength(lineText, "utf-8");
422
+
423
+ if (lineBytes > remaining) {
424
+ truncatedBy = "bytes";
425
+ if (includedLines === 0) {
426
+ const tail = truncateTailBytes(lineText, maxBytes);
427
+ return {
428
+ content: tail.text,
429
+ truncated: true,
430
+ truncatedBy: "bytes",
431
+ totalLines,
432
+ totalBytes,
433
+ outputLines: 1,
434
+ outputBytes: tail.bytes,
435
+ lastLinePartial: true,
436
+ firstLineExceedsLimit: false,
437
+ };
438
+ }
439
+ break;
440
+ }
441
+
442
+ bytesUsed += sepBytes + lineBytes;
443
+ includedLines++;
444
+ startIndex = lineStart;
445
+
446
+ if (nl === -1) break;
447
+ end = nl; // exclude the newline itself; it'll be accounted as sepBytes in the next iteration
448
+ }
449
+
450
+ if (includedLines >= maxLines && bytesUsed <= maxBytes) truncatedBy = "lines";
451
+
452
+ return {
453
+ content: content.slice(startIndex),
454
+ truncated: true,
455
+ truncatedBy,
456
+ totalLines,
457
+ totalBytes,
458
+ outputLines: includedLines,
459
+ outputBytes: bytesUsed,
460
+ lastLinePartial: false,
461
+ firstLineExceedsLimit: false,
462
+ };
463
+ }
464
+
465
+ // =============================================================================
466
+ // Middle elision (keep head + tail, drop middle)
467
+ // =============================================================================
468
+
469
+ /**
470
+ * Format the inline marker substituted for the elided middle region.
471
+ * Returned without surrounding newlines so callers can position it freely.
472
+ */
473
+ export function formatMiddleElisionMarker(elidedLines: number, elidedBytes: number): string {
474
+ const linesPart = `${elidedLines.toLocaleString()} line${elidedLines === 1 ? "" : "s"}`;
475
+ return `[… ${linesPart} elided (${formatBytes(elidedBytes)}) …]`;
476
+ }
477
+
478
+ /**
479
+ * Truncate content keeping a head window and a tail window, eliding the middle.
480
+ *
481
+ * The combined output is `<head>\n<marker>\n<tail>` when truncation is needed.
482
+ * `maxHeadBytes` defaults to `floor(maxBytes / 2)`; the tail receives the
483
+ * remainder. Falls back to `truncateTail` / `truncateHead` if either side's
484
+ * budget is empty or the content already fits.
485
+ */
486
+ export function truncateMiddle(content: string, options: TruncationOptions = {}): TruncationResult {
487
+ const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
488
+ const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;
489
+ const headBytes = options.maxHeadBytes ?? Math.floor(maxBytes / 2);
490
+ const tailBytes = Math.max(0, maxBytes - headBytes);
491
+ const headLines = options.maxHeadLines ?? Math.max(1, Math.floor(maxLines / 2));
492
+ const tailLines = Math.max(0, maxLines - headLines);
493
+
494
+ const totalBytes = Buffer.byteLength(content, "utf-8");
495
+ const totalLines = countNewlines(content) + 1;
496
+
497
+ if (totalBytes <= maxBytes && totalLines <= maxLines) {
498
+ return noTruncResult(content, totalLines, totalBytes);
499
+ }
500
+
501
+ // Degenerate budgets → fall back to one-sided truncation.
502
+ if (headBytes <= 0 || headLines <= 0) {
503
+ return truncateTail(content, { maxBytes: tailBytes || maxBytes, maxLines: tailLines || maxLines });
504
+ }
505
+ if (tailBytes <= 0 || tailLines <= 0) {
506
+ return truncateHead(content, { maxBytes: headBytes, maxLines: headLines });
507
+ }
508
+
509
+ const head = truncateHead(content, { maxBytes: headBytes, maxLines: headLines });
510
+ const tail = truncateTail(content, { maxBytes: tailBytes, maxLines: tailLines });
511
+
512
+ const headLinesKept = head.outputLines ?? 0;
513
+ const tailLinesKept = tail.outputLines ?? 0;
514
+ const headBytesKept = head.outputBytes ?? Buffer.byteLength(head.content, "utf-8");
515
+ const tailBytesKept = tail.outputBytes ?? Buffer.byteLength(tail.content, "utf-8");
516
+
517
+ // Head unusable (first line exceeds budget) → tail-only.
518
+ if (headLinesKept === 0 || head.firstLineExceedsLimit) return tail;
519
+ // Tail unusable → head-only.
520
+ if (tailLinesKept === 0) return head;
521
+ // Windows overlap → no meaningful elision; return content untruncated.
522
+ if (headLinesKept + tailLinesKept >= totalLines) {
523
+ return noTruncResult(content, totalLines, totalBytes);
524
+ }
525
+
526
+ const elidedLines = totalLines - headLinesKept - tailLinesKept;
527
+ // `totalBytes - headBytesKept - tailBytesKept` includes newline separators
528
+ // between the kept windows and the elided region; close enough for a notice.
529
+ const elidedBytes = Math.max(0, totalBytes - headBytesKept - tailBytesKept);
530
+ const marker = formatMiddleElisionMarker(elidedLines, elidedBytes);
531
+ const composed = `${head.content}\n${marker}\n${tail.content}`;
532
+ const markerBytes = Buffer.byteLength(marker, "utf-8");
533
+
534
+ return {
535
+ content: composed,
536
+ truncated: true,
537
+ truncatedBy: "middle",
538
+ totalLines,
539
+ totalBytes,
540
+ outputLines: headLinesKept + tailLinesKept + 1,
541
+ outputBytes: headBytesKept + tailBytesKept + markerBytes + 2,
542
+ elidedLines,
543
+ elidedBytes,
544
+ lastLinePartial: tail.lastLinePartial,
545
+ firstLineExceedsLimit: false,
546
+ };
547
+ }
548
+
549
+ // =============================================================================
550
+ // TailBuffer — ring-style tail buffer with lazy joining
551
+ // =============================================================================
552
+
553
+ const MAX_PENDING = 10;
554
+
555
+ export class TailBuffer {
556
+ #pending: string[] = [];
557
+ #pos = 0; // byte count of the currently-held tail (after trims)
558
+
559
+ constructor(readonly maxBytes: number) {}
560
+
561
+ append(text: string): void {
562
+ if (!text) return;
563
+
564
+ const max = this.maxBytes;
565
+ if (max === 0) {
566
+ this.#pending.length = 0;
567
+ this.#pos = 0;
568
+ return;
569
+ }
570
+
571
+ const n = Buffer.byteLength(text, "utf-8");
572
+
573
+ // If the incoming chunk alone is >= budget, it fully dominates the tail.
574
+ if (n >= max) {
575
+ const { text: t, bytes } = truncateTailBytes(text, max);
576
+ this.#pending[0] = t;
577
+ this.#pending.length = 1;
578
+ this.#pos = bytes;
579
+ return;
580
+ }
581
+
582
+ this.#pos += n;
583
+
584
+ if (this.#pending.length === 0) {
585
+ this.#pending[0] = text;
586
+ this.#pending.length = 1;
587
+ } else {
588
+ this.#pending.push(text);
589
+ if (this.#pending.length > MAX_PENDING) this.#compact();
590
+ }
591
+
592
+ // Trim when we exceed 2× budget to amortize cost.
593
+ if (this.#pos > max * 2) this.#trimTo(max);
594
+ }
595
+
596
+ text(): string {
597
+ const max = this.maxBytes;
598
+ this.#trimTo(max);
599
+ return this.#flush();
600
+ }
601
+
602
+ bytes(): number {
603
+ const max = this.maxBytes;
604
+ this.#trimTo(max);
605
+ return this.#pos;
606
+ }
607
+
608
+ // -- private ---------------------------------------------------------------
609
+
610
+ #compact(): void {
611
+ this.#pending[0] = this.#pending.join("");
612
+ this.#pending.length = 1;
613
+ }
614
+
615
+ #flush(): string {
616
+ if (this.#pending.length === 0) return "";
617
+ if (this.#pending.length > 1) this.#compact();
618
+ return this.#pending[0];
619
+ }
620
+
621
+ #trimTo(max: number): void {
622
+ if (max === 0) {
623
+ this.#pending.length = 0;
624
+ this.#pos = 0;
625
+ return;
626
+ }
627
+ if (this.#pos <= max) return;
628
+
629
+ const joined = this.#flush();
630
+ const { text, bytes } = truncateTailBytes(joined, max);
631
+ this.#pos = bytes;
632
+ this.#pending[0] = text;
633
+ this.#pending.length = 1;
634
+ }
635
+ }
636
+
637
+ // =============================================================================
638
+ // OutputSink — line-buffered output with file spill support
639
+ // =============================================================================
640
+
641
+ export class OutputSink {
642
+ #buffer = "";
643
+ #bufferBytes = 0;
644
+ #head = "";
645
+ #headBytes = 0;
646
+ #headLines = 0; // newline count inside #head
647
+ #headRetentionDisabled = false;
648
+ #totalLines = 0; // newline count
649
+ #totalBytes = 0;
650
+ #sawData = false;
651
+ #truncated = false;
652
+ #lastChunkTime = 0;
653
+
654
+ // Per-line column cap streaming state (persists across `push` calls so a
655
+ // long line split across chunks still trips the same trigger).
656
+ #currentLineBytes = 0;
657
+ #columnEllipsisAdded = false;
658
+ #columnDroppedBytes = 0;
659
+ #columnTruncatedLines = 0;
660
+ #file?: {
661
+ path: string;
662
+ artifactId?: string;
663
+ sink: Bun.FileSink;
664
+ };
665
+
666
+ // Queue of chunks waiting for the file sink to be created.
667
+ #pendingFileWrites?: string[];
668
+ #fileReady = false;
669
+
670
+ readonly #artifactPath?: string;
671
+ readonly #artifactId?: string;
672
+ readonly #spillThreshold: number;
673
+ readonly #headLimit: number;
674
+ readonly #onChunk?: (chunk: string) => void;
675
+ readonly #chunkThrottleMs: number;
676
+ readonly #maxColumns: number;
677
+
678
+ constructor(options?: OutputSinkOptions) {
679
+ const {
680
+ artifactPath,
681
+ artifactId,
682
+ spillThreshold = DEFAULT_MAX_BYTES,
683
+ headBytes = 0,
684
+ maxColumns = 0,
685
+ onChunk,
686
+ chunkThrottleMs = 0,
687
+ } = options ?? {};
688
+ this.#artifactPath = artifactPath;
689
+ this.#artifactId = artifactId;
690
+ this.#spillThreshold = spillThreshold;
691
+ this.#headLimit = Math.max(0, headBytes);
692
+ this.#maxColumns = Math.max(0, maxColumns);
693
+ this.#onChunk = onChunk;
694
+ this.#chunkThrottleMs = chunkThrottleMs;
695
+ }
696
+
697
+ /**
698
+ * Push a chunk of output. The buffer management and onChunk callback run
699
+ * synchronously. File sink writes are deferred and serialized internally.
700
+ */
701
+ push(chunk: string): void {
702
+ chunk = sanitizeWithOptionalSixelPassthrough(chunk, sanitizeText);
703
+
704
+ // Throttled onChunk: only call the callback when enough time has passed.
705
+ // Live preview gets the raw (pre-cap) chunk so the TUI never lags behind
706
+ // what reached the sink — the column cap is for the persisted LLM view.
707
+ if (this.#onChunk) {
708
+ const now = Date.now();
709
+ if (now - this.#lastChunkTime >= this.#chunkThrottleMs) {
710
+ this.#lastChunkTime = now;
711
+ this.#onChunk(chunk);
712
+ }
713
+ }
714
+
715
+ const rawBytes = Buffer.byteLength(chunk, "utf-8");
716
+ this.#totalBytes += rawBytes;
717
+
718
+ if (chunk.length > 0) {
719
+ this.#sawData = true;
720
+ this.#totalLines += countNewlines(chunk);
721
+ }
722
+
723
+ // Per-line column cap. State persists across chunks so a mid-line split
724
+ // still respects the budget. Operates on the sanitized chunk; the cap is
725
+ // applied before head/tail accounting but after artifact mirroring decides.
726
+ const capped = this.#maxColumns > 0 ? this.#applyColumnCap(chunk) : chunk;
727
+ const cappedBytes = capped === chunk ? rawBytes : Buffer.byteLength(capped, "utf-8");
728
+ const cappedThisChunk = cappedBytes < rawBytes;
729
+ if (cappedThisChunk) this.#truncated = true;
730
+
731
+ // Mirror RAW chunk to the artifact file so the on-disk record is the full
732
+ // uncapped stream. Mirror triggers on: in-memory overflow OR this chunk's
733
+ // column cap dropped bytes (otherwise we'd lose data) OR file already open.
734
+ if (this.#artifactPath && (this.#file != null || cappedThisChunk || this.#willOverflow(cappedBytes))) {
735
+ this.#writeToFile(chunk);
736
+ }
737
+
738
+ if (cappedBytes === 0) return;
739
+
740
+ // Head retention: drain the (capped) chunk into #head until the budget is
741
+ // exhausted, then forward any leftover to the tail buffer.
742
+ let tailChunk = capped;
743
+ let tailBytes = cappedBytes;
744
+ if (this.#headLimit > 0 && !this.#headRetentionDisabled && this.#headBytes < this.#headLimit) {
745
+ const room = this.#headLimit - this.#headBytes;
746
+ if (cappedBytes <= room) {
747
+ this.#head += capped;
748
+ this.#headBytes += cappedBytes;
749
+ this.#headLines += countNewlines(capped);
750
+ return;
751
+ }
752
+ // Split: head takes a UTF-8-safe prefix; remainder flows to tail.
753
+ const headSlice = truncateHeadBytes(capped, room);
754
+ if (headSlice.bytes > 0) {
755
+ this.#head += headSlice.text;
756
+ this.#headBytes += headSlice.bytes;
757
+ this.#headLines += countNewlines(headSlice.text);
758
+ tailChunk = capped.substring(headSlice.text.length);
759
+ tailBytes = cappedBytes - headSlice.bytes;
760
+ }
761
+ }
762
+
763
+ this.#pushTail(tailChunk, tailBytes);
764
+ }
765
+
766
+ /**
767
+ * Apply the per-line byte cap to `chunk`, dropping bytes that would push the
768
+ * current line beyond `#maxColumns`. Emits a single `…` once a line trips the
769
+ * cap; subsequent bytes are skipped until the next `\n`. State persists
770
+ * across calls so a long line split across chunks still produces one marker.
771
+ */
772
+ #applyColumnCap(chunk: string): string {
773
+ if (chunk.length === 0) return chunk;
774
+ const max = this.#maxColumns;
775
+ const parts: string[] = [];
776
+ let cursor = 0;
777
+ while (cursor < chunk.length) {
778
+ const nlIdx = chunk.indexOf(NL, cursor);
779
+ const segEnd = nlIdx === -1 ? chunk.length : nlIdx;
780
+ if (segEnd > cursor) {
781
+ const segment = chunk.substring(cursor, segEnd);
782
+ if (this.#columnEllipsisAdded) {
783
+ // Past the cap; drop until newline.
784
+ this.#columnDroppedBytes += Buffer.byteLength(segment, "utf-8");
785
+ } else {
786
+ const segBytes = Buffer.byteLength(segment, "utf-8");
787
+ const remaining = max - this.#currentLineBytes;
788
+ if (segBytes <= remaining) {
789
+ parts.push(segment);
790
+ this.#currentLineBytes += segBytes;
791
+ } else {
792
+ // First overflow on this line: keep what fits, append ellipsis,
793
+ // arm the skip-until-newline flag.
794
+ const ellipsisBytes = 3; // "…" in UTF-8
795
+ const headRoom = Math.max(0, remaining - ellipsisBytes);
796
+ let kept = "";
797
+ let keptBytes = 0;
798
+ if (headRoom > 0) {
799
+ const sliced = truncateHeadBytes(segment, headRoom);
800
+ kept = sliced.text;
801
+ keptBytes = sliced.bytes;
802
+ parts.push(kept);
803
+ }
804
+ parts.push(ELLIPSIS);
805
+ this.#columnDroppedBytes += segBytes - keptBytes;
806
+ this.#columnTruncatedLines++;
807
+ this.#currentLineBytes += keptBytes + ellipsisBytes;
808
+ this.#columnEllipsisAdded = true;
809
+ }
810
+ }
811
+ }
812
+ if (nlIdx === -1) break;
813
+ parts.push(NL);
814
+ this.#currentLineBytes = 0;
815
+ this.#columnEllipsisAdded = false;
816
+ cursor = nlIdx + 1;
817
+ }
818
+ return parts.join("");
819
+ }
820
+
821
+ #willOverflow(dataBytes: number): boolean {
822
+ // Triggers file mirroring as soon as the next chunk would push us over
823
+ // the tail budget (head retention does not change spill-to-artifact).
824
+ return this.#bufferBytes + dataBytes > this.#spillThreshold;
825
+ }
826
+
827
+ #pushTail(chunk: string, dataBytes: number): void {
828
+ if (dataBytes === 0) return;
829
+
830
+ const threshold = this.#spillThreshold;
831
+ const willOverflow = this.#bufferBytes + dataBytes > threshold;
832
+
833
+ if (!willOverflow) {
834
+ this.#buffer += chunk;
835
+ this.#bufferBytes += dataBytes;
836
+ return;
837
+ }
838
+
839
+ // Overflow: keep only a tail window in memory.
840
+ this.#truncated = true;
841
+
842
+ // Avoid creating a giant intermediate string when chunk alone dominates.
843
+ if (dataBytes >= threshold) {
844
+ const { text, bytes } = truncateTailBytes(chunk, threshold);
845
+ this.#buffer = text;
846
+ this.#bufferBytes = bytes;
847
+ } else {
848
+ // Intermediate size is bounded (<= threshold + dataBytes), safe to concat.
849
+ this.#buffer += chunk;
850
+ this.#bufferBytes += dataBytes;
851
+
852
+ const { text, bytes } = truncateTailBytes(this.#buffer, threshold);
853
+ this.#buffer = text;
854
+ this.#bufferBytes = bytes;
855
+ }
856
+ }
857
+
858
+ /**
859
+ * Write a chunk to the artifact file. Handles the async file sink creation
860
+ * by queuing writes until the sink is ready, then draining synchronously.
861
+ */
862
+ #writeToFile(chunk: string): void {
863
+ if (this.#fileReady && this.#file) {
864
+ // Fast path: file sink exists, write synchronously
865
+ this.#file.sink.write(chunk);
866
+ return;
867
+ }
868
+ // File sink not yet created — queue this chunk and kick off creation
869
+ if (!this.#pendingFileWrites) {
870
+ this.#pendingFileWrites = [chunk];
871
+ void this.#createFileSink();
872
+ } else {
873
+ this.#pendingFileWrites.push(chunk);
874
+ }
875
+ }
876
+
877
+ async #createFileSink(): Promise<void> {
878
+ if (!this.#artifactPath || this.#fileReady) return;
879
+ try {
880
+ const sink = Bun.file(this.#artifactPath).writer();
881
+ this.#file = { path: this.#artifactPath, artifactId: this.#artifactId, sink };
882
+
883
+ // Flush existing buffer to file BEFORE it gets trimmed further.
884
+ if (this.#buffer.length > 0) {
885
+ sink.write(this.#buffer);
886
+ }
887
+
888
+ // Drain any chunks that arrived while the sink was being created
889
+ if (this.#pendingFileWrites) {
890
+ for (const pending of this.#pendingFileWrites) {
891
+ sink.write(pending);
892
+ }
893
+ this.#pendingFileWrites = undefined;
894
+ }
895
+
896
+ this.#fileReady = true;
897
+ } catch {
898
+ try {
899
+ await this.#file?.sink?.end();
900
+ } catch {
901
+ /* ignore */
902
+ }
903
+ this.#file = undefined;
904
+ this.#pendingFileWrites = undefined;
905
+ }
906
+ }
907
+
908
+ createInput(): WritableStream<Uint8Array | string> {
909
+ const dec = new TextDecoder("utf-8", { ignoreBOM: true });
910
+ const finalize = () => {
911
+ this.push(dec.decode());
912
+ };
913
+ return new WritableStream({
914
+ write: chunk => {
915
+ this.push(typeof chunk === "string" ? chunk : dec.decode(chunk, { stream: true }));
916
+ },
917
+ close: finalize,
918
+ abort: finalize,
919
+ });
920
+ }
921
+
922
+ /**
923
+ * Replace the in-memory buffer with the given text. Used when an upstream
924
+ * minimizer rewrites the captured output after the raw bytes have already
925
+ * been streamed.
926
+ *
927
+ * After this call the buffer is authoritative: streaming counters realign
928
+ * to the replacement, the retained head window is cleared, and head
929
+ * retention is disabled so subsequent `push()` calls append directly to the
930
+ * tail buffer instead of repopulating the (now meaningless) head window
931
+ * — which would otherwise reorder content and trip the middle-elision
932
+ * branch in `dump()` against stale totals.
933
+ */
934
+ replace(text: string): void {
935
+ this.#buffer = text;
936
+ this.#bufferBytes = Buffer.byteLength(text, "utf-8");
937
+ this.#head = "";
938
+ this.#headBytes = 0;
939
+ this.#headLines = 0;
940
+ this.#headRetentionDisabled = true;
941
+ this.#totalBytes = this.#bufferBytes;
942
+ this.#totalLines = countNewlines(text);
943
+ this.#sawData = text.length > 0;
944
+ this.#truncated = false;
945
+ this.#currentLineBytes = 0;
946
+ this.#columnEllipsisAdded = false;
947
+ this.#columnDroppedBytes = 0;
948
+ this.#columnTruncatedLines = 0;
949
+ }
950
+
951
+ async dump(notice?: string): Promise<OutputSummary> {
952
+ const noticeLine = notice ? `[${notice}]\n` : "";
953
+ const totalLines = this.#sawData ? this.#totalLines + 1 : 0;
954
+
955
+ if (this.#file) await this.#file.sink.end();
956
+
957
+ // Compose the visible output. With head retention, splice head + marker
958
+ // + tail when content was elided. Otherwise return the rolling buffer.
959
+ const headBytes = this.#headBytes;
960
+ const tailBuf = this.#buffer;
961
+ const tailBytes = this.#bufferBytes;
962
+ const headLines = this.#headLines + (headBytes > 0 && !this.#head.endsWith("\n") ? 1 : 0);
963
+ const tailLines = tailBuf.length > 0 ? countNewlines(tailBuf) + 1 : 0;
964
+
965
+ // Bytes that survived the column cap. Middle elision operates on these,
966
+ // so column-dropped bytes don't inflate the "elided from middle" count.
967
+ const effectiveTotalBytes = Math.max(0, this.#totalBytes - this.#columnDroppedBytes);
968
+
969
+ let body: string;
970
+ let outputBytes: number;
971
+ let outputLines: number;
972
+ let elidedBytes: number | undefined;
973
+ let elidedLines: number | undefined;
974
+
975
+ if (headBytes > 0 && effectiveTotalBytes > headBytes + tailBytes) {
976
+ // Middle was elided. Emit head + marker + tail.
977
+ elidedBytes = Math.max(0, effectiveTotalBytes - headBytes - tailBytes);
978
+ elidedLines = Math.max(0, totalLines - headLines - tailLines);
979
+ const marker = formatMiddleElisionMarker(elidedLines, elidedBytes);
980
+ const markerBytes = Buffer.byteLength(marker, "utf-8");
981
+ const headSep = this.#head.endsWith("\n") ? "" : "\n";
982
+ const tailSep = tailBuf.startsWith("\n") ? "" : "\n";
983
+ body = `${this.#head}${headSep}${marker}${tailSep}${tailBuf}`;
984
+ outputBytes =
985
+ headBytes +
986
+ markerBytes +
987
+ tailBytes +
988
+ Buffer.byteLength(headSep, "utf-8") +
989
+ Buffer.byteLength(tailSep, "utf-8");
990
+ outputLines = headLines + 1 + tailLines;
991
+ this.#truncated = true;
992
+ } else if (headBytes > 0) {
993
+ // Head + tail combine into the full buffered output (no overlap or elision).
994
+ body = `${this.#head}${tailBuf}`;
995
+ outputBytes = headBytes + tailBytes;
996
+ outputLines = body.length > 0 ? countNewlines(body) + 1 : 0;
997
+ } else {
998
+ body = tailBuf;
999
+ outputBytes = tailBytes;
1000
+ outputLines = tailLines;
1001
+ }
1002
+
1003
+ return {
1004
+ output: `${noticeLine}${body}`,
1005
+ truncated: this.#truncated,
1006
+ totalLines,
1007
+ totalBytes: this.#totalBytes,
1008
+ outputLines,
1009
+ outputBytes,
1010
+ elidedBytes,
1011
+ elidedLines,
1012
+ columnDroppedBytes: this.#columnDroppedBytes > 0 ? this.#columnDroppedBytes : undefined,
1013
+ columnTruncatedLines: this.#columnTruncatedLines > 0 ? this.#columnTruncatedLines : undefined,
1014
+ artifactId: this.#file?.artifactId,
1015
+ };
1016
+ }
1017
+ }
1018
+
1019
+ // =============================================================================
1020
+ // Truncation notice formatting
1021
+ // =============================================================================
1022
+
1023
+ /**
1024
+ * Format a truncation notice for tail-truncated output (bash, python, ssh).
1025
+ * Returns empty string if not truncated.
1026
+ */
1027
+ export function formatTailTruncationNotice(
1028
+ truncation: TruncationResult,
1029
+ options: TailTruncationNoticeOptions = {},
1030
+ ): string {
1031
+ if (!truncation.truncated) return "";
1032
+
1033
+ const { fullOutputPath, originalContent, suffix = "" } = options;
1034
+ const startLine = truncation.totalLines - (truncation.outputLines ?? truncation.totalLines) + 1;
1035
+ const endLine = truncation.totalLines;
1036
+ const fullOutputPart = fullOutputPath ? `. Full output: ${fullOutputPath}` : "";
1037
+
1038
+ let notice: string;
1039
+ if (truncation.lastLinePartial) {
1040
+ let lastLineSizePart = "";
1041
+ if (originalContent) {
1042
+ const lastNl = originalContent.lastIndexOf(NL);
1043
+ const lastLine = lastNl === -1 ? originalContent : originalContent.substring(lastNl + 1);
1044
+ lastLineSizePart = ` (line is ${formatBytes(Buffer.byteLength(lastLine, "utf-8"))})`;
1045
+ }
1046
+ notice = `[Showing last ${formatBytes(truncation.outputBytes ?? truncation.totalBytes)} of line ${endLine}${lastLineSizePart}${fullOutputPart}${suffix}]`;
1047
+ } else {
1048
+ notice = `[Showing lines ${startLine}-${endLine} of ${truncation.totalLines}${fullOutputPart}${suffix}]`;
1049
+ }
1050
+
1051
+ return `\n\n${notice}`;
1052
+ }
1053
+
1054
+ /**
1055
+ * Format a truncation notice for head-truncated output (read tool).
1056
+ * Returns empty string if not truncated.
1057
+ */
1058
+ export function formatHeadTruncationNotice(
1059
+ truncation: TruncationResult,
1060
+ options: HeadTruncationNoticeOptions = {},
1061
+ ): string {
1062
+ if (!truncation.truncated) return "";
1063
+
1064
+ const startLineDisplay = options.startLine ?? 1;
1065
+ const totalFileLines = options.totalFileLines ?? truncation.totalLines;
1066
+ const endLineDisplay = startLineDisplay + (truncation.outputLines ?? truncation.totalLines) - 1;
1067
+ const nextOffset = endLineDisplay + 1;
1068
+ const notice = `[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines}. Use :${nextOffset} to continue]`;
1069
+ return `\n\n${notice}`;
1070
+ }
1071
+
1072
+ // =============================================================================
1073
+ // Streaming tail update helper (shared by bash/ssh tools)
1074
+ // =============================================================================
1075
+
1076
+ /**
1077
+ * Build an onChunk handler that appends to a TailBuffer and emits a streaming
1078
+ * update (when `onUpdate` is defined) with the buffer's current text.
1079
+ */
1080
+ export function streamTailUpdates<TDetails, TInput = unknown>(
1081
+ tailBuffer: TailBuffer,
1082
+ onUpdate: AgentToolUpdateCallback<TDetails, TInput> | undefined,
1083
+ ): (chunk: string) => void {
1084
+ return chunk => {
1085
+ tailBuffer.append(chunk);
1086
+ if (onUpdate) {
1087
+ onUpdate({
1088
+ content: [{ type: "text", text: tailBuffer.text() }],
1089
+ details: {} as TDetails,
1090
+ });
1091
+ }
1092
+ };
1093
+ }