mu-agent 0.1.7 → 0.1.10
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.
- package/CHANGELOG.md +52 -0
- package/README.md +34 -29
- package/dist/bundle/chunks/anthropic-messages-4PAJY4R6.js +6 -0
- package/dist/bundle/chunks/anthropic.js +2 -2
- package/dist/bundle/chunks/azure-openai-responses-Y4BBWQ3N.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +12 -9
- package/dist/bundle/chunks/{chunk-TRDNDS6A.js → chunk-3V45WARH.js} +6 -3
- package/dist/bundle/chunks/{chunk-XDUWOHPL.js → chunk-5AGIVGSV.js} +3 -3
- package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
- package/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
- package/dist/bundle/chunks/{chunk-DRQDKNXA.js → chunk-7DDKXS2Q.js} +1 -1
- package/dist/bundle/chunks/chunk-BSS6T6KQ.js +2 -0
- package/dist/bundle/chunks/chunk-CF5GWZHW.js +31 -0
- package/dist/bundle/chunks/chunk-DNNHZBQR.js +4 -0
- package/dist/bundle/chunks/chunk-FN6OEZYR.js +2 -0
- package/dist/bundle/chunks/chunk-FTJT2X6E.js +2 -0
- package/dist/bundle/chunks/chunk-HZNN636Z.js +130 -0
- package/dist/bundle/chunks/{chunk-4L3WN2XY.js → chunk-JXWJOIH4.js} +1 -1
- package/dist/bundle/chunks/{chunk-4O2SCVYF.js → chunk-KIDDRTZP.js} +4 -4
- package/dist/bundle/chunks/chunk-LMNWTX2L.js +11 -0
- package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
- package/dist/bundle/chunks/{chunk-6CYCI3EJ.js → chunk-LVVZS2NO.js} +1 -1
- package/dist/bundle/chunks/chunk-NN4BEPYX.js +2 -0
- package/dist/bundle/chunks/chunk-O7IPTASE.js +1221 -0
- package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
- package/dist/bundle/chunks/chunk-QOEEJKS4.js +9 -0
- package/dist/bundle/chunks/chunk-R4VPBBDS.js +2 -0
- package/dist/bundle/chunks/chunk-RAQ6TU76.js +2 -0
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
- package/dist/bundle/chunks/chunk-SGOTYFMT.js +91 -0
- package/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
- package/dist/bundle/chunks/chunk-UKVNB6C4.js +2 -0
- package/dist/bundle/chunks/chunk-VJLOQZKR.js +9 -0
- package/dist/bundle/chunks/chunk-WCGU75WO.js +11 -0
- package/dist/bundle/chunks/chunk-X234222Q.js +64 -0
- package/dist/bundle/chunks/cli-722OL3K5.js +51 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MEZHQVNP.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +478 -0
- package/dist/bundle/chunks/easter-egg-3d-6H34EDGX.js +2 -0
- package/dist/bundle/chunks/execute-KVSEIDWL.js +499 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-C44KRRZ4.js → google-generative-ai-D2VJQBTK.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-25DUXPTJ.js → google-vertex-SQG2BO6C.js} +1 -1
- package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/{jiti-loader-C3NU2SDH.js → jiti-loader-GL4HJFAD.js} +1 -1
- package/dist/bundle/chunks/{jiti-static-loader-E6ANQD5T.js → jiti-static-loader-2RCDI6B4.js} +1 -1
- package/dist/bundle/chunks/{lib-HGQMNYVT.js → lib-4AVRLBHM.js} +2 -2
- package/dist/bundle/chunks/llama-cpp-classify-5YHLY3RC.js +22 -0
- package/dist/bundle/chunks/mistral-conversations-BDARVJTT.js +5 -0
- package/dist/bundle/chunks/{multipart-parser-SQ6GDJL7.js → multipart-parser-FMGQ7342.js} +1 -1
- package/dist/bundle/chunks/{node-TWVVAGPO.js → node-AUOGOBCN.js} +1 -1
- package/dist/bundle/chunks/node-KCMANYC2.js +16 -0
- package/dist/bundle/chunks/openai-chatgpt.js +86 -0
- package/dist/bundle/chunks/openai-codex-responses-CECGTDYD.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +2 -2
- package/dist/bundle/chunks/openai-completions-UOA7MELD.js +7 -0
- package/dist/bundle/chunks/openai-decisions-HLM372N6.js +5 -0
- package/dist/bundle/chunks/openai-responses-TII7ZY5X.js +3 -0
- package/dist/bundle/chunks/{openrouter-images-JVEJN44Q.js → openrouter-images-7T452AS5.js} +1 -1
- package/dist/bundle/chunks/openrouter.js +2 -2
- package/dist/bundle/chunks/{pi-messages-TM5SOOIW.js → pi-messages-2UDKLKOO.js} +1 -1
- package/dist/bundle/chunks/radius.js +2 -2
- package/dist/bundle/chunks/runtime-O3ELDOM7.js +2 -0
- package/dist/bundle/chunks/{src-UK77SYZE.js → src-QKGKDFSU.js} +1 -1
- package/dist/bundle/chunks/typesafe-system-one-KNCICMO5.js +2 -0
- package/dist/bundle/chunks/virtual-modules-IKEARUOZ.js +2 -0
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
- package/dist/bundle/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/export-html/template.js +37 -16
- package/dist/modes/interactive/theme/dark.json +60 -73
- package/dist/modes/interactive/theme/light.json +58 -70
- package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/system-theme.js +546 -0
- package/dist/modes/interactive/theme/system-theme.js.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +43 -9
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +121 -79
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +47 -56
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +149 -143
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
- package/dist/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
- package/docs/cli-integration.md +1 -1
- package/docs/cli.md +78 -13
- package/docs/codemode.md +230 -0
- package/docs/compaction.md +5 -5
- package/docs/configuration.md +2 -0
- package/docs/custom-provider.md +53 -1
- package/docs/docs.json +21 -1
- package/docs/environment-variables.md +5 -3
- package/docs/extensions.md +172 -10
- package/docs/index.md +1 -1
- package/docs/json.md +3 -3
- package/docs/keybindings.md +7 -6
- package/docs/llama-cpp.md +21 -1
- package/docs/mcp.md +272 -0
- package/docs/message-types.md +22 -4
- package/docs/models-configuration.md +187 -0
- package/docs/models.md +100 -2
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/packages.md +1 -1
- package/docs/providers.md +66 -6
- package/docs/quickstart.md +16 -2
- package/docs/rpc-commands.md +9 -3
- package/docs/rpc.md +3 -1
- package/docs/sdk.md +8 -3
- package/docs/security.md +2 -0
- package/docs/session-format.md +5 -1
- package/docs/sessions.md +1 -1
- package/docs/settings.md +30 -8
- package/docs/terminal-setup.md +14 -0
- package/docs/themes.md +31 -7
- package/docs/tui.md +71 -1
- package/docs/usage.md +2 -2
- package/docs/virtual-models.md +114 -0
- package/docs/windows.md +2 -0
- package/examples/README.md +1 -4
- package/examples/extensions/README.md +1 -0
- package/examples/extensions/built-in-tool-renderer.ts +16 -40
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +5 -5
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/jev-router.ts +113 -0
- package/examples/extensions/minimal-mode.ts +28 -101
- package/examples/extensions/overlay-test.ts +2 -2
- package/examples/extensions/plan-mode/index.ts +6 -2
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/index.ts +4 -6
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/rpc-client.ts +1 -1
- package/examples/rpc-extension-ui.ts +1 -1
- package/examples/sdk/14-codemode-mcp.ts +61 -0
- package/examples/sdk/README.md +2 -1
- package/judge/THIRD_PARTY_NOTICES.md +63 -0
- package/judge/dist/auth.js +169 -123
- package/judge/dist/import.js +36 -30
- package/judge/dist/setup.js +250 -120
- package/judge/manifest.json +1008 -316
- package/judge/{dist/kyrn-judge.js → mu/index.js} +6933 -5995
- package/judge/themes/mu-dark.json +80 -0
- package/judge/themes/mu-light.json +80 -0
- package/kyrn/bin/kyrn-doctor +75 -25
- package/kyrn/bin/kyrn-judge-local +2 -2
- package/kyrn/bin/kyrn-ledger +1 -1
- package/kyrn/bin/mu.mjs +149 -107
- package/package.json +4 -5
- package/dist/bundle/chunks/anthropic-messages-VMESUHQ7.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-K232MQFF.js +0 -2
- package/dist/bundle/chunks/chunk-A3JYRWB6.js +0 -2
- package/dist/bundle/chunks/chunk-AYFRR3OD.js +0 -2
- package/dist/bundle/chunks/chunk-DTD7JQ7Y.js +0 -42
- package/dist/bundle/chunks/chunk-FU4XQUSL.js +0 -11
- package/dist/bundle/chunks/chunk-GNYZK6XN.js +0 -2
- package/dist/bundle/chunks/chunk-HEMXN7VJ.js +0 -1653
- package/dist/bundle/chunks/chunk-MVPXOVOJ.js +0 -2
- package/dist/bundle/chunks/chunk-NUHFSC37.js +0 -25
- package/dist/bundle/chunks/chunk-V7IXECST.js +0 -11
- package/dist/bundle/chunks/chunk-XNGRGP62.js +0 -2
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-NR2TDCXU.js +0 -2
- package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +0 -13
- package/dist/bundle/chunks/mistral-conversations-6IHQOR4R.js +0 -5
- package/dist/bundle/chunks/node-O3RIBJRH.js +0 -16
- package/dist/bundle/chunks/openai-codex-responses-3UAYOSSR.js +0 -10
- package/dist/bundle/chunks/openai-completions-FIEQGWAH.js +0 -7
- package/dist/bundle/chunks/openai-responses-OZJXLHFC.js +0 -2
- package/dist/bundle/chunks/typesafe-system-one-VKYX4OGY.js +0 -2
- package/dist/bundle/chunks/virtual-modules-V7SXVVLP.js +0 -2
- package/dist/modes/interactive/theme/theme-json.d.ts +0 -85
- package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-json.js +0 -132
- package/dist/modes/interactive/theme/theme-json.js.map +0 -1
- package/dist/modes/interactive/theme/theme-schema.json +0 -361
- package/examples/plugins/pi-example-plugin/README.md +0 -38
- package/examples/plugins/pi-example-plugin/package.json +0 -10
- package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
- package/examples/plugins/pi-example-plugin/src/session.ts +0 -24
- package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme JSON validation, kept out of `theme.ts` on purpose.
|
|
3
|
+
*
|
|
4
|
+
* Validating user-authored theme files needs typebox, which costs ~17 MB of module graph to import.
|
|
5
|
+
* Palette lookup does not, so a presentation that only uses built-in themes should never pay for it.
|
|
6
|
+
* `main.ts` installs this validator before runtime resource loading; other consumers can opt in with
|
|
7
|
+
* `setThemeJsonValidator()`. Built-in themes do not need validation.
|
|
8
|
+
*/
|
|
9
|
+
import { type Static, Type } from "typebox";
|
|
10
|
+
import { type ThemeColorValues } from "./theme-tokens.ts";
|
|
11
|
+
export declare const ColorValueSchema: Type.TUnion<[Type.TString, Type.TInteger]>;
|
|
12
|
+
export type ThemeColorValue = Static<typeof ColorValueSchema>;
|
|
13
|
+
export declare const ThemeJsonSchema: Type.TObject<{
|
|
14
|
+
$schema: Type.TOptional<Type.TString>;
|
|
15
|
+
name: Type.TString;
|
|
16
|
+
appearance: Type.TOptional<Type.TUnion<[Type.TLiteral<"dark">, Type.TLiteral<"light">]>>;
|
|
17
|
+
vars: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TInteger]>>>;
|
|
18
|
+
colors: Type.TUnsafe<ThemeColorValues<string | number>>;
|
|
19
|
+
export: Type.TOptional<Type.TObject<{
|
|
20
|
+
pageBg: Type.TOptional<Type.TUnion<[Type.TString, Type.TInteger]>>;
|
|
21
|
+
cardBg: Type.TOptional<Type.TUnion<[Type.TString, Type.TInteger]>>;
|
|
22
|
+
infoBg: Type.TOptional<Type.TUnion<[Type.TString, Type.TInteger]>>;
|
|
23
|
+
}>>;
|
|
24
|
+
}>;
|
|
25
|
+
export type ValidatedThemeJson = Static<typeof ThemeJsonSchema>;
|
|
26
|
+
/** Validate one theme document, throwing a message that names the offending tokens. */
|
|
27
|
+
export declare function validateThemeJson(label: string, json: unknown): ValidatedThemeJson;
|
|
28
|
+
//# sourceMappingURL=theme-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-schema.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAoB,IAAI,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,EAAgB,KAAK,gBAAgB,EAA8B,MAAM,mBAAmB,CAAC;AAmBpG,eAAO,MAAM,gBAAgB,4CAAe,CAAC;AAE7C,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAmB9D,eAAO,MAAM,eAAe;;;;;;;;;;;EAsC3B,CAAC;AAIF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAEhE,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,kBAAkB,CAiDlF"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme JSON validation, kept out of `theme.ts` on purpose.
|
|
3
|
+
*
|
|
4
|
+
* Validating user-authored theme files needs typebox, which costs ~17 MB of module graph to import.
|
|
5
|
+
* Palette lookup does not, so a presentation that only uses built-in themes should never pay for it.
|
|
6
|
+
* `main.ts` installs this validator before runtime resource loading; other consumers can opt in with
|
|
7
|
+
* `setThemeJsonValidator()`. Built-in themes do not need validation.
|
|
8
|
+
*/
|
|
9
|
+
import { Type } from "typebox";
|
|
10
|
+
import { Compile } from "typebox/compile";
|
|
11
|
+
import { THEME_TOKENS } from "./theme-tokens.js";
|
|
12
|
+
function colorValue(description) {
|
|
13
|
+
return Type.Union([
|
|
14
|
+
Type.String({
|
|
15
|
+
description: "Hex color (#RGB or #RRGGBB), OKLCH or OKHSL color, variable reference, or empty string for terminal default",
|
|
16
|
+
}),
|
|
17
|
+
Type.Integer({
|
|
18
|
+
minimum: 0,
|
|
19
|
+
maximum: 255,
|
|
20
|
+
description: "256-color palette index (0-255)",
|
|
21
|
+
}),
|
|
22
|
+
], description ? { description } : {});
|
|
23
|
+
}
|
|
24
|
+
export const ColorValueSchema = colorValue();
|
|
25
|
+
function themeTokenProperties(tokens) {
|
|
26
|
+
const properties = {};
|
|
27
|
+
for (const [name, descriptor] of Object.entries(tokens)) {
|
|
28
|
+
const schema = colorValue(descriptor.description);
|
|
29
|
+
properties[name] = descriptor.fallback === undefined ? schema : Type.Optional(schema);
|
|
30
|
+
}
|
|
31
|
+
return properties;
|
|
32
|
+
}
|
|
33
|
+
const ThemeColorsSchema = Type.Unsafe(Type.Object(themeTokenProperties(THEME_TOKENS), {
|
|
34
|
+
description: "Theme color definitions (scrollbar, thinkingMax, and search highlight colors are optional and use compatible fallbacks)",
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
}));
|
|
37
|
+
export const ThemeJsonSchema = Type.Object({
|
|
38
|
+
$schema: Type.Optional(Type.String({ description: "JSON schema reference" })),
|
|
39
|
+
name: Type.String({
|
|
40
|
+
pattern: "^[^/]+$",
|
|
41
|
+
description: "Theme name. Must not contain '/' because it is reserved for automatic light/dark theme settings.",
|
|
42
|
+
}),
|
|
43
|
+
appearance: Type.Optional(Type.Union([Type.Literal("dark"), Type.Literal("light")], {
|
|
44
|
+
description: "Background the theme is designed for. Detected from the theme colors when omitted.",
|
|
45
|
+
})),
|
|
46
|
+
vars: Type.Optional(Type.Record(Type.String(), ColorValueSchema, {
|
|
47
|
+
description: "Reusable color variables",
|
|
48
|
+
})),
|
|
49
|
+
colors: ThemeColorsSchema,
|
|
50
|
+
export: Type.Optional(Type.Object({
|
|
51
|
+
pageBg: Type.Optional(colorValue("Page background color")),
|
|
52
|
+
cardBg: Type.Optional(colorValue("Card/container background color")),
|
|
53
|
+
infoBg: Type.Optional(colorValue("Info sections background (system prompt, notices)")),
|
|
54
|
+
}, {
|
|
55
|
+
description: "Optional colors for HTML export (defaults derived from userMessageBg if not specified)",
|
|
56
|
+
additionalProperties: false,
|
|
57
|
+
})),
|
|
58
|
+
}, {
|
|
59
|
+
title: "Pi Coding Agent Theme",
|
|
60
|
+
description: "Theme schema for Pi coding agent",
|
|
61
|
+
additionalProperties: false,
|
|
62
|
+
});
|
|
63
|
+
const compiledThemeSchema = Compile(ThemeJsonSchema);
|
|
64
|
+
/** Validate one theme document, throwing a message that names the offending tokens. */
|
|
65
|
+
export function validateThemeJson(label, json) {
|
|
66
|
+
if (typeof json === "object" &&
|
|
67
|
+
json !== null &&
|
|
68
|
+
"name" in json &&
|
|
69
|
+
typeof json.name === "string" &&
|
|
70
|
+
json.name.includes("/")) {
|
|
71
|
+
throw new Error(`Invalid theme name "${json.name}": theme names cannot contain "/" because it is reserved for automatic light/dark theme settings.`);
|
|
72
|
+
}
|
|
73
|
+
if (!compiledThemeSchema.Check(json)) {
|
|
74
|
+
const errors = Array.from(compiledThemeSchema.Errors(json));
|
|
75
|
+
const missingColors = new Set();
|
|
76
|
+
const otherErrors = [];
|
|
77
|
+
for (const error of errors) {
|
|
78
|
+
if (error.keyword === "required" && error.instancePath === "/colors") {
|
|
79
|
+
const requiredProperties = error.params.requiredProperties;
|
|
80
|
+
for (const requiredProperty of requiredProperties ?? []) {
|
|
81
|
+
missingColors.add(requiredProperty);
|
|
82
|
+
}
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const path = error.instancePath || "/";
|
|
86
|
+
otherErrors.push(` - ${path}: ${error.message}`);
|
|
87
|
+
}
|
|
88
|
+
let errorMessage = `Invalid theme "${label}":\n`;
|
|
89
|
+
if (missingColors.size > 0) {
|
|
90
|
+
errorMessage += "\nMissing required color tokens:\n";
|
|
91
|
+
errorMessage += Array.from(missingColors)
|
|
92
|
+
.sort()
|
|
93
|
+
.map((color) => ` - ${color}`)
|
|
94
|
+
.join("\n");
|
|
95
|
+
errorMessage += '\n\nPlease add these colors to your theme\'s "colors" object.';
|
|
96
|
+
errorMessage += "\nSee the built-in themes (dark.json, light.json) for reference values.";
|
|
97
|
+
}
|
|
98
|
+
if (otherErrors.length > 0) {
|
|
99
|
+
errorMessage += `\n\nOther errors:\n${otherErrors.join("\n")}`;
|
|
100
|
+
}
|
|
101
|
+
throw new Error(errorMessage);
|
|
102
|
+
}
|
|
103
|
+
return json;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=theme-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-schema.js","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAiC,IAAI,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAqD,MAAM,mBAAmB,CAAC;AAEpG,SAAS,UAAU,CAAC,WAAoB;IACvC,OAAO,IAAI,CAAC,KAAK,CAChB;QACC,IAAI,CAAC,MAAM,CAAC;YACX,WAAW,EACV,6GAA6G;SAC9G,CAAC;QACF,IAAI,CAAC,OAAO,CAAC;YACZ,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,GAAG;YACZ,WAAW,EAAE,iCAAiC;SAC9C,CAAC;KACF,EACD,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAClC,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,EAAE,CAAC;AAI7C,SAAS,oBAAoB,CAAC,MAA6B;IAC1D,MAAM,UAAU,GAAgB,EAAE,CAAC;IACnC,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAClD,UAAU,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC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AAW,CAAC,IAAI,CAAC,OAAO,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,YAAY,GAAG,kBAAkB,KAAK,MAAM,CAAC;QACjD,IAAI,aAAa,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAC5B,YAAY,IAAI,oCAAoC,CAAC;YACrD,YAAY,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC;iBACvC,IAAI,EAAE;iBACN,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC;iBAC9B,IAAI,CAAC,IAAI,CAAC,CAAC;YACb,YAAY,IAAI,+DAA+D,CAAC;YAChF,YAAY,IAAI,yEAAyE,CAAC;QAC3F,CAAC;QACD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,YAAY,IAAI,sBAAsB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAChE,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,IAA0B,CAAC;AACnC,CAAC","sourcesContent":["/**\n * Theme JSON validation, kept out of `theme.ts` on purpose.\n *\n * Validating user-authored theme files needs typebox, which costs ~17 MB of module graph to import.\n * Palette lookup does not, so a presentation that only uses built-in themes should never pay for it.\n * `main.ts` installs this validator before runtime resource loading; other consumers can opt in with\n * `setThemeJsonValidator()`. Built-in themes do not need validation.\n */\n\nimport { type Static, type TProperties, Type } from \"typebox\";\nimport { Compile } from \"typebox/compile\";\nimport { THEME_TOKENS, type ThemeColorValues, type ThemeTokenDescriptors } from \"./theme-tokens.ts\";\n\nfunction colorValue(description?: string) {\n\treturn Type.Union(\n\t\t[\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Hex color (#RGB or #RRGGBB), OKLCH or OKHSL color, variable reference, or empty string for terminal default\",\n\t\t\t}),\n\t\t\tType.Integer({\n\t\t\t\tminimum: 0,\n\t\t\t\tmaximum: 255,\n\t\t\t\tdescription: \"256-color palette index (0-255)\",\n\t\t\t}),\n\t\t],\n\t\tdescription ? { description } : {},\n\t);\n}\n\nexport const ColorValueSchema = colorValue();\n\nexport type ThemeColorValue = Static<typeof ColorValueSchema>;\n\nfunction themeTokenProperties(tokens: ThemeTokenDescriptors): TProperties {\n\tconst properties: TProperties = {};\n\tfor (const [name, descriptor] of Object.entries(tokens)) {\n\t\tconst schema = colorValue(descriptor.description);\n\t\tproperties[name] = descriptor.fallback === undefined ? schema : Type.Optional(schema);\n\t}\n\treturn properties;\n}\n\nconst ThemeColorsSchema = Type.Unsafe<ThemeColorValues<ThemeColorValue>>(\n\tType.Object(themeTokenProperties(THEME_TOKENS), {\n\t\tdescription:\n\t\t\t\"Theme color definitions (scrollbar, thinkingMax, and search highlight colors are optional and use compatible fallbacks)\",\n\t\tadditionalProperties: false,\n\t}),\n);\n\nexport const ThemeJsonSchema = Type.Object(\n\t{\n\t\t$schema: Type.Optional(Type.String({ description: \"JSON schema reference\" })),\n\t\tname: Type.String({\n\t\t\tpattern: \"^[^/]+$\",\n\t\t\tdescription:\n\t\t\t\t\"Theme name. Must not contain '/' because it is reserved for automatic light/dark theme settings.\",\n\t\t}),\n\t\tappearance: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"dark\"), Type.Literal(\"light\")], {\n\t\t\t\tdescription: \"Background the theme is designed for. Detected from the theme colors when omitted.\",\n\t\t\t}),\n\t\t),\n\t\tvars: Type.Optional(\n\t\t\tType.Record(Type.String(), ColorValueSchema, {\n\t\t\t\tdescription: \"Reusable color variables\",\n\t\t\t}),\n\t\t),\n\t\tcolors: ThemeColorsSchema,\n\t\texport: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tpageBg: Type.Optional(colorValue(\"Page background color\")),\n\t\t\t\t\tcardBg: Type.Optional(colorValue(\"Card/container background color\")),\n\t\t\t\t\tinfoBg: Type.Optional(colorValue(\"Info sections background (system prompt, notices)\")),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdescription: \"Optional colors for HTML export (defaults derived from userMessageBg if not specified)\",\n\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t},\n\t{\n\t\ttitle: \"Pi Coding Agent Theme\",\n\t\tdescription: \"Theme schema for Pi coding agent\",\n\t\tadditionalProperties: false,\n\t},\n);\n\nconst compiledThemeSchema = Compile(ThemeJsonSchema);\n\nexport type ValidatedThemeJson = Static<typeof ThemeJsonSchema>;\n\n/** Validate one theme document, throwing a message that names the offending tokens. */\nexport function validateThemeJson(label: string, json: unknown): ValidatedThemeJson {\n\tif (\n\t\ttypeof json === \"object\" &&\n\t\tjson !== null &&\n\t\t\"name\" in json &&\n\t\ttypeof json.name === \"string\" &&\n\t\tjson.name.includes(\"/\")\n\t) {\n\t\tthrow new Error(\n\t\t\t`Invalid theme name \"${json.name}\": theme names cannot contain \"/\" because it is reserved for automatic light/dark theme settings.`,\n\t\t);\n\t}\n\n\tif (!compiledThemeSchema.Check(json)) {\n\t\tconst errors = Array.from(compiledThemeSchema.Errors(json));\n\t\tconst missingColors = new Set<string>();\n\t\tconst otherErrors: string[] = [];\n\n\t\tfor (const error of errors) {\n\t\t\tif (error.keyword === \"required\" && error.instancePath === \"/colors\") {\n\t\t\t\tconst requiredProperties = (error.params as { requiredProperties?: string[] }).requiredProperties;\n\t\t\t\tfor (const requiredProperty of requiredProperties ?? []) {\n\t\t\t\t\tmissingColors.add(requiredProperty);\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst path = error.instancePath || \"/\";\n\t\t\totherErrors.push(` - ${path}: ${error.message}`);\n\t\t}\n\n\t\tlet errorMessage = `Invalid theme \"${label}\":\\n`;\n\t\tif (missingColors.size > 0) {\n\t\t\terrorMessage += \"\\nMissing required color tokens:\\n\";\n\t\t\terrorMessage += Array.from(missingColors)\n\t\t\t\t.sort()\n\t\t\t\t.map((color) => ` - ${color}`)\n\t\t\t\t.join(\"\\n\");\n\t\t\terrorMessage += '\\n\\nPlease add these colors to your theme\\'s \"colors\" object.';\n\t\t\terrorMessage += \"\\nSee the built-in themes (dark.json, light.json) for reference values.\";\n\t\t}\n\t\tif (otherErrors.length > 0) {\n\t\t\terrorMessage += `\\n\\nOther errors:\\n${otherErrors.join(\"\\n\")}`;\n\t\t}\n\n\t\tthrow new Error(errorMessage);\n\t}\n\n\treturn json as ValidatedThemeJson;\n}\n"]}
|
|
@@ -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":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,YAAY,GAAG,YAAY,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAA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
|
|
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 @@
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AAE;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"]}
|