meetsoma 0.3.2 → 0.3.3

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 (515) hide show
  1. package/dist/thin-cli.js +56 -13
  2. package/package.json +42 -89
  3. package/bin/gum +0 -0
  4. package/dist/bun/cli.d.ts +0 -3
  5. package/dist/bun/cli.d.ts.map +0 -1
  6. package/dist/bun/cli.js +0 -7
  7. package/dist/bun/cli.js.map +0 -1
  8. package/dist/bun/register-bedrock.d.ts +0 -2
  9. package/dist/bun/register-bedrock.d.ts.map +0 -1
  10. package/dist/bun/register-bedrock.js +0 -4
  11. package/dist/bun/register-bedrock.js.map +0 -1
  12. package/dist/cli/args.d.ts +0 -49
  13. package/dist/cli/args.d.ts.map +0 -1
  14. package/dist/cli/args.js +0 -304
  15. package/dist/cli/args.js.map +0 -1
  16. package/dist/cli/config-selector.d.ts +0 -14
  17. package/dist/cli/config-selector.d.ts.map +0 -1
  18. package/dist/cli/config-selector.js +0 -31
  19. package/dist/cli/config-selector.js.map +0 -1
  20. package/dist/cli/file-processor.d.ts +0 -15
  21. package/dist/cli/file-processor.d.ts.map +0 -1
  22. package/dist/cli/file-processor.js +0 -83
  23. package/dist/cli/file-processor.js.map +0 -1
  24. package/dist/cli/initial-message.d.ts +0 -18
  25. package/dist/cli/initial-message.d.ts.map +0 -1
  26. package/dist/cli/initial-message.js +0 -22
  27. package/dist/cli/initial-message.js.map +0 -1
  28. package/dist/cli/list-models.d.ts +0 -9
  29. package/dist/cli/list-models.d.ts.map +0 -1
  30. package/dist/cli/list-models.js +0 -92
  31. package/dist/cli/list-models.js.map +0 -1
  32. package/dist/cli/session-picker.d.ts +0 -9
  33. package/dist/cli/session-picker.d.ts.map +0 -1
  34. package/dist/cli/session-picker.js +0 -35
  35. package/dist/cli/session-picker.js.map +0 -1
  36. package/dist/cli.d.ts +0 -3
  37. package/dist/cli.d.ts.map +0 -1
  38. package/dist/cli.js +0 -601
  39. package/dist/cli.js.map +0 -1
  40. package/dist/config.d.ts +0 -68
  41. package/dist/config.d.ts.map +0 -1
  42. package/dist/config.js +0 -203
  43. package/dist/config.js.map +0 -1
  44. package/dist/core/agent-session-runtime.d.ts +0 -134
  45. package/dist/core/agent-session-runtime.d.ts.map +0 -1
  46. package/dist/core/agent-session-runtime.js +0 -264
  47. package/dist/core/agent-session-runtime.js.map +0 -1
  48. package/dist/core/agent-session.d.ts +0 -585
  49. package/dist/core/agent-session.d.ts.map +0 -1
  50. package/dist/core/agent-session.js +0 -2497
  51. package/dist/core/agent-session.js.map +0 -1
  52. package/dist/core/auth-storage.d.ts +0 -132
  53. package/dist/core/auth-storage.d.ts.map +0 -1
  54. package/dist/core/auth-storage.js +0 -422
  55. package/dist/core/auth-storage.js.map +0 -1
  56. package/dist/core/bash-executor.d.ts +0 -46
  57. package/dist/core/bash-executor.d.ts.map +0 -1
  58. package/dist/core/bash-executor.js +0 -113
  59. package/dist/core/bash-executor.js.map +0 -1
  60. package/dist/core/compaction/branch-summarization.d.ts +0 -88
  61. package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  62. package/dist/core/compaction/branch-summarization.js +0 -243
  63. package/dist/core/compaction/branch-summarization.js.map +0 -1
  64. package/dist/core/compaction/compaction.d.ts +0 -121
  65. package/dist/core/compaction/compaction.d.ts.map +0 -1
  66. package/dist/core/compaction/compaction.js +0 -613
  67. package/dist/core/compaction/compaction.js.map +0 -1
  68. package/dist/core/compaction/index.d.ts +0 -7
  69. package/dist/core/compaction/index.d.ts.map +0 -1
  70. package/dist/core/compaction/index.js +0 -7
  71. package/dist/core/compaction/index.js.map +0 -1
  72. package/dist/core/compaction/utils.d.ts +0 -38
  73. package/dist/core/compaction/utils.d.ts.map +0 -1
  74. package/dist/core/compaction/utils.js +0 -153
  75. package/dist/core/compaction/utils.js.map +0 -1
  76. package/dist/core/defaults.d.ts +0 -3
  77. package/dist/core/defaults.d.ts.map +0 -1
  78. package/dist/core/defaults.js +0 -2
  79. package/dist/core/defaults.js.map +0 -1
  80. package/dist/core/diagnostics.d.ts +0 -15
  81. package/dist/core/diagnostics.d.ts.map +0 -1
  82. package/dist/core/diagnostics.js +0 -2
  83. package/dist/core/diagnostics.js.map +0 -1
  84. package/dist/core/event-bus.d.ts +0 -9
  85. package/dist/core/event-bus.d.ts.map +0 -1
  86. package/dist/core/event-bus.js +0 -25
  87. package/dist/core/event-bus.js.map +0 -1
  88. package/dist/core/exec.d.ts +0 -29
  89. package/dist/core/exec.d.ts.map +0 -1
  90. package/dist/core/exec.js +0 -75
  91. package/dist/core/exec.js.map +0 -1
  92. package/dist/core/export-html/ansi-to-html.d.ts +0 -22
  93. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  94. package/dist/core/export-html/ansi-to-html.js +0 -249
  95. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  96. package/dist/core/export-html/index.d.ts +0 -37
  97. package/dist/core/export-html/index.d.ts.map +0 -1
  98. package/dist/core/export-html/index.js +0 -224
  99. package/dist/core/export-html/index.js.map +0 -1
  100. package/dist/core/export-html/template.css +0 -1001
  101. package/dist/core/export-html/template.html +0 -55
  102. package/dist/core/export-html/template.js +0 -1690
  103. package/dist/core/export-html/tool-renderer.d.ts +0 -40
  104. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  105. package/dist/core/export-html/tool-renderer.js +0 -95
  106. package/dist/core/export-html/tool-renderer.js.map +0 -1
  107. package/dist/core/export-html/vendor/highlight.min.js +0 -1213
  108. package/dist/core/export-html/vendor/marked.min.js +0 -6
  109. package/dist/core/extensions/index.d.ts +0 -12
  110. package/dist/core/extensions/index.d.ts.map +0 -1
  111. package/dist/core/extensions/index.js +0 -9
  112. package/dist/core/extensions/index.js.map +0 -1
  113. package/dist/core/extensions/loader.d.ts +0 -25
  114. package/dist/core/extensions/loader.d.ts.map +0 -1
  115. package/dist/core/extensions/loader.js +0 -436
  116. package/dist/core/extensions/loader.js.map +0 -1
  117. package/dist/core/extensions/runner.d.ts +0 -148
  118. package/dist/core/extensions/runner.d.ts.map +0 -1
  119. package/dist/core/extensions/runner.js +0 -700
  120. package/dist/core/extensions/runner.js.map +0 -1
  121. package/dist/core/extensions/types.d.ts +0 -1076
  122. package/dist/core/extensions/types.d.ts.map +0 -1
  123. package/dist/core/extensions/types.js +0 -35
  124. package/dist/core/extensions/types.js.map +0 -1
  125. package/dist/core/extensions/wrapper.d.ts +0 -20
  126. package/dist/core/extensions/wrapper.d.ts.map +0 -1
  127. package/dist/core/extensions/wrapper.js +0 -22
  128. package/dist/core/extensions/wrapper.js.map +0 -1
  129. package/dist/core/footer-data-provider.d.ts +0 -48
  130. package/dist/core/footer-data-provider.d.ts.map +0 -1
  131. package/dist/core/footer-data-provider.js +0 -314
  132. package/dist/core/footer-data-provider.js.map +0 -1
  133. package/dist/core/index.d.ts +0 -11
  134. package/dist/core/index.d.ts.map +0 -1
  135. package/dist/core/index.js +0 -11
  136. package/dist/core/index.js.map +0 -1
  137. package/dist/core/keybindings.d.ts +0 -285
  138. package/dist/core/keybindings.d.ts.map +0 -1
  139. package/dist/core/keybindings.js +0 -251
  140. package/dist/core/keybindings.js.map +0 -1
  141. package/dist/core/messages.d.ts +0 -77
  142. package/dist/core/messages.d.ts.map +0 -1
  143. package/dist/core/messages.js +0 -123
  144. package/dist/core/messages.js.map +0 -1
  145. package/dist/core/model-registry.d.ts +0 -132
  146. package/dist/core/model-registry.d.ts.map +0 -1
  147. package/dist/core/model-registry.js +0 -583
  148. package/dist/core/model-registry.js.map +0 -1
  149. package/dist/core/model-resolver.d.ts +0 -110
  150. package/dist/core/model-resolver.d.ts.map +0 -1
  151. package/dist/core/model-resolver.js +0 -486
  152. package/dist/core/model-resolver.js.map +0 -1
  153. package/dist/core/output-guard.d.ts +0 -6
  154. package/dist/core/output-guard.d.ts.map +0 -1
  155. package/dist/core/output-guard.js +0 -59
  156. package/dist/core/output-guard.js.map +0 -1
  157. package/dist/core/package-manager.d.ts +0 -172
  158. package/dist/core/package-manager.d.ts.map +0 -1
  159. package/dist/core/package-manager.js +0 -1783
  160. package/dist/core/package-manager.js.map +0 -1
  161. package/dist/core/prompt-templates.d.ts +0 -51
  162. package/dist/core/prompt-templates.d.ts.map +0 -1
  163. package/dist/core/prompt-templates.js +0 -249
  164. package/dist/core/prompt-templates.js.map +0 -1
  165. package/dist/core/resolve-config-value.d.ts +0 -23
  166. package/dist/core/resolve-config-value.d.ts.map +0 -1
  167. package/dist/core/resolve-config-value.js +0 -126
  168. package/dist/core/resolve-config-value.js.map +0 -1
  169. package/dist/core/resource-loader.d.ts +0 -185
  170. package/dist/core/resource-loader.d.ts.map +0 -1
  171. package/dist/core/resource-loader.js +0 -698
  172. package/dist/core/resource-loader.js.map +0 -1
  173. package/dist/core/sdk.d.ts +0 -93
  174. package/dist/core/sdk.d.ts.map +0 -1
  175. package/dist/core/sdk.js +0 -236
  176. package/dist/core/sdk.js.map +0 -1
  177. package/dist/core/session-manager.d.ts +0 -332
  178. package/dist/core/session-manager.d.ts.map +0 -1
  179. package/dist/core/session-manager.js +0 -1104
  180. package/dist/core/session-manager.js.map +0 -1
  181. package/dist/core/settings-manager.d.ts +0 -237
  182. package/dist/core/settings-manager.d.ts.map +0 -1
  183. package/dist/core/settings-manager.js +0 -702
  184. package/dist/core/settings-manager.js.map +0 -1
  185. package/dist/core/skills.d.ts +0 -60
  186. package/dist/core/skills.d.ts.map +0 -1
  187. package/dist/core/skills.js +0 -409
  188. package/dist/core/skills.js.map +0 -1
  189. package/dist/core/slash-commands.d.ts +0 -14
  190. package/dist/core/slash-commands.d.ts.map +0 -1
  191. package/dist/core/slash-commands.js +0 -23
  192. package/dist/core/slash-commands.js.map +0 -1
  193. package/dist/core/source-info.d.ts +0 -18
  194. package/dist/core/source-info.d.ts.map +0 -1
  195. package/dist/core/source-info.js +0 -19
  196. package/dist/core/source-info.js.map +0 -1
  197. package/dist/core/system-prompt.d.ts +0 -28
  198. package/dist/core/system-prompt.d.ts.map +0 -1
  199. package/dist/core/system-prompt.js +0 -116
  200. package/dist/core/system-prompt.js.map +0 -1
  201. package/dist/core/timings.d.ts +0 -8
  202. package/dist/core/timings.d.ts.map +0 -1
  203. package/dist/core/timings.js +0 -31
  204. package/dist/core/timings.js.map +0 -1
  205. package/dist/core/tools/bash.d.ts +0 -73
  206. package/dist/core/tools/bash.d.ts.map +0 -1
  207. package/dist/core/tools/bash.js +0 -342
  208. package/dist/core/tools/bash.js.map +0 -1
  209. package/dist/core/tools/edit-diff.d.ts +0 -85
  210. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  211. package/dist/core/tools/edit-diff.js +0 -337
  212. package/dist/core/tools/edit-diff.js.map +0 -1
  213. package/dist/core/tools/edit.d.ts +0 -53
  214. package/dist/core/tools/edit.d.ts.map +0 -1
  215. package/dist/core/tools/edit.js +0 -196
  216. package/dist/core/tools/edit.js.map +0 -1
  217. package/dist/core/tools/file-mutation-queue.d.ts +0 -6
  218. package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  219. package/dist/core/tools/file-mutation-queue.js +0 -37
  220. package/dist/core/tools/file-mutation-queue.js.map +0 -1
  221. package/dist/core/tools/find.d.ts +0 -46
  222. package/dist/core/tools/find.d.ts.map +0 -1
  223. package/dist/core/tools/find.js +0 -258
  224. package/dist/core/tools/find.js.map +0 -1
  225. package/dist/core/tools/grep.d.ts +0 -56
  226. package/dist/core/tools/grep.d.ts.map +0 -1
  227. package/dist/core/tools/grep.js +0 -293
  228. package/dist/core/tools/grep.js.map +0 -1
  229. package/dist/core/tools/index.d.ts +0 -115
  230. package/dist/core/tools/index.d.ts.map +0 -1
  231. package/dist/core/tools/index.js +0 -86
  232. package/dist/core/tools/index.js.map +0 -1
  233. package/dist/core/tools/ls.d.ts +0 -46
  234. package/dist/core/tools/ls.d.ts.map +0 -1
  235. package/dist/core/tools/ls.js +0 -172
  236. package/dist/core/tools/ls.js.map +0 -1
  237. package/dist/core/tools/path-utils.d.ts +0 -8
  238. package/dist/core/tools/path-utils.d.ts.map +0 -1
  239. package/dist/core/tools/path-utils.js +0 -81
  240. package/dist/core/tools/path-utils.js.map +0 -1
  241. package/dist/core/tools/read.d.ts +0 -46
  242. package/dist/core/tools/read.d.ts.map +0 -1
  243. package/dist/core/tools/read.js +0 -225
  244. package/dist/core/tools/read.js.map +0 -1
  245. package/dist/core/tools/render-utils.d.ts +0 -21
  246. package/dist/core/tools/render-utils.d.ts.map +0 -1
  247. package/dist/core/tools/render-utils.js +0 -49
  248. package/dist/core/tools/render-utils.js.map +0 -1
  249. package/dist/core/tools/tool-definition-wrapper.d.ts +0 -14
  250. package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  251. package/dist/core/tools/tool-definition-wrapper.js +0 -32
  252. package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  253. package/dist/core/tools/truncate.d.ts +0 -70
  254. package/dist/core/tools/truncate.d.ts.map +0 -1
  255. package/dist/core/tools/truncate.js +0 -205
  256. package/dist/core/tools/truncate.js.map +0 -1
  257. package/dist/core/tools/write.d.ts +0 -35
  258. package/dist/core/tools/write.d.ts.map +0 -1
  259. package/dist/core/tools/write.js +0 -216
  260. package/dist/core/tools/write.js.map +0 -1
  261. package/dist/index.d.ts +0 -28
  262. package/dist/index.d.ts.map +0 -1
  263. package/dist/index.js +0 -43
  264. package/dist/index.js.map +0 -1
  265. package/dist/lib/config.js +0 -22
  266. package/dist/lib/detect.js +0 -94
  267. package/dist/lib/display.js +0 -182
  268. package/dist/main.d.ts +0 -8
  269. package/dist/main.d.ts.map +0 -1
  270. package/dist/main.js +0 -806
  271. package/dist/main.js.map +0 -1
  272. package/dist/migrations.d.ts +0 -33
  273. package/dist/migrations.d.ts.map +0 -1
  274. package/dist/migrations.js +0 -261
  275. package/dist/migrations.js.map +0 -1
  276. package/dist/modes/index.d.ts +0 -9
  277. package/dist/modes/index.d.ts.map +0 -1
  278. package/dist/modes/index.js +0 -8
  279. package/dist/modes/index.js.map +0 -1
  280. package/dist/modes/interactive/components/armin.d.ts +0 -34
  281. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  282. package/dist/modes/interactive/components/armin.js +0 -333
  283. package/dist/modes/interactive/components/armin.js.map +0 -1
  284. package/dist/modes/interactive/components/assistant-message.d.ts +0 -18
  285. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  286. package/dist/modes/interactive/components/assistant-message.js +0 -107
  287. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  288. package/dist/modes/interactive/components/bash-execution.d.ts +0 -34
  289. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  290. package/dist/modes/interactive/components/bash-execution.js +0 -175
  291. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  292. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  293. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  294. package/dist/modes/interactive/components/bordered-loader.js +0 -51
  295. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  296. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
  297. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  298. package/dist/modes/interactive/components/branch-summary-message.js +0 -44
  299. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  300. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
  301. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  302. package/dist/modes/interactive/components/compaction-summary-message.js +0 -45
  303. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  304. package/dist/modes/interactive/components/config-selector.d.ts +0 -71
  305. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  306. package/dist/modes/interactive/components/config-selector.js +0 -479
  307. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  308. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
  309. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  310. package/dist/modes/interactive/components/countdown-timer.js +0 -33
  311. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  312. package/dist/modes/interactive/components/custom-editor.d.ts +0 -21
  313. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  314. package/dist/modes/interactive/components/custom-editor.js +0 -70
  315. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  316. package/dist/modes/interactive/components/custom-message.d.ts +0 -20
  317. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  318. package/dist/modes/interactive/components/custom-message.js +0 -79
  319. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  320. package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
  321. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  322. package/dist/modes/interactive/components/daxnuts.js +0 -140
  323. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
  324. package/dist/modes/interactive/components/diff.d.ts +0 -12
  325. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  326. package/dist/modes/interactive/components/diff.js +0 -133
  327. package/dist/modes/interactive/components/diff.js.map +0 -1
  328. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
  329. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  330. package/dist/modes/interactive/components/dynamic-border.js +0 -21
  331. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  332. package/dist/modes/interactive/components/extension-editor.d.ts +0 -20
  333. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  334. package/dist/modes/interactive/components/extension-editor.js +0 -111
  335. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  336. package/dist/modes/interactive/components/extension-input.d.ts +0 -23
  337. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  338. package/dist/modes/interactive/components/extension-input.js +0 -61
  339. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  340. package/dist/modes/interactive/components/extension-selector.d.ts +0 -24
  341. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  342. package/dist/modes/interactive/components/extension-selector.js +0 -78
  343. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  344. package/dist/modes/interactive/components/footer.d.ts +0 -27
  345. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  346. package/dist/modes/interactive/components/footer.js +0 -201
  347. package/dist/modes/interactive/components/footer.js.map +0 -1
  348. package/dist/modes/interactive/components/index.d.ts +0 -32
  349. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  350. package/dist/modes/interactive/components/index.js +0 -33
  351. package/dist/modes/interactive/components/index.js.map +0 -1
  352. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -8
  353. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  354. package/dist/modes/interactive/components/keybinding-hints.js +0 -22
  355. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  356. package/dist/modes/interactive/components/login-dialog.d.ts +0 -42
  357. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  358. package/dist/modes/interactive/components/login-dialog.js +0 -145
  359. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  360. package/dist/modes/interactive/components/model-selector.d.ts +0 -47
  361. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  362. package/dist/modes/interactive/components/model-selector.js +0 -275
  363. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  364. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -19
  365. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  366. package/dist/modes/interactive/components/oauth-selector.js +0 -97
  367. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  368. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -49
  369. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  370. package/dist/modes/interactive/components/scoped-models-selector.js +0 -275
  371. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  372. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
  373. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  374. package/dist/modes/interactive/components/session-selector-search.js +0 -155
  375. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  376. package/dist/modes/interactive/components/session-selector.d.ts +0 -95
  377. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  378. package/dist/modes/interactive/components/session-selector.js +0 -848
  379. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  380. package/dist/modes/interactive/components/settings-selector.d.ts +0 -58
  381. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  382. package/dist/modes/interactive/components/settings-selector.js +0 -301
  383. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  384. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  385. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  386. package/dist/modes/interactive/components/show-images-selector.js +0 -39
  387. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  388. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
  389. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  390. package/dist/modes/interactive/components/skill-invocation-message.js +0 -47
  391. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  392. package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  393. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  394. package/dist/modes/interactive/components/theme-selector.js +0 -50
  395. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  396. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -11
  397. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  398. package/dist/modes/interactive/components/thinking-selector.js +0 -51
  399. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  400. package/dist/modes/interactive/components/tool-execution.d.ts +0 -58
  401. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  402. package/dist/modes/interactive/components/tool-execution.js +0 -274
  403. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  404. package/dist/modes/interactive/components/tree-selector.d.ts +0 -89
  405. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  406. package/dist/modes/interactive/components/tree-selector.js +0 -1084
  407. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  408. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  409. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  410. package/dist/modes/interactive/components/user-message-selector.js +0 -113
  411. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  412. package/dist/modes/interactive/components/user-message.d.ts +0 -9
  413. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  414. package/dist/modes/interactive/components/user-message.js +0 -28
  415. package/dist/modes/interactive/components/user-message.js.map +0 -1
  416. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -24
  417. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  418. package/dist/modes/interactive/components/visual-truncate.js +0 -33
  419. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  420. package/dist/modes/interactive/interactive-mode.d.ts +0 -318
  421. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  422. package/dist/modes/interactive/interactive-mode.js +0 -3907
  423. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  424. package/dist/modes/interactive/theme/dark.json +0 -85
  425. package/dist/modes/interactive/theme/light.json +0 -84
  426. package/dist/modes/interactive/theme/theme-schema.json +0 -335
  427. package/dist/modes/interactive/theme/theme.d.ts +0 -81
  428. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  429. package/dist/modes/interactive/theme/theme.js +0 -970
  430. package/dist/modes/interactive/theme/theme.js.map +0 -1
  431. package/dist/modes/print-mode.d.ts +0 -28
  432. package/dist/modes/print-mode.d.ts.map +0 -1
  433. package/dist/modes/print-mode.js +0 -108
  434. package/dist/modes/print-mode.js.map +0 -1
  435. package/dist/modes/rpc/jsonl.d.ts +0 -17
  436. package/dist/modes/rpc/jsonl.d.ts.map +0 -1
  437. package/dist/modes/rpc/jsonl.js +0 -49
  438. package/dist/modes/rpc/jsonl.js.map +0 -1
  439. package/dist/modes/rpc/rpc-client.d.ts +0 -217
  440. package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  441. package/dist/modes/rpc/rpc-client.js +0 -401
  442. package/dist/modes/rpc/rpc-client.js.map +0 -1
  443. package/dist/modes/rpc/rpc-mode.d.ts +0 -20
  444. package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  445. package/dist/modes/rpc/rpc-mode.js +0 -542
  446. package/dist/modes/rpc/rpc-mode.js.map +0 -1
  447. package/dist/modes/rpc/rpc-types.d.ts +0 -408
  448. package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  449. package/dist/modes/rpc/rpc-types.js +0 -8
  450. package/dist/modes/rpc/rpc-types.js.map +0 -1
  451. package/dist/utils/changelog.d.ts +0 -21
  452. package/dist/utils/changelog.d.ts.map +0 -1
  453. package/dist/utils/changelog.js +0 -87
  454. package/dist/utils/changelog.js.map +0 -1
  455. package/dist/utils/child-process.d.ts +0 -11
  456. package/dist/utils/child-process.d.ts.map +0 -1
  457. package/dist/utils/child-process.js +0 -78
  458. package/dist/utils/child-process.js.map +0 -1
  459. package/dist/utils/clipboard-image.d.ts +0 -11
  460. package/dist/utils/clipboard-image.d.ts.map +0 -1
  461. package/dist/utils/clipboard-image.js +0 -245
  462. package/dist/utils/clipboard-image.js.map +0 -1
  463. package/dist/utils/clipboard-native.d.ts +0 -8
  464. package/dist/utils/clipboard-native.d.ts.map +0 -1
  465. package/dist/utils/clipboard-native.js +0 -14
  466. package/dist/utils/clipboard-native.js.map +0 -1
  467. package/dist/utils/clipboard.d.ts +0 -2
  468. package/dist/utils/clipboard.d.ts.map +0 -1
  469. package/dist/utils/clipboard.js +0 -78
  470. package/dist/utils/clipboard.js.map +0 -1
  471. package/dist/utils/exif-orientation.d.ts +0 -5
  472. package/dist/utils/exif-orientation.d.ts.map +0 -1
  473. package/dist/utils/exif-orientation.js +0 -158
  474. package/dist/utils/exif-orientation.js.map +0 -1
  475. package/dist/utils/frontmatter.d.ts +0 -8
  476. package/dist/utils/frontmatter.d.ts.map +0 -1
  477. package/dist/utils/frontmatter.js +0 -26
  478. package/dist/utils/frontmatter.js.map +0 -1
  479. package/dist/utils/git.d.ts +0 -26
  480. package/dist/utils/git.d.ts.map +0 -1
  481. package/dist/utils/git.js +0 -163
  482. package/dist/utils/git.js.map +0 -1
  483. package/dist/utils/image-convert.d.ts +0 -9
  484. package/dist/utils/image-convert.d.ts.map +0 -1
  485. package/dist/utils/image-convert.js +0 -39
  486. package/dist/utils/image-convert.js.map +0 -1
  487. package/dist/utils/image-resize.d.ts +0 -36
  488. package/dist/utils/image-resize.d.ts.map +0 -1
  489. package/dist/utils/image-resize.js +0 -137
  490. package/dist/utils/image-resize.js.map +0 -1
  491. package/dist/utils/mime.d.ts +0 -2
  492. package/dist/utils/mime.d.ts.map +0 -1
  493. package/dist/utils/mime.js +0 -26
  494. package/dist/utils/mime.js.map +0 -1
  495. package/dist/utils/photon.d.ts +0 -21
  496. package/dist/utils/photon.d.ts.map +0 -1
  497. package/dist/utils/photon.js +0 -121
  498. package/dist/utils/photon.js.map +0 -1
  499. package/dist/utils/shell.d.ts +0 -26
  500. package/dist/utils/shell.d.ts.map +0 -1
  501. package/dist/utils/shell.js +0 -186
  502. package/dist/utils/shell.js.map +0 -1
  503. package/dist/utils/sleep.d.ts +0 -5
  504. package/dist/utils/sleep.d.ts.map +0 -1
  505. package/dist/utils/sleep.js +0 -17
  506. package/dist/utils/sleep.js.map +0 -1
  507. package/dist/utils/tools-manager.d.ts +0 -3
  508. package/dist/utils/tools-manager.d.ts.map +0 -1
  509. package/dist/utils/tools-manager.js +0 -252
  510. package/dist/utils/tools-manager.js.map +0 -1
  511. package/dist/welcome/about.js +0 -50
  512. package/dist/welcome/auth.js +0 -126
  513. package/dist/welcome/intro.js +0 -90
  514. package/dist/welcome/qa.js +0 -131
  515. 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