acryl 0.1.10 → 0.1.12

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 (53) hide show
  1. package/lib/bin.js +325 -6
  2. package/package.json +1 -3
  3. package/lib/bin.js.map +0 -1
  4. package/lib/index.js +0 -5051
  5. package/lib/index.js.map +0 -1
  6. package/lib/types/bin.d.ts +0 -4
  7. package/lib/types/cli/grammar.d.ts +0 -9
  8. package/lib/types/cli/node-launcher.d.ts +0 -9
  9. package/lib/types/cli/run.d.ts +0 -32
  10. package/lib/types/host/direct.d.ts +0 -18
  11. package/lib/types/index.d.ts +0 -3
  12. package/lib/types/markdown.d.ts +0 -28
  13. package/lib/types/render.d.ts +0 -78
  14. package/lib/types/sessionId.d.ts +0 -12
  15. package/lib/types/tui/CustomEditor.d.ts +0 -51
  16. package/lib/types/tui/Spinner.d.ts +0 -18
  17. package/lib/types/tui/TuiApp.d.ts +0 -64
  18. package/lib/types/tui/actions.d.ts +0 -85
  19. package/lib/types/tui/agentPresets/AgentPresetsOverlay.d.ts +0 -19
  20. package/lib/types/tui/agentPresets/types.d.ts +0 -18
  21. package/lib/types/tui/bannerText.d.ts +0 -19
  22. package/lib/types/tui/commands.d.ts +0 -54
  23. package/lib/types/tui/context/ContextOverlay.d.ts +0 -17
  24. package/lib/types/tui/fileIndex.d.ts +0 -17
  25. package/lib/types/tui/fileMention.d.ts +0 -31
  26. package/lib/types/tui/interaction/ApprovalOverlay.d.ts +0 -18
  27. package/lib/types/tui/interaction/QuestionOverlay.d.ts +0 -26
  28. package/lib/types/tui/interaction/types.d.ts +0 -36
  29. package/lib/types/tui/liveText.d.ts +0 -60
  30. package/lib/types/tui/logoArt.generated.d.ts +0 -9
  31. package/lib/types/tui/miniTextField.d.ts +0 -20
  32. package/lib/types/tui/modelProfile/ModelProfileOverlay.d.ts +0 -48
  33. package/lib/types/tui/modelProfile/types.d.ts +0 -63
  34. package/lib/types/tui/piTheme.d.ts +0 -10
  35. package/lib/types/tui/plugins/PluginsOverlay.d.ts +0 -22
  36. package/lib/types/tui/plugins/types.d.ts +0 -18
  37. package/lib/types/tui/promptAutocomplete.d.ts +0 -29
  38. package/lib/types/tui/statsFormat.d.ts +0 -89
  39. package/lib/types/tui/store.d.ts +0 -246
  40. package/lib/types/tui/text.d.ts +0 -21
  41. package/lib/types/tui/theme.d.ts +0 -35
  42. package/lib/types/tui/toolCards/ToolCardsOverlay.d.ts +0 -33
  43. package/lib/types/tui/trajectory/TrajectoryDetail.d.ts +0 -13
  44. package/lib/types/tui/trajectory/TrajectoryLedger.d.ts +0 -9
  45. package/lib/types/tui/trajectory/TrajectoryOverlay.d.ts +0 -39
  46. package/lib/types/tui/trajectory/detail.d.ts +0 -10
  47. package/lib/types/tui/trajectory/layout.d.ts +0 -16
  48. package/lib/types/tui/trajectory/types.d.ts +0 -74
  49. package/lib/types/tui-app/session.d.ts +0 -21
  50. package/lib/types/version.d.ts +0 -2
  51. package/lib/types/yly/yly-frames.generated.d.ts +0 -18
  52. package/lib/types/yly/yly-pet.d.ts +0 -46
  53. package/lib/types/yly/yly-programs.d.ts +0 -41
@@ -1,246 +0,0 @@
1
- /**
2
- * Plain, dependency-free projection of Cordis/session events into a single
3
- * immutable snapshot that React components read through
4
- * `useSyncExternalStore`. Owns the seq-dedupe boundary between replayed and
5
- * live session events so that invariant lives in one place, testable without
6
- * Ink or Cordis.
7
- * @module @tomowang/dsh-tui/tui/store
8
- */
9
- import type { AgentStatus } from '@deepseek-ai/dsh-agent';
10
- import type { GoalProjection } from '@deepseek-ai/dsh-goal';
11
- import type { CallId } from '@deepseek-ai/dsh-llm';
12
- import type { SessionEvent, UserMessage } from '@deepseek-ai/dsh-session';
13
- import type { SessionStatsProjection } from '@deepseek-ai/dsh-session-stats';
14
- import type { ContextBreakdownProjection, ContextPressureProjection, TokenUsageProjection } from '@deepseek-ai/dsh-token-meter';
15
- import type { DiscoveredModel, ProviderDraft, ProviderRow } from './modelProfile/types.js';
16
- import type { PluginRow } from './plugins/types.js';
17
- import type { AgentPresetRow } from './agentPresets/types.js';
18
- import type { ApprovalPromptState, QuestionPromptState } from './interaction/types.js';
19
- /** Which pane of the `/model` overlay is showing. */
20
- export type ModelProfileView = 'list' | 'form';
21
- /** Overlay-owned state for the `/model` provider-profile screen. */
22
- export interface ModelProfileOverlayState {
23
- readonly view: ModelProfileView;
24
- /** Joined provider directory; `undefined` until the first load settles. */
25
- readonly providers: readonly ProviderRow[] | undefined;
26
- readonly selected: number;
27
- readonly draft: ProviderDraft | undefined;
28
- /** Bumped on every `editProvider`/`createProvider` so the form remounts with fresh local state. */
29
- readonly formKey: number;
30
- readonly discovered: readonly DiscoveredModel[] | undefined;
31
- readonly busy: boolean;
32
- readonly error: string | undefined;
33
- }
34
- /** Overlay-owned state for the `/presets` agent-preset screen. */
35
- export interface AgentPresetsOverlayState {
36
- /** Joined preset roster; empty while the first load is still in flight (see `busy`). */
37
- readonly rows: readonly AgentPresetRow[];
38
- readonly selected: number;
39
- /** The session's currently resolved preset id, or `undefined` without a mounted service. */
40
- readonly current: string | undefined;
41
- /** Whether the session has run no turn yet — the only state a preset switch is accepted in. */
42
- readonly blank: boolean;
43
- readonly busy: boolean;
44
- readonly error: string | undefined;
45
- }
46
- /**
47
- * Full-screen overlay replacing the live region's normal controls — except
48
- * `'approval'`, which `TuiApp` renders inline in the dock (a live-region row
49
- * with focus, not a `showOverlay` panel) since it's the highest-frequency
50
- * interruption and doesn't need to hide the transcript to be answered.
51
- */
52
- export type Overlay = {
53
- readonly kind: 'none';
54
- } | {
55
- readonly kind: 'modelProfile';
56
- readonly modelProfile: ModelProfileOverlayState;
57
- } | {
58
- readonly kind: 'trajectory';
59
- } | {
60
- readonly kind: 'toolCards';
61
- } | {
62
- readonly kind: 'context';
63
- } | {
64
- readonly kind: 'plugins';
65
- readonly rows: readonly PluginRow[];
66
- } | {
67
- readonly kind: 'agentPresets';
68
- readonly agentPresets: AgentPresetsOverlayState;
69
- } | {
70
- readonly kind: 'approval';
71
- readonly approval: ApprovalPromptState;
72
- } | {
73
- readonly kind: 'userQuestion';
74
- readonly userQuestion: QuestionPromptState;
75
- };
76
- /** Whole-log figures for the status bar's stats line; each side is `undefined` without its projection unit mounted. */
77
- export interface StatsSnapshot {
78
- readonly sessionStats: SessionStatsProjection | undefined;
79
- readonly tokenUsage: TokenUsageProjection | undefined;
80
- readonly contextPressure: ContextPressureProjection | undefined;
81
- readonly contextBreakdown: ContextBreakdownProjection | undefined;
82
- }
83
- /** The session's current permission preset, folded from `ctx.permissionPresets`. */
84
- export interface PermissionState {
85
- /** The effective preset name, or `'custom'` when the knobs match no table entry. */
86
- readonly current: string;
87
- /** Every switchable preset name, in table declaration order. */
88
- readonly names: readonly string[];
89
- }
90
- /** The session's current agent preset, folded from `ctx.agentPresets`. */
91
- export interface PresetState {
92
- /** Display label of the resolved preset, or `undefined` when the deployment composes none. */
93
- readonly current: string | undefined;
94
- /** Whether the session has run no turn yet — the only state a preset switch is accepted in. */
95
- readonly blank: boolean;
96
- }
97
- /** The currently-generating step's accumulated text, folded live from `assistant/chunk`. */
98
- export interface StreamingState {
99
- readonly turn: number;
100
- readonly step: number;
101
- readonly text: string;
102
- /** Accumulated reasoning/thinking text, distinct from `text`; empty when the step has none. */
103
- readonly reasoningText: string;
104
- }
105
- /** One tool call sent but with no `tool/result` yet, for the live region's spinner row; collapses into the transcript's one-line summary once its result lands. */
106
- export interface PendingToolCall {
107
- readonly callId: CallId;
108
- readonly name: string;
109
- readonly arguments: string;
110
- }
111
- /** The in-flight local shell-escape run (`!` prompt-mode), mirroring `StreamingState`'s live-region role. */
112
- export interface ShellRunState {
113
- readonly id: number;
114
- readonly command: string;
115
- readonly output: string;
116
- }
117
- /** One settled local shell-escape run, ordered into the permanent transcript after every event observed by the time it finished. */
118
- export interface ShellRunRecord {
119
- readonly id: number;
120
- readonly command: string;
121
- readonly output: string;
122
- readonly exitCode: number | null;
123
- /** The store's `lastSeq` at completion — sorts this record after every event seen so far and before any observed later. */
124
- readonly afterSeq: number;
125
- }
126
- /** One immutable snapshot of everything the TUI renders. */
127
- export interface TuiState {
128
- /** Session log so far, in append order. */
129
- readonly events: readonly SessionEvent[];
130
- /** Highest `seq` that was seeded from replay rather than observed live. */
131
- readonly replayThrough: number;
132
- /** Current agent lifecycle state. */
133
- readonly status: AgentStatus;
134
- /** Messages currently pending in the agent's inbox. */
135
- readonly queued: readonly UserMessage[];
136
- /** Transient one-line notice (e.g. `/status`), cleared on the next input. */
137
- readonly notice: string | undefined;
138
- /** Active full-screen overlay, if any, replacing the prompt/status live region. */
139
- readonly overlay: Overlay;
140
- /** Current permission preset, or `undefined` when `ctx.permissionPresets` isn't composed in this profile. */
141
- readonly permission: PermissionState | undefined;
142
- /** The session's current goal (the 'goal' session projection: whole value, or `null` before the first create / after a clear tombstone), or `undefined` when the projection unit isn't composed in this profile. */
143
- readonly goal: GoalProjection | null | undefined;
144
- /** The session's current title (the 'title' session projection: last-wins `session/title` text, or `null` before the first one lands), or `undefined` when `dsh-session-title` isn't composed in this profile. Drives the terminal window/tab title — see `TuiApp`'s `updateTerminalTitle`. */
145
- readonly title: string | null | undefined;
146
- /** Whole-log stats-line figures, or `undefined` sides when `ctx.sessionProjections` isn't composed in this profile. */
147
- readonly stats: StatsSnapshot;
148
- /** Current agent preset, or `undefined` when `ctx.agentPresets` isn't composed in this profile. */
149
- readonly preset: PresetState | undefined;
150
- /** The in-flight step's accumulated text, or `undefined` when nothing is currently streaming. */
151
- readonly streaming: StreamingState | undefined;
152
- /** Tool calls sent but not yet resolved by a `tool/result`, in call order. */
153
- readonly pendingToolCalls: readonly PendingToolCall[];
154
- /** The in-flight local shell-escape run, or `undefined` when none is running. */
155
- readonly shellRun: ShellRunState | undefined;
156
- /** Settled local shell-escape runs, in completion order, interleaved into the transcript via `afterSeq`. */
157
- readonly shellHistory: readonly ShellRunRecord[];
158
- /** Repo-relative file paths backing the `@`-mention dropdown; `undefined` until the first mention triggers a load. */
159
- readonly fileIndex: FileIndexState;
160
- /** A newer npm-published version of this package, once the startup registry check (`src/updateCheck.ts`) resolves one; `undefined` while unchecked or already current. */
161
- readonly updateHint: string | undefined;
162
- }
163
- /** The `@`-mention dropdown's backing file list, loaded lazily on first use (see `ensureFileIndex` in `src/index.ts`). */
164
- export interface FileIndexState {
165
- readonly candidates: readonly string[] | undefined;
166
- readonly loading: boolean;
167
- }
168
- type Listener = () => void;
169
- /** Mutable projection; `getSnapshot`/`subscribe` satisfy `useSyncExternalStore`. */
170
- export declare class TuiStore {
171
- private state;
172
- private readonly listeners;
173
- private lastSeq;
174
- private streamingAssembler;
175
- private streamingKey;
176
- private readonly toolCalls;
177
- private readonly pendingToolCallsMap;
178
- constructor(initial: {
179
- events: readonly SessionEvent[];
180
- });
181
- getSnapshot: () => TuiState;
182
- /** The `tool/call` a later `tool/result` correlates with, by `callId`; `undefined` when its call was never seen (e.g. log truncation). */
183
- getToolCall: (callId: CallId) => {
184
- name: string;
185
- arguments: string;
186
- } | undefined;
187
- subscribe: (listener: Listener) => (() => void);
188
- /** Append one live session event, ignoring anything already seeded/seen. */
189
- appendEvent(event: SessionEvent): void;
190
- /** Snapshot `pendingToolCallsMap` into `TuiState`'s array shape, in call order. */
191
- private pendingToolCallsSnapshot;
192
- /** Fold one raw stream chunk into the in-flight step's live text, keyed by `{turn, step}`. */
193
- private foldChunk;
194
- setStatus(status: AgentStatus): void;
195
- setQueued(queued: readonly UserMessage[]): void;
196
- setNotice(notice: string | undefined): void;
197
- setPermission(permission: PermissionState | undefined): void;
198
- /** Refresh the session's current goal from the 'goal' session projection; `undefined` when the projection unit isn't composed, `null` before the first create or after a clear. */
199
- setGoal(goal: GoalProjection | null | undefined): void;
200
- /** Refresh the session's current title from the 'title' session projection; `undefined` when `dsh-session-title` isn't composed, `null` before the first accepted title. */
201
- setTitle(title: string | null | undefined): void;
202
- setStats(stats: StatsSnapshot): void;
203
- setPreset(preset: PresetState | undefined): void;
204
- private shellRunSeq;
205
- /** Begin one local shell-escape run; its output accumulates via `appendShellOutput` until `finishShellRun` settles it into the transcript. */
206
- startShellRun(command: string): number;
207
- /** Append one chunk of stdout/stderr to the in-flight run; a no-op once it's settled or superseded by a later run. */
208
- appendShellOutput(id: number, chunk: string): void;
209
- /** Settle the in-flight run into the permanent transcript; a no-op once it's already settled or superseded. */
210
- finishShellRun(id: number, exitCode: number | null): void;
211
- /** Open the `/model` overlay to a fresh, loading provider list. */
212
- openModelProfile(): void;
213
- /** Open the `/trajectory` ledger overlay. */
214
- openTrajectory(): void;
215
- /** Open the expandable Tool Cards inspector. */
216
- openToolCards(): void;
217
- /** Open the `/context` usage overlay. */
218
- openContext(): void;
219
- /** Open the `/plugins` loaded-plugin-tree overlay with a snapshotted row list. */
220
- openPlugins(rows: readonly PluginRow[]): void;
221
- /** Open the `/presets` overlay to a fresh, loading roster. */
222
- openAgentPresets(init: {
223
- current: string | undefined;
224
- blank: boolean;
225
- }): void;
226
- /** Present one pending tool-approval decision, taking over the live region. */
227
- openApproval(approval: ApprovalPromptState): void;
228
- /** Present one pending question, taking over the live region. */
229
- openUserQuestion(userQuestion: QuestionPromptState): void;
230
- /** Close whichever overlay is open, restoring the normal prompt/status controls. */
231
- closeOverlay(): void;
232
- /** Patch the open `/model` overlay's sub-state; a no-op once it's closed. */
233
- updateModelProfile(patch: Partial<ModelProfileOverlayState>): void;
234
- /** Patch the open `/presets` overlay's sub-state; a no-op once it's closed. */
235
- updateAgentPresets(patch: Partial<AgentPresetsOverlayState>): void;
236
- /** Move the `/presets` overlay's list cursor. */
237
- selectAgentPresetRow(index: number): void;
238
- /** Mark the `@`-mention file index as loading; a no-op once candidates are already present. */
239
- setFileIndexLoading(): void;
240
- /** Settle the `@`-mention file index once `loadFileIndex` resolves. */
241
- setFileIndex(candidates: readonly string[]): void;
242
- /** Record a newer npm-published version found by the startup update check; persists for the session (not cleared by `/clear`'s notice reset) until dismissed by a fresh check finding none. */
243
- setUpdateHint(version: string | undefined): void;
244
- private set;
245
- }
246
- export {};
@@ -1,21 +0,0 @@
1
- /**
2
- * Thin pi-tui `Component` wrappers around already-ANSI-styled strings.
3
- * `render.ts`/`markdown.ts`/`bannerText.ts` produce terminal-ready text
4
- * (colors, bold, links baked in via raw SGR/OSC sequences) — these wrappers
5
- * exist only to satisfy pi-tui's `Component` interface (`render(width)`,
6
- * `invalidate()`) without re-styling that text, mirroring how the old Ink
7
- * `<Text>` usage printed these strings unmodified.
8
- * @module @tomowang/dsh-tui/tui/text
9
- */
10
- import { type Component } from '@earendil-works/pi-tui';
11
- /** Word-wraps already-ANSI-styled text to fit within `width` minus the transcript's left/right margin, then indents every resulting line. Used by the live-region rows (streaming text, pending tool calls, live shell output), which rebuild their string from the store on every render — see `createTranscriptLine` for the settled, append-only transcript rows, which get the same margin from pi-tui's own `Text` instead so repeated renders can be cached. */
12
- export declare function padTranscriptText(text: string, width: number): string[];
13
- /** A settled transcript line: pi-tui's `Text` component wraps to width and applies the same left/right margin as `padTranscriptText`, but — unlike our own `Component`s here — caches its wrapped output keyed on `(text, width)`, so appended transcript history isn't re-wrapped on every unrelated store update (e.g. a streaming token delta) the way a hand-rolled render() would. Content is fixed at construction — transcript rows are append-only and never mutated after being added. */
14
- export declare function createTranscriptLine(text: string): Component;
15
- /** A block of pre-styled text rebuilt from the current viewport width on every render — for content (the banner) whose own layout is width-responsive. */
16
- export declare class DynamicText implements Component {
17
- private readonly build;
18
- constructor(build: (width: number) => string);
19
- invalidate(): void;
20
- render(width: number): string[];
21
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * DeepSeek brand palette for the TUI. Keep color decisions semantic so every
3
- * Ink surface and the raw-ANSI `render.ts`/`bannerText.ts` helpers share the
4
- * same visual language — see `DESIGN.md` for the full rationale and the
5
- * component-mapping guide this table is drawn from.
6
- *
7
- * The terminal still owns its background and default foreground; these are
8
- * foreground tokens for interactive, stateful, and brand elements only —
9
- * this TUI renders to native scrollback (no painted panel backgrounds), so
10
- * DeepSeek's `surface`/`bg-dark`/`border-dim` tokens are deliberately not
11
- * represented here.
12
- * @module @tomowang/dsh-tui/tui/theme
13
- */
14
- export declare const theme: {
15
- /** DeepSeek Blue — brand banner/ASCII, active input border. */
16
- readonly primary: "#4F6BFE";
17
- /** Electric Cyan — section headers, streaming/progress indicators. */
18
- readonly secondary: "#38BDF8";
19
- /** Slate Indigo — badges (active provider/model). */
20
- readonly accent: "#818CF8";
21
- /** Thought Violet — reasoning/thinking content, set apart from assistant text; see `formatReasoningSummary`/`formatStreamingText` in `src/render.ts`. */
22
- readonly reasoning: "#A855F7";
23
- /** Mint Emerald. */
24
- readonly success: "#34D399";
25
- /** Amber Sun. */
26
- readonly warning: "#FBBF24";
27
- /** Coral Red. */
28
- readonly error: "#F87171";
29
- /** DeepSeek uses its primary blue for informational UI. */
30
- readonly info: "#4F6BFE";
31
- /** Slate Gray — dim/secondary text (labels, hints, timestamps). */
32
- readonly muted: "#94A3B8";
33
- };
34
- /** 24-bit-color ANSI wrapper, shared by every raw-ANSI formatter (`render.ts`, `markdown.ts`, `bannerText.ts`) and every pi-tui component theme adapter. */
35
- export declare function fg(hex: string): (s: string) => string;
@@ -1,33 +0,0 @@
1
- /**
2
- * Mutable inspector for tool cards, opened by Ctrl+O/`/tools`: every row
3
- * shows its full, uncapped presentation (`formatToolCardDetail`) by
4
- * default, scrollable, rather than the transcript's collapsed one-line
5
- * summary — `Enter`/`Space` collapses a row back down, per-row.
6
- * @module @tomowang/dsh-tui/tui/toolCards/ToolCardsOverlay
7
- */
8
- import type { Component, TUI } from '@earendil-works/pi-tui';
9
- import { type RenderOptions } from '../../render.js';
10
- import type { TuiActions } from '../actions.js';
11
- import type { TuiStore } from '../store.js';
12
- export declare class ToolCardsOverlay implements Component {
13
- private readonly tui;
14
- private readonly store;
15
- private readonly actions;
16
- private readonly getTool;
17
- private readonly getToolCall;
18
- private selected;
19
- private readonly collapsed;
20
- private scrollOffset;
21
- private lastRowKey;
22
- private lastOpen;
23
- constructor(tui: TUI, store: TuiStore, actions: TuiActions, getTool: RenderOptions['getTool'], getToolCall: RenderOptions['getToolCall']);
24
- invalidate(): void;
25
- /** Pairs `tool/call`/`tool/result` events by `callId`, in call order; an orphaned result (no call in the log) gets its own trailing row. */
26
- private cards;
27
- private contentRows;
28
- render(_width: number): string[];
29
- private move;
30
- private scroll;
31
- private toggle;
32
- handleInput(data: string): void;
33
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Pure line-builder for the `/trajectory` overlay's tabbed detail pane —
3
- * tabs vary by the selected record's kind (see `detailTabsFor`), content
4
- * word-wrapped to the pane's width and line-clamped to fit its height
5
- * budget. Wrapping matters here specifically because `buildDetail`'s
6
- * Preview/Raw/Payload/Schema content can be arbitrarily long prose or JSON
7
- * with no line breaks of its own — unlike a browser, the terminal won't wrap
8
- * it for us.
9
- * @module @tomowang/dsh-tui/tui/trajectory/TrajectoryDetail
10
- */
11
- import type { RenderOptions } from '../../render.js';
12
- import { type TrajectoryDetailTab, type TrajectoryRecord } from './types.js';
13
- export declare function buildDetailLines(record: TrajectoryRecord | undefined, tab: TrajectoryDetailTab, maxLines: number, getTool: RenderOptions['getTool'], width: number): string[];
@@ -1,9 +0,0 @@
1
- /**
2
- * Pure line-builder for the `/trajectory` ledger's rows: turn/step boundary
3
- * markers, one line per record (colored kind tag + icon + label), and
4
- * collapsed-turn summaries. `TrajectoryOverlay` owns scroll-window slicing;
5
- * this only formats whatever slice it's given.
6
- * @module @tomowang/dsh-tui/tui/trajectory/TrajectoryLedger
7
- */
8
- import type { TrajectoryRow } from './types.js';
9
- export declare function buildLedgerLines(rows: readonly TrajectoryRow[], selectedId: string | undefined): string[];
@@ -1,39 +0,0 @@
1
- /**
2
- * `/trajectory` overlay: a turn/step-grouped ledger of the session log (see
3
- * `layout.ts`) with a keyboard-driven inspector panel. Owns all of its own
4
- * navigation/filter/collapse state locally (nothing is store-held; the
5
- * ledger is re-derived from the store's events on every render, per the
6
- * project's log-first-rendering principle).
7
- *
8
- * Keys: ↑↓ move selection, Tab/Shift+Tab cycle the detail tab, `c` toggles
9
- * collapsing the selected record's turn, `/` focuses a substring filter
10
- * (Esc there defocuses without closing), Esc closes the overlay.
11
- * @module @tomowang/dsh-tui/tui/trajectory/TrajectoryOverlay
12
- */
13
- import type { Component, TUI } from '@earendil-works/pi-tui';
14
- import type { RenderOptions } from '../../render.js';
15
- import type { TuiActions } from '../actions.js';
16
- import type { TuiStore } from '../store.js';
17
- export declare class TrajectoryOverlay implements Component {
18
- private readonly tui;
19
- private readonly store;
20
- private readonly actions;
21
- private readonly getTool;
22
- private readonly collapsedTurns;
23
- private filter;
24
- private filterFocused;
25
- private detailTab;
26
- private selectedId;
27
- private scrollOffset;
28
- private lastSelectedTurn;
29
- constructor(tui: TUI, store: TuiStore, actions: TuiActions, getTool: RenderOptions['getTool']);
30
- invalidate(): void;
31
- private heights;
32
- private computeRows;
33
- render(width: number): string[];
34
- private moveSelection;
35
- private selectedRecord;
36
- private cycleTab;
37
- private toggleCollapse;
38
- handleInput(data: string): void;
39
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Per-tab text builders for the `/trajectory` detail pane. Pure functions
3
- * over a `TrajectoryRecord`, kept separate from rendering so the content
4
- * logic is unit-testable without Ink.
5
- * @module @tomowang/dsh-tui/tui/trajectory/detail
6
- */
7
- import type { RenderOptions } from '../../render.js';
8
- import type { TrajectoryDetailTab, TrajectoryRecord } from './types.js';
9
- /** Render the content of one detail-pane tab for the selected record. */
10
- export declare function buildDetail(record: TrajectoryRecord, tab: TrajectoryDetailTab, getTool: RenderOptions['getTool']): string;
@@ -1,16 +0,0 @@
1
- /**
2
- * Pure fold of the durable session log into the `/trajectory` ledger's rows —
3
- * turn/step boundaries, one row per user/assistant message, tool calls paired
4
- * with their result by `callId`, and request-header changes. No Ink/React
5
- * dependency, so this is unit-testable directly against a `SessionEvent[]`
6
- * fixture.
7
- * @module @tomowang/dsh-tui/tui/trajectory/layout
8
- */
9
- import type { SessionEvent } from '@deepseek-ai/dsh-session';
10
- import type { TrajectoryRow } from './types.js';
11
- /**
12
- * Fold the session log into ledger rows, in seq order.
13
- * @param events - the session's durable event log (replay + live, already seq-deduped by `TuiStore`).
14
- * @param collapsedTurns - turns whose non-first content row should fold into one `'collapsed'` summary row.
15
- */
16
- export declare function buildTrajectoryRows(events: readonly SessionEvent[], collapsedTurns: ReadonlySet<number>): readonly TrajectoryRow[];
@@ -1,74 +0,0 @@
1
- /**
2
- * Plain data shapes for the `/trajectory` ledger overlay: a turn/step-grouped
3
- * projection of the session log, independent of Ink/React so `layout.ts` and
4
- * `detail.ts` stay unit-testable without rendering.
5
- * @module @tomowang/dsh-tui/tui/trajectory/types
6
- */
7
- /**
8
- * What kind of session record a ledger row represents. `context` mirrors the
9
- * web ledger's split of `user/message` by `source.kind`: a direct human
10
- * prompt is `user`, while plugin-injected context (subdir AGENTS.md, skill
11
- * content, cron notices, …) is `context` — see `userLabel` in `layout.ts`.
12
- */
13
- export type TrajectoryRecordKind = 'user' | 'context' | 'assistant' | 'tool' | 'header';
14
- /**
15
- * Which tab of the detail pane is showing for the selected record. Not every
16
- * tab applies to every record kind — see `detailTabsFor`, which mirrors the
17
- * web ledger's per-kind split (`detailTabs()` in `TrajectoryTable.tsx`).
18
- */
19
- export type TrajectoryDetailTab = 'summary' | 'payload' | 'result' | 'schema' | 'timing' | 'preview' | 'raw' | 'source';
20
- /** One selectable ledger entry: a user/assistant message, a tool call+result pair, or a header change. */
21
- export interface TrajectoryRecord {
22
- /** Stable identity: the tool `callId` for tool records, else `seq` as a string. */
23
- readonly id: string;
24
- readonly kind: TrajectoryRecordKind;
25
- readonly turn: number;
26
- readonly step: number;
27
- /** The seq of the record's opening event (call/message), used for ordering and selection. */
28
- readonly seq: number;
29
- readonly startedAt: number;
30
- /** Set once the paired result/message lands; `undefined` for a still-open tool call. */
31
- readonly completedAt: number | undefined;
32
- /** One-line ledger row text, already truncated/ANSI-decorated like `formatEvent`'s output. */
33
- readonly label: string;
34
- readonly isError: boolean;
35
- /** Untruncated one-line description for the Summary tab. */
36
- readonly summary: string;
37
- /** Full input payload (tool arguments, a direct human prompt's text, header JSON), for the Payload tab (tool/header) and the Preview/Raw tabs (user/context/assistant, where it's visible text only — see `reasoning` for an assistant's thinking). */
38
- readonly payload: string | undefined;
39
- /** Full result content (tool result, error), for the Result tab; `undefined` for non-tool kinds. */
40
- readonly result: string | undefined;
41
- /** An assistant step's reasoning/thinking text, independent of `payload`'s visible text; `undefined` for non-assistant kinds or a step with none. */
42
- readonly reasoning: string | undefined;
43
- /** The raw `user/message` event's `source` (`{kind: 'user'}` or a plugin's injected-context descriptor), for the Source tab; `undefined` for non-user/context kinds. */
44
- readonly source: unknown;
45
- /** Tool name, for the Schema tab's `getTool` lookup; `undefined` for non-tool kinds, or an unmatched result with no known call. */
46
- readonly toolName: string | undefined;
47
- }
48
- /**
49
- * Which detail tabs apply to a record, mirroring the web ledger's per-kind
50
- * split: a markdown record (user/context/assistant) gets Summary/Preview/Raw
51
- * plus Source only when the underlying event actually carried one (user and
52
- * context always do; assistant never does — see `layout.ts`). Everything
53
- * else (tool, header) gets Summary plus whichever of Payload/Result the
54
- * record actually has, and — tool records only — Schema, always followed by
55
- * Timing.
56
- */
57
- export declare function detailTabsFor(record: TrajectoryRecord): readonly TrajectoryDetailTab[];
58
- /** One row of the ledger: a boundary marker, a record, or a collapsed-turn summary. */
59
- export type TrajectoryRow = {
60
- readonly kind: 'turn';
61
- readonly turn: number;
62
- readonly aborted: string | undefined;
63
- } | {
64
- readonly kind: 'step';
65
- readonly turn: number;
66
- readonly step: number;
67
- } | {
68
- readonly kind: 'record';
69
- readonly record: TrajectoryRecord;
70
- } | {
71
- readonly kind: 'collapsed';
72
- readonly turn: number;
73
- readonly count: number;
74
- };
@@ -1,21 +0,0 @@
1
- /**
2
- * ACRYL terminal host adapter: brings up one normal local runtime, opens or
3
- * resumes one native durable DSH session through a runtime-owned bridge,
4
- * projects the durable log into `TuiStore`, and drives the pi-tui shell.
5
- *
6
- * Session-inspector overlays (/trajectory, /tools, /context, /plugins) and the
7
- * /model /presets /goal /plan /compact commands are wired to the runtime so the
8
- * TUI shows the same capabilities the web surface does. `/clear` flushes the
9
- * current session and re-attaches a fresh one (durable history stays on disk).
10
- */
11
- export interface RunAcrylTuiOptions {
12
- readonly profile: string;
13
- readonly resumeSessionId?: string;
14
- }
15
- export interface AcrylTuiResult {
16
- readonly sessionId: string;
17
- readonly resumeHint: string;
18
- dispose(): Promise<void>;
19
- }
20
- /** Mount one interactive pi-tui session over the bridge; loop over `/clear` re-attaches. */
21
- export declare function runAcrylTui(options: RunAcrylTuiOptions): Promise<AcrylTuiResult>;
@@ -1,2 +0,0 @@
1
- /** Canonical ACRYL version string used by the CLI and the release smoke checks. */
2
- export declare const ACRYL_VERSION: string;
@@ -1,18 +0,0 @@
1
- export declare const YLY_CELL_W = 96;
2
- export declare const YLY_CELL_H = 84;
3
- export declare const YLY_FRAME_COUNT = 13;
4
- export declare const YLY_SIZES: {
5
- readonly small: {
6
- readonly cols: 16;
7
- readonly rows: 9;
8
- };
9
- readonly medium: {
10
- readonly cols: 22;
11
- readonly rows: 12;
12
- };
13
- readonly large: {
14
- readonly cols: 30;
15
- readonly rows: 16;
16
- };
17
- };
18
- export declare const YLY_FRAMES: Record<'small' | 'medium' | 'large', readonly (readonly string[])[]>;
@@ -1,46 +0,0 @@
1
- /**
2
- * The ACRYL pet (ACRYLY, technical id `YlyPet`): a pi-tui `Component` that
3
- * renders the YLY sprite frames (compiled into ANSI half-block strings) and
4
- * animates them with the mockup's exact clip timings (per-step `ms`, loop /
5
- * next-state, vertical bob). It occupies a fixed header region at the top-left
6
- * of the terminal while the conversation scrolls underneath.
7
- *
8
- * To avoid distracting the reader, the animation is NOT continuous: the pet
9
- * alternates between random-length *rest* periods (a frozen canonical frame,
10
- * no movement) and random-length *active* bursts (the mode's clip plays). A
11
- * mode change (`setMode`) wakes it into an active burst so an agent turn still
12
- * reads as activity, and the status bar carries the live state meanwhile.
13
- * @module acryl-tui/yly/yly-pet
14
- */
15
- import type { Component, TUI } from '@earendil-works/pi-tui';
16
- import { type YlyState } from './yly-programs.js';
17
- export interface YlyPetOptions {
18
- /** Rest (paused) duration source, in ms. Defaults to a random 4-12s. */
19
- readonly restMs?: () => number;
20
- /** Active (animating) burst duration source, in ms. Defaults to a random 1.6-4.8s. */
21
- readonly activeMs?: () => number;
22
- }
23
- export declare class YlyPet implements Component {
24
- private readonly tui;
25
- private state;
26
- private step;
27
- private phase;
28
- private activeElapsed;
29
- private restDuration;
30
- private activeDuration;
31
- private readonly restMs;
32
- private readonly activeMs;
33
- private timer;
34
- constructor(tui: TUI, options?: YlyPetOptions);
35
- setMode(state: YlyState): void;
36
- private clip;
37
- private restart;
38
- private activate;
39
- private deactivate;
40
- private advance;
41
- start(): void;
42
- stop(): void;
43
- invalidate(): void;
44
- private sizeForCols;
45
- render(_width: number): string[];
46
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * ACRYL YLY pet animation programs — a faithful port of the react mockup's
3
- * `ylyAnimations.ts` (frame indices + per-step ms + loop/next + bob). A pi-tui
4
- * terminal renders these frame-for-frame. Frame names follow `ylyFrames.ts`
5
- * (sheet cell indices 0..12).
6
- * @module acryl-tui/yly/yly-programs
7
- */
8
- export type YlyState = 'idle' | 'thinking' | 'walking' | 'tool' | 'typing' | 'success' | 'error' | 'sleeping';
9
- export interface YlyStep {
10
- /** sheet cell index (see yly-frames generated F map). */
11
- readonly frame: number;
12
- /** how long the frame is held, in ms. */
13
- readonly ms: number;
14
- }
15
- export interface YlyClip {
16
- readonly steps: readonly YlyStep[];
17
- readonly loop: boolean;
18
- /** state entered automatically when a non-looping clip finishes. */
19
- readonly next?: YlyState;
20
- /** vertical bob amplitude in terminal rows (0 = still). */
21
- readonly bob?: number;
22
- }
23
- export declare const YLY_CLIPS: Record<YlyState, YlyClip>;
24
- /** Terminal size presets (cols x rows) mirroring the mockup's responsive sizes. */
25
- export declare const YLY_SIZE_PRESETS: {
26
- readonly small: {
27
- readonly cols: 16;
28
- readonly rows: 9;
29
- };
30
- readonly medium: {
31
- readonly cols: 22;
32
- readonly rows: 12;
33
- };
34
- readonly large: {
35
- readonly cols: 30;
36
- readonly rows: 16;
37
- };
38
- };
39
- export type YlySize = keyof typeof YLY_SIZE_PRESETS;
40
- /** Pet is hidden below this terminal width; content always wins. */
41
- export declare const MIN_WIDTH = 92;