innocode 1.0.0 → 1.0.229

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