dsh-ssh-tui 0.5.2 → 0.5.4
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.en.md +36 -6
- package/README.md +24 -13
- package/lib/approval-reviewer.js +102 -17
- package/lib/approval-reviewer.js.map +1 -1
- package/lib/auto-approval.js +312 -29
- package/lib/auto-approval.js.map +1 -1
- package/lib/footer.js +337 -0
- package/lib/footer.js.map +1 -0
- package/lib/i18n/en.js +83 -8
- package/lib/i18n/en.js.map +1 -1
- package/lib/i18n/index.js +1 -0
- package/lib/i18n/index.js.map +1 -1
- package/lib/i18n/zh.js +83 -8
- package/lib/i18n/zh.js.map +1 -1
- package/lib/json-args.js +30 -0
- package/lib/json-args.js.map +1 -0
- package/lib/paint.js +262 -0
- package/lib/paint.js.map +1 -0
- package/lib/picker.js +407 -56
- package/lib/picker.js.map +1 -1
- package/lib/plan.js +369 -0
- package/lib/plan.js.map +1 -0
- package/lib/quota.js +408 -0
- package/lib/quota.js.map +1 -0
- package/lib/session-list.js +18 -21
- package/lib/session-list.js.map +1 -1
- package/lib/term-text.js +827 -0
- package/lib/term-text.js.map +1 -0
- package/lib/tool-present.js +744 -0
- package/lib/tool-present.js.map +1 -0
- package/lib/transcript-types.js +6 -0
- package/lib/transcript-types.js.map +1 -0
- package/lib/tui.js +747 -3077
- package/lib/tui.js.map +1 -1
- package/lib/types/approval-reviewer.d.ts +18 -4
- package/lib/types/auto-approval.d.ts +53 -2
- package/lib/types/footer.d.ts +155 -0
- package/lib/types/i18n/index.d.ts +2 -0
- package/lib/types/json-args.d.ts +7 -0
- package/lib/types/paint.d.ts +78 -0
- package/lib/types/picker.d.ts +99 -7
- package/lib/types/plan.d.ts +80 -0
- package/lib/types/quota.d.ts +94 -0
- package/lib/types/session-list.d.ts +13 -0
- package/lib/types/term-text.d.ts +130 -0
- package/lib/types/tool-present.d.ts +165 -0
- package/lib/types/transcript-types.d.ts +152 -0
- package/lib/types/tui.d.ts +39 -665
- package/package.json +1 -1
package/lib/types/tui.d.ts
CHANGED
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* write of dirty rows only — jump-host / proxied SSH should see one packet
|
|
10
10
|
* per paint, not one per line. Cadence is DSH_TUI_PAINT_MS, else local 80 ms
|
|
11
11
|
* or an SSH tier from a CSI 6n round-trip (default 160 ms).
|
|
12
|
+
*
|
|
13
|
+
* Pure helpers live next to this file (`term-text`, `paint`, `footer`,
|
|
14
|
+
* `quota`, `plan`, `tool-present`) and are re-exported here so existing
|
|
15
|
+
* `lib/tui.js` imports keep working. The launch picker imports `paint` /
|
|
16
|
+
* `term-text` directly and does not load this module.
|
|
12
17
|
*/
|
|
13
18
|
import type { Agent, ModelSelection, ModelSelectionRef } from '@deepseek-ai/dsh-agent';
|
|
14
19
|
import type { Context } from '@deepseek-ai/cordis';
|
|
@@ -17,7 +22,15 @@ import { SessionId, type SessionEvent } from '@deepseek-ai/dsh-session';
|
|
|
17
22
|
import type { SubagentRunEndInfo, SubagentRunInfo } from '@deepseek-ai/dsh-subagent';
|
|
18
23
|
import { type SubagentSelectionRef } from './subagent-model.js';
|
|
19
24
|
import { type AskUserQuestionAnswer, type AskUserQuestionRequest } from '@deepseek-ai/dsh-user-questions';
|
|
20
|
-
|
|
25
|
+
import type { ApprovalOutcome, ApprovalRequest } from '@deepseek-ai/dsh-user-approval';
|
|
26
|
+
import type { CollapsibleBlock, DisconnectPolicyName } from './transcript-types.js';
|
|
27
|
+
export type { CollapsibleBlock, DisplayKind, DisconnectPolicyName, PlanTodoItem, Row, SubagentLogEntry, ToolDiffHunk, } from './transcript-types.js';
|
|
28
|
+
export { clipAnsiToWidth, displayWidth, foldInputView, fmtElapsedCompact, padAnsiToWidth, padToWidth, renderMarkdownLines, repeatToWidth, shimmerText, truncateToWidth, visibleWidth, waitCardCopy, waitSummaryFromReasoning, wrapWaitDetails, } from './term-text.js';
|
|
29
|
+
export { captureHangupSignals, composePaintOutput, detectSshSession, formatLinkQualityChip, ignoreFurtherHangupSignals, isEscapePrefix, isHangupErrno, linkQualityOf, linkSignalPips, paintIntervalForRtt, paintLinkLabel, parseCursorPositionReply, pickerWindowStart, probeTerminalRttMs, releaseHangupSignals, resolvePaintIntervalMs, waitUntilIdleOrTimeout, type LinkQuality, type PaintLinkKind, } from './paint.js';
|
|
30
|
+
export { CONTEXT_IDLE_COMPACT_RATIO, CONTEXT_PRESSURE_DANGER_RATIO, CONTEXT_PRESSURE_WARN_RATIO, CONTEXT_RING_EMPTY, CONTEXT_RING_SEGMENTS, contextPressureAlertText, contextPressureRingColor, contextPressureUsedTokens, contextPressureView, describeProviderRoute, dropFooterQuotaPlanName, fitFooterStatsLine, fitFooterStatusLine, footerActivity, footerIdentityParts, footerStatsGroups, formatContextPressureChip, formatContextPressureRing, formatContextPressureStatusLine, formatDuration, formatFooterQuota, formatQuotaBar, formatStatusReport, formatTokens, formatTokensPerSecond, parseContextPressure, promptPressureTokens, providerShortCode, providerUsesLocalOAuth, shouldIdleAutoCompact, type ContextPressureSample, type ContextPressureView, type FooterActivityKind, type FooterStatsInput, type FooterStatusInput, type StatusReportInput, } from './footer.js';
|
|
31
|
+
export { crossedQuotaThresholds, formatAccountBalance, formatFooterBalance, formatOpenCodeGoUsage, formatQuotaSnapshot, formatQuotaStatusLine, joinUrl, openCodeSourceFor, parseDeepSeekBalance, parseOpenAiCompatibleBalance, parseOpenCodeGoQuota, parseSuperGrokBilling, quotaAlertText, quotaRefreshEverySteps, quotaRefreshEveryTurns, remainingPercentFromUsed, tightestQuotaWindow, type AccountBalanceLine, type AccountBalanceSnapshot, type OpenCodeFlavor, type OpenCodeSource, type QuotaPeriod, type QuotaSnapshot, type QuotaWindow, } from './quota.js';
|
|
32
|
+
export { applyTurnEndToPlan, askSummary, cardCategoryOf, compactionHeaderText, formatCompactCommandError, isPromptInjectionMessage, matchTranscriptRows, parseFindQuery, parsePlanTodos, planCloseNudgeText, planDockNote, planIsLive, planTitleFromMarkdown, planTurnLeftOpen, promptInjectionSources, promptInjectionTitle, subagentHeaderText, todoProgressLabel, todoSummary, type CardCategory, } from './plan.js';
|
|
33
|
+
export { buildToolHeader, canMergeToolCall, compactEditPath, compactToolBursts, compactToolGroups, countDiffAddDel, countDiffLines, countOutputLines, diffMetaDiffs, diffStatToken, friendlyJsonLines, parseExitStatus, presentToolCall, READ_TOOL_NAMES, renderToolDiff, toolBodyFitsWorkspace, toolBodyLines, toolStateColor, toolStateLabel, wrappedToolBodyLineCount, } from './tool-present.js';
|
|
21
34
|
/** Presentation configuration for the terminal channel. */
|
|
22
35
|
export interface TuiConfig {
|
|
23
36
|
/** Exact shared agent/session identity driven by this terminal. */
|
|
@@ -69,489 +82,13 @@ export interface TuiConfig {
|
|
|
69
82
|
/** Hangup policy while busy: pause cancels the turn; continue lets it finish detached. Idle hangup always exits. */
|
|
70
83
|
disconnectPolicy?: DisconnectPolicyName;
|
|
71
84
|
}
|
|
72
|
-
type SubagentLogKind = 'user' | 'assistant' | 'tool' | 'result' | 'turn' | 'approval' | 'team' | 'system';
|
|
73
|
-
/** One child-session event folded into a parent-side subagent card. */
|
|
74
|
-
export interface SubagentLogEntry {
|
|
75
|
-
kind: SubagentLogKind;
|
|
76
|
-
text: string;
|
|
77
|
-
}
|
|
78
|
-
/** One todo-list item as the plan card renders it. */
|
|
79
|
-
export interface PlanTodoItem {
|
|
80
|
-
content: string;
|
|
81
|
-
status: 'pending' | 'in_progress' | 'completed';
|
|
82
|
-
}
|
|
83
|
-
type Row = {
|
|
84
|
-
kind: 'user';
|
|
85
|
-
text: string;
|
|
86
|
-
} | {
|
|
87
|
-
kind: 'assistant';
|
|
88
|
-
text: string;
|
|
89
|
-
} | {
|
|
90
|
-
kind: 'reasoning';
|
|
91
|
-
text: string;
|
|
92
|
-
expanded: boolean;
|
|
93
|
-
} | {
|
|
94
|
-
kind: 'brand';
|
|
95
|
-
text: string;
|
|
96
|
-
} | {
|
|
97
|
-
kind: 'brand-logo';
|
|
98
|
-
} | {
|
|
99
|
-
kind: 'tool';
|
|
100
|
-
callId: string;
|
|
101
|
-
name: string;
|
|
102
|
-
args: string;
|
|
103
|
-
status?: 'running' | 'ok' | 'error';
|
|
104
|
-
output: string;
|
|
105
|
-
title: string;
|
|
106
|
-
summary: string;
|
|
107
|
-
command?: string;
|
|
108
|
-
cwd?: string;
|
|
109
|
-
diff?: ToolDiffHunk[];
|
|
110
|
-
exitCode?: number;
|
|
111
|
-
signal?: string;
|
|
112
|
-
expanded: boolean;
|
|
113
|
-
/** Consecutive same-path reads/edits folded into this card. */
|
|
114
|
-
repeats?: number;
|
|
115
|
-
/** Sum of output characters across folded reads. */
|
|
116
|
-
totalChars?: number;
|
|
117
|
-
/** Sum of output lines across folded reads. */
|
|
118
|
-
totalLines?: number;
|
|
119
|
-
/** Flip-card animation until this timestamp (ms since epoch). */
|
|
120
|
-
flipUntil?: number;
|
|
121
|
-
} | {
|
|
122
|
-
kind: 'subagent';
|
|
123
|
-
sessionId: string;
|
|
124
|
-
runId: string;
|
|
125
|
-
provider: string;
|
|
126
|
-
local: boolean;
|
|
127
|
-
label: string;
|
|
128
|
-
status: 'running' | 'ok' | 'error' | 'aborted';
|
|
129
|
-
startedAt: number;
|
|
130
|
-
endedAt?: number;
|
|
131
|
-
stopReason?: string;
|
|
132
|
-
lastActivity: string;
|
|
133
|
-
logs: SubagentLogEntry[];
|
|
134
|
-
expanded: boolean;
|
|
135
|
-
} | {
|
|
136
|
-
kind: 'plan';
|
|
137
|
-
active: boolean;
|
|
138
|
-
pending: boolean;
|
|
139
|
-
todos: PlanTodoItem[];
|
|
140
|
-
planMarkdown?: string;
|
|
141
|
-
expanded: boolean;
|
|
142
|
-
/** When true the plan stays in the scrolling transcript, not the dock. */
|
|
143
|
-
archived?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Display-only: the last turn ended while todos were still open.
|
|
146
|
-
* Does not rewrite the session log.
|
|
147
|
-
*/
|
|
148
|
-
turnLeftOpen?: boolean;
|
|
149
|
-
} | {
|
|
150
|
-
kind: 'question';
|
|
151
|
-
questionId: string;
|
|
152
|
-
title: string;
|
|
153
|
-
header?: string;
|
|
154
|
-
detail?: string;
|
|
155
|
-
intent: 'ask' | 'plan-review';
|
|
156
|
-
status: 'waiting' | 'answered' | 'cancelled';
|
|
157
|
-
summary: string;
|
|
158
|
-
expanded: boolean;
|
|
159
|
-
} | {
|
|
160
|
-
kind: 'goal';
|
|
161
|
-
objective: string;
|
|
162
|
-
phase: 'active' | 'paused' | 'blocked' | 'complete' | 'cleared';
|
|
163
|
-
blockedReason?: string;
|
|
164
|
-
expanded: boolean;
|
|
165
|
-
} | {
|
|
166
|
-
kind: 'compaction';
|
|
167
|
-
compactionId: string;
|
|
168
|
-
status: 'running' | 'ok' | 'error';
|
|
169
|
-
startedAt: number;
|
|
170
|
-
endedAt?: number;
|
|
171
|
-
pruneCount: number;
|
|
172
|
-
prunedTokens: number;
|
|
173
|
-
summary?: string;
|
|
174
|
-
error?: string;
|
|
175
|
-
expanded: boolean;
|
|
176
|
-
} | {
|
|
177
|
-
kind: 'prompt';
|
|
178
|
-
sources: string[];
|
|
179
|
-
text: string;
|
|
180
|
-
plugin?: string;
|
|
181
|
-
expanded: boolean;
|
|
182
|
-
} | {
|
|
183
|
-
kind: 'system';
|
|
184
|
-
text: string;
|
|
185
|
-
} | {
|
|
186
|
-
kind: 'error';
|
|
187
|
-
text: string;
|
|
188
|
-
};
|
|
189
|
-
/** A reasoning/tool/subagent/plan row or the live streaming-reasoning block. */
|
|
190
|
-
type CollapsibleBlock = Extract<Row, {
|
|
191
|
-
kind: 'reasoning';
|
|
192
|
-
} | {
|
|
193
|
-
kind: 'tool';
|
|
194
|
-
} | {
|
|
195
|
-
kind: 'subagent';
|
|
196
|
-
} | {
|
|
197
|
-
kind: 'plan';
|
|
198
|
-
} | {
|
|
199
|
-
kind: 'question';
|
|
200
|
-
} | {
|
|
201
|
-
kind: 'goal';
|
|
202
|
-
} | {
|
|
203
|
-
kind: 'compaction';
|
|
204
|
-
} | {
|
|
205
|
-
kind: 'prompt';
|
|
206
|
-
}> | {
|
|
207
|
-
kind: 'streaming-reasoning';
|
|
208
|
-
expanded: boolean;
|
|
209
|
-
};
|
|
210
|
-
type DisplayKind = Row['kind'] | 'tool-result' | 'diff-add' | 'diff-del' | 'diff-path' | 'todo-done' | 'todo-active' | 'todo-pending' | 'plan-dock';
|
|
211
|
-
/** One file's change, matching the web diff-card contract (`card: 'diff'`). */
|
|
212
|
-
interface ToolDiffHunk {
|
|
213
|
-
path: string;
|
|
214
|
-
oldText: string | null;
|
|
215
|
-
newText: string;
|
|
216
|
-
}
|
|
217
85
|
/** Lifecycle handle for a mounted interactive terminal channel. */
|
|
218
86
|
export interface TuiController {
|
|
219
87
|
dispose(): Promise<void>;
|
|
220
88
|
handleHangup(): Promise<void>;
|
|
221
89
|
disconnectPolicy(): DisconnectPolicyName;
|
|
222
90
|
}
|
|
223
|
-
export type PaintLinkKind = 'local' | 'ssh';
|
|
224
|
-
/** Compact token count, matching the web stats line (517 / 12.2K / 1.2M). */
|
|
225
|
-
export declare function formatTokens(n: number): string;
|
|
226
|
-
/** Compact duration, matching the web stats line (45.2s / 2m42s). */
|
|
227
|
-
export declare function formatDuration(ms: number): string;
|
|
228
|
-
export declare function formatTokensPerSecond(tokensPerSecond: number): string;
|
|
229
|
-
/**
|
|
230
|
-
* Explicit env/config always wins. Otherwise local TTYs stay snappy and SSH
|
|
231
|
-
* sessions pick a tier from a measured round-trip (CSI 6n), falling back to
|
|
232
|
-
* 160 ms when the probe is missing.
|
|
233
|
-
*/
|
|
234
|
-
export declare function resolvePaintIntervalMs(configured?: number, env?: NodeJS.ProcessEnv, options?: {
|
|
235
|
-
ssh?: boolean;
|
|
236
|
-
rttMs?: number;
|
|
237
|
-
}): number;
|
|
238
|
-
/** True when this process is attached to an SSH session (jump host / proxy). */
|
|
239
|
-
export declare function detectSshSession(env?: NodeJS.ProcessEnv): boolean;
|
|
240
|
-
/** Node errno on a write/close that means the TTY is gone (SSH drop, HUP). */
|
|
241
|
-
export declare function isHangupErrno(error: unknown): boolean;
|
|
242
|
-
/**
|
|
243
|
-
* Replace launcher SIGTERM/SIGINT/SIGHUP handlers with `handler`. SSH drop
|
|
244
|
-
* otherwise lets `dsh` dispose the whole tree before this plugin can detach.
|
|
245
|
-
*/
|
|
246
|
-
export declare function captureHangupSignals(handler: () => void): void;
|
|
247
|
-
export declare function releaseHangupSignals(handler: () => void): void;
|
|
248
|
-
/** After detach, extra HUP/TERM from sshd must not kill the leftover Host. */
|
|
249
|
-
export declare function ignoreFurtherHangupSignals(): void;
|
|
250
|
-
/**
|
|
251
|
-
* Wait until `isIdle` is true or `timeoutMs` elapses. Used after cancel so a
|
|
252
|
-
* hangup can flush a settled session log instead of tearing a live write.
|
|
253
|
-
*/
|
|
254
|
-
export declare function waitUntilIdleOrTimeout(isIdle: () => boolean, timeoutMs: number, now?: () => number, wait?: (ms: number) => Promise<void>): Promise<'idle' | 'timeout'>;
|
|
255
|
-
/** Map a CSI-6n round-trip to a paint cadence. Unknown RTT uses the SSH default. */
|
|
256
|
-
export declare function paintIntervalForRtt(rttMs: number | undefined): number;
|
|
257
|
-
export declare function paintLinkLabel(kind: PaintLinkKind, intervalMs: number, probed: boolean): string;
|
|
258
|
-
export type LinkQuality = 'local' | 'good' | 'ok' | 'slow' | 'poor' | 'unknown';
|
|
259
|
-
/** Signal-bar quality from a measured SSH round-trip, or local TTY. */
|
|
260
|
-
export declare function linkQualityOf(kind: PaintLinkKind, rttMs: number | undefined): LinkQuality;
|
|
261
|
-
/** How many filled signal pips: 4 local/fast, 3 ok, 2 slow, 1 poor, 0 unknown. */
|
|
262
|
-
export declare function linkSignalPips(quality: LinkQuality): number;
|
|
263
|
-
/** Compact footer chip: `SSH ●●●○ 90ms` — 1 pip red, 2 yellow, 3+ green. */
|
|
264
|
-
export declare function formatLinkQualityChip(kind: PaintLinkKind, intervalMs: number, rttMs: number | undefined, probed: boolean, color?: boolean): string;
|
|
265
|
-
export declare function providerShortCode(provider: string): string;
|
|
266
|
-
export interface FooterStatsInput {
|
|
267
|
-
turns: number;
|
|
268
|
-
steps: number;
|
|
269
|
-
llmMs: number;
|
|
270
|
-
toolMs: number;
|
|
271
|
-
ttftMs: number;
|
|
272
|
-
ttftSteps: number;
|
|
273
|
-
decodeMs: number;
|
|
274
|
-
decodeTokens: number;
|
|
275
|
-
inputTokens: number;
|
|
276
|
-
outputTokens: number;
|
|
277
|
-
cacheReadTokens: number;
|
|
278
|
-
cacheWriteTokens: number;
|
|
279
|
-
}
|
|
280
|
-
/** Stats groups in drop order (last is dropped first when the row is too wide). */
|
|
281
|
-
export declare function footerStatsGroups(stats: FooterStatsInput): string[];
|
|
282
|
-
export declare function fitFooterStatsLine(chip: string, groups: readonly string[], width: number): string;
|
|
283
|
-
export type FooterActivityKind = 'plan-review' | 'waiting' | 'compacting' | 'retry' | 'subagents' | 'tools' | 'plan-open' | 'plan-pending' | 'goal' | 'waiting-llm' | 'idle';
|
|
284
|
-
export interface FooterStatusInput {
|
|
285
|
-
running: boolean;
|
|
286
|
-
planReview: boolean;
|
|
287
|
-
waitingQuestion: boolean;
|
|
288
|
-
compacting: boolean;
|
|
289
|
-
retry?: {
|
|
290
|
-
retry: number;
|
|
291
|
-
maxRetries: number;
|
|
292
|
-
};
|
|
293
|
-
subagents: number;
|
|
294
|
-
tools: number;
|
|
295
|
-
planLeftOpen: boolean;
|
|
296
|
-
planPending: boolean;
|
|
297
|
-
planActive: boolean;
|
|
298
|
-
goalPhase?: 'active' | 'paused' | 'blocked';
|
|
299
|
-
idleMs: number;
|
|
300
|
-
model: string;
|
|
301
|
-
effort?: string;
|
|
302
|
-
preset?: string;
|
|
303
|
-
provider: string;
|
|
304
|
-
parentModel: string;
|
|
305
|
-
subModel: string;
|
|
306
|
-
subDiffers: boolean;
|
|
307
|
-
quotaCode?: string;
|
|
308
|
-
quotaPercent?: number;
|
|
309
|
-
balanceText?: string;
|
|
310
|
-
search?: {
|
|
311
|
-
index: number;
|
|
312
|
-
total: number;
|
|
313
|
-
};
|
|
314
|
-
foldedInput: boolean;
|
|
315
|
-
multiLineInput: boolean;
|
|
316
|
-
queued: number;
|
|
317
|
-
cwdLabel?: string;
|
|
318
|
-
compactView?: boolean;
|
|
319
|
-
}
|
|
320
|
-
export declare function footerActivity(input: FooterStatusInput): {
|
|
321
|
-
kind: FooterActivityKind;
|
|
322
|
-
text: string;
|
|
323
|
-
};
|
|
324
|
-
/** Short remaining-quota bar: 8 pips, filled from the left. */
|
|
325
|
-
export declare function formatQuotaBar(remainingPercent: number, width?: number): string;
|
|
326
|
-
export declare function footerIdentityParts(input: FooterStatusInput): string[];
|
|
327
|
-
/** `SuperGrok ███████░ 82%`, or just the bar + percent when `code` is omitted. */
|
|
328
|
-
export declare function formatFooterQuota(percent: number, code?: string): string;
|
|
329
|
-
/**
|
|
330
|
-
* Drop the Go / SuperGrok plan name from a quota identity part, keeping the
|
|
331
|
-
* remaining-percent bar. Returns true when a part was rewritten.
|
|
332
|
-
*/
|
|
333
|
-
export declare function dropFooterQuotaPlanName(parts: string[]): boolean;
|
|
334
|
-
export declare function fitFooterStatusLine(activity: string, identity: readonly string[], width: number): string;
|
|
335
|
-
/** One incremental paint as a single stdout write (one SSH packet when corked). */
|
|
336
|
-
export declare function composePaintOutput(options: {
|
|
337
|
-
width: number;
|
|
338
|
-
height: number;
|
|
339
|
-
paintRows: readonly string[];
|
|
340
|
-
previousRows: readonly string[];
|
|
341
|
-
sizeChanged: boolean;
|
|
342
|
-
chromeChanged: boolean;
|
|
343
|
-
chromeStart: number;
|
|
344
|
-
previousChromeStart?: number;
|
|
345
|
-
cursorRow: number;
|
|
346
|
-
cursorColumn: number;
|
|
347
|
-
}): string;
|
|
348
|
-
export interface StatusReportInput {
|
|
349
|
-
sessionId: string;
|
|
350
|
-
pluginVersion: string;
|
|
351
|
-
provider: string;
|
|
352
|
-
model: string;
|
|
353
|
-
effort?: string;
|
|
354
|
-
agentStatus: string;
|
|
355
|
-
preset: string;
|
|
356
|
-
activeSubagents: number;
|
|
357
|
-
plan: 'off' | 'pending' | 'on';
|
|
358
|
-
paint: string;
|
|
359
|
-
disconnect?: DisconnectPolicyName;
|
|
360
|
-
waitingQuestions: number;
|
|
361
|
-
quota?: QuotaSnapshot;
|
|
362
|
-
parentModel?: string;
|
|
363
|
-
subProvider?: string;
|
|
364
|
-
subModel: string;
|
|
365
|
-
cwd?: string;
|
|
366
|
-
}
|
|
367
|
-
/** Lines printed by `/status` — SSH first-boot diagnostics, no extra command. */
|
|
368
|
-
export declare function formatStatusReport(input: StatusReportInput): string[];
|
|
369
|
-
/** Human-facing kind for a live LLM route. */
|
|
370
|
-
export declare function describeProviderRoute(provider: string): {
|
|
371
|
-
kind: string;
|
|
372
|
-
short: string;
|
|
373
|
-
};
|
|
374
|
-
/** Routes that authenticate without a harness API-key credential. */
|
|
375
|
-
export declare function providerUsesLocalOAuth(provider: string): boolean;
|
|
376
|
-
/**
|
|
377
|
-
* Terminal cell width for one string.
|
|
378
|
-
*
|
|
379
|
-
* Match glibc wcwidth / typical UTF-8 SSH terminals: CJK ideographs and
|
|
380
|
-
* fullwidth forms occupy two cells; East-Asian Ambiguous box-drawing and
|
|
381
|
-
* ornaments (`─`, `●`, `·`, `▸`, `❯`, Braille spinners) occupy one. Counting
|
|
382
|
-
* those ambiguous glyphs as two made `repeatToWidth('─', cols)` paint a
|
|
383
|
-
* half-width rule and parked the input cursor half a cell past the text.
|
|
384
|
-
*
|
|
385
|
-
* Overflow into the input box is handled by clipping/padding painted rows to
|
|
386
|
-
* the measured column count, not by inflating glyph width.
|
|
387
|
-
*/
|
|
388
|
-
/**
|
|
389
|
-
* Codex-style compact elapsed: `0s`, `1m 05s`, `1h 01m 01s`.
|
|
390
|
-
* Used by the workspace wait card while the model has not streamed yet.
|
|
391
|
-
*/
|
|
392
|
-
export declare function fmtElapsedCompact(elapsedSecs: number): string;
|
|
393
|
-
/**
|
|
394
|
-
* Sweep highlight across `text` (Codex `shimmer.rs`). Truecolor blends a
|
|
395
|
-
* highlight band; otherwise DIM / default / BOLD. Process-start based so
|
|
396
|
-
* every paint of the same frame stays in phase.
|
|
397
|
-
*/
|
|
398
|
-
export declare function shimmerText(text: string, nowMs: number, color: boolean): string;
|
|
399
|
-
/**
|
|
400
|
-
* Codex `extract_first_bold`: the first **closed** `**bold**` in the thinking
|
|
401
|
-
* stream, else the first markdown heading. An unclosed `**` means the title
|
|
402
|
-
* has not arrived yet, so return undefined and keep the default header —
|
|
403
|
-
* never fall back to hard-truncated reasoning, reply, or prompt text.
|
|
404
|
-
*/
|
|
405
|
-
export declare function waitSummaryFromReasoning(text: string): string | undefined;
|
|
406
|
-
/** Wait-card header + optional detail. Header tracks model work when known. */
|
|
407
|
-
export declare function waitCardCopy(input: {
|
|
408
|
-
toolTitle?: string;
|
|
409
|
-
toolSummary?: string;
|
|
410
|
-
reasoning?: string;
|
|
411
|
-
}): {
|
|
412
|
-
header: string;
|
|
413
|
-
detail?: string;
|
|
414
|
-
};
|
|
415
|
-
/**
|
|
416
|
-
* Codex `wrapped_details_lines`: word-wrap the wait-card detail under the
|
|
417
|
-
* ` └ ` prefix, continue wrapped rows at the prefix width, cap at 3 rows and
|
|
418
|
-
* end the last one with an ellipsis when the text does not fit.
|
|
419
|
-
*/
|
|
420
|
-
export declare function wrapWaitDetails(detail: string, width: number, maxLines?: number): string[];
|
|
421
|
-
export declare function displayWidth(text: string): number;
|
|
422
|
-
/** Pad or clip one already-sanitized line so it occupies exactly `width` cells. */
|
|
423
|
-
export declare function padToWidth(text: string, width: number): string;
|
|
424
|
-
/**
|
|
425
|
-
* Pad an already-styled ANSI line to `width` cells without resetting SGR.
|
|
426
|
-
* Diff add/del rows keep their background across the whole terminal row
|
|
427
|
-
* instead of only the glyphs.
|
|
428
|
-
*/
|
|
429
|
-
export declare function padAnsiToWidth(text: string, width: number): string;
|
|
430
|
-
/** Visible width of an ANSI-styled line, ignoring CSI / OSC sequences. */
|
|
431
|
-
export declare function visibleWidth(text: string): number;
|
|
432
|
-
/** Repeat a glyph until it occupies exactly `width` cells. */
|
|
433
|
-
export declare function repeatToWidth(glyph: string, width: number): string;
|
|
434
|
-
/** One colored span inside a tool-card header line. Offsets are UTF-16 char indices. */
|
|
435
|
-
interface TextSegment {
|
|
436
|
-
start: number;
|
|
437
|
-
end: number;
|
|
438
|
-
sgr: string;
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Render workspace markdown into width-bounded terminal rows. Assistant
|
|
442
|
-
* replies get a bold-white base; code blocks, headings, quotes, lists, rules,
|
|
443
|
-
* links and inline spans keep their own ANSI treatment.
|
|
444
|
-
*/
|
|
445
|
-
export declare function renderMarkdownLines(text: string, width: number, color: boolean): string[];
|
|
446
|
-
/** Cut one line to fit a width, appending an ellipsis when truncated. */
|
|
447
|
-
export declare function truncateToWidth(text: string, width: number): string;
|
|
448
|
-
/**
|
|
449
|
-
* Clip an already-styled ANSI line to `width` terminal cells without dropping
|
|
450
|
-
* the reset/SGR sequences. Used by the incremental painter so a leftover wide
|
|
451
|
-
* glyph cannot wrap into the next row.
|
|
452
|
-
*/
|
|
453
|
-
export declare function clipAnsiToWidth(text: string, width: number): string;
|
|
454
|
-
/** One renderable view of the input line: text plus the cursor's visual offset. */
|
|
455
|
-
interface InputView {
|
|
456
|
-
text: string;
|
|
457
|
-
cursorOffset: number;
|
|
458
|
-
folded: boolean;
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Fold a long input into one terminal row around the cursor.
|
|
462
|
-
*
|
|
463
|
-
* Newlines from a paste are display-only: they do not occupy cells, so a
|
|
464
|
-
* naive `displayWidth(input)` under-counts a multi-line paste and parks the
|
|
465
|
-
* caret in the middle of later text. Fold the *current line* (between the
|
|
466
|
-
* surrounding newlines) and keep `\n` out of the visible slice.
|
|
467
|
-
*/
|
|
468
|
-
export declare function foldInputView(input: string, cursor: number, maxWidth: number): InputView;
|
|
469
|
-
/** A recognized OpenCode provider route, used by /usage and /quota. */
|
|
470
|
-
export type OpenCodeFlavor = 'zen' | 'go';
|
|
471
|
-
export interface OpenCodeSource {
|
|
472
|
-
provider: string;
|
|
473
|
-
flavor: OpenCodeFlavor;
|
|
474
|
-
label: string;
|
|
475
|
-
apiKeyEnv: string;
|
|
476
|
-
baseURL?: string;
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* Classify the currently selected provider as an OpenCode route. Built-in
|
|
480
|
-
* `opencode`/`opencode-go` ids are recognized directly, and custom llm-pi-ai
|
|
481
|
-
* routes are recognized by their `opencode.ai` base URL.
|
|
482
|
-
*/
|
|
483
|
-
export declare function openCodeSourceFor(provider: string, llmPiAiSection: unknown): OpenCodeSource | null;
|
|
484
|
-
export type QuotaPeriod = 'hourly' | 'weekly' | 'monthly' | 'unknown';
|
|
485
|
-
export interface QuotaWindow {
|
|
486
|
-
label: string;
|
|
487
|
-
period: QuotaPeriod;
|
|
488
|
-
/** Remaining percent of the window (100 = unused). */
|
|
489
|
-
remainingPercent: number;
|
|
490
|
-
resetsAt?: string;
|
|
491
|
-
}
|
|
492
|
-
export interface QuotaSnapshot {
|
|
493
|
-
provider: string;
|
|
494
|
-
plan: string;
|
|
495
|
-
windows: QuotaWindow[];
|
|
496
|
-
}
|
|
497
|
-
export declare function remainingPercentFromUsed(usedPercent: number): number;
|
|
498
|
-
/** Cross a remaining-percent threshold from above (50 / 25 / 10 / 5).
|
|
499
|
-
* Only the tightest (lowest) crossed threshold is returned, so one drop
|
|
500
|
-
* never paints 50/25/10 as three identical warnings. */
|
|
501
|
-
export declare function crossedQuotaThresholds(previousRemaining: number | undefined, remaining: number): number[];
|
|
502
|
-
export declare function quotaAlertText(snapshot: QuotaSnapshot, window: QuotaWindow): string;
|
|
503
|
-
/**
|
|
504
|
-
* How often to re-fetch quota or prepaid balance, counted in model steps.
|
|
505
|
-
* Default is every 10 steps. Near a remaining-percent threshold, hourly
|
|
506
|
-
* windows refresh every 4 steps.
|
|
507
|
-
*/
|
|
508
|
-
export declare function quotaRefreshEverySteps(window: QuotaWindow | undefined): number;
|
|
509
|
-
/** @deprecated Same cadence as {@link quotaRefreshEverySteps}; the name predates step accounting. */
|
|
510
|
-
export declare const quotaRefreshEveryTurns: typeof quotaRefreshEverySteps;
|
|
511
|
-
export declare function parseSuperGrokBilling(payload: unknown): QuotaSnapshot;
|
|
512
|
-
export declare function parseOpenCodeGoQuota(payload: unknown, provider: string): QuotaSnapshot;
|
|
513
|
-
export declare function formatQuotaSnapshot(snapshot: QuotaSnapshot): string;
|
|
514
|
-
/** Compact `/status` quota line: tightest window first, then the rest. */
|
|
515
|
-
export declare function formatQuotaStatusLine(snapshot: QuotaSnapshot | undefined): string;
|
|
516
|
-
/** Tightest remaining window — used for threshold alerts. */
|
|
517
|
-
export declare function tightestQuotaWindow(snapshot: QuotaSnapshot): QuotaWindow | undefined;
|
|
518
|
-
/** Render the OpenCode Go quota payload as a transcript block. */
|
|
519
|
-
export declare function formatOpenCodeGoUsage(payload: unknown, source: OpenCodeSource): string;
|
|
520
|
-
export interface AccountBalanceLine {
|
|
521
|
-
label: string;
|
|
522
|
-
amount: string;
|
|
523
|
-
currency?: string;
|
|
524
|
-
}
|
|
525
|
-
export interface AccountBalanceSnapshot {
|
|
526
|
-
provider: string;
|
|
527
|
-
plan: string;
|
|
528
|
-
available?: boolean;
|
|
529
|
-
lines: AccountBalanceLine[];
|
|
530
|
-
sourcePath?: string;
|
|
531
|
-
}
|
|
532
|
-
export declare function joinUrl(base: string, path: string): string;
|
|
533
|
-
export declare function parseDeepSeekBalance(payload: unknown, provider?: string): AccountBalanceSnapshot;
|
|
534
|
-
/** Best-effort parse of OpenAI-compatible credit/balance JSON. */
|
|
535
|
-
export declare function parseOpenAiCompatibleBalance(payload: unknown, provider: string, path: string): AccountBalanceSnapshot | undefined;
|
|
536
|
-
/** Compact footer chip: `余额 86.42 CNY`. Prefers remaining/available lines. */
|
|
537
|
-
export declare function formatFooterBalance(snapshot: AccountBalanceSnapshot): string | undefined;
|
|
538
|
-
export declare function formatAccountBalance(snapshot: AccountBalanceSnapshot): string;
|
|
539
|
-
/** Whether `text` could still grow into a recognized escape sequence. */
|
|
540
|
-
export declare function isEscapePrefix(text: string): boolean;
|
|
541
|
-
/** Parse a Device Status Report cursor reply (`CSI row;col R`). */
|
|
542
|
-
export declare function parseCursorPositionReply(text: string): {
|
|
543
|
-
row: number;
|
|
544
|
-
column: number;
|
|
545
|
-
} | undefined;
|
|
546
|
-
/**
|
|
547
|
-
* Round-trip to the attached terminal via CSI 6n. Returns undefined when the
|
|
548
|
-
* reply never arrives (dumb pipe, blocked DSR). Does not interpret the
|
|
549
|
-
* coordinates — only the elapsed milliseconds matter.
|
|
550
|
-
*/
|
|
551
|
-
export declare function probeTerminalRttMs(stdin?: NodeJS.ReadStream, stdout?: NodeJS.WriteStream, timeoutMs?: number): Promise<number | undefined>;
|
|
552
91
|
export type WorkspaceView = 'detailed' | 'compact';
|
|
553
|
-
/** Sliding window of `windowSize` items that keeps `cursor` visible. */
|
|
554
|
-
export declare function pickerWindowStart(cursor: number, total: number, windowSize?: number): number;
|
|
555
92
|
export declare function parseDisconnectPolicy(raw: string): DisconnectPolicyName | undefined;
|
|
556
93
|
/** Parse `/effort high` / `/subeffort default`. Empty or unknown → undefined. */
|
|
557
94
|
export declare function parseEffortArg(raw: string): {
|
|
@@ -561,190 +98,6 @@ export declare function parseEffortArg(raw: string): {
|
|
|
561
98
|
id: string;
|
|
562
99
|
} | undefined;
|
|
563
100
|
export declare function parseWorkspaceView(raw: string): WorkspaceView | undefined;
|
|
564
|
-
export declare function countDiffLines(hunks: readonly ToolDiffHunk[] | undefined): number;
|
|
565
|
-
/** Added / removed line counts for a diff (`oldText: null` means a new file). */
|
|
566
|
-
export declare function countDiffAddDel(hunks: readonly ToolDiffHunk[] | undefined): {
|
|
567
|
-
add: number;
|
|
568
|
-
del: number;
|
|
569
|
-
};
|
|
570
|
-
/**
|
|
571
|
-
* Git diffstat token, deletions first like `-13 +24`. Zero parts drop out
|
|
572
|
-
* (a new file shows only `+24`); empty when the diff has no counted lines.
|
|
573
|
-
*/
|
|
574
|
-
export declare function diffStatToken(add: number, del: number): string;
|
|
575
|
-
export declare function toolTargetPath(name: string, args: string, fallback?: string): string;
|
|
576
|
-
export declare function countOutputLines(text: string): number;
|
|
577
|
-
/**
|
|
578
|
-
* Consecutive same-path reads (or edits) collapse onto one card.
|
|
579
|
-
* A → B → C → A becomes four cards; A ×5 stays one card with repeats=5.
|
|
580
|
-
*/
|
|
581
|
-
export declare function canMergeToolCall(previous: Extract<Row, {
|
|
582
|
-
kind: 'tool';
|
|
583
|
-
}> | undefined, next: {
|
|
584
|
-
name: string;
|
|
585
|
-
args: string;
|
|
586
|
-
}): previous is Extract<Row, {
|
|
587
|
-
kind: 'tool';
|
|
588
|
-
}>;
|
|
589
|
-
export declare function compactToolGroups(tools: readonly Extract<Row, {
|
|
590
|
-
kind: 'tool';
|
|
591
|
-
}>[]): {
|
|
592
|
-
edits: Extract<Row, {
|
|
593
|
-
kind: 'tool';
|
|
594
|
-
}>[];
|
|
595
|
-
calls: Extract<Row, {
|
|
596
|
-
kind: 'tool';
|
|
597
|
-
}>[];
|
|
598
|
-
failedCalls: number;
|
|
599
|
-
};
|
|
600
|
-
/**
|
|
601
|
-
* Split compact-view tools into the bursts that belong with each assistant
|
|
602
|
-
* reply: tools after reply N sit with that reply, until the next reply.
|
|
603
|
-
*/
|
|
604
|
-
export declare function compactToolBursts(rows: readonly Row[]): Array<{
|
|
605
|
-
after: Extract<Row, {
|
|
606
|
-
kind: 'assistant';
|
|
607
|
-
}> | undefined;
|
|
608
|
-
groups: ReturnType<typeof compactToolGroups>;
|
|
609
|
-
}>;
|
|
610
|
-
/** True while a plan still belongs in the dock (latest incomplete work). */
|
|
611
|
-
export declare function planIsLive(plan: {
|
|
612
|
-
active: boolean;
|
|
613
|
-
pending: boolean;
|
|
614
|
-
todos: readonly PlanTodoItem[];
|
|
615
|
-
planMarkdown?: string;
|
|
616
|
-
archived?: boolean;
|
|
617
|
-
}): boolean;
|
|
618
|
-
/** Open todos left behind when a turn ends without a completing todo_write. */
|
|
619
|
-
export declare function planTurnLeftOpen(plan: {
|
|
620
|
-
todos: readonly PlanTodoItem[];
|
|
621
|
-
}): boolean;
|
|
622
|
-
/** Mark leftover in-progress/pending todos as display-stale after turn/end. */
|
|
623
|
-
export declare function applyTurnEndToPlan<T extends {
|
|
624
|
-
todos: PlanTodoItem[];
|
|
625
|
-
turnLeftOpen?: boolean;
|
|
626
|
-
}>(plan: T): T;
|
|
627
|
-
/** Follow-up that asks the model to close leftover todos. One per open list. */
|
|
628
|
-
export declare function planCloseNudgeText(plan: {
|
|
629
|
-
todos: readonly PlanTodoItem[];
|
|
630
|
-
}): string;
|
|
631
|
-
export type CardCategory = 'thinking' | 'plan' | 'subagent' | 'reply' | 'tool' | 'question' | 'goal' | 'prompt';
|
|
632
|
-
/** Category for jump / search. Assistant replies are not collapsible cards. */
|
|
633
|
-
export declare function cardCategoryOf(row: {
|
|
634
|
-
kind: string;
|
|
635
|
-
}): CardCategory | undefined;
|
|
636
|
-
/** Split `/find thinking padAnsi` into an optional category and a query. */
|
|
637
|
-
export declare function parseFindQuery(raw: string): {
|
|
638
|
-
category?: CardCategory;
|
|
639
|
-
query: string;
|
|
640
|
-
};
|
|
641
|
-
/** Classify one injected prompt blob into display sources. */
|
|
642
|
-
export declare function promptInjectionSources(text: string, plugin?: string): string[];
|
|
643
|
-
export declare function promptInjectionTitle(sources: readonly string[]): string;
|
|
644
|
-
export declare function isPromptInjectionMessage(sourceKind: string, text: string, plugin?: string): boolean;
|
|
645
|
-
export declare function compactionHeaderText(row: {
|
|
646
|
-
status: 'running' | 'ok' | 'error';
|
|
647
|
-
pruneCount: number;
|
|
648
|
-
prunedTokens: number;
|
|
649
|
-
error?: string;
|
|
650
|
-
}): string;
|
|
651
|
-
/** Transcript rows matching a `/find` query, newest last. */
|
|
652
|
-
export declare function matchTranscriptRows(rows: readonly Row[], raw: string): Row[];
|
|
653
|
-
/** One-line note under an expanded plan strip. */
|
|
654
|
-
export declare function planDockNote(plan: {
|
|
655
|
-
active: boolean;
|
|
656
|
-
pending: boolean;
|
|
657
|
-
todos: readonly PlanTodoItem[];
|
|
658
|
-
planMarkdown?: string;
|
|
659
|
-
turnLeftOpen?: boolean;
|
|
660
|
-
}): string;
|
|
661
|
-
/** Compact per-status counts matching the web plan strip. */
|
|
662
|
-
export declare function todoProgressLabel(todos: readonly PlanTodoItem[]): string;
|
|
663
|
-
/** First markdown heading of an exit_plan_mode plan body. */
|
|
664
|
-
export declare function planTitleFromMarkdown(markdown: string): string | undefined;
|
|
665
|
-
/** Parse a todo_write payload into displayable plan items. */
|
|
666
|
-
export declare function parsePlanTodos(value: unknown): PlanTodoItem[];
|
|
667
|
-
/** Compact todo-list summary: done/total plus the first in-progress task. */
|
|
668
|
-
export declare function todoSummary(value: unknown): string;
|
|
669
|
-
/** Compact ask_user_question summary from tool arguments. */
|
|
670
|
-
export declare function askSummary(value: unknown): string;
|
|
671
|
-
/** One-line subagent card header used while collapsed. */
|
|
672
|
-
export declare function subagentHeaderText(row: Extract<Row, {
|
|
673
|
-
kind: 'subagent';
|
|
674
|
-
}>, now?: number): string;
|
|
675
|
-
/** One-line friendly tool-call presentation (command / path / arg summary). */
|
|
676
|
-
export declare function presentToolCall(name: string, args: string): {
|
|
677
|
-
title: string;
|
|
678
|
-
summary: string;
|
|
679
|
-
command?: string;
|
|
680
|
-
cwd?: string;
|
|
681
|
-
diff?: ToolDiffHunk[];
|
|
682
|
-
};
|
|
683
|
-
/** Validate a tool/result meta payload's structured diff, mirroring the web card. */
|
|
684
|
-
export declare function diffMetaDiffs(meta: unknown): ToolDiffHunk[] | null;
|
|
685
|
-
/** One rendered diff body line with its display role. */
|
|
686
|
-
interface DiffDisplayLine {
|
|
687
|
-
kind: DisplayKind;
|
|
688
|
-
text: string;
|
|
689
|
-
}
|
|
690
|
-
/** Running / ok / error → ANSI color for the status dot and status word only. */
|
|
691
|
-
export declare function toolStateColor(status: 'running' | 'ok' | 'error' | undefined): '33' | '32' | '31';
|
|
692
|
-
export declare function toolStateLabel(status: 'running' | 'ok' | 'error' | undefined): string;
|
|
693
|
-
/** Header + SGR spans: default title, dim operand, colored ●. `[ok]` is omitted — the green dot is enough. */
|
|
694
|
-
export declare function buildToolHeader(input: {
|
|
695
|
-
focused: boolean;
|
|
696
|
-
expanded: boolean;
|
|
697
|
-
title: string;
|
|
698
|
-
summary: string;
|
|
699
|
-
status?: 'running' | 'ok' | 'error';
|
|
700
|
-
command?: string;
|
|
701
|
-
signal?: string;
|
|
702
|
-
exitCode?: number;
|
|
703
|
-
spinner?: string;
|
|
704
|
-
flipping?: boolean;
|
|
705
|
-
diffStat?: {
|
|
706
|
-
add: number;
|
|
707
|
-
del: number;
|
|
708
|
-
};
|
|
709
|
-
}): {
|
|
710
|
-
plain: string;
|
|
711
|
-
segments: TextSegment[];
|
|
712
|
-
};
|
|
713
|
-
/** How many terminal rows a tool body occupies after wrapping. */
|
|
714
|
-
export declare function wrappedToolBodyLineCount(lines: readonly {
|
|
715
|
-
text: string;
|
|
716
|
-
}[], width: number): number;
|
|
717
|
-
/**
|
|
718
|
-
* True when the full tool body plus a one-line header fits in the workspace
|
|
719
|
-
* (the rows between the title bar and the input chrome). Oversized bodies
|
|
720
|
-
* open a dedicated inspect overlay instead of dumping into the transcript.
|
|
721
|
-
*/
|
|
722
|
-
export declare function toolBodyFitsWorkspace(bodyLines: number, workspaceRows: number): boolean;
|
|
723
|
-
/** Flatten hunks into git-style `-`/`+` lines plus the web-compatible footer. */
|
|
724
|
-
export declare function renderToolDiff(diffs: ToolDiffHunk[], maxLines: number): DiffDisplayLine[];
|
|
725
|
-
/** Convert any parsed JSON value into readable indented display lines. */
|
|
726
|
-
export declare function friendlyJsonLines(value: unknown, depth?: number): string[];
|
|
727
|
-
/** Minimal tool-row shape the expanded-body renderer reads. */
|
|
728
|
-
interface ToolBodySource {
|
|
729
|
-
name?: string;
|
|
730
|
-
diff?: ToolDiffHunk[];
|
|
731
|
-
command?: string;
|
|
732
|
-
status?: 'running' | 'ok' | 'error';
|
|
733
|
-
output: string;
|
|
734
|
-
args: string;
|
|
735
|
-
}
|
|
736
|
-
/**
|
|
737
|
-
* The expanded body of one tool card: diffs and shell output keep their
|
|
738
|
-
* dedicated views; every other tool's JSON arguments and JSON result are
|
|
739
|
-
* converted into readable indented content instead of raw JSON text.
|
|
740
|
-
*/
|
|
741
|
-
export declare function toolBodyLines(row: ToolBodySource, maxLines: number): DiffDisplayLine[];
|
|
742
|
-
/** Recover the shell tools' exit marker, mirroring @deepseek-ai/dsh-shell/render. */
|
|
743
|
-
export declare function parseExitStatus(text: string): {
|
|
744
|
-
body: string;
|
|
745
|
-
exitCode?: number;
|
|
746
|
-
signal?: string;
|
|
747
|
-
};
|
|
748
101
|
/** Owns one interactive terminal channel and its agent event wiring. */
|
|
749
102
|
export declare class SshTui {
|
|
750
103
|
private readonly ctx;
|
|
@@ -822,6 +175,8 @@ export declare class SshTui {
|
|
|
822
175
|
private activeSubagents;
|
|
823
176
|
private subagentSessions;
|
|
824
177
|
private openToolCalls;
|
|
178
|
+
/** Survives result settlement so a card-less result can still be labelled. */
|
|
179
|
+
private toolCallNames;
|
|
825
180
|
private readonly stats;
|
|
826
181
|
private openStepStats;
|
|
827
182
|
private readonly pendingToolTimes;
|
|
@@ -859,6 +214,10 @@ export declare class SshTui {
|
|
|
859
214
|
private quotaAlerted;
|
|
860
215
|
private quotaStepsSinceRefresh;
|
|
861
216
|
private quotaRefreshInFlight;
|
|
217
|
+
private contextPressure;
|
|
218
|
+
private contextAlertLevel;
|
|
219
|
+
private idleCompactInFlight;
|
|
220
|
+
private lastIdleCompactAt;
|
|
862
221
|
private searchHits;
|
|
863
222
|
private searchIndex;
|
|
864
223
|
private searchQuery;
|
|
@@ -936,6 +295,8 @@ export declare class SshTui {
|
|
|
936
295
|
private markDirty;
|
|
937
296
|
private toolCardSummary;
|
|
938
297
|
private mergeIntoToolCard;
|
|
298
|
+
private findToolRowByCallId;
|
|
299
|
+
private findMergeableToolRow;
|
|
939
300
|
/** Append one transcript row, bounding memory on long sessions. */
|
|
940
301
|
private pushRow;
|
|
941
302
|
/** The transcript rows that support per-row expand/collapse. */
|
|
@@ -959,8 +320,8 @@ export declare class SshTui {
|
|
|
959
320
|
private upsertPlanRow;
|
|
960
321
|
/** Whether the live plan strip should occupy the workspace footer. */
|
|
961
322
|
private shouldDockPlan;
|
|
962
|
-
/**
|
|
963
|
-
private
|
|
323
|
+
/** Send the leftover-todo nudge only from true idle, so /compact is not blocked. */
|
|
324
|
+
private flushPlanCloseNudge;
|
|
964
325
|
/** Compact web-style plan strip pinned above the input, not in the transcript. */
|
|
965
326
|
private paintPlanDock;
|
|
966
327
|
private paintToolBodyLine;
|
|
@@ -1022,6 +383,11 @@ export declare class SshTui {
|
|
|
1022
383
|
private handleExtensionEvent;
|
|
1023
384
|
private findCompactionRow;
|
|
1024
385
|
private handleCompactionEvent;
|
|
386
|
+
private readContextPressure;
|
|
387
|
+
private refreshContextPressure;
|
|
388
|
+
private canRunCompactCommand;
|
|
389
|
+
private maybeIdleAutoCompact;
|
|
390
|
+
private dispatchCompactCommand;
|
|
1025
391
|
private handleCommandRun;
|
|
1026
392
|
private formatCommandText;
|
|
1027
393
|
private handleCommandDone;
|
|
@@ -1046,8 +412,17 @@ export declare class SshTui {
|
|
|
1046
412
|
* 'allow' | 'deny', or undefined when the reviewer is unavailable or its
|
|
1047
413
|
* output was unusable (caller falls back to prompt/reject).
|
|
1048
414
|
*/
|
|
415
|
+
private latestUserAuthorizationText;
|
|
1049
416
|
private reviewUnknownWithModel;
|
|
1050
|
-
private
|
|
417
|
+
private recordAutoApproval;
|
|
418
|
+
/**
|
|
419
|
+
* Host ApprovalOutcome cannot carry a reason, so the model only sees
|
|
420
|
+
* `the user rejected tool "bash"`. Steer a plugin notice with the real
|
|
421
|
+
* classifier/reviewer reason. Summary matches the workspace decision row
|
|
422
|
+
* so the handler does not paint the body twice.
|
|
423
|
+
*/
|
|
424
|
+
private tellModelApprovalDenied;
|
|
425
|
+
readonly handleApproval: (request: ApprovalRequest, _next: () => Promise<ApprovalOutcome>) => Promise<ApprovalOutcome>;
|
|
1051
426
|
readonly handleUserQuestions: (request: AskUserQuestionRequest) => Promise<AskUserQuestionAnswer>;
|
|
1052
427
|
/** Queue one dialog behind an already-open one instead of overwriting it. */
|
|
1053
428
|
private openDialog;
|
|
@@ -1201,4 +576,3 @@ export declare class SshTui {
|
|
|
1201
576
|
* @returns lifecycle controller used by the Cordis effect disposer.
|
|
1202
577
|
*/
|
|
1203
578
|
export declare function mountTui(ctx: Context, config: TuiConfig): TuiController;
|
|
1204
|
-
export {};
|