@eminent337/aery 0.1.63 → 0.1.65

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