@fishwithcat/dsh-tui-app 0.0.0-stage → 0.2.2-alpha.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/README.i18n.yaml +79 -0
- package/README.md +245 -2
- package/README.zh.md +246 -0
- package/cordis.patch.yml +67 -0
- package/lib/index.js +7021 -0
- package/lib/startup.js +54 -0
- package/lib/types/ansi.d.ts +109 -0
- package/lib/types/app.d.ts +480 -0
- package/lib/types/clipboard.d.ts +61 -0
- package/lib/types/commands.d.ts +101 -0
- package/lib/types/config.d.ts +35 -0
- package/lib/types/diagnostics.d.ts +23 -0
- package/lib/types/diff.d.ts +37 -0
- package/lib/types/images.d.ts +37 -0
- package/lib/types/index.d.ts +28 -0
- package/lib/types/interactions.d.ts +132 -0
- package/lib/types/measurement.d.ts +18 -0
- package/lib/types/session.d.ts +151 -0
- package/lib/types/shell.d.ts +111 -0
- package/lib/types/startup.d.ts +34 -0
- package/lib/types/subagents.d.ts +75 -0
- package/lib/types/tool-view.d.ts +39 -0
- package/lib/types/transcript.d.ts +216 -0
- package/lib/types/views.d.ts +572 -0
- package/lib/types/watch/client.d.ts +70 -0
- package/lib/types/watch/history.d.ts +25 -0
- package/lib/types/watch/protocol.d.ts +146 -0
- package/lib/types/watch/record.d.ts +50 -0
- package/lib/types/watch/server.d.ts +172 -0
- package/lib/types/watch/viewer.d.ts +128 -0
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +110 -4
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local `!` commands: one foreground shell execution whose streamed output is a
|
|
3
|
+
* transcript row. Nothing here reaches the model or the session log; the
|
|
4
|
+
* executor, sandbox policy, and output bounds belong to the mounted services.
|
|
5
|
+
* @module @deepseek-ai/dsh-tui-app/shell
|
|
6
|
+
*/
|
|
7
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
8
|
+
import type { Session } from '@deepseek-ai/dsh-session';
|
|
9
|
+
import type { ShellEntry, TerminalTranscript } from './transcript.ts';
|
|
10
|
+
/**
|
|
11
|
+
* Wall-clock bound requested for one local command. The executor clamps it to
|
|
12
|
+
* its own `maxTimeoutMs`, so this is a request rather than a promise.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SHELL_COMMAND_TIMEOUT_MS = 600000;
|
|
15
|
+
/** What {@link ShellRunner.submit} learned. */
|
|
16
|
+
export type ShellStart = {
|
|
17
|
+
readonly started: true;
|
|
18
|
+
} | {
|
|
19
|
+
readonly started: false;
|
|
20
|
+
readonly reason: string;
|
|
21
|
+
};
|
|
22
|
+
/** Everything the runner needs from the application. */
|
|
23
|
+
export interface ShellRunnerOptions {
|
|
24
|
+
/** Context carrying the shell executor, sandbox policy, and working directory. */
|
|
25
|
+
ctx: Context;
|
|
26
|
+
/** Transcript model the row is appended to. */
|
|
27
|
+
transcript: TerminalTranscript;
|
|
28
|
+
/** The live session whose sandbox policy applies. */
|
|
29
|
+
session: () => Session;
|
|
30
|
+
/** Directory the command starts in. */
|
|
31
|
+
cwd: () => string;
|
|
32
|
+
/** Repaint after a row changed. */
|
|
33
|
+
changed: () => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Run one `!` command at a time and stream it into a transcript row.
|
|
37
|
+
*
|
|
38
|
+
* The application refuses a second command while {@link running} is true, so
|
|
39
|
+
* this class owns no queue; it owns cancellation, streamed reads, and the
|
|
40
|
+
* settled facts the row shows.
|
|
41
|
+
*/
|
|
42
|
+
export declare class ShellRunner {
|
|
43
|
+
private readonly options;
|
|
44
|
+
private current;
|
|
45
|
+
/**
|
|
46
|
+
* @param options - context, transcript, session and directory accessors, and the repaint hook.
|
|
47
|
+
*/
|
|
48
|
+
constructor(options: ShellRunnerOptions);
|
|
49
|
+
/** Whether a command currently occupies the surface. */
|
|
50
|
+
get running(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Start one command.
|
|
53
|
+
*
|
|
54
|
+
* A refusal is returned rather than thrown so the caller can leave the
|
|
55
|
+
* composer untouched; the only refusals are composition faults, because the
|
|
56
|
+
* caller already owns the occupancy rules.
|
|
57
|
+
* @param command - the text after the leading `!`.
|
|
58
|
+
* @returns whether the row was appended, or why it was not.
|
|
59
|
+
*/
|
|
60
|
+
submit(command: string): ShellStart;
|
|
61
|
+
/**
|
|
62
|
+
* Stop the running command, keeping the output it already produced.
|
|
63
|
+
* @returns whether a command was running.
|
|
64
|
+
*/
|
|
65
|
+
cancel(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Stop the running command and wait for it to close; used when the session
|
|
68
|
+
* switches or the application exits, where the row cannot outlive the view.
|
|
69
|
+
*/
|
|
70
|
+
dispose(): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Poll one read into the row.
|
|
73
|
+
* @param state - the execution being folded.
|
|
74
|
+
* @param final - whether this is the last read before settlement.
|
|
75
|
+
*/
|
|
76
|
+
private poll;
|
|
77
|
+
/**
|
|
78
|
+
* Prepare one execution and follow it to settlement.
|
|
79
|
+
* @param prepared - the spawning promise returned by the executor.
|
|
80
|
+
* @param state - the row this execution belongs to.
|
|
81
|
+
*/
|
|
82
|
+
private start;
|
|
83
|
+
/**
|
|
84
|
+
* Write one settled outcome into the row and release the surface.
|
|
85
|
+
* @param state - the executed row.
|
|
86
|
+
* @param result - the executor's settled facts.
|
|
87
|
+
* @param timer - the poll timer started with this execution.
|
|
88
|
+
*/
|
|
89
|
+
private settle;
|
|
90
|
+
/**
|
|
91
|
+
* Write a preparation failure into the row and release the surface.
|
|
92
|
+
* @param state - the row that never ran.
|
|
93
|
+
* @param error - the rejection that ended preparation.
|
|
94
|
+
*/
|
|
95
|
+
private fail;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The right-aligned label of one shell row: whether it is local-only and which
|
|
99
|
+
* sandbox mode confined it.
|
|
100
|
+
* @param entry - the shell row.
|
|
101
|
+
* @returns the label text.
|
|
102
|
+
*/
|
|
103
|
+
export declare function shellLabel(entry: ShellEntry): string;
|
|
104
|
+
/**
|
|
105
|
+
* The closing line of one shell row: its state and, once settled, how long it
|
|
106
|
+
* took and how it ended.
|
|
107
|
+
* @param entry - the shell row.
|
|
108
|
+
* @returns the status text.
|
|
109
|
+
*/
|
|
110
|
+
export declare function shellStatusLine(entry: ShellEntry): string;
|
|
111
|
+
//# sourceMappingURL=shell.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The terminal app's command-line provider: it parses the `dsh --profile tui`
|
|
3
|
+
* flag family (`--resume`, `--provider`, `--model`, `--watch`) and its `--help` text, then
|
|
4
|
+
* publishes the values as {@link TUI_STARTUP_SERVICE}. The TUI row injects that
|
|
5
|
+
* service, so a help or usage invocation — which publishes nothing — mounts no
|
|
6
|
+
* terminal UI.
|
|
7
|
+
* @module @deepseek-ai/dsh-tui-app/startup
|
|
8
|
+
*/
|
|
9
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
10
|
+
/** Stable Cordis plugin name. */
|
|
11
|
+
export declare const name = "tui-startup";
|
|
12
|
+
/** Services required before the flags can be resolved. */
|
|
13
|
+
export declare const inject: string[];
|
|
14
|
+
/** Service provided by this plugin and injected by the TUI row. */
|
|
15
|
+
export declare const TUI_STARTUP_SERVICE = "tuiStartup";
|
|
16
|
+
/** What the TUI row reads from {@link TUI_STARTUP_SERVICE}. */
|
|
17
|
+
export interface TuiStartupValues {
|
|
18
|
+
/** Stored session id to resume, absent when this invocation starts a new session. */
|
|
19
|
+
resume?: string | undefined;
|
|
20
|
+
/** Provider route this session starts on, absent when the deployment default applies. */
|
|
21
|
+
provider?: string | undefined;
|
|
22
|
+
/** Model id this session starts on, absent when the deployment default applies. */
|
|
23
|
+
model?: string | undefined;
|
|
24
|
+
/** Stored child session id to view read-only, absent for an interactive session. */
|
|
25
|
+
watch?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse and publish the TUI invocation as an ordinary Cordis service. A partial
|
|
29
|
+
* route is a usage error, so on rejection (and on `--help`) nothing is provided
|
|
30
|
+
* and the TUI row stays pending.
|
|
31
|
+
* @param ctx - plugin context carrying the command line.
|
|
32
|
+
*/
|
|
33
|
+
export declare function apply(ctx: Context): void;
|
|
34
|
+
//# sourceMappingURL=startup.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pinned `/subagents` panel: one line per delegated child, read from the
|
|
3
|
+
* live session catalogs on every render and scrolled inside a fixed row budget.
|
|
4
|
+
* The panel never writes a transcript row, so the main Agent can keep streaming
|
|
5
|
+
* without moving it.
|
|
6
|
+
* @module @deepseek-ai/dsh-tui-app/subagents
|
|
7
|
+
*/
|
|
8
|
+
import type { Component, TuiMouseEvent, TuiMouseEventResult } from '@earendil-works/pi-tui';
|
|
9
|
+
import type { TuiTheme } from './ansi.ts';
|
|
10
|
+
import type { TuiSubagent } from './session.ts';
|
|
11
|
+
/**
|
|
12
|
+
* A scrollable list of the session's delegated children.
|
|
13
|
+
*
|
|
14
|
+
* The row provider runs on every render, so a child that starts or settles
|
|
15
|
+
* while the panel is open appears without reopening the command. The panel
|
|
16
|
+
* owns only its scroll position; the transcript underneath keeps following the
|
|
17
|
+
* Agent's output.
|
|
18
|
+
*/
|
|
19
|
+
export declare class SubagentPanel implements Component {
|
|
20
|
+
private readonly read;
|
|
21
|
+
private readonly failure;
|
|
22
|
+
private readonly capacity;
|
|
23
|
+
private readonly theme;
|
|
24
|
+
private readonly repaint;
|
|
25
|
+
/** Called when the user dismisses the panel with Enter or Ctrl+C. */
|
|
26
|
+
onClose?: () => void;
|
|
27
|
+
/** First row of the list currently shown. */
|
|
28
|
+
private offset;
|
|
29
|
+
/**
|
|
30
|
+
* @param read - cached children, read on every render and key event.
|
|
31
|
+
* @param failure - why the last descendant read failed, if it did.
|
|
32
|
+
* @param capacity - body rows the panel may draw, summary and scroll hint included.
|
|
33
|
+
* @param theme - the surface theme.
|
|
34
|
+
* @param repaint - requests a render after the panel scrolls itself.
|
|
35
|
+
*/
|
|
36
|
+
constructor(read: () => readonly TuiSubagent[], failure: () => string | undefined, capacity: number, theme: TuiTheme, repaint: () => void);
|
|
37
|
+
/**
|
|
38
|
+
* Close on Enter or Ctrl+C, scroll the list on the arrow and page keys, and
|
|
39
|
+
* leave every other key alone. Escape is the surrounding panel's skip.
|
|
40
|
+
* @param data - raw key bytes.
|
|
41
|
+
*/
|
|
42
|
+
handleInput(data: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Scroll the overflowing list with the wheel; leave the wheel to the
|
|
45
|
+
* transcript while every row fits.
|
|
46
|
+
* @param event - the normalized mouse event.
|
|
47
|
+
* @returns `handled` for a consumed wheel event, otherwise undefined.
|
|
48
|
+
*/
|
|
49
|
+
handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined;
|
|
50
|
+
/** The panel keeps no cached render state. */
|
|
51
|
+
invalidate(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Render the summary and the visible rows.
|
|
54
|
+
* @param width - the viewport width in columns.
|
|
55
|
+
* @returns the panel's rows, clipped to `width` by the surrounding panel.
|
|
56
|
+
*/
|
|
57
|
+
render(width: number): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Read the cached children, or none while the last read failure stands.
|
|
60
|
+
* @returns the children, or an empty list after a failure.
|
|
61
|
+
*/
|
|
62
|
+
private rows;
|
|
63
|
+
/** Rows one page of the scroll spends. */
|
|
64
|
+
private viewport;
|
|
65
|
+
/**
|
|
66
|
+
* Move the list by `delta` rows and request a repaint when the offset changes.
|
|
67
|
+
* @param delta - signed row delta.
|
|
68
|
+
*/
|
|
69
|
+
private move;
|
|
70
|
+
/** The header naming the running and total counts. */
|
|
71
|
+
private summary;
|
|
72
|
+
/** One child's row: state, label, mode, and the watch command. */
|
|
73
|
+
private row;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=subagents.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host tool-presentation bridge for the terminal surface: the Host consumer
|
|
3
|
+
* of `ToolDefinition.presentCall`/`presentResult` anticipated by the
|
|
4
|
+
* [decision](../../../../.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.md).
|
|
5
|
+
* The bridge resolves the acting scope's Tool definition and hands the declared
|
|
6
|
+
* call or result view to the transcript unchanged; the terminal renderer
|
|
7
|
+
* switches on the card tag and degrades to the surface's ordinary tool row when
|
|
8
|
+
* a Tool declares no view.
|
|
9
|
+
* @module @deepseek-ai/dsh-tui-app/tool-view
|
|
10
|
+
*/
|
|
11
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
12
|
+
import type { ToolCallView, ToolResult, ToolResultView } from '@deepseek-ai/dsh-tools';
|
|
13
|
+
/** Resolves the presentation view a Tool declared for one call and its settled result. */
|
|
14
|
+
export interface ToolPresentationResolver {
|
|
15
|
+
/**
|
|
16
|
+
* @param name - the Tool name as the model requested it.
|
|
17
|
+
* @param argsJson - the raw arguments JSON the model produced.
|
|
18
|
+
* @returns the pending call view, or undefined when the Tool declares none.
|
|
19
|
+
*/
|
|
20
|
+
call(name: string, argsJson: string): ToolCallView | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* @param name - the Tool name as the model requested it.
|
|
23
|
+
* @param argsJson - the raw arguments JSON the model produced.
|
|
24
|
+
* @param result - the settled result projection the durable event carries.
|
|
25
|
+
* @returns the completed result view, or undefined when the Tool declares none.
|
|
26
|
+
*/
|
|
27
|
+
result(name: string, argsJson: string, result: ToolResult): ToolResultView | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Build the resolver over the live Tool registry.
|
|
31
|
+
* @param ctx - the application context carrying the optional `tools` service.
|
|
32
|
+
* @param agent - reads the Agent whose scope owns the call; the registry resolves the
|
|
33
|
+
* definition the acting scope sees, so a scoped shadow renders as it executed.
|
|
34
|
+
* Returning undefined reads the deployment's global tool view, which is what a
|
|
35
|
+
* read-only viewer with no live Agent can present.
|
|
36
|
+
* @returns the resolver the transcript folds with.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createToolPresentationResolver(ctx: Context, agent: () => object | undefined): ToolPresentationResolver;
|
|
39
|
+
//# sourceMappingURL=tool-view.d.ts.map
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The transcript model: durable Session events and live Assistant stream frames
|
|
3
|
+
* folded into the ordered rows the terminal surface renders. The fold is pure
|
|
4
|
+
* with respect to I/O, so rendering tests drive it with recorded events instead
|
|
5
|
+
* of a terminal.
|
|
6
|
+
* @module @deepseek-ai/dsh-tui-app/transcript
|
|
7
|
+
*/
|
|
8
|
+
import type { AssistantStreamFrame } from '@deepseek-ai/dsh-agent';
|
|
9
|
+
import type { ContentBlock } from '@deepseek-ai/dsh-llm';
|
|
10
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
11
|
+
import type { ToolCallView, ToolResultView } from '@deepseek-ai/dsh-tools';
|
|
12
|
+
import type { ApprovalOutcome, ApprovalRequestId } from '@deepseek-ai/dsh-user-approval';
|
|
13
|
+
import type { ToolPresentationResolver } from './tool-view.ts';
|
|
14
|
+
/** A human prompt row. */
|
|
15
|
+
export interface UserEntry {
|
|
16
|
+
kind: 'user';
|
|
17
|
+
/** Row identity, stable for the life of the row. */
|
|
18
|
+
id: number;
|
|
19
|
+
/** The prompt text, without the composer markers of its images. */
|
|
20
|
+
text: string;
|
|
21
|
+
/** One label per attached image, in content order; empty for a text-only prompt. */
|
|
22
|
+
images: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
/** An assistant message row. */
|
|
25
|
+
export interface AssistantEntry {
|
|
26
|
+
kind: 'assistant';
|
|
27
|
+
/** Row identity; negative while the message is still streaming. */
|
|
28
|
+
id: number;
|
|
29
|
+
/** The assembled visible text. */
|
|
30
|
+
text: string;
|
|
31
|
+
/** Whether the turn was cancelled while this message streamed. */
|
|
32
|
+
interrupted: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Provider reasoning retained before its assistant message or attempt outcome. */
|
|
35
|
+
export interface ReasoningEntry {
|
|
36
|
+
kind: 'reasoning';
|
|
37
|
+
/** Row identity; negative while the reasoning is still streaming. */
|
|
38
|
+
id: number;
|
|
39
|
+
/** The reasoning text streamed so far. */
|
|
40
|
+
text: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* One Tool call and its settled outcome. The fold replaces this row when the
|
|
44
|
+
* result settles rather than mutating it, so durable rows keep one identity.
|
|
45
|
+
*/
|
|
46
|
+
export interface ToolEntry {
|
|
47
|
+
kind: 'tool';
|
|
48
|
+
/** Row identity, stable for the life of the row. */
|
|
49
|
+
id: number;
|
|
50
|
+
/** Correlating call id. */
|
|
51
|
+
callId: string;
|
|
52
|
+
/** Registered Tool name. */
|
|
53
|
+
name: string;
|
|
54
|
+
/** Raw arguments JSON as the model produced it. */
|
|
55
|
+
args: string;
|
|
56
|
+
/** Whether the call is still running or has settled. */
|
|
57
|
+
status: 'running' | 'ok' | 'error';
|
|
58
|
+
/** Visible result text, or empty while running. */
|
|
59
|
+
result: string;
|
|
60
|
+
/** Failure identity when the Tool reported an error. */
|
|
61
|
+
error?: string;
|
|
62
|
+
/** The presentation view the Tool declared for its call, when it declared one. */
|
|
63
|
+
callView?: ToolCallView | undefined;
|
|
64
|
+
/** The presentation view the Tool declared for its settled result; absent keeps the call view. */
|
|
65
|
+
resultView?: ToolResultView | undefined;
|
|
66
|
+
}
|
|
67
|
+
/** An app-level account that belongs to no message: injected context, turn outcomes, discarded attempts. */
|
|
68
|
+
export interface NoticeEntry {
|
|
69
|
+
kind: 'notice';
|
|
70
|
+
/** Row identity, stable for the life of the row. */
|
|
71
|
+
id: number;
|
|
72
|
+
/** Whether the row reads as a failure. */
|
|
73
|
+
level: 'info' | 'error';
|
|
74
|
+
/** One-line account of what happened. */
|
|
75
|
+
text: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One local `!` shell command and its streamed output. The row belongs to this
|
|
79
|
+
* process only: it never enters the session log, so a new or resumed session
|
|
80
|
+
* drops it, and nothing in it reaches a model request.
|
|
81
|
+
*/
|
|
82
|
+
export interface ShellEntry {
|
|
83
|
+
kind: 'shell';
|
|
84
|
+
/** Row identity, stable while the row updates in place. */
|
|
85
|
+
id: number;
|
|
86
|
+
/** The command text the user typed after `!`. */
|
|
87
|
+
command: string;
|
|
88
|
+
/** Whether the command still runs or how it settled. */
|
|
89
|
+
status: 'running' | 'ok' | 'error' | 'cancelled' | 'timedout';
|
|
90
|
+
/** Combined stdout and stderr streamed so far. */
|
|
91
|
+
output: string;
|
|
92
|
+
/** Sandbox mode the command ran under; absent when the executor does not confine. */
|
|
93
|
+
mode?: string | undefined;
|
|
94
|
+
/** Process exit code; absent while running and while a signal ended it. */
|
|
95
|
+
exitCode?: number | null | undefined;
|
|
96
|
+
/** Terminating signal, when a signal ended the command. */
|
|
97
|
+
signal?: string | undefined;
|
|
98
|
+
/** Wall-clock time from submission to settlement; absent while running. */
|
|
99
|
+
durationMs?: number | undefined;
|
|
100
|
+
/** Bound the executor applied, read by the timeout status line. */
|
|
101
|
+
timeoutMs?: number | undefined;
|
|
102
|
+
/** True when the executor dropped output the row cannot show. */
|
|
103
|
+
lossy?: boolean | undefined;
|
|
104
|
+
/** Spill file holding the complete output, when truncation produced one. */
|
|
105
|
+
spillPath?: string | undefined;
|
|
106
|
+
/** True when the sandbox denied a file operation the command attempted. */
|
|
107
|
+
sandboxDenied?: boolean | undefined;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* One approval request and its settled outcome, folded from the durable audit
|
|
111
|
+
* pair. The decision replaces the pending row in place so the request keeps one
|
|
112
|
+
* identity on screen.
|
|
113
|
+
*/
|
|
114
|
+
export interface ApprovalEntry {
|
|
115
|
+
kind: 'approval';
|
|
116
|
+
/** Row identity, stable across the decision. */
|
|
117
|
+
id: number;
|
|
118
|
+
/** Request identity pairing the ask with its decision. */
|
|
119
|
+
requestId: ApprovalRequestId;
|
|
120
|
+
/** Tool the decision is about. */
|
|
121
|
+
toolName: string;
|
|
122
|
+
/** The asker's explanation, when it supplied one. */
|
|
123
|
+
reason?: string;
|
|
124
|
+
/** Settled outcome; absent while the request is still waiting. */
|
|
125
|
+
outcome?: ApprovalOutcome;
|
|
126
|
+
/** The allowed outcome is covered by a remembered grant for this tool. */
|
|
127
|
+
remembered?: true;
|
|
128
|
+
}
|
|
129
|
+
/** One rendered row of the transcript. */
|
|
130
|
+
export type TranscriptEntry = UserEntry | AssistantEntry | ReasoningEntry | ToolEntry | NoticeEntry | ShellEntry | ApprovalEntry;
|
|
131
|
+
/**
|
|
132
|
+
* Join the visible text of a content block list, ignoring non-text blocks.
|
|
133
|
+
* @param blocks - message or tool-result content.
|
|
134
|
+
* @returns the concatenated text blocks.
|
|
135
|
+
*/
|
|
136
|
+
export declare function textOfBlocks(blocks: readonly ContentBlock[]): string;
|
|
137
|
+
/**
|
|
138
|
+
* The ordered transcript of one Agent session. Durable rows come from the
|
|
139
|
+
* session log; live rows come from `agent/assistant-stream` and are replaced by
|
|
140
|
+
* their durable settlement.
|
|
141
|
+
*/
|
|
142
|
+
export declare class TerminalTranscript {
|
|
143
|
+
private readonly views?;
|
|
144
|
+
private rows;
|
|
145
|
+
private readonly toolByCallId;
|
|
146
|
+
private readonly approvalById;
|
|
147
|
+
private nextId;
|
|
148
|
+
private liveText;
|
|
149
|
+
private liveReasoning;
|
|
150
|
+
private attempt;
|
|
151
|
+
private changeCount;
|
|
152
|
+
/**
|
|
153
|
+
* @param views - resolves the diff card a Tool declared for its call and result;
|
|
154
|
+
* absent keeps every Tool row in its raw name-and-summary form.
|
|
155
|
+
*/
|
|
156
|
+
constructor(views?: ToolPresentationResolver | undefined);
|
|
157
|
+
/** Monotone change counter; a view compares it to decide whether to rebuild. */
|
|
158
|
+
get revision(): number;
|
|
159
|
+
/** Whether an Assistant attempt is currently streaming. */
|
|
160
|
+
get streaming(): boolean;
|
|
161
|
+
/**
|
|
162
|
+
* The rows to render, in order: durable rows followed by the live attempt.
|
|
163
|
+
* @returns the current transcript.
|
|
164
|
+
*/
|
|
165
|
+
entries(): readonly TranscriptEntry[];
|
|
166
|
+
/** Drop every row, for a new or resumed session. */
|
|
167
|
+
reset(): void;
|
|
168
|
+
/**
|
|
169
|
+
* Fold one durable Session event into the transcript.
|
|
170
|
+
* @param event - the appended event.
|
|
171
|
+
* @returns whether the visible transcript changed.
|
|
172
|
+
*/
|
|
173
|
+
applyEvent(event: SessionEvent): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Fold one live Assistant stream frame into the transcript.
|
|
176
|
+
* @param frame - the published frame.
|
|
177
|
+
* @returns whether the visible transcript changed.
|
|
178
|
+
*/
|
|
179
|
+
applyFrame(frame: AssistantStreamFrame): boolean;
|
|
180
|
+
private applyChunk;
|
|
181
|
+
private applyUserMessage;
|
|
182
|
+
private applyAssistantMessage;
|
|
183
|
+
private applyAttempt;
|
|
184
|
+
private appendReasoning;
|
|
185
|
+
private applyToolCall;
|
|
186
|
+
private applyToolResult;
|
|
187
|
+
private applyApprovalAsked;
|
|
188
|
+
private applyApprovalDecided;
|
|
189
|
+
private applyTurnEnd;
|
|
190
|
+
/**
|
|
191
|
+
* Append an app-level notice row.
|
|
192
|
+
* @param level - whether the row reads as a failure.
|
|
193
|
+
* @param text - the one-line account.
|
|
194
|
+
* @returns always true, since a row was appended.
|
|
195
|
+
*/
|
|
196
|
+
notice(level: NoticeEntry['level'], text: string): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Append one local shell row in its running state.
|
|
199
|
+
* @param command - the command text after `!`.
|
|
200
|
+
* @param mode - the sandbox mode the executor will apply, when it confines.
|
|
201
|
+
* @returns the row identity later updates address.
|
|
202
|
+
*/
|
|
203
|
+
appendShell(command: string, mode: string | undefined): number;
|
|
204
|
+
/**
|
|
205
|
+
* Replace one shell row with its next state.
|
|
206
|
+
*
|
|
207
|
+
* The fold replaces the row object instead of mutating it: the view caches a
|
|
208
|
+
* row's rendered lines against that object, so a fresh object is what makes
|
|
209
|
+
* streamed output repaint.
|
|
210
|
+
* @param id - the row appended by {@link appendShell}.
|
|
211
|
+
* @param patch - fields to replace; omitted fields keep their current value.
|
|
212
|
+
*/
|
|
213
|
+
updateShell(id: number, patch: Partial<Omit<ShellEntry, 'kind' | 'id'>>): void;
|
|
214
|
+
private changed;
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=transcript.d.ts.map
|