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.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +85 -0
  3. package/dist/App.d.ts +19 -0
  4. package/dist/App.d.ts.map +1 -0
  5. package/dist/builtins.d.ts +3 -0
  6. package/dist/builtins.d.ts.map +1 -0
  7. package/dist/cli.d.ts +3 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +2257 -0
  10. package/dist/commands.d.ts +44 -0
  11. package/dist/commands.d.ts.map +1 -0
  12. package/dist/composer.d.ts +16 -0
  13. package/dist/composer.d.ts.map +1 -0
  14. package/dist/config.d.ts +49 -0
  15. package/dist/config.d.ts.map +1 -0
  16. package/dist/controller.d.ts +37 -0
  17. package/dist/controller.d.ts.map +1 -0
  18. package/dist/core/collection.d.ts +32 -0
  19. package/dist/core/collection.d.ts.map +1 -0
  20. package/dist/core/command-palette.d.ts +23 -0
  21. package/dist/core/command-palette.d.ts.map +1 -0
  22. package/dist/core/index.d.ts +6 -0
  23. package/dist/core/index.d.ts.map +1 -0
  24. package/dist/core/index.js +361 -0
  25. package/dist/core/operation.d.ts +33 -0
  26. package/dist/core/operation.d.ts.map +1 -0
  27. package/dist/core/panes.d.ts +51 -0
  28. package/dist/core/panes.d.ts.map +1 -0
  29. package/dist/core/viewport.d.ts +36 -0
  30. package/dist/core/viewport.d.ts.map +1 -0
  31. package/dist/diagnostics.d.ts +72 -0
  32. package/dist/diagnostics.d.ts.map +1 -0
  33. package/dist/index.d.ts +12 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +2219 -0
  36. package/dist/keyboard.d.ts +7 -0
  37. package/dist/keyboard.d.ts.map +1 -0
  38. package/dist/model-picker.d.ts +40 -0
  39. package/dist/model-picker.d.ts.map +1 -0
  40. package/dist/run.d.ts +11 -0
  41. package/dist/run.d.ts.map +1 -0
  42. package/dist/session.d.ts +64 -0
  43. package/dist/session.d.ts.map +1 -0
  44. package/dist/status-line.d.ts +20 -0
  45. package/dist/status-line.d.ts.map +1 -0
  46. package/dist/transcript.d.ts +9 -0
  47. package/dist/transcript.d.ts.map +1 -0
  48. package/package.json +59 -0
@@ -0,0 +1,7 @@
1
+ export interface AgentTuiKey {
2
+ name?: string;
3
+ ctrl?: boolean;
4
+ }
5
+ /** Raw terminal mode consumes SIGINT, so Ctrl+C must be handled as a key too. */
6
+ export declare function isAgentTuiExitKey(key: AgentTuiKey): boolean;
7
+ //# sourceMappingURL=keyboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../src/keyboard.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAE3D"}
@@ -0,0 +1,40 @@
1
+ import type { AgentModelCatalog } from 'stitchkit/agent-runtime';
2
+ export declare const AGENT_TUI_MODEL_RESULT_LIMIT = 200;
3
+ /** Search the complete catalog while bounding the options retained by the renderer. */
4
+ export declare function searchAgentTuiModels(catalog: AgentModelCatalog, query: string): {
5
+ models: {
6
+ id: string;
7
+ name: string;
8
+ descriptor: {
9
+ provider: string;
10
+ modelId: string;
11
+ contextWindow: number;
12
+ capabilities: ("files" | "reasoning" | "tools" | "vision")[];
13
+ observedAt?: string | undefined;
14
+ source?: string | undefined;
15
+ availability?: "available" | "unavailable" | undefined;
16
+ };
17
+ description?: string | undefined;
18
+ price?: {
19
+ currency: string;
20
+ inputPerToken?: string | undefined;
21
+ outputPerToken?: string | undefined;
22
+ } | undefined;
23
+ popularity?: {
24
+ rank: number;
25
+ window: "week";
26
+ source: string;
27
+ observedAt: string;
28
+ } | undefined;
29
+ metrics: {
30
+ metric: string;
31
+ value: number;
32
+ unit: "elo" | "index" | "milliseconds" | "percent";
33
+ source: string;
34
+ observedAt: string;
35
+ }[];
36
+ }[];
37
+ total: number;
38
+ truncated: boolean;
39
+ };
40
+ //# sourceMappingURL=model-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-picker.d.ts","sourceRoot":"","sources":["../src/model-picker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD,uFAAuF;AACvF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK7E"}
package/dist/run.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { AgentRecoverableDescriptor, AgentRuntimeRecoveryDecision } from 'stitchkit/agent-runtime';
2
+ import type { AgentTuiConfig } from './config';
3
+ export interface RunningAgentTui {
4
+ sessionId: string;
5
+ close(): Promise<void>;
6
+ }
7
+ export declare function defaultAgentTuiRecoveryDecision({ run, }: AgentRecoverableDescriptor): AgentRuntimeRecoveryDecision;
8
+ export declare function resolveAgentTuiInitialConversationId(initialConversationId?: string): string;
9
+ /** Start the official terminal host around one headless runtime controller. */
10
+ export declare function runAgentTui<CONTEXT>(config: AgentTuiConfig<CONTEXT>): Promise<RunningAgentTui>;
11
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAgB/C,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,wBAAgB,+BAA+B,CAAC,EAC9C,GAAG,GACJ,EAAE,0BAA0B,GAAG,4BAA4B,CAE3D;AAED,wBAAgB,oCAAoC,CAAC,qBAAqB,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3F;AAED,+EAA+E;AAC/E,wBAAsB,WAAW,CAAC,OAAO,EACvC,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,GAC9B,OAAO,CAAC,eAAe,CAAC,CAqJ1B"}
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ export declare const AgentTuiSessionDescriptorSchema: z.ZodObject<{
3
+ schemaVersion: z.ZodLiteral<1>;
4
+ sessionId: z.ZodString;
5
+ conversationId: z.ZodString;
6
+ socketPath: z.ZodString;
7
+ token: z.ZodString;
8
+ pid: z.ZodInt;
9
+ startedAt: z.ZodISODateTime;
10
+ }, z.core.$strict>;
11
+ export declare const AgentTuiSessionRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
12
+ requestId: z.ZodString;
13
+ operation: z.ZodLiteral<"status">;
14
+ }, z.core.$strict>, z.ZodObject<{
15
+ requestId: z.ZodString;
16
+ operation: z.ZodLiteral<"submit">;
17
+ text: z.ZodString;
18
+ idempotencyKey: z.ZodString;
19
+ }, z.core.$strict>, z.ZodObject<{
20
+ requestId: z.ZodString;
21
+ operation: z.ZodLiteral<"interrupt">;
22
+ runId: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strict>], "operation">;
24
+ export declare const AgentTuiSessionResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
25
+ requestId: z.ZodString;
26
+ outcome: z.ZodLiteral<"ok">;
27
+ sessionId: z.ZodString;
28
+ conversationId: z.ZodString;
29
+ runId: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ requestId: z.ZodString;
32
+ outcome: z.ZodLiteral<"error">;
33
+ error: z.ZodObject<{
34
+ code: z.ZodString;
35
+ message: z.ZodString;
36
+ }, z.core.$strict>;
37
+ }, z.core.$strict>], "outcome">;
38
+ export type AgentTuiSessionDescriptor = z.infer<typeof AgentTuiSessionDescriptorSchema>;
39
+ export type AgentTuiSessionRequest = z.infer<typeof AgentTuiSessionRequestSchema>;
40
+ export type AgentTuiSessionResponse = z.infer<typeof AgentTuiSessionResponseSchema>;
41
+ export declare function createAgentTuiSessionId(): string;
42
+ export declare function createAgentTuiConversationId(): string;
43
+ export declare function listAgentTuiSessions(rootDirectory: string): Promise<readonly AgentTuiSessionDescriptor[]>;
44
+ export interface AgentTuiSessionHost {
45
+ sessionId: string;
46
+ socketPath: string;
47
+ setConversationId(conversationId: string): Promise<void>;
48
+ close(): Promise<void>;
49
+ }
50
+ export declare function startAgentTuiSessionHost(input: {
51
+ rootDirectory: string;
52
+ conversationId: string;
53
+ sessionId?: string;
54
+ handle(request: AgentTuiSessionRequest): Promise<AgentTuiSessionResponse>;
55
+ }): Promise<AgentTuiSessionHost>;
56
+ export interface AgentTuiClient {
57
+ request(request: AgentTuiSessionRequest): Promise<AgentTuiSessionResponse>;
58
+ }
59
+ export declare function createAgentTuiClient(input: {
60
+ rootDirectory: string;
61
+ sessionId: string;
62
+ timeoutMs?: number;
63
+ }): Promise<AgentTuiClient>;
64
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,+BAA+B;;;;;;;;kBAUjC,CAAC;AAEZ,eAAO,MAAM,4BAA4B;;;;;;;;;;;;iCAiBvC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;+BAiBxC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AA8FD,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,SAAS,yBAAyB,EAAE,CAAC,CAuB/C;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,wBAAsB,wBAAwB,CAAC,KAAK,EAAE;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC3E,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmE/B;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC5E;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,cAAc,CAAC,CAoB1B"}
@@ -0,0 +1,20 @@
1
+ import type { AgentModelCatalogEntry, AgentSnapshot } from 'stitchkit/agent-runtime';
2
+ export type AgentTuiStatusTone = 'primary' | 'muted' | 'accent' | 'success' | 'warning' | 'danger';
3
+ export interface AgentTuiStatusSegment {
4
+ text: string;
5
+ tone?: AgentTuiStatusTone;
6
+ }
7
+ export type AgentTuiStatusRows = readonly (readonly AgentTuiStatusSegment[])[];
8
+ export interface AgentTuiStatusLineContext {
9
+ title: string;
10
+ workspace: string;
11
+ activity: 'READY' | 'RUNNING' | 'APPROVAL';
12
+ sessionId: string;
13
+ conversationId: string;
14
+ model?: AgentModelCatalogEntry;
15
+ snapshot: AgentSnapshot;
16
+ }
17
+ export type AgentTuiStatusLineFormatter = (context: AgentTuiStatusLineContext) => AgentTuiStatusRows;
18
+ /** Default rows use only model metadata and usage already durable in the snapshot. */
19
+ export declare const defaultAgentTuiStatusLine: AgentTuiStatusLineFormatter;
20
+ //# sourceMappingURL=status-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-line.d.ts","sourceRoot":"","sources":["../src/status-line.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EAEd,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,OAAO,GACP,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,CAAC;AAEb,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B;AAED,MAAM,MAAM,kBAAkB,GAAG,SAAS,CAAC,SAAS,qBAAqB,EAAE,CAAC,EAAE,CAAC;AAE/E,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,MAAM,2BAA2B,GAAG,CACxC,OAAO,EAAE,yBAAyB,KAC/B,kBAAkB,CAAC;AAiCxB,sFAAsF;AACtF,eAAO,MAAM,yBAAyB,EAAE,2BAsCvC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { AgentSnapshot } from 'stitchkit/agent-runtime';
2
+ export interface AgentTuiTranscriptEntry {
3
+ id: string;
4
+ role: 'you' | 'agent' | 'tool' | 'system';
5
+ text: string;
6
+ tone: 'primary' | 'muted' | 'success' | 'danger' | 'accent';
7
+ }
8
+ export declare function projectAgentTuiTranscript(snapshot: AgentSnapshot): readonly AgentTuiTranscriptEntry[];
9
+ //# sourceMappingURL=transcript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../src/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkC,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7F,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;CAC7D;AAkDD,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,aAAa,GACtB,SAAS,uBAAuB,EAAE,CAwBpC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "stitchkit-tui",
3
+ "version": "0.1.1",
4
+ "description": "Composable terminal UI for the Stitchkit headless agent runtime",
5
+ "license": "MIT",
6
+ "author": "Max Listov <maxlistov@gmail.com>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/max-listov/stitchkit.git",
10
+ "directory": "packages/tui"
11
+ },
12
+ "type": "module",
13
+ "bin": {
14
+ "stitchkit-agent": "./dist/cli.js"
15
+ },
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ },
23
+ "./core": {
24
+ "types": "./dist/core/index.d.ts",
25
+ "import": "./dist/core/index.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "README.md",
31
+ "LICENSE"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "scripts": {
37
+ "check": "bun x tsc --noEmit",
38
+ "test": "bun test",
39
+ "build": "rm -rf dist && bun build src/index.ts src/cli.ts src/core/index.ts --root src --outdir dist --target bun --packages external && bun x tsc -p tsconfig.build.json --emitDeclarationOnly && chmod +x dist/cli.js",
40
+ "prepublishOnly": "bun run check && bun run test && bun run build"
41
+ },
42
+ "dependencies": {
43
+ "@opentui/core": "^0.5.9",
44
+ "@opentui/react": "^0.5.9",
45
+ "ai": "^7.0.0",
46
+ "react": "^19.2.8",
47
+ "stitchkit": "^0.68.11",
48
+ "zod": "^4.4.3"
49
+ },
50
+ "devDependencies": {
51
+ "@types/bun": "^1.4.0",
52
+ "@types/react": "^19.2.18",
53
+ "typescript": "^7.0.2"
54
+ },
55
+ "engines": {
56
+ "bun": ">=1.3.0"
57
+ },
58
+ "packageManager": "bun@1.3.14"
59
+ }