@subimpact/e 0.100.0 → 0.100.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 (911) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +7 -1
  3. package/dist/bundle/chunks/{chunk-KAXC2ESR.js → chunk-GICF34HK.js} +8 -8
  4. package/dist/bundle/chunks/{chunk-FBZU53S6.js → chunk-NBSSK56J.js} +1 -1
  5. package/dist/bundle/chunks/{chunk-QSDAQKAU.js → chunk-RAB4RJZ2.js} +11 -12
  6. package/dist/bundle/chunks/{easter-egg-3d-DD22MRM3.js → easter-egg-3d-JQPBRQEU.js} +1 -1
  7. package/dist/bundle/chunks/{openai-codex-responses-YOLBMQOC.js → openai-codex-responses-WGH4GHLE.js} +1 -1
  8. package/dist/bundle/chunks/{virtual-modules-YQUQNKDN.js → virtual-modules-L22CHFWU.js} +1 -1
  9. package/dist/bundle/cli-runtime.js +1 -1
  10. package/dist/bundle/index.js +1 -1
  11. package/dist/bundle/rpc-entry.js +1 -1
  12. package/docs/compaction.md +2 -2
  13. package/docs/extensions.md +4 -10
  14. package/docs/message-types.md +2 -4
  15. package/docs/session-format.md +4 -4
  16. package/docs/settings.md +1 -1
  17. package/docs/tui.md +1 -1
  18. package/examples/extensions/overlay-test.ts +2 -2
  19. package/package.json +31 -31
  20. package/dist/bun/cli.d.ts +0 -5
  21. package/dist/bun/cli.d.ts.map +0 -1
  22. package/dist/bun/cli.js +0 -5
  23. package/dist/bun/cli.js.map +0 -1
  24. package/dist/bun/restore-sandbox-env.d.ts +0 -17
  25. package/dist/bun/restore-sandbox-env.d.ts.map +0 -1
  26. package/dist/bun/restore-sandbox-env.js +0 -36
  27. package/dist/bun/restore-sandbox-env.js.map +0 -1
  28. package/dist/bun/runtime-setup.d.ts +0 -2
  29. package/dist/bun/runtime-setup.d.ts.map +0 -1
  30. package/dist/bun/runtime-setup.js +0 -9
  31. package/dist/bun/runtime-setup.js.map +0 -1
  32. package/dist/bun/sandbox-env-setup.d.ts +0 -2
  33. package/dist/bun/sandbox-env-setup.d.ts.map +0 -1
  34. package/dist/bun/sandbox-env-setup.js +0 -4
  35. package/dist/bun/sandbox-env-setup.js.map +0 -1
  36. package/dist/cli/args.d.ts +0 -61
  37. package/dist/cli/args.d.ts.map +0 -1
  38. package/dist/cli/args.js +0 -453
  39. package/dist/cli/args.js.map +0 -1
  40. package/dist/cli/auth-check.d.ts +0 -19
  41. package/dist/cli/auth-check.d.ts.map +0 -1
  42. package/dist/cli/auth-check.js +0 -50
  43. package/dist/cli/auth-check.js.map +0 -1
  44. package/dist/cli/auth-command.d.ts +0 -24
  45. package/dist/cli/auth-command.d.ts.map +0 -1
  46. package/dist/cli/auth-command.js +0 -103
  47. package/dist/cli/auth-command.js.map +0 -1
  48. package/dist/cli/config-selector.d.ts +0 -16
  49. package/dist/cli/config-selector.d.ts.map +0 -1
  50. package/dist/cli/config-selector.js +0 -32
  51. package/dist/cli/config-selector.js.map +0 -1
  52. package/dist/cli/credential-print.d.ts +0 -13
  53. package/dist/cli/credential-print.d.ts.map +0 -1
  54. package/dist/cli/credential-print.js +0 -76
  55. package/dist/cli/credential-print.js.map +0 -1
  56. package/dist/cli/file-processor.d.ts +0 -15
  57. package/dist/cli/file-processor.d.ts.map +0 -1
  58. package/dist/cli/file-processor.js +0 -71
  59. package/dist/cli/file-processor.js.map +0 -1
  60. package/dist/cli/initial-message.d.ts +0 -18
  61. package/dist/cli/initial-message.d.ts.map +0 -1
  62. package/dist/cli/initial-message.js +0 -22
  63. package/dist/cli/initial-message.js.map +0 -1
  64. package/dist/cli/list-models.d.ts +0 -9
  65. package/dist/cli/list-models.d.ts.map +0 -1
  66. package/dist/cli/list-models.js +0 -98
  67. package/dist/cli/list-models.js.map +0 -1
  68. package/dist/cli/project-trust.d.ts +0 -10
  69. package/dist/cli/project-trust.d.ts.map +0 -1
  70. package/dist/cli/project-trust.js +0 -48
  71. package/dist/cli/project-trust.js.map +0 -1
  72. package/dist/cli/session-picker.d.ts +0 -10
  73. package/dist/cli/session-picker.d.ts.map +0 -1
  74. package/dist/cli/session-picker.js +0 -36
  75. package/dist/cli/session-picker.js.map +0 -1
  76. package/dist/cli/setup.d.ts +0 -2
  77. package/dist/cli/setup.d.ts.map +0 -1
  78. package/dist/cli/setup.js +0 -12
  79. package/dist/cli/setup.js.map +0 -1
  80. package/dist/cli/startup-ui.d.ts +0 -20
  81. package/dist/cli/startup-ui.d.ts.map +0 -1
  82. package/dist/cli/startup-ui.js +0 -193
  83. package/dist/cli/startup-ui.js.map +0 -1
  84. package/dist/cli.d.ts +0 -3
  85. package/dist/cli.d.ts.map +0 -1
  86. package/dist/cli.js +0 -6
  87. package/dist/cli.js.map +0 -1
  88. package/dist/config.d.ts +0 -107
  89. package/dist/config.d.ts.map +0 -1
  90. package/dist/config.js +0 -486
  91. package/dist/config.js.map +0 -1
  92. package/dist/core/agent-session-runtime.d.ts +0 -119
  93. package/dist/core/agent-session-runtime.d.ts.map +0 -1
  94. package/dist/core/agent-session-runtime.js +0 -317
  95. package/dist/core/agent-session-runtime.js.map +0 -1
  96. package/dist/core/agent-session-services.d.ts +0 -86
  97. package/dist/core/agent-session-services.d.ts.map +0 -1
  98. package/dist/core/agent-session-services.js +0 -147
  99. package/dist/core/agent-session-services.js.map +0 -1
  100. package/dist/core/agent-session.d.ts +0 -859
  101. package/dist/core/agent-session.d.ts.map +0 -1
  102. package/dist/core/agent-session.js +0 -3416
  103. package/dist/core/agent-session.js.map +0 -1
  104. package/dist/core/auth-guidance.d.ts +0 -5
  105. package/dist/core/auth-guidance.d.ts.map +0 -1
  106. package/dist/core/auth-guidance.js +0 -21
  107. package/dist/core/auth-guidance.js.map +0 -1
  108. package/dist/core/auth-storage.d.ts +0 -72
  109. package/dist/core/auth-storage.d.ts.map +0 -1
  110. package/dist/core/auth-storage.js +0 -426
  111. package/dist/core/auth-storage.js.map +0 -1
  112. package/dist/core/bash-executor.d.ts +0 -32
  113. package/dist/core/bash-executor.d.ts.map +0 -1
  114. package/dist/core/bash-executor.js +0 -106
  115. package/dist/core/bash-executor.js.map +0 -1
  116. package/dist/core/bug-report-upload.d.ts +0 -12
  117. package/dist/core/bug-report-upload.d.ts.map +0 -1
  118. package/dist/core/bug-report-upload.js +0 -22
  119. package/dist/core/bug-report-upload.js.map +0 -1
  120. package/dist/core/bug-report.d.ts +0 -176
  121. package/dist/core/bug-report.d.ts.map +0 -1
  122. package/dist/core/bug-report.js +0 -292
  123. package/dist/core/bug-report.js.map +0 -1
  124. package/dist/core/cache-stats.d.ts +0 -49
  125. package/dist/core/cache-stats.d.ts.map +0 -1
  126. package/dist/core/cache-stats.js +0 -112
  127. package/dist/core/cache-stats.js.map +0 -1
  128. package/dist/core/cache-warmer.d.ts +0 -103
  129. package/dist/core/cache-warmer.d.ts.map +0 -1
  130. package/dist/core/cache-warmer.js +0 -359
  131. package/dist/core/cache-warmer.js.map +0 -1
  132. package/dist/core/compaction/branch-summarization.d.ts +0 -98
  133. package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  134. package/dist/core/compaction/branch-summarization.js +0 -251
  135. package/dist/core/compaction/branch-summarization.js.map +0 -1
  136. package/dist/core/compaction/compaction.d.ts +0 -145
  137. package/dist/core/compaction/compaction.d.ts.map +0 -1
  138. package/dist/core/compaction/compaction.js +0 -744
  139. package/dist/core/compaction/compaction.js.map +0 -1
  140. package/dist/core/compaction/index.d.ts +0 -7
  141. package/dist/core/compaction/index.d.ts.map +0 -1
  142. package/dist/core/compaction/index.js +0 -7
  143. package/dist/core/compaction/index.js.map +0 -1
  144. package/dist/core/compaction/utils.d.ts +0 -39
  145. package/dist/core/compaction/utils.d.ts.map +0 -1
  146. package/dist/core/compaction/utils.js +0 -149
  147. package/dist/core/compaction/utils.js.map +0 -1
  148. package/dist/core/crash-log.d.ts +0 -27
  149. package/dist/core/crash-log.d.ts.map +0 -1
  150. package/dist/core/crash-log.js +0 -140
  151. package/dist/core/crash-log.js.map +0 -1
  152. package/dist/core/defaults.d.ts +0 -4
  153. package/dist/core/defaults.d.ts.map +0 -1
  154. package/dist/core/defaults.js +0 -11
  155. package/dist/core/defaults.js.map +0 -1
  156. package/dist/core/diagnostics.d.ts +0 -15
  157. package/dist/core/diagnostics.d.ts.map +0 -1
  158. package/dist/core/diagnostics.js +0 -2
  159. package/dist/core/diagnostics.js.map +0 -1
  160. package/dist/core/event-bus.d.ts +0 -9
  161. package/dist/core/event-bus.d.ts.map +0 -1
  162. package/dist/core/event-bus.js +0 -25
  163. package/dist/core/event-bus.js.map +0 -1
  164. package/dist/core/exec.d.ts +0 -29
  165. package/dist/core/exec.d.ts.map +0 -1
  166. package/dist/core/exec.js +0 -75
  167. package/dist/core/exec.js.map +0 -1
  168. package/dist/core/experimental.d.ts +0 -2
  169. package/dist/core/experimental.d.ts.map +0 -1
  170. package/dist/core/experimental.js +0 -6
  171. package/dist/core/experimental.js.map +0 -1
  172. package/dist/core/export-html/ansi-to-html.d.ts +0 -22
  173. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  174. package/dist/core/export-html/ansi-to-html.js +0 -249
  175. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  176. package/dist/core/export-html/index.d.ts +0 -37
  177. package/dist/core/export-html/index.d.ts.map +0 -1
  178. package/dist/core/export-html/index.js +0 -226
  179. package/dist/core/export-html/index.js.map +0 -1
  180. package/dist/core/export-html/tool-renderer.d.ts +0 -34
  181. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  182. package/dist/core/export-html/tool-renderer.js +0 -109
  183. package/dist/core/export-html/tool-renderer.js.map +0 -1
  184. package/dist/core/extensions/compat-check.d.ts +0 -26
  185. package/dist/core/extensions/compat-check.d.ts.map +0 -1
  186. package/dist/core/extensions/compat-check.js +0 -129
  187. package/dist/core/extensions/compat-check.js.map +0 -1
  188. package/dist/core/extensions/index.d.ts +0 -12
  189. package/dist/core/extensions/index.d.ts.map +0 -1
  190. package/dist/core/extensions/index.js +0 -9
  191. package/dist/core/extensions/index.js.map +0 -1
  192. package/dist/core/extensions/jiti-loader.d.ts +0 -2
  193. package/dist/core/extensions/jiti-loader.d.ts.map +0 -1
  194. package/dist/core/extensions/jiti-loader.js +0 -4
  195. package/dist/core/extensions/jiti-loader.js.map +0 -1
  196. package/dist/core/extensions/jiti-static-loader.d.ts +0 -2
  197. package/dist/core/extensions/jiti-static-loader.d.ts.map +0 -1
  198. package/dist/core/extensions/jiti-static-loader.js +0 -4
  199. package/dist/core/extensions/jiti-static-loader.js.map +0 -1
  200. package/dist/core/extensions/loader.d.ts +0 -23
  201. package/dist/core/extensions/loader.d.ts.map +0 -1
  202. package/dist/core/extensions/loader.js +0 -689
  203. package/dist/core/extensions/loader.js.map +0 -1
  204. package/dist/core/extensions/runner.d.ts +0 -204
  205. package/dist/core/extensions/runner.d.ts.map +0 -1
  206. package/dist/core/extensions/runner.js +0 -1207
  207. package/dist/core/extensions/runner.js.map +0 -1
  208. package/dist/core/extensions/types.d.ts +0 -1623
  209. package/dist/core/extensions/types.d.ts.map +0 -1
  210. package/dist/core/extensions/types.js +0 -48
  211. package/dist/core/extensions/types.js.map +0 -1
  212. package/dist/core/extensions/virtual-modules.d.ts +0 -3
  213. package/dist/core/extensions/virtual-modules.d.ts.map +0 -1
  214. package/dist/core/extensions/virtual-modules.js +0 -38
  215. package/dist/core/extensions/virtual-modules.js.map +0 -1
  216. package/dist/core/extensions/wrapper.d.ts +0 -20
  217. package/dist/core/extensions/wrapper.d.ts.map +0 -1
  218. package/dist/core/extensions/wrapper.js +0 -22
  219. package/dist/core/extensions/wrapper.js.map +0 -1
  220. package/dist/core/footer-data-provider.d.ts +0 -64
  221. package/dist/core/footer-data-provider.d.ts.map +0 -1
  222. package/dist/core/footer-data-provider.js +0 -338
  223. package/dist/core/footer-data-provider.js.map +0 -1
  224. package/dist/core/http-dispatcher.d.ts +0 -22
  225. package/dist/core/http-dispatcher.d.ts.map +0 -1
  226. package/dist/core/http-dispatcher.js +0 -98
  227. package/dist/core/http-dispatcher.js.map +0 -1
  228. package/dist/core/index.d.ts +0 -14
  229. package/dist/core/index.d.ts.map +0 -1
  230. package/dist/core/index.js +0 -13
  231. package/dist/core/index.js.map +0 -1
  232. package/dist/core/keybindings.d.ts +0 -428
  233. package/dist/core/keybindings.d.ts.map +0 -1
  234. package/dist/core/keybindings.js +0 -321
  235. package/dist/core/keybindings.js.map +0 -1
  236. package/dist/core/messages.d.ts +0 -77
  237. package/dist/core/messages.d.ts.map +0 -1
  238. package/dist/core/messages.js +0 -124
  239. package/dist/core/messages.js.map +0 -1
  240. package/dist/core/model-config.d.ts +0 -760
  241. package/dist/core/model-config.d.ts.map +0 -1
  242. package/dist/core/model-config.js +0 -294
  243. package/dist/core/model-config.js.map +0 -1
  244. package/dist/core/model-registry.d.ts +0 -61
  245. package/dist/core/model-registry.d.ts.map +0 -1
  246. package/dist/core/model-registry.js +0 -140
  247. package/dist/core/model-registry.js.map +0 -1
  248. package/dist/core/model-resolver.d.ts +0 -124
  249. package/dist/core/model-resolver.d.ts.map +0 -1
  250. package/dist/core/model-resolver.js +0 -590
  251. package/dist/core/model-resolver.js.map +0 -1
  252. package/dist/core/model-runtime.d.ts +0 -145
  253. package/dist/core/model-runtime.d.ts.map +0 -1
  254. package/dist/core/model-runtime.js +0 -758
  255. package/dist/core/model-runtime.js.map +0 -1
  256. package/dist/core/models-store.d.ts +0 -22
  257. package/dist/core/models-store.d.ts.map +0 -1
  258. package/dist/core/models-store.js +0 -115
  259. package/dist/core/models-store.js.map +0 -1
  260. package/dist/core/nested-tool-calls.d.ts +0 -102
  261. package/dist/core/nested-tool-calls.d.ts.map +0 -1
  262. package/dist/core/nested-tool-calls.js +0 -178
  263. package/dist/core/nested-tool-calls.js.map +0 -1
  264. package/dist/core/output-guard.d.ts +0 -7
  265. package/dist/core/output-guard.d.ts.map +0 -1
  266. package/dist/core/output-guard.js +0 -89
  267. package/dist/core/output-guard.js.map +0 -1
  268. package/dist/core/package-manager.d.ts +0 -222
  269. package/dist/core/package-manager.d.ts.map +0 -1
  270. package/dist/core/package-manager.js +0 -2258
  271. package/dist/core/package-manager.js.map +0 -1
  272. package/dist/core/pi-manifest.d.ts +0 -8
  273. package/dist/core/pi-manifest.d.ts.map +0 -1
  274. package/dist/core/pi-manifest.js +0 -26
  275. package/dist/core/pi-manifest.js.map +0 -1
  276. package/dist/core/project-trust.d.ts +0 -15
  277. package/dist/core/project-trust.d.ts.map +0 -1
  278. package/dist/core/project-trust.js +0 -59
  279. package/dist/core/project-trust.js.map +0 -1
  280. package/dist/core/prompt-templates.d.ts +0 -59
  281. package/dist/core/prompt-templates.d.ts.map +0 -1
  282. package/dist/core/prompt-templates.js +0 -262
  283. package/dist/core/prompt-templates.js.map +0 -1
  284. package/dist/core/provider-attribution.d.ts +0 -4
  285. package/dist/core/provider-attribution.d.ts.map +0 -1
  286. package/dist/core/provider-attribution.js +0 -72
  287. package/dist/core/provider-attribution.js.map +0 -1
  288. package/dist/core/provider-composer.d.ts +0 -80
  289. package/dist/core/provider-composer.d.ts.map +0 -1
  290. package/dist/core/provider-composer.js +0 -488
  291. package/dist/core/provider-composer.js.map +0 -1
  292. package/dist/core/radius.d.ts +0 -5
  293. package/dist/core/radius.d.ts.map +0 -1
  294. package/dist/core/radius.js +0 -9
  295. package/dist/core/radius.js.map +0 -1
  296. package/dist/core/remote-catalog-provider.d.ts +0 -12
  297. package/dist/core/remote-catalog-provider.d.ts.map +0 -1
  298. package/dist/core/remote-catalog-provider.js +0 -132
  299. package/dist/core/remote-catalog-provider.js.map +0 -1
  300. package/dist/core/resolve-config-value.d.ts +0 -30
  301. package/dist/core/resolve-config-value.d.ts.map +0 -1
  302. package/dist/core/resolve-config-value.js +0 -247
  303. package/dist/core/resolve-config-value.js.map +0 -1
  304. package/dist/core/resource-loader.d.ts +0 -227
  305. package/dist/core/resource-loader.d.ts.map +0 -1
  306. package/dist/core/resource-loader.js +0 -1008
  307. package/dist/core/resource-loader.js.map +0 -1
  308. package/dist/core/runtime-credentials.d.ts +0 -15
  309. package/dist/core/runtime-credentials.d.ts.map +0 -1
  310. package/dist/core/runtime-credentials.js +0 -39
  311. package/dist/core/runtime-credentials.js.map +0 -1
  312. package/dist/core/sdk.d.ts +0 -108
  313. package/dist/core/sdk.d.ts.map +0 -1
  314. package/dist/core/sdk.js +0 -315
  315. package/dist/core/sdk.js.map +0 -1
  316. package/dist/core/session-cwd.d.ts +0 -19
  317. package/dist/core/session-cwd.d.ts.map +0 -1
  318. package/dist/core/session-cwd.js +0 -38
  319. package/dist/core/session-cwd.js.map +0 -1
  320. package/dist/core/session-export.d.ts +0 -8
  321. package/dist/core/session-export.d.ts.map +0 -1
  322. package/dist/core/session-export.js +0 -33
  323. package/dist/core/session-export.js.map +0 -1
  324. package/dist/core/session-manager.d.ts +0 -416
  325. package/dist/core/session-manager.d.ts.map +0 -1
  326. package/dist/core/session-manager.js +0 -1537
  327. package/dist/core/session-manager.js.map +0 -1
  328. package/dist/core/settings-diagnostics.d.ts +0 -9
  329. package/dist/core/settings-diagnostics.d.ts.map +0 -1
  330. package/dist/core/settings-diagnostics.js +0 -21
  331. package/dist/core/settings-diagnostics.js.map +0 -1
  332. package/dist/core/settings-manager.d.ts +0 -362
  333. package/dist/core/settings-manager.d.ts.map +0 -1
  334. package/dist/core/settings-manager.js +0 -1107
  335. package/dist/core/settings-manager.js.map +0 -1
  336. package/dist/core/skills.d.ts +0 -60
  337. package/dist/core/skills.d.ts.map +0 -1
  338. package/dist/core/skills.js +0 -407
  339. package/dist/core/skills.js.map +0 -1
  340. package/dist/core/slash-commands.d.ts +0 -15
  341. package/dist/core/slash-commands.d.ts.map +0 -1
  342. package/dist/core/slash-commands.js +0 -28
  343. package/dist/core/slash-commands.js.map +0 -1
  344. package/dist/core/source-info.d.ts +0 -26
  345. package/dist/core/source-info.d.ts.map +0 -1
  346. package/dist/core/source-info.js +0 -35
  347. package/dist/core/source-info.js.map +0 -1
  348. package/dist/core/system-prompt.d.ts +0 -71
  349. package/dist/core/system-prompt.d.ts.map +0 -1
  350. package/dist/core/system-prompt.js +0 -147
  351. package/dist/core/system-prompt.js.map +0 -1
  352. package/dist/core/telemetry.d.ts +0 -3
  353. package/dist/core/telemetry.d.ts.map +0 -1
  354. package/dist/core/telemetry.js +0 -10
  355. package/dist/core/telemetry.js.map +0 -1
  356. package/dist/core/timings.d.ts +0 -6
  357. package/dist/core/timings.d.ts.map +0 -1
  358. package/dist/core/timings.js +0 -42
  359. package/dist/core/timings.js.map +0 -1
  360. package/dist/core/tools/bash.d.ts +0 -101
  361. package/dist/core/tools/bash.d.ts.map +0 -1
  362. package/dist/core/tools/bash.js +0 -348
  363. package/dist/core/tools/bash.js.map +0 -1
  364. package/dist/core/tools/edit-diff.d.ts +0 -101
  365. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  366. package/dist/core/tools/edit-diff.js +0 -421
  367. package/dist/core/tools/edit-diff.js.map +0 -1
  368. package/dist/core/tools/edit.d.ts +0 -44
  369. package/dist/core/tools/edit.d.ts.map +0 -1
  370. package/dist/core/tools/edit.js +0 -147
  371. package/dist/core/tools/edit.js.map +0 -1
  372. package/dist/core/tools/file-mutation-queue.d.ts +0 -6
  373. package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  374. package/dist/core/tools/file-mutation-queue.js +0 -52
  375. package/dist/core/tools/file-mutation-queue.js.map +0 -1
  376. package/dist/core/tools/find.d.ts +0 -42
  377. package/dist/core/tools/find.d.ts.map +0 -1
  378. package/dist/core/tools/find.js +0 -251
  379. package/dist/core/tools/find.js.map +0 -1
  380. package/dist/core/tools/grep.d.ts +0 -41
  381. package/dist/core/tools/grep.d.ts.map +0 -1
  382. package/dist/core/tools/grep.js +0 -252
  383. package/dist/core/tools/grep.js.map +0 -1
  384. package/dist/core/tools/index.d.ts +0 -43
  385. package/dist/core/tools/index.d.ts.map +0 -1
  386. package/dist/core/tools/index.js +0 -129
  387. package/dist/core/tools/index.js.map +0 -1
  388. package/dist/core/tools/ls.d.ts +0 -41
  389. package/dist/core/tools/ls.d.ts.map +0 -1
  390. package/dist/core/tools/ls.js +0 -126
  391. package/dist/core/tools/ls.js.map +0 -1
  392. package/dist/core/tools/output-accumulator.d.ts +0 -63
  393. package/dist/core/tools/output-accumulator.d.ts.map +0 -1
  394. package/dist/core/tools/output-accumulator.js +0 -220
  395. package/dist/core/tools/output-accumulator.js.map +0 -1
  396. package/dist/core/tools/path-utils.d.ts +0 -10
  397. package/dist/core/tools/path-utils.d.ts.map +0 -1
  398. package/dist/core/tools/path-utils.js +0 -99
  399. package/dist/core/tools/path-utils.js.map +0 -1
  400. package/dist/core/tools/powershell.d.ts +0 -16
  401. package/dist/core/tools/powershell.d.ts.map +0 -1
  402. package/dist/core/tools/powershell.js +0 -39
  403. package/dist/core/tools/powershell.js.map +0 -1
  404. package/dist/core/tools/read.d.ts +0 -42
  405. package/dist/core/tools/read.d.ts.map +0 -1
  406. package/dist/core/tools/read.js +0 -169
  407. package/dist/core/tools/read.js.map +0 -1
  408. package/dist/core/tools/render-utils.d.ts +0 -30
  409. package/dist/core/tools/render-utils.d.ts.map +0 -1
  410. package/dist/core/tools/render-utils.js +0 -91
  411. package/dist/core/tools/render-utils.js.map +0 -1
  412. package/dist/core/tools/renderers/bash.d.ts +0 -12
  413. package/dist/core/tools/renderers/bash.d.ts.map +0 -1
  414. package/dist/core/tools/renderers/bash.js +0 -117
  415. package/dist/core/tools/renderers/bash.js.map +0 -1
  416. package/dist/core/tools/renderers/edit.d.ts +0 -23
  417. package/dist/core/tools/renderers/edit.d.ts.map +0 -1
  418. package/dist/core/tools/renderers/edit.js +0 -168
  419. package/dist/core/tools/renderers/edit.js.map +0 -1
  420. package/dist/core/tools/renderers/find.d.ts +0 -10
  421. package/dist/core/tools/renderers/find.d.ts.map +0 -1
  422. package/dist/core/tools/renderers/find.js +0 -64
  423. package/dist/core/tools/renderers/find.js.map +0 -1
  424. package/dist/core/tools/renderers/grep.d.ts +0 -10
  425. package/dist/core/tools/renderers/grep.d.ts.map +0 -1
  426. package/dist/core/tools/renderers/grep.js +0 -69
  427. package/dist/core/tools/renderers/grep.js.map +0 -1
  428. package/dist/core/tools/renderers/index.d.ts +0 -28
  429. package/dist/core/tools/renderers/index.d.ts.map +0 -1
  430. package/dist/core/tools/renderers/index.js +0 -47
  431. package/dist/core/tools/renderers/index.js.map +0 -1
  432. package/dist/core/tools/renderers/ls.d.ts +0 -10
  433. package/dist/core/tools/renderers/ls.d.ts.map +0 -1
  434. package/dist/core/tools/renderers/ls.js +0 -58
  435. package/dist/core/tools/renderers/ls.js.map +0 -1
  436. package/dist/core/tools/renderers/read.d.ts +0 -11
  437. package/dist/core/tools/renderers/read.d.ts.map +0 -1
  438. package/dist/core/tools/renderers/read.js +0 -130
  439. package/dist/core/tools/renderers/read.js.map +0 -1
  440. package/dist/core/tools/renderers/write.d.ts +0 -10
  441. package/dist/core/tools/renderers/write.d.ts.map +0 -1
  442. package/dist/core/tools/renderers/write.js +0 -153
  443. package/dist/core/tools/renderers/write.js.map +0 -1
  444. package/dist/core/tools/tool-definition-wrapper.d.ts +0 -16
  445. package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  446. package/dist/core/tools/tool-definition-wrapper.js +0 -38
  447. package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  448. package/dist/core/tools/truncate.d.ts +0 -84
  449. package/dist/core/tools/truncate.d.ts.map +0 -1
  450. package/dist/core/tools/truncate.js +0 -244
  451. package/dist/core/tools/truncate.js.map +0 -1
  452. package/dist/core/tools/write.d.ts +0 -30
  453. package/dist/core/tools/write.d.ts.map +0 -1
  454. package/dist/core/tools/write.js +0 -61
  455. package/dist/core/tools/write.js.map +0 -1
  456. package/dist/core/trust-manager.d.ts +0 -36
  457. package/dist/core/trust-manager.d.ts.map +0 -1
  458. package/dist/core/trust-manager.js +0 -203
  459. package/dist/core/trust-manager.js.map +0 -1
  460. package/dist/core/usage-totals.d.ts +0 -21
  461. package/dist/core/usage-totals.d.ts.map +0 -1
  462. package/dist/core/usage-totals.js +0 -79
  463. package/dist/core/usage-totals.js.map +0 -1
  464. package/dist/core/virtual-models.d.ts +0 -117
  465. package/dist/core/virtual-models.d.ts.map +0 -1
  466. package/dist/core/virtual-models.js +0 -124
  467. package/dist/core/virtual-models.js.map +0 -1
  468. package/dist/extensions/index.d.ts +0 -3
  469. package/dist/extensions/index.d.ts.map +0 -1
  470. package/dist/extensions/index.js +0 -3
  471. package/dist/extensions/index.js.map +0 -1
  472. package/dist/extensions/llama/client.d.ts +0 -69
  473. package/dist/extensions/llama/client.d.ts.map +0 -1
  474. package/dist/extensions/llama/client.js +0 -313
  475. package/dist/extensions/llama/client.js.map +0 -1
  476. package/dist/extensions/llama/huggingface.d.ts +0 -23
  477. package/dist/extensions/llama/huggingface.d.ts.map +0 -1
  478. package/dist/extensions/llama/huggingface.js +0 -141
  479. package/dist/extensions/llama/huggingface.js.map +0 -1
  480. package/dist/extensions/llama/index.d.ts +0 -3
  481. package/dist/extensions/llama/index.d.ts.map +0 -1
  482. package/dist/extensions/llama/index.js +0 -219
  483. package/dist/extensions/llama/index.js.map +0 -1
  484. package/dist/extensions/llama/provider.d.ts +0 -12
  485. package/dist/extensions/llama/provider.d.ts.map +0 -1
  486. package/dist/extensions/llama/provider.js +0 -213
  487. package/dist/extensions/llama/provider.js.map +0 -1
  488. package/dist/extensions/llama/ui.d.ts +0 -42
  489. package/dist/extensions/llama/ui.d.ts.map +0 -1
  490. package/dist/extensions/llama/ui.js +0 -416
  491. package/dist/extensions/llama/ui.js.map +0 -1
  492. package/dist/index.d.ts +0 -38
  493. package/dist/index.d.ts.map +0 -1
  494. package/dist/index.js +0 -49
  495. package/dist/index.js.map +0 -1
  496. package/dist/main.d.ts +0 -16
  497. package/dist/main.d.ts.map +0 -1
  498. package/dist/main.js +0 -819
  499. package/dist/main.js.map +0 -1
  500. package/dist/migrations.d.ts +0 -33
  501. package/dist/migrations.d.ts.map +0 -1
  502. package/dist/migrations.js +0 -282
  503. package/dist/migrations.js.map +0 -1
  504. package/dist/modes/index.d.ts +0 -10
  505. package/dist/modes/index.d.ts.map +0 -1
  506. package/dist/modes/index.js +0 -8
  507. package/dist/modes/index.js.map +0 -1
  508. package/dist/modes/interactive/bug-report.d.ts +0 -16
  509. package/dist/modes/interactive/bug-report.d.ts.map +0 -1
  510. package/dist/modes/interactive/bug-report.js +0 -210
  511. package/dist/modes/interactive/bug-report.js.map +0 -1
  512. package/dist/modes/interactive/chat-viewport.d.ts +0 -20
  513. package/dist/modes/interactive/chat-viewport.d.ts.map +0 -1
  514. package/dist/modes/interactive/chat-viewport.js +0 -28
  515. package/dist/modes/interactive/chat-viewport.js.map +0 -1
  516. package/dist/modes/interactive/components/armin.d.ts +0 -37
  517. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  518. package/dist/modes/interactive/components/armin.js +0 -335
  519. package/dist/modes/interactive/components/armin.js.map +0 -1
  520. package/dist/modes/interactive/components/assistant-message.d.ts +0 -26
  521. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  522. package/dist/modes/interactive/components/assistant-message.js +0 -158
  523. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  524. package/dist/modes/interactive/components/bash-execution.d.ts +0 -38
  525. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  526. package/dist/modes/interactive/components/bash-execution.js +0 -178
  527. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  528. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  529. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  530. package/dist/modes/interactive/components/bordered-loader.js +0 -54
  531. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  532. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -17
  533. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  534. package/dist/modes/interactive/components/branch-summary-message.js +0 -54
  535. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  536. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -17
  537. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  538. package/dist/modes/interactive/components/compaction-summary-message.js +0 -55
  539. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  540. package/dist/modes/interactive/components/config-selector.d.ts +0 -102
  541. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  542. package/dist/modes/interactive/components/config-selector.js +0 -771
  543. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  544. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
  545. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  546. package/dist/modes/interactive/components/countdown-timer.js +0 -33
  547. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  548. package/dist/modes/interactive/components/custom-editor.d.ts +0 -30
  549. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  550. package/dist/modes/interactive/components/custom-editor.js +0 -115
  551. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  552. package/dist/modes/interactive/components/custom-entry.d.ts +0 -21
  553. package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
  554. package/dist/modes/interactive/components/custom-entry.js +0 -58
  555. package/dist/modes/interactive/components/custom-entry.js.map +0 -1
  556. package/dist/modes/interactive/components/custom-message.d.ts +0 -22
  557. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  558. package/dist/modes/interactive/components/custom-message.js +0 -88
  559. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  560. package/dist/modes/interactive/components/diff.d.ts +0 -12
  561. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  562. package/dist/modes/interactive/components/diff.js +0 -133
  563. package/dist/modes/interactive/components/diff.js.map +0 -1
  564. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
  565. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  566. package/dist/modes/interactive/components/dynamic-border.js +0 -21
  567. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  568. package/dist/modes/interactive/components/e-logo.d.ts +0 -16
  569. package/dist/modes/interactive/components/e-logo.d.ts.map +0 -1
  570. package/dist/modes/interactive/components/e-logo.js +0 -29
  571. package/dist/modes/interactive/components/e-logo.js.map +0 -1
  572. package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -5
  573. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
  574. package/dist/modes/interactive/components/earendil-announcement.js +0 -40
  575. package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
  576. package/dist/modes/interactive/components/easter-egg-3d.d.ts +0 -104
  577. package/dist/modes/interactive/components/easter-egg-3d.d.ts.map +0 -1
  578. package/dist/modes/interactive/components/easter-egg-3d.js +0 -1138
  579. package/dist/modes/interactive/components/easter-egg-3d.js.map +0 -1
  580. package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts +0 -6
  581. package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts.map +0 -1
  582. package/dist/modes/interactive/components/easter-egg-3d.lazy.js +0 -23
  583. package/dist/modes/interactive/components/easter-egg-3d.lazy.js.map +0 -1
  584. package/dist/modes/interactive/components/extension-editor.d.ts +0 -24
  585. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  586. package/dist/modes/interactive/components/extension-editor.js +0 -103
  587. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  588. package/dist/modes/interactive/components/extension-input.d.ts +0 -25
  589. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  590. package/dist/modes/interactive/components/extension-input.js +0 -67
  591. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  592. package/dist/modes/interactive/components/extension-selector.d.ts +0 -27
  593. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  594. package/dist/modes/interactive/components/extension-selector.js +0 -87
  595. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  596. package/dist/modes/interactive/components/first-time-setup.d.ts +0 -25
  597. package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
  598. package/dist/modes/interactive/components/first-time-setup.js +0 -109
  599. package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
  600. package/dist/modes/interactive/components/footer.d.ts +0 -39
  601. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  602. package/dist/modes/interactive/components/footer.js +0 -265
  603. package/dist/modes/interactive/components/footer.js.map +0 -1
  604. package/dist/modes/interactive/components/index.d.ts +0 -33
  605. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  606. package/dist/modes/interactive/components/index.js +0 -34
  607. package/dist/modes/interactive/components/index.js.map +0 -1
  608. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -13
  609. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  610. package/dist/modes/interactive/components/keybinding-hints.js +0 -36
  611. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  612. package/dist/modes/interactive/components/login-dialog.d.ts +0 -52
  613. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  614. package/dist/modes/interactive/components/login-dialog.js +0 -188
  615. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  616. package/dist/modes/interactive/components/markdown-transform.d.ts +0 -3
  617. package/dist/modes/interactive/components/markdown-transform.d.ts.map +0 -1
  618. package/dist/modes/interactive/components/markdown-transform.js +0 -19
  619. package/dist/modes/interactive/components/markdown-transform.js.map +0 -1
  620. package/dist/modes/interactive/components/mermaid.d.ts +0 -11
  621. package/dist/modes/interactive/components/mermaid.d.ts.map +0 -1
  622. package/dist/modes/interactive/components/mermaid.js +0 -75
  623. package/dist/modes/interactive/components/mermaid.js.map +0 -1
  624. package/dist/modes/interactive/components/model-selector.d.ts +0 -60
  625. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  626. package/dist/modes/interactive/components/model-selector.js +0 -361
  627. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  628. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -33
  629. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  630. package/dist/modes/interactive/components/oauth-selector.js +0 -163
  631. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  632. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -46
  633. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  634. package/dist/modes/interactive/components/scoped-models-selector.js +0 -326
  635. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  636. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
  637. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  638. package/dist/modes/interactive/components/session-selector-search.js +0 -155
  639. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  640. package/dist/modes/interactive/components/session-selector.d.ts +0 -95
  641. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  642. package/dist/modes/interactive/components/session-selector.js +0 -893
  643. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  644. package/dist/modes/interactive/components/settings-selector.d.ts +0 -96
  645. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  646. package/dist/modes/interactive/components/settings-selector.js +0 -742
  647. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  648. package/dist/modes/interactive/components/settings-submenu.d.ts +0 -72
  649. package/dist/modes/interactive/components/settings-submenu.d.ts.map +0 -1
  650. package/dist/modes/interactive/components/settings-submenu.js +0 -165
  651. package/dist/modes/interactive/components/settings-submenu.js.map +0 -1
  652. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  653. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  654. package/dist/modes/interactive/components/show-images-selector.js +0 -39
  655. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  656. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -18
  657. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  658. package/dist/modes/interactive/components/skill-invocation-message.js +0 -57
  659. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  660. package/dist/modes/interactive/components/status-indicator.d.ts +0 -30
  661. package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
  662. package/dist/modes/interactive/components/status-indicator.js +0 -67
  663. package/dist/modes/interactive/components/status-indicator.js.map +0 -1
  664. package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  665. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  666. package/dist/modes/interactive/components/theme-selector.js +0 -50
  667. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  668. package/dist/modes/interactive/components/themed-text.d.ts +0 -17
  669. package/dist/modes/interactive/components/themed-text.d.ts.map +0 -1
  670. package/dist/modes/interactive/components/themed-text.js +0 -29
  671. package/dist/modes/interactive/components/themed-text.js.map +0 -1
  672. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -23
  673. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  674. package/dist/modes/interactive/components/thinking-selector.js +0 -109
  675. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  676. package/dist/modes/interactive/components/tool-execution.d.ts +0 -83
  677. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  678. package/dist/modes/interactive/components/tool-execution.js +0 -323
  679. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  680. package/dist/modes/interactive/components/tree-selector.d.ts +0 -94
  681. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  682. package/dist/modes/interactive/components/tree-selector.js +0 -1254
  683. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  684. package/dist/modes/interactive/components/trust-selector.d.ts +0 -23
  685. package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
  686. package/dist/modes/interactive/components/trust-selector.js +0 -91
  687. package/dist/modes/interactive/components/trust-selector.js.map +0 -1
  688. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  689. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  690. package/dist/modes/interactive/components/user-message-selector.js +0 -114
  691. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  692. package/dist/modes/interactive/components/user-message.d.ts +0 -16
  693. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  694. package/dist/modes/interactive/components/user-message.js +0 -50
  695. package/dist/modes/interactive/components/user-message.js.map +0 -1
  696. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -48
  697. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  698. package/dist/modes/interactive/components/visual-truncate.js +0 -66
  699. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  700. package/dist/modes/interactive/external-editor.d.ts +0 -12
  701. package/dist/modes/interactive/external-editor.d.ts.map +0 -1
  702. package/dist/modes/interactive/external-editor.js +0 -38
  703. package/dist/modes/interactive/external-editor.js.map +0 -1
  704. package/dist/modes/interactive/interactive-mode.d.ts +0 -470
  705. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  706. package/dist/modes/interactive/interactive-mode.js +0 -5795
  707. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  708. package/dist/modes/interactive/model-catalog-refresh.d.ts +0 -7
  709. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
  710. package/dist/modes/interactive/model-catalog-refresh.js +0 -34
  711. package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
  712. package/dist/modes/interactive/model-search.d.ts +0 -12
  713. package/dist/modes/interactive/model-search.d.ts.map +0 -1
  714. package/dist/modes/interactive/model-search.js +0 -15
  715. package/dist/modes/interactive/model-search.js.map +0 -1
  716. package/dist/modes/interactive/session-share.d.ts +0 -18
  717. package/dist/modes/interactive/session-share.d.ts.map +0 -1
  718. package/dist/modes/interactive/session-share.js +0 -188
  719. package/dist/modes/interactive/session-share.js.map +0 -1
  720. package/dist/modes/interactive/theme/system-theme.d.ts +0 -55
  721. package/dist/modes/interactive/theme/system-theme.d.ts.map +0 -1
  722. package/dist/modes/interactive/theme/system-theme.js +0 -546
  723. package/dist/modes/interactive/theme/system-theme.js.map +0 -1
  724. package/dist/modes/interactive/theme/theme-controller.d.ts +0 -81
  725. package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
  726. package/dist/modes/interactive/theme/theme-controller.js +0 -210
  727. package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
  728. package/dist/modes/interactive/theme/theme-json.d.ts +0 -85
  729. package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
  730. package/dist/modes/interactive/theme/theme-json.js +0 -132
  731. package/dist/modes/interactive/theme/theme-json.js.map +0 -1
  732. package/dist/modes/interactive/theme/theme.d.ts +0 -158
  733. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  734. package/dist/modes/interactive/theme/theme.js +0 -913
  735. package/dist/modes/interactive/theme/theme.js.map +0 -1
  736. package/dist/modes/interactive/tui-renderer.d.ts +0 -22
  737. package/dist/modes/interactive/tui-renderer.d.ts.map +0 -1
  738. package/dist/modes/interactive/tui-renderer.js +0 -67
  739. package/dist/modes/interactive/tui-renderer.js.map +0 -1
  740. package/dist/modes/json-event.d.ts +0 -34
  741. package/dist/modes/json-event.d.ts.map +0 -1
  742. package/dist/modes/json-event.js +0 -29
  743. package/dist/modes/json-event.js.map +0 -1
  744. package/dist/modes/print-mode.d.ts +0 -28
  745. package/dist/modes/print-mode.d.ts.map +0 -1
  746. package/dist/modes/print-mode.js +0 -142
  747. package/dist/modes/print-mode.js.map +0 -1
  748. package/dist/modes/rpc/jsonl.d.ts +0 -17
  749. package/dist/modes/rpc/jsonl.d.ts.map +0 -1
  750. package/dist/modes/rpc/jsonl.js +0 -49
  751. package/dist/modes/rpc/jsonl.js.map +0 -1
  752. package/dist/modes/rpc/rpc-client.d.ts +0 -254
  753. package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  754. package/dist/modes/rpc/rpc-client.js +0 -499
  755. package/dist/modes/rpc/rpc-client.js.map +0 -1
  756. package/dist/modes/rpc/rpc-mode.d.ts +0 -20
  757. package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  758. package/dist/modes/rpc/rpc-mode.js +0 -655
  759. package/dist/modes/rpc/rpc-mode.js.map +0 -1
  760. package/dist/modes/rpc/rpc-types.d.ts +0 -478
  761. package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  762. package/dist/modes/rpc/rpc-types.js +0 -8
  763. package/dist/modes/rpc/rpc-types.js.map +0 -1
  764. package/dist/package-manager-cli.d.ts +0 -9
  765. package/dist/package-manager-cli.d.ts.map +0 -1
  766. package/dist/package-manager-cli.js +0 -1003
  767. package/dist/package-manager-cli.js.map +0 -1
  768. package/dist/rpc-entry.d.ts +0 -3
  769. package/dist/rpc-entry.d.ts.map +0 -1
  770. package/dist/rpc-entry.js +0 -11
  771. package/dist/rpc-entry.js.map +0 -1
  772. package/dist/utils/abort.d.ts +0 -5
  773. package/dist/utils/abort.d.ts.map +0 -1
  774. package/dist/utils/abort.js +0 -48
  775. package/dist/utils/abort.js.map +0 -1
  776. package/dist/utils/ansi.d.ts +0 -10
  777. package/dist/utils/ansi.d.ts.map +0 -1
  778. package/dist/utils/ansi.js +0 -71
  779. package/dist/utils/ansi.js.map +0 -1
  780. package/dist/utils/changelog.d.ts +0 -22
  781. package/dist/utils/changelog.d.ts.map +0 -1
  782. package/dist/utils/changelog.js +0 -165
  783. package/dist/utils/changelog.js.map +0 -1
  784. package/dist/utils/child-process.d.ts +0 -18
  785. package/dist/utils/child-process.d.ts.map +0 -1
  786. package/dist/utils/child-process.js +0 -106
  787. package/dist/utils/child-process.js.map +0 -1
  788. package/dist/utils/clipboard-command.d.ts +0 -7
  789. package/dist/utils/clipboard-command.d.ts.map +0 -1
  790. package/dist/utils/clipboard-command.js +0 -45
  791. package/dist/utils/clipboard-command.js.map +0 -1
  792. package/dist/utils/clipboard-image.d.ts +0 -11
  793. package/dist/utils/clipboard-image.d.ts.map +0 -1
  794. package/dist/utils/clipboard-image.js +0 -214
  795. package/dist/utils/clipboard-image.js.map +0 -1
  796. package/dist/utils/clipboard.d.ts +0 -6
  797. package/dist/utils/clipboard.d.ts.map +0 -1
  798. package/dist/utils/clipboard.js +0 -157
  799. package/dist/utils/clipboard.js.map +0 -1
  800. package/dist/utils/deprecation.d.ts +0 -4
  801. package/dist/utils/deprecation.d.ts.map +0 -1
  802. package/dist/utils/deprecation.js +0 -13
  803. package/dist/utils/deprecation.js.map +0 -1
  804. package/dist/utils/exif-orientation.d.ts +0 -5
  805. package/dist/utils/exif-orientation.d.ts.map +0 -1
  806. package/dist/utils/exif-orientation.js +0 -157
  807. package/dist/utils/exif-orientation.js.map +0 -1
  808. package/dist/utils/frontmatter.d.ts +0 -8
  809. package/dist/utils/frontmatter.d.ts.map +0 -1
  810. package/dist/utils/frontmatter.js +0 -27
  811. package/dist/utils/frontmatter.js.map +0 -1
  812. package/dist/utils/fs-watch.d.ts +0 -5
  813. package/dist/utils/fs-watch.d.ts.map +0 -1
  814. package/dist/utils/fs-watch.js +0 -25
  815. package/dist/utils/fs-watch.js.map +0 -1
  816. package/dist/utils/git.d.ts +0 -26
  817. package/dist/utils/git.d.ts.map +0 -1
  818. package/dist/utils/git.js +0 -195
  819. package/dist/utils/git.js.map +0 -1
  820. package/dist/utils/html.d.ts +0 -7
  821. package/dist/utils/html.d.ts.map +0 -1
  822. package/dist/utils/html.js +0 -40
  823. package/dist/utils/html.js.map +0 -1
  824. package/dist/utils/image-convert.d.ts +0 -22
  825. package/dist/utils/image-convert.d.ts.map +0 -1
  826. package/dist/utils/image-convert.js +0 -84
  827. package/dist/utils/image-convert.js.map +0 -1
  828. package/dist/utils/image-process.d.ts +0 -18
  829. package/dist/utils/image-process.d.ts.map +0 -1
  830. package/dist/utils/image-process.js +0 -83
  831. package/dist/utils/image-process.js.map +0 -1
  832. package/dist/utils/image-resize-core.d.ts +0 -42
  833. package/dist/utils/image-resize-core.d.ts.map +0 -1
  834. package/dist/utils/image-resize-core.js +0 -129
  835. package/dist/utils/image-resize-core.js.map +0 -1
  836. package/dist/utils/image-resize-worker.d.ts +0 -2
  837. package/dist/utils/image-resize-worker.d.ts.map +0 -1
  838. package/dist/utils/image-resize-worker.js +0 -32
  839. package/dist/utils/image-resize-worker.js.map +0 -1
  840. package/dist/utils/image-resize.d.ts +0 -16
  841. package/dist/utils/image-resize.d.ts.map +0 -1
  842. package/dist/utils/image-resize.js +0 -96
  843. package/dist/utils/image-resize.js.map +0 -1
  844. package/dist/utils/json.d.ts +0 -3
  845. package/dist/utils/json.d.ts.map +0 -1
  846. package/dist/utils/json.js +0 -7
  847. package/dist/utils/json.js.map +0 -1
  848. package/dist/utils/management-http.d.ts +0 -25
  849. package/dist/utils/management-http.d.ts.map +0 -1
  850. package/dist/utils/management-http.js +0 -54
  851. package/dist/utils/management-http.js.map +0 -1
  852. package/dist/utils/mime.d.ts +0 -3
  853. package/dist/utils/mime.d.ts.map +0 -1
  854. package/dist/utils/mime.js +0 -110
  855. package/dist/utils/mime.js.map +0 -1
  856. package/dist/utils/open-browser.d.ts +0 -9
  857. package/dist/utils/open-browser.d.ts.map +0 -1
  858. package/dist/utils/open-browser.js +0 -22
  859. package/dist/utils/open-browser.js.map +0 -1
  860. package/dist/utils/paths.d.ts +0 -34
  861. package/dist/utils/paths.d.ts.map +0 -1
  862. package/dist/utils/paths.js +0 -115
  863. package/dist/utils/paths.js.map +0 -1
  864. package/dist/utils/photon.d.ts +0 -21
  865. package/dist/utils/photon.d.ts.map +0 -1
  866. package/dist/utils/photon.js +0 -121
  867. package/dist/utils/photon.js.map +0 -1
  868. package/dist/utils/pi-user-agent.d.ts +0 -2
  869. package/dist/utils/pi-user-agent.d.ts.map +0 -1
  870. package/dist/utils/pi-user-agent.js +0 -5
  871. package/dist/utils/pi-user-agent.js.map +0 -1
  872. package/dist/utils/shell.d.ts +0 -32
  873. package/dist/utils/shell.d.ts.map +0 -1
  874. package/dist/utils/shell.js +0 -189
  875. package/dist/utils/shell.js.map +0 -1
  876. package/dist/utils/sleep.d.ts +0 -5
  877. package/dist/utils/sleep.d.ts.map +0 -1
  878. package/dist/utils/sleep.js +0 -17
  879. package/dist/utils/sleep.js.map +0 -1
  880. package/dist/utils/syntax-highlight.d.ts +0 -13
  881. package/dist/utils/syntax-highlight.d.ts.map +0 -1
  882. package/dist/utils/syntax-highlight.js +0 -184
  883. package/dist/utils/syntax-highlight.js.map +0 -1
  884. package/dist/utils/text.d.ts +0 -8
  885. package/dist/utils/text.d.ts.map +0 -1
  886. package/dist/utils/text.js +0 -9
  887. package/dist/utils/text.js.map +0 -1
  888. package/dist/utils/tool-result-images.d.ts +0 -21
  889. package/dist/utils/tool-result-images.d.ts.map +0 -1
  890. package/dist/utils/tool-result-images.js +0 -48
  891. package/dist/utils/tool-result-images.js.map +0 -1
  892. package/dist/utils/tools-manager.d.ts +0 -13
  893. package/dist/utils/tools-manager.d.ts.map +0 -1
  894. package/dist/utils/tools-manager.js +0 -343
  895. package/dist/utils/tools-manager.js.map +0 -1
  896. package/dist/utils/version-check.d.ts +0 -19
  897. package/dist/utils/version-check.d.ts.map +0 -1
  898. package/dist/utils/version-check.js +0 -72
  899. package/dist/utils/version-check.js.map +0 -1
  900. package/dist/utils/windows-self-update.d.ts +0 -3
  901. package/dist/utils/windows-self-update.d.ts.map +0 -1
  902. package/dist/utils/windows-self-update.js +0 -77
  903. package/dist/utils/windows-self-update.js.map +0 -1
  904. package/dist/utils/wsl.d.ts +0 -3
  905. package/dist/utils/wsl.d.ts.map +0 -1
  906. package/dist/utils/wsl.js +0 -15
  907. package/dist/utils/wsl.js.map +0 -1
  908. package/dist/utils/zip.d.ts +0 -7
  909. package/dist/utils/zip.d.ts.map +0 -1
  910. package/dist/utils/zip.js +0 -60
  911. package/dist/utils/zip.js.map +0 -1
@@ -1,744 +0,0 @@
1
- /**
2
- * Context compaction for long sessions.
3
- *
4
- * Pure functions for compaction logic. The session manager handles I/O,
5
- * and after compaction the session is reloaded.
6
- */
7
- import { contentText, getCurrentSystemMessage, normalizeContext, retryAssistantCall, uuidv7, } from "@earendil-works/pi-ai";
8
- import { completeSimple } from "@earendil-works/pi-ai/compat";
9
- import { convertToLlm } from "../messages.js";
10
- import { buildSessionProjection, sessionEntryToContextMessages, } from "../session-manager.js";
11
- import { combineUsage } from "../usage-totals.js";
12
- import { computeFileLists, createFileOps, extractFileOpsFromMessage, formatFileOperations, SUMMARIZATION_SYSTEM_PROMPT, serializeConversation, } from "./utils.js";
13
- /**
14
- * Extract file operations from messages and previous compaction entries.
15
- */
16
- function extractFileOperations(messages, entries, prevCompactionIndex) {
17
- const fileOps = createFileOps();
18
- // Collect from previous compaction's details (if pi-generated)
19
- if (prevCompactionIndex >= 0) {
20
- const prevCompaction = entries[prevCompactionIndex];
21
- if (!prevCompaction.fromHook && prevCompaction.details) {
22
- // fromHook field kept for session file compatibility
23
- const details = prevCompaction.details;
24
- if (Array.isArray(details.readFiles)) {
25
- for (const f of details.readFiles)
26
- fileOps.read.add(f);
27
- }
28
- if (Array.isArray(details.modifiedFiles)) {
29
- for (const f of details.modifiedFiles)
30
- fileOps.edited.add(f);
31
- }
32
- }
33
- }
34
- // Extract from tool calls in messages
35
- for (const msg of messages) {
36
- extractFileOpsFromMessage(msg, fileOps);
37
- }
38
- return fileOps;
39
- }
40
- // ============================================================================
41
- // Message Extraction
42
- // ============================================================================
43
- /**
44
- * Extract AgentMessage from an entry if it produces one.
45
- * Returns undefined for entries that don't contribute to LLM context.
46
- */
47
- function getMessagesFromProjectedEntryForCompaction(entry) {
48
- if (entry.sourceEntry.type === "compaction")
49
- return [];
50
- // System messages are prompt state, not conversation; the compaction entry carries their replay.
51
- return entry.messages.filter((message) => message.role !== "system");
52
- }
53
- export const DEFAULT_COMPACTION_SETTINGS = {
54
- enabled: true,
55
- reserveTokens: 16384,
56
- keepRecentTokens: 20000,
57
- };
58
- // ============================================================================
59
- // Token calculation
60
- // ============================================================================
61
- /**
62
- * Calculate total context tokens from usage.
63
- * Uses the native totalTokens field when available, falls back to computing from components.
64
- */
65
- export function calculateContextTokens(usage) {
66
- return usage.totalTokens || usage.input + usage.output + usage.cacheRead + usage.cacheWrite;
67
- }
68
- /**
69
- * Get usage from an assistant message if available.
70
- * Skips aborted, error, and all-zero usage messages as they don't have valid usage data.
71
- */
72
- function getAssistantUsage(msg) {
73
- if (msg.role === "assistant" && "usage" in msg) {
74
- const assistantMsg = msg;
75
- if (assistantMsg.stopReason !== "aborted" &&
76
- assistantMsg.stopReason !== "error" &&
77
- assistantMsg.usage &&
78
- calculateContextTokens(assistantMsg.usage) > 0) {
79
- return assistantMsg.usage;
80
- }
81
- }
82
- return undefined;
83
- }
84
- /**
85
- * Find the last valid assistant message usage from session entries.
86
- */
87
- export function getLastAssistantUsage(entries) {
88
- for (let i = entries.length - 1; i >= 0; i--) {
89
- const entry = entries[i];
90
- if (entry.type === "message") {
91
- const usage = getAssistantUsage(entry.message);
92
- if (usage)
93
- return usage;
94
- }
95
- }
96
- return undefined;
97
- }
98
- function getLastAssistantUsageInfo(messages) {
99
- for (let i = messages.length - 1; i >= 0; i--) {
100
- const usage = getAssistantUsage(messages[i]);
101
- if (usage)
102
- return { usage, index: i };
103
- }
104
- return undefined;
105
- }
106
- /**
107
- * Estimate context tokens from messages, using the last assistant usage when available.
108
- * If there are messages after the last usage, estimate their tokens with estimateTokens.
109
- */
110
- export function estimateContextTokens(messages) {
111
- const usageInfo = getLastAssistantUsageInfo(messages);
112
- if (!usageInfo) {
113
- let estimated = 0;
114
- for (const message of messages) {
115
- estimated += estimateTokens(message);
116
- }
117
- return {
118
- tokens: estimated,
119
- usageTokens: 0,
120
- trailingTokens: estimated,
121
- lastUsageIndex: null,
122
- };
123
- }
124
- const usageTokens = calculateContextTokens(usageInfo.usage);
125
- let trailingTokens = 0;
126
- for (let i = usageInfo.index + 1; i < messages.length; i++) {
127
- trailingTokens += estimateTokens(messages[i]);
128
- }
129
- return {
130
- tokens: usageTokens + trailingTokens,
131
- usageTokens,
132
- trailingTokens,
133
- lastUsageIndex: usageInfo.index,
134
- };
135
- }
136
- /** Estimate projected context without trusting usage captured before a later edit or compaction. */
137
- export function estimateProjectedContextTokens(projection, branchEntries) {
138
- const estimate = estimateContextTokens(projection.messages);
139
- if (estimate.lastUsageIndex !== null) {
140
- let projectedMessageIndex = 0;
141
- let usageEntryId;
142
- for (const entry of projection.entries) {
143
- const nextMessageIndex = projectedMessageIndex + entry.messages.length;
144
- if (estimate.lastUsageIndex < nextMessageIndex) {
145
- usageEntryId = entry.sourceEntry.id;
146
- break;
147
- }
148
- projectedMessageIndex = nextMessageIndex;
149
- }
150
- const usageEntryIndex = usageEntryId ? branchEntries.findIndex((entry) => entry.id === usageEntryId) : -1;
151
- let latestInvalidatingEntryIndex = -1;
152
- for (let i = branchEntries.length - 1; i >= 0; i--) {
153
- const entry = branchEntries[i];
154
- if (entry.type === "context_edit" || entry.type === "compaction") {
155
- latestInvalidatingEntryIndex = i;
156
- break;
157
- }
158
- }
159
- if (usageEntryIndex > latestInvalidatingEntryIndex)
160
- return estimate;
161
- }
162
- const currentSystem = getCurrentSystemMessage(projection.messages);
163
- let tokens = currentSystem ? estimateTokens(currentSystem) : 0;
164
- for (const message of projection.messages) {
165
- if (message.role !== "system")
166
- tokens += estimateTokens(message);
167
- }
168
- return { tokens, usageTokens: 0, trailingTokens: tokens, lastUsageIndex: null };
169
- }
170
- /**
171
- * Check if compaction should trigger based on context usage.
172
- */
173
- export function shouldCompact(contextTokens, contextWindow, settings) {
174
- if (!settings.enabled)
175
- return false;
176
- return contextTokens > contextWindow - settings.reserveTokens;
177
- }
178
- // ============================================================================
179
- // Cut point detection
180
- // ============================================================================
181
- const ESTIMATED_IMAGE_CHARS = 4800;
182
- function estimateTextAndImageContentChars(content) {
183
- if (typeof content === "string") {
184
- return content.length;
185
- }
186
- let chars = 0;
187
- for (const block of content) {
188
- if (block.type === "text" && block.text) {
189
- chars += block.text.length;
190
- }
191
- else if (block.type === "image") {
192
- chars += ESTIMATED_IMAGE_CHARS;
193
- }
194
- }
195
- return chars;
196
- }
197
- /**
198
- * Estimate token count for a message using chars/4 heuristic.
199
- * This is conservative (overestimates tokens).
200
- */
201
- export function estimateTokens(message) {
202
- let chars = 0;
203
- switch (message.role) {
204
- case "system": {
205
- const system = message;
206
- chars = estimateTextAndImageContentChars(system.content);
207
- if (system.sections) {
208
- for (const section of Object.values(system.sections)) {
209
- if (section)
210
- chars += section.length;
211
- }
212
- }
213
- if (system.tools)
214
- chars += JSON.stringify(system.tools).length;
215
- return Math.ceil(chars / 4);
216
- }
217
- case "user": {
218
- chars = estimateTextAndImageContentChars(message.content);
219
- return Math.ceil(chars / 4);
220
- }
221
- case "assistant": {
222
- const assistant = message;
223
- for (const block of assistant.content) {
224
- if (block.type === "text") {
225
- chars += block.text.length;
226
- }
227
- else if (block.type === "thinking") {
228
- chars += block.thinking.length;
229
- }
230
- else if (block.type === "toolCall") {
231
- chars += block.name.length + JSON.stringify(block.arguments).length;
232
- }
233
- }
234
- return Math.ceil(chars / 4);
235
- }
236
- case "custom":
237
- case "toolResult": {
238
- chars = estimateTextAndImageContentChars(message.content);
239
- return Math.ceil(chars / 4);
240
- }
241
- case "bashExecution": {
242
- chars = message.command.length + message.output.length;
243
- return Math.ceil(chars / 4);
244
- }
245
- case "branchSummary":
246
- case "compactionSummary": {
247
- chars = message.summary.length;
248
- return Math.ceil(chars / 4);
249
- }
250
- }
251
- return 0;
252
- }
253
- function isCutPointMessage(message) {
254
- switch (message.role) {
255
- case "user":
256
- case "assistant":
257
- case "bashExecution":
258
- case "custom":
259
- case "branchSummary":
260
- case "compactionSummary":
261
- return true;
262
- case "toolResult":
263
- return false;
264
- }
265
- return false;
266
- }
267
- function isTurnStartMessage(message) {
268
- switch (message.role) {
269
- case "user":
270
- case "bashExecution":
271
- case "custom":
272
- case "branchSummary":
273
- case "compactionSummary":
274
- return true;
275
- case "assistant":
276
- case "toolResult":
277
- return false;
278
- }
279
- return false;
280
- }
281
- function isTurnStartEntry(entry) {
282
- if (entry.type === "compaction") {
283
- return false;
284
- }
285
- return sessionEntryToContextMessages(entry).some(isTurnStartMessage);
286
- }
287
- /**
288
- * Find valid cut points: indices of context-visible user-like or assistant messages.
289
- * Never cut at tool results (they must follow their tool call).
290
- * When we cut at an assistant message with tool calls, its tool results follow it
291
- * and will be kept.
292
- */
293
- function findValidCutPoints(entries, startIndex, endIndex) {
294
- const cutPoints = [];
295
- for (let i = startIndex; i < endIndex; i++) {
296
- const entry = entries[i];
297
- if (entry.type === "compaction") {
298
- continue;
299
- }
300
- if (sessionEntryToContextMessages(entry).some(isCutPointMessage)) {
301
- cutPoints.push(i);
302
- }
303
- }
304
- return cutPoints;
305
- }
306
- /**
307
- * Find the context-visible user-role message that starts the turn containing the given entry index.
308
- * Returns -1 if no turn start found before the index.
309
- */
310
- export function findTurnStartIndex(entries, entryIndex, startIndex) {
311
- for (let i = entryIndex; i >= startIndex; i--) {
312
- if (isTurnStartEntry(entries[i])) {
313
- return i;
314
- }
315
- }
316
- return -1;
317
- }
318
- /**
319
- * Find the cut point in session entries that keeps approximately `keepRecentTokens`.
320
- *
321
- * Algorithm: Walk backwards from newest, accumulating estimated message sizes.
322
- * Stop when we've accumulated >= keepRecentTokens. Cut at that point.
323
- *
324
- * Can cut at user OR assistant messages (never tool results). When cutting at an
325
- * assistant message with tool calls, its tool results come after and will be kept.
326
- *
327
- * Returns CutPointResult with:
328
- * - firstKeptEntryIndex: the entry index to start keeping from
329
- * - turnStartIndex: if cutting mid-turn, the user message that started that turn
330
- * - isSplitTurn: whether we're cutting in the middle of a turn
331
- *
332
- * Only considers entries between `startIndex` and `endIndex` (exclusive).
333
- */
334
- export function findCutPoint(entries, startIndex, endIndex, keepRecentTokens) {
335
- const cutPoints = findValidCutPoints(entries, startIndex, endIndex);
336
- if (cutPoints.length === 0) {
337
- return { firstKeptEntryIndex: startIndex, turnStartIndex: -1, isSplitTurn: false };
338
- }
339
- // Walk backwards from newest, accumulating estimated message sizes
340
- let accumulatedTokens = 0;
341
- let cutIndex = cutPoints[0]; // Default: keep from first message (not header)
342
- for (let i = endIndex - 1; i >= startIndex; i--) {
343
- const entry = entries[i];
344
- const messageTokens = sessionEntryToContextMessages(entry).reduce((sum, message) => sum + estimateTokens(message), 0);
345
- if (messageTokens === 0)
346
- continue;
347
- accumulatedTokens += messageTokens;
348
- // Check if we've exceeded the budget
349
- if (accumulatedTokens >= keepRecentTokens) {
350
- // Prefer the closest valid cut point at or after this entry. If trailing
351
- // tool results exceed the budget by themselves, keep their preceding
352
- // assistant tool call instead of falling back to the first message.
353
- cutIndex = cutPoints.find((candidate) => candidate >= i) ?? cutPoints[cutPoints.length - 1];
354
- break;
355
- }
356
- }
357
- // Scan backwards from cutIndex to include adjacent metadata entries that do not affect context.
358
- while (cutIndex > startIndex) {
359
- const prevEntry = entries[cutIndex - 1];
360
- // Stop at compaction boundaries or context-visible entries.
361
- if (prevEntry.type === "compaction" || sessionEntryToContextMessages(prevEntry).length > 0) {
362
- break;
363
- }
364
- cutIndex--;
365
- }
366
- // Determine if this is a split turn
367
- const cutEntry = entries[cutIndex];
368
- const startsTurn = isTurnStartEntry(cutEntry);
369
- const turnStartIndex = startsTurn ? -1 : findTurnStartIndex(entries, cutIndex, startIndex);
370
- return {
371
- firstKeptEntryIndex: cutIndex,
372
- turnStartIndex,
373
- isSplitTurn: !startsTurn && turnStartIndex !== -1,
374
- };
375
- }
376
- // ============================================================================
377
- // Summarization
378
- // ============================================================================
379
- const SUMMARIZATION_PROMPT = `The messages above are a conversation to summarize. Create a structured context checkpoint summary that another LLM will use to continue the work.
380
-
381
- Use this EXACT format:
382
-
383
- ## Goal
384
- [What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
385
-
386
- ## Constraints & Preferences
387
- - [Any constraints, preferences, or requirements mentioned by user]
388
- - [Or "(none)" if none were mentioned]
389
-
390
- ## Progress
391
- ### Done
392
- - [x] [Completed tasks/changes]
393
-
394
- ### In Progress
395
- - [ ] [Current work]
396
-
397
- ### Blocked
398
- - [Issues preventing progress, if any]
399
-
400
- ## Key Decisions
401
- - **[Decision]**: [Brief rationale]
402
-
403
- ## Next Steps
404
- 1. [Ordered list of what should happen next]
405
-
406
- ## Critical Context
407
- - [Any data, examples, or references needed to continue]
408
- - [Or "(none)" if not applicable]
409
-
410
- Keep each section concise. Preserve exact file paths, function names, and error messages.`;
411
- const UPDATE_SUMMARIZATION_INSTRUCTIONS = `Update the existing structured summary with new information. RULES:
412
- - PRESERVE all existing information from the previous summary
413
- - ADD new progress, decisions, and context from the new messages
414
- - UPDATE the Progress section: move items from "In Progress" to "Done" when completed
415
- - UPDATE "Next Steps" based on what was accomplished
416
- - PRESERVE exact file paths, function names, and error messages
417
- - If something is no longer relevant, you may remove it
418
-
419
- Use this EXACT format:
420
-
421
- ## Goal
422
- [Preserve existing goals, add new ones if the task expanded]
423
-
424
- ## Constraints & Preferences
425
- - [Preserve existing, add new ones discovered]
426
-
427
- ## Progress
428
- ### Done
429
- - [x] [Include previously done items AND newly completed items]
430
-
431
- ### In Progress
432
- - [ ] [Current work - update based on progress]
433
-
434
- ### Blocked
435
- - [Current blockers - remove if resolved]
436
-
437
- ## Key Decisions
438
- - **[Decision]**: [Brief rationale] (preserve all previous, add new)
439
-
440
- ## Next Steps
441
- 1. [Update based on current state]
442
-
443
- ## Critical Context
444
- - [Preserve important context, add new if needed]
445
-
446
- Keep each section concise. Preserve exact file paths, function names, and error messages.`;
447
- const UPDATE_SUMMARIZATION_PROMPT = `The messages above are NEW conversation messages to incorporate into the existing summary provided in <previous-summary> tags.
448
-
449
- ${UPDATE_SUMMARIZATION_INSTRUCTIONS}`;
450
- /**
451
- * Returns an error message when a summarization response cannot safely be persisted.
452
- * A length stop contains partial text and must not become a session checkpoint.
453
- */
454
- export function getSummarizationFailure(response, label) {
455
- if (response.stopReason === "error") {
456
- return `${label} failed: ${response.errorMessage || "Unknown error"}`;
457
- }
458
- if (response.stopReason === "length") {
459
- return `${label} failed: generation hit the token cap and the summary is incomplete`;
460
- }
461
- return undefined;
462
- }
463
- function createSummarizationOptions(model, maxTokens, apiKey, headers, env, signal, thinkingLevel, sessionId) {
464
- const options = { maxTokens, signal, apiKey, headers, env, sessionId };
465
- if (model.reasoning && thinkingLevel && thinkingLevel !== "off") {
466
- options.reasoning = thinkingLevel;
467
- }
468
- return options;
469
- }
470
- /**
471
- * Shared choke point for every compaction/branch-summary summarization call. Wraps the
472
- * single LLM call in {@link retryAssistantCall} so transient stream drops (e.g.
473
- * `terminated`, socket close) honor the configured retry policy instead of failing
474
- * the whole compaction on the first attempt. Deterministic errors and aborts return
475
- * immediately (see {@link retryAssistantCall}).
476
- */
477
- export async function completeSummarization(model, context, options, streamFn, retry, callbacks) {
478
- // Avoid cache writes for one-off summaries. Reuse caller-supplied routing when available;
479
- // callers without a session ID, including branch summaries, receive a fresh routing ID.
480
- const requestOptions = {
481
- ...options,
482
- cacheRetention: "none",
483
- sessionId: options.sessionId ?? uuidv7(),
484
- };
485
- const produce = async () => streamFn
486
- ? (await streamFn(model, context, requestOptions)).result()
487
- : completeSimple(model, context, requestOptions);
488
- return retryAssistantCall(produce, retry, requestOptions.signal, callbacks);
489
- }
490
- /**
491
- * Generate a summary of the conversation using the LLM.
492
- * If previousSummary is provided, uses the update prompt to merge.
493
- */
494
- export async function generateSummary(currentMessages, model, reserveTokens, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env, retry, callbacks, sessionId) {
495
- return (await generateSummaryWithUsage(currentMessages, model, reserveTokens, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env, retry, callbacks, sessionId)).text;
496
- }
497
- /** Build the provider context for a standalone summary request. */
498
- function buildSummarizationContext(promptText) {
499
- return normalizeContext({
500
- systemPrompt: SUMMARIZATION_SYSTEM_PROMPT,
501
- messages: [
502
- {
503
- role: "user",
504
- content: [{ type: "text", text: promptText }],
505
- timestamp: Date.now(),
506
- },
507
- ],
508
- });
509
- }
510
- /** Generate or update a conversation summary and return its provider usage. */
511
- export async function generateSummaryWithUsage(currentMessages, model, reserveTokens, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env, retry, callbacks, sessionId) {
512
- const maxTokens = Math.min(Math.floor(0.8 * reserveTokens), model.maxTokens > 0 ? model.maxTokens : Number.POSITIVE_INFINITY);
513
- // Use update prompt if we have a previous summary, otherwise initial prompt
514
- let basePrompt = previousSummary ? UPDATE_SUMMARIZATION_PROMPT : SUMMARIZATION_PROMPT;
515
- if (customInstructions) {
516
- basePrompt = `${basePrompt}\n\nAdditional focus: ${customInstructions}`;
517
- }
518
- // Serialize conversation to text so model doesn't try to continue it
519
- // Convert to LLM messages first (handles custom types like bashExecution, custom, etc.)
520
- const llmMessages = convertToLlm(currentMessages);
521
- const conversationText = serializeConversation(llmMessages);
522
- // Build the prompt with conversation wrapped in tags
523
- let promptText = `<conversation>\n${conversationText}\n</conversation>\n\n`;
524
- if (previousSummary) {
525
- promptText += `<previous-summary>\n${previousSummary}\n</previous-summary>\n\n`;
526
- }
527
- promptText += basePrompt;
528
- const completionOptions = createSummarizationOptions(model, maxTokens, apiKey, headers, env, signal, thinkingLevel, sessionId);
529
- const response = await completeSummarization(model, buildSummarizationContext(promptText), completionOptions, streamFn, retry, callbacks);
530
- const failure = getSummarizationFailure(response, "Summarization");
531
- if (failure) {
532
- throw new Error(failure);
533
- }
534
- if (response.content.some((block) => block.type === "toolCall")) {
535
- throw new Error("Summarization attempted to call a tool");
536
- }
537
- const textContent = contentText(response.content);
538
- return { text: textContent, usage: response.usage };
539
- }
540
- function isProjectedTurnStart(entry) {
541
- if (entry.sourceEntry.type === "compaction")
542
- return false;
543
- return entry.messages.some(isTurnStartMessage);
544
- }
545
- function findProjectedTurnStartIndex(entries, entryIndex, startIndex) {
546
- for (let i = entryIndex; i >= startIndex; i--) {
547
- if (isProjectedTurnStart(entries[i]))
548
- return i;
549
- }
550
- return -1;
551
- }
552
- function findProjectedCutPoint(entries, startIndex, endIndex, keepRecentTokens) {
553
- const cutPoints = [];
554
- for (let i = startIndex; i < endIndex; i++) {
555
- const entry = entries[i];
556
- if (entry.sourceEntry.type !== "compaction" && entry.messages.some(isCutPointMessage))
557
- cutPoints.push(i);
558
- }
559
- if (cutPoints.length === 0) {
560
- return { firstKeptEntryIndex: startIndex, turnStartIndex: -1, isSplitTurn: false };
561
- }
562
- let accumulatedTokens = 0;
563
- let exceededBudget = false;
564
- let cutIndex = cutPoints[0];
565
- for (let i = endIndex - 1; i >= startIndex; i--) {
566
- const messageTokens = entries[i].messages.reduce((sum, message) => sum + estimateTokens(message), 0);
567
- if (messageTokens === 0)
568
- continue;
569
- accumulatedTokens += messageTokens;
570
- if (accumulatedTokens >= keepRecentTokens) {
571
- exceededBudget = true;
572
- cutIndex = cutPoints.find((candidate) => candidate >= i) ?? cutPoints[cutPoints.length - 1];
573
- break;
574
- }
575
- }
576
- // A recovery attempt and its omission edits are context-invisible after the last
577
- // visible input. Advance only for a closed suffix containing an omitted assistant
578
- // attempt; arbitrary metadata must not move the cut past unsent input.
579
- const suffix = entries.slice(cutIndex + 1, endIndex);
580
- const isIntrinsicallyVisible = (entry) => entry.sourceEntry.type !== "context_edit" && sessionEntryToContextMessages(entry.sourceEntry).length > 0;
581
- const isOmitted = (entry) => isIntrinsicallyVisible(entry) && entry.messages.length === 0;
582
- const omittedSuffixIds = new Set(suffix.filter(isOmitted).map((entry) => entry.sourceEntry.id));
583
- const hasExternalReplacement = suffix.some((entry) => entry.sourceEntry.type === "context_edit" &&
584
- entry.sourceEntry.replacement !== null &&
585
- !omittedSuffixIds.has(entry.sourceEntry.targetId));
586
- const isRecoveryOmissionSuffix = exceededBudget &&
587
- !hasExternalReplacement &&
588
- suffix.some((entry) => entry.sourceEntry.type === "message" && entry.sourceEntry.message.role === "assistant" && isOmitted(entry)) &&
589
- suffix.every((entry) => entry.sourceEntry.type !== "compaction" && (!isIntrinsicallyVisible(entry) || isOmitted(entry)));
590
- if (isRecoveryOmissionSuffix)
591
- cutIndex++;
592
- while (cutIndex > startIndex) {
593
- const previous = entries[cutIndex - 1];
594
- if (previous.sourceEntry.type === "compaction" || previous.messages.length > 0)
595
- break;
596
- cutIndex--;
597
- }
598
- const startsTurn = isProjectedTurnStart(entries[cutIndex]);
599
- const turnStartIndex = startsTurn ? -1 : findProjectedTurnStartIndex(entries, cutIndex, startIndex);
600
- return {
601
- firstKeptEntryIndex: cutIndex,
602
- turnStartIndex,
603
- isSplitTurn: !startsTurn && turnStartIndex !== -1,
604
- };
605
- }
606
- export function prepareCompaction(pathEntries, settings) {
607
- if (pathEntries.length > 0 && pathEntries[pathEntries.length - 1].type === "compaction") {
608
- return undefined;
609
- }
610
- const projection = buildSessionProjection(pathEntries);
611
- const projectedEntries = projection.entries;
612
- const sourceEntries = projectedEntries.map((entry) => entry.sourceEntry);
613
- // The newest compaction is projected first. Older compaction entries can still
614
- // occur in its retained raw range, but their projected contribution is empty.
615
- const prevCompactionIndex = projectedEntries.findIndex((entry) => entry.sourceEntry.type === "compaction" && entry.messages.length > 0);
616
- let previousSummary;
617
- let boundaryStart = 0;
618
- if (prevCompactionIndex >= 0) {
619
- previousSummary = projectedEntries[prevCompactionIndex].sourceEntry.summary;
620
- // The canonical projection has already selected the previous compaction's retained tail.
621
- boundaryStart = prevCompactionIndex + 1;
622
- }
623
- const boundaryEnd = projectedEntries.length;
624
- const tokensBefore = estimateProjectedContextTokens(projection, pathEntries).tokens;
625
- const cutPoint = findProjectedCutPoint(projectedEntries, boundaryStart, boundaryEnd, settings.keepRecentTokens);
626
- const firstKeptEntry = projectedEntries[cutPoint.firstKeptEntryIndex]?.sourceEntry;
627
- if (!firstKeptEntry?.id)
628
- return undefined;
629
- const firstKeptEntryId = firstKeptEntry.id;
630
- const historyEnd = cutPoint.isSplitTurn ? cutPoint.turnStartIndex : cutPoint.firstKeptEntryIndex;
631
- const messagesToSummarize = projectedEntries
632
- .slice(boundaryStart, historyEnd)
633
- .flatMap(getMessagesFromProjectedEntryForCompaction);
634
- const turnPrefixMessages = cutPoint.isSplitTurn
635
- ? projectedEntries
636
- .slice(cutPoint.turnStartIndex, cutPoint.firstKeptEntryIndex)
637
- .flatMap(getMessagesFromProjectedEntryForCompaction)
638
- : [];
639
- if (messagesToSummarize.length === 0 && turnPrefixMessages.length === 0)
640
- return undefined;
641
- // Extract file operations from edited model-visible messages and the previous compaction.
642
- const fileOps = extractFileOperations(messagesToSummarize, sourceEntries, prevCompactionIndex);
643
- // Also extract file ops from turn prefix if splitting
644
- if (cutPoint.isSplitTurn) {
645
- for (const msg of turnPrefixMessages) {
646
- extractFileOpsFromMessage(msg, fileOps);
647
- }
648
- }
649
- return {
650
- firstKeptEntryId,
651
- messagesToSummarize,
652
- turnPrefixMessages,
653
- isSplitTurn: cutPoint.isSplitTurn,
654
- tokensBefore,
655
- previousSummary,
656
- fileOps,
657
- settings,
658
- };
659
- }
660
- // ============================================================================
661
- // Main compaction function
662
- // ============================================================================
663
- const TURN_PREFIX_SUMMARIZATION_PROMPT = `The messages above are earlier context from an ongoing conversation. Later messages are stored separately and do not need to be reconstructed.
664
-
665
- Create a concise checkpoint of the user's request and the progress shown above. This checkpoint will be placed before the later messages so the conversation can continue with the necessary context.
666
-
667
- ## Original Request
668
- [What did the user ask for?]
669
-
670
- ## Progress So Far
671
- - [Key decisions and work completed in these messages]
672
-
673
- ## Context Needed to Continue
674
- - [Information from these messages needed to understand the later work]
675
-
676
- Only summarize information explicitly present above. Do not infer or recreate later messages.`;
677
- /**
678
- * Generate summaries for compaction using prepared data.
679
- * Returns CompactionResult - SessionManager adds uuid/parentUuid when saving.
680
- *
681
- * @param preparation - Pre-calculated preparation from prepareCompaction()
682
- * @param customInstructions - Optional custom focus for the summary
683
- * @param sessionId - Optional routing session ID forwarded without enabling prompt caching
684
- */
685
- export async function compact(preparation, model, apiKey, headers, customInstructions, signal, thinkingLevel, streamFn, env, retry, callbacks, sessionId) {
686
- const { firstKeptEntryId, messagesToSummarize, turnPrefixMessages, isSplitTurn, tokensBefore, previousSummary, fileOps, settings, } = preparation;
687
- // Generate summaries and merge into one
688
- let summary;
689
- let summaryUsage;
690
- if (isSplitTurn && turnPrefixMessages.length > 0) {
691
- let historyText = previousSummary ?? "No prior history.";
692
- let historyUsage;
693
- if (messagesToSummarize.length > 0) {
694
- const historyResult = await generateSummaryWithUsage(messagesToSummarize, model, settings.reserveTokens, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env, retry, callbacks, sessionId);
695
- historyText = historyResult.text;
696
- historyUsage = historyResult.usage;
697
- }
698
- const turnPrefixResult = await generateTurnPrefixSummary(turnPrefixMessages, model, settings.reserveTokens, apiKey, headers, env, signal, thinkingLevel, streamFn, retry, callbacks, sessionId);
699
- // Merge into single summary
700
- summary = `${historyText}\n\n---\n\n**Turn Context (split turn):**\n\n${turnPrefixResult.text}`;
701
- summaryUsage = historyUsage ? combineUsage(historyUsage, turnPrefixResult.usage) : turnPrefixResult.usage;
702
- }
703
- else {
704
- // Just generate history summary
705
- const result = await generateSummaryWithUsage(messagesToSummarize, model, settings.reserveTokens, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env, retry, callbacks, sessionId);
706
- summary = result.text;
707
- summaryUsage = result.usage;
708
- }
709
- // Compute file lists and append to summary
710
- const { readFiles, modifiedFiles } = computeFileLists(fileOps);
711
- summary += formatFileOperations(readFiles, modifiedFiles);
712
- if (!firstKeptEntryId) {
713
- throw new Error("First kept entry has no UUID - session may need migration");
714
- }
715
- return {
716
- summary,
717
- firstKeptEntryId,
718
- tokensBefore,
719
- usage: summaryUsage,
720
- details: { readFiles, modifiedFiles },
721
- };
722
- }
723
- /**
724
- * Generate a summary for a turn prefix (when splitting a turn).
725
- */
726
- async function generateTurnPrefixSummary(messages, model, reserveTokens, apiKey, headers, env, signal, thinkingLevel, streamFn, retry, callbacks, sessionId) {
727
- const maxTokens = Math.min(Math.floor(0.5 * reserveTokens), model.maxTokens > 0 ? model.maxTokens : Number.POSITIVE_INFINITY); // Smaller budget for turn prefix
728
- const llmMessages = convertToLlm(messages);
729
- const conversationText = serializeConversation(llmMessages);
730
- const promptText = `# Conversation\n${conversationText}\n\n# Instructions\n${TURN_PREFIX_SUMMARIZATION_PROMPT}`;
731
- const response = await completeSummarization(model, buildSummarizationContext(promptText), createSummarizationOptions(model, maxTokens, apiKey, headers, env, signal, thinkingLevel, sessionId), streamFn, retry, callbacks);
732
- const failure = getSummarizationFailure(response, "Turn prefix summarization");
733
- if (failure) {
734
- throw new Error(failure);
735
- }
736
- if (response.content.some((block) => block.type === "toolCall")) {
737
- throw new Error("Turn prefix summarization attempted to call a tool");
738
- }
739
- return {
740
- text: contentText(response.content),
741
- usage: response.usage,
742
- };
743
- }
744
- //# sourceMappingURL=compaction.js.map