meetsoma 0.3.2 → 0.3.4

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 (516) hide show
  1. package/CHANGELOG.md +26 -194
  2. package/dist/thin-cli.js +1587 -392
  3. package/package.json +12 -59
  4. package/bin/gum +0 -0
  5. package/dist/bun/cli.d.ts +0 -3
  6. package/dist/bun/cli.d.ts.map +0 -1
  7. package/dist/bun/cli.js +0 -7
  8. package/dist/bun/cli.js.map +0 -1
  9. package/dist/bun/register-bedrock.d.ts +0 -2
  10. package/dist/bun/register-bedrock.d.ts.map +0 -1
  11. package/dist/bun/register-bedrock.js +0 -4
  12. package/dist/bun/register-bedrock.js.map +0 -1
  13. package/dist/cli/args.d.ts +0 -49
  14. package/dist/cli/args.d.ts.map +0 -1
  15. package/dist/cli/args.js +0 -304
  16. package/dist/cli/args.js.map +0 -1
  17. package/dist/cli/config-selector.d.ts +0 -14
  18. package/dist/cli/config-selector.d.ts.map +0 -1
  19. package/dist/cli/config-selector.js +0 -31
  20. package/dist/cli/config-selector.js.map +0 -1
  21. package/dist/cli/file-processor.d.ts +0 -15
  22. package/dist/cli/file-processor.d.ts.map +0 -1
  23. package/dist/cli/file-processor.js +0 -83
  24. package/dist/cli/file-processor.js.map +0 -1
  25. package/dist/cli/initial-message.d.ts +0 -18
  26. package/dist/cli/initial-message.d.ts.map +0 -1
  27. package/dist/cli/initial-message.js +0 -22
  28. package/dist/cli/initial-message.js.map +0 -1
  29. package/dist/cli/list-models.d.ts +0 -9
  30. package/dist/cli/list-models.d.ts.map +0 -1
  31. package/dist/cli/list-models.js +0 -92
  32. package/dist/cli/list-models.js.map +0 -1
  33. package/dist/cli/session-picker.d.ts +0 -9
  34. package/dist/cli/session-picker.d.ts.map +0 -1
  35. package/dist/cli/session-picker.js +0 -35
  36. package/dist/cli/session-picker.js.map +0 -1
  37. package/dist/cli.d.ts +0 -3
  38. package/dist/cli.d.ts.map +0 -1
  39. package/dist/cli.js +0 -601
  40. package/dist/cli.js.map +0 -1
  41. package/dist/config.d.ts +0 -68
  42. package/dist/config.d.ts.map +0 -1
  43. package/dist/config.js +0 -203
  44. package/dist/config.js.map +0 -1
  45. package/dist/core/agent-session-runtime.d.ts +0 -134
  46. package/dist/core/agent-session-runtime.d.ts.map +0 -1
  47. package/dist/core/agent-session-runtime.js +0 -264
  48. package/dist/core/agent-session-runtime.js.map +0 -1
  49. package/dist/core/agent-session.d.ts +0 -585
  50. package/dist/core/agent-session.d.ts.map +0 -1
  51. package/dist/core/agent-session.js +0 -2497
  52. package/dist/core/agent-session.js.map +0 -1
  53. package/dist/core/auth-storage.d.ts +0 -132
  54. package/dist/core/auth-storage.d.ts.map +0 -1
  55. package/dist/core/auth-storage.js +0 -422
  56. package/dist/core/auth-storage.js.map +0 -1
  57. package/dist/core/bash-executor.d.ts +0 -46
  58. package/dist/core/bash-executor.d.ts.map +0 -1
  59. package/dist/core/bash-executor.js +0 -113
  60. package/dist/core/bash-executor.js.map +0 -1
  61. package/dist/core/compaction/branch-summarization.d.ts +0 -88
  62. package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  63. package/dist/core/compaction/branch-summarization.js +0 -243
  64. package/dist/core/compaction/branch-summarization.js.map +0 -1
  65. package/dist/core/compaction/compaction.d.ts +0 -121
  66. package/dist/core/compaction/compaction.d.ts.map +0 -1
  67. package/dist/core/compaction/compaction.js +0 -613
  68. package/dist/core/compaction/compaction.js.map +0 -1
  69. package/dist/core/compaction/index.d.ts +0 -7
  70. package/dist/core/compaction/index.d.ts.map +0 -1
  71. package/dist/core/compaction/index.js +0 -7
  72. package/dist/core/compaction/index.js.map +0 -1
  73. package/dist/core/compaction/utils.d.ts +0 -38
  74. package/dist/core/compaction/utils.d.ts.map +0 -1
  75. package/dist/core/compaction/utils.js +0 -153
  76. package/dist/core/compaction/utils.js.map +0 -1
  77. package/dist/core/defaults.d.ts +0 -3
  78. package/dist/core/defaults.d.ts.map +0 -1
  79. package/dist/core/defaults.js +0 -2
  80. package/dist/core/defaults.js.map +0 -1
  81. package/dist/core/diagnostics.d.ts +0 -15
  82. package/dist/core/diagnostics.d.ts.map +0 -1
  83. package/dist/core/diagnostics.js +0 -2
  84. package/dist/core/diagnostics.js.map +0 -1
  85. package/dist/core/event-bus.d.ts +0 -9
  86. package/dist/core/event-bus.d.ts.map +0 -1
  87. package/dist/core/event-bus.js +0 -25
  88. package/dist/core/event-bus.js.map +0 -1
  89. package/dist/core/exec.d.ts +0 -29
  90. package/dist/core/exec.d.ts.map +0 -1
  91. package/dist/core/exec.js +0 -75
  92. package/dist/core/exec.js.map +0 -1
  93. package/dist/core/export-html/ansi-to-html.d.ts +0 -22
  94. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  95. package/dist/core/export-html/ansi-to-html.js +0 -249
  96. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  97. package/dist/core/export-html/index.d.ts +0 -37
  98. package/dist/core/export-html/index.d.ts.map +0 -1
  99. package/dist/core/export-html/index.js +0 -224
  100. package/dist/core/export-html/index.js.map +0 -1
  101. package/dist/core/export-html/template.css +0 -1001
  102. package/dist/core/export-html/template.html +0 -55
  103. package/dist/core/export-html/template.js +0 -1690
  104. package/dist/core/export-html/tool-renderer.d.ts +0 -40
  105. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  106. package/dist/core/export-html/tool-renderer.js +0 -95
  107. package/dist/core/export-html/tool-renderer.js.map +0 -1
  108. package/dist/core/export-html/vendor/highlight.min.js +0 -1213
  109. package/dist/core/export-html/vendor/marked.min.js +0 -6
  110. package/dist/core/extensions/index.d.ts +0 -12
  111. package/dist/core/extensions/index.d.ts.map +0 -1
  112. package/dist/core/extensions/index.js +0 -9
  113. package/dist/core/extensions/index.js.map +0 -1
  114. package/dist/core/extensions/loader.d.ts +0 -25
  115. package/dist/core/extensions/loader.d.ts.map +0 -1
  116. package/dist/core/extensions/loader.js +0 -436
  117. package/dist/core/extensions/loader.js.map +0 -1
  118. package/dist/core/extensions/runner.d.ts +0 -148
  119. package/dist/core/extensions/runner.d.ts.map +0 -1
  120. package/dist/core/extensions/runner.js +0 -700
  121. package/dist/core/extensions/runner.js.map +0 -1
  122. package/dist/core/extensions/types.d.ts +0 -1076
  123. package/dist/core/extensions/types.d.ts.map +0 -1
  124. package/dist/core/extensions/types.js +0 -35
  125. package/dist/core/extensions/types.js.map +0 -1
  126. package/dist/core/extensions/wrapper.d.ts +0 -20
  127. package/dist/core/extensions/wrapper.d.ts.map +0 -1
  128. package/dist/core/extensions/wrapper.js +0 -22
  129. package/dist/core/extensions/wrapper.js.map +0 -1
  130. package/dist/core/footer-data-provider.d.ts +0 -48
  131. package/dist/core/footer-data-provider.d.ts.map +0 -1
  132. package/dist/core/footer-data-provider.js +0 -314
  133. package/dist/core/footer-data-provider.js.map +0 -1
  134. package/dist/core/index.d.ts +0 -11
  135. package/dist/core/index.d.ts.map +0 -1
  136. package/dist/core/index.js +0 -11
  137. package/dist/core/index.js.map +0 -1
  138. package/dist/core/keybindings.d.ts +0 -285
  139. package/dist/core/keybindings.d.ts.map +0 -1
  140. package/dist/core/keybindings.js +0 -251
  141. package/dist/core/keybindings.js.map +0 -1
  142. package/dist/core/messages.d.ts +0 -77
  143. package/dist/core/messages.d.ts.map +0 -1
  144. package/dist/core/messages.js +0 -123
  145. package/dist/core/messages.js.map +0 -1
  146. package/dist/core/model-registry.d.ts +0 -132
  147. package/dist/core/model-registry.d.ts.map +0 -1
  148. package/dist/core/model-registry.js +0 -583
  149. package/dist/core/model-registry.js.map +0 -1
  150. package/dist/core/model-resolver.d.ts +0 -110
  151. package/dist/core/model-resolver.d.ts.map +0 -1
  152. package/dist/core/model-resolver.js +0 -486
  153. package/dist/core/model-resolver.js.map +0 -1
  154. package/dist/core/output-guard.d.ts +0 -6
  155. package/dist/core/output-guard.d.ts.map +0 -1
  156. package/dist/core/output-guard.js +0 -59
  157. package/dist/core/output-guard.js.map +0 -1
  158. package/dist/core/package-manager.d.ts +0 -172
  159. package/dist/core/package-manager.d.ts.map +0 -1
  160. package/dist/core/package-manager.js +0 -1783
  161. package/dist/core/package-manager.js.map +0 -1
  162. package/dist/core/prompt-templates.d.ts +0 -51
  163. package/dist/core/prompt-templates.d.ts.map +0 -1
  164. package/dist/core/prompt-templates.js +0 -249
  165. package/dist/core/prompt-templates.js.map +0 -1
  166. package/dist/core/resolve-config-value.d.ts +0 -23
  167. package/dist/core/resolve-config-value.d.ts.map +0 -1
  168. package/dist/core/resolve-config-value.js +0 -126
  169. package/dist/core/resolve-config-value.js.map +0 -1
  170. package/dist/core/resource-loader.d.ts +0 -185
  171. package/dist/core/resource-loader.d.ts.map +0 -1
  172. package/dist/core/resource-loader.js +0 -698
  173. package/dist/core/resource-loader.js.map +0 -1
  174. package/dist/core/sdk.d.ts +0 -93
  175. package/dist/core/sdk.d.ts.map +0 -1
  176. package/dist/core/sdk.js +0 -236
  177. package/dist/core/sdk.js.map +0 -1
  178. package/dist/core/session-manager.d.ts +0 -332
  179. package/dist/core/session-manager.d.ts.map +0 -1
  180. package/dist/core/session-manager.js +0 -1104
  181. package/dist/core/session-manager.js.map +0 -1
  182. package/dist/core/settings-manager.d.ts +0 -237
  183. package/dist/core/settings-manager.d.ts.map +0 -1
  184. package/dist/core/settings-manager.js +0 -702
  185. package/dist/core/settings-manager.js.map +0 -1
  186. package/dist/core/skills.d.ts +0 -60
  187. package/dist/core/skills.d.ts.map +0 -1
  188. package/dist/core/skills.js +0 -409
  189. package/dist/core/skills.js.map +0 -1
  190. package/dist/core/slash-commands.d.ts +0 -14
  191. package/dist/core/slash-commands.d.ts.map +0 -1
  192. package/dist/core/slash-commands.js +0 -23
  193. package/dist/core/slash-commands.js.map +0 -1
  194. package/dist/core/source-info.d.ts +0 -18
  195. package/dist/core/source-info.d.ts.map +0 -1
  196. package/dist/core/source-info.js +0 -19
  197. package/dist/core/source-info.js.map +0 -1
  198. package/dist/core/system-prompt.d.ts +0 -28
  199. package/dist/core/system-prompt.d.ts.map +0 -1
  200. package/dist/core/system-prompt.js +0 -116
  201. package/dist/core/system-prompt.js.map +0 -1
  202. package/dist/core/timings.d.ts +0 -8
  203. package/dist/core/timings.d.ts.map +0 -1
  204. package/dist/core/timings.js +0 -31
  205. package/dist/core/timings.js.map +0 -1
  206. package/dist/core/tools/bash.d.ts +0 -73
  207. package/dist/core/tools/bash.d.ts.map +0 -1
  208. package/dist/core/tools/bash.js +0 -342
  209. package/dist/core/tools/bash.js.map +0 -1
  210. package/dist/core/tools/edit-diff.d.ts +0 -85
  211. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  212. package/dist/core/tools/edit-diff.js +0 -337
  213. package/dist/core/tools/edit-diff.js.map +0 -1
  214. package/dist/core/tools/edit.d.ts +0 -53
  215. package/dist/core/tools/edit.d.ts.map +0 -1
  216. package/dist/core/tools/edit.js +0 -196
  217. package/dist/core/tools/edit.js.map +0 -1
  218. package/dist/core/tools/file-mutation-queue.d.ts +0 -6
  219. package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  220. package/dist/core/tools/file-mutation-queue.js +0 -37
  221. package/dist/core/tools/file-mutation-queue.js.map +0 -1
  222. package/dist/core/tools/find.d.ts +0 -46
  223. package/dist/core/tools/find.d.ts.map +0 -1
  224. package/dist/core/tools/find.js +0 -258
  225. package/dist/core/tools/find.js.map +0 -1
  226. package/dist/core/tools/grep.d.ts +0 -56
  227. package/dist/core/tools/grep.d.ts.map +0 -1
  228. package/dist/core/tools/grep.js +0 -293
  229. package/dist/core/tools/grep.js.map +0 -1
  230. package/dist/core/tools/index.d.ts +0 -115
  231. package/dist/core/tools/index.d.ts.map +0 -1
  232. package/dist/core/tools/index.js +0 -86
  233. package/dist/core/tools/index.js.map +0 -1
  234. package/dist/core/tools/ls.d.ts +0 -46
  235. package/dist/core/tools/ls.d.ts.map +0 -1
  236. package/dist/core/tools/ls.js +0 -172
  237. package/dist/core/tools/ls.js.map +0 -1
  238. package/dist/core/tools/path-utils.d.ts +0 -8
  239. package/dist/core/tools/path-utils.d.ts.map +0 -1
  240. package/dist/core/tools/path-utils.js +0 -81
  241. package/dist/core/tools/path-utils.js.map +0 -1
  242. package/dist/core/tools/read.d.ts +0 -46
  243. package/dist/core/tools/read.d.ts.map +0 -1
  244. package/dist/core/tools/read.js +0 -225
  245. package/dist/core/tools/read.js.map +0 -1
  246. package/dist/core/tools/render-utils.d.ts +0 -21
  247. package/dist/core/tools/render-utils.d.ts.map +0 -1
  248. package/dist/core/tools/render-utils.js +0 -49
  249. package/dist/core/tools/render-utils.js.map +0 -1
  250. package/dist/core/tools/tool-definition-wrapper.d.ts +0 -14
  251. package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  252. package/dist/core/tools/tool-definition-wrapper.js +0 -32
  253. package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  254. package/dist/core/tools/truncate.d.ts +0 -70
  255. package/dist/core/tools/truncate.d.ts.map +0 -1
  256. package/dist/core/tools/truncate.js +0 -205
  257. package/dist/core/tools/truncate.js.map +0 -1
  258. package/dist/core/tools/write.d.ts +0 -35
  259. package/dist/core/tools/write.d.ts.map +0 -1
  260. package/dist/core/tools/write.js +0 -216
  261. package/dist/core/tools/write.js.map +0 -1
  262. package/dist/index.d.ts +0 -28
  263. package/dist/index.d.ts.map +0 -1
  264. package/dist/index.js +0 -43
  265. package/dist/index.js.map +0 -1
  266. package/dist/lib/config.js +0 -22
  267. package/dist/lib/detect.js +0 -94
  268. package/dist/lib/display.js +0 -182
  269. package/dist/main.d.ts +0 -8
  270. package/dist/main.d.ts.map +0 -1
  271. package/dist/main.js +0 -806
  272. package/dist/main.js.map +0 -1
  273. package/dist/migrations.d.ts +0 -33
  274. package/dist/migrations.d.ts.map +0 -1
  275. package/dist/migrations.js +0 -261
  276. package/dist/migrations.js.map +0 -1
  277. package/dist/modes/index.d.ts +0 -9
  278. package/dist/modes/index.d.ts.map +0 -1
  279. package/dist/modes/index.js +0 -8
  280. package/dist/modes/index.js.map +0 -1
  281. package/dist/modes/interactive/components/armin.d.ts +0 -34
  282. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  283. package/dist/modes/interactive/components/armin.js +0 -333
  284. package/dist/modes/interactive/components/armin.js.map +0 -1
  285. package/dist/modes/interactive/components/assistant-message.d.ts +0 -18
  286. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  287. package/dist/modes/interactive/components/assistant-message.js +0 -107
  288. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  289. package/dist/modes/interactive/components/bash-execution.d.ts +0 -34
  290. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  291. package/dist/modes/interactive/components/bash-execution.js +0 -175
  292. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  293. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  294. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  295. package/dist/modes/interactive/components/bordered-loader.js +0 -51
  296. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  297. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
  298. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  299. package/dist/modes/interactive/components/branch-summary-message.js +0 -44
  300. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  301. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
  302. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  303. package/dist/modes/interactive/components/compaction-summary-message.js +0 -45
  304. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  305. package/dist/modes/interactive/components/config-selector.d.ts +0 -71
  306. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  307. package/dist/modes/interactive/components/config-selector.js +0 -479
  308. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  309. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
  310. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  311. package/dist/modes/interactive/components/countdown-timer.js +0 -33
  312. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  313. package/dist/modes/interactive/components/custom-editor.d.ts +0 -21
  314. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  315. package/dist/modes/interactive/components/custom-editor.js +0 -70
  316. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  317. package/dist/modes/interactive/components/custom-message.d.ts +0 -20
  318. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  319. package/dist/modes/interactive/components/custom-message.js +0 -79
  320. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  321. package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
  322. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  323. package/dist/modes/interactive/components/daxnuts.js +0 -140
  324. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
  325. package/dist/modes/interactive/components/diff.d.ts +0 -12
  326. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  327. package/dist/modes/interactive/components/diff.js +0 -133
  328. package/dist/modes/interactive/components/diff.js.map +0 -1
  329. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
  330. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  331. package/dist/modes/interactive/components/dynamic-border.js +0 -21
  332. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  333. package/dist/modes/interactive/components/extension-editor.d.ts +0 -20
  334. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  335. package/dist/modes/interactive/components/extension-editor.js +0 -111
  336. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  337. package/dist/modes/interactive/components/extension-input.d.ts +0 -23
  338. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  339. package/dist/modes/interactive/components/extension-input.js +0 -61
  340. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  341. package/dist/modes/interactive/components/extension-selector.d.ts +0 -24
  342. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  343. package/dist/modes/interactive/components/extension-selector.js +0 -78
  344. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  345. package/dist/modes/interactive/components/footer.d.ts +0 -27
  346. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  347. package/dist/modes/interactive/components/footer.js +0 -201
  348. package/dist/modes/interactive/components/footer.js.map +0 -1
  349. package/dist/modes/interactive/components/index.d.ts +0 -32
  350. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  351. package/dist/modes/interactive/components/index.js +0 -33
  352. package/dist/modes/interactive/components/index.js.map +0 -1
  353. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -8
  354. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  355. package/dist/modes/interactive/components/keybinding-hints.js +0 -22
  356. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  357. package/dist/modes/interactive/components/login-dialog.d.ts +0 -42
  358. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  359. package/dist/modes/interactive/components/login-dialog.js +0 -145
  360. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  361. package/dist/modes/interactive/components/model-selector.d.ts +0 -47
  362. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  363. package/dist/modes/interactive/components/model-selector.js +0 -275
  364. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  365. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -19
  366. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  367. package/dist/modes/interactive/components/oauth-selector.js +0 -97
  368. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  369. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -49
  370. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  371. package/dist/modes/interactive/components/scoped-models-selector.js +0 -275
  372. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  373. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
  374. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  375. package/dist/modes/interactive/components/session-selector-search.js +0 -155
  376. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  377. package/dist/modes/interactive/components/session-selector.d.ts +0 -95
  378. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  379. package/dist/modes/interactive/components/session-selector.js +0 -848
  380. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  381. package/dist/modes/interactive/components/settings-selector.d.ts +0 -58
  382. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  383. package/dist/modes/interactive/components/settings-selector.js +0 -301
  384. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  385. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  386. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  387. package/dist/modes/interactive/components/show-images-selector.js +0 -39
  388. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  389. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
  390. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  391. package/dist/modes/interactive/components/skill-invocation-message.js +0 -47
  392. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  393. package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  394. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  395. package/dist/modes/interactive/components/theme-selector.js +0 -50
  396. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  397. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -11
  398. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  399. package/dist/modes/interactive/components/thinking-selector.js +0 -51
  400. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  401. package/dist/modes/interactive/components/tool-execution.d.ts +0 -58
  402. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  403. package/dist/modes/interactive/components/tool-execution.js +0 -274
  404. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  405. package/dist/modes/interactive/components/tree-selector.d.ts +0 -89
  406. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  407. package/dist/modes/interactive/components/tree-selector.js +0 -1084
  408. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  409. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  410. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  411. package/dist/modes/interactive/components/user-message-selector.js +0 -113
  412. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  413. package/dist/modes/interactive/components/user-message.d.ts +0 -9
  414. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  415. package/dist/modes/interactive/components/user-message.js +0 -28
  416. package/dist/modes/interactive/components/user-message.js.map +0 -1
  417. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -24
  418. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  419. package/dist/modes/interactive/components/visual-truncate.js +0 -33
  420. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  421. package/dist/modes/interactive/interactive-mode.d.ts +0 -318
  422. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  423. package/dist/modes/interactive/interactive-mode.js +0 -3907
  424. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  425. package/dist/modes/interactive/theme/dark.json +0 -85
  426. package/dist/modes/interactive/theme/light.json +0 -84
  427. package/dist/modes/interactive/theme/theme-schema.json +0 -335
  428. package/dist/modes/interactive/theme/theme.d.ts +0 -81
  429. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  430. package/dist/modes/interactive/theme/theme.js +0 -970
  431. package/dist/modes/interactive/theme/theme.js.map +0 -1
  432. package/dist/modes/print-mode.d.ts +0 -28
  433. package/dist/modes/print-mode.d.ts.map +0 -1
  434. package/dist/modes/print-mode.js +0 -108
  435. package/dist/modes/print-mode.js.map +0 -1
  436. package/dist/modes/rpc/jsonl.d.ts +0 -17
  437. package/dist/modes/rpc/jsonl.d.ts.map +0 -1
  438. package/dist/modes/rpc/jsonl.js +0 -49
  439. package/dist/modes/rpc/jsonl.js.map +0 -1
  440. package/dist/modes/rpc/rpc-client.d.ts +0 -217
  441. package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  442. package/dist/modes/rpc/rpc-client.js +0 -401
  443. package/dist/modes/rpc/rpc-client.js.map +0 -1
  444. package/dist/modes/rpc/rpc-mode.d.ts +0 -20
  445. package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  446. package/dist/modes/rpc/rpc-mode.js +0 -542
  447. package/dist/modes/rpc/rpc-mode.js.map +0 -1
  448. package/dist/modes/rpc/rpc-types.d.ts +0 -408
  449. package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  450. package/dist/modes/rpc/rpc-types.js +0 -8
  451. package/dist/modes/rpc/rpc-types.js.map +0 -1
  452. package/dist/utils/changelog.d.ts +0 -21
  453. package/dist/utils/changelog.d.ts.map +0 -1
  454. package/dist/utils/changelog.js +0 -87
  455. package/dist/utils/changelog.js.map +0 -1
  456. package/dist/utils/child-process.d.ts +0 -11
  457. package/dist/utils/child-process.d.ts.map +0 -1
  458. package/dist/utils/child-process.js +0 -78
  459. package/dist/utils/child-process.js.map +0 -1
  460. package/dist/utils/clipboard-image.d.ts +0 -11
  461. package/dist/utils/clipboard-image.d.ts.map +0 -1
  462. package/dist/utils/clipboard-image.js +0 -245
  463. package/dist/utils/clipboard-image.js.map +0 -1
  464. package/dist/utils/clipboard-native.d.ts +0 -8
  465. package/dist/utils/clipboard-native.d.ts.map +0 -1
  466. package/dist/utils/clipboard-native.js +0 -14
  467. package/dist/utils/clipboard-native.js.map +0 -1
  468. package/dist/utils/clipboard.d.ts +0 -2
  469. package/dist/utils/clipboard.d.ts.map +0 -1
  470. package/dist/utils/clipboard.js +0 -78
  471. package/dist/utils/clipboard.js.map +0 -1
  472. package/dist/utils/exif-orientation.d.ts +0 -5
  473. package/dist/utils/exif-orientation.d.ts.map +0 -1
  474. package/dist/utils/exif-orientation.js +0 -158
  475. package/dist/utils/exif-orientation.js.map +0 -1
  476. package/dist/utils/frontmatter.d.ts +0 -8
  477. package/dist/utils/frontmatter.d.ts.map +0 -1
  478. package/dist/utils/frontmatter.js +0 -26
  479. package/dist/utils/frontmatter.js.map +0 -1
  480. package/dist/utils/git.d.ts +0 -26
  481. package/dist/utils/git.d.ts.map +0 -1
  482. package/dist/utils/git.js +0 -163
  483. package/dist/utils/git.js.map +0 -1
  484. package/dist/utils/image-convert.d.ts +0 -9
  485. package/dist/utils/image-convert.d.ts.map +0 -1
  486. package/dist/utils/image-convert.js +0 -39
  487. package/dist/utils/image-convert.js.map +0 -1
  488. package/dist/utils/image-resize.d.ts +0 -36
  489. package/dist/utils/image-resize.d.ts.map +0 -1
  490. package/dist/utils/image-resize.js +0 -137
  491. package/dist/utils/image-resize.js.map +0 -1
  492. package/dist/utils/mime.d.ts +0 -2
  493. package/dist/utils/mime.d.ts.map +0 -1
  494. package/dist/utils/mime.js +0 -26
  495. package/dist/utils/mime.js.map +0 -1
  496. package/dist/utils/photon.d.ts +0 -21
  497. package/dist/utils/photon.d.ts.map +0 -1
  498. package/dist/utils/photon.js +0 -121
  499. package/dist/utils/photon.js.map +0 -1
  500. package/dist/utils/shell.d.ts +0 -26
  501. package/dist/utils/shell.d.ts.map +0 -1
  502. package/dist/utils/shell.js +0 -186
  503. package/dist/utils/shell.js.map +0 -1
  504. package/dist/utils/sleep.d.ts +0 -5
  505. package/dist/utils/sleep.d.ts.map +0 -1
  506. package/dist/utils/sleep.js +0 -17
  507. package/dist/utils/sleep.js.map +0 -1
  508. package/dist/utils/tools-manager.d.ts +0 -3
  509. package/dist/utils/tools-manager.d.ts.map +0 -1
  510. package/dist/utils/tools-manager.js +0 -252
  511. package/dist/utils/tools-manager.js.map +0 -1
  512. package/dist/welcome/about.js +0 -50
  513. package/dist/welcome/auth.js +0 -126
  514. package/dist/welcome/intro.js +0 -90
  515. package/dist/welcome/qa.js +0 -131
  516. package/scripts/install-gum.sh +0 -141
@@ -1,970 +0,0 @@
1
- import * as fs from "node:fs";
2
- import * as path from "node:path";
3
- import { Type } from "@sinclair/typebox";
4
- import { TypeCompiler } from "@sinclair/typebox/compiler";
5
- import chalk from "chalk";
6
- import { highlight, supportsLanguage } from "cli-highlight";
7
- import { getCustomThemesDir, getThemesDir } from "../../../config.js";
8
- // ============================================================================
9
- // Types & Schema
10
- // ============================================================================
11
- const ColorValueSchema = Type.Union([
12
- Type.String(), // hex "#ff0000", var ref "primary", or empty ""
13
- Type.Integer({ minimum: 0, maximum: 255 }), // 256-color index
14
- ]);
15
- const ThemeJsonSchema = Type.Object({
16
- $schema: Type.Optional(Type.String()),
17
- name: Type.String(),
18
- vars: Type.Optional(Type.Record(Type.String(), ColorValueSchema)),
19
- colors: Type.Object({
20
- // Core UI (10 colors)
21
- accent: ColorValueSchema,
22
- border: ColorValueSchema,
23
- borderAccent: ColorValueSchema,
24
- borderMuted: ColorValueSchema,
25
- success: ColorValueSchema,
26
- error: ColorValueSchema,
27
- warning: ColorValueSchema,
28
- muted: ColorValueSchema,
29
- dim: ColorValueSchema,
30
- text: ColorValueSchema,
31
- thinkingText: ColorValueSchema,
32
- // Backgrounds & Content Text (11 colors)
33
- selectedBg: ColorValueSchema,
34
- userMessageBg: ColorValueSchema,
35
- userMessageText: ColorValueSchema,
36
- customMessageBg: ColorValueSchema,
37
- customMessageText: ColorValueSchema,
38
- customMessageLabel: ColorValueSchema,
39
- toolPendingBg: ColorValueSchema,
40
- toolSuccessBg: ColorValueSchema,
41
- toolErrorBg: ColorValueSchema,
42
- toolTitle: ColorValueSchema,
43
- toolOutput: ColorValueSchema,
44
- // Markdown (10 colors)
45
- mdHeading: ColorValueSchema,
46
- mdLink: ColorValueSchema,
47
- mdLinkUrl: ColorValueSchema,
48
- mdCode: ColorValueSchema,
49
- mdCodeBlock: ColorValueSchema,
50
- mdCodeBlockBorder: ColorValueSchema,
51
- mdQuote: ColorValueSchema,
52
- mdQuoteBorder: ColorValueSchema,
53
- mdHr: ColorValueSchema,
54
- mdListBullet: ColorValueSchema,
55
- // Tool Diffs (3 colors)
56
- toolDiffAdded: ColorValueSchema,
57
- toolDiffRemoved: ColorValueSchema,
58
- toolDiffContext: ColorValueSchema,
59
- // Syntax Highlighting (9 colors)
60
- syntaxComment: ColorValueSchema,
61
- syntaxKeyword: ColorValueSchema,
62
- syntaxFunction: ColorValueSchema,
63
- syntaxVariable: ColorValueSchema,
64
- syntaxString: ColorValueSchema,
65
- syntaxNumber: ColorValueSchema,
66
- syntaxType: ColorValueSchema,
67
- syntaxOperator: ColorValueSchema,
68
- syntaxPunctuation: ColorValueSchema,
69
- // Thinking Level Borders (6 colors)
70
- thinkingOff: ColorValueSchema,
71
- thinkingMinimal: ColorValueSchema,
72
- thinkingLow: ColorValueSchema,
73
- thinkingMedium: ColorValueSchema,
74
- thinkingHigh: ColorValueSchema,
75
- thinkingXhigh: ColorValueSchema,
76
- // Bash Mode (1 color)
77
- bashMode: ColorValueSchema,
78
- }),
79
- export: Type.Optional(Type.Object({
80
- pageBg: Type.Optional(ColorValueSchema),
81
- cardBg: Type.Optional(ColorValueSchema),
82
- infoBg: Type.Optional(ColorValueSchema),
83
- })),
84
- });
85
- const validateThemeJson = TypeCompiler.Compile(ThemeJsonSchema);
86
- // ============================================================================
87
- // Color Utilities
88
- // ============================================================================
89
- function detectColorMode() {
90
- const colorterm = process.env.COLORTERM;
91
- if (colorterm === "truecolor" || colorterm === "24bit") {
92
- return "truecolor";
93
- }
94
- // Windows Terminal supports truecolor
95
- if (process.env.WT_SESSION) {
96
- return "truecolor";
97
- }
98
- const term = process.env.TERM || "";
99
- // Fall back to 256color for truly limited terminals
100
- if (term === "dumb" || term === "" || term === "linux") {
101
- return "256color";
102
- }
103
- // Terminal.app also doesn't support truecolor
104
- if (process.env.TERM_PROGRAM === "Apple_Terminal") {
105
- return "256color";
106
- }
107
- // GNU screen doesn't support truecolor unless explicitly opted in via COLORTERM=truecolor.
108
- // TERM under screen is typically "screen", "screen-256color", or "screen.xterm-256color".
109
- if (term === "screen" || term.startsWith("screen-") || term.startsWith("screen.")) {
110
- return "256color";
111
- }
112
- // Assume truecolor for everything else - virtually all modern terminals support it
113
- return "truecolor";
114
- }
115
- function hexToRgb(hex) {
116
- const cleaned = hex.replace("#", "");
117
- if (cleaned.length !== 6) {
118
- throw new Error(`Invalid hex color: ${hex}`);
119
- }
120
- const r = parseInt(cleaned.substring(0, 2), 16);
121
- const g = parseInt(cleaned.substring(2, 4), 16);
122
- const b = parseInt(cleaned.substring(4, 6), 16);
123
- if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
124
- throw new Error(`Invalid hex color: ${hex}`);
125
- }
126
- return { r, g, b };
127
- }
128
- // The 6x6x6 color cube channel values (indices 0-5)
129
- const CUBE_VALUES = [0, 95, 135, 175, 215, 255];
130
- // Grayscale ramp values (indices 232-255, 24 grays from 8 to 238)
131
- const GRAY_VALUES = Array.from({ length: 24 }, (_, i) => 8 + i * 10);
132
- function findClosestCubeIndex(value) {
133
- let minDist = Infinity;
134
- let minIdx = 0;
135
- for (let i = 0; i < CUBE_VALUES.length; i++) {
136
- const dist = Math.abs(value - CUBE_VALUES[i]);
137
- if (dist < minDist) {
138
- minDist = dist;
139
- minIdx = i;
140
- }
141
- }
142
- return minIdx;
143
- }
144
- function findClosestGrayIndex(gray) {
145
- let minDist = Infinity;
146
- let minIdx = 0;
147
- for (let i = 0; i < GRAY_VALUES.length; i++) {
148
- const dist = Math.abs(gray - GRAY_VALUES[i]);
149
- if (dist < minDist) {
150
- minDist = dist;
151
- minIdx = i;
152
- }
153
- }
154
- return minIdx;
155
- }
156
- function colorDistance(r1, g1, b1, r2, g2, b2) {
157
- // Weighted Euclidean distance (human eye is more sensitive to green)
158
- const dr = r1 - r2;
159
- const dg = g1 - g2;
160
- const db = b1 - b2;
161
- return dr * dr * 0.299 + dg * dg * 0.587 + db * db * 0.114;
162
- }
163
- function rgbTo256(r, g, b) {
164
- // Find closest color in the 6x6x6 cube
165
- const rIdx = findClosestCubeIndex(r);
166
- const gIdx = findClosestCubeIndex(g);
167
- const bIdx = findClosestCubeIndex(b);
168
- const cubeR = CUBE_VALUES[rIdx];
169
- const cubeG = CUBE_VALUES[gIdx];
170
- const cubeB = CUBE_VALUES[bIdx];
171
- const cubeIndex = 16 + 36 * rIdx + 6 * gIdx + bIdx;
172
- const cubeDist = colorDistance(r, g, b, cubeR, cubeG, cubeB);
173
- // Find closest grayscale
174
- const gray = Math.round(0.299 * r + 0.587 * g + 0.114 * b);
175
- const grayIdx = findClosestGrayIndex(gray);
176
- const grayValue = GRAY_VALUES[grayIdx];
177
- const grayIndex = 232 + grayIdx;
178
- const grayDist = colorDistance(r, g, b, grayValue, grayValue, grayValue);
179
- // Check if color has noticeable saturation (hue matters)
180
- // If max-min spread is significant, prefer cube to preserve tint
181
- const maxC = Math.max(r, g, b);
182
- const minC = Math.min(r, g, b);
183
- const spread = maxC - minC;
184
- // Only consider grayscale if color is nearly neutral (spread < 10)
185
- // AND grayscale is actually closer
186
- if (spread < 10 && grayDist < cubeDist) {
187
- return grayIndex;
188
- }
189
- return cubeIndex;
190
- }
191
- function hexTo256(hex) {
192
- const { r, g, b } = hexToRgb(hex);
193
- return rgbTo256(r, g, b);
194
- }
195
- function fgAnsi(color, mode) {
196
- if (color === "")
197
- return "\x1b[39m";
198
- if (typeof color === "number")
199
- return `\x1b[38;5;${color}m`;
200
- if (color.startsWith("#")) {
201
- if (mode === "truecolor") {
202
- const { r, g, b } = hexToRgb(color);
203
- return `\x1b[38;2;${r};${g};${b}m`;
204
- }
205
- else {
206
- const index = hexTo256(color);
207
- return `\x1b[38;5;${index}m`;
208
- }
209
- }
210
- throw new Error(`Invalid color value: ${color}`);
211
- }
212
- function bgAnsi(color, mode) {
213
- if (color === "")
214
- return "\x1b[49m";
215
- if (typeof color === "number")
216
- return `\x1b[48;5;${color}m`;
217
- if (color.startsWith("#")) {
218
- if (mode === "truecolor") {
219
- const { r, g, b } = hexToRgb(color);
220
- return `\x1b[48;2;${r};${g};${b}m`;
221
- }
222
- else {
223
- const index = hexTo256(color);
224
- return `\x1b[48;5;${index}m`;
225
- }
226
- }
227
- throw new Error(`Invalid color value: ${color}`);
228
- }
229
- function resolveVarRefs(value, vars, visited = new Set()) {
230
- if (typeof value === "number" || value === "" || value.startsWith("#")) {
231
- return value;
232
- }
233
- if (visited.has(value)) {
234
- throw new Error(`Circular variable reference detected: ${value}`);
235
- }
236
- if (!(value in vars)) {
237
- throw new Error(`Variable reference not found: ${value}`);
238
- }
239
- visited.add(value);
240
- return resolveVarRefs(vars[value], vars, visited);
241
- }
242
- function resolveThemeColors(colors, vars = {}) {
243
- const resolved = {};
244
- for (const [key, value] of Object.entries(colors)) {
245
- resolved[key] = resolveVarRefs(value, vars);
246
- }
247
- return resolved;
248
- }
249
- // ============================================================================
250
- // Theme Class
251
- // ============================================================================
252
- export class Theme {
253
- name;
254
- sourcePath;
255
- sourceInfo;
256
- fgColors;
257
- bgColors;
258
- mode;
259
- constructor(fgColors, bgColors, mode, options = {}) {
260
- this.name = options.name;
261
- this.sourcePath = options.sourcePath;
262
- this.sourceInfo = options.sourceInfo;
263
- this.mode = mode;
264
- this.fgColors = new Map();
265
- for (const [key, value] of Object.entries(fgColors)) {
266
- this.fgColors.set(key, fgAnsi(value, mode));
267
- }
268
- this.bgColors = new Map();
269
- for (const [key, value] of Object.entries(bgColors)) {
270
- this.bgColors.set(key, bgAnsi(value, mode));
271
- }
272
- }
273
- fg(color, text) {
274
- const ansi = this.fgColors.get(color);
275
- if (!ansi)
276
- throw new Error(`Unknown theme color: ${color}`);
277
- return `${ansi}${text}\x1b[39m`; // Reset only foreground color
278
- }
279
- bg(color, text) {
280
- const ansi = this.bgColors.get(color);
281
- if (!ansi)
282
- throw new Error(`Unknown theme background color: ${color}`);
283
- return `${ansi}${text}\x1b[49m`; // Reset only background color
284
- }
285
- bold(text) {
286
- return chalk.bold(text);
287
- }
288
- italic(text) {
289
- return chalk.italic(text);
290
- }
291
- underline(text) {
292
- return chalk.underline(text);
293
- }
294
- inverse(text) {
295
- return chalk.inverse(text);
296
- }
297
- strikethrough(text) {
298
- return chalk.strikethrough(text);
299
- }
300
- getFgAnsi(color) {
301
- const ansi = this.fgColors.get(color);
302
- if (!ansi)
303
- throw new Error(`Unknown theme color: ${color}`);
304
- return ansi;
305
- }
306
- getBgAnsi(color) {
307
- const ansi = this.bgColors.get(color);
308
- if (!ansi)
309
- throw new Error(`Unknown theme background color: ${color}`);
310
- return ansi;
311
- }
312
- getColorMode() {
313
- return this.mode;
314
- }
315
- getThinkingBorderColor(level) {
316
- // Map thinking levels to dedicated theme colors
317
- switch (level) {
318
- case "off":
319
- return (str) => this.fg("thinkingOff", str);
320
- case "minimal":
321
- return (str) => this.fg("thinkingMinimal", str);
322
- case "low":
323
- return (str) => this.fg("thinkingLow", str);
324
- case "medium":
325
- return (str) => this.fg("thinkingMedium", str);
326
- case "high":
327
- return (str) => this.fg("thinkingHigh", str);
328
- case "xhigh":
329
- return (str) => this.fg("thinkingXhigh", str);
330
- default:
331
- return (str) => this.fg("thinkingOff", str);
332
- }
333
- }
334
- getBashModeBorderColor() {
335
- return (str) => this.fg("bashMode", str);
336
- }
337
- }
338
- // ============================================================================
339
- // Theme Loading
340
- // ============================================================================
341
- let BUILTIN_THEMES;
342
- function getBuiltinThemes() {
343
- if (!BUILTIN_THEMES) {
344
- const themesDir = getThemesDir();
345
- const darkPath = path.join(themesDir, "dark.json");
346
- const lightPath = path.join(themesDir, "light.json");
347
- BUILTIN_THEMES = {
348
- dark: JSON.parse(fs.readFileSync(darkPath, "utf-8")),
349
- light: JSON.parse(fs.readFileSync(lightPath, "utf-8")),
350
- };
351
- }
352
- return BUILTIN_THEMES;
353
- }
354
- export function getAvailableThemes() {
355
- const themes = new Set(Object.keys(getBuiltinThemes()));
356
- const customThemesDir = getCustomThemesDir();
357
- if (fs.existsSync(customThemesDir)) {
358
- const files = fs.readdirSync(customThemesDir);
359
- for (const file of files) {
360
- if (file.endsWith(".json")) {
361
- themes.add(file.slice(0, -5));
362
- }
363
- }
364
- }
365
- for (const name of registeredThemes.keys()) {
366
- themes.add(name);
367
- }
368
- return Array.from(themes).sort();
369
- }
370
- export function getAvailableThemesWithPaths() {
371
- const themesDir = getThemesDir();
372
- const customThemesDir = getCustomThemesDir();
373
- const result = [];
374
- // Built-in themes
375
- for (const name of Object.keys(getBuiltinThemes())) {
376
- result.push({ name, path: path.join(themesDir, `${name}.json`) });
377
- }
378
- // Custom themes
379
- if (fs.existsSync(customThemesDir)) {
380
- for (const file of fs.readdirSync(customThemesDir)) {
381
- if (file.endsWith(".json")) {
382
- const name = file.slice(0, -5);
383
- if (!result.some((t) => t.name === name)) {
384
- result.push({ name, path: path.join(customThemesDir, file) });
385
- }
386
- }
387
- }
388
- }
389
- for (const [name, theme] of registeredThemes.entries()) {
390
- if (!result.some((t) => t.name === name)) {
391
- result.push({ name, path: theme.sourcePath });
392
- }
393
- }
394
- return result.sort((a, b) => a.name.localeCompare(b.name));
395
- }
396
- function parseThemeJson(label, json) {
397
- if (!validateThemeJson.Check(json)) {
398
- const errors = Array.from(validateThemeJson.Errors(json));
399
- const missingColors = [];
400
- const otherErrors = [];
401
- for (const e of errors) {
402
- // Check for missing required color properties
403
- const match = e.path.match(/^\/colors\/(\w+)$/);
404
- if (match && e.message.includes("Required")) {
405
- missingColors.push(match[1]);
406
- }
407
- else {
408
- otherErrors.push(` - ${e.path}: ${e.message}`);
409
- }
410
- }
411
- let errorMessage = `Invalid theme "${label}":\n`;
412
- if (missingColors.length > 0) {
413
- errorMessage += "\nMissing required color tokens:\n";
414
- errorMessage += missingColors.map((c) => ` - ${c}`).join("\n");
415
- errorMessage += '\n\nPlease add these colors to your theme\'s "colors" object.';
416
- errorMessage += "\nSee the built-in themes (dark.json, light.json) for reference values.";
417
- }
418
- if (otherErrors.length > 0) {
419
- errorMessage += `\n\nOther errors:\n${otherErrors.join("\n")}`;
420
- }
421
- throw new Error(errorMessage);
422
- }
423
- return json;
424
- }
425
- function parseThemeJsonContent(label, content) {
426
- let json;
427
- try {
428
- json = JSON.parse(content);
429
- }
430
- catch (error) {
431
- throw new Error(`Failed to parse theme ${label}: ${error}`);
432
- }
433
- return parseThemeJson(label, json);
434
- }
435
- function loadThemeJson(name) {
436
- const builtinThemes = getBuiltinThemes();
437
- if (name in builtinThemes) {
438
- return builtinThemes[name];
439
- }
440
- const registeredTheme = registeredThemes.get(name);
441
- if (registeredTheme?.sourcePath) {
442
- const content = fs.readFileSync(registeredTheme.sourcePath, "utf-8");
443
- return parseThemeJsonContent(registeredTheme.sourcePath, content);
444
- }
445
- if (registeredTheme) {
446
- throw new Error(`Theme "${name}" does not have a source path for export`);
447
- }
448
- const customThemesDir = getCustomThemesDir();
449
- const themePath = path.join(customThemesDir, `${name}.json`);
450
- if (!fs.existsSync(themePath)) {
451
- throw new Error(`Theme not found: ${name}`);
452
- }
453
- const content = fs.readFileSync(themePath, "utf-8");
454
- return parseThemeJsonContent(name, content);
455
- }
456
- function createTheme(themeJson, mode, sourcePath) {
457
- const colorMode = mode ?? detectColorMode();
458
- const resolvedColors = resolveThemeColors(themeJson.colors, themeJson.vars);
459
- const fgColors = {};
460
- const bgColors = {};
461
- const bgColorKeys = new Set([
462
- "selectedBg",
463
- "userMessageBg",
464
- "customMessageBg",
465
- "toolPendingBg",
466
- "toolSuccessBg",
467
- "toolErrorBg",
468
- ]);
469
- for (const [key, value] of Object.entries(resolvedColors)) {
470
- if (bgColorKeys.has(key)) {
471
- bgColors[key] = value;
472
- }
473
- else {
474
- fgColors[key] = value;
475
- }
476
- }
477
- return new Theme(fgColors, bgColors, colorMode, {
478
- name: themeJson.name,
479
- sourcePath,
480
- });
481
- }
482
- export function loadThemeFromPath(themePath, mode) {
483
- const content = fs.readFileSync(themePath, "utf-8");
484
- const themeJson = parseThemeJsonContent(themePath, content);
485
- return createTheme(themeJson, mode, themePath);
486
- }
487
- function loadTheme(name, mode) {
488
- const registeredTheme = registeredThemes.get(name);
489
- if (registeredTheme) {
490
- return registeredTheme;
491
- }
492
- const themeJson = loadThemeJson(name);
493
- return createTheme(themeJson, mode);
494
- }
495
- export function getThemeByName(name) {
496
- try {
497
- return loadTheme(name);
498
- }
499
- catch {
500
- return undefined;
501
- }
502
- }
503
- function detectTerminalBackground() {
504
- const colorfgbg = process.env.COLORFGBG || "";
505
- if (colorfgbg) {
506
- const parts = colorfgbg.split(";");
507
- if (parts.length >= 2) {
508
- const bg = parseInt(parts[1], 10);
509
- if (!Number.isNaN(bg)) {
510
- const result = bg < 8 ? "dark" : "light";
511
- return result;
512
- }
513
- }
514
- }
515
- return "dark";
516
- }
517
- function getDefaultTheme() {
518
- return detectTerminalBackground();
519
- }
520
- // ============================================================================
521
- // Global Theme Instance
522
- // ============================================================================
523
- // Use globalThis to share theme across module loaders (tsx + jiti in dev mode)
524
- const THEME_KEY = Symbol.for("@mariozechner/pi-coding-agent:theme");
525
- // Export theme as a getter that reads from globalThis
526
- // This ensures all module instances (tsx, jiti) see the same theme
527
- export const theme = new Proxy({}, {
528
- get(_target, prop) {
529
- const t = globalThis[THEME_KEY];
530
- if (!t)
531
- throw new Error("Theme not initialized. Call initTheme() first.");
532
- return t[prop];
533
- },
534
- });
535
- function setGlobalTheme(t) {
536
- globalThis[THEME_KEY] = t;
537
- }
538
- let currentThemeName;
539
- let themeWatcher;
540
- let themeReloadTimer;
541
- let onThemeChangeCallback;
542
- const registeredThemes = new Map();
543
- export function setRegisteredThemes(themes) {
544
- registeredThemes.clear();
545
- for (const theme of themes) {
546
- if (theme.name) {
547
- registeredThemes.set(theme.name, theme);
548
- }
549
- }
550
- }
551
- export function initTheme(themeName, enableWatcher = false) {
552
- const name = themeName ?? getDefaultTheme();
553
- currentThemeName = name;
554
- try {
555
- setGlobalTheme(loadTheme(name));
556
- if (enableWatcher) {
557
- startThemeWatcher();
558
- }
559
- }
560
- catch (_error) {
561
- // Theme is invalid - fall back to dark theme silently
562
- currentThemeName = "dark";
563
- setGlobalTheme(loadTheme("dark"));
564
- // Don't start watcher for fallback theme
565
- }
566
- }
567
- export function setTheme(name, enableWatcher = false) {
568
- currentThemeName = name;
569
- try {
570
- setGlobalTheme(loadTheme(name));
571
- if (enableWatcher) {
572
- startThemeWatcher();
573
- }
574
- if (onThemeChangeCallback) {
575
- onThemeChangeCallback();
576
- }
577
- return { success: true };
578
- }
579
- catch (error) {
580
- // Theme is invalid - fall back to dark theme
581
- currentThemeName = "dark";
582
- setGlobalTheme(loadTheme("dark"));
583
- // Don't start watcher for fallback theme
584
- return {
585
- success: false,
586
- error: error instanceof Error ? error.message : String(error),
587
- };
588
- }
589
- }
590
- export function setThemeInstance(themeInstance) {
591
- setGlobalTheme(themeInstance);
592
- currentThemeName = "<in-memory>";
593
- stopThemeWatcher(); // Can't watch a direct instance
594
- if (onThemeChangeCallback) {
595
- onThemeChangeCallback();
596
- }
597
- }
598
- export function onThemeChange(callback) {
599
- onThemeChangeCallback = callback;
600
- }
601
- function startThemeWatcher() {
602
- stopThemeWatcher();
603
- // Only watch if it's a custom theme (not built-in)
604
- if (!currentThemeName || currentThemeName === "dark" || currentThemeName === "light") {
605
- return;
606
- }
607
- const customThemesDir = getCustomThemesDir();
608
- const watchedThemeName = currentThemeName;
609
- const watchedFileName = `${watchedThemeName}.json`;
610
- const themeFile = path.join(customThemesDir, watchedFileName);
611
- // Only watch if the file exists
612
- if (!fs.existsSync(themeFile)) {
613
- return;
614
- }
615
- const scheduleReload = () => {
616
- if (themeReloadTimer) {
617
- clearTimeout(themeReloadTimer);
618
- }
619
- themeReloadTimer = setTimeout(() => {
620
- themeReloadTimer = undefined;
621
- // Ignore stale timers after switching themes or stopping the watcher
622
- if (currentThemeName !== watchedThemeName) {
623
- return;
624
- }
625
- // Keep the last successfully loaded theme active if the file is temporarily missing
626
- if (!fs.existsSync(themeFile)) {
627
- return;
628
- }
629
- try {
630
- // Reload the theme from disk and refresh the registry cache
631
- const reloadedTheme = loadThemeFromPath(themeFile);
632
- registeredThemes.set(watchedThemeName, reloadedTheme);
633
- setGlobalTheme(reloadedTheme);
634
- // Notify callback (to invalidate UI)
635
- if (onThemeChangeCallback) {
636
- onThemeChangeCallback();
637
- }
638
- }
639
- catch (_error) {
640
- // Ignore errors (file might be in invalid state while being edited)
641
- }
642
- }, 100);
643
- };
644
- try {
645
- themeWatcher = fs.watch(customThemesDir, (_eventType, filename) => {
646
- if (currentThemeName !== watchedThemeName) {
647
- return;
648
- }
649
- if (!filename) {
650
- scheduleReload();
651
- return;
652
- }
653
- const changedFile = String(filename);
654
- if (changedFile !== watchedFileName) {
655
- return;
656
- }
657
- scheduleReload();
658
- });
659
- }
660
- catch (_error) {
661
- // Ignore errors starting watcher
662
- }
663
- }
664
- export function stopThemeWatcher() {
665
- if (themeReloadTimer) {
666
- clearTimeout(themeReloadTimer);
667
- themeReloadTimer = undefined;
668
- }
669
- if (themeWatcher) {
670
- themeWatcher.close();
671
- themeWatcher = undefined;
672
- }
673
- }
674
- // ============================================================================
675
- // HTML Export Helpers
676
- // ============================================================================
677
- /**
678
- * Convert a 256-color index to hex string.
679
- * Indices 0-15: basic colors (approximate)
680
- * Indices 16-231: 6x6x6 color cube
681
- * Indices 232-255: grayscale ramp
682
- */
683
- function ansi256ToHex(index) {
684
- // Basic colors (0-15) - approximate common terminal values
685
- const basicColors = [
686
- "#000000",
687
- "#800000",
688
- "#008000",
689
- "#808000",
690
- "#000080",
691
- "#800080",
692
- "#008080",
693
- "#c0c0c0",
694
- "#808080",
695
- "#ff0000",
696
- "#00ff00",
697
- "#ffff00",
698
- "#0000ff",
699
- "#ff00ff",
700
- "#00ffff",
701
- "#ffffff",
702
- ];
703
- if (index < 16) {
704
- return basicColors[index];
705
- }
706
- // Color cube (16-231): 6x6x6 = 216 colors
707
- if (index < 232) {
708
- const cubeIndex = index - 16;
709
- const r = Math.floor(cubeIndex / 36);
710
- const g = Math.floor((cubeIndex % 36) / 6);
711
- const b = cubeIndex % 6;
712
- const toHex = (n) => (n === 0 ? 0 : 55 + n * 40).toString(16).padStart(2, "0");
713
- return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
714
- }
715
- // Grayscale (232-255): 24 shades
716
- const gray = 8 + (index - 232) * 10;
717
- const grayHex = gray.toString(16).padStart(2, "0");
718
- return `#${grayHex}${grayHex}${grayHex}`;
719
- }
720
- /**
721
- * Get resolved theme colors as CSS-compatible hex strings.
722
- * Used by HTML export to generate CSS custom properties.
723
- */
724
- export function getResolvedThemeColors(themeName) {
725
- const name = themeName ?? currentThemeName ?? getDefaultTheme();
726
- const isLight = name === "light";
727
- const themeJson = loadThemeJson(name);
728
- const resolved = resolveThemeColors(themeJson.colors, themeJson.vars);
729
- // Default text color for empty values (terminal uses default fg color)
730
- const defaultText = isLight ? "#000000" : "#e5e5e7";
731
- const cssColors = {};
732
- for (const [key, value] of Object.entries(resolved)) {
733
- if (typeof value === "number") {
734
- cssColors[key] = ansi256ToHex(value);
735
- }
736
- else if (value === "") {
737
- // Empty means default terminal color - use sensible fallback for HTML
738
- cssColors[key] = defaultText;
739
- }
740
- else {
741
- cssColors[key] = value;
742
- }
743
- }
744
- return cssColors;
745
- }
746
- /**
747
- * Check if a theme is a "light" theme (for CSS that needs light/dark variants).
748
- */
749
- export function isLightTheme(themeName) {
750
- // Currently just check the name - could be extended to analyze colors
751
- return themeName === "light";
752
- }
753
- /**
754
- * Get explicit export colors from theme JSON, if specified.
755
- * Returns undefined for each color that isn't explicitly set.
756
- */
757
- export function getThemeExportColors(themeName) {
758
- const name = themeName ?? currentThemeName ?? getDefaultTheme();
759
- try {
760
- const themeJson = loadThemeJson(name);
761
- const exportSection = themeJson.export;
762
- if (!exportSection)
763
- return {};
764
- const vars = themeJson.vars ?? {};
765
- const resolve = (value) => {
766
- if (value === undefined)
767
- return undefined;
768
- const resolved = resolveVarRefs(value, vars);
769
- if (typeof resolved === "number")
770
- return ansi256ToHex(resolved);
771
- if (resolved === "")
772
- return undefined;
773
- return resolved;
774
- };
775
- return {
776
- pageBg: resolve(exportSection.pageBg),
777
- cardBg: resolve(exportSection.cardBg),
778
- infoBg: resolve(exportSection.infoBg),
779
- };
780
- }
781
- catch {
782
- return {};
783
- }
784
- }
785
- let cachedHighlightThemeFor;
786
- let cachedCliHighlightTheme;
787
- function buildCliHighlightTheme(t) {
788
- return {
789
- keyword: (s) => t.fg("syntaxKeyword", s),
790
- built_in: (s) => t.fg("syntaxType", s),
791
- literal: (s) => t.fg("syntaxNumber", s),
792
- number: (s) => t.fg("syntaxNumber", s),
793
- string: (s) => t.fg("syntaxString", s),
794
- comment: (s) => t.fg("syntaxComment", s),
795
- function: (s) => t.fg("syntaxFunction", s),
796
- title: (s) => t.fg("syntaxFunction", s),
797
- class: (s) => t.fg("syntaxType", s),
798
- type: (s) => t.fg("syntaxType", s),
799
- attr: (s) => t.fg("syntaxVariable", s),
800
- variable: (s) => t.fg("syntaxVariable", s),
801
- params: (s) => t.fg("syntaxVariable", s),
802
- operator: (s) => t.fg("syntaxOperator", s),
803
- punctuation: (s) => t.fg("syntaxPunctuation", s),
804
- };
805
- }
806
- function getCliHighlightTheme(t) {
807
- if (cachedHighlightThemeFor !== t || !cachedCliHighlightTheme) {
808
- cachedHighlightThemeFor = t;
809
- cachedCliHighlightTheme = buildCliHighlightTheme(t);
810
- }
811
- return cachedCliHighlightTheme;
812
- }
813
- /**
814
- * Highlight code with syntax coloring based on file extension or language.
815
- * Returns array of highlighted lines.
816
- */
817
- export function highlightCode(code, lang) {
818
- // Validate language before highlighting to avoid stderr spam from cli-highlight
819
- const validLang = lang && supportsLanguage(lang) ? lang : undefined;
820
- // Skip highlighting when no valid language is specified. cli-highlight's
821
- // auto-detection is unreliable and can misidentify prose as AppleScript,
822
- // LiveCodeServer, etc., coloring random English words as keywords.
823
- if (!validLang) {
824
- return code.split("\n").map((line) => theme.fg("mdCodeBlock", line));
825
- }
826
- const opts = {
827
- language: validLang,
828
- ignoreIllegals: true,
829
- theme: getCliHighlightTheme(theme),
830
- };
831
- try {
832
- return highlight(code, opts).split("\n");
833
- }
834
- catch {
835
- return code.split("\n");
836
- }
837
- }
838
- /**
839
- * Get language identifier from file path extension.
840
- */
841
- export function getLanguageFromPath(filePath) {
842
- const ext = filePath.split(".").pop()?.toLowerCase();
843
- if (!ext)
844
- return undefined;
845
- const extToLang = {
846
- ts: "typescript",
847
- tsx: "typescript",
848
- js: "javascript",
849
- jsx: "javascript",
850
- mjs: "javascript",
851
- cjs: "javascript",
852
- py: "python",
853
- rb: "ruby",
854
- rs: "rust",
855
- go: "go",
856
- java: "java",
857
- kt: "kotlin",
858
- swift: "swift",
859
- c: "c",
860
- h: "c",
861
- cpp: "cpp",
862
- cc: "cpp",
863
- cxx: "cpp",
864
- hpp: "cpp",
865
- cs: "csharp",
866
- php: "php",
867
- sh: "bash",
868
- bash: "bash",
869
- zsh: "bash",
870
- fish: "fish",
871
- ps1: "powershell",
872
- sql: "sql",
873
- html: "html",
874
- htm: "html",
875
- css: "css",
876
- scss: "scss",
877
- sass: "sass",
878
- less: "less",
879
- json: "json",
880
- yaml: "yaml",
881
- yml: "yaml",
882
- toml: "toml",
883
- xml: "xml",
884
- md: "markdown",
885
- markdown: "markdown",
886
- dockerfile: "dockerfile",
887
- makefile: "makefile",
888
- cmake: "cmake",
889
- lua: "lua",
890
- perl: "perl",
891
- r: "r",
892
- scala: "scala",
893
- clj: "clojure",
894
- ex: "elixir",
895
- exs: "elixir",
896
- erl: "erlang",
897
- hs: "haskell",
898
- ml: "ocaml",
899
- vim: "vim",
900
- graphql: "graphql",
901
- proto: "protobuf",
902
- tf: "hcl",
903
- hcl: "hcl",
904
- };
905
- return extToLang[ext];
906
- }
907
- export function getMarkdownTheme() {
908
- return {
909
- heading: (text) => theme.fg("mdHeading", text),
910
- link: (text) => theme.fg("mdLink", text),
911
- linkUrl: (text) => theme.fg("mdLinkUrl", text),
912
- code: (text) => theme.fg("mdCode", text),
913
- codeBlock: (text) => theme.fg("mdCodeBlock", text),
914
- codeBlockBorder: (text) => theme.fg("mdCodeBlockBorder", text),
915
- quote: (text) => theme.fg("mdQuote", text),
916
- quoteBorder: (text) => theme.fg("mdQuoteBorder", text),
917
- hr: (text) => theme.fg("mdHr", text),
918
- listBullet: (text) => theme.fg("mdListBullet", text),
919
- bold: (text) => theme.bold(text),
920
- italic: (text) => theme.italic(text),
921
- underline: (text) => theme.underline(text),
922
- strikethrough: (text) => chalk.strikethrough(text),
923
- highlightCode: (code, lang) => {
924
- // Validate language before highlighting to avoid stderr spam from cli-highlight
925
- const validLang = lang && supportsLanguage(lang) ? lang : undefined;
926
- // Skip highlighting when no valid language is specified. cli-highlight's
927
- // auto-detection is unreliable and can misidentify prose as AppleScript,
928
- // LiveCodeServer, etc., coloring random English words as keywords.
929
- if (!validLang) {
930
- return code.split("\n").map((line) => theme.fg("mdCodeBlock", line));
931
- }
932
- const opts = {
933
- language: validLang,
934
- ignoreIllegals: true,
935
- theme: getCliHighlightTheme(theme),
936
- };
937
- try {
938
- return highlight(code, opts).split("\n");
939
- }
940
- catch {
941
- return code.split("\n").map((line) => theme.fg("mdCodeBlock", line));
942
- }
943
- },
944
- };
945
- }
946
- export function getSelectListTheme() {
947
- return {
948
- selectedPrefix: (text) => theme.fg("accent", text),
949
- selectedText: (text) => theme.fg("accent", text),
950
- description: (text) => theme.fg("muted", text),
951
- scrollInfo: (text) => theme.fg("muted", text),
952
- noMatch: (text) => theme.fg("muted", text),
953
- };
954
- }
955
- export function getEditorTheme() {
956
- return {
957
- borderColor: (text) => theme.fg("borderMuted", text),
958
- selectList: getSelectListTheme(),
959
- };
960
- }
961
- export function getSettingsListTheme() {
962
- return {
963
- label: (text, selected) => (selected ? theme.fg("accent", text) : text),
964
- value: (text, selected) => (selected ? theme.fg("accent", text) : theme.fg("muted", text)),
965
- description: (text) => theme.fg("dim", text),
966
- cursor: theme.fg("accent", "→ "),
967
- hint: (text) => theme.fg("dim", text),
968
- };
969
- }
970
- //# sourceMappingURL=theme.js.map