jonsoc 1.1.48 → 1.1.50

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 (421) hide show
  1. package/bin/jonsoc +17 -9
  2. package/package.json +8 -142
  3. package/postinstall.mjs +15 -0
  4. package/AGENTS.md +0 -27
  5. package/Dockerfile +0 -18
  6. package/PUBLISHING_GUIDE.md +0 -151
  7. package/README.md +0 -58
  8. package/bunfig.toml +0 -7
  9. package/package.json.placeholder +0 -11
  10. package/parsers-config.ts +0 -253
  11. package/script/build.ts +0 -115
  12. package/script/publish-registries.ts +0 -197
  13. package/script/publish.ts +0 -110
  14. package/script/schema.ts +0 -47
  15. package/script/seed-e2e.ts +0 -50
  16. package/src/acp/README.md +0 -164
  17. package/src/acp/agent.ts +0 -1437
  18. package/src/acp/session.ts +0 -105
  19. package/src/acp/types.ts +0 -22
  20. package/src/agent/agent.ts +0 -347
  21. package/src/agent/generate.txt +0 -75
  22. package/src/agent/prompt/compaction.txt +0 -12
  23. package/src/agent/prompt/explore.txt +0 -18
  24. package/src/agent/prompt/summary.txt +0 -11
  25. package/src/agent/prompt/title.txt +0 -44
  26. package/src/auth/index.ts +0 -73
  27. package/src/brand/index.ts +0 -89
  28. package/src/bun/index.ts +0 -139
  29. package/src/bus/bus-event.ts +0 -43
  30. package/src/bus/global.ts +0 -10
  31. package/src/bus/index.ts +0 -105
  32. package/src/cli/bootstrap.ts +0 -17
  33. package/src/cli/cmd/acp.ts +0 -69
  34. package/src/cli/cmd/agent.ts +0 -257
  35. package/src/cli/cmd/auth.ts +0 -405
  36. package/src/cli/cmd/cmd.ts +0 -7
  37. package/src/cli/cmd/debug/agent.ts +0 -166
  38. package/src/cli/cmd/debug/config.ts +0 -16
  39. package/src/cli/cmd/debug/file.ts +0 -97
  40. package/src/cli/cmd/debug/index.ts +0 -48
  41. package/src/cli/cmd/debug/lsp.ts +0 -52
  42. package/src/cli/cmd/debug/ripgrep.ts +0 -87
  43. package/src/cli/cmd/debug/scrap.ts +0 -16
  44. package/src/cli/cmd/debug/skill.ts +0 -16
  45. package/src/cli/cmd/debug/snapshot.ts +0 -52
  46. package/src/cli/cmd/export.ts +0 -88
  47. package/src/cli/cmd/generate.ts +0 -38
  48. package/src/cli/cmd/github.ts +0 -1548
  49. package/src/cli/cmd/import.ts +0 -99
  50. package/src/cli/cmd/mcp.ts +0 -765
  51. package/src/cli/cmd/models.ts +0 -77
  52. package/src/cli/cmd/pr.ts +0 -112
  53. package/src/cli/cmd/run.ts +0 -395
  54. package/src/cli/cmd/serve.ts +0 -20
  55. package/src/cli/cmd/session.ts +0 -135
  56. package/src/cli/cmd/stats.ts +0 -402
  57. package/src/cli/cmd/tui/app.tsx +0 -923
  58. package/src/cli/cmd/tui/attach.ts +0 -39
  59. package/src/cli/cmd/tui/component/border.tsx +0 -21
  60. package/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
  61. package/src/cli/cmd/tui/component/dialog-command.tsx +0 -162
  62. package/src/cli/cmd/tui/component/dialog-error-log.tsx +0 -155
  63. package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
  64. package/src/cli/cmd/tui/component/dialog-model.tsx +0 -234
  65. package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -256
  66. package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -114
  67. package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
  68. package/src/cli/cmd/tui/component/dialog-stash.tsx +0 -87
  69. package/src/cli/cmd/tui/component/dialog-status.tsx +0 -164
  70. package/src/cli/cmd/tui/component/dialog-tag.tsx +0 -44
  71. package/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
  72. package/src/cli/cmd/tui/component/dynamic-layout.tsx +0 -86
  73. package/src/cli/cmd/tui/component/inspector-overlay.tsx +0 -247
  74. package/src/cli/cmd/tui/component/logo.tsx +0 -88
  75. package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -653
  76. package/src/cli/cmd/tui/component/prompt/frecency.tsx +0 -89
  77. package/src/cli/cmd/tui/component/prompt/history.tsx +0 -108
  78. package/src/cli/cmd/tui/component/prompt/index.tsx +0 -1347
  79. package/src/cli/cmd/tui/component/prompt/stash.tsx +0 -101
  80. package/src/cli/cmd/tui/component/textarea-keybindings.ts +0 -73
  81. package/src/cli/cmd/tui/component/tips.tsx +0 -153
  82. package/src/cli/cmd/tui/component/todo-item.tsx +0 -32
  83. package/src/cli/cmd/tui/context/args.tsx +0 -14
  84. package/src/cli/cmd/tui/context/directory.ts +0 -13
  85. package/src/cli/cmd/tui/context/error-log.tsx +0 -56
  86. package/src/cli/cmd/tui/context/exit.tsx +0 -26
  87. package/src/cli/cmd/tui/context/helper.tsx +0 -25
  88. package/src/cli/cmd/tui/context/inspector.tsx +0 -57
  89. package/src/cli/cmd/tui/context/keybind.tsx +0 -108
  90. package/src/cli/cmd/tui/context/kv.tsx +0 -53
  91. package/src/cli/cmd/tui/context/layout.tsx +0 -240
  92. package/src/cli/cmd/tui/context/local.tsx +0 -402
  93. package/src/cli/cmd/tui/context/prompt.tsx +0 -18
  94. package/src/cli/cmd/tui/context/route.tsx +0 -51
  95. package/src/cli/cmd/tui/context/sdk.tsx +0 -94
  96. package/src/cli/cmd/tui/context/sync.tsx +0 -449
  97. package/src/cli/cmd/tui/context/theme/aura.json +0 -69
  98. package/src/cli/cmd/tui/context/theme/ayu.json +0 -80
  99. package/src/cli/cmd/tui/context/theme/carbonfox.json +0 -248
  100. package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +0 -233
  101. package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -233
  102. package/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
  103. package/src/cli/cmd/tui/context/theme/cobalt2.json +0 -228
  104. package/src/cli/cmd/tui/context/theme/cursor.json +0 -249
  105. package/src/cli/cmd/tui/context/theme/dracula.json +0 -219
  106. package/src/cli/cmd/tui/context/theme/everforest.json +0 -241
  107. package/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
  108. package/src/cli/cmd/tui/context/theme/github.json +0 -233
  109. package/src/cli/cmd/tui/context/theme/gruvbox.json +0 -242
  110. package/src/cli/cmd/tui/context/theme/jonsoc.json +0 -245
  111. package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
  112. package/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -237
  113. package/src/cli/cmd/tui/context/theme/material.json +0 -235
  114. package/src/cli/cmd/tui/context/theme/matrix.json +0 -77
  115. package/src/cli/cmd/tui/context/theme/mercury.json +0 -252
  116. package/src/cli/cmd/tui/context/theme/monokai.json +0 -221
  117. package/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
  118. package/src/cli/cmd/tui/context/theme/nord.json +0 -223
  119. package/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
  120. package/src/cli/cmd/tui/context/theme/orng.json +0 -249
  121. package/src/cli/cmd/tui/context/theme/osaka-jade.json +0 -93
  122. package/src/cli/cmd/tui/context/theme/palenight.json +0 -222
  123. package/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
  124. package/src/cli/cmd/tui/context/theme/solarized.json +0 -223
  125. package/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
  126. package/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
  127. package/src/cli/cmd/tui/context/theme/vercel.json +0 -245
  128. package/src/cli/cmd/tui/context/theme/vesper.json +0 -218
  129. package/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
  130. package/src/cli/cmd/tui/context/theme.tsx +0 -1153
  131. package/src/cli/cmd/tui/event.ts +0 -48
  132. package/src/cli/cmd/tui/hooks/use-command-registry.tsx +0 -184
  133. package/src/cli/cmd/tui/routes/home.tsx +0 -198
  134. package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +0 -64
  135. package/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -109
  136. package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +0 -26
  137. package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -47
  138. package/src/cli/cmd/tui/routes/session/footer.tsx +0 -91
  139. package/src/cli/cmd/tui/routes/session/git-commit.tsx +0 -59
  140. package/src/cli/cmd/tui/routes/session/git-history.tsx +0 -122
  141. package/src/cli/cmd/tui/routes/session/header.tsx +0 -185
  142. package/src/cli/cmd/tui/routes/session/index.tsx +0 -2363
  143. package/src/cli/cmd/tui/routes/session/navigator-ui.tsx +0 -214
  144. package/src/cli/cmd/tui/routes/session/navigator.tsx +0 -1124
  145. package/src/cli/cmd/tui/routes/session/panel-explorer.tsx +0 -553
  146. package/src/cli/cmd/tui/routes/session/panel-viewer.tsx +0 -386
  147. package/src/cli/cmd/tui/routes/session/permission.tsx +0 -501
  148. package/src/cli/cmd/tui/routes/session/question.tsx +0 -507
  149. package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -365
  150. package/src/cli/cmd/tui/routes/session/vcs-diff-viewer.tsx +0 -37
  151. package/src/cli/cmd/tui/routes/ui-settings.tsx +0 -449
  152. package/src/cli/cmd/tui/thread.ts +0 -172
  153. package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -90
  154. package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -83
  155. package/src/cli/cmd/tui/ui/dialog-export-options.tsx +0 -204
  156. package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -38
  157. package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -77
  158. package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -384
  159. package/src/cli/cmd/tui/ui/dialog.tsx +0 -170
  160. package/src/cli/cmd/tui/ui/link.tsx +0 -28
  161. package/src/cli/cmd/tui/ui/spinner.ts +0 -375
  162. package/src/cli/cmd/tui/ui/toast.tsx +0 -100
  163. package/src/cli/cmd/tui/util/clipboard.ts +0 -255
  164. package/src/cli/cmd/tui/util/editor.ts +0 -32
  165. package/src/cli/cmd/tui/util/signal.ts +0 -7
  166. package/src/cli/cmd/tui/util/terminal.ts +0 -114
  167. package/src/cli/cmd/tui/util/transcript.ts +0 -98
  168. package/src/cli/cmd/tui/worker.ts +0 -152
  169. package/src/cli/cmd/uninstall.ts +0 -362
  170. package/src/cli/cmd/upgrade.ts +0 -73
  171. package/src/cli/cmd/web.ts +0 -81
  172. package/src/cli/error.ts +0 -57
  173. package/src/cli/network.ts +0 -53
  174. package/src/cli/ui.ts +0 -119
  175. package/src/cli/upgrade.ts +0 -25
  176. package/src/command/index.ts +0 -131
  177. package/src/command/template/initialize.txt +0 -10
  178. package/src/command/template/review.txt +0 -99
  179. package/src/config/config.ts +0 -1404
  180. package/src/config/markdown.ts +0 -93
  181. package/src/env/index.ts +0 -26
  182. package/src/file/ignore.ts +0 -83
  183. package/src/file/index.ts +0 -432
  184. package/src/file/ripgrep.ts +0 -407
  185. package/src/file/time.ts +0 -69
  186. package/src/file/watcher.ts +0 -127
  187. package/src/flag/flag.ts +0 -80
  188. package/src/format/formatter.ts +0 -357
  189. package/src/format/index.ts +0 -137
  190. package/src/global/index.ts +0 -58
  191. package/src/id/id.ts +0 -83
  192. package/src/ide/index.ts +0 -76
  193. package/src/index.ts +0 -208
  194. package/src/installation/index.ts +0 -258
  195. package/src/lsp/client.ts +0 -252
  196. package/src/lsp/index.ts +0 -485
  197. package/src/lsp/language.ts +0 -119
  198. package/src/lsp/server.ts +0 -2046
  199. package/src/mcp/auth.ts +0 -135
  200. package/src/mcp/index.ts +0 -934
  201. package/src/mcp/oauth-callback.ts +0 -200
  202. package/src/mcp/oauth-provider.ts +0 -155
  203. package/src/patch/index.ts +0 -680
  204. package/src/permission/arity.ts +0 -163
  205. package/src/permission/index.ts +0 -210
  206. package/src/permission/next.ts +0 -280
  207. package/src/plugin/codex.ts +0 -500
  208. package/src/plugin/copilot.ts +0 -283
  209. package/src/plugin/index.ts +0 -135
  210. package/src/project/bootstrap.ts +0 -35
  211. package/src/project/instance.ts +0 -91
  212. package/src/project/project.ts +0 -371
  213. package/src/project/state.ts +0 -66
  214. package/src/project/vcs.ts +0 -151
  215. package/src/provider/auth.ts +0 -147
  216. package/src/provider/models-macro.ts +0 -14
  217. package/src/provider/models.ts +0 -114
  218. package/src/provider/provider.ts +0 -1220
  219. package/src/provider/sdk/openai-compatible/src/README.md +0 -5
  220. package/src/provider/sdk/openai-compatible/src/index.ts +0 -2
  221. package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +0 -100
  222. package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +0 -303
  223. package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +0 -22
  224. package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +0 -18
  225. package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +0 -22
  226. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +0 -207
  227. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +0 -1732
  228. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +0 -177
  229. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +0 -1
  230. package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +0 -88
  231. package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +0 -128
  232. package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +0 -115
  233. package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +0 -65
  234. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +0 -104
  235. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +0 -103
  236. package/src/provider/transform.ts +0 -742
  237. package/src/pty/index.ts +0 -241
  238. package/src/question/index.ts +0 -176
  239. package/src/scheduler/index.ts +0 -61
  240. package/src/server/error.ts +0 -36
  241. package/src/server/event.ts +0 -7
  242. package/src/server/mdns.ts +0 -59
  243. package/src/server/routes/config.ts +0 -92
  244. package/src/server/routes/experimental.ts +0 -208
  245. package/src/server/routes/file.ts +0 -227
  246. package/src/server/routes/global.ts +0 -135
  247. package/src/server/routes/mcp.ts +0 -225
  248. package/src/server/routes/permission.ts +0 -68
  249. package/src/server/routes/project.ts +0 -82
  250. package/src/server/routes/provider.ts +0 -165
  251. package/src/server/routes/pty.ts +0 -169
  252. package/src/server/routes/question.ts +0 -98
  253. package/src/server/routes/session.ts +0 -939
  254. package/src/server/routes/tui.ts +0 -379
  255. package/src/server/server.ts +0 -663
  256. package/src/session/compaction.ts +0 -225
  257. package/src/session/index.ts +0 -498
  258. package/src/session/llm.ts +0 -288
  259. package/src/session/message-v2.ts +0 -740
  260. package/src/session/message.ts +0 -189
  261. package/src/session/processor.ts +0 -406
  262. package/src/session/prompt/anthropic-20250930.txt +0 -168
  263. package/src/session/prompt/anthropic.txt +0 -172
  264. package/src/session/prompt/anthropic_spoof.txt +0 -1
  265. package/src/session/prompt/beast.txt +0 -149
  266. package/src/session/prompt/build-switch.txt +0 -5
  267. package/src/session/prompt/codex_header.txt +0 -81
  268. package/src/session/prompt/copilot-gpt-5.txt +0 -145
  269. package/src/session/prompt/gemini.txt +0 -157
  270. package/src/session/prompt/max-steps.txt +0 -16
  271. package/src/session/prompt/plan-reminder-anthropic.txt +0 -67
  272. package/src/session/prompt/plan.txt +0 -26
  273. package/src/session/prompt/qwen.txt +0 -111
  274. package/src/session/prompt.ts +0 -1815
  275. package/src/session/retry.ts +0 -90
  276. package/src/session/revert.ts +0 -121
  277. package/src/session/status.ts +0 -76
  278. package/src/session/summary.ts +0 -150
  279. package/src/session/system.ts +0 -156
  280. package/src/session/todo.ts +0 -37
  281. package/src/share/share-next.ts +0 -204
  282. package/src/share/share.ts +0 -95
  283. package/src/shell/shell.ts +0 -67
  284. package/src/skill/index.ts +0 -1
  285. package/src/skill/skill.ts +0 -135
  286. package/src/snapshot/index.ts +0 -236
  287. package/src/storage/storage.ts +0 -227
  288. package/src/tool/apply_patch.ts +0 -279
  289. package/src/tool/apply_patch.txt +0 -33
  290. package/src/tool/bash.ts +0 -258
  291. package/src/tool/bash.txt +0 -115
  292. package/src/tool/batch.ts +0 -175
  293. package/src/tool/batch.txt +0 -24
  294. package/src/tool/codesearch.ts +0 -132
  295. package/src/tool/codesearch.txt +0 -12
  296. package/src/tool/edit.ts +0 -645
  297. package/src/tool/edit.txt +0 -10
  298. package/src/tool/external-directory.ts +0 -32
  299. package/src/tool/glob.ts +0 -77
  300. package/src/tool/glob.txt +0 -6
  301. package/src/tool/grep.ts +0 -154
  302. package/src/tool/grep.txt +0 -8
  303. package/src/tool/invalid.ts +0 -17
  304. package/src/tool/ls.ts +0 -121
  305. package/src/tool/ls.txt +0 -1
  306. package/src/tool/lsp.ts +0 -96
  307. package/src/tool/lsp.txt +0 -19
  308. package/src/tool/multiedit.ts +0 -46
  309. package/src/tool/multiedit.txt +0 -41
  310. package/src/tool/plan-enter.txt +0 -14
  311. package/src/tool/plan-exit.txt +0 -13
  312. package/src/tool/plan.ts +0 -130
  313. package/src/tool/question.ts +0 -33
  314. package/src/tool/question.txt +0 -10
  315. package/src/tool/read.ts +0 -202
  316. package/src/tool/read.txt +0 -12
  317. package/src/tool/registry.ts +0 -162
  318. package/src/tool/skill.ts +0 -82
  319. package/src/tool/task.ts +0 -188
  320. package/src/tool/task.txt +0 -60
  321. package/src/tool/todo.ts +0 -53
  322. package/src/tool/todoread.txt +0 -14
  323. package/src/tool/todowrite.txt +0 -167
  324. package/src/tool/tool.ts +0 -88
  325. package/src/tool/truncation.ts +0 -106
  326. package/src/tool/webfetch.ts +0 -182
  327. package/src/tool/webfetch.txt +0 -13
  328. package/src/tool/websearch.ts +0 -150
  329. package/src/tool/websearch.txt +0 -14
  330. package/src/tool/write.ts +0 -80
  331. package/src/tool/write.txt +0 -8
  332. package/src/util/archive.ts +0 -16
  333. package/src/util/color.ts +0 -19
  334. package/src/util/context.ts +0 -25
  335. package/src/util/defer.ts +0 -12
  336. package/src/util/eventloop.ts +0 -20
  337. package/src/util/filesystem.ts +0 -93
  338. package/src/util/fn.ts +0 -11
  339. package/src/util/format.ts +0 -20
  340. package/src/util/iife.ts +0 -3
  341. package/src/util/keybind.ts +0 -103
  342. package/src/util/lazy.ts +0 -18
  343. package/src/util/locale.ts +0 -81
  344. package/src/util/lock.ts +0 -98
  345. package/src/util/log.ts +0 -180
  346. package/src/util/queue.ts +0 -32
  347. package/src/util/rpc.ts +0 -66
  348. package/src/util/scrap.ts +0 -10
  349. package/src/util/signal.ts +0 -12
  350. package/src/util/timeout.ts +0 -14
  351. package/src/util/token.ts +0 -7
  352. package/src/util/wildcard.ts +0 -56
  353. package/src/worktree/index.ts +0 -524
  354. package/sst-env.d.ts +0 -9
  355. package/test/acp/agent-interface.test.ts +0 -51
  356. package/test/acp/event-subscription.test.ts +0 -436
  357. package/test/agent/agent.test.ts +0 -638
  358. package/test/bun.test.ts +0 -53
  359. package/test/cli/cmd/tui/fileref.test.ts +0 -30
  360. package/test/cli/github-action.test.ts +0 -129
  361. package/test/cli/github-remote.test.ts +0 -80
  362. package/test/cli/tui/navigator_logic.test.ts +0 -99
  363. package/test/cli/tui/transcript.test.ts +0 -297
  364. package/test/cli/ui.test.ts +0 -80
  365. package/test/config/agent-color.test.ts +0 -66
  366. package/test/config/config.test.ts +0 -1613
  367. package/test/config/fixtures/empty-frontmatter.md +0 -4
  368. package/test/config/fixtures/frontmatter.md +0 -28
  369. package/test/config/fixtures/no-frontmatter.md +0 -1
  370. package/test/config/markdown.test.ts +0 -192
  371. package/test/file/ignore.test.ts +0 -10
  372. package/test/file/path-traversal.test.ts +0 -198
  373. package/test/fixture/fixture.ts +0 -45
  374. package/test/fixture/lsp/fake-lsp-server.js +0 -77
  375. package/test/ide/ide.test.ts +0 -82
  376. package/test/keybind.test.ts +0 -421
  377. package/test/lsp/client.test.ts +0 -95
  378. package/test/mcp/headers.test.ts +0 -153
  379. package/test/mcp/oauth-browser.test.ts +0 -261
  380. package/test/patch/patch.test.ts +0 -348
  381. package/test/permission/arity.test.ts +0 -33
  382. package/test/permission/next.test.ts +0 -690
  383. package/test/permission-task.test.ts +0 -319
  384. package/test/plugin/codex.test.ts +0 -123
  385. package/test/preload.ts +0 -67
  386. package/test/project/project.test.ts +0 -120
  387. package/test/provider/amazon-bedrock.test.ts +0 -268
  388. package/test/provider/gitlab-duo.test.ts +0 -286
  389. package/test/provider/provider.test.ts +0 -2149
  390. package/test/provider/transform.test.ts +0 -1631
  391. package/test/question/question.test.ts +0 -300
  392. package/test/scheduler.test.ts +0 -73
  393. package/test/server/session-list.test.ts +0 -39
  394. package/test/server/session-select.test.ts +0 -78
  395. package/test/session/compaction.test.ts +0 -293
  396. package/test/session/llm.test.ts +0 -90
  397. package/test/session/message-v2.test.ts +0 -786
  398. package/test/session/retry.test.ts +0 -131
  399. package/test/session/revert-compact.test.ts +0 -285
  400. package/test/session/session.test.ts +0 -71
  401. package/test/skill/skill.test.ts +0 -185
  402. package/test/snapshot/snapshot.test.ts +0 -939
  403. package/test/tool/__snapshots__/tool.test.ts.snap +0 -9
  404. package/test/tool/apply_patch.test.ts +0 -499
  405. package/test/tool/bash.test.ts +0 -320
  406. package/test/tool/external-directory.test.ts +0 -126
  407. package/test/tool/fixtures/large-image.png +0 -0
  408. package/test/tool/fixtures/models-api.json +0 -33453
  409. package/test/tool/grep.test.ts +0 -109
  410. package/test/tool/question.test.ts +0 -105
  411. package/test/tool/read.test.ts +0 -332
  412. package/test/tool/registry.test.ts +0 -76
  413. package/test/tool/truncation.test.ts +0 -159
  414. package/test/util/filesystem.test.ts +0 -39
  415. package/test/util/format.test.ts +0 -59
  416. package/test/util/iife.test.ts +0 -36
  417. package/test/util/lazy.test.ts +0 -50
  418. package/test/util/lock.test.ts +0 -72
  419. package/test/util/timeout.test.ts +0 -21
  420. package/test/util/wildcard.test.ts +0 -75
  421. package/tsconfig.json +0 -16
@@ -1,1153 +0,0 @@
1
- import { SyntaxStyle, RGBA, type TerminalColors } from "@opentui/core"
2
- import path from "path"
3
- import { createEffect, createMemo, onMount } from "solid-js"
4
- import { useSync } from "@tui/context/sync"
5
- import { createSimpleContext } from "./helper"
6
- import aura from "./theme/aura.json" with { type: "json" }
7
- import ayu from "./theme/ayu.json" with { type: "json" }
8
- import catppuccin from "./theme/catppuccin.json" with { type: "json" }
9
- import catppuccinFrappe from "./theme/catppuccin-frappe.json" with { type: "json" }
10
- import catppuccinMacchiato from "./theme/catppuccin-macchiato.json" with { type: "json" }
11
- import cobalt2 from "./theme/cobalt2.json" with { type: "json" }
12
- import cursor from "./theme/cursor.json" with { type: "json" }
13
- import dracula from "./theme/dracula.json" with { type: "json" }
14
- import everforest from "./theme/everforest.json" with { type: "json" }
15
- import flexoki from "./theme/flexoki.json" with { type: "json" }
16
- import github from "./theme/github.json" with { type: "json" }
17
- import gruvbox from "./theme/gruvbox.json" with { type: "json" }
18
- import kanagawa from "./theme/kanagawa.json" with { type: "json" }
19
- import material from "./theme/material.json" with { type: "json" }
20
- import matrix from "./theme/matrix.json" with { type: "json" }
21
- import mercury from "./theme/mercury.json" with { type: "json" }
22
- import monokai from "./theme/monokai.json" with { type: "json" }
23
- import nightowl from "./theme/nightowl.json" with { type: "json" }
24
- import nord from "./theme/nord.json" with { type: "json" }
25
- import osakaJade from "./theme/osaka-jade.json" with { type: "json" }
26
- import onedark from "./theme/one-dark.json" with { type: "json" }
27
- import jonsoc from "./theme/jonsoc.json" with { type: "json" }
28
- import orng from "./theme/orng.json" with { type: "json" }
29
- import lucentOrng from "./theme/lucent-orng.json" with { type: "json" }
30
- import palenight from "./theme/palenight.json" with { type: "json" }
31
- import rosepine from "./theme/rosepine.json" with { type: "json" }
32
- import solarized from "./theme/solarized.json" with { type: "json" }
33
- import synthwave84 from "./theme/synthwave84.json" with { type: "json" }
34
- import tokyonight from "./theme/tokyonight.json" with { type: "json" }
35
- import vercel from "./theme/vercel.json" with { type: "json" }
36
- import vesper from "./theme/vesper.json" with { type: "json" }
37
- import zenburn from "./theme/zenburn.json" with { type: "json" }
38
- import carbonfox from "./theme/carbonfox.json" with { type: "json" }
39
- import { useKV } from "./kv"
40
- import { useRenderer } from "@opentui/solid"
41
- import { createStore, produce } from "solid-js/store"
42
- import { Global } from "@/global"
43
- import { Filesystem } from "@/util/filesystem"
44
- import { useSDK } from "./sdk"
45
-
46
- type ThemeColors = {
47
- primary: RGBA
48
- secondary: RGBA
49
- accent: RGBA
50
- error: RGBA
51
- warning: RGBA
52
- success: RGBA
53
- info: RGBA
54
- text: RGBA
55
- textMuted: RGBA
56
- selectedListItemText: RGBA
57
- background: RGBA
58
- backgroundPanel: RGBA
59
- backgroundElement: RGBA
60
- backgroundMenu: RGBA
61
- border: RGBA
62
- borderActive: RGBA
63
- borderSubtle: RGBA
64
- diffAdded: RGBA
65
- diffRemoved: RGBA
66
- diffContext: RGBA
67
- diffHunkHeader: RGBA
68
- diffHighlightAdded: RGBA
69
- diffHighlightRemoved: RGBA
70
- diffAddedBg: RGBA
71
- diffRemovedBg: RGBA
72
- diffContextBg: RGBA
73
- diffLineNumber: RGBA
74
- diffAddedLineNumberBg: RGBA
75
- diffRemovedLineNumberBg: RGBA
76
- markdownText: RGBA
77
- markdownHeading: RGBA
78
- markdownLink: RGBA
79
- markdownLinkText: RGBA
80
- markdownCode: RGBA
81
- markdownBlockQuote: RGBA
82
- markdownEmph: RGBA
83
- markdownStrong: RGBA
84
- markdownHorizontalRule: RGBA
85
- markdownListItem: RGBA
86
- markdownListEnumeration: RGBA
87
- markdownImage: RGBA
88
- markdownImageText: RGBA
89
- markdownCodeBlock: RGBA
90
- syntaxComment: RGBA
91
- syntaxKeyword: RGBA
92
- syntaxFunction: RGBA
93
- syntaxVariable: RGBA
94
- syntaxString: RGBA
95
- syntaxNumber: RGBA
96
- syntaxType: RGBA
97
- syntaxOperator: RGBA
98
- syntaxPunctuation: RGBA
99
- }
100
-
101
- type Theme = ThemeColors & {
102
- _hasSelectedListItemText: boolean
103
- thinkingOpacity: number
104
- }
105
-
106
- export function selectedForeground(theme: Theme, bg?: RGBA): RGBA {
107
- // If theme explicitly defines selectedListItemText, use it
108
- if (theme._hasSelectedListItemText) {
109
- return theme.selectedListItemText
110
- }
111
-
112
- // For transparent backgrounds, calculate contrast based on the actual bg (or fallback to primary)
113
- if (theme.background.a === 0) {
114
- const targetColor = bg ?? theme.primary
115
- const { r, g, b } = targetColor
116
- const luminance = 0.299 * r + 0.587 * g + 0.114 * b
117
- return luminance > 0.5 ? RGBA.fromInts(0, 0, 0) : RGBA.fromInts(255, 255, 255)
118
- }
119
-
120
- // Fall back to background color
121
- return theme.background
122
- }
123
-
124
- type HexColor = `#${string}`
125
- type RefName = string
126
- type Variant = {
127
- dark: HexColor | RefName
128
- light: HexColor | RefName
129
- }
130
- type ColorValue = HexColor | RefName | Variant | RGBA
131
- type ThemeJson = {
132
- $schema?: string
133
- defs?: Record<string, HexColor | RefName>
134
- theme: Omit<Record<keyof ThemeColors, ColorValue>, "selectedListItemText" | "backgroundMenu"> & {
135
- selectedListItemText?: ColorValue
136
- backgroundMenu?: ColorValue
137
- thinkingOpacity?: number
138
- }
139
- }
140
-
141
- export const DEFAULT_THEMES: Record<string, ThemeJson> = {
142
- aura,
143
- ayu,
144
- catppuccin,
145
- ["catppuccin-frappe"]: catppuccinFrappe,
146
- ["catppuccin-macchiato"]: catppuccinMacchiato,
147
- cobalt2,
148
- cursor,
149
- dracula,
150
- everforest,
151
- flexoki,
152
- github,
153
- gruvbox,
154
- kanagawa,
155
- material,
156
- matrix,
157
- mercury,
158
- monokai,
159
- nightowl,
160
- nord,
161
- ["one-dark"]: onedark,
162
- ["osaka-jade"]: osakaJade,
163
- jonsoc,
164
- jonsoc: jonsoc,
165
- orng,
166
- ["lucent-orng"]: lucentOrng,
167
- palenight,
168
- rosepine,
169
- solarized,
170
- synthwave84,
171
- tokyonight,
172
- vesper,
173
- vercel,
174
- zenburn,
175
- carbonfox,
176
- }
177
-
178
- function resolveTheme(theme: ThemeJson, mode: "dark" | "light") {
179
- const defs = theme.defs ?? {}
180
- function resolveColor(c: ColorValue): RGBA {
181
- if (c instanceof RGBA) return c
182
- if (typeof c === "string") {
183
- if (c === "transparent" || c === "none") return RGBA.fromInts(0, 0, 0, 0)
184
-
185
- if (c.startsWith("#")) return RGBA.fromHex(c)
186
-
187
- if (defs[c] != null) {
188
- return resolveColor(defs[c])
189
- } else if (theme.theme[c as keyof ThemeColors] !== undefined) {
190
- return resolveColor(theme.theme[c as keyof ThemeColors]!)
191
- } else {
192
- throw new Error(`Color reference "${c}" not found in defs or theme`)
193
- }
194
- }
195
- if (typeof c === "number") {
196
- return ansiToRgba(c)
197
- }
198
- return resolveColor(c[mode])
199
- }
200
-
201
- const resolved = Object.fromEntries(
202
- Object.entries(theme.theme)
203
- .filter(([key]) => key !== "selectedListItemText" && key !== "backgroundMenu" && key !== "thinkingOpacity")
204
- .map(([key, value]) => {
205
- return [key, resolveColor(value as ColorValue)]
206
- }),
207
- ) as Partial<ThemeColors>
208
-
209
- // Handle selectedListItemText separately since it's optional
210
- const hasSelectedListItemText = theme.theme.selectedListItemText !== undefined
211
- if (hasSelectedListItemText) {
212
- resolved.selectedListItemText = resolveColor(theme.theme.selectedListItemText!)
213
- } else {
214
- // Backward compatibility: if selectedListItemText is not defined, use background color
215
- // This preserves the current behavior for all existing themes
216
- resolved.selectedListItemText = resolved.background
217
- }
218
-
219
- // Handle backgroundMenu - optional with fallback to backgroundElement
220
- if (theme.theme.backgroundMenu !== undefined) {
221
- resolved.backgroundMenu = resolveColor(theme.theme.backgroundMenu)
222
- } else {
223
- resolved.backgroundMenu = resolved.backgroundElement
224
- }
225
-
226
- // Handle thinkingOpacity - optional with default of 0.6
227
- const thinkingOpacity = theme.theme.thinkingOpacity ?? 0.6
228
-
229
- return {
230
- ...resolved,
231
- _hasSelectedListItemText: hasSelectedListItemText,
232
- thinkingOpacity,
233
- } as Theme
234
- }
235
-
236
- function ansiToRgba(code: number): RGBA {
237
- // Standard ANSI colors (0-15)
238
- if (code < 16) {
239
- const ansiColors = [
240
- "#000000", // Black
241
- "#800000", // Red
242
- "#008000", // Green
243
- "#808000", // Yellow
244
- "#000080", // Blue
245
- "#800080", // Magenta
246
- "#008080", // Cyan
247
- "#c0c0c0", // White
248
- "#808080", // Bright Black
249
- "#ff0000", // Bright Red
250
- "#00ff00", // Bright Green
251
- "#ffff00", // Bright Yellow
252
- "#0000ff", // Bright Blue
253
- "#ff00ff", // Bright Magenta
254
- "#00ffff", // Bright Cyan
255
- "#ffffff", // Bright White
256
- ]
257
- return RGBA.fromHex(ansiColors[code] ?? "#000000")
258
- }
259
-
260
- // 6x6x6 Color Cube (16-231)
261
- if (code < 232) {
262
- const index = code - 16
263
- const b = index % 6
264
- const g = Math.floor(index / 6) % 6
265
- const r = Math.floor(index / 36)
266
-
267
- const val = (x: number) => (x === 0 ? 0 : x * 40 + 55)
268
- return RGBA.fromInts(val(r), val(g), val(b))
269
- }
270
-
271
- // Grayscale Ramp (232-255)
272
- if (code < 256) {
273
- const gray = (code - 232) * 10 + 8
274
- return RGBA.fromInts(gray, gray, gray)
275
- }
276
-
277
- // Fallback for invalid codes
278
- return RGBA.fromInts(0, 0, 0)
279
- }
280
-
281
- export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
282
- name: "Theme",
283
- init: (props: { mode: "dark" | "light" }) => {
284
- const sync = useSync()
285
- const kv = useKV()
286
- const [store, setStore] = createStore({
287
- themes: DEFAULT_THEMES,
288
- mode: kv.get("theme_mode", props.mode),
289
- active: (sync.data.config.theme ?? kv.get("theme", "jonsoc")) as string,
290
- ready: false,
291
- })
292
-
293
- createEffect(() => {
294
- const theme = sync.data.config.theme
295
- if (theme) setStore("active", theme)
296
- })
297
-
298
- function init() {
299
- resolveSystemTheme()
300
- getCustomThemes()
301
- .then((custom) => {
302
- setStore(
303
- produce((draft) => {
304
- Object.assign(draft.themes, custom)
305
- }),
306
- )
307
- })
308
- .catch(() => {
309
- setStore("active", "jonsoc")
310
- })
311
- .finally(() => {
312
- if (store.active !== "system") {
313
- setStore("ready", true)
314
- }
315
- })
316
- }
317
-
318
- onMount(init)
319
-
320
- function resolveSystemTheme() {
321
- console.log("resolveSystemTheme")
322
- renderer
323
- .getPalette({
324
- size: 16,
325
- })
326
- .then((colors) => {
327
- console.log(colors.palette)
328
- if (!colors.palette[0]) {
329
- if (store.active === "system") {
330
- setStore(
331
- produce((draft) => {
332
- draft.active = "jonsoc"
333
- draft.ready = true
334
- }),
335
- )
336
- }
337
- return
338
- }
339
- setStore(
340
- produce((draft) => {
341
- draft.themes.system = generateSystem(colors, store.mode)
342
- if (store.active === "system") {
343
- draft.ready = true
344
- }
345
- }),
346
- )
347
- })
348
- }
349
-
350
- const renderer = useRenderer()
351
- process.on("SIGUSR2", async () => {
352
- renderer.clearPaletteCache()
353
- init()
354
- })
355
-
356
- const values = createMemo(() => {
357
- return resolveTheme(store.themes[store.active] ?? store.themes.jonsoc, store.mode)
358
- })
359
-
360
- const syntax = createMemo(() => generateSyntax(values()))
361
- const subtleSyntax = createMemo(() => generateSubtleSyntax(values()))
362
-
363
- return {
364
- theme: new Proxy(values(), {
365
- get(_target, prop) {
366
- // @ts-expect-error
367
- return values()[prop]
368
- },
369
- }),
370
- get selected() {
371
- return store.active
372
- },
373
- all() {
374
- return store.themes
375
- },
376
- syntax,
377
- subtleSyntax,
378
- mode() {
379
- return store.mode
380
- },
381
- setMode(mode: "dark" | "light") {
382
- setStore("mode", mode)
383
- kv.set("theme_mode", mode)
384
- },
385
- set(theme: string) {
386
- setStore("active", theme)
387
- kv.set("theme", theme)
388
- },
389
- get ready() {
390
- return store.ready
391
- },
392
- }
393
- },
394
- })
395
-
396
- const CUSTOM_THEME_GLOB = new Bun.Glob("themes/*.json")
397
- async function getCustomThemes() {
398
- const directories = [
399
- Global.Path.config,
400
- ...(await Array.fromAsync(
401
- Filesystem.up({
402
- targets: [".jonsoc", ".jonsoc"],
403
- start: process.cwd(),
404
- }),
405
- )),
406
- ]
407
-
408
- const result: Record<string, ThemeJson> = {}
409
- for (const dir of directories) {
410
- for await (const item of CUSTOM_THEME_GLOB.scan({
411
- absolute: true,
412
- followSymlinks: true,
413
- dot: true,
414
- cwd: dir,
415
- })) {
416
- const name = path.basename(item, ".json")
417
- result[name] = await Bun.file(item).json()
418
- }
419
- }
420
- return result
421
- }
422
-
423
- export function tint(base: RGBA, overlay: RGBA, alpha: number): RGBA {
424
- const r = base.r + (overlay.r - base.r) * alpha
425
- const g = base.g + (overlay.g - base.g) * alpha
426
- const b = base.b + (overlay.b - base.b) * alpha
427
- return RGBA.fromInts(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255))
428
- }
429
-
430
- function generateSystem(colors: TerminalColors, mode: "dark" | "light"): ThemeJson {
431
- const bg = RGBA.fromHex(colors.defaultBackground ?? colors.palette[0]!)
432
- const fg = RGBA.fromHex(colors.defaultForeground ?? colors.palette[7]!)
433
- const isDark = mode == "dark"
434
-
435
- const col = (i: number) => {
436
- const value = colors.palette[i]
437
- if (value) return RGBA.fromHex(value)
438
- return ansiToRgba(i)
439
- }
440
-
441
- // Generate gray scale based on terminal background
442
- const grays = generateGrayScale(bg, isDark)
443
- const textMuted = generateMutedTextColor(bg, isDark)
444
-
445
- // ANSI color references
446
- const ansiColors = {
447
- black: col(0),
448
- red: col(1),
449
- green: col(2),
450
- yellow: col(3),
451
- blue: col(4),
452
- magenta: col(5),
453
- cyan: col(6),
454
- white: col(7),
455
- redBright: col(9),
456
- greenBright: col(10),
457
- }
458
-
459
- const diffAlpha = isDark ? 0.22 : 0.14
460
- const diffAddedBg = tint(bg, ansiColors.green, diffAlpha)
461
- const diffRemovedBg = tint(bg, ansiColors.red, diffAlpha)
462
- const diffAddedLineNumberBg = tint(grays[3], ansiColors.green, diffAlpha)
463
- const diffRemovedLineNumberBg = tint(grays[3], ansiColors.red, diffAlpha)
464
-
465
- return {
466
- theme: {
467
- // Primary colors using ANSI
468
- primary: ansiColors.cyan,
469
- secondary: ansiColors.magenta,
470
- accent: ansiColors.cyan,
471
-
472
- // Status colors using ANSI
473
- error: ansiColors.red,
474
- warning: ansiColors.yellow,
475
- success: ansiColors.green,
476
- info: ansiColors.cyan,
477
-
478
- // Text colors
479
- text: fg,
480
- textMuted,
481
- selectedListItemText: bg,
482
-
483
- // Background colors
484
- background: bg,
485
- backgroundPanel: grays[2],
486
- backgroundElement: grays[3],
487
- backgroundMenu: grays[3],
488
-
489
- // Border colors
490
- borderSubtle: grays[6],
491
- border: grays[7],
492
- borderActive: grays[8],
493
-
494
- // Diff colors
495
- diffAdded: ansiColors.green,
496
- diffRemoved: ansiColors.red,
497
- diffContext: grays[7],
498
- diffHunkHeader: grays[7],
499
- diffHighlightAdded: ansiColors.greenBright,
500
- diffHighlightRemoved: ansiColors.redBright,
501
- diffAddedBg,
502
- diffRemovedBg,
503
- diffContextBg: grays[1],
504
- diffLineNumber: grays[6],
505
- diffAddedLineNumberBg,
506
- diffRemovedLineNumberBg,
507
-
508
- // Markdown colors
509
- markdownText: fg,
510
- markdownHeading: fg,
511
- markdownLink: ansiColors.blue,
512
- markdownLinkText: ansiColors.cyan,
513
- markdownCode: ansiColors.green,
514
- markdownBlockQuote: ansiColors.yellow,
515
- markdownEmph: ansiColors.yellow,
516
- markdownStrong: fg,
517
- markdownHorizontalRule: grays[7],
518
- markdownListItem: ansiColors.blue,
519
- markdownListEnumeration: ansiColors.cyan,
520
- markdownImage: ansiColors.blue,
521
- markdownImageText: ansiColors.cyan,
522
- markdownCodeBlock: fg,
523
-
524
- // Syntax colors
525
- syntaxComment: textMuted,
526
- syntaxKeyword: ansiColors.magenta,
527
- syntaxFunction: ansiColors.blue,
528
- syntaxVariable: fg,
529
- syntaxString: ansiColors.green,
530
- syntaxNumber: ansiColors.yellow,
531
- syntaxType: ansiColors.cyan,
532
- syntaxOperator: ansiColors.cyan,
533
- syntaxPunctuation: fg,
534
- },
535
- }
536
- }
537
-
538
- function generateGrayScale(bg: RGBA, isDark: boolean): Record<number, RGBA> {
539
- const grays: Record<number, RGBA> = {}
540
-
541
- // RGBA stores floats in range 0-1, convert to 0-255
542
- const bgR = bg.r * 255
543
- const bgG = bg.g * 255
544
- const bgB = bg.b * 255
545
-
546
- const luminance = 0.299 * bgR + 0.587 * bgG + 0.114 * bgB
547
-
548
- for (let i = 1; i <= 12; i++) {
549
- const factor = i / 12.0
550
-
551
- let grayValue: number
552
- let newR: number
553
- let newG: number
554
- let newB: number
555
-
556
- if (isDark) {
557
- if (luminance < 10) {
558
- grayValue = Math.floor(factor * 0.4 * 255)
559
- newR = grayValue
560
- newG = grayValue
561
- newB = grayValue
562
- } else {
563
- const newLum = luminance + (255 - luminance) * factor * 0.4
564
-
565
- const ratio = newLum / luminance
566
- newR = Math.min(bgR * ratio, 255)
567
- newG = Math.min(bgG * ratio, 255)
568
- newB = Math.min(bgB * ratio, 255)
569
- }
570
- } else {
571
- if (luminance > 245) {
572
- grayValue = Math.floor(255 - factor * 0.4 * 255)
573
- newR = grayValue
574
- newG = grayValue
575
- newB = grayValue
576
- } else {
577
- const newLum = luminance * (1 - factor * 0.4)
578
-
579
- const ratio = newLum / luminance
580
- newR = Math.max(bgR * ratio, 0)
581
- newG = Math.max(bgG * ratio, 0)
582
- newB = Math.max(bgB * ratio, 0)
583
- }
584
- }
585
-
586
- grays[i] = RGBA.fromInts(Math.floor(newR), Math.floor(newG), Math.floor(newB))
587
- }
588
-
589
- return grays
590
- }
591
-
592
- function generateMutedTextColor(bg: RGBA, isDark: boolean): RGBA {
593
- // RGBA stores floats in range 0-1, convert to 0-255
594
- const bgR = bg.r * 255
595
- const bgG = bg.g * 255
596
- const bgB = bg.b * 255
597
-
598
- const bgLum = 0.299 * bgR + 0.587 * bgG + 0.114 * bgB
599
-
600
- let grayValue: number
601
-
602
- if (isDark) {
603
- if (bgLum < 10) {
604
- // Very dark/black background
605
- grayValue = 180 // #b4b4b4
606
- } else {
607
- // Scale up for lighter dark backgrounds
608
- grayValue = Math.min(Math.floor(160 + bgLum * 0.3), 200)
609
- }
610
- } else {
611
- if (bgLum > 245) {
612
- // Very light/white background
613
- grayValue = 75 // #4b4b4b
614
- } else {
615
- // Scale down for darker light backgrounds
616
- grayValue = Math.max(Math.floor(100 - (255 - bgLum) * 0.2), 60)
617
- }
618
- }
619
-
620
- return RGBA.fromInts(grayValue, grayValue, grayValue)
621
- }
622
-
623
- function generateSyntax(theme: Theme) {
624
- return SyntaxStyle.fromTheme(getSyntaxRules(theme))
625
- }
626
-
627
- function generateSubtleSyntax(theme: Theme) {
628
- const rules = getSyntaxRules(theme)
629
- return SyntaxStyle.fromTheme(
630
- rules.map((rule) => {
631
- if (rule.style.foreground) {
632
- const fg = rule.style.foreground
633
- return {
634
- ...rule,
635
- style: {
636
- ...rule.style,
637
- foreground: RGBA.fromInts(
638
- Math.round(fg.r * 255),
639
- Math.round(fg.g * 255),
640
- Math.round(fg.b * 255),
641
- Math.round(theme.thinkingOpacity * 255),
642
- ),
643
- },
644
- }
645
- }
646
- return rule
647
- }),
648
- )
649
- }
650
-
651
- function getSyntaxRules(theme: Theme) {
652
- return [
653
- {
654
- scope: ["default"],
655
- style: {
656
- foreground: theme.text,
657
- },
658
- },
659
- {
660
- scope: ["prompt"],
661
- style: {
662
- foreground: theme.accent,
663
- },
664
- },
665
- {
666
- scope: ["extmark.file"],
667
- style: {
668
- foreground: theme.warning,
669
- bold: true,
670
- },
671
- },
672
- {
673
- scope: ["extmark.agent"],
674
- style: {
675
- foreground: theme.secondary,
676
- bold: true,
677
- },
678
- },
679
- {
680
- scope: ["extmark.paste"],
681
- style: {
682
- foreground: theme.background,
683
- background: theme.warning,
684
- bold: true,
685
- },
686
- },
687
- {
688
- scope: ["comment"],
689
- style: {
690
- foreground: theme.syntaxComment,
691
- italic: true,
692
- },
693
- },
694
- {
695
- scope: ["comment.documentation"],
696
- style: {
697
- foreground: theme.syntaxComment,
698
- italic: true,
699
- },
700
- },
701
- {
702
- scope: ["string", "symbol"],
703
- style: {
704
- foreground: theme.syntaxString,
705
- },
706
- },
707
- {
708
- scope: ["number", "boolean"],
709
- style: {
710
- foreground: theme.syntaxNumber,
711
- },
712
- },
713
- {
714
- scope: ["character.special"],
715
- style: {
716
- foreground: theme.syntaxString,
717
- },
718
- },
719
- {
720
- scope: ["keyword.return", "keyword.conditional", "keyword.repeat", "keyword.coroutine"],
721
- style: {
722
- foreground: theme.syntaxKeyword,
723
- italic: true,
724
- },
725
- },
726
- {
727
- scope: ["keyword.type"],
728
- style: {
729
- foreground: theme.syntaxType,
730
- bold: true,
731
- italic: true,
732
- },
733
- },
734
- {
735
- scope: ["keyword.function", "function.method"],
736
- style: {
737
- foreground: theme.syntaxFunction,
738
- },
739
- },
740
- {
741
- scope: ["keyword"],
742
- style: {
743
- foreground: theme.syntaxKeyword,
744
- italic: true,
745
- },
746
- },
747
- {
748
- scope: ["keyword.import"],
749
- style: {
750
- foreground: theme.syntaxKeyword,
751
- },
752
- },
753
- {
754
- scope: ["operator", "keyword.operator", "punctuation.delimiter"],
755
- style: {
756
- foreground: theme.syntaxOperator,
757
- },
758
- },
759
- {
760
- scope: ["keyword.conditional.ternary"],
761
- style: {
762
- foreground: theme.syntaxOperator,
763
- },
764
- },
765
- {
766
- scope: ["variable", "variable.parameter", "function.method.call", "function.call"],
767
- style: {
768
- foreground: theme.syntaxVariable,
769
- },
770
- },
771
- {
772
- scope: ["variable.member", "function", "constructor"],
773
- style: {
774
- foreground: theme.syntaxFunction,
775
- },
776
- },
777
- {
778
- scope: ["type", "module"],
779
- style: {
780
- foreground: theme.syntaxType,
781
- },
782
- },
783
- {
784
- scope: ["constant"],
785
- style: {
786
- foreground: theme.syntaxNumber,
787
- },
788
- },
789
- {
790
- scope: ["property"],
791
- style: {
792
- foreground: theme.syntaxVariable,
793
- },
794
- },
795
- {
796
- scope: ["class"],
797
- style: {
798
- foreground: theme.syntaxType,
799
- },
800
- },
801
- {
802
- scope: ["parameter"],
803
- style: {
804
- foreground: theme.syntaxVariable,
805
- },
806
- },
807
- {
808
- scope: ["punctuation", "punctuation.bracket"],
809
- style: {
810
- foreground: theme.syntaxPunctuation,
811
- },
812
- },
813
- {
814
- scope: ["variable.builtin", "type.builtin", "function.builtin", "module.builtin", "constant.builtin"],
815
- style: {
816
- foreground: theme.error,
817
- },
818
- },
819
- {
820
- scope: ["variable.super"],
821
- style: {
822
- foreground: theme.error,
823
- },
824
- },
825
- {
826
- scope: ["string.escape", "string.regexp"],
827
- style: {
828
- foreground: theme.syntaxKeyword,
829
- },
830
- },
831
- {
832
- scope: ["keyword.directive"],
833
- style: {
834
- foreground: theme.syntaxKeyword,
835
- italic: true,
836
- },
837
- },
838
- {
839
- scope: ["punctuation.special"],
840
- style: {
841
- foreground: theme.syntaxOperator,
842
- },
843
- },
844
- {
845
- scope: ["keyword.modifier"],
846
- style: {
847
- foreground: theme.syntaxKeyword,
848
- italic: true,
849
- },
850
- },
851
- {
852
- scope: ["keyword.exception"],
853
- style: {
854
- foreground: theme.syntaxKeyword,
855
- italic: true,
856
- },
857
- },
858
- // Markdown specific styles
859
- {
860
- scope: ["markup.heading"],
861
- style: {
862
- foreground: theme.markdownHeading,
863
- bold: true,
864
- },
865
- },
866
- {
867
- scope: ["markup.heading.1"],
868
- style: {
869
- foreground: theme.markdownHeading,
870
- bold: true,
871
- },
872
- },
873
- {
874
- scope: ["markup.heading.2"],
875
- style: {
876
- foreground: theme.markdownHeading,
877
- bold: true,
878
- },
879
- },
880
- {
881
- scope: ["markup.heading.3"],
882
- style: {
883
- foreground: theme.markdownHeading,
884
- bold: true,
885
- },
886
- },
887
- {
888
- scope: ["markup.heading.4"],
889
- style: {
890
- foreground: theme.markdownHeading,
891
- bold: true,
892
- },
893
- },
894
- {
895
- scope: ["markup.heading.5"],
896
- style: {
897
- foreground: theme.markdownHeading,
898
- bold: true,
899
- },
900
- },
901
- {
902
- scope: ["markup.heading.6"],
903
- style: {
904
- foreground: theme.markdownHeading,
905
- bold: true,
906
- },
907
- },
908
- {
909
- scope: ["markup.bold", "markup.strong"],
910
- style: {
911
- foreground: theme.markdownStrong,
912
- bold: true,
913
- },
914
- },
915
- {
916
- scope: ["markup.italic"],
917
- style: {
918
- foreground: theme.markdownEmph,
919
- italic: true,
920
- },
921
- },
922
- {
923
- scope: ["markup.list"],
924
- style: {
925
- foreground: theme.markdownListItem,
926
- },
927
- },
928
- {
929
- scope: ["markup.quote"],
930
- style: {
931
- foreground: theme.markdownBlockQuote,
932
- italic: true,
933
- },
934
- },
935
- {
936
- scope: ["markup.raw", "markup.raw.block"],
937
- style: {
938
- foreground: theme.markdownCode,
939
- },
940
- },
941
- {
942
- scope: ["markup.raw.inline"],
943
- style: {
944
- foreground: theme.markdownCode,
945
- background: theme.background,
946
- },
947
- },
948
- {
949
- scope: ["markup.link"],
950
- style: {
951
- foreground: theme.markdownLink,
952
- underline: true,
953
- },
954
- },
955
- {
956
- scope: ["markup.link.label"],
957
- style: {
958
- foreground: theme.markdownLinkText,
959
- underline: true,
960
- },
961
- },
962
- {
963
- scope: ["markup.link.url"],
964
- style: {
965
- foreground: theme.markdownLink,
966
- underline: true,
967
- },
968
- },
969
- {
970
- scope: ["label"],
971
- style: {
972
- foreground: theme.markdownLinkText,
973
- },
974
- },
975
- {
976
- scope: ["spell", "nospell"],
977
- style: {
978
- foreground: theme.text,
979
- },
980
- },
981
- {
982
- scope: ["conceal"],
983
- style: {
984
- foreground: theme.textMuted,
985
- },
986
- },
987
- // Additional common highlight groups
988
- {
989
- scope: ["string.special", "string.special.url"],
990
- style: {
991
- foreground: theme.markdownLink,
992
- underline: true,
993
- },
994
- },
995
- {
996
- scope: ["character"],
997
- style: {
998
- foreground: theme.syntaxString,
999
- },
1000
- },
1001
- {
1002
- scope: ["float"],
1003
- style: {
1004
- foreground: theme.syntaxNumber,
1005
- },
1006
- },
1007
- {
1008
- scope: ["comment.error"],
1009
- style: {
1010
- foreground: theme.error,
1011
- italic: true,
1012
- bold: true,
1013
- },
1014
- },
1015
- {
1016
- scope: ["comment.warning"],
1017
- style: {
1018
- foreground: theme.warning,
1019
- italic: true,
1020
- bold: true,
1021
- },
1022
- },
1023
- {
1024
- scope: ["comment.todo", "comment.note"],
1025
- style: {
1026
- foreground: theme.info,
1027
- italic: true,
1028
- bold: true,
1029
- },
1030
- },
1031
- {
1032
- scope: ["namespace"],
1033
- style: {
1034
- foreground: theme.syntaxType,
1035
- },
1036
- },
1037
- {
1038
- scope: ["field"],
1039
- style: {
1040
- foreground: theme.syntaxVariable,
1041
- },
1042
- },
1043
- {
1044
- scope: ["type.definition"],
1045
- style: {
1046
- foreground: theme.syntaxType,
1047
- bold: true,
1048
- },
1049
- },
1050
- {
1051
- scope: ["keyword.export"],
1052
- style: {
1053
- foreground: theme.syntaxKeyword,
1054
- },
1055
- },
1056
- {
1057
- scope: ["attribute", "annotation"],
1058
- style: {
1059
- foreground: theme.warning,
1060
- },
1061
- },
1062
- {
1063
- scope: ["tag"],
1064
- style: {
1065
- foreground: theme.error,
1066
- },
1067
- },
1068
- {
1069
- scope: ["tag.attribute"],
1070
- style: {
1071
- foreground: theme.syntaxKeyword,
1072
- },
1073
- },
1074
- {
1075
- scope: ["tag.delimiter"],
1076
- style: {
1077
- foreground: theme.syntaxOperator,
1078
- },
1079
- },
1080
- {
1081
- scope: ["markup.strikethrough"],
1082
- style: {
1083
- foreground: theme.textMuted,
1084
- },
1085
- },
1086
- {
1087
- scope: ["markup.underline"],
1088
- style: {
1089
- foreground: theme.text,
1090
- underline: true,
1091
- },
1092
- },
1093
- {
1094
- scope: ["markup.list.checked"],
1095
- style: {
1096
- foreground: theme.success,
1097
- },
1098
- },
1099
- {
1100
- scope: ["markup.list.unchecked"],
1101
- style: {
1102
- foreground: theme.textMuted,
1103
- },
1104
- },
1105
- {
1106
- scope: ["diff.plus"],
1107
- style: {
1108
- foreground: theme.diffAdded,
1109
- background: theme.diffAddedBg,
1110
- },
1111
- },
1112
- {
1113
- scope: ["diff.minus"],
1114
- style: {
1115
- foreground: theme.diffRemoved,
1116
- background: theme.diffRemovedBg,
1117
- },
1118
- },
1119
- {
1120
- scope: ["diff.delta"],
1121
- style: {
1122
- foreground: theme.diffContext,
1123
- background: theme.diffContextBg,
1124
- },
1125
- },
1126
- {
1127
- scope: ["error"],
1128
- style: {
1129
- foreground: theme.error,
1130
- bold: true,
1131
- },
1132
- },
1133
- {
1134
- scope: ["warning"],
1135
- style: {
1136
- foreground: theme.warning,
1137
- bold: true,
1138
- },
1139
- },
1140
- {
1141
- scope: ["info"],
1142
- style: {
1143
- foreground: theme.info,
1144
- },
1145
- },
1146
- {
1147
- scope: ["debug"],
1148
- style: {
1149
- foreground: theme.textMuted,
1150
- },
1151
- },
1152
- ]
1153
- }