mu-agent 0.1.8 → 0.1.13

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 (176) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/README.md +34 -30
  3. package/dist/bundle/chunks/anthropic-messages-4PAJY4R6.js +6 -0
  4. package/dist/bundle/chunks/anthropic.js +1 -1
  5. package/dist/bundle/chunks/azure-openai-responses-Y4BBWQ3N.js +2 -0
  6. package/dist/bundle/chunks/bedrock-converse-stream.js +12 -9
  7. package/dist/bundle/chunks/{chunk-NG4PO5FP.js → chunk-3J3HSHLX.js} +128 -110
  8. package/dist/bundle/chunks/{chunk-TRDNDS6A.js → chunk-3V45WARH.js} +6 -3
  9. package/dist/bundle/chunks/{chunk-S3GGRYIO.js → chunk-5AGIVGSV.js} +1 -1
  10. package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
  11. package/dist/bundle/chunks/{chunk-4OBXYPH4.js → chunk-6Z2347ML.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-F5ZABL6Z.js → chunk-7CBJINYJ.js} +2 -2
  13. package/dist/bundle/chunks/{chunk-DRQDKNXA.js → chunk-7DDKXS2Q.js} +1 -1
  14. package/dist/bundle/chunks/{chunk-H3QXYIF7.js → chunk-CF5GWZHW.js} +1 -1
  15. package/dist/bundle/chunks/{chunk-RLZVFGW4.js → chunk-DYTENXHX.js} +29 -92
  16. package/dist/bundle/chunks/{chunk-NTSWBG4X.js → chunk-FLHKNMLQ.js} +1 -1
  17. package/dist/bundle/chunks/chunk-FTJT2X6E.js +2 -0
  18. package/dist/bundle/chunks/{chunk-4L3WN2XY.js → chunk-JXWJOIH4.js} +1 -1
  19. package/dist/bundle/chunks/{chunk-TAOL3JFA.js → chunk-KIDDRTZP.js} +4 -4
  20. package/dist/bundle/chunks/chunk-LHRPMXVI.js +2 -0
  21. package/dist/bundle/chunks/chunk-LMNWTX2L.js +11 -0
  22. package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
  23. package/dist/bundle/chunks/chunk-LT2C56HV.js +130 -0
  24. package/dist/bundle/chunks/{chunk-6CYCI3EJ.js → chunk-LVVZS2NO.js} +1 -1
  25. package/dist/bundle/chunks/chunk-MF3VB62R.js +91 -0
  26. package/dist/bundle/chunks/chunk-NN4BEPYX.js +2 -0
  27. package/dist/bundle/chunks/{chunk-LD2P6SFZ.js → chunk-PMRZO46Y.js} +1 -1
  28. package/dist/bundle/chunks/chunk-R4VPBBDS.js +2 -0
  29. package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
  30. package/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
  31. package/dist/bundle/chunks/chunk-UKVNB6C4.js +2 -0
  32. package/dist/bundle/chunks/chunk-URBBMV3M.js +9 -0
  33. package/dist/bundle/chunks/chunk-WCGU75WO.js +11 -0
  34. package/dist/bundle/chunks/chunk-WCJNJQO5.js +9 -0
  35. package/dist/bundle/chunks/chunk-WDURT4ZM.js +2 -0
  36. package/dist/bundle/chunks/{cli-AOVD3SSZ.js → cli-M4YBZZ6Q.js} +4 -4
  37. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MEZHQVNP.js +2 -0
  38. package/dist/bundle/chunks/codemode-worker.js +117 -13
  39. package/dist/bundle/chunks/easter-egg-3d-VFY3YRQR.js +2 -0
  40. package/dist/bundle/chunks/execute-FKI7Y4XR.js +499 -0
  41. package/dist/bundle/chunks/github-copilot.js +1 -1
  42. package/dist/bundle/chunks/{google-generative-ai-XMFHGQC5.js → google-generative-ai-D2VJQBTK.js} +1 -1
  43. package/dist/bundle/chunks/{google-vertex-4XRRNP74.js → google-vertex-SQG2BO6C.js} +1 -1
  44. package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
  45. package/dist/bundle/chunks/image-resize-worker.js +1 -1
  46. package/dist/bundle/chunks/{jiti-loader-C3NU2SDH.js → jiti-loader-GL4HJFAD.js} +1 -1
  47. package/dist/bundle/chunks/{jiti-static-loader-E6ANQD5T.js → jiti-static-loader-2RCDI6B4.js} +1 -1
  48. package/dist/bundle/chunks/{lib-TEDK3E5I.js → lib-4AVRLBHM.js} +1 -1
  49. package/dist/bundle/chunks/{llama-cpp-classify-XT44PI3C.js → llama-cpp-classify-5YHLY3RC.js} +2 -2
  50. package/dist/bundle/chunks/mistral-conversations-BDARVJTT.js +5 -0
  51. package/dist/bundle/chunks/{multipart-parser-SQ6GDJL7.js → multipart-parser-FMGQ7342.js} +1 -1
  52. package/dist/bundle/chunks/{node-TWVVAGPO.js → node-AUOGOBCN.js} +1 -1
  53. package/dist/bundle/chunks/{node-N5BSDOA5.js → node-KCMANYC2.js} +1 -1
  54. package/dist/bundle/chunks/openai-chatgpt.js +1 -1
  55. package/dist/bundle/chunks/openai-codex-responses-CECGTDYD.js +10 -0
  56. package/dist/bundle/chunks/openai-codex.js +1 -1
  57. package/dist/bundle/chunks/openai-completions-UOA7MELD.js +7 -0
  58. package/dist/bundle/chunks/openai-decisions-HLM372N6.js +5 -0
  59. package/dist/bundle/chunks/openai-responses-TII7ZY5X.js +3 -0
  60. package/dist/bundle/chunks/{openrouter-images-ZVXWCSIM.js → openrouter-images-7T452AS5.js} +1 -1
  61. package/dist/bundle/chunks/{pi-messages-TM5SOOIW.js → pi-messages-2UDKLKOO.js} +1 -1
  62. package/dist/bundle/chunks/runtime-IKE5OQIW.js +2 -0
  63. package/dist/bundle/chunks/{src-UK77SYZE.js → src-QKGKDFSU.js} +1 -1
  64. package/dist/bundle/chunks/typesafe-system-one-KNCICMO5.js +2 -0
  65. package/dist/bundle/chunks/virtual-modules-TJPHLTRT.js +2 -0
  66. package/dist/bundle/cli-runtime.js +1 -1
  67. package/dist/bundle/index.js +1 -1
  68. package/dist/bundle/rpc-entry.js +1 -1
  69. package/dist/core/export-html/template.js +21 -16
  70. package/dist/modes/interactive/theme/dark.json +1 -1
  71. package/dist/modes/interactive/theme/light.json +1 -1
  72. package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
  73. package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  74. package/dist/modes/interactive/theme/theme-schema.js +105 -0
  75. package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  76. package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
  77. package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
  78. package/dist/modes/interactive/theme/theme-tokens.js +94 -0
  79. package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
  80. package/dist/modes/interactive/theme/theme.d.ts +13 -16
  81. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  82. package/dist/modes/interactive/theme/theme.js +22 -29
  83. package/dist/modes/interactive/theme/theme.js.map +1 -1
  84. package/docs/cli-integration.md +1 -1
  85. package/docs/cli.md +22 -10
  86. package/docs/codemode.md +29 -6
  87. package/docs/compaction.md +5 -5
  88. package/docs/custom-provider.md +53 -1
  89. package/docs/docs.json +8 -0
  90. package/docs/environment-variables.md +3 -1
  91. package/docs/extensions.md +122 -13
  92. package/docs/json.md +3 -3
  93. package/docs/keybindings.md +5 -4
  94. package/docs/llama-cpp.md +9 -2
  95. package/docs/mcp.md +4 -2
  96. package/docs/message-types.md +22 -4
  97. package/docs/models-configuration.md +187 -0
  98. package/docs/models.md +18 -2
  99. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  100. package/docs/providers.md +47 -0
  101. package/docs/sessions.md +1 -1
  102. package/docs/settings.md +9 -6
  103. package/docs/terminal-setup.md +14 -0
  104. package/docs/themes.md +4 -2
  105. package/docs/tui.md +71 -1
  106. package/docs/usage.md +1 -1
  107. package/examples/README.md +0 -3
  108. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  109. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  110. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  111. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  112. package/examples/extensions/gondolin/package-lock.json +2 -2
  113. package/examples/extensions/gondolin/package.json +1 -1
  114. package/examples/extensions/minimal-mode.ts +4 -5
  115. package/examples/extensions/overlay-test.ts +2 -2
  116. package/examples/extensions/plan-mode/index.ts +6 -2
  117. package/examples/extensions/sandbox/package-lock.json +2 -2
  118. package/examples/extensions/sandbox/package.json +1 -1
  119. package/examples/extensions/subagent/index.ts +4 -6
  120. package/examples/extensions/with-deps/package-lock.json +2 -2
  121. package/examples/extensions/with-deps/package.json +1 -1
  122. package/judge/dist/auth.js +91 -35
  123. package/judge/dist/chrome.js +2 -2
  124. package/judge/dist/import.js +852 -175
  125. package/judge/dist/setup.js +240 -153
  126. package/judge/manifest.json +2512 -546
  127. package/judge/mu/chunk-3NQ5BIBI.js +4773 -0
  128. package/judge/mu/chunk-SKGYWHW6.js +51 -0
  129. package/judge/mu/chunk-WQM4MV6L.js +58 -0
  130. package/judge/mu/cloud-code-V7FOGB4J.js +22802 -0
  131. package/judge/mu/dist-75PS4OC4.js +1283 -0
  132. package/judge/{dist/kyrn-judge.js → mu/index.js} +5365 -32809
  133. package/judge/mu/multipart-parser-ZDXVIOOP.js +372 -0
  134. package/judge/mu/src-TVVA5ZK2.js +1409 -0
  135. package/judge/themes/mu-dark.json +80 -0
  136. package/judge/themes/mu-light.json +80 -0
  137. package/kyrn/bin/kyrn-doctor +44 -19
  138. package/kyrn/bin/kyrn-judge-local +43 -14
  139. package/kyrn/bin/kyrn-ledger +16 -1
  140. package/kyrn/bin/mu.mjs +142 -61
  141. package/kyrn/local-judge/server.py +26 -14
  142. package/package.json +8 -6
  143. package/dist/bundle/chunks/anthropic-messages-MI4QHRXW.js +0 -6
  144. package/dist/bundle/chunks/azure-openai-responses-E3QGN4VN.js +0 -2
  145. package/dist/bundle/chunks/chunk-33KL6IIQ.js +0 -20
  146. package/dist/bundle/chunks/chunk-A3JYRWB6.js +0 -2
  147. package/dist/bundle/chunks/chunk-C47CLQZK.js +0 -2
  148. package/dist/bundle/chunks/chunk-HQHD6PZI.js +0 -2
  149. package/dist/bundle/chunks/chunk-KJUDFE6Y.js +0 -11
  150. package/dist/bundle/chunks/chunk-TE3GUV6H.js +0 -9
  151. package/dist/bundle/chunks/chunk-VIV3CWXG.js +0 -2
  152. package/dist/bundle/chunks/chunk-WE4MXUQS.js +0 -11
  153. package/dist/bundle/chunks/chunk-Y2PP32XV.js +0 -2
  154. package/dist/bundle/chunks/chunk-YLY6CKPK.js +0 -132
  155. package/dist/bundle/chunks/chunk-ZE5FMF3V.js +0 -99
  156. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-NM3JRRWQ.js +0 -2
  157. package/dist/bundle/chunks/easter-egg-3d-G2LUBEMZ.js +0 -2
  158. package/dist/bundle/chunks/execute-MZVUC6BB.js +0 -388
  159. package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +0 -13
  160. package/dist/bundle/chunks/mistral-conversations-Q22M3IBG.js +0 -5
  161. package/dist/bundle/chunks/openai-codex-responses-4MYQSO5E.js +0 -10
  162. package/dist/bundle/chunks/openai-completions-OSRCWAAA.js +0 -7
  163. package/dist/bundle/chunks/openai-responses-UHF3DHNG.js +0 -3
  164. package/dist/bundle/chunks/runtime-VJMMDLVH.js +0 -2
  165. package/dist/bundle/chunks/typesafe-system-one-PRR5K6CI.js +0 -2
  166. package/dist/bundle/chunks/virtual-modules-RJXJGCPI.js +0 -2
  167. package/dist/modes/interactive/theme/theme-json.d.ts +0 -85
  168. package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
  169. package/dist/modes/interactive/theme/theme-json.js +0 -132
  170. package/dist/modes/interactive/theme/theme-json.js.map +0 -1
  171. package/dist/modes/interactive/theme/theme-schema.json +0 -361
  172. package/examples/plugins/pi-example-plugin/README.md +0 -38
  173. package/examples/plugins/pi-example-plugin/package.json +0 -10
  174. package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
  175. package/examples/plugins/pi-example-plugin/src/session.ts +0 -24
  176. package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
@@ -0,0 +1,257 @@
1
+ export interface ThemeTokenDescriptor {
2
+ slot: "foreground" | "background";
3
+ description: string;
4
+ fallback?: string;
5
+ }
6
+ export type ThemeTokenDescriptors = Readonly<Record<string, ThemeTokenDescriptor>>;
7
+ /** Theme token metadata in the same order used by theme files and the published JSON Schema. */
8
+ export declare const THEME_TOKENS: {
9
+ readonly accent: {
10
+ readonly slot: "foreground";
11
+ readonly description: "Primary accent color (logo, selected items, cursor)";
12
+ };
13
+ readonly border: {
14
+ readonly slot: "foreground";
15
+ readonly description: "Normal borders";
16
+ };
17
+ readonly borderAccent: {
18
+ readonly slot: "foreground";
19
+ readonly description: "Highlighted borders";
20
+ };
21
+ readonly borderMuted: {
22
+ readonly slot: "foreground";
23
+ readonly description: "Subtle borders";
24
+ };
25
+ readonly success: {
26
+ readonly slot: "foreground";
27
+ readonly description: "Success states";
28
+ };
29
+ readonly error: {
30
+ readonly slot: "foreground";
31
+ readonly description: "Error states";
32
+ };
33
+ readonly warning: {
34
+ readonly slot: "foreground";
35
+ readonly description: "Warning states";
36
+ };
37
+ readonly muted: {
38
+ readonly slot: "foreground";
39
+ readonly description: "Secondary/dimmed text";
40
+ };
41
+ readonly dim: {
42
+ readonly slot: "foreground";
43
+ readonly description: "Very dimmed text (more subtle than muted)";
44
+ };
45
+ readonly text: {
46
+ readonly slot: "foreground";
47
+ readonly description: "Default text color (usually empty string)";
48
+ };
49
+ readonly thinkingText: {
50
+ readonly slot: "foreground";
51
+ readonly description: "Thinking block text color";
52
+ };
53
+ readonly scrollbarTrack: {
54
+ readonly slot: "foreground";
55
+ readonly description: "Fullscreen scrollbar track foreground (falls back to muted when omitted)";
56
+ readonly fallback: "muted";
57
+ };
58
+ readonly scrollbarThumb: {
59
+ readonly slot: "foreground";
60
+ readonly description: "Fullscreen scrollbar thumb foreground (falls back to text when omitted)";
61
+ readonly fallback: "text";
62
+ };
63
+ readonly selectedBg: {
64
+ readonly slot: "background";
65
+ readonly description: "Selected item background";
66
+ };
67
+ readonly searchMatchBg: {
68
+ readonly slot: "background";
69
+ readonly description: "Transcript search match background and current-match text (falls back to selectedBg when omitted)";
70
+ readonly fallback: "selectedBg";
71
+ };
72
+ readonly searchMatchText: {
73
+ readonly slot: "foreground";
74
+ readonly description: "Transcript search match text and current-match background (falls back to text when omitted)";
75
+ readonly fallback: "text";
76
+ };
77
+ readonly userMessageBg: {
78
+ readonly slot: "background";
79
+ readonly description: "User message background";
80
+ };
81
+ readonly userMessageText: {
82
+ readonly slot: "foreground";
83
+ readonly description: "User message text color";
84
+ };
85
+ readonly customMessageBg: {
86
+ readonly slot: "background";
87
+ readonly description: "Custom message background (hook-injected messages)";
88
+ };
89
+ readonly customMessageText: {
90
+ readonly slot: "foreground";
91
+ readonly description: "Custom message text color";
92
+ };
93
+ readonly customMessageLabel: {
94
+ readonly slot: "foreground";
95
+ readonly description: "Custom message type label color";
96
+ };
97
+ readonly toolPendingBg: {
98
+ readonly slot: "background";
99
+ readonly description: "Tool execution box (pending state)";
100
+ };
101
+ readonly toolSuccessBg: {
102
+ readonly slot: "background";
103
+ readonly description: "Tool execution box (success state)";
104
+ };
105
+ readonly toolErrorBg: {
106
+ readonly slot: "background";
107
+ readonly description: "Tool execution box (error state)";
108
+ };
109
+ readonly toolTitle: {
110
+ readonly slot: "foreground";
111
+ readonly description: "Tool execution box title color";
112
+ };
113
+ readonly toolOutput: {
114
+ readonly slot: "foreground";
115
+ readonly description: "Tool execution box output text color";
116
+ };
117
+ readonly mdHeading: {
118
+ readonly slot: "foreground";
119
+ readonly description: "Markdown heading text";
120
+ };
121
+ readonly mdLink: {
122
+ readonly slot: "foreground";
123
+ readonly description: "Markdown link text";
124
+ };
125
+ readonly mdLinkUrl: {
126
+ readonly slot: "foreground";
127
+ readonly description: "Markdown link URL";
128
+ };
129
+ readonly mdCode: {
130
+ readonly slot: "foreground";
131
+ readonly description: "Markdown inline code";
132
+ };
133
+ readonly mdCodeBlock: {
134
+ readonly slot: "foreground";
135
+ readonly description: "Markdown code block content";
136
+ };
137
+ readonly mdCodeBlockBorder: {
138
+ readonly slot: "foreground";
139
+ readonly description: "Markdown code block fences";
140
+ };
141
+ readonly mdQuote: {
142
+ readonly slot: "foreground";
143
+ readonly description: "Markdown blockquote text";
144
+ };
145
+ readonly mdQuoteBorder: {
146
+ readonly slot: "foreground";
147
+ readonly description: "Markdown blockquote border";
148
+ };
149
+ readonly mdHr: {
150
+ readonly slot: "foreground";
151
+ readonly description: "Markdown horizontal rule";
152
+ };
153
+ readonly mdListBullet: {
154
+ readonly slot: "foreground";
155
+ readonly description: "Markdown list bullets/numbers";
156
+ };
157
+ readonly toolDiffAdded: {
158
+ readonly slot: "foreground";
159
+ readonly description: "Added lines in tool diffs";
160
+ };
161
+ readonly toolDiffRemoved: {
162
+ readonly slot: "foreground";
163
+ readonly description: "Removed lines in tool diffs";
164
+ };
165
+ readonly toolDiffContext: {
166
+ readonly slot: "foreground";
167
+ readonly description: "Context lines in tool diffs";
168
+ };
169
+ readonly syntaxComment: {
170
+ readonly slot: "foreground";
171
+ readonly description: "Syntax highlighting: comments";
172
+ };
173
+ readonly syntaxKeyword: {
174
+ readonly slot: "foreground";
175
+ readonly description: "Syntax highlighting: keywords";
176
+ };
177
+ readonly syntaxFunction: {
178
+ readonly slot: "foreground";
179
+ readonly description: "Syntax highlighting: function names";
180
+ };
181
+ readonly syntaxVariable: {
182
+ readonly slot: "foreground";
183
+ readonly description: "Syntax highlighting: variable names";
184
+ };
185
+ readonly syntaxString: {
186
+ readonly slot: "foreground";
187
+ readonly description: "Syntax highlighting: string literals";
188
+ };
189
+ readonly syntaxNumber: {
190
+ readonly slot: "foreground";
191
+ readonly description: "Syntax highlighting: number literals";
192
+ };
193
+ readonly syntaxType: {
194
+ readonly slot: "foreground";
195
+ readonly description: "Syntax highlighting: type names";
196
+ };
197
+ readonly syntaxOperator: {
198
+ readonly slot: "foreground";
199
+ readonly description: "Syntax highlighting: operators";
200
+ };
201
+ readonly syntaxPunctuation: {
202
+ readonly slot: "foreground";
203
+ readonly description: "Syntax highlighting: punctuation";
204
+ };
205
+ readonly thinkingOff: {
206
+ readonly slot: "foreground";
207
+ readonly description: "Thinking level border: off";
208
+ };
209
+ readonly thinkingMinimal: {
210
+ readonly slot: "foreground";
211
+ readonly description: "Thinking level border: minimal";
212
+ };
213
+ readonly thinkingLow: {
214
+ readonly slot: "foreground";
215
+ readonly description: "Thinking level border: low";
216
+ };
217
+ readonly thinkingMedium: {
218
+ readonly slot: "foreground";
219
+ readonly description: "Thinking level border: medium";
220
+ };
221
+ readonly thinkingHigh: {
222
+ readonly slot: "foreground";
223
+ readonly description: "Thinking level border: high";
224
+ };
225
+ readonly thinkingXhigh: {
226
+ readonly slot: "foreground";
227
+ readonly description: "Thinking level border: xhigh";
228
+ };
229
+ readonly thinkingMax: {
230
+ readonly slot: "foreground";
231
+ readonly description: "Thinking level border: max (falls back to thinkingXhigh when omitted)";
232
+ readonly fallback: "thinkingXhigh";
233
+ };
234
+ readonly bashMode: {
235
+ readonly slot: "foreground";
236
+ readonly description: "Editor border color in bash mode";
237
+ };
238
+ };
239
+ export type ThemeToken = keyof typeof THEME_TOKENS;
240
+ export type ThemeColor = {
241
+ [K in ThemeToken]: (typeof THEME_TOKENS)[K]["slot"] extends "foreground" ? K : never;
242
+ }[ThemeToken];
243
+ export type ThemeBg = Exclude<ThemeToken, ThemeColor>;
244
+ type OptionalToken = {
245
+ [K in ThemeToken]: (typeof THEME_TOKENS)[K] extends {
246
+ fallback: string;
247
+ } ? K : never;
248
+ }[ThemeToken];
249
+ type RequiredToken = Exclude<ThemeToken, OptionalToken>;
250
+ export type ThemeColorValues<Value> = {
251
+ [K in RequiredToken]: Value;
252
+ } & {
253
+ [K in OptionalToken]?: Value;
254
+ };
255
+ export type ResolvedThemeColorValues<Value> = Record<ThemeToken, Value>;
256
+ export {};
257
+ //# sourceMappingURL=theme-tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-tokens.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme-tokens.ts"],"names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CAC3B,GAAG;KACF,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,KAAK;CAC5B,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,KAAK,IAAI,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC"}
@@ -0,0 +1,94 @@
1
+ function defineThemeTokens(tokens) {
2
+ for (const [name, descriptor] of Object.entries(tokens)) {
3
+ if (descriptor.fallback === undefined)
4
+ continue;
5
+ const fallback = tokens[descriptor.fallback];
6
+ if (fallback === undefined) {
7
+ throw new Error(`Theme token ${name} has unknown fallback ${descriptor.fallback}`);
8
+ }
9
+ if (fallback.slot !== descriptor.slot) {
10
+ throw new Error(`Theme token ${name} has fallback ${descriptor.fallback} in a different color slot`);
11
+ }
12
+ }
13
+ return tokens;
14
+ }
15
+ /** Theme token metadata in the same order used by theme files and the published JSON Schema. */
16
+ export const THEME_TOKENS = defineThemeTokens({
17
+ accent: { slot: "foreground", description: "Primary accent color (logo, selected items, cursor)" },
18
+ border: { slot: "foreground", description: "Normal borders" },
19
+ borderAccent: { slot: "foreground", description: "Highlighted borders" },
20
+ borderMuted: { slot: "foreground", description: "Subtle borders" },
21
+ success: { slot: "foreground", description: "Success states" },
22
+ error: { slot: "foreground", description: "Error states" },
23
+ warning: { slot: "foreground", description: "Warning states" },
24
+ muted: { slot: "foreground", description: "Secondary/dimmed text" },
25
+ dim: { slot: "foreground", description: "Very dimmed text (more subtle than muted)" },
26
+ text: { slot: "foreground", description: "Default text color (usually empty string)" },
27
+ thinkingText: { slot: "foreground", description: "Thinking block text color" },
28
+ scrollbarTrack: {
29
+ slot: "foreground",
30
+ description: "Fullscreen scrollbar track foreground (falls back to muted when omitted)",
31
+ fallback: "muted",
32
+ },
33
+ scrollbarThumb: {
34
+ slot: "foreground",
35
+ description: "Fullscreen scrollbar thumb foreground (falls back to text when omitted)",
36
+ fallback: "text",
37
+ },
38
+ selectedBg: { slot: "background", description: "Selected item background" },
39
+ searchMatchBg: {
40
+ slot: "background",
41
+ description: "Transcript search match background and current-match text (falls back to selectedBg when omitted)",
42
+ fallback: "selectedBg",
43
+ },
44
+ searchMatchText: {
45
+ slot: "foreground",
46
+ description: "Transcript search match text and current-match background (falls back to text when omitted)",
47
+ fallback: "text",
48
+ },
49
+ userMessageBg: { slot: "background", description: "User message background" },
50
+ userMessageText: { slot: "foreground", description: "User message text color" },
51
+ customMessageBg: { slot: "background", description: "Custom message background (hook-injected messages)" },
52
+ customMessageText: { slot: "foreground", description: "Custom message text color" },
53
+ customMessageLabel: { slot: "foreground", description: "Custom message type label color" },
54
+ toolPendingBg: { slot: "background", description: "Tool execution box (pending state)" },
55
+ toolSuccessBg: { slot: "background", description: "Tool execution box (success state)" },
56
+ toolErrorBg: { slot: "background", description: "Tool execution box (error state)" },
57
+ toolTitle: { slot: "foreground", description: "Tool execution box title color" },
58
+ toolOutput: { slot: "foreground", description: "Tool execution box output text color" },
59
+ mdHeading: { slot: "foreground", description: "Markdown heading text" },
60
+ mdLink: { slot: "foreground", description: "Markdown link text" },
61
+ mdLinkUrl: { slot: "foreground", description: "Markdown link URL" },
62
+ mdCode: { slot: "foreground", description: "Markdown inline code" },
63
+ mdCodeBlock: { slot: "foreground", description: "Markdown code block content" },
64
+ mdCodeBlockBorder: { slot: "foreground", description: "Markdown code block fences" },
65
+ mdQuote: { slot: "foreground", description: "Markdown blockquote text" },
66
+ mdQuoteBorder: { slot: "foreground", description: "Markdown blockquote border" },
67
+ mdHr: { slot: "foreground", description: "Markdown horizontal rule" },
68
+ mdListBullet: { slot: "foreground", description: "Markdown list bullets/numbers" },
69
+ toolDiffAdded: { slot: "foreground", description: "Added lines in tool diffs" },
70
+ toolDiffRemoved: { slot: "foreground", description: "Removed lines in tool diffs" },
71
+ toolDiffContext: { slot: "foreground", description: "Context lines in tool diffs" },
72
+ syntaxComment: { slot: "foreground", description: "Syntax highlighting: comments" },
73
+ syntaxKeyword: { slot: "foreground", description: "Syntax highlighting: keywords" },
74
+ syntaxFunction: { slot: "foreground", description: "Syntax highlighting: function names" },
75
+ syntaxVariable: { slot: "foreground", description: "Syntax highlighting: variable names" },
76
+ syntaxString: { slot: "foreground", description: "Syntax highlighting: string literals" },
77
+ syntaxNumber: { slot: "foreground", description: "Syntax highlighting: number literals" },
78
+ syntaxType: { slot: "foreground", description: "Syntax highlighting: type names" },
79
+ syntaxOperator: { slot: "foreground", description: "Syntax highlighting: operators" },
80
+ syntaxPunctuation: { slot: "foreground", description: "Syntax highlighting: punctuation" },
81
+ thinkingOff: { slot: "foreground", description: "Thinking level border: off" },
82
+ thinkingMinimal: { slot: "foreground", description: "Thinking level border: minimal" },
83
+ thinkingLow: { slot: "foreground", description: "Thinking level border: low" },
84
+ thinkingMedium: { slot: "foreground", description: "Thinking level border: medium" },
85
+ thinkingHigh: { slot: "foreground", description: "Thinking level border: high" },
86
+ thinkingXhigh: { slot: "foreground", description: "Thinking level border: xhigh" },
87
+ thinkingMax: {
88
+ slot: "foreground",
89
+ description: "Thinking level border: max (falls back to thinkingXhigh when omitted)",
90
+ fallback: "thinkingXhigh",
91
+ },
92
+ bashMode: { slot: "foreground", description: "Editor border color in bash mode" },
93
+ });
94
+ //# sourceMappingURL=theme-tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-tokens.js","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme-tokens.ts"],"names":[],"mappings":"AAQA,SAAS,iBAAiB,CAAwC,MAAS;IAC1E,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,IAAI,UAAU,CAAC,QAAQ,KAAK,SAAS;YAAE,SAAS;QAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,yBAAyB,UAAU,CAAC,QAAQ,EAAE,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AE;IACzF,YAAY,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACzF,UAAU,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,iCAAiC,EAAE;IAClF,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,gCAAgC,EAAE;IACrF,iBAAiB,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,kCAAkC,EAAE;IAC1F,WAAW,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAC9E,eAAe,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,gCAAgC,EAAE;IACtF,WAAW,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAC9E,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,+BAA+B,EAAE;IACpF,YAAY,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,6BAA6B,EAAE;IAChF,aAAa,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,8BAA8B,EAAE;IAClF,WAAW,EAAE;QACZ,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,uEAAuE;QACpF,QAAQ,EAAE,eAAe;KACzB;IACD,QAAQ,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,kCAAkC,EAAE;CACjF,CAAC,CAAC","sourcesContent":["export interface ThemeTokenDescriptor {\n\tslot: \"foreground\" | \"background\";\n\tdescription: string;\n\tfallback?: string;\n}\n\nexport type ThemeTokenDescriptors = Readonly<Record<string, ThemeTokenDescriptor>>;\n\nfunction defineThemeTokens<const T extends ThemeTokenDescriptors>(tokens: T): T {\n\tfor (const [name, descriptor] of Object.entries(tokens)) {\n\t\tif (descriptor.fallback === undefined) continue;\n\t\tconst fallback = tokens[descriptor.fallback];\n\t\tif (fallback === undefined) {\n\t\t\tthrow new Error(`Theme token ${name} has unknown fallback ${descriptor.fallback}`);\n\t\t}\n\t\tif (fallback.slot !== descriptor.slot) {\n\t\t\tthrow new Error(`Theme token ${name} has fallback ${descriptor.fallback} in a different color slot`);\n\t\t}\n\t}\n\treturn tokens;\n}\n\n/** Theme token metadata in the same order used by theme files and the published JSON Schema. */\nexport const THEME_TOKENS = defineThemeTokens({\n\taccent: { slot: \"foreground\", description: \"Primary accent color (logo, selected items, cursor)\" },\n\tborder: { slot: \"foreground\", description: \"Normal borders\" },\n\tborderAccent: { slot: \"foreground\", description: \"Highlighted borders\" },\n\tborderMuted: { slot: \"foreground\", description: \"Subtle borders\" },\n\tsuccess: { slot: \"foreground\", description: \"Success states\" },\n\terror: { slot: \"foreground\", description: \"Error states\" },\n\twarning: { slot: \"foreground\", description: \"Warning states\" },\n\tmuted: { slot: \"foreground\", description: \"Secondary/dimmed text\" },\n\tdim: { slot: \"foreground\", description: \"Very dimmed text (more subtle than muted)\" },\n\ttext: { slot: \"foreground\", description: \"Default text color (usually empty string)\" },\n\tthinkingText: { slot: \"foreground\", description: \"Thinking block text color\" },\n\tscrollbarTrack: {\n\t\tslot: \"foreground\",\n\t\tdescription: \"Fullscreen scrollbar track foreground (falls back to muted when omitted)\",\n\t\tfallback: \"muted\",\n\t},\n\tscrollbarThumb: {\n\t\tslot: \"foreground\",\n\t\tdescription: \"Fullscreen scrollbar thumb foreground (falls back to text when omitted)\",\n\t\tfallback: \"text\",\n\t},\n\tselectedBg: { slot: \"background\", description: \"Selected item background\" },\n\tsearchMatchBg: {\n\t\tslot: \"background\",\n\t\tdescription: \"Transcript search match background and current-match text (falls back to selectedBg when omitted)\",\n\t\tfallback: \"selectedBg\",\n\t},\n\tsearchMatchText: {\n\t\tslot: \"foreground\",\n\t\tdescription: \"Transcript search match text and current-match background (falls back to text when omitted)\",\n\t\tfallback: \"text\",\n\t},\n\tuserMessageBg: { slot: \"background\", description: \"User message background\" },\n\tuserMessageText: { slot: \"foreground\", description: \"User message text color\" },\n\tcustomMessageBg: { slot: \"background\", description: \"Custom message background (hook-injected messages)\" },\n\tcustomMessageText: { slot: \"foreground\", description: \"Custom message text color\" },\n\tcustomMessageLabel: { slot: \"foreground\", description: \"Custom message type label color\" },\n\ttoolPendingBg: { slot: \"background\", description: \"Tool execution box (pending state)\" },\n\ttoolSuccessBg: { slot: \"background\", description: \"Tool execution box (success state)\" },\n\ttoolErrorBg: { slot: \"background\", description: \"Tool execution box (error state)\" },\n\ttoolTitle: { slot: \"foreground\", description: \"Tool execution box title color\" },\n\ttoolOutput: { slot: \"foreground\", description: \"Tool execution box output text color\" },\n\tmdHeading: { slot: \"foreground\", description: \"Markdown heading text\" },\n\tmdLink: { slot: \"foreground\", description: \"Markdown link text\" },\n\tmdLinkUrl: { slot: \"foreground\", description: \"Markdown link URL\" },\n\tmdCode: { slot: \"foreground\", description: \"Markdown inline code\" },\n\tmdCodeBlock: { slot: \"foreground\", description: \"Markdown code block content\" },\n\tmdCodeBlockBorder: { slot: \"foreground\", description: \"Markdown code block fences\" },\n\tmdQuote: { slot: \"foreground\", description: \"Markdown blockquote text\" },\n\tmdQuoteBorder: { slot: \"foreground\", description: \"Markdown blockquote border\" },\n\tmdHr: { slot: \"foreground\", description: \"Markdown horizontal rule\" },\n\tmdListBullet: { slot: \"foreground\", description: \"Markdown list bullets/numbers\" },\n\ttoolDiffAdded: { slot: \"foreground\", description: \"Added lines in tool diffs\" },\n\ttoolDiffRemoved: { slot: \"foreground\", description: \"Removed lines in tool diffs\" },\n\ttoolDiffContext: { slot: \"foreground\", description: \"Context lines in tool diffs\" },\n\tsyntaxComment: { slot: \"foreground\", description: \"Syntax highlighting: comments\" },\n\tsyntaxKeyword: { slot: \"foreground\", description: \"Syntax highlighting: keywords\" },\n\tsyntaxFunction: { slot: \"foreground\", description: \"Syntax highlighting: function names\" },\n\tsyntaxVariable: { slot: \"foreground\", description: \"Syntax highlighting: variable names\" },\n\tsyntaxString: { slot: \"foreground\", description: \"Syntax highlighting: string literals\" },\n\tsyntaxNumber: { slot: \"foreground\", description: \"Syntax highlighting: number literals\" },\n\tsyntaxType: { slot: \"foreground\", description: \"Syntax highlighting: type names\" },\n\tsyntaxOperator: { slot: \"foreground\", description: \"Syntax highlighting: operators\" },\n\tsyntaxPunctuation: { slot: \"foreground\", description: \"Syntax highlighting: punctuation\" },\n\tthinkingOff: { slot: \"foreground\", description: \"Thinking level border: off\" },\n\tthinkingMinimal: { slot: \"foreground\", description: \"Thinking level border: minimal\" },\n\tthinkingLow: { slot: \"foreground\", description: \"Thinking level border: low\" },\n\tthinkingMedium: { slot: \"foreground\", description: \"Thinking level border: medium\" },\n\tthinkingHigh: { slot: \"foreground\", description: \"Thinking level border: high\" },\n\tthinkingXhigh: { slot: \"foreground\", description: \"Thinking level border: xhigh\" },\n\tthinkingMax: {\n\t\tslot: \"foreground\",\n\t\tdescription: \"Thinking level border: max (falls back to thinkingXhigh when omitted)\",\n\t\tfallback: \"thinkingXhigh\",\n\t},\n\tbashMode: { slot: \"foreground\", description: \"Editor border color in bash mode\" },\n});\n\nexport type ThemeToken = keyof typeof THEME_TOKENS;\nexport type ThemeColor = {\n\t[K in ThemeToken]: (typeof THEME_TOKENS)[K][\"slot\"] extends \"foreground\" ? K : never;\n}[ThemeToken];\nexport type ThemeBg = Exclude<ThemeToken, ThemeColor>;\n\ntype OptionalToken = {\n\t[K in ThemeToken]: (typeof THEME_TOKENS)[K] extends { fallback: string } ? K : never;\n}[ThemeToken];\n\ntype RequiredToken = Exclude<ThemeToken, OptionalToken>;\n\nexport type ThemeColorValues<Value> = {\n\t[K in RequiredToken]: Value;\n} & {\n\t[K in OptionalToken]?: Value;\n};\n\nexport type ResolvedThemeColorValues<Value> = Record<ThemeToken, Value>;\n"]}
@@ -1,20 +1,12 @@
1
1
  import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
2
2
  import { type Color, type EditorTheme, type MarkdownTheme, type SelectListTheme, type SettingsListTheme, type TerminalColorMode, type TerminalColors, type TextAttributes } from "@earendil-works/pi-tui";
3
3
  import type { SourceInfo } from "../../../core/source-info.ts";
4
+ import { type ThemeBg, type ThemeColor, type ThemeColorValues, type ThemeToken } from "./theme-tokens.ts";
4
5
  export { SYSTEM_THEME_NAME } from "./system-theme.ts";
5
- /** The schema that validates this shape lives in `theme-json.ts`; importing the type is free. */
6
- import type { ValidatedThemeJson as ThemeJson } from "./theme-json.ts";
7
- export type { ValidatedThemeJson as ThemeJson } from "./theme-json.ts";
8
- export type ThemeJsonValidator = (label: string, json: unknown) => ThemeJson;
9
- /**
10
- * Install full theme validation. Without it, documents are accepted as-is, which is what built-in
11
- * themes already do: validating user-authored JSON needs typebox, and a presentation that only uses
12
- * built-in themes should not pay ~17 MB of module graph for it.
13
- */
14
- export declare function setThemeJsonValidator(validator: ThemeJsonValidator): void;
15
- export type ThemeColor = "accent" | "border" | "borderAccent" | "borderMuted" | "success" | "error" | "warning" | "muted" | "dim" | "text" | "thinkingText" | "scrollbarTrack" | "scrollbarThumb" | "searchMatchText" | "userMessageText" | "customMessageText" | "customMessageLabel" | "toolTitle" | "toolOutput" | "mdHeading" | "mdLink" | "mdLinkUrl" | "mdCode" | "mdCodeBlock" | "mdCodeBlockBorder" | "mdQuote" | "mdQuoteBorder" | "mdHr" | "mdListBullet" | "toolDiffAdded" | "toolDiffRemoved" | "toolDiffContext" | "syntaxComment" | "syntaxKeyword" | "syntaxFunction" | "syntaxVariable" | "syntaxString" | "syntaxNumber" | "syntaxType" | "syntaxOperator" | "syntaxPunctuation" | "thinkingOff" | "thinkingMinimal" | "thinkingLow" | "thinkingMedium" | "thinkingHigh" | "thinkingXhigh" | "thinkingMax" | "bashMode";
16
- export type ThemeBg = "selectedBg" | "searchMatchBg" | "userMessageBg" | "customMessageBg" | "toolPendingBg" | "toolSuccessBg" | "toolErrorBg";
17
- export type ThemeToken = ThemeColor | ThemeBg;
6
+ /** The schema that validates this shape lives in `theme-schema.ts`; importing the type is free. */
7
+ import type { ValidatedThemeJson as ThemeJson } from "./theme-schema.ts";
8
+ export type { ValidatedThemeJson as ThemeJson } from "./theme-schema.ts";
9
+ export type { ThemeBg, ThemeColor, ThemeToken } from "./theme-tokens.ts";
18
10
  /**
19
11
  * Tokens are only accepted in their own slot, because "" (terminal default) means the default foreground
20
12
  * or background depending on the slot. Use `theme.colors[token]` to use a token's color in the other slot.
@@ -23,8 +15,13 @@ export interface ThemeStyle extends TextAttributes {
23
15
  fg?: ThemeColor | Color;
24
16
  bg?: ThemeBg | Color;
25
17
  }
26
- type OptionalThemeColor = "scrollbarTrack" | "scrollbarThumb" | "thinkingMax" | "searchMatchText";
27
- type OptionalThemeBg = "searchMatchBg";
18
+ export type ThemeJsonValidator = (label: string, json: unknown) => ThemeJson;
19
+ /**
20
+ * Install full theme validation. Without it, documents are accepted as-is, which is what built-in
21
+ * themes already do: validating user-authored JSON needs typebox, and a presentation that only uses
22
+ * built-in themes should not pay ~17 MB of module graph for it.
23
+ */
24
+ export declare function setThemeJsonValidator(validator: ThemeJsonValidator): void;
28
25
  /** The background a theme is designed for. */
29
26
  export type ThemeAppearance = TerminalTheme;
30
27
  /**
@@ -49,7 +46,7 @@ export declare class Theme {
49
46
  private readonly dimTokens;
50
47
  private readonly ownAppearance;
51
48
  private resolvedColors;
52
- constructor(fgColors: Record<Exclude<ThemeColor, OptionalThemeColor>, string | number> & Partial<Record<OptionalThemeColor, string | number>>, bgColors: Record<Exclude<ThemeBg, OptionalThemeBg>, string | number> & Partial<Record<OptionalThemeBg, string | number>>, mode: TerminalColorMode, options?: {
49
+ constructor(fgColors: Pick<ThemeColorValues<string | number>, ThemeColor>, bgColors: Pick<ThemeColorValues<string | number>, ThemeBg>, mode: TerminalColorMode, options?: {
53
50
  name?: string;
54
51
  sourcePath?: string;
55
52
  sourceInfo?: SourceInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme.ts"],"names":[],"m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AI,CAclF;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,GAAE,OAAe,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAqB3G;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,KAAK,GAAG,IAAI,CAO3D;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAExD;AAgFD,wBAAgB,gBAAgB,IAAI,IAAI,CAOvC;AAMD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGjF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,CA2BA;AAkDD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBnE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAkExE;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAqChD;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAQpD;AAED,wBAAgB,cAAc,IAAI,WAAW,CAK5C;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAQxD"}
@@ -7,6 +7,7 @@ import { closeWatcher, watchWithErrorHandler } from "../../../utils/fs-watch.js"
7
7
  import { highlight, supportsLanguage } from "../../../utils/syntax-highlight.js";
8
8
  import { stripBom } from "../../../utils/text.js";
9
9
  import { generateSystemThemeColors, SYSTEM_THEME_NAME, terminalAppearance } from "./system-theme.js";
10
+ import { THEME_TOKENS, } from "./theme-tokens.js";
10
11
  export { SYSTEM_THEME_NAME } from "./system-theme.js";
11
12
  let themeJsonValidator;
12
13
  /**
@@ -40,15 +41,22 @@ function resolveThemeColors(colors, vars = {}) {
40
41
  }
41
42
  return resolved;
42
43
  }
43
- function withThemeColorFallbacks(colors) {
44
- return {
45
- ...colors,
46
- scrollbarTrack: colors.scrollbarTrack ?? colors.muted,
47
- scrollbarThumb: colors.scrollbarThumb ?? colors.text,
48
- thinkingMax: colors.thinkingMax ?? colors.thinkingXhigh,
49
- searchMatchBg: colors.searchMatchBg ?? colors.selectedBg,
50
- searchMatchText: colors.searchMatchText ?? colors.text,
51
- };
44
+ function withThemeTokenFallbacks(values) {
45
+ const resolved = { ...values };
46
+ for (const [rawName, descriptor] of Object.entries(THEME_TOKENS)) {
47
+ if (!("fallback" in descriptor))
48
+ continue;
49
+ const name = rawName;
50
+ if (resolved[name] !== undefined)
51
+ continue;
52
+ const fallback = descriptor.fallback;
53
+ const fallbackValue = resolved[fallback];
54
+ if (fallbackValue === undefined) {
55
+ throw new Error(`Theme token ${rawName} has unresolved fallback ${descriptor.fallback}`);
56
+ }
57
+ resolved[name] = fallbackValue;
58
+ }
59
+ return resolved;
52
60
  }
53
61
  // The terminal's reported colors. Replaced (never mutated) on update, so themes can cache resolved colors
54
62
  // by identity.
@@ -122,14 +130,7 @@ export class Theme {
122
130
  this.sourceInfo = options.sourceInfo;
123
131
  this.mode = mode;
124
132
  this.dimTokens = new Set(options.dim);
125
- const foregrounds = {
126
- ...fgColors,
127
- scrollbarTrack: fgColors.scrollbarTrack ?? fgColors.muted,
128
- scrollbarThumb: fgColors.scrollbarThumb ?? fgColors.text,
129
- thinkingMax: fgColors.thinkingMax ?? fgColors.thinkingXhigh,
130
- searchMatchText: fgColors.searchMatchText ?? fgColors.text,
131
- };
132
- const backgrounds = { ...bgColors, searchMatchBg: bgColors.searchMatchBg ?? bgColors.selectedBg };
133
+ const { fgColors: foregrounds, bgColors: backgrounds } = splitThemeColors(withThemeTokenFallbacks({ ...fgColors, ...bgColors }));
133
134
  const concreteForegrounds = [];
134
135
  const concreteBackgrounds = [];
135
136
  // Returns the escape sequence for the token's own slot.
@@ -378,20 +379,11 @@ function loadThemeJson(name) {
378
379
  const content = fs.readFileSync(themePath, "utf-8");
379
380
  return parseThemeJsonContent(name, content);
380
381
  }
381
- const BACKGROUND_TOKENS = new Set([
382
- "selectedBg",
383
- "searchMatchBg",
384
- "userMessageBg",
385
- "customMessageBg",
386
- "toolPendingBg",
387
- "toolSuccessBg",
388
- "toolErrorBg",
389
- ]);
390
382
  function splitThemeColors(colors) {
391
383
  const fgColors = {};
392
384
  const bgColors = {};
393
385
  for (const [key, value] of Object.entries(colors)) {
394
- if (BACKGROUND_TOKENS.has(key)) {
386
+ if (THEME_TOKENS[key].slot === "background") {
395
387
  bgColors[key] = value;
396
388
  }
397
389
  else {
@@ -402,7 +394,7 @@ function splitThemeColors(colors) {
402
394
  }
403
395
  function createTheme(themeJson, mode, sourcePath) {
404
396
  const colorMode = mode ?? getTerminalColorMode();
405
- const resolvedColors = resolveThemeColors(withThemeColorFallbacks(themeJson.colors), themeJson.vars);
397
+ const resolvedColors = withThemeTokenFallbacks(resolveThemeColors(themeJson.colors, themeJson.vars));
406
398
  const { fgColors, bgColors } = splitThemeColors(resolvedColors);
407
399
  return new Theme(fgColors, bgColors, colorMode, {
408
400
  name: themeJson.name,
@@ -417,7 +409,7 @@ function createSystemTheme(mode) {
417
409
  saturation: terminalColorsPending ? 0 : 1,
418
410
  appearanceHint: getTerminalTheme(),
419
411
  });
420
- const { fgColors, bgColors } = splitThemeColors(generated.colors);
412
+ const { fgColors, bgColors } = splitThemeColors(withThemeTokenFallbacks(generated.colors));
421
413
  return new Theme(fgColors, bgColors, mode ?? getTerminalColorMode(), {
422
414
  name: SYSTEM_THEME_NAME,
423
415
  appearance: generated.appearance,
@@ -724,6 +716,7 @@ function buildCliHighlightTheme(t) {
724
716
  number: (s) => t.fg("syntaxNumber", s),
725
717
  regexp: (s) => t.fg("syntaxString", s),
726
718
  string: (s) => t.fg("syntaxString", s),
719
+ subst: (s) => t.fg("text", s),
727
720
  comment: (s) => t.fg("syntaxComment", s),
728
721
  doctag: (s) => t.fg("syntaxComment", s),
729
722
  meta: (s) => t.fg("muted", s),