@useavalon/caelence-agent 0.2.5-canary.1 → 0.2.5-canary.2
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/desktop/README.md +2 -2
- package/package.json +2 -3
- package/src/cli/main.ts +5 -5
- package/src/cli/theme.test.ts +40 -5
- package/src/cli/theme.ts +65 -4
- package/src/cli/tui-terminal-probe.test.ts +19 -0
- package/src/cli/tui-terminal-probe.ts +113 -0
- package/src/cli/tui.tsx +12 -13
- package/src/product.ts +1 -1
package/desktop/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Needs bun and Rust. System `rustup` works. A local toolchain can live in `deskto
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
# from this repo, or any project
|
|
11
|
-
bun
|
|
11
|
+
bun run desktop
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Or:
|
|
@@ -23,4 +23,4 @@ Paste an OpenRouter key in Settings after the window opens. You do not need to e
|
|
|
23
23
|
|
|
24
24
|
`HARNESS_CWD` is the project the agent opens.
|
|
25
25
|
|
|
26
|
-
The Ink TUI: `bun
|
|
26
|
+
The Ink TUI: `bun start` or `caelence` from the package.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useavalon/caelence-agent",
|
|
3
|
-
"version": "0.2.5-canary.
|
|
3
|
+
"version": "0.2.5-canary.2",
|
|
4
4
|
"description": "Caelence agent: Strands turn loop, local tools, skills, evals, and a themable terminal UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"bin": {
|
|
23
23
|
"caelence": "./bin/harness.ts",
|
|
24
|
-
"caelence-agent": "./bin/harness.ts"
|
|
25
|
-
"harness": "./bin/harness.ts"
|
|
24
|
+
"caelence-agent": "./bin/harness.ts"
|
|
26
25
|
},
|
|
27
26
|
"exports": {
|
|
28
27
|
".": "./src/index.ts",
|
package/src/cli/main.ts
CHANGED
|
@@ -41,8 +41,8 @@ function printHelp(): void {
|
|
|
41
41
|
process.stdout.write(`${PRODUCT_NAME}
|
|
42
42
|
|
|
43
43
|
Usage:
|
|
44
|
-
${CLI_NAME} Terminal UI
|
|
45
|
-
${CLI_NAME} desktop
|
|
44
|
+
${CLI_NAME} Terminal UI (same binary as caelence-agent)
|
|
45
|
+
${CLI_NAME} desktop Desktop window (Tauri)
|
|
46
46
|
${CLI_NAME} chat -m <text> One-shot turn
|
|
47
47
|
${CLI_NAME} eval [name] Run an eval suite (list if omitted)
|
|
48
48
|
${CLI_NAME} experiment Run the local regression dataset (no Langfuse required)
|
|
@@ -384,7 +384,7 @@ async function runExperiment(cwd: string): Promise<number> {
|
|
|
384
384
|
async function runChat(parsed: ParsedCli, mode: AgentMode | undefined): Promise<number> {
|
|
385
385
|
const message = parsed.message;
|
|
386
386
|
if (!message) {
|
|
387
|
-
process.stderr.write(
|
|
387
|
+
process.stderr.write(`${CLI_NAME} chat -m <text>\n`);
|
|
388
388
|
return 1;
|
|
389
389
|
}
|
|
390
390
|
const tty = Boolean(process.stdin.isTTY);
|
|
@@ -467,10 +467,10 @@ export async function main(argv = process.argv.slice(2)): Promise<number> {
|
|
|
467
467
|
const handler = COMMANDS[cmd];
|
|
468
468
|
if (handler) return handler(parsed);
|
|
469
469
|
if (cmd.startsWith("-")) {
|
|
470
|
-
process.stderr.write(`Unknown flag ${cmd}. Try
|
|
470
|
+
process.stderr.write(`Unknown flag ${cmd}. Try ${CLI_NAME} help.\n`);
|
|
471
471
|
return 1;
|
|
472
472
|
}
|
|
473
|
-
process.stderr.write(`Unknown command ${cmd}. Try
|
|
473
|
+
process.stderr.write(`Unknown command ${cmd}. Try ${CLI_NAME} help.\n`);
|
|
474
474
|
return 1;
|
|
475
475
|
}
|
|
476
476
|
|
package/src/cli/theme.test.ts
CHANGED
|
@@ -1,11 +1,46 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CAELENCE_LIGHT_THEME,
|
|
4
|
+
CAELENCE_THEME,
|
|
5
|
+
PLAIN_LIGHT_THEME,
|
|
6
|
+
PLAIN_THEME,
|
|
7
|
+
resolveTheme,
|
|
8
|
+
terminalPrefersLightBackground,
|
|
9
|
+
} from "./theme.ts";
|
|
3
10
|
|
|
4
11
|
describe("theme", () => {
|
|
5
|
-
test("defaults to caelence", () => {
|
|
6
|
-
expect(resolveTheme(undefined).brand).toBe(CAELENCE_THEME.brand);
|
|
7
|
-
expect(resolveTheme("plain").name).toBe(PLAIN_THEME.name);
|
|
8
|
-
expect(
|
|
12
|
+
test("defaults to caelence on dark terminals", () => {
|
|
13
|
+
expect(resolveTheme(undefined, { COLORFGBG: "7;0" }).brand).toBe(CAELENCE_THEME.brand);
|
|
14
|
+
expect(resolveTheme("plain", { COLORFGBG: "7;0" }).name).toBe(PLAIN_THEME.name);
|
|
15
|
+
expect(
|
|
16
|
+
resolveTheme({ ...CAELENCE_THEME, danger: "#ff0000" }, { COLORFGBG: "7;0" }).danger,
|
|
17
|
+
).toBe("#ff0000");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("uses light palette when COLORFGBG reports a pale background", () => {
|
|
21
|
+
expect(resolveTheme(undefined, { COLORFGBG: "0;15" }).ink).toBe(CAELENCE_LIGHT_THEME.ink);
|
|
22
|
+
expect(resolveTheme("plain", { COLORFGBG: "0;15" }).ink).toBe(PLAIN_LIGHT_THEME.ink);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("detects light background from COLORFGBG", () => {
|
|
26
|
+
expect(terminalPrefersLightBackground({ COLORFGBG: "0;15" })).toBe(true);
|
|
27
|
+
expect(terminalPrefersLightBackground({ COLORFGBG: "7;0" })).toBe(false);
|
|
28
|
+
expect(terminalPrefersLightBackground({})).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("honors CAELENCE_LIGHT_TERMINAL override", () => {
|
|
32
|
+
expect(terminalPrefersLightBackground({ CAELENCE_LIGHT_TERMINAL: "1", COLORFGBG: "7;0" })).toBe(
|
|
33
|
+
true,
|
|
34
|
+
);
|
|
35
|
+
expect(
|
|
36
|
+
terminalPrefersLightBackground({ CAELENCE_LIGHT_TERMINAL: "0", COLORFGBG: "0;15" }),
|
|
37
|
+
).toBe(false);
|
|
38
|
+
expect(resolveTheme(undefined, { CAELENCE_LIGHT_TERMINAL: "0", COLORFGBG: "0;15" }).ink).toBe(
|
|
39
|
+
CAELENCE_THEME.ink,
|
|
40
|
+
);
|
|
41
|
+
expect(resolveTheme(undefined, { CAELENCE_LIGHT_TERMINAL: "1", COLORFGBG: "7;0" }).ink).toBe(
|
|
42
|
+
CAELENCE_LIGHT_THEME.ink,
|
|
43
|
+
);
|
|
9
44
|
});
|
|
10
45
|
|
|
11
46
|
test("uses instrument blue instead of brand green", () => {
|
package/src/cli/theme.ts
CHANGED
|
@@ -25,6 +25,19 @@ export const CAELENCE_THEME: Theme = {
|
|
|
25
25
|
done: "#6e93b8",
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
/** Light-terminal mapping (dark ink on pale backgrounds). */
|
|
29
|
+
export const CAELENCE_LIGHT_THEME: Theme = {
|
|
30
|
+
name: "caelence",
|
|
31
|
+
brand: "#3d5a73",
|
|
32
|
+
action: "#3d5a73",
|
|
33
|
+
ink: "#1a1814",
|
|
34
|
+
muted: "#5c574f",
|
|
35
|
+
line: "#8a847a",
|
|
36
|
+
danger: "#b54a3f",
|
|
37
|
+
warning: "#9a6b1a",
|
|
38
|
+
done: "#3d5a73",
|
|
39
|
+
};
|
|
40
|
+
|
|
28
41
|
export const PLAIN_THEME: Theme = {
|
|
29
42
|
name: "plain",
|
|
30
43
|
brand: "blue",
|
|
@@ -37,8 +50,56 @@ export const PLAIN_THEME: Theme = {
|
|
|
37
50
|
done: "blue",
|
|
38
51
|
};
|
|
39
52
|
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
export const PLAIN_LIGHT_THEME: Theme = {
|
|
54
|
+
name: "plain",
|
|
55
|
+
brand: "blue",
|
|
56
|
+
action: "blue",
|
|
57
|
+
ink: "black",
|
|
58
|
+
muted: "gray",
|
|
59
|
+
line: "gray",
|
|
60
|
+
danger: "red",
|
|
61
|
+
warning: "yellow",
|
|
62
|
+
done: "blue",
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Explicit CAELENCE_LIGHT_TERMINAL when set; otherwise undefined (auto-detect).
|
|
67
|
+
* `1` = pale terminal background (dark ink). `0` = dark background (pale ink).
|
|
68
|
+
*/
|
|
69
|
+
export function readLightTerminalOverride(
|
|
70
|
+
env: Record<string, string | undefined>,
|
|
71
|
+
): boolean | undefined {
|
|
72
|
+
const raw = env.CAELENCE_LIGHT_TERMINAL?.trim().toLowerCase();
|
|
73
|
+
if (raw === "1" || raw === "true" || raw === "yes") return true;
|
|
74
|
+
if (raw === "0" || raw === "false" || raw === "no") return false;
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function terminalPrefersLightBackground(
|
|
79
|
+
env: Record<string, string | undefined> = process.env,
|
|
80
|
+
): boolean {
|
|
81
|
+
const override = readLightTerminalOverride(env);
|
|
82
|
+
if (override !== undefined) return override;
|
|
83
|
+
const raw = env.COLORFGBG?.trim();
|
|
84
|
+
if (!raw) return false;
|
|
85
|
+
const parts = raw.split(";").map((part) => Number.parseInt(part, 10));
|
|
86
|
+
const bg = parts.length >= 2 ? parts[1] : parts.at(-1);
|
|
87
|
+
if (bg === undefined || Number.isNaN(bg)) return false;
|
|
88
|
+
return bg >= 7;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function baseTheme(name: ThemeName, lightBackground: boolean): Theme {
|
|
92
|
+
if (name === "plain") return lightBackground ? PLAIN_LIGHT_THEME : PLAIN_THEME;
|
|
93
|
+
return lightBackground ? CAELENCE_LIGHT_THEME : CAELENCE_THEME;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function resolveTheme(
|
|
97
|
+
theme: ThemeName | Theme | undefined,
|
|
98
|
+
env: Record<string, string | undefined> = process.env,
|
|
99
|
+
): Theme {
|
|
100
|
+
const lightBackground = terminalPrefersLightBackground(env);
|
|
101
|
+
if (!theme) return baseTheme("caelence", lightBackground);
|
|
102
|
+
if (typeof theme === "string") return baseTheme(theme, lightBackground);
|
|
103
|
+
const base = baseTheme(theme.name === "plain" ? "plain" : "caelence", lightBackground);
|
|
104
|
+
return { ...base, ...theme };
|
|
44
105
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { detectLightTerminalBackground, luminanceFromOsc11 } from "./tui-terminal-probe.ts";
|
|
3
|
+
|
|
4
|
+
describe("tui terminal probe", () => {
|
|
5
|
+
test("parses OSC 11 rgb background", () => {
|
|
6
|
+
expect(luminanceFromOsc11("rgb:ffff/ffff/ffff")).toBeCloseTo(1, 1);
|
|
7
|
+
expect(luminanceFromOsc11("rgb:0000/0000/0000")).toBeCloseTo(0, 1);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
test("parses hex background", () => {
|
|
11
|
+
expect(luminanceFromOsc11("#ffffff")).toBeCloseTo(1, 1);
|
|
12
|
+
expect(luminanceFromOsc11("1a1a1a")).toBeCloseTo(0.1, 1);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test("defaults to light palette when detection is inconclusive", async () => {
|
|
16
|
+
expect(await detectLightTerminalBackground({})).toBe(true);
|
|
17
|
+
expect(await detectLightTerminalBackground({ CAELENCE_LIGHT_TERMINAL: "0" })).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { readLightTerminalOverride, terminalPrefersLightBackground } from "./theme.ts";
|
|
2
|
+
|
|
3
|
+
function channel(value: string): number {
|
|
4
|
+
const trimmed = value.trim();
|
|
5
|
+
if (!trimmed) return 0;
|
|
6
|
+
if (trimmed.includes("/")) {
|
|
7
|
+
const max = 16 ** trimmed.length - 1;
|
|
8
|
+
const n = Number.parseInt(trimmed, 16);
|
|
9
|
+
return Number.isNaN(n) ? 0 : n / max;
|
|
10
|
+
}
|
|
11
|
+
if (trimmed.length <= 2) {
|
|
12
|
+
const n = Number.parseInt(trimmed, 16);
|
|
13
|
+
return Number.isNaN(n) ? 0 : n / 255;
|
|
14
|
+
}
|
|
15
|
+
const n = Number.parseInt(trimmed, 16);
|
|
16
|
+
const max = 16 ** trimmed.length - 1;
|
|
17
|
+
return Number.isNaN(n) ? 0 : n / max;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Relative luminance 0–1 from an OSC 11 background report. */
|
|
21
|
+
export function luminanceFromOsc11(payload: string): number | undefined {
|
|
22
|
+
const text = payload.trim();
|
|
23
|
+
const rgbParts = /^rgb:([^/]+)\/([^/]+)\/([^/]+)/i.exec(text);
|
|
24
|
+
if (rgbParts) {
|
|
25
|
+
const r = channel(rgbParts[1] ?? "0");
|
|
26
|
+
const g = channel(rgbParts[2] ?? "0");
|
|
27
|
+
const b = channel(rgbParts[3] ?? "0");
|
|
28
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
29
|
+
}
|
|
30
|
+
const hex = /^#?([0-9a-f]{6})$/i.exec(text);
|
|
31
|
+
if (hex?.[1]) {
|
|
32
|
+
const value = hex[1];
|
|
33
|
+
const r = channel(value.slice(0, 2));
|
|
34
|
+
const g = channel(value.slice(2, 4));
|
|
35
|
+
const b = channel(value.slice(4, 6));
|
|
36
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function parseOsc11FromBuffer(buffer: string): number | undefined {
|
|
42
|
+
const start = buffer.indexOf("\x1b]11;");
|
|
43
|
+
if (start < 0) return undefined;
|
|
44
|
+
const end = buffer.indexOf("\x07", start);
|
|
45
|
+
if (end < 0) return undefined;
|
|
46
|
+
const body = buffer.slice(start + 5, end);
|
|
47
|
+
return luminanceFromOsc11(body);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** OSC 11 background luminance query on the **current** screen (call before alt-screen). */
|
|
51
|
+
export function queryOsc11BackgroundLight(
|
|
52
|
+
stdin: NodeJS.ReadStream = process.stdin,
|
|
53
|
+
stdout: NodeJS.WriteStream = process.stdout,
|
|
54
|
+
timeoutMs = 250,
|
|
55
|
+
): Promise<boolean | undefined> {
|
|
56
|
+
if (!stdin.isTTY || !stdout.isTTY) return Promise.resolve(undefined);
|
|
57
|
+
|
|
58
|
+
return new Promise((resolve) => {
|
|
59
|
+
let buffer = "";
|
|
60
|
+
let raw = false;
|
|
61
|
+
const timeout = setTimeout(() => finish(undefined), timeoutMs);
|
|
62
|
+
|
|
63
|
+
const finish = (light: boolean | undefined) => {
|
|
64
|
+
clearTimeout(timeout);
|
|
65
|
+
stdin.off("data", onData);
|
|
66
|
+
if (raw && stdin.isTTY && stdin.setRawMode) stdin.setRawMode(false);
|
|
67
|
+
resolve(light);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const onData = (chunk: Buffer | string) => {
|
|
71
|
+
buffer += typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
72
|
+
const lum = parseOsc11FromBuffer(buffer);
|
|
73
|
+
if (lum === undefined) return;
|
|
74
|
+
finish(lum > 0.55);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
if (stdin.isTTY && stdin.setRawMode) {
|
|
78
|
+
stdin.setRawMode(true);
|
|
79
|
+
raw = true;
|
|
80
|
+
}
|
|
81
|
+
stdin.on("data", onData);
|
|
82
|
+
stdout.write("\x1b]11;?\x07");
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Best-effort light/dark detection for TUI contrast.
|
|
88
|
+
* Run on the main screen before switching to the alt buffer.
|
|
89
|
+
*/
|
|
90
|
+
export async function detectLightTerminalBackground(
|
|
91
|
+
env: Record<string, string | undefined> = process.env,
|
|
92
|
+
): Promise<boolean> {
|
|
93
|
+
const explicit = readLightTerminalOverride(env);
|
|
94
|
+
if (explicit !== undefined) return explicit;
|
|
95
|
+
if (terminalPrefersLightBackground(env)) return true;
|
|
96
|
+
|
|
97
|
+
const osc = await queryOsc11BackgroundLight();
|
|
98
|
+
if (osc !== undefined) return osc;
|
|
99
|
+
|
|
100
|
+
// Cursor / IDE terminals often omit COLORFGBG and ignore OSC on the alt screen.
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Env for `resolveTheme` after TUI detection (respects explicit overrides). */
|
|
105
|
+
export async function resolveTuiThemeEnv(
|
|
106
|
+
env: Record<string, string | undefined> = process.env,
|
|
107
|
+
): Promise<Record<string, string | undefined>> {
|
|
108
|
+
const out = { ...env };
|
|
109
|
+
if (readLightTerminalOverride(out) !== undefined) return out;
|
|
110
|
+
const light = await detectLightTerminalBackground(out);
|
|
111
|
+
out.CAELENCE_LIGHT_TERMINAL = light ? "1" : "0";
|
|
112
|
+
return out;
|
|
113
|
+
}
|
package/src/cli/tui.tsx
CHANGED
|
@@ -32,11 +32,12 @@ import {
|
|
|
32
32
|
resolveSlashSubmit,
|
|
33
33
|
} from "./slash.ts";
|
|
34
34
|
import { applyPickerChoice, dispatchSlash, type SlashPickerKind } from "./slash-dispatch.ts";
|
|
35
|
-
import type
|
|
35
|
+
import { resolveTheme, type Theme } from "./theme.ts";
|
|
36
36
|
import { clipLabel, sidebarWidth, tuiChromeRows, visibleTranscriptRows } from "./tui-layout.ts";
|
|
37
37
|
import { turnProgressLabel } from "./tui-progress.ts";
|
|
38
38
|
import { enterAltScreen } from "./tui-screen.ts";
|
|
39
39
|
import type { StreamLine, ToolStatus, TurnToolLine } from "./tui-stream.ts";
|
|
40
|
+
import { resolveTuiThemeEnv } from "./tui-terminal-probe.ts";
|
|
40
41
|
import { TuiTextInput } from "./tui-text-input.tsx";
|
|
41
42
|
import { summarizeTurnTools, takeLinesForRowBudget } from "./tui-transcript.ts";
|
|
42
43
|
|
|
@@ -179,10 +180,7 @@ function Header(
|
|
|
179
180
|
<Box flexDirection="column">
|
|
180
181
|
<Box>
|
|
181
182
|
<Text color={color}>{mark}</Text>
|
|
182
|
-
<Text
|
|
183
|
-
{" "}
|
|
184
|
-
{PRODUCT_NAME}
|
|
185
|
-
</Text>
|
|
183
|
+
<Text bold> {PRODUCT_NAME}</Text>
|
|
186
184
|
<Text color={props.theme.muted}>
|
|
187
185
|
{" "}
|
|
188
186
|
{props.title} · {props.mode} · {label}
|
|
@@ -228,7 +226,7 @@ function Sidebar(
|
|
|
228
226
|
items.map((item) => (
|
|
229
227
|
<Text
|
|
230
228
|
key={item.id}
|
|
231
|
-
color={item.id === props.currentId ? props.theme.brand :
|
|
229
|
+
color={item.id === props.currentId ? props.theme.brand : undefined}
|
|
232
230
|
wrap="truncate"
|
|
233
231
|
>
|
|
234
232
|
{item.id === props.currentId ? "› " : " "}
|
|
@@ -448,13 +446,13 @@ function ApprovalCard(props: Readonly<{ theme: Theme; req: ApprovalRequest }>):
|
|
|
448
446
|
</Text>
|
|
449
447
|
{upload ? (
|
|
450
448
|
<>
|
|
451
|
-
<Text
|
|
452
|
-
<Text
|
|
449
|
+
<Text>Copy: {copyPath}</Text>
|
|
450
|
+
<Text>Original: {originalPath}</Text>
|
|
453
451
|
<Text color={props.theme.muted}>c copy · o original · n cancel</Text>
|
|
454
452
|
</>
|
|
455
453
|
) : (
|
|
456
454
|
<>
|
|
457
|
-
<Text
|
|
455
|
+
<Text>{command}</Text>
|
|
458
456
|
<Text color={props.theme.muted}>y approve · n deny · a always this session</Text>
|
|
459
457
|
</>
|
|
460
458
|
)}
|
|
@@ -652,9 +650,8 @@ function ComposerFooter(
|
|
|
652
650
|
);
|
|
653
651
|
}
|
|
654
652
|
|
|
655
|
-
function App(props: Readonly<{ harness: HarnessRuntime }>): React.ReactElement {
|
|
656
|
-
const { harness } = props;
|
|
657
|
-
const theme = harness.theme;
|
|
653
|
+
function App(props: Readonly<{ harness: HarnessRuntime; theme: Theme }>): React.ReactElement {
|
|
654
|
+
const { harness, theme } = props;
|
|
658
655
|
const { exit } = useApp();
|
|
659
656
|
const [lines, setLines] = useState<StreamLine[]>([]);
|
|
660
657
|
const [turnTools, setTurnTools] = useState<TurnToolLine[]>([]);
|
|
@@ -1037,9 +1034,11 @@ function App(props: Readonly<{ harness: HarnessRuntime }>): React.ReactElement {
|
|
|
1037
1034
|
}
|
|
1038
1035
|
|
|
1039
1036
|
export async function startTui(harness: HarnessRuntime): Promise<void> {
|
|
1037
|
+
const env = await resolveTuiThemeEnv({ ...process.env });
|
|
1038
|
+
const theme = resolveTheme(harness.config.theme, env);
|
|
1040
1039
|
const restore = enterAltScreen();
|
|
1041
1040
|
try {
|
|
1042
|
-
const instance = render(<App harness={harness} />, { patchConsole: true });
|
|
1041
|
+
const instance = render(<App harness={harness} theme={theme} />, { patchConsole: true });
|
|
1043
1042
|
await instance.waitUntilExit();
|
|
1044
1043
|
} finally {
|
|
1045
1044
|
restore();
|
package/src/product.ts
CHANGED