stitchkit-tui 0.1.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/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/App.d.ts +19 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/builtins.d.ts +3 -0
- package/dist/builtins.d.ts.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +2257 -0
- package/dist/commands.d.ts +44 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/composer.d.ts +16 -0
- package/dist/composer.d.ts.map +1 -0
- package/dist/config.d.ts +49 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/controller.d.ts +37 -0
- package/dist/controller.d.ts.map +1 -0
- package/dist/core/collection.d.ts +32 -0
- package/dist/core/collection.d.ts.map +1 -0
- package/dist/core/command-palette.d.ts +23 -0
- package/dist/core/command-palette.d.ts.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +361 -0
- package/dist/core/operation.d.ts +33 -0
- package/dist/core/operation.d.ts.map +1 -0
- package/dist/core/panes.d.ts +51 -0
- package/dist/core/panes.d.ts.map +1 -0
- package/dist/core/viewport.d.ts +36 -0
- package/dist/core/viewport.d.ts.map +1 -0
- package/dist/diagnostics.d.ts +72 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2219 -0
- package/dist/keyboard.d.ts +7 -0
- package/dist/keyboard.d.ts.map +1 -0
- package/dist/model-picker.d.ts +40 -0
- package/dist/model-picker.d.ts.map +1 -0
- package/dist/run.d.ts +11 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/session.d.ts +64 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/status-line.d.ts +20 -0
- package/dist/status-line.d.ts.map +1 -0
- package/dist/transcript.d.ts +9 -0
- package/dist/transcript.d.ts.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Max Listov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# stitchkit-tui
|
|
2
|
+
|
|
3
|
+
The official composable terminal host for `stitchkit/agent-runtime`.
|
|
4
|
+
|
|
5
|
+
It supplies a full durable transcript, multiline composer, slash-command registry, live model
|
|
6
|
+
catalog picker, approval cards, conversation switching and an authenticated local session socket.
|
|
7
|
+
The package never owns provider policy or tools: applications compose those in one typed config.
|
|
8
|
+
The default shell keeps the terminal's own canvas, executes the highlighted slash suggestion on
|
|
9
|
+
Enter and shows a compact two-row status line with model capacity and durable usage.
|
|
10
|
+
|
|
11
|
+
Applications that own a different terminal product shell import the pure state layer instead:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import {
|
|
15
|
+
createTerminalCollection,
|
|
16
|
+
reduceTerminalCollection,
|
|
17
|
+
createTerminalPaneState,
|
|
18
|
+
} from 'stitchkit-tui/core';
|
|
19
|
+
|
|
20
|
+
let sessions = createTerminalCollection(['one', 'two'], 8, 'two');
|
|
21
|
+
sessions = reduceTerminalCollection(sessions, {
|
|
22
|
+
type: 'reconcile',
|
|
23
|
+
keys: ['two', 'one'],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const panes = createTerminalPaneState({
|
|
27
|
+
totalSize: 120,
|
|
28
|
+
primarySize: 48,
|
|
29
|
+
minPrimary: 32,
|
|
30
|
+
minSecondary: 48,
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`stitchkit-tui/core` imports no React, OpenTUI or agent-runtime code. It owns only identity-stable
|
|
35
|
+
collections, feed viewport state, split panes, command selection and confirmed operations. Session
|
|
36
|
+
cards, process supervision, restart policy and runtime adapters remain with the embedding product.
|
|
37
|
+
|
|
38
|
+
Every normal launch starts a fresh durable conversation. Use `/resume` (or `/sessions`) to pick
|
|
39
|
+
an earlier conversation, and `/clear` to leave the current one resumable while starting clean.
|
|
40
|
+
Embedding hosts that intentionally want a fixed identity may set `initialConversationId`.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { defineAgentTui, runAgentTui } from 'stitchkit-tui';
|
|
44
|
+
|
|
45
|
+
const config = defineAgentTui({
|
|
46
|
+
context: () => ({}),
|
|
47
|
+
modelCatalog,
|
|
48
|
+
createRuntime: ({ catalog, selections }) => ({ harness, conversations }),
|
|
49
|
+
statusLine: ({ model, activity, conversationId }) => [
|
|
50
|
+
[{ text: model?.name ?? 'no model', tone: 'accent' }],
|
|
51
|
+
[
|
|
52
|
+
{ text: conversationId.slice(0, 8), tone: 'muted' },
|
|
53
|
+
{ text: activity.toLowerCase(), tone: 'success' },
|
|
54
|
+
],
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
await runAgentTui(config);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Omit `statusLine` for the default projection, provide a formatter to replace every row, or set it
|
|
62
|
+
to `false` to hide the status line. The formatter receives the selected catalog entry, workspace,
|
|
63
|
+
activity, local identities and the canonical durable snapshot; it does not receive guessed token
|
|
64
|
+
counts. `theme` remains an independent semantic color override.
|
|
65
|
+
|
|
66
|
+
The bundled CLI loads `stitchkit.agent.ts` by default:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
stitchkit-agent run
|
|
70
|
+
stitchkit-agent sessions --workspace /path/to/project
|
|
71
|
+
stitchkit-agent send --session SESSION_ID --idempotency-key CALLER_KEY -- "Continue the review"
|
|
72
|
+
stitchkit-agent interrupt --session SESSION_ID
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Local clients authenticate through a mode-`0600` descriptor and Unix socket. They submit through
|
|
76
|
+
the live TUI controller, so there is one runtime owner and one durable admission path.
|
|
77
|
+
Startup resumes still-queued work and safely skips acquired work by default. A host may provide
|
|
78
|
+
`recover` only when it can derive stronger replay evidence; the TUI never invents
|
|
79
|
+
`replaySafe: true` for application side effects.
|
|
80
|
+
|
|
81
|
+
Each terminal session writes a bounded, rotating metadata journal under
|
|
82
|
+
`.stitchkit/logs/tui/<session-id>.jsonl`. It records conversation and run identities plus lifecycle
|
|
83
|
+
transitions; prompt/model text, reasoning, tool arguments, provider causes and credentials are
|
|
84
|
+
discarded before journal admission. Live-session files are retained, alongside the eight newest
|
|
85
|
+
inactive session journals.
|
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AgentConversationReader, AgentModelCatalog } from 'stitchkit/agent-runtime';
|
|
2
|
+
import { type AgentTuiCommand } from './commands';
|
|
3
|
+
import type { AgentTuiTheme } from './config';
|
|
4
|
+
import type { AgentTuiController } from './controller';
|
|
5
|
+
import { type AgentTuiStatusLineFormatter } from './status-line';
|
|
6
|
+
export declare function AgentTuiApp<CONTEXT>({ controller, catalog, conversations, commands: customCommands, theme, workspace, statusLine, sessionId, title, onConversationChange, onExit, }: {
|
|
7
|
+
controller: AgentTuiController<CONTEXT>;
|
|
8
|
+
catalog: AgentModelCatalog;
|
|
9
|
+
conversations?: AgentConversationReader;
|
|
10
|
+
commands?: readonly AgentTuiCommand[];
|
|
11
|
+
theme: AgentTuiTheme;
|
|
12
|
+
workspace: string;
|
|
13
|
+
statusLine?: AgentTuiStatusLineFormatter | false;
|
|
14
|
+
sessionId: string;
|
|
15
|
+
title: string;
|
|
16
|
+
onConversationChange(conversationId: string, reason: 'new' | 'clear' | 'resume'): void | Promise<void>;
|
|
17
|
+
onExit(): void | Promise<void>;
|
|
18
|
+
}): import("react").ReactNode;
|
|
19
|
+
//# sourceMappingURL=App.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EAEvB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,KAAK,eAAe,EAKrB,MAAM,YAAY,CAAC;AAOpB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAA2B,MAAM,cAAc,CAAC;AAKhF,OAAO,EACL,KAAK,2BAA2B,EAGjC,MAAM,eAAe,CAAC;AAkDvB,wBAAgB,WAAW,CAAC,OAAO,EAAE,EACnC,UAAU,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EAAE,cAAmB,EAC7B,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,KAAK,EACL,oBAAoB,EACpB,MAAM,GACP,EAAE;IACD,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,QAAQ,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACtC,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB,CAClB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GACjC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC,6BAioBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,YAAY,CAAC;AASpB,wBAAgB,6BAA6B,IAAI,SAAS,eAAe,EAAE,CAkE1E"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|