@toddzheng024/dscode-bundle 0.7.11 → 0.7.13
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/THIRD_PARTY_NOTICES.md +3 -3
- package/cordis.patch.yml +1 -1
- package/package.json +5 -4
- package/plugins/i18n/messages.mjs +6 -6
- package/plugins/session-metrics/view.mjs +16 -5
- package/plugins/tui-tools/index.mjs +14 -1
- package/vendor/tui/lib/app.mjs +6674 -0
- package/vendor/tui/lib/approval.mjs +122 -0
- package/vendor/tui/lib/attachments.mjs +218 -0
- package/vendor/tui/lib/authorization-panel.mjs +242 -0
- package/vendor/tui/lib/authorization.mjs +111 -0
- package/vendor/tui/lib/commands.mjs +123 -0
- package/vendor/tui/lib/dscode/chat.mjs +64 -0
- package/vendor/tui/lib/dscode/flags.mjs +32 -0
- package/vendor/tui/lib/dscode/model-search.mjs +68 -0
- package/vendor/tui/lib/dscode/paste.mjs +87 -0
- package/vendor/tui/lib/dscode/telemetry.mjs +82 -0
- package/vendor/tui/lib/dscode/welcome.mjs +100 -0
- package/vendor/tui/lib/editor-keys.mjs +346 -0
- package/vendor/tui/lib/editor.mjs +50 -0
- package/vendor/tui/lib/fork.mjs +24 -0
- package/vendor/tui/lib/git-workflow.mjs +278 -0
- package/vendor/tui/{types/history.d.ts → lib/history.mjs} +69 -26
- package/vendor/tui/{types/i18n.d.ts → lib/i18n.mjs} +23 -15
- package/vendor/tui/lib/index.mjs +2198 -0
- package/vendor/tui/lib/input-split.mjs +170 -0
- package/vendor/tui/lib/internals.mjs +90 -0
- package/vendor/tui/lib/invariant.mjs +22 -0
- package/vendor/tui/lib/kernel-panels.mjs +1265 -0
- package/vendor/tui/lib/keyboard.mjs +283 -0
- package/vendor/tui/lib/language-panel.mjs +41 -0
- package/vendor/tui/lib/locales/en.mjs +495 -0
- package/vendor/tui/lib/locales/zh.mjs +495 -0
- package/vendor/tui/lib/mentions.mjs +150 -0
- package/vendor/tui/lib/model-capabilities.mjs +245 -0
- package/vendor/tui/lib/models.mjs +215 -0
- package/vendor/tui/{types/panel-accent.d.ts → lib/panel-accent.mjs} +11 -7
- package/vendor/tui/lib/permissions.mjs +45 -0
- package/vendor/tui/lib/plugin-inventory.mjs +27 -0
- package/vendor/tui/lib/presets.mjs +46 -0
- package/vendor/tui/lib/provider-settings.mjs +600 -0
- package/vendor/tui/lib/questions.mjs +116 -0
- package/vendor/tui/lib/rainbow.mjs +181 -0
- package/vendor/tui/lib/render/animations.mjs +665 -0
- package/vendor/tui/lib/render/editor.mjs +437 -0
- package/vendor/tui/lib/render/export.mjs +119 -0
- package/vendor/tui/lib/render/fuzzy.mjs +79 -0
- package/vendor/tui/lib/render/ime-cursor.mjs +135 -0
- package/vendor/tui/lib/render/inspector.mjs +93 -0
- package/vendor/tui/lib/render/lines.mjs +538 -0
- package/vendor/tui/lib/render/markdown.mjs +592 -0
- package/vendor/tui/lib/render/projection.mjs +1862 -0
- package/vendor/tui/lib/render/status.mjs +591 -0
- package/vendor/tui/lib/render/text.mjs +157 -0
- package/vendor/tui/lib/render/tool-detail.mjs +187 -0
- package/vendor/tui/lib/render/tool-preview.mjs +79 -0
- package/vendor/tui/lib/render/usage.mjs +336 -0
- package/vendor/tui/lib/render/width.mjs +191 -0
- package/vendor/tui/lib/session-directory.mjs +329 -0
- package/vendor/tui/lib/session-query.mjs +184 -0
- package/vendor/tui/lib/session-switch.mjs +51 -0
- package/vendor/tui/lib/settings-file.mjs +75 -0
- package/vendor/tui/lib/skills.mjs +119 -0
- package/vendor/tui/lib/startup.mjs +111 -0
- package/vendor/tui/lib/store.mjs +129 -0
- package/vendor/tui/lib/subagents.mjs +200 -0
- package/vendor/tui/lib/terminal-title.mjs +186 -0
- package/vendor/tui/lib/theme-panel.mjs +60 -0
- package/vendor/tui/lib/theme.mjs +379 -0
- package/vendor/tui/lib/update-panel.mjs +239 -0
- package/vendor/tui/lib/update.mjs +101 -0
- package/vendor/tui/lib/version.mjs +105 -0
- package/vendor/tui/lib/whale-glyph.mjs +20 -0
- package/vendor/tui/LICENSE +0 -21
- package/vendor/tui/devtools-CdTl3MNy.mjs +0 -3643
- package/vendor/tui/dscode-email/cli.mjs +0 -32
- package/vendor/tui/dscode-email/contacts.mjs +0 -36
- package/vendor/tui/dscode-email/gmail-oauth.mjs +0 -69
- package/vendor/tui/dscode-email/gmail-store.mjs +0 -2
- package/vendor/tui/dscode-email/gmail.mjs +0 -194
- package/vendor/tui/dscode-email/imap.mjs +0 -136
- package/vendor/tui/dscode-email/inbox.d.mts +0 -25
- package/vendor/tui/dscode-email/inbox.mjs +0 -76
- package/vendor/tui/dscode-email/smtp.mjs +0 -69
- package/vendor/tui/dscode-email/store.mjs +0 -32
- package/vendor/tui/dscode-providers/catalog.mjs +0 -136
- package/vendor/tui/dscode-providers/effort.mjs +0 -35
- package/vendor/tui/dscode-providers/openrouter-account.mjs +0 -171
- package/vendor/tui/index.mjs +0 -44483
- package/vendor/tui/invariant.mjs +0 -21
- package/vendor/tui/rolldown-runtime-CMFfr-1z.mjs +0 -26
- package/vendor/tui/session-query.mjs +0 -150
- package/vendor/tui/startup.mjs +0 -109
- package/vendor/tui/theme-7u5Qo3dF.mjs +0 -1265
- package/vendor/tui/types/app.d.ts +0 -348
- package/vendor/tui/types/approval.d.ts +0 -59
- package/vendor/tui/types/attachments.d.ts +0 -52
- package/vendor/tui/types/authorization-panel.d.ts +0 -22
- package/vendor/tui/types/authorization.d.ts +0 -36
- package/vendor/tui/types/commands.d.ts +0 -52
- package/vendor/tui/types/editor-keys.d.ts +0 -105
- package/vendor/tui/types/editor.d.ts +0 -6
- package/vendor/tui/types/fork.d.ts +0 -8
- package/vendor/tui/types/git-workflow.d.ts +0 -121
- package/vendor/tui/types/index.d.ts +0 -223
- package/vendor/tui/types/input-split.d.ts +0 -54
- package/vendor/tui/types/internals.d.ts +0 -26
- package/vendor/tui/types/invariant.d.ts +0 -15
- package/vendor/tui/types/kernel-panels.d.ts +0 -245
- package/vendor/tui/types/keyboard.d.ts +0 -80
- package/vendor/tui/types/language-panel.d.ts +0 -12
- package/vendor/tui/types/locales/en.d.ts +0 -450
- package/vendor/tui/types/locales/zh.d.ts +0 -9
- package/vendor/tui/types/mentions.d.ts +0 -85
- package/vendor/tui/types/model-capabilities.d.ts +0 -82
- package/vendor/tui/types/models.d.ts +0 -133
- package/vendor/tui/types/permissions.d.ts +0 -27
- package/vendor/tui/types/plugin-inventory.d.ts +0 -11
- package/vendor/tui/types/presets.d.ts +0 -22
- package/vendor/tui/types/provider-settings.d.ts +0 -239
- package/vendor/tui/types/questions.d.ts +0 -54
- package/vendor/tui/types/rainbow.d.ts +0 -69
- package/vendor/tui/types/render/animations.d.ts +0 -307
- package/vendor/tui/types/render/editor.d.ts +0 -163
- package/vendor/tui/types/render/export.d.ts +0 -9
- package/vendor/tui/types/render/fuzzy.d.ts +0 -21
- package/vendor/tui/types/render/ime-cursor.d.ts +0 -60
- package/vendor/tui/types/render/inspector.d.ts +0 -62
- package/vendor/tui/types/render/lines.d.ts +0 -86
- package/vendor/tui/types/render/markdown.d.ts +0 -29
- package/vendor/tui/types/render/projection.d.ts +0 -587
- package/vendor/tui/types/render/status.d.ts +0 -196
- package/vendor/tui/types/render/text.d.ts +0 -64
- package/vendor/tui/types/render/tool-detail.d.ts +0 -94
- package/vendor/tui/types/render/tool-preview.d.ts +0 -28
- package/vendor/tui/types/render/usage.d.ts +0 -113
- package/vendor/tui/types/render/width.d.ts +0 -29
- package/vendor/tui/types/session-directory.d.ts +0 -190
- package/vendor/tui/types/session-query.d.ts +0 -92
- package/vendor/tui/types/session-switch.d.ts +0 -17
- package/vendor/tui/types/settings-file.d.ts +0 -41
- package/vendor/tui/types/skills.d.ts +0 -47
- package/vendor/tui/types/startup.d.ts +0 -65
- package/vendor/tui/types/store.d.ts +0 -58
- package/vendor/tui/types/subagents.d.ts +0 -70
- package/vendor/tui/types/terminal-title.d.ts +0 -66
- package/vendor/tui/types/theme-panel.d.ts +0 -24
- package/vendor/tui/types/theme.d.ts +0 -434
- package/vendor/tui/types/update-panel.d.ts +0 -49
- package/vendor/tui/types/update.d.ts +0 -75
- package/vendor/tui/types/version.d.ts +0 -19
- package/vendor/tui/types/whale-glyph.d.ts +0 -6
- /package/vendor/tui/{dscode-clipboard-image → lib/dscode/clipboard-image}/clipboard-image.swift +0 -0
- /package/vendor/tui/{dscode-clipboard-image → lib/dscode/clipboard-image}/index.mjs +0 -0
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Status-bar composition for the TUI footer. Codex/Claude-Code-style split
|
|
3
|
-
* line: identity facts and session figures flow from the left, while the
|
|
4
|
-
* permission badge (the Codex "autonomous selection" anchor, with its
|
|
5
|
-
* shift+tab cycle hint) pins to the right edge. Every segment carries a tone
|
|
6
|
-
* the footer maps to a theme color, and layoutStatusBar degrades the line
|
|
7
|
-
* item by item so it always fits one physical row — truncation with an
|
|
8
|
-
* ellipsis happens only after every lesser group has already dropped out.
|
|
9
|
-
*
|
|
10
|
-
* @module @deepseek-ai/dsh-tui/render/status
|
|
11
|
-
*/
|
|
12
|
-
import type { TranscriptStats } from './projection.ts';
|
|
13
|
-
import { formatTokens } from './text.ts';
|
|
14
|
-
export { formatTokens };
|
|
15
|
-
/**
|
|
16
|
-
* Compact duration: 45.2s under a minute, 2m42s from there on.
|
|
17
|
-
* @param ms - duration in milliseconds.
|
|
18
|
-
* @returns display string.
|
|
19
|
-
*/
|
|
20
|
-
export declare function formatDuration(ms: number): string;
|
|
21
|
-
/**
|
|
22
|
-
* Cache-hit share of billed prompt-side input. The denominator is the same
|
|
23
|
-
* billed total the /usage panel shows (uncached input plus both cache
|
|
24
|
-
* buckets), so the two readouts can never disagree.
|
|
25
|
-
* @param usage - cumulative token totals.
|
|
26
|
-
* @returns percent rounded to one decimal place, or null when no input was billed.
|
|
27
|
-
*/
|
|
28
|
-
export declare function cacheHitPercent(usage: TranscriptStats['usage']): number | null;
|
|
29
|
-
/**
|
|
30
|
-
* Presentation tones for status spans; the footer maps each to a theme color
|
|
31
|
-
* (Codex status-line accents: model/path/branch/state/usage categories).
|
|
32
|
-
*/
|
|
33
|
-
export type StatusTone = 'model' | 'live' | 'path' | 'branch' | 'value' | 'label' | 'meta' | 'accent' | 'success' | 'plan' | 'warn' | 'error' | 'ctxFill';
|
|
34
|
-
/** One colored run inside the status bar. */
|
|
35
|
-
export interface StatusSpan {
|
|
36
|
-
text: string;
|
|
37
|
-
tone: StatusTone;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* One pipe-separated cluster on the leading side of the bar. Spans are the
|
|
41
|
-
* full visual sequence: junction separators ride along as their own dim
|
|
42
|
-
* 'label'-tone spans, so joining is a flat concat with no implicit glue.
|
|
43
|
-
*/
|
|
44
|
-
export interface StatusGroup {
|
|
45
|
-
spans: readonly StatusSpan[];
|
|
46
|
-
}
|
|
47
|
-
/** One physical row of the footer: leading clusters and trailing badges. */
|
|
48
|
-
export interface StatusRow {
|
|
49
|
-
/** Leading clusters, pipe-separated in display order; index 0 is identity. */
|
|
50
|
-
left: readonly StatusGroup[];
|
|
51
|
-
/** Trailing spans pinned to the right edge, dot-separated in display order. */
|
|
52
|
-
right: readonly StatusSpan[];
|
|
53
|
-
/** Whether the shift+tab cycle hint rides after the permission badge. */
|
|
54
|
-
hint: boolean;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* The footer layout: two stacked physical rows. Row 1 keeps the primary
|
|
58
|
-
* controls in model, cwd, mode, branch, context, permission order. Row 2
|
|
59
|
-
* carries every secondary session/run figure and degrades independently.
|
|
60
|
-
*/
|
|
61
|
-
export interface StatusLayout {
|
|
62
|
-
row1: StatusRow;
|
|
63
|
-
row2: StatusRow;
|
|
64
|
-
}
|
|
65
|
-
/** Separator between leading clusters. */
|
|
66
|
-
export declare const STATUS_GROUP_SEPARATOR = " | ";
|
|
67
|
-
/** Separator between trailing state spans. */
|
|
68
|
-
export declare const STATUS_ITEM_SEPARATOR = " \u00B7 ";
|
|
69
|
-
/** The Codex-style mode cycle hint appended to the permission badge. */
|
|
70
|
-
/** English compatibility value for callers that only measure the default layout. */
|
|
71
|
-
export declare const STATUS_CYCLE_HINT = " (shift+tab to cycle)";
|
|
72
|
-
/** Localized mode-cycle hint used by the live layout. */
|
|
73
|
-
export declare function statusCycleHint(): string;
|
|
74
|
-
/**
|
|
75
|
-
* Interior columns of the context bar. The layout starts every bar at this
|
|
76
|
-
* width so the drop ladder can pre-measure the group, then degrades the
|
|
77
|
-
* readout and shrinks the bar inside a tighter budget before dropping the
|
|
78
|
-
* group (see CONTEXT_MIN_WIDTH) rather than asking the layout for more room.
|
|
79
|
-
*/
|
|
80
|
-
export declare const CONTEXT_BAR_WIDTH = 24;
|
|
81
|
-
/**
|
|
82
|
-
* Render context occupancy as ONE stepless proportional bar: a solid
|
|
83
|
-
* DeepSeek-blue fill run tracking the occupancy and a dim dotted free
|
|
84
|
-
* track for the rest. Nothing else lives inside the bar — the usage
|
|
85
|
-
* readout rides outside it (see contextGroupSpans) — so the geometry
|
|
86
|
-
* always reads as the true remaining share. A given occupancy always
|
|
87
|
-
* renders the identical bar.
|
|
88
|
-
* @param usedTokens - reported used tokens.
|
|
89
|
-
* @param contextWindow - route capacity.
|
|
90
|
-
* @param width - total bar columns.
|
|
91
|
-
* @returns tone-split spans for the footer to paint.
|
|
92
|
-
*/
|
|
93
|
-
export declare function contextBar(usedTokens: number, contextWindow: number, width: number): readonly StatusSpan[];
|
|
94
|
-
/** How much usage detail the context group's readout carries. */
|
|
95
|
-
export type ContextReadoutMode = 'full' | 'percent' | 'none';
|
|
96
|
-
/**
|
|
97
|
-
* Compose the context group: the proportional bar plus the usage readout
|
|
98
|
-
* OUTSIDE the bar, so the dotted track keeps its proportional meaning no
|
|
99
|
-
* matter how wide the readout is. `full` reads `12.3K/1.0M 25%`; `percent`
|
|
100
|
-
* drops the absolute pair; `none` is the bare bar. The readout turns amber
|
|
101
|
-
* once occupancy reaches the warning threshold.
|
|
102
|
-
*/
|
|
103
|
-
export declare function contextGroupSpans(usedTokens: number, contextWindow: number, barWidth: number, readout: ContextReadoutMode): readonly StatusSpan[];
|
|
104
|
-
/**
|
|
105
|
-
* One customizable status item (the Codex /statusline picker contract).
|
|
106
|
-
* 'left' items render as pipe-separated clusters after the identity dot;
|
|
107
|
-
* 'right' items pin to the right edge as dot-separated state badges.
|
|
108
|
-
*/
|
|
109
|
-
export type StatusItemId = 'model' | 'cwd' | 'branch' | 'plan' | 'mode' | 'turns' | 'durations' | 'cache' | 'context' | 'tokens' | 'title' | 'goal' | 'sandbox' | 'permission';
|
|
110
|
-
/** Picker-facing metadata for one customizable item. */
|
|
111
|
-
export interface StatusItemInfo {
|
|
112
|
-
id: StatusItemId;
|
|
113
|
-
/** Short picker label. */
|
|
114
|
-
label: string;
|
|
115
|
-
/** One-line picker description of what the item shows. */
|
|
116
|
-
description: string;
|
|
117
|
-
/** Which side of the split row the item renders on. */
|
|
118
|
-
side: 'left' | 'right';
|
|
119
|
-
}
|
|
120
|
-
/** The full item catalog in canonical order (the /statusline default). */
|
|
121
|
-
export declare const STATUS_ITEMS: readonly StatusItemInfo[];
|
|
122
|
-
/**
|
|
123
|
-
* Default order: the whole catalog (matches the pre-customization bar).
|
|
124
|
-
* The busy dot is not an item — it always leads the identity cluster.
|
|
125
|
-
*/
|
|
126
|
-
export declare const DEFAULT_STATUSLINE_ITEMS: readonly StatusItemId[];
|
|
127
|
-
/**
|
|
128
|
-
* Parse a persisted statusline item list. The stored value is the ordered
|
|
129
|
-
* set of ENABLED items (the Codex /statusline contract): unknown ids and
|
|
130
|
-
* duplicates drop out, and a non-array value (missing or corrupt file)
|
|
131
|
-
* falls back to the full default set. An explicitly empty array is valid —
|
|
132
|
-
* the bar degrades to its busy dot alone.
|
|
133
|
-
* @param value - the raw parsed JSON value (expected string[]).
|
|
134
|
-
* @returns the normalized ordered item list.
|
|
135
|
-
*/
|
|
136
|
-
export declare function parseStatuslineItems(value: unknown): readonly StatusItemId[];
|
|
137
|
-
/**
|
|
138
|
-
* Extra left padding on the secondary row so its content aligns with the
|
|
139
|
-
* model name's left edge on the primary row (padding 2 + busy dot 2). The
|
|
140
|
-
* layout subtracts it from row 2's budget so the indent can never wrap it.
|
|
141
|
-
*/
|
|
142
|
-
export declare const STATUS_ROW2_INDENT = 2;
|
|
143
|
-
/** Identity facts the runner resolves once at mount; empty strings drop out. */
|
|
144
|
-
export interface StatusFacts {
|
|
145
|
-
/** 'provider/model' selection serving this session. */
|
|
146
|
-
model: string;
|
|
147
|
-
/** Agent preset composing this session. */
|
|
148
|
-
mode?: string;
|
|
149
|
-
/** Working-directory basename the session serves. */
|
|
150
|
-
cwd: string;
|
|
151
|
-
/** Git branch name, empty outside a repository or on a detached HEAD file. */
|
|
152
|
-
branch: string;
|
|
153
|
-
/** Short session identifier (last dash-separated segment or tail). */
|
|
154
|
-
sessionId: string;
|
|
155
|
-
/** Latest session title (folded from 'session/title'); shown in place of the id. */
|
|
156
|
-
title: string;
|
|
157
|
-
/** Sandbox-mode override (folded from 'sandbox/mode'), empty when never switched. */
|
|
158
|
-
sandbox: string;
|
|
159
|
-
/** Live goal summary (folded from 'goal/change'), undefined when none. */
|
|
160
|
-
goal: {
|
|
161
|
-
phase: string;
|
|
162
|
-
rounds: number;
|
|
163
|
-
max: number;
|
|
164
|
-
} | undefined;
|
|
165
|
-
/** Whether plan mode is active (folded from 'plan/mode'). */
|
|
166
|
-
plan: boolean;
|
|
167
|
-
/** Active or pending permission preset; empty only when the service is unavailable. */
|
|
168
|
-
permission: string;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Traffic-light tone for a permission preset: read-only stays success green,
|
|
172
|
-
* full access reads error red, and every workspace-scoped middle ground
|
|
173
|
-
* (including unknown presets) reads warning amber.
|
|
174
|
-
* @param permission - active permission preset label.
|
|
175
|
-
* @returns tone for the badge span.
|
|
176
|
-
*/
|
|
177
|
-
export declare function permissionTone(permission: string): StatusTone;
|
|
178
|
-
/**
|
|
179
|
-
* Compose the two-row footer layout under a column budget. Row 1 keeps model,
|
|
180
|
-
* cwd, mode, branch, context, then the right-pinned permission badge and cycle
|
|
181
|
-
* hint. It drops hint, context, and permission before ellipsizing identity.
|
|
182
|
-
* Row 2 fits all secondary figures and state within its own budget.
|
|
183
|
-
* @param facts - identity facts resolved by the runner.
|
|
184
|
-
* @param stats - session figures folded from the durable log.
|
|
185
|
-
* @param columns - usable columns for each row (before their left padding).
|
|
186
|
-
* @param options - 'busy' hides the cycle hint while a turn runs (Codex
|
|
187
|
-
* keeps mode hints idle-only); 'items' is the ordered enabled-item config
|
|
188
|
-
* from /statusline (defaults to the full catalog). Display order follows the
|
|
189
|
-
* config per side while the drop ladder keeps its fixed ranks.
|
|
190
|
-
* @returns the two rows to render; row1.left is never empty.
|
|
191
|
-
*/
|
|
192
|
-
export declare function layoutStatusBar(facts: StatusFacts, stats: TranscriptStats, columns: number, options?: {
|
|
193
|
-
busy?: boolean;
|
|
194
|
-
items?: readonly string[];
|
|
195
|
-
contextWidth?: number;
|
|
196
|
-
}): StatusLayout;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Display-boundary sanitization for externally sourced text (model output,
|
|
3
|
-
* tool payloads, skill descriptions). Control characters — including ANSI
|
|
4
|
-
* CSI/OSC escape sequences — would otherwise pass through Ink into the
|
|
5
|
-
* terminal, letting output rewrite the screen or inject prompts. Newlines
|
|
6
|
-
* survive; everything else in C0/C1 plus DEL becomes a visible `\xNN`
|
|
7
|
-
* escape, and bidi overrides / invisible format controls / Unicode line and
|
|
8
|
-
* paragraph separators become a visible `\uXXXX` escape (terminal emulators
|
|
9
|
-
* that render bidirectional text would otherwise reorder the displayed
|
|
10
|
-
* glyphs and let a command read as something it is not).
|
|
11
|
-
*
|
|
12
|
-
* @module @deepseek-ai/dsh-code/render/text
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Compact token count: exact below 1K, then one-decimal-ish K/M.
|
|
16
|
-
* @param n - token count.
|
|
17
|
-
* @returns display string.
|
|
18
|
-
*/
|
|
19
|
-
export declare function formatTokens(n: number): string;
|
|
20
|
-
/**
|
|
21
|
-
* Escape control and deceptive characters so externally sourced text cannot
|
|
22
|
-
* drive the terminal. C0/C1/DEL render as a literal `\xNN` escape; bidi,
|
|
23
|
-
* invisible-format, and separator controls render as a literal `\uXXXX`
|
|
24
|
-
* escape. Newlines and tabs survive (budgeted callers normalize tabs).
|
|
25
|
-
* @param text - raw text from a session event, tool payload, or catalog.
|
|
26
|
-
* @returns display-safe text with every injectable character made visible.
|
|
27
|
-
*/
|
|
28
|
-
export declare function displayText(text: string): string;
|
|
29
|
-
/** Collapse external text to one terminal-safe logical row. */
|
|
30
|
-
export declare function singleLineText(text: string): string;
|
|
31
|
-
/**
|
|
32
|
-
* Truncate one display-safe row without ever exceeding its physical-column
|
|
33
|
-
* budget. The ellipsis is included inside the budget, matching Codex's popup
|
|
34
|
-
* truncation contract; the cut walks grapheme clusters so emoji and
|
|
35
|
-
* combining sequences never split mid-cluster.
|
|
36
|
-
*/
|
|
37
|
-
export declare function truncateColumns(text: string, columns: number): string;
|
|
38
|
-
/** A display-safe suffix bounded by terminal rows and columns. */
|
|
39
|
-
export interface DisplayTail {
|
|
40
|
-
/** Sanitized suffix suitable for direct terminal rendering. */
|
|
41
|
-
text: string;
|
|
42
|
-
/** Whether content before the returned suffix was omitted. */
|
|
43
|
-
truncated: boolean;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Keep the newest display-safe text that fits a terminal rectangle, wrapping
|
|
47
|
-
* FORWARD from the start of the text and slicing the tail rows.
|
|
48
|
-
*
|
|
49
|
-
* Forward wrapping is what keeps a streaming tail calm: rows already produced
|
|
50
|
-
* never re-wrap as tokens append (a backward scan recomputes every wrap point
|
|
51
|
-
* per chunk and the whole visible block jumps), and the wrap rules match the
|
|
52
|
-
* settled text's renderer so the flush at turn end does not reflow the block
|
|
53
|
-
* a second time. CJK kinsoku applies at both edges: closing punctuation
|
|
54
|
-
* overhangs up to two cells onto the filled row instead of starting the next
|
|
55
|
-
* one (within the caret column the caller reserves), and opening punctuation
|
|
56
|
-
* moves down instead of dangling at a row end. Tabs expand to two spaces so
|
|
57
|
-
* terminal tab stops cannot inflate the physical row count; clusters carry
|
|
58
|
-
* emoji presentation and combining marks whole.
|
|
59
|
-
* @param text - raw externally sourced text.
|
|
60
|
-
* @param columns - available terminal columns.
|
|
61
|
-
* @param rows - available terminal rows.
|
|
62
|
-
* @returns a sanitized bounded suffix and whether an earlier prefix was cut.
|
|
63
|
-
*/
|
|
64
|
-
export declare function displayTail(text: string, columns: number, rows: number): DisplayTail;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expansion payloads for tool cards (the Ctrl+O verbose transcript): the
|
|
3
|
-
* TUI-side consumption of the harness presentation contract. Mutation and
|
|
4
|
-
* read tools persist a structured `tool/result.meta` (`diffs`, read
|
|
5
|
-
* windows, web sources) exactly so a capable UI can replay richer cards than
|
|
6
|
-
* the model-facing text; this module narrows that opaque JSON defensively —
|
|
7
|
-
* mirroring the upstream validators — and pre-formats bounded, render-ready
|
|
8
|
-
* rows. Malformed or absent metadata always degrades to the bounded raw
|
|
9
|
-
* result text, never throws during replay.
|
|
10
|
-
*
|
|
11
|
-
* @module @deepseek-ai/dsh-code/render/tool-detail
|
|
12
|
-
*/
|
|
13
|
-
/** One rendered diff row: removed, added, or shared context. */
|
|
14
|
-
export interface DiffLine {
|
|
15
|
-
/** '-' removed, '+' added, ' ' context. */
|
|
16
|
-
mark: '-' | '+' | ' ';
|
|
17
|
-
/** The line text, truncated to the column budget. */
|
|
18
|
-
text: string;
|
|
19
|
-
}
|
|
20
|
-
/** One file's bounded inline diff. */
|
|
21
|
-
export interface ToolDiff {
|
|
22
|
-
/** File path the change belongs to. */
|
|
23
|
-
path: string;
|
|
24
|
-
/** Rendered rows in order; '-' block before the '+' block. */
|
|
25
|
-
lines: readonly DiffLine[];
|
|
26
|
-
/** True when the line budget cut the hunk. */
|
|
27
|
-
truncated: boolean;
|
|
28
|
-
}
|
|
29
|
-
/** One numbered line of a read window. */
|
|
30
|
-
export interface ToolReadLine {
|
|
31
|
-
/** 1-based file line number. */
|
|
32
|
-
number: number;
|
|
33
|
-
/** The line text, truncated to the column budget. */
|
|
34
|
-
text: string;
|
|
35
|
-
}
|
|
36
|
-
/** One web-search source row. */
|
|
37
|
-
export interface ToolWebSource {
|
|
38
|
-
/** Source URL. */
|
|
39
|
-
url: string;
|
|
40
|
-
/** Source title, when the provider returned one. */
|
|
41
|
-
title: string | undefined;
|
|
42
|
-
/** Short excerpt, truncated to the column budget. */
|
|
43
|
-
snippet: string;
|
|
44
|
-
}
|
|
45
|
-
/** The expansion payload a verbose tool card renders; a discriminated union. */
|
|
46
|
-
export type ToolDetail = {
|
|
47
|
-
kind: 'diff';
|
|
48
|
-
diffs: readonly ToolDiff[];
|
|
49
|
-
} | {
|
|
50
|
-
kind: 'read';
|
|
51
|
-
path: string;
|
|
52
|
-
offset: number;
|
|
53
|
-
lines: readonly ToolReadLine[];
|
|
54
|
-
totalLines: number;
|
|
55
|
-
truncated: boolean;
|
|
56
|
-
} | {
|
|
57
|
-
kind: 'web-search';
|
|
58
|
-
sources: readonly ToolWebSource[];
|
|
59
|
-
truncated: boolean;
|
|
60
|
-
} | {
|
|
61
|
-
kind: 'web-fetch';
|
|
62
|
-
url: string;
|
|
63
|
-
statusCode: number;
|
|
64
|
-
} | {
|
|
65
|
-
kind: 'raw';
|
|
66
|
-
text: string;
|
|
67
|
-
truncated: boolean;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Render one change as removed-then-added rows, hunked by common prefix and
|
|
71
|
-
* suffix. A null before-image (file create) renders as pure additions. The
|
|
72
|
-
* budget caps emitted rows and reports the cut, so a whole-file overwrite
|
|
73
|
-
* never floods the transcript. Inputs are hard-capped before line splitting
|
|
74
|
-
* and the row list is built incrementally up to the budget — a crafted or
|
|
75
|
-
* replayed giant diff cannot force a full intermediate rows array.
|
|
76
|
-
* @param oldText - prior content, or null for a create.
|
|
77
|
-
* @param newText - content after the change.
|
|
78
|
-
* @param budget - maximum rows to emit.
|
|
79
|
-
* @returns the bounded rows and whether they were cut.
|
|
80
|
-
*/
|
|
81
|
-
export declare function diffRows(oldText: string | null, newText: string, budget: number): {
|
|
82
|
-
lines: readonly DiffLine[];
|
|
83
|
-
truncated: boolean;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Narrow the opaque `tool/result.meta` into one bounded expansion payload,
|
|
87
|
-
* mirroring the upstream presenters' degradation ladder: diffs (write/edit),
|
|
88
|
-
* read windows (read), sources (web_search), fetch summaries (web_fetch), and
|
|
89
|
-
* the bounded raw result text as the universal fallback.
|
|
90
|
-
* @param meta - the persisted presentation metadata, when the tool attached one.
|
|
91
|
-
* @param rawText - the joined text blocks of the result message.
|
|
92
|
-
* @returns the expansion payload, or undefined when nothing renderable exists.
|
|
93
|
-
*/
|
|
94
|
-
export declare function toolResultDetail(meta: unknown, rawText: string): ToolDetail | undefined;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bounded preview line for a tool invocation's raw JSON arguments: the first
|
|
3
|
-
* human-meaningful string among the well-known keys (command, path, query, …)
|
|
4
|
-
* with a fallback to the bounded raw JSON. Shared by the tool card in the
|
|
5
|
-
* transcript and the approval bar's command preview. Arguments longer than
|
|
6
|
-
* {@link MAX_PARSE_CHARS} are never parsed: the preview is a display concern,
|
|
7
|
-
* and a synchronous `JSON.parse` plus string copies of an unbounded model
|
|
8
|
-
* payload must not run on the approval or projection paths.
|
|
9
|
-
*
|
|
10
|
-
* @module @deepseek-ai/dsh-code/render/tool-preview
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Resolve one bounded preview for raw tool arguments.
|
|
14
|
-
* @param args - raw JSON arguments string as the model produced it.
|
|
15
|
-
* @param toolName - the tool the arguments belong to (fallback label).
|
|
16
|
-
* @returns the preview line; empty when nothing useful resolves.
|
|
17
|
-
*/
|
|
18
|
-
export declare function toolArgumentsPreview(args: string, toolName: string): string;
|
|
19
|
-
/**
|
|
20
|
-
* Bounded prompt preview for delegation-style tools (`subagent`): the
|
|
21
|
-
* `prompt` argument rendered as the card's second row, so the transcript
|
|
22
|
-
* shows what the child agent was asked — not just its description label —
|
|
23
|
-
* while it runs (Codex's SpawnAgent card preview). Anything else returns ''.
|
|
24
|
-
* @param toolName - the tool the arguments belong to.
|
|
25
|
-
* @param args - raw JSON arguments string as the model produced it.
|
|
26
|
-
* @returns the one-line prompt preview, or '' when none applies.
|
|
27
|
-
*/
|
|
28
|
-
export declare function toolPromptPreview(toolName: string, args: string): string;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session usage for the /usage panel: the provider-reported token totals, the
|
|
3
|
-
* context pressure and composition, and the exact per-turn accounting, folded
|
|
4
|
-
* into the styled rows the panel draws.
|
|
5
|
-
*
|
|
6
|
-
* Every figure comes from the harness token meter. The four token buckets are
|
|
7
|
-
* disjoint, so the prompt side is never double counted; the composition block
|
|
8
|
-
* is a density estimate and is labelled as one.
|
|
9
|
-
*
|
|
10
|
-
* @module @deepseek-ai/dsh-tui/render/usage
|
|
11
|
-
*/
|
|
12
|
-
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
13
|
-
import type { TokenUsageProjection, TurnTokenUsage } from '@deepseek-ai/dsh-token-meter/client';
|
|
14
|
-
import { type StyledLine } from './lines.ts';
|
|
15
|
-
/** One completed turn's exact provider-reported accounting. */
|
|
16
|
-
export interface UsageTurn {
|
|
17
|
-
/** Durable turn number (`turn/start`). */
|
|
18
|
-
readonly turn: number;
|
|
19
|
-
readonly usage: TurnTokenUsage;
|
|
20
|
-
/**
|
|
21
|
-
* The model that billed this turn, or '' when nothing in the log names one.
|
|
22
|
-
* The meter's own `routes` is preferred; it is absent whenever ONE attempt
|
|
23
|
-
* went unattributed, so the turn's own assistant messages answer instead.
|
|
24
|
-
*/
|
|
25
|
-
readonly model: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Everything the panel reads. The totals come from the mounted projection and
|
|
29
|
-
* the per-turn rows from the meter's own fold; a missing projection renders as
|
|
30
|
-
* explicitly unavailable rather than as zeros, because an unmounted deployment
|
|
31
|
-
* and a session with no traffic are different facts.
|
|
32
|
-
*/
|
|
33
|
-
export interface UsageView {
|
|
34
|
-
/** Provider-reported usage over the whole durable log. */
|
|
35
|
-
readonly totals?: TokenUsageProjection;
|
|
36
|
-
/** Completed turns, oldest first. */
|
|
37
|
-
readonly turns: readonly UsageTurn[];
|
|
38
|
-
}
|
|
39
|
-
/** Prompt-side tokens the provider billed: uncached input plus both cache buckets. */
|
|
40
|
-
export declare function billedInputTokens(totals: TokenUsageProjection): number;
|
|
41
|
-
/** Prompt plus completion tokens over the whole log. */
|
|
42
|
-
export declare function usageTotalTokens(totals: TokenUsageProjection): number;
|
|
43
|
-
/**
|
|
44
|
-
* Cache-hit share of billed prompt-side input.
|
|
45
|
-
* @param totals - cumulative provider-reported buckets.
|
|
46
|
-
* @returns percent rounded to one decimal place, or null when nothing was billed.
|
|
47
|
-
*/
|
|
48
|
-
export declare function usageCacheHitPercent(totals: TokenUsageProjection): number | null;
|
|
49
|
-
/** One complete turn's durable events, in log order. */
|
|
50
|
-
export interface TurnSlice {
|
|
51
|
-
readonly turn: number;
|
|
52
|
-
readonly events: readonly SessionEvent[];
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Split a durable log into COMPLETE turns. A turn still running has no
|
|
56
|
-
* `turn/end` yet, and an unfinished attempt has no exact accounting, so the
|
|
57
|
-
* trailing slice is dropped rather than guessed at.
|
|
58
|
-
* @param events - the whole durable log, in log order.
|
|
59
|
-
* @returns one slice per `turn/start`…`turn/end` span, oldest first.
|
|
60
|
-
*/
|
|
61
|
-
export declare function completedTurns(events: readonly SessionEvent[]): readonly TurnSlice[];
|
|
62
|
-
/**
|
|
63
|
-
* Exact usage for every completed turn that can be proven.
|
|
64
|
-
* @param events - the whole durable log, in log order.
|
|
65
|
-
* @param derive - the meter's per-turn fold, injected so this module stays pure.
|
|
66
|
-
* @returns one row per provable turn, oldest first; turns whose attempts did
|
|
67
|
-
* not all report usage are omitted rather than estimated, and so is a turn
|
|
68
|
-
* that billed nothing at all — an empty row is noise in a usage table.
|
|
69
|
-
*/
|
|
70
|
-
export declare function turnUsages(events: readonly SessionEvent[], derive: (events: readonly SessionEvent[]) => TurnTokenUsage | undefined): readonly UsageTurn[];
|
|
71
|
-
/** A bucket some turn of a group did not report, leaving the group sum a floor. */
|
|
72
|
-
export type PartialBucket = 'cacheReadTokens' | 'cacheWriteTokens' | 'reasoningTokens';
|
|
73
|
-
/** One model's merged totals across every turn it billed. */
|
|
74
|
-
export interface ModelUsage {
|
|
75
|
-
/** Model names joined with ` + ` (a turn that switched models lists both). */
|
|
76
|
-
readonly model: string;
|
|
77
|
-
/** Turns attributed to this model. */
|
|
78
|
-
readonly turns: number;
|
|
79
|
-
readonly uncachedInputTokens: number;
|
|
80
|
-
readonly outputTokens: number;
|
|
81
|
-
readonly totalTokens: number;
|
|
82
|
-
/** Summed over the turns that reported it; absent when none did. */
|
|
83
|
-
readonly cacheReadTokens?: number;
|
|
84
|
-
/** Summed over the turns that reported it; absent when none did. */
|
|
85
|
-
readonly cacheWriteTokens?: number;
|
|
86
|
-
/** Summed over the turns that reported it; absent when none did. */
|
|
87
|
-
readonly reasoningTokens?: number;
|
|
88
|
-
/**
|
|
89
|
-
* Buckets some turn of the group left unreported. The corresponding sum (and
|
|
90
|
-
* the hit share derived from it) counts only what WAS reported, so the
|
|
91
|
-
* display marks it as a floor rather than hiding the group's known traffic.
|
|
92
|
-
*/
|
|
93
|
-
readonly partial: readonly PartialBucket[];
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Merge the per-turn rows by the model that billed them, biggest spender
|
|
97
|
-
* first. A turn lands in exactly one group — the group named by every model it
|
|
98
|
-
* used — so the sums stay additive and a mid-turn model switch never counts
|
|
99
|
-
* the same tokens twice. Each bucket is merged over the turns that reported
|
|
100
|
-
* it, and {@link ModelUsage.partial} records the ones that stayed silent.
|
|
101
|
-
* @param turns - provable per-turn rows, oldest first.
|
|
102
|
-
* @returns one row per model group.
|
|
103
|
-
*/
|
|
104
|
-
export declare function modelTotals(turns: readonly UsageTurn[]): readonly ModelUsage[];
|
|
105
|
-
/** The model attribution for one turn: the meter's routes, else its messages. */
|
|
106
|
-
export declare function turnModel(slice: TurnSlice, usage: TurnTokenUsage): string;
|
|
107
|
-
/**
|
|
108
|
-
* Render the panel body.
|
|
109
|
-
* @param view - the projection totals plus the derived per-turn rows.
|
|
110
|
-
* @param columns - usable content columns inside the panel border.
|
|
111
|
-
* @returns bounded, styled rows ready to draw.
|
|
112
|
-
*/
|
|
113
|
-
export declare function usageLines(view: UsageView, columns: number): readonly StyledLine[];
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Precise terminal-cell width measurement — the single authority every
|
|
3
|
-
* budget, wrap, and truncation path shares. The previous heuristic
|
|
4
|
-
* (`codePoint > 0x2e7f ? 2 : 1)) mis-sized Hangul Jamo (narrow), high
|
|
5
|
-
* non-CJK code points (wide), and emoji: text-default glyphs like ✳ ⚠ ❤
|
|
6
|
-
* counted 2 while terminals draw 1, and VS16 sequences counted 1 while
|
|
7
|
-
* terminals draw 2 — the exact drift class the community dsh-TUI string
|
|
8
|
-
* engine documents (a spinner glyph drifting one column per frame). This
|
|
9
|
-
* module adapts that engine's rules without its Ink-fork renderer: an ASCII
|
|
10
|
-
* fast path, grapheme-cluster iteration via Intl.Segmenter (code-point
|
|
11
|
-
* fallback), a merged East-Asian-Wide/Fullwidth + Emoji_Presentation range
|
|
12
|
-
* table, text-default emoji = 1, VS16 = 2, marks/selectors/ZWJ = 0.
|
|
13
|
-
* @module @deepseek-ai/dsh-code/render/width
|
|
14
|
-
*/
|
|
15
|
-
/** Split text into grapheme clusters (code points when Segmenter is absent). */
|
|
16
|
-
export declare function splitGraphemes(text: string): string[];
|
|
17
|
-
/** Terminal-cell width of one grapheme cluster. */
|
|
18
|
-
export declare function graphemeWidth(cluster: string): number;
|
|
19
|
-
/** Terminal-cell width of one code point (surrogate pairs must stay paired). */
|
|
20
|
-
export declare function codePointWidth(char: string): number;
|
|
21
|
-
/**
|
|
22
|
-
* Terminal-cell width of a string: an ASCII fast path avoids the segmenter
|
|
23
|
-
* for the overwhelmingly common case; everything else sums grapheme clusters.
|
|
24
|
-
* Control characters occupy no cells (display sanitization makes them
|
|
25
|
-
* visible escapes before they ever reach a budget).
|
|
26
|
-
* @param text - display-safe or raw text to measure.
|
|
27
|
-
* @returns the column count the terminal will draw.
|
|
28
|
-
*/
|
|
29
|
-
export declare function stringWidth(text: string): number;
|