stitchkit-tui 0.3.0 → 0.4.1
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/README.md +61 -16
- package/dist/{app-mqzzrp1t.js → app-2zw4ra7n.js} +36 -16
- package/dist/build/index.d.ts +42 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +174 -0
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/controller.d.ts.map +1 -1
- package/dist/core/index.js +27 -25
- package/dist/core/labels.d.ts +4 -0
- package/dist/core/labels.d.ts.map +1 -1
- package/dist/core/table.d.ts +18 -1
- package/dist/core/table.d.ts.map +1 -1
- package/dist/gallery/main.js +1 -1
- package/dist/gallery/monitor-page.d.ts.map +1 -1
- package/dist/{index-kz62sdr9.js → index-1qacnvfd.js} +1 -1
- package/dist/index-51qwgt9f.js +172 -0
- package/dist/index-ahfc59de.js +495 -0
- package/dist/{index-ecpc5qkb.js → index-as4srnct.js} +1 -0
- package/dist/{index-z4c2ehg4.js → index-djrp2fey.js} +107 -583
- package/dist/index-m0dhvt6x.js +160 -0
- package/dist/{index-251fexwh.js → index-qhj2ne64.js} +1 -1
- package/dist/{index-fxx9ktw7.js → index-t6mwjbgr.js} +68 -58
- package/dist/{index-54sqbm3r.js → index-wcbe2tnk.js} +168 -285
- package/dist/index.js +8 -5
- package/dist/{run-e1kdpzna.js → run-ea636vch.js} +8 -5
- package/dist/run.d.ts.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/testing/index.d.ts +50 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +110 -0
- package/dist/widgets/app.d.ts +77 -0
- package/dist/widgets/app.d.ts.map +1 -0
- package/dist/widgets/form.d.ts.map +1 -1
- package/dist/widgets/index.d.ts +1 -0
- package/dist/widgets/index.d.ts.map +1 -1
- package/dist/widgets/index.js +20 -7
- package/dist/widgets/table.d.ts.map +1 -1
- package/dist/widgets/theme.d.ts +7 -1
- package/dist/widgets/theme.d.ts.map +1 -1
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -48,8 +48,7 @@ a confirmation, a spinner, a JSON result, toasts), a process monitor and the sma
|
|
|
48
48
|
cycles auto/dark/light and Ctrl+L switches English/Russian.
|
|
49
49
|
|
|
50
50
|
```tsx
|
|
51
|
-
import {
|
|
52
|
-
import { createRoot, useTerminalDimensions } from '@opentui/react';
|
|
51
|
+
import { useTerminalDimensions } from '@opentui/react';
|
|
53
52
|
import { useReducer } from 'react';
|
|
54
53
|
import {
|
|
55
54
|
createTerminalList,
|
|
@@ -57,10 +56,9 @@ import {
|
|
|
57
56
|
terminalLabelsRu,
|
|
58
57
|
} from 'stitchkit-tui/core';
|
|
59
58
|
import {
|
|
59
|
+
runTerminalApp,
|
|
60
60
|
TerminalAppShell,
|
|
61
|
-
TerminalLabelsProvider,
|
|
62
61
|
TerminalList,
|
|
63
|
-
TerminalThemeProvider,
|
|
64
62
|
terminalListKeymap,
|
|
65
63
|
} from 'stitchkit-tui/widgets';
|
|
66
64
|
|
|
@@ -88,14 +86,10 @@ function Home() {
|
|
|
88
86
|
);
|
|
89
87
|
}
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<Home />
|
|
96
|
-
</TerminalLabelsProvider>
|
|
97
|
-
</TerminalThemeProvider>,
|
|
98
|
-
);
|
|
89
|
+
// The renderer, the theme and labels providers, an error boundary that shows the cause
|
|
90
|
+
// on screen, and an exit on Ctrl-C, a kill, a closed window (SIGHUP) or any other signal OpenTUI
|
|
91
|
+
// catches — so no orphan keeps drawing.
|
|
92
|
+
await runTerminalApp(<Home />, { labels: terminalLabelsRu });
|
|
99
93
|
```
|
|
100
94
|
|
|
101
95
|
What the widgets promise:
|
|
@@ -109,12 +103,62 @@ What the widgets promise:
|
|
|
109
103
|
- **Foreign text is sanitized.** Anything shown from data passes `sanitizeTerminalText`; JSON is
|
|
110
104
|
printed toned and escaped.
|
|
111
105
|
- **Live screens stay put.** Tables and lists draw only their window, rows are rewritten in place,
|
|
112
|
-
every line has a fixed position, and a time series is bounded by its window.
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
every line has a fixed position, and a time series is bounded by its window. A screen that
|
|
107
|
+
lives for hours runs React's production build (below), because the development build records a
|
|
108
|
+
measure for every render and Bun keeps them.
|
|
115
109
|
- **Words and colours have one source.** `TerminalLabels` (English and Russian bundled) and one
|
|
116
110
|
semantic `TerminalPalette` per terminal background, followed automatically in `auto` mode.
|
|
117
111
|
|
|
112
|
+
### React's production build
|
|
113
|
+
|
|
114
|
+
Choose it when the code is **compiled**, never by setting `NODE_ENV` at run time. Bun compiles
|
|
115
|
+
JSX to `jsxDEV` when it does not find a `tsconfig.json` with `jsx` from the working directory — a
|
|
116
|
+
start from a monorepo root — and React's production runtime has no `jsxDEV`: the screen stays
|
|
117
|
+
blank. OpenTUI's own root error boundary is compiled the same way, so it cannot show that error
|
|
118
|
+
either; `runTerminalApp`'s boundary can.
|
|
119
|
+
|
|
120
|
+
- An executable: `compileTerminalApp` (below) defines `process.env.NODE_ENV` as `"production"`.
|
|
121
|
+
- From source: `bun --define process.env.NODE_ENV='"production"' src/main.tsx`, and put
|
|
122
|
+
`/** @jsxImportSource @opentui/react */` at the top of each screen file so its JSX does not
|
|
123
|
+
depend on which `tsconfig.json` Bun finds.
|
|
124
|
+
|
|
125
|
+
### One executable for any platform
|
|
126
|
+
|
|
127
|
+
`bun build --compile --target=bun-linux-x64` on a Mac fails with `Could not resolve:
|
|
128
|
+
"@opentui/core-linux-x64"`: OpenTUI imports one native package per platform and a package manager
|
|
129
|
+
installs only the current machine's. `compileTerminalApp` adds the target's package — the version
|
|
130
|
+
the installed `@opentui/core` pins, downloaded from the registry and checked against the sha512 in
|
|
131
|
+
`bun.lock` — and replaces every other platform's with a module that throws. Musl targets are
|
|
132
|
+
refused: OpenTUI picks musl at run time from `OPENTUI_LIBC`.
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import { compileTerminalApp } from 'stitchkit-tui/build';
|
|
136
|
+
|
|
137
|
+
await compileTerminalApp({ entry: 'src/main.tsx', outfile: 'dist/app-linux-x64', target: 'bun-linux-x64' });
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
`terminalNativePlugin({ target })` is the same step as a plugin for a `Bun.build` of your own.
|
|
141
|
+
|
|
142
|
+
### Testing a screen
|
|
143
|
+
|
|
144
|
+
`renderTerminalTest` renders a screen inside the kit's providers on a test terminal and drives it
|
|
145
|
+
by real keys. Every step runs inside React's `act`, so the effects of the screen a key opened — its
|
|
146
|
+
keyboard subscription too — have run before the next key, and a lone Esc waits out the input
|
|
147
|
+
parser's escape timeout. A test has no `act` and no sleeps:
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import { renderTerminalTest } from 'stitchkit-tui/testing';
|
|
151
|
+
|
|
152
|
+
const screen = await renderTerminalTest(<Catalogue />, { width: 100, height: 30 });
|
|
153
|
+
await screen.press('RETURN');
|
|
154
|
+
await screen.type('alpha');
|
|
155
|
+
expect(await screen.press('ESCAPE')).toContain('› docs_read');
|
|
156
|
+
await screen.close();
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Run tests under React's development build (the default of `bun test`): the production build has
|
|
160
|
+
no `act`.
|
|
161
|
+
|
|
118
162
|
React, `@opentui/core` and `@opentui/react` are peers: install them in the application, so one copy
|
|
119
163
|
of each drives the whole tree. `stitchkit` is needed only for the agent host below.
|
|
120
164
|
|
|
@@ -145,7 +189,8 @@ Omit `statusLine` for the default projection, provide a formatter to replace eve
|
|
|
145
189
|
to `false` to hide the status line. The formatter receives the selected catalog entry, workspace,
|
|
146
190
|
activity, local identities and the canonical durable snapshot; it does not receive guessed token
|
|
147
191
|
counts. `theme` overrides colours of the kit's `TerminalPalette`, and `themeMode` picks the dark or
|
|
148
|
-
light palette.
|
|
192
|
+
light palette. The host starts through `runTerminalApp`: Ctrl-C, a kill and a closed window (SIGHUP) close
|
|
193
|
+
the session and exit the process; a host that owns its process passes `exitSignals: []`.
|
|
149
194
|
|
|
150
195
|
The bundled CLI loads `stitchkit.agent.ts` by default:
|
|
151
196
|
|
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
TerminalToneSchema2,
|
|
4
|
-
createTerminalTimeSeries2,
|
|
5
|
-
appendTerminalSample2,
|
|
6
4
|
createTerminalForm2,
|
|
7
5
|
reduceTerminalForm2,
|
|
8
6
|
terminalFormFieldsFromJsonSchema2,
|
|
7
|
+
terminalLabelsEn2,
|
|
8
|
+
terminalLabelsRu2
|
|
9
|
+
} from "./index-ahfc59de.js";
|
|
10
|
+
import {
|
|
11
|
+
createTerminalTimeSeries2,
|
|
12
|
+
appendTerminalSample2,
|
|
9
13
|
defineTerminalKeymap2,
|
|
10
14
|
matchTerminalKey2,
|
|
11
|
-
terminalLabelsEn2,
|
|
12
|
-
terminalLabelsRu2,
|
|
13
15
|
createTerminalList2,
|
|
14
16
|
reduceTerminalList2,
|
|
15
17
|
layoutTerminalMeterGrid2,
|
|
16
18
|
TerminalSpinnerKindSchema2,
|
|
17
19
|
createTerminalTable2,
|
|
18
20
|
reduceTerminalTable2
|
|
19
|
-
} from "./index-
|
|
21
|
+
} from "./index-djrp2fey.js";
|
|
20
22
|
import {
|
|
21
23
|
createTerminalNotices2,
|
|
22
24
|
reduceTerminalNotices2,
|
|
23
25
|
nextTerminalNoticeExpiry2,
|
|
24
26
|
createTerminalTabs2,
|
|
25
27
|
reduceTerminalTabs2
|
|
26
|
-
} from "./index-
|
|
28
|
+
} from "./index-qhj2ne64.js";
|
|
27
29
|
import {
|
|
28
|
-
useTerminalPalette2,
|
|
29
|
-
useTerminalThemeMode2,
|
|
30
|
-
TerminalThemeProvider2,
|
|
31
|
-
TerminalChart2,
|
|
32
|
-
TerminalSparkline2,
|
|
33
30
|
TerminalLabelsProvider2,
|
|
34
31
|
useTerminalLabels2,
|
|
35
32
|
TerminalKeyPriority2,
|
|
36
33
|
useTerminalKeyboard2,
|
|
34
|
+
useTerminalPalette2,
|
|
35
|
+
useTerminalThemeMode2,
|
|
36
|
+
TerminalThemeProvider2
|
|
37
|
+
} from "./index-m0dhvt6x.js";
|
|
38
|
+
import {
|
|
39
|
+
TerminalChart2,
|
|
40
|
+
TerminalSparkline2,
|
|
37
41
|
TerminalSpinner2,
|
|
38
42
|
TerminalProgressBar2,
|
|
39
43
|
TerminalDetails2,
|
|
@@ -50,7 +54,7 @@ import {
|
|
|
50
54
|
TerminalTabs2,
|
|
51
55
|
terminalTextViewKeymap2,
|
|
52
56
|
TerminalJsonView2
|
|
53
|
-
} from "./index-
|
|
57
|
+
} from "./index-wcbe2tnk.js";
|
|
54
58
|
|
|
55
59
|
// src/gallery/app.tsx
|
|
56
60
|
import { useRenderer, useTerminalDimensions } from "@opentui/react";
|
|
@@ -266,8 +270,18 @@ var columns = [
|
|
|
266
270
|
kind: "number",
|
|
267
271
|
width: 7,
|
|
268
272
|
format: (v) => `${Math.round(Number(v))}M`
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
id: "state",
|
|
276
|
+
title: "STATE",
|
|
277
|
+
kind: "text",
|
|
278
|
+
width: 8,
|
|
279
|
+
tone: (value) => value === "errored" ? "danger" : value === "online" ? "success" : undefined
|
|
269
280
|
}
|
|
270
281
|
];
|
|
282
|
+
function serviceState(app) {
|
|
283
|
+
return app % 11 === 4 ? "errored" : app % 7 === 3 ? "stopped" : "online";
|
|
284
|
+
}
|
|
271
285
|
function noise(seed) {
|
|
272
286
|
const x = Math.sin(seed * 12.9898) * 43758.5453;
|
|
273
287
|
return x - Math.floor(x);
|
|
@@ -281,8 +295,11 @@ function rows(tick) {
|
|
|
281
295
|
name: `service-${app}`,
|
|
282
296
|
pid: 1000 + app,
|
|
283
297
|
cpu: Math.round(noise(app * 31 + tick) * 400) / 10,
|
|
284
|
-
mem: app % 9 === 0 ? null : 40 + noise(app) * 600
|
|
285
|
-
|
|
298
|
+
mem: app % 9 === 0 ? null : 40 + noise(app) * 600,
|
|
299
|
+
state: serviceState(app)
|
|
300
|
+
},
|
|
301
|
+
...serviceState(app) === "stopped" && { tone: "muted" },
|
|
302
|
+
...serviceState(app) === "errored" && { tone: "danger" }
|
|
286
303
|
},
|
|
287
304
|
...Array.from({ length: 4 }, (_, worker) => ({
|
|
288
305
|
key: `app-${app}/w${worker}`,
|
|
@@ -291,8 +308,11 @@ function rows(tick) {
|
|
|
291
308
|
name: `worker-${worker}`,
|
|
292
309
|
pid: 20000 + app * 10 + worker,
|
|
293
310
|
cpu: Math.round(noise(app * 7 + worker + tick) * 1000) / 10,
|
|
294
|
-
mem: 10 + noise(worker + app) * 100
|
|
295
|
-
|
|
311
|
+
mem: 10 + noise(worker + app) * 100,
|
|
312
|
+
state: serviceState(app)
|
|
313
|
+
},
|
|
314
|
+
...serviceState(app) === "stopped" && { tone: "muted" },
|
|
315
|
+
...serviceState(app) === "errored" && { tone: "danger" }
|
|
296
316
|
}))
|
|
297
317
|
]).flat();
|
|
298
318
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { BunPlugin } from 'bun';
|
|
2
|
+
export interface TerminalNativeTarget {
|
|
3
|
+
platform: 'darwin' | 'linux' | 'win32';
|
|
4
|
+
arch: 'x64' | 'arm64';
|
|
5
|
+
/** The `@opentui/core-…` package whose library this executable carries. */
|
|
6
|
+
packageName: string;
|
|
7
|
+
}
|
|
8
|
+
/** Read a Bun compile target (`bun-linux-x64`, `bun-darwin-arm64-modern`, …). */
|
|
9
|
+
export declare function terminalNativeTarget(target: Bun.Build.CompileTarget): TerminalNativeTarget;
|
|
10
|
+
export interface TerminalNativePluginOptions {
|
|
11
|
+
target: Bun.Build.CompileTarget;
|
|
12
|
+
/** The lockfile that pins the native package's integrity; found upwards from the working directory. */
|
|
13
|
+
lockfile?: string;
|
|
14
|
+
/** Where verified tarballs are unpacked; reused across builds. */
|
|
15
|
+
cacheDirectory?: string;
|
|
16
|
+
registry?: string;
|
|
17
|
+
/** How long the registry may take to send the tarball (120 s). */
|
|
18
|
+
fetchTimeoutMs?: number;
|
|
19
|
+
fetch?: typeof fetch;
|
|
20
|
+
}
|
|
21
|
+
/** Bundle the target platform's OpenTUI native package, and no other platform's. */
|
|
22
|
+
export declare function terminalNativePlugin(options: TerminalNativePluginOptions): BunPlugin;
|
|
23
|
+
export interface CompileTerminalAppOptions {
|
|
24
|
+
entry: string;
|
|
25
|
+
outfile: string;
|
|
26
|
+
/** The platform the executable runs on; the machine building it may be another. */
|
|
27
|
+
target: Bun.Build.CompileTarget;
|
|
28
|
+
/** Extra `define`s; `process.env.NODE_ENV` is `"production"`, so React runs its production build. */
|
|
29
|
+
define?: Record<string, string>;
|
|
30
|
+
plugins?: BunPlugin[];
|
|
31
|
+
native?: Omit<TerminalNativePluginOptions, 'target'>;
|
|
32
|
+
minify?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Compile one standalone executable of a terminal application. React's
|
|
36
|
+
* production build is chosen at build time, where it belongs: setting
|
|
37
|
+
* NODE_ENV at run time cannot change JSX that was already compiled.
|
|
38
|
+
*/
|
|
39
|
+
export declare function compileTerminalApp(options: CompileTerminalAppOptions): Promise<{
|
|
40
|
+
outfile: string;
|
|
41
|
+
}>;
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/build/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAKrC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;IACvC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;IACtB,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,aAAa,GAAG,oBAAoB,CAkB1F;AA6BD,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC;IAChC,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,SAAS,CA8HpF;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC;IAChC,qGAAqG;IACrG,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,IAAI,CAAC,2BAA2B,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAmB9B"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/build/index.ts
|
|
3
|
+
import { createHash, randomUUID } from "crypto";
|
|
4
|
+
import { existsSync } from "fs";
|
|
5
|
+
import { mkdir, readFile, rename, rm, writeFile } from "fs/promises";
|
|
6
|
+
import { homedir } from "os";
|
|
7
|
+
import { dirname, join, resolve } from "path";
|
|
8
|
+
var NATIVE_PACKAGE = /^@opentui\/core-(darwin|linux|win32)-(x64|arm64)(-musl)?$/;
|
|
9
|
+
var ABSENT_NAMESPACE = "stitchkit-tui-absent-native";
|
|
10
|
+
function terminalNativeTarget(target) {
|
|
11
|
+
const parts = target.split("-");
|
|
12
|
+
const os = parts[1];
|
|
13
|
+
const rawArch = parts[2];
|
|
14
|
+
if (parts.includes("musl")) {
|
|
15
|
+
throw new Error(`stitchkit-tui/build: ${target} is not supported \u2014 OpenTUI selects musl at run time through OPENTUI_LIBC; build a glibc target`);
|
|
16
|
+
}
|
|
17
|
+
const platform = os === "darwin" ? "darwin" : os === "linux" ? "linux" : os === "windows" ? "win32" : null;
|
|
18
|
+
const arch = rawArch === "x64" ? "x64" : rawArch === "arm64" || rawArch === "aarch64" ? "arm64" : null;
|
|
19
|
+
if (!platform || !arch)
|
|
20
|
+
throw new Error(`stitchkit-tui/build: unknown compile target ${target}`);
|
|
21
|
+
return { platform, arch, packageName: `@opentui/core-${platform}-${arch}` };
|
|
22
|
+
}
|
|
23
|
+
function lockIntegrity(lock, spec) {
|
|
24
|
+
const packages = typeof lock === "object" && lock !== null ? Reflect.get(lock, "packages") : null;
|
|
25
|
+
if (typeof packages !== "object" || packages === null)
|
|
26
|
+
return null;
|
|
27
|
+
for (const entry of Object.values(packages)) {
|
|
28
|
+
if (!Array.isArray(entry) || entry[0] !== spec)
|
|
29
|
+
continue;
|
|
30
|
+
const integrity = entry.find((value) => typeof value === "string" && value.startsWith("sha512-"));
|
|
31
|
+
if (integrity)
|
|
32
|
+
return integrity;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function findUp(start, name) {
|
|
37
|
+
let directory = resolve(start);
|
|
38
|
+
while (true) {
|
|
39
|
+
const candidate = join(directory, name);
|
|
40
|
+
if (existsSync(candidate))
|
|
41
|
+
return candidate;
|
|
42
|
+
const parent = dirname(directory);
|
|
43
|
+
if (parent === directory)
|
|
44
|
+
return null;
|
|
45
|
+
directory = parent;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function terminalNativePlugin(options) {
|
|
49
|
+
const target = terminalNativeTarget(options.target);
|
|
50
|
+
const cacheDirectory = options.cacheDirectory ?? join(homedir(), ".cache", "stitchkit-tui", "native");
|
|
51
|
+
const registry = (options.registry ?? "https://registry.npmjs.org").replace(/\/$/, "");
|
|
52
|
+
const download = options.fetch ?? fetch;
|
|
53
|
+
const fetched = new Map;
|
|
54
|
+
async function pinnedVersion(importer) {
|
|
55
|
+
const manifestPath = findUp(dirname(importer), "package.json");
|
|
56
|
+
const manifest = manifestPath ? JSON.parse(await readFile(manifestPath, "utf8")) : null;
|
|
57
|
+
const optional = typeof manifest === "object" && manifest !== null ? Reflect.get(manifest, "optionalDependencies") : null;
|
|
58
|
+
const version = typeof optional === "object" && optional !== null ? Reflect.get(optional, target.packageName) : null;
|
|
59
|
+
if (typeof version !== "string" || !/^\d+\.\d+\.\d+/.test(version)) {
|
|
60
|
+
throw new Error(`stitchkit-tui/build: ${manifestPath ?? importer} does not pin ${target.packageName} to an exact version`);
|
|
61
|
+
}
|
|
62
|
+
return version;
|
|
63
|
+
}
|
|
64
|
+
async function fetchPackage(version) {
|
|
65
|
+
const spec = `${target.packageName}@${version}`;
|
|
66
|
+
const lockfile = options.lockfile ?? findUp(process.cwd(), "bun.lock");
|
|
67
|
+
if (!lockfile)
|
|
68
|
+
throw new Error(`stitchkit-tui/build: no bun.lock pins ${spec}`);
|
|
69
|
+
const integrity = lockIntegrity(Bun.JSONC.parse(await readFile(lockfile, "utf8")), spec);
|
|
70
|
+
if (!integrity) {
|
|
71
|
+
throw new Error(`stitchkit-tui/build: ${lockfile} records no integrity for ${spec}; run bun install`);
|
|
72
|
+
}
|
|
73
|
+
const sha512 = (bytes) => `sha512-${createHash("sha512").update(bytes).digest("base64")}`;
|
|
74
|
+
const key = createHash("sha256").update(integrity).digest("hex").slice(0, 16);
|
|
75
|
+
const directory = join(cacheDirectory, `${target.packageName.replace("/", "+")}@${version}-${key}`);
|
|
76
|
+
const entry = join(directory, "package", "index.bun.js");
|
|
77
|
+
const cached = async () => {
|
|
78
|
+
if (!existsSync(entry))
|
|
79
|
+
return false;
|
|
80
|
+
const kept = await readFile(join(directory, "package.tgz")).catch(() => null);
|
|
81
|
+
return kept !== null && sha512(kept) === integrity;
|
|
82
|
+
};
|
|
83
|
+
if (await cached())
|
|
84
|
+
return entry;
|
|
85
|
+
const basename = target.packageName.split("/")[1];
|
|
86
|
+
const url = `${registry}/${target.packageName}/-/${basename}-${version}.tgz`;
|
|
87
|
+
const response = await download(url, {
|
|
88
|
+
signal: AbortSignal.timeout(options.fetchTimeoutMs ?? 120000)
|
|
89
|
+
});
|
|
90
|
+
if (!response.ok)
|
|
91
|
+
throw new Error(`stitchkit-tui/build: ${url} answered ${response.status}`);
|
|
92
|
+
const tarball = new Uint8Array(await response.arrayBuffer());
|
|
93
|
+
const actual = sha512(tarball);
|
|
94
|
+
if (actual !== integrity) {
|
|
95
|
+
throw new Error(`stitchkit-tui/build: ${url} does not match bun.lock (${integrity}, got ${actual})`);
|
|
96
|
+
}
|
|
97
|
+
const staging = `${directory}.${randomUUID()}.partial`;
|
|
98
|
+
await mkdir(staging, { recursive: true });
|
|
99
|
+
try {
|
|
100
|
+
await writeFile(join(staging, "package.tgz"), tarball);
|
|
101
|
+
const tar = Bun.spawn(["tar", "-xzf", "package.tgz"], { cwd: staging, stderr: "pipe" });
|
|
102
|
+
if (await tar.exited !== 0) {
|
|
103
|
+
throw new Error(`stitchkit-tui/build: cannot unpack ${url}: ${await new Response(tar.stderr).text()}`);
|
|
104
|
+
}
|
|
105
|
+
if (!existsSync(join(staging, "package", "index.bun.js"))) {
|
|
106
|
+
throw new Error(`stitchkit-tui/build: ${spec} has no index.bun.js`);
|
|
107
|
+
}
|
|
108
|
+
if (existsSync(directory) && !await cached()) {
|
|
109
|
+
await rm(directory, { recursive: true, force: true });
|
|
110
|
+
}
|
|
111
|
+
if (!existsSync(directory))
|
|
112
|
+
await rename(staging, directory).catch(() => {
|
|
113
|
+
return;
|
|
114
|
+
});
|
|
115
|
+
if (!await cached())
|
|
116
|
+
throw new Error(`stitchkit-tui/build: cannot cache ${spec} in ${directory}`);
|
|
117
|
+
return entry;
|
|
118
|
+
} finally {
|
|
119
|
+
await rm(staging, { recursive: true, force: true });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
name: "stitchkit-tui-native",
|
|
124
|
+
setup(build) {
|
|
125
|
+
build.onResolve({ filter: NATIVE_PACKAGE }, async (args) => {
|
|
126
|
+
if (args.path !== target.packageName) {
|
|
127
|
+
return { path: args.path, namespace: ABSENT_NAMESPACE };
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
return { path: Bun.resolveSync(args.path, dirname(args.importer)) };
|
|
131
|
+
} catch {
|
|
132
|
+
const version = await pinnedVersion(args.importer);
|
|
133
|
+
let pending = fetched.get(version);
|
|
134
|
+
if (!pending) {
|
|
135
|
+
pending = fetchPackage(version);
|
|
136
|
+
fetched.set(version, pending);
|
|
137
|
+
}
|
|
138
|
+
return { path: await pending };
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
build.onLoad({ filter: /.*/, namespace: ABSENT_NAMESPACE }, (args) => ({
|
|
142
|
+
contents: `throw new Error(${JSON.stringify(`${args.path} is not in this executable: it was built for ${target.packageName}`)});
|
|
143
|
+
`,
|
|
144
|
+
loader: "js"
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
async function compileTerminalApp(options) {
|
|
150
|
+
const outfile = resolve(options.outfile);
|
|
151
|
+
const result = await Bun.build({
|
|
152
|
+
entrypoints: [options.entry],
|
|
153
|
+
compile: { target: options.target, outfile },
|
|
154
|
+
define: { "process.env.NODE_ENV": '"production"', ...options.define },
|
|
155
|
+
minify: options.minify ?? true,
|
|
156
|
+
throw: false,
|
|
157
|
+
plugins: [
|
|
158
|
+
terminalNativePlugin({ target: options.target, ...options.native }),
|
|
159
|
+
...options.plugins ?? []
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
if (!result.success) {
|
|
163
|
+
const causes = result.logs.map((log) => log.message).join(`
|
|
164
|
+
`);
|
|
165
|
+
throw new Error(`stitchkit-tui/build: ${options.entry} did not compile:
|
|
166
|
+
${causes}`);
|
|
167
|
+
}
|
|
168
|
+
return { outfile };
|
|
169
|
+
}
|
|
170
|
+
export {
|
|
171
|
+
compileTerminalApp,
|
|
172
|
+
terminalNativePlugin,
|
|
173
|
+
terminalNativeTarget
|
|
174
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import {
|
|
4
4
|
listAgentTuiSessions2,
|
|
5
5
|
createAgentTuiClient2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-as4srnct.js";
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
9
|
import path from "path";
|
|
@@ -69,7 +69,7 @@ if (command === "sessions") {
|
|
|
69
69
|
if (!isAgentTuiConfig(config)) {
|
|
70
70
|
throw new Error("The config default export must be created with defineAgentTui()");
|
|
71
71
|
}
|
|
72
|
-
const { runAgentTui } = await import("./run-
|
|
72
|
+
const { runAgentTui } = await import("./run-ea636vch.js");
|
|
73
73
|
await runAgentTui(config);
|
|
74
74
|
} else {
|
|
75
75
|
throw new Error(`Unknown command: ${command}`);
|
package/dist/config.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { HeadlessAgentHarness } from 'stitchkit/agent-runtime/harness';
|
|
|
3
3
|
import type { AgentTuiCommand } from './commands';
|
|
4
4
|
import type { TerminalPalette, TerminalThemeMode } from './core/theme';
|
|
5
5
|
import type { AgentTuiStatusLineFormatter } from './status-line';
|
|
6
|
+
import type { TerminalExitSignal } from './widgets/app';
|
|
6
7
|
export interface AgentTuiRuntimeBundle<CONTEXT> {
|
|
7
8
|
harness: HeadlessAgentHarness<CONTEXT>;
|
|
8
9
|
conversations?: AgentConversationReader;
|
|
@@ -35,6 +36,13 @@ export interface AgentTuiConfig<CONTEXT> {
|
|
|
35
36
|
themeMode?: TerminalThemeMode | 'auto';
|
|
36
37
|
/** Replace the default durable status rows, or set false to hide them. */
|
|
37
38
|
statusLine?: AgentTuiStatusLineFormatter | false;
|
|
39
|
+
/**
|
|
40
|
+
* Signals that close the session and exit the process (default SIGINT, SIGTERM,
|
|
41
|
+
* SIGHUP). An embedding host that owns the process passes `[]` and calls `close()`.
|
|
42
|
+
*/
|
|
43
|
+
exitSignals?: readonly TerminalExitSignal[];
|
|
44
|
+
/** The longest closing may take on a signal or Ctrl-C before the process exits anyway (5000 ms). */
|
|
45
|
+
closeTimeoutMs?: number;
|
|
38
46
|
}
|
|
39
47
|
export declare function defineAgentTui<CONTEXT>(config: AgentTuiConfig<CONTEXT>): AgentTuiConfig<CONTEXT>;
|
|
40
48
|
export declare function createFileAgentModelSelectionStore(workspace: string): AgentModelSelectionStore;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EAEzB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EACjB,yB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,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACtC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;IACvC,0EAA0E;IAC1E,UAAU,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IACjD;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC5C,oGAAoG;IACpG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,OAAO,EACpC,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,GAC9B,cAAc,CAAC,OAAO,CAAC,CAEzB;AAED,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,MAAM,GAChB,wBAAwB,CAuC1B"}
|
package/dist/controller.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,aAAa,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,2BAA2B,CAAC;IAC9C,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACtD;AAED,MAAM,WAAW,kBAAkB,CAAC,QAAQ;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AAO,EAAE,KAAK,EAAE;IAC7D,OAAO,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,UAAU,EAAE,wBAAwB,CAAC;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,CAAC,KAAK,EAAE;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,iBAAiB,CAAC;KAC1B,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B,GAAG,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAkMvC"}
|
package/dist/core/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
createTerminalFeedViewport2,
|
|
30
30
|
reduceTerminalFeedViewport2,
|
|
31
31
|
visibleTerminalFeedRange2
|
|
32
|
-
} from "../index-
|
|
32
|
+
} from "../index-1qacnvfd.js";
|
|
33
33
|
import {
|
|
34
34
|
TerminalNoticeSchema2,
|
|
35
35
|
createTerminalNotices2,
|
|
@@ -40,16 +40,11 @@ import {
|
|
|
40
40
|
createTerminalTabs2,
|
|
41
41
|
reduceTerminalTabs2,
|
|
42
42
|
selectedTerminalTab2
|
|
43
|
-
} from "../index-
|
|
43
|
+
} from "../index-qhj2ne64.js";
|
|
44
44
|
import {
|
|
45
45
|
matchTerminalSearch2,
|
|
46
46
|
searchTerminalItems2,
|
|
47
47
|
terminalHighlightRuns2,
|
|
48
|
-
TerminalToneSchema2,
|
|
49
|
-
TerminalThemeModeSchema2,
|
|
50
|
-
TerminalPaletteSchema2,
|
|
51
|
-
terminalPalettes2,
|
|
52
|
-
resolveTerminalPalette2,
|
|
53
48
|
createTerminalTimeSeries2,
|
|
54
49
|
appendTerminalSample2,
|
|
55
50
|
sampleTerminalTimeSeries2,
|
|
@@ -61,29 +56,12 @@ import {
|
|
|
61
56
|
createTerminalCollection2,
|
|
62
57
|
reduceTerminalCollection2,
|
|
63
58
|
visibleTerminalCollectionRange2,
|
|
64
|
-
sanitizeTerminalText2,
|
|
65
|
-
terminalGraphemes2,
|
|
66
|
-
terminalGraphemeWidth2,
|
|
67
|
-
terminalTextWidth2,
|
|
68
|
-
truncateTerminalText2,
|
|
69
|
-
fitTerminalText2,
|
|
70
|
-
wrapTerminalText2,
|
|
71
|
-
terminalTextEdit2,
|
|
72
|
-
applyTerminalTextEdit2,
|
|
73
|
-
TerminalFormFieldSchema2,
|
|
74
|
-
terminalFormMessages2,
|
|
75
|
-
createTerminalForm2,
|
|
76
|
-
readTerminalForm2,
|
|
77
|
-
reduceTerminalForm2,
|
|
78
|
-
terminalFormFieldsFromJsonSchema2,
|
|
79
59
|
terminalJsonLines2,
|
|
80
60
|
layoutTerminalDetails2,
|
|
81
61
|
TerminalKeyBindingSchema2,
|
|
82
62
|
defineTerminalKeymap2,
|
|
83
63
|
matchTerminalKey2,
|
|
84
64
|
fitTerminalKeyHints2,
|
|
85
|
-
terminalLabelsEn2,
|
|
86
|
-
terminalLabelsRu2,
|
|
87
65
|
terminalTableKeymap2,
|
|
88
66
|
terminalTableKey2,
|
|
89
67
|
terminalTabsKeymap2,
|
|
@@ -114,7 +92,31 @@ import {
|
|
|
114
92
|
selectedTerminalTableRow2,
|
|
115
93
|
layoutTerminalTableColumns2,
|
|
116
94
|
terminalTableTreePrefix2
|
|
117
|
-
} from "../index-
|
|
95
|
+
} from "../index-djrp2fey.js";
|
|
96
|
+
import {
|
|
97
|
+
TerminalToneSchema2,
|
|
98
|
+
TerminalThemeModeSchema2,
|
|
99
|
+
TerminalPaletteSchema2,
|
|
100
|
+
terminalPalettes2,
|
|
101
|
+
resolveTerminalPalette2,
|
|
102
|
+
sanitizeTerminalText2,
|
|
103
|
+
terminalGraphemes2,
|
|
104
|
+
terminalGraphemeWidth2,
|
|
105
|
+
terminalTextWidth2,
|
|
106
|
+
truncateTerminalText2,
|
|
107
|
+
fitTerminalText2,
|
|
108
|
+
wrapTerminalText2,
|
|
109
|
+
terminalTextEdit2,
|
|
110
|
+
applyTerminalTextEdit2,
|
|
111
|
+
TerminalFormFieldSchema2,
|
|
112
|
+
terminalFormMessages2,
|
|
113
|
+
createTerminalForm2,
|
|
114
|
+
readTerminalForm2,
|
|
115
|
+
reduceTerminalForm2,
|
|
116
|
+
terminalFormFieldsFromJsonSchema2,
|
|
117
|
+
terminalLabelsEn2,
|
|
118
|
+
terminalLabelsRu2
|
|
119
|
+
} from "../index-ahfc59de.js";
|
|
118
120
|
export {
|
|
119
121
|
TerminalCollectionStateSchema2 as TerminalCollectionStateSchema,
|
|
120
122
|
TerminalCommandDescriptorSchema2 as TerminalCommandDescriptorSchema,
|
package/dist/core/labels.d.ts
CHANGED
|
@@ -37,6 +37,10 @@ export interface TerminalLabels {
|
|
|
37
37
|
top: string;
|
|
38
38
|
bottom: string;
|
|
39
39
|
required: string;
|
|
40
|
+
/** What a form with no fields shows: Enter still submits it. */
|
|
41
|
+
noFields: string;
|
|
42
|
+
/** The heading `runTerminalApp` draws above an error that escaped the screens. */
|
|
43
|
+
crashed: string;
|
|
40
44
|
scroll: (percent: number) => string;
|
|
41
45
|
}
|
|
42
46
|
export declare const terminalLabelsEn: TerminalLabels;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/core/labels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAwB,MAAM,QAAQ,CAAC;AAEzE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,YAA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C;AAEH,eAAO,MAAM,gBAAgB,EAAE,cA0C7B,CAAC"}
|
package/dist/core/table.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type TerminalCollectionAction, type TerminalCollectionState } from './collection';
|
|
3
3
|
import { type TerminalTextEdit } from './text';
|
|
4
|
+
import { type TerminalTone } from './theme';
|
|
4
5
|
export declare const TerminalTableColumnSchema: z.ZodObject<{
|
|
5
6
|
id: z.ZodString;
|
|
6
7
|
title: z.ZodString;
|
|
@@ -19,17 +20,33 @@ export declare const TerminalTableColumnSchema: z.ZodObject<{
|
|
|
19
20
|
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
20
21
|
}, z.core.$strict>;
|
|
21
22
|
export type TerminalTableCellValue = string | number | null;
|
|
22
|
-
/**
|
|
23
|
+
/** What a column says about one of its cells: the tone it is drawn in, or none for the row's. */
|
|
24
|
+
export type TerminalTableCellTone = (value: TerminalTableCellValue, row: TerminalTableRow) => TerminalTone | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* A column; `format` turns a present value into the text a reader sees and the
|
|
27
|
+
* filter searches, and `tone` colours a cell by its value — a `fail` status in
|
|
28
|
+
* `danger` — over the row's tone.
|
|
29
|
+
*/
|
|
23
30
|
export type TerminalTableColumn = z.input<typeof TerminalTableColumnSchema> & {
|
|
24
31
|
format?: (value: string | number) => string;
|
|
32
|
+
tone?: TerminalTableCellTone;
|
|
25
33
|
};
|
|
26
34
|
type ParsedColumn = z.output<typeof TerminalTableColumnSchema> & {
|
|
27
35
|
format?: (value: string | number) => string;
|
|
36
|
+
tone?: TerminalTableCellTone;
|
|
28
37
|
};
|
|
29
38
|
export declare const TerminalTableRowSchema: z.ZodObject<{
|
|
30
39
|
key: z.ZodString;
|
|
31
40
|
parentKey: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
32
41
|
cells: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
42
|
+
tone: z.ZodOptional<z.ZodEnum<{
|
|
43
|
+
accent: "accent";
|
|
44
|
+
danger: "danger";
|
|
45
|
+
muted: "muted";
|
|
46
|
+
primary: "primary";
|
|
47
|
+
success: "success";
|
|
48
|
+
warning: "warning";
|
|
49
|
+
}>>;
|
|
33
50
|
}, z.core.$strict>;
|
|
34
51
|
export type TerminalTableRow = z.output<typeof TerminalTableRowSchema>;
|
|
35
52
|
export type TerminalTableRowInput = z.input<typeof TerminalTableRowSchema>;
|