acryl 0.1.13 → 0.1.15
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/lib/bin.js +451 -7
- package/lib/bin.js.map +1 -1
- package/lib/index.js +382 -6
- package/lib/index.js.map +1 -1
- package/package.json +1 -3
- package/lib/types/bin.d.ts +0 -4
- package/lib/types/cli/grammar.d.ts +0 -10
- package/lib/types/cli/node-launcher.d.ts +0 -9
- package/lib/types/cli/run.d.ts +0 -32
- package/lib/types/host/direct.d.ts +0 -18
- package/lib/types/index.d.ts +0 -3
- package/lib/types/markdown.d.ts +0 -28
- package/lib/types/render.d.ts +0 -78
- package/lib/types/sessionId.d.ts +0 -12
- package/lib/types/tui/CustomEditor.d.ts +0 -51
- package/lib/types/tui/Spinner.d.ts +0 -18
- package/lib/types/tui/TuiApp.d.ts +0 -64
- package/lib/types/tui/actions.d.ts +0 -85
- package/lib/types/tui/agentPresets/AgentPresetsOverlay.d.ts +0 -19
- package/lib/types/tui/agentPresets/types.d.ts +0 -18
- package/lib/types/tui/bannerText.d.ts +0 -19
- package/lib/types/tui/commands.d.ts +0 -54
- package/lib/types/tui/context/ContextOverlay.d.ts +0 -17
- package/lib/types/tui/fileIndex.d.ts +0 -17
- package/lib/types/tui/fileMention.d.ts +0 -31
- package/lib/types/tui/interaction/ApprovalOverlay.d.ts +0 -18
- package/lib/types/tui/interaction/QuestionOverlay.d.ts +0 -26
- package/lib/types/tui/interaction/types.d.ts +0 -36
- package/lib/types/tui/liveText.d.ts +0 -60
- package/lib/types/tui/logoArt.generated.d.ts +0 -9
- package/lib/types/tui/miniTextField.d.ts +0 -20
- package/lib/types/tui/modelProfile/ModelProfileOverlay.d.ts +0 -48
- package/lib/types/tui/modelProfile/types.d.ts +0 -63
- package/lib/types/tui/piTheme.d.ts +0 -10
- package/lib/types/tui/plugins/PluginsOverlay.d.ts +0 -22
- package/lib/types/tui/plugins/types.d.ts +0 -18
- package/lib/types/tui/promptAutocomplete.d.ts +0 -29
- package/lib/types/tui/statsFormat.d.ts +0 -89
- package/lib/types/tui/store.d.ts +0 -246
- package/lib/types/tui/text.d.ts +0 -21
- package/lib/types/tui/theme.d.ts +0 -35
- package/lib/types/tui/toolCards/ToolCardsOverlay.d.ts +0 -33
- package/lib/types/tui/trajectory/TrajectoryDetail.d.ts +0 -13
- package/lib/types/tui/trajectory/TrajectoryLedger.d.ts +0 -9
- package/lib/types/tui/trajectory/TrajectoryOverlay.d.ts +0 -39
- package/lib/types/tui/trajectory/detail.d.ts +0 -10
- package/lib/types/tui/trajectory/layout.d.ts +0 -16
- package/lib/types/tui/trajectory/types.d.ts +0 -74
- package/lib/types/tui-app/session.d.ts +0 -21
- package/lib/types/version.d.ts +0 -2
- package/lib/types/yly/yly-frames.generated.d.ts +0 -18
- package/lib/types/yly/yly-pet.d.ts +0 -46
- package/lib/types/yly/yly-programs.d.ts +0 -41
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "acryl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "ACRYL local-first coding-agent workspace CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -384,7 +384,6 @@
|
|
|
384
384
|
"mime-types": "3.0.2",
|
|
385
385
|
"negotiator": "1.1.0",
|
|
386
386
|
"adm-zip": "0.6.0",
|
|
387
|
-
"dshmarket": "1.17.1",
|
|
388
387
|
"pnpm": "11.7.0",
|
|
389
388
|
"semver": "7.8.5",
|
|
390
389
|
"agent-base": "7.1.4",
|
|
@@ -435,7 +434,6 @@
|
|
|
435
434
|
"dequal": "2.0.3",
|
|
436
435
|
"detect-libc": "2.1.2",
|
|
437
436
|
"devlop": "1.1.0",
|
|
438
|
-
"undici": "7.29.0",
|
|
439
437
|
"dunder-proto": "1.0.1",
|
|
440
438
|
"gopd": "1.2.0",
|
|
441
439
|
"ecdsa-sig-formatter": "1.0.11",
|
package/lib/types/bin.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type AcrylHostCommand = 'tui' | 'gui' | 'web';
|
|
2
|
-
export interface AcrylInvocation {
|
|
3
|
-
readonly command: AcrylHostCommand;
|
|
4
|
-
readonly json: boolean;
|
|
5
|
-
readonly version: boolean;
|
|
6
|
-
readonly help: boolean;
|
|
7
|
-
readonly profile?: string;
|
|
8
|
-
readonly resumeSessionId?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function parseAcrylArgs(args: readonly string[]): AcrylInvocation;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface ExposedInternalsLaunchInput {
|
|
2
|
-
readonly execArgv: readonly string[];
|
|
3
|
-
readonly script: string;
|
|
4
|
-
readonly args: readonly string[];
|
|
5
|
-
}
|
|
6
|
-
/** Return the child Node invocation required to expose Cordis HMR internals. */
|
|
7
|
-
export declare function exposedInternalsInvocation(input: ExposedInternalsLaunchInput): readonly string[] | undefined;
|
|
8
|
-
/** Re-execute this CLI under Node with the Cordis HMR prerequisite enabled. */
|
|
9
|
-
export declare function relaunchWithExposedInternals(input: ExposedInternalsLaunchInput): Promise<boolean>;
|
package/lib/types/cli/run.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
interface RunningDirectHost {
|
|
2
|
-
readonly runtimeState: 'ready' | 'unavailable';
|
|
3
|
-
readonly profile: string;
|
|
4
|
-
readonly generationId: string;
|
|
5
|
-
dispose(): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export interface AcrylWebResult {
|
|
8
|
-
readonly url: string;
|
|
9
|
-
}
|
|
10
|
-
export interface AcrylCliDependencies {
|
|
11
|
-
readonly startDirectHost: (options: {
|
|
12
|
-
profile: string;
|
|
13
|
-
}) => Promise<RunningDirectHost>;
|
|
14
|
-
readonly runTui: (options: {
|
|
15
|
-
profile: string;
|
|
16
|
-
resumeSessionId?: string;
|
|
17
|
-
}) => Promise<{
|
|
18
|
-
resumeHint: string;
|
|
19
|
-
}>;
|
|
20
|
-
readonly runWeb: (options: {
|
|
21
|
-
profile: string;
|
|
22
|
-
}) => Promise<AcrylWebResult>;
|
|
23
|
-
readonly exit: (code: number) => void;
|
|
24
|
-
readonly write: (line: string) => void;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Run the direct ACRYL terminal host. `--json` is a short-lived, scriptable
|
|
28
|
-
* headless readiness probe; interactive mode mounts the pi-tui session via the
|
|
29
|
-
* runtime bridge until a normal exit, then prints a resumable session id.
|
|
30
|
-
*/
|
|
31
|
-
export declare function runAcryl(args: readonly string[], supplied?: Partial<AcrylCliDependencies>): Promise<void>;
|
|
32
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** Start one normal local Harness runtime for this terminal surface. */
|
|
2
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
-
export interface StartDirectHostOptions {
|
|
4
|
-
readonly profile: string;
|
|
5
|
-
readonly generationId?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface DirectHost {
|
|
8
|
-
readonly ctx: Context;
|
|
9
|
-
readonly runtimeState: 'ready' | 'unavailable';
|
|
10
|
-
readonly profile: string;
|
|
11
|
-
readonly generationId: string;
|
|
12
|
-
dispose(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A local surface owns its normal DSH/Cordis root. Durable DSH sessions, not
|
|
16
|
-
* `.acryl/control` experiments, provide continuity across later launches.
|
|
17
|
-
*/
|
|
18
|
-
export declare function startDirectHost(options: StartDirectHostOptions): Promise<DirectHost>;
|
package/lib/types/index.d.ts
DELETED
package/lib/types/markdown.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal Markdown rendering for assistant text. `render.ts` prints
|
|
3
|
-
* assistant/tool output straight to native scrollback via raw ANSI, so this
|
|
4
|
-
* module detects whether a text blob is (at least partly) Markdown before
|
|
5
|
-
* paying the cost of styling it — plain prose keeps rendering exactly as it
|
|
6
|
-
* always has, only text carrying real Markdown syntax gets headers, bold,
|
|
7
|
-
* lists, code spans, tables, etc. converted to ANSI.
|
|
8
|
-
* @module @tomowang/dsh-tui/markdown
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Heuristically decides whether `text` carries Markdown markup worth
|
|
12
|
-
* rendering, as opposed to plain prose that happens to contain a stray `*`
|
|
13
|
-
* or `_`. Block-level syntax (fenced code, headers, rules, quotes, lists,
|
|
14
|
-
* table rows) and unambiguous inline syntax (links, bold, strikethrough,
|
|
15
|
-
* inline code) each single-handedly qualify. Lone single-`*`/`_` emphasis is
|
|
16
|
-
* deliberately excluded: it is the highest false-positive-risk cue (globs,
|
|
17
|
-
* multiplication, snake_case, `*args`) and easy to get wrong on its own, so
|
|
18
|
-
* it only ever renders as emphasis when some other signal already confirmed
|
|
19
|
-
* the text is Markdown.
|
|
20
|
-
*/
|
|
21
|
-
export declare function looksLikeMarkdown(text: string): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Render Markdown source to ANSI-styled terminal text: headers, fenced/
|
|
24
|
-
* inline code, block quotes, ordered/unordered lists, rules, tables, links,
|
|
25
|
-
* bold, strikethrough, and emphasis. Text that `looksLikeMarkdown` rejects
|
|
26
|
-
* passes through byte-for-byte unchanged.
|
|
27
|
-
*/
|
|
28
|
-
export declare function renderMarkdown(text: string): string;
|
package/lib/types/render.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal projection of durable session events. The TUI renders only from the
|
|
3
|
-
* append-only session log, so a resumed session replays through the exact same
|
|
4
|
-
* code path as live events.
|
|
5
|
-
* @module @tomowang/dsh-tui/render
|
|
6
|
-
*/
|
|
7
|
-
import type { CallId, ContentBlock } from '@deepseek-ai/dsh-llm';
|
|
8
|
-
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
9
|
-
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
10
|
-
/** Rendering context: replay walks history already in the log. */
|
|
11
|
-
export interface RenderOptions {
|
|
12
|
-
/** True while replaying persisted events on startup. */
|
|
13
|
-
replay: boolean;
|
|
14
|
-
/** Look up a tool's declared presentation by name; absent outside the live TUI (e.g. tests). */
|
|
15
|
-
getTool?: (name: string) => ToolDefinition | undefined;
|
|
16
|
-
/** Look up a `tool/call`'s name/arguments by `callId`, for a later `tool/result` to present with. */
|
|
17
|
-
getToolCall?: (callId: CallId) => {
|
|
18
|
-
name: string;
|
|
19
|
-
arguments: string;
|
|
20
|
-
} | undefined;
|
|
21
|
-
}
|
|
22
|
-
/** Clamp one-line summaries so tool arguments cannot flood the transcript. */
|
|
23
|
-
export declare function truncate(text: string, max: number): string;
|
|
24
|
-
/** Join the text blocks of a message content array. */
|
|
25
|
-
export declare function textOf(content: readonly ContentBlock[]): string;
|
|
26
|
-
/** Join the reasoning/thinking blocks of a message content array, distinct from its visible `textOf`. */
|
|
27
|
-
export declare function reasoningOf(content: readonly ContentBlock[]): string;
|
|
28
|
-
/**
|
|
29
|
-
* Format one settled step's text (and, ahead of it, a one-line reasoning
|
|
30
|
-
* summary when the step had any), for the permanent transcript.
|
|
31
|
-
*/
|
|
32
|
-
export declare function formatSettledMessage(text: string, reasoningText: string): string | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* Format the in-progress step's live region: while reasoning has started but
|
|
35
|
-
* no visible text has arrived yet, an animated `spinnerChar thinking` line
|
|
36
|
-
* stands in for the raw, fast-scrolling reasoning body (its settled one-line
|
|
37
|
-
* `✦ think · …` summary appears in the transcript once the step lands —
|
|
38
|
-
* see `formatSettledMessage`); once text starts streaming, that text is
|
|
39
|
-
* shown directly.
|
|
40
|
-
*/
|
|
41
|
-
export declare function formatStreamingText(text: string, reasoningText?: string, spinnerChar?: string): string | undefined;
|
|
42
|
-
/** Format one settled local shell-escape run (`!` prompt-mode) for the permanent transcript, mirroring a `terminal` tool card. */
|
|
43
|
-
export declare function formatShellRun(command: string, output: string, exitCode: number | null): string;
|
|
44
|
-
/** Format the in-progress shell-escape run's accumulated output for the live region, mirroring `formatStreamingText`'s settle-without-jump framing. */
|
|
45
|
-
export declare function formatShellRunLive(command: string, output: string): string;
|
|
46
|
-
/**
|
|
47
|
-
* Format every tool call that's been sent but has no `tool/result` yet, for
|
|
48
|
-
* the live region: one line per call, the shared spinner frame standing in
|
|
49
|
-
* for the settled ✓/✖ icon it'll collapse to once its result lands and it
|
|
50
|
-
* becomes a single transcript line (see `formatToolCardSummary`).
|
|
51
|
-
*/
|
|
52
|
-
export declare function formatPendingToolCalls(calls: readonly {
|
|
53
|
-
name: string;
|
|
54
|
-
arguments: string;
|
|
55
|
-
}[], spinnerChar: string, getTool: RenderOptions['getTool']): string;
|
|
56
|
-
/**
|
|
57
|
-
* Format one durable session event as a terminal line, or `undefined` for
|
|
58
|
-
* events this viewer does not present. Unknown event types are silently
|
|
59
|
-
* skipped: the log's vocabulary is merge-extensible and a transcript viewer
|
|
60
|
-
* must tolerate events from plugins it does not know.
|
|
61
|
-
* @param event - the durable session event to project.
|
|
62
|
-
* @param options - replay/live rendering context, plus optional tool-presentation resolvers.
|
|
63
|
-
*/
|
|
64
|
-
export declare function formatEvent(event: SessionEvent, options: RenderOptions): string | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* A `tool/call`/`tool/result` event's one-line summary — the Tool Cards
|
|
67
|
-
* overlay's collapsed row. Distinct from `formatEvent`'s own card rendering
|
|
68
|
-
* (which can be multi-line even at its most compact), because the overlay
|
|
69
|
-
* needs a genuine single line to toggle open from.
|
|
70
|
-
*/
|
|
71
|
-
export declare function formatToolCardSummary(event: SessionEvent, options: RenderOptions): string;
|
|
72
|
-
/**
|
|
73
|
-
* Full, uncapped presentation lines for a `tool/call`/`tool/result` event.
|
|
74
|
-
* Unlike `formatEvent`, this never truncates or omits — the Tool Cards
|
|
75
|
-
* overlay scrolls its own window over the result instead of relying on a
|
|
76
|
-
* fixed line cap, so it needs the complete card body to scroll through.
|
|
77
|
-
*/
|
|
78
|
-
export declare function formatToolCardDetail(event: SessionEvent, options: RenderOptions): string[];
|
package/lib/types/sessionId.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session id prefix helpers shared between id generation/resolution
|
|
3
|
-
* (`src/index.ts`) and display (`src/tui/StatusBar.tsx`). `session-` is the
|
|
4
|
-
* de facto convention for top-level interactive sessions across the harness
|
|
5
|
-
* (web portal, headless bundle), so ids keep the prefix on disk; only
|
|
6
|
-
* user-facing text strips it.
|
|
7
|
-
* @module @tomowang/dsh-tui/sessionId
|
|
8
|
-
*/
|
|
9
|
-
/** Strip the `session-` prefix for display, if present. */
|
|
10
|
-
export declare function stripSessionIdPrefix(id: string): string;
|
|
11
|
-
/** Add the `session-` prefix back, if missing, so a stripped id can round-trip through `--resume`. */
|
|
12
|
-
export declare function ensureSessionIdPrefix(id: string): string;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The reader's line of input. Subclasses pi-tui's `Editor` rather than
|
|
3
|
-
* re-implementing readline-style editing: multi-line motion, kill-ring word
|
|
4
|
-
* ops, undo, and history recall are all already Editor defaults (see
|
|
5
|
-
* `TUI_KEYBINDINGS` in the pi-tui package — its defaults already match this
|
|
6
|
-
* app's old hand-rolled bindings almost 1:1: Ctrl+B/F, Ctrl+A/E, Alt+Left/
|
|
7
|
-
* Right, Ctrl+W, Alt+D, Ctrl+K/U all come for free). What's genuinely new
|
|
8
|
-
* here, layered on top via `handleInput`/`render` overrides, mirrors the
|
|
9
|
-
* pieces the old `PromptInput.tsx` had to hand-roll because Ink had no
|
|
10
|
-
* equivalent: `Ctrl+O` (Tool Cards toggle), shell mode (a leading `!` on an
|
|
11
|
-
* empty buffer swaps Enter to run a local command), `Shift+Tab` (permission
|
|
12
|
-
* preset cycle), and the two-press Ctrl+C/Ctrl+D exit-arm sequence — all
|
|
13
|
-
* short-circuited before `super.handleInput` so Editor's own bindings never
|
|
14
|
-
* see them. Slash-command and `@`-mention completion are *not* hand-rolled
|
|
15
|
-
* here at all: they're a `PromptAutocompleteProvider` (see
|
|
16
|
-
* `promptAutocomplete.ts`) wired via `setAutocompleteProvider`, and Editor
|
|
17
|
-
* renders and drives that dropdown itself.
|
|
18
|
-
* @module @tomowang/dsh-tui/tui/CustomEditor
|
|
19
|
-
*/
|
|
20
|
-
import type { AgentStatus } from '@deepseek-ai/dsh-agent';
|
|
21
|
-
import { Editor, type TUI } from '@earendil-works/pi-tui';
|
|
22
|
-
import type { TuiActions } from './actions.js';
|
|
23
|
-
import { type GetFileCandidates } from './promptAutocomplete.js';
|
|
24
|
-
export interface CustomEditorDeps {
|
|
25
|
-
readonly getStatus: () => AgentStatus;
|
|
26
|
-
/** Submitted-line history for up/down-arrow recall; owned outside the component tree so it survives `/clear`. */
|
|
27
|
-
readonly history: string[];
|
|
28
|
-
readonly getFileCandidates: GetFileCandidates;
|
|
29
|
-
}
|
|
30
|
-
export declare class CustomEditor extends Editor {
|
|
31
|
-
private readonly actions;
|
|
32
|
-
private readonly deps;
|
|
33
|
-
private shellMode;
|
|
34
|
-
private armedKey;
|
|
35
|
-
private armTimer;
|
|
36
|
-
constructor(tui: TUI, actions: TuiActions, deps: CustomEditorDeps);
|
|
37
|
-
private armOrConfirmExit;
|
|
38
|
-
private clearArm;
|
|
39
|
-
private setShellMode;
|
|
40
|
-
private handleSubmit;
|
|
41
|
-
handleInput(data: string): void;
|
|
42
|
-
render(width: number): string[];
|
|
43
|
-
/**
|
|
44
|
-
* Splices a `'› '`/`'! '` prompt marker into the editor box's first
|
|
45
|
-
* content row (index 1 — index 0 is always the top border), replacing
|
|
46
|
-
* that row's leading `paddingX` spaces. Skipped below `paddingX: 2`'s
|
|
47
|
-
* width-clamped floor (mirrors `Editor.render`'s own `maxPadding` clamp)
|
|
48
|
-
* rather than risk eating actual text in a pathologically narrow terminal.
|
|
49
|
-
*/
|
|
50
|
-
private withPromptPrefix;
|
|
51
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Braille frame-cycling spinner, embedded inline in the status bar text.
|
|
3
|
-
* The only component with genuine self-driven animation state independent
|
|
4
|
-
* of `TuiStore` — mirrors pi-tui's own `Loader` component's pattern (owns
|
|
5
|
-
* its `tui` reference, drives its own timer, calls `requestRender()` itself)
|
|
6
|
-
* rather than relying on a React re-render loop that no longer exists.
|
|
7
|
-
* @module @tomowang/dsh-tui/tui/Spinner
|
|
8
|
-
*/
|
|
9
|
-
import type { TUI } from '@earendil-works/pi-tui';
|
|
10
|
-
export declare class Spinner {
|
|
11
|
-
private readonly tui;
|
|
12
|
-
private frame;
|
|
13
|
-
private timer;
|
|
14
|
-
constructor(tui: TUI);
|
|
15
|
-
current(): string;
|
|
16
|
-
start(): void;
|
|
17
|
-
stop(): void;
|
|
18
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Root orchestrator: builds the pi-tui component tree once, then patches it
|
|
3
|
-
* imperatively from `TuiStore` change notifications — the pi-tui equivalent
|
|
4
|
-
* of `App.tsx` (root component) + `mount.tsx` (the `render()` call site)
|
|
5
|
-
* combined, since pi-tui has no JSX/reconciler to split those across.
|
|
6
|
-
*
|
|
7
|
-
* Two different update strategies are used, deliberately:
|
|
8
|
-
*
|
|
9
|
-
* - The live region (notice, queued preview, streaming text, status bar,
|
|
10
|
-
* stats line, permission indicator, update hint) is a `DynamicText`/`Spinner` per row,
|
|
11
|
-
* each pulling straight from `store.getSnapshot()` at render time. There is
|
|
12
|
-
* no manual `setText` bookkeeping to keep in sync — every repaint just
|
|
13
|
-
* reflects whatever the store currently holds. The approve/reject panel
|
|
14
|
-
* (`ApprovalSlot`) is a live-region row too, but an interactive one: it
|
|
15
|
-
* delegates render/input to whichever `ApprovalOverlay` is currently
|
|
16
|
-
* active and takes focus while one is, rather than covering the screen.
|
|
17
|
-
* - The transcript is append-only: `appendNewTranscriptItems` diffs the
|
|
18
|
-
* store's `events`/`shellHistory` arrays against how much has already been
|
|
19
|
-
* turned into a `createTranscriptLine` child of `documentContainer`,
|
|
20
|
-
* appending only the new tail. Re-formatting the whole transcript on every
|
|
21
|
-
* store change would be wasteful for a long session — `ScrollView`'s own
|
|
22
|
-
* viewport culling (confirmed in pi-tui's own test suite: painting a huge
|
|
23
|
-
* scroll child is O(viewport), not O(content)) is what makes this safe to
|
|
24
|
-
* grow without bound.
|
|
25
|
-
*
|
|
26
|
-
* Overlays (`/model`, `/trajectory`, Ctrl+O tool cards, `/context`,
|
|
27
|
-
* `/plugins`, `/presets`, question) are `tui.showOverlay(...)` calls keyed
|
|
28
|
-
* off `store.getSnapshot().overlay.kind` — see `updateOverlay`. Approval is
|
|
29
|
-
* the one exception: it renders inline in the dock instead (see above).
|
|
30
|
-
* @module @tomowang/dsh-tui/tui/TuiApp
|
|
31
|
-
*/
|
|
32
|
-
import type { RenderOptions } from '../render.js';
|
|
33
|
-
import type { TuiActions } from './actions.js';
|
|
34
|
-
import type { TuiStore } from './store.js';
|
|
35
|
-
export interface MountOptions {
|
|
36
|
-
readonly store: TuiStore;
|
|
37
|
-
readonly actions: TuiActions;
|
|
38
|
-
readonly sessionId: string;
|
|
39
|
-
readonly provider: string;
|
|
40
|
-
readonly model: string;
|
|
41
|
-
readonly version: string;
|
|
42
|
-
readonly cwd: string;
|
|
43
|
-
/** Submitted-line history for the prompt's up/down-arrow recall; owned outside this tree so `/clear` can preserve it. */
|
|
44
|
-
readonly promptHistory: string[];
|
|
45
|
-
/** Look up a tool's declared presentation, for `tool/call`/`tool/result` cards. */
|
|
46
|
-
readonly getTool: RenderOptions['getTool'];
|
|
47
|
-
/** Look up a `tool/call`'s name/arguments by `callId`, for a `tool/result` to present with. */
|
|
48
|
-
readonly getToolCall: RenderOptions['getToolCall'];
|
|
49
|
-
}
|
|
50
|
-
export interface TuiHandle {
|
|
51
|
-
unmount(options?: {
|
|
52
|
-
preserveScreen?: boolean;
|
|
53
|
-
}): void;
|
|
54
|
-
waitUntilExit(): Promise<void>;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Synchronous, best-effort terminal restoration for a crash exit — the same
|
|
58
|
-
* last-line-of-defense role the old Ink-era `restoreTerminal()` played, now
|
|
59
|
-
* delegating to `tui.stop()` (which owns raw mode, alt-screen exit, and
|
|
60
|
-
* cursor visibility) instead of hand-writing ANSI escapes.
|
|
61
|
-
*/
|
|
62
|
-
export declare function restoreActiveTerminal(): void;
|
|
63
|
-
/** Mount the interactive front door. */
|
|
64
|
-
export declare function mountTui(options: MountOptions): TuiHandle;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Callback surface the TUI's interactive components (the prompt editor,
|
|
3
|
-
* every overlay) call into; implemented once in `src/index.ts`, where each
|
|
4
|
-
* method closes over the live `Agent`/`TuiStore`/services. Framework-free so
|
|
5
|
-
* it can be shared by `commands.ts`, the prompt editor, and every overlay
|
|
6
|
-
* without any of them depending on pi-tui.
|
|
7
|
-
* @module @tomowang/dsh-tui/tui/actions
|
|
8
|
-
*/
|
|
9
|
-
import type { GoalCommand } from './commands.js';
|
|
10
|
-
import type { ProviderDraft, ProviderRow } from './modelProfile/types.js';
|
|
11
|
-
import type { QuestionAnswer } from './interaction/types.js';
|
|
12
|
-
export interface TuiActions {
|
|
13
|
-
/** Route free text to steering (running) or follow-up (idle). */
|
|
14
|
-
send(text: string): void;
|
|
15
|
-
/** Run one local shell command (not sent to the agent) and print its output to the transcript. */
|
|
16
|
-
runShell(command: string): void;
|
|
17
|
-
/** Cancel the active turn. */
|
|
18
|
-
cancel(): void;
|
|
19
|
-
/** Flush and exit. */
|
|
20
|
-
shutdown(): void;
|
|
21
|
-
/** Publish the `/help` command list and key shortcuts as the live-region notice. */
|
|
22
|
-
help(): void;
|
|
23
|
-
/** Persist one newly submitted history line for cross-session up/down-arrow recall (best-effort; no-op without a settings service). */
|
|
24
|
-
recordHistory(line: string): void;
|
|
25
|
-
/** Flush the current session, then start a brand-new one in a fresh screen. */
|
|
26
|
-
clear(): void;
|
|
27
|
-
/** Switch to the next permission preset (read-only/workspace-write/full-access), wrapping around. */
|
|
28
|
-
cyclePermission(): void;
|
|
29
|
-
/** Manually trigger session-history compaction via `ctx.compaction`. */
|
|
30
|
-
compact(): void;
|
|
31
|
-
/** Enter plan mode (optionally steering `rawInput` as its first message), or `off` to leave it, via `ctx.planMode`. */
|
|
32
|
-
plan(rawInput: string): void;
|
|
33
|
-
/** Run one parsed `/goal` command (show/create/edit/pause/resume/clear) via `ctx.goals`. */
|
|
34
|
-
goal(command: GoalCommand): void;
|
|
35
|
-
/** Start (or no-op if already loaded/loading) the background load backing the `@`-mention dropdown. */
|
|
36
|
-
ensureFileIndex(): void;
|
|
37
|
-
/** Open the `/model` provider-profile overlay and start loading providers. */
|
|
38
|
-
openModelProfile(): void;
|
|
39
|
-
/** Close the `/model` overlay, discarding any in-progress edit. */
|
|
40
|
-
closeModelProfile(): void;
|
|
41
|
-
/** Return from the add/edit form to the provider list without saving. */
|
|
42
|
-
backToProviderList(): void;
|
|
43
|
-
/** Move the provider list's selection cursor. */
|
|
44
|
-
selectProvider(index: number): void;
|
|
45
|
-
/** Open a blank draft for a new custom provider. */
|
|
46
|
-
createProvider(): void;
|
|
47
|
-
/** Open an existing provider's stored profile for editing. */
|
|
48
|
-
editProvider(route: string): void;
|
|
49
|
-
/** Persist a draft via `ctx.settings`/`ctx.credentials`, then reload the list. */
|
|
50
|
-
saveProvider(draft: ProviderDraft): void;
|
|
51
|
-
/** Remove a provider's settings section and credential. */
|
|
52
|
-
deleteProvider(row: ProviderRow): void;
|
|
53
|
-
/** Probe a draft's endpoint via `ctx.llm.discoverModels`. */
|
|
54
|
-
discoverModelsForDraft(draft: ProviderDraft): void;
|
|
55
|
-
/** Save `{provider, model}` as the Agent's default model selection. */
|
|
56
|
-
setActiveModel(provider: string, model: string): void;
|
|
57
|
-
/** Open the `/trajectory` ledger overlay. */
|
|
58
|
-
openTrajectory(): void;
|
|
59
|
-
/** Close the `/trajectory` overlay. */
|
|
60
|
-
closeTrajectory(): void;
|
|
61
|
-
/** Open the Tool Cards inspector, where individual cards can expand/collapse. */
|
|
62
|
-
openToolCards(): void;
|
|
63
|
-
/** Close the Tool Cards inspector. */
|
|
64
|
-
closeToolCards(): void;
|
|
65
|
-
/** Open the `/context` usage overlay. */
|
|
66
|
-
openContext(): void;
|
|
67
|
-
/** Close the `/context` overlay. */
|
|
68
|
-
closeContext(): void;
|
|
69
|
-
/** Open the `/plugins` loaded-plugin-tree overlay. */
|
|
70
|
-
openPlugins(): void;
|
|
71
|
-
/** Close the `/plugins` overlay. */
|
|
72
|
-
closePlugins(): void;
|
|
73
|
-
/** Open the `/presets` agent-preset overlay and start loading the roster. */
|
|
74
|
-
openAgentPresets(): void;
|
|
75
|
-
/** Close the `/presets` overlay. */
|
|
76
|
-
closeAgentPresets(): void;
|
|
77
|
-
/** Move the `/presets` list's selection cursor. */
|
|
78
|
-
selectAgentPresetRow(index: number): void;
|
|
79
|
-
/** Apply a different agent preset to the current (blank) session. */
|
|
80
|
-
applyAgentPreset(id: string): void;
|
|
81
|
-
/** Answer the pending in-terminal tool-approval prompt. */
|
|
82
|
-
answerApproval(outcome: 'allowed-once' | 'rejected'): void;
|
|
83
|
-
/** Answer the pending in-terminal question prompt. */
|
|
84
|
-
answerQuestion(answer: QuestionAnswer): void;
|
|
85
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `/presets` overlay: the deployment's agent-preset roster, with the
|
|
3
|
-
* session's current preset marked. Cursor lives in the store (`selected`),
|
|
4
|
-
* matching `ProviderList`'s pattern. A switch is only accepted while the
|
|
5
|
-
* session is blank (no turn has run yet); the host enforces that too, so
|
|
6
|
-
* this is a UX guard, not the only guard.
|
|
7
|
-
* @module @tomowang/dsh-tui/tui/agentPresets/AgentPresetsOverlay
|
|
8
|
-
*/
|
|
9
|
-
import type { Component } from '@earendil-works/pi-tui';
|
|
10
|
-
import type { TuiActions } from '../actions.js';
|
|
11
|
-
import type { TuiStore } from '../store.js';
|
|
12
|
-
export declare class AgentPresetsOverlay implements Component {
|
|
13
|
-
private readonly store;
|
|
14
|
-
private readonly actions;
|
|
15
|
-
constructor(store: TuiStore, actions: TuiActions);
|
|
16
|
-
invalidate(): void;
|
|
17
|
-
render(_width: number): string[];
|
|
18
|
-
handleInput(data: string): void;
|
|
19
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plain, Cordis-agnostic snapshot of one agent preset, joined from
|
|
3
|
-
* `ctx.agentPresets.list()` for the `/presets` overlay.
|
|
4
|
-
* @module @tomowang/dsh-tui/tui/agentPresets/types
|
|
5
|
-
*/
|
|
6
|
-
/** One preset row as the overlay renders it. */
|
|
7
|
-
export interface AgentPresetRow {
|
|
8
|
-
/** Stable identifier; the preset directory's name. */
|
|
9
|
-
readonly id: string;
|
|
10
|
-
/** Display label: a built-in English name for the four shipped ids, else the preset's own name, else its id. */
|
|
11
|
-
readonly label: string;
|
|
12
|
-
/** One sentence on what this preset is for, when it published one. */
|
|
13
|
-
readonly description: string | undefined;
|
|
14
|
-
/** `'system'` for a shipped preset, `'user'` for a locally authored one. */
|
|
15
|
-
readonly trust: 'system' | 'user';
|
|
16
|
-
/** Why this preset cannot compose a session, `undefined` when it can. */
|
|
17
|
-
readonly broken: string | undefined;
|
|
18
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure text builder for the startup banner: a bordered box with the brand
|
|
3
|
-
* logo on the left and session info on the right. Kept dependency-free (no
|
|
4
|
-
* Ink/React) so it's trivial to reason about and test in isolation,
|
|
5
|
-
* mirroring `render.ts`'s hand-rolled ANSI-aware formatting.
|
|
6
|
-
* @module @tomowang/dsh-tui/tui/bannerText
|
|
7
|
-
*/
|
|
8
|
-
export interface BannerContent {
|
|
9
|
-
readonly version: string;
|
|
10
|
-
readonly provider: string;
|
|
11
|
-
readonly model: string;
|
|
12
|
-
readonly cwd: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Builds the full multi-line banner text, sized to the given terminal
|
|
16
|
-
* width: title bar, then a fixed-width logo column beside a session-info
|
|
17
|
-
* column (vertically centered against each other), then the bottom border.
|
|
18
|
-
*/
|
|
19
|
-
export declare function buildBannerText(content: BannerContent, columns: number): string;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal-only commands the prompt intercepts before text reaches the
|
|
3
|
-
* agent. Data-driven so `PromptInput` can both dispatch on submit and render
|
|
4
|
-
* a filtered picker while the reader is still typing.
|
|
5
|
-
* @module @tomowang/dsh-tui/tui/commands
|
|
6
|
-
*/
|
|
7
|
-
import type { TuiActions } from './actions.js';
|
|
8
|
-
export interface SlashCommand {
|
|
9
|
-
readonly command: string;
|
|
10
|
-
readonly description: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const SLASH_COMMANDS: readonly SlashCommand[];
|
|
13
|
-
/** Widest command text, so the dropdown can pad every row's description to the same column. */
|
|
14
|
-
export declare const SLASH_COMMAND_WIDTH: number;
|
|
15
|
-
export declare function matchSlashCommands(query: string): readonly SlashCommand[];
|
|
16
|
-
export declare function commandQuery(value: string): {
|
|
17
|
-
isCommandMode: boolean;
|
|
18
|
-
matches: readonly SlashCommand[];
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* `/plan`'s argument takes free text (a message, or the literal `off`), so unlike every other
|
|
22
|
-
* command it can't route through {@link matchSlashCommands}'s whitespace-free matching.
|
|
23
|
-
* @param text - Raw submitted line.
|
|
24
|
-
* @returns The trimmed argument text, or `undefined` when `text` isn't a `/plan` invocation.
|
|
25
|
-
*/
|
|
26
|
-
export declare function parsePlanCommand(text: string): string | undefined;
|
|
27
|
-
/** One parsed `/goal` invocation, mirroring `@deepseek-ai/dsh-command-goal`'s `GoalCommand` union. */
|
|
28
|
-
export type GoalCommand = {
|
|
29
|
-
readonly kind: 'show';
|
|
30
|
-
} | {
|
|
31
|
-
readonly kind: 'create';
|
|
32
|
-
readonly objective: string;
|
|
33
|
-
} | {
|
|
34
|
-
readonly kind: 'edit';
|
|
35
|
-
readonly objective: string;
|
|
36
|
-
} | {
|
|
37
|
-
readonly kind: 'invalid-edit';
|
|
38
|
-
} | {
|
|
39
|
-
readonly kind: 'pause';
|
|
40
|
-
} | {
|
|
41
|
-
readonly kind: 'resume';
|
|
42
|
-
} | {
|
|
43
|
-
readonly kind: 'clear';
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Parse a `/goal` invocation exactly the way `@deepseek-ai/dsh-command-goal`'s own
|
|
47
|
-
* `parseGoalCommand` does — bare `/goal` shows the current goal, the control words
|
|
48
|
-
* `clear`/`pause`/`resume` (case-insensitive) mutate it, `edit <objective>` replaces
|
|
49
|
-
* the objective (bare `edit` is an error), and any other text is a create objective.
|
|
50
|
-
* @param text - Raw submitted line.
|
|
51
|
-
* @returns The parsed command, or `undefined` when `text` isn't a `/goal` invocation.
|
|
52
|
-
*/
|
|
53
|
-
export declare function parseGoalCommand(text: string): GoalCommand | undefined;
|
|
54
|
-
export declare function runSlashCommand(command: string, actions: TuiActions): void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `/context` overlay: a static panel showing context-window occupancy and its
|
|
3
|
-
* System prompt / Tools / Messages composition. No scrolling or selection
|
|
4
|
-
* state — a fixed read of `state.stats`, refreshed every render.
|
|
5
|
-
* @module @tomowang/dsh-tui/tui/context/ContextOverlay
|
|
6
|
-
*/
|
|
7
|
-
import type { Component } from '@earendil-works/pi-tui';
|
|
8
|
-
import type { TuiActions } from '../actions.js';
|
|
9
|
-
import type { TuiStore } from '../store.js';
|
|
10
|
-
export declare class ContextOverlay implements Component {
|
|
11
|
-
private readonly store;
|
|
12
|
-
private readonly actions;
|
|
13
|
-
constructor(store: TuiStore, actions: TuiActions);
|
|
14
|
-
invalidate(): void;
|
|
15
|
-
render(_width: number): string[];
|
|
16
|
-
handleInput(data: string): void;
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Repo-relative file paths for the `@`-mention dropdown (`PromptInput.tsx`).
|
|
3
|
-
* Reader-local convenience, so — like `!`-shell-mode's `runShell` in
|
|
4
|
-
* `src/index.ts` — this goes straight to `node:child_process`/`node:fs`
|
|
5
|
-
* rather than through `ctx.fs` (which is for the agent's own sandboxed tool
|
|
6
|
-
* execution, a different concern from listing files for local autocomplete).
|
|
7
|
-
* @module @tomowang/dsh-tui/tui/fileIndex
|
|
8
|
-
*/
|
|
9
|
-
/** Hard cap on the fallback recursive walk so a huge non-git tree can't hang the prompt. */
|
|
10
|
-
export declare const FILE_INDEX_MAX_ENTRIES = 5000;
|
|
11
|
-
/**
|
|
12
|
-
* List candidate file paths under `cwd`, relative to `cwd`.
|
|
13
|
-
* @param cwd - root to list from.
|
|
14
|
-
* @returns tracked and untracked-but-not-gitignored paths via `git ls-files`
|
|
15
|
-
* when `cwd` is inside a git repo; otherwise a bounded recursive walk.
|
|
16
|
-
*/
|
|
17
|
-
export declare function loadFileIndex(cwd: string): Promise<string[]>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `@`-file-mention detection and candidate filtering for the prompt buffer —
|
|
3
|
-
* the `@` counterpart to `commands.ts`'s `/`-command query, applied around
|
|
4
|
-
* the cursor instead of anchored to the start of the line so a mention can
|
|
5
|
-
* open mid-sentence.
|
|
6
|
-
* @module @tomowang/dsh-tui/tui/fileMention
|
|
7
|
-
*/
|
|
8
|
-
/** Max dropdown rows shown for a `@`-mention query. */
|
|
9
|
-
export declare const FILE_MENTION_MAX_MATCHES = 10;
|
|
10
|
-
export interface MentionQuery {
|
|
11
|
-
readonly isMentionMode: boolean;
|
|
12
|
-
/** Text typed after `@`, excluding the `@` itself. */
|
|
13
|
-
readonly query: string;
|
|
14
|
-
/** Index of the `@` that opened this mention, or `-1` outside mention mode. */
|
|
15
|
-
readonly start: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Find the `@`-mention token, if any, ending at `cursor`.
|
|
19
|
-
* @param value - the full prompt buffer.
|
|
20
|
-
* @param cursor - the buffer offset the reader is currently editing at.
|
|
21
|
-
* @returns the open mention's query/span, or `isMentionMode: false` outside one.
|
|
22
|
-
*/
|
|
23
|
-
export declare function mentionQuery(value: string, cursor: number): MentionQuery;
|
|
24
|
-
/**
|
|
25
|
-
* Filter and rank file candidates for a `@`-mention query.
|
|
26
|
-
* @param candidates - the full file index, repo-relative paths.
|
|
27
|
-
* @param query - text typed after `@` (case-insensitive substring match).
|
|
28
|
-
* @param limit - max rows returned.
|
|
29
|
-
* @returns matches ranked by path-prefix, then basename-prefix, then path length.
|
|
30
|
-
*/
|
|
31
|
-
export declare function matchFileCandidates(candidates: readonly string[], query: string, limit?: number): readonly string[];
|