@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,190 +0,0 @@
|
|
|
1
|
-
/** Lightweight session-directory projection for the /resume picker. */
|
|
2
|
-
import { type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session';
|
|
3
|
-
export interface SessionRecord {
|
|
4
|
-
readonly header: SessionHeader;
|
|
5
|
-
readonly live: boolean;
|
|
6
|
-
readonly persisted: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface TitleObservationResult {
|
|
9
|
-
readonly sessionId: string;
|
|
10
|
-
readonly status: 'fulfilled' | 'rejected';
|
|
11
|
-
readonly value?: {
|
|
12
|
-
readonly title?: {
|
|
13
|
-
readonly title?: string;
|
|
14
|
-
readonly text?: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export interface SessionLogSnapshot {
|
|
19
|
-
readonly session: SessionHeader;
|
|
20
|
-
readonly events: SessionEvent[];
|
|
21
|
-
}
|
|
22
|
-
/** Structural upstream SessionQuery surface used by the TUI. */
|
|
23
|
-
export interface SessionQueryService {
|
|
24
|
-
listSessions(signal?: AbortSignal): Promise<SessionRecord[]>;
|
|
25
|
-
readTitleSnapshots(ids: readonly string[], signal?: AbortSignal): Promise<TitleObservationResult[]>;
|
|
26
|
-
readSession(id: string, signal?: AbortSignal): Promise<SessionLogSnapshot>;
|
|
27
|
-
/** Cross-session full-text search (SQLite FTS engine; openAt may gate it). */
|
|
28
|
-
searchSessions(request: {
|
|
29
|
-
query: string;
|
|
30
|
-
limit?: number;
|
|
31
|
-
}, exec?: {
|
|
32
|
-
signal?: AbortSignal;
|
|
33
|
-
}): Promise<{
|
|
34
|
-
items: readonly {
|
|
35
|
-
header: SessionHeader;
|
|
36
|
-
live: boolean;
|
|
37
|
-
persisted: boolean;
|
|
38
|
-
bestMatch: {
|
|
39
|
-
snippet: string;
|
|
40
|
-
time: number;
|
|
41
|
-
};
|
|
42
|
-
}[];
|
|
43
|
-
}>;
|
|
44
|
-
}
|
|
45
|
-
export type SessionScope = 'roots' | 'all';
|
|
46
|
-
export type CwdScope = 'all' | 'current';
|
|
47
|
-
export type SessionSort = 'newest' | 'oldest';
|
|
48
|
-
export interface SessionDirectoryOptions {
|
|
49
|
-
readonly sessions: SessionScope;
|
|
50
|
-
readonly cwd: CwdScope;
|
|
51
|
-
readonly sort: SessionSort;
|
|
52
|
-
readonly currentCwd: string;
|
|
53
|
-
readonly query: string;
|
|
54
|
-
}
|
|
55
|
-
export interface SessionRow {
|
|
56
|
-
readonly id: string;
|
|
57
|
-
readonly createdAt: number;
|
|
58
|
-
/** Last-activity timestamp: artifact mtime when known, else createdAt. */
|
|
59
|
-
readonly updatedAt: number;
|
|
60
|
-
readonly cwd: string;
|
|
61
|
-
readonly workspace: string;
|
|
62
|
-
readonly parent?: string;
|
|
63
|
-
readonly subagent: boolean;
|
|
64
|
-
readonly resumable: boolean;
|
|
65
|
-
readonly live: boolean;
|
|
66
|
-
readonly persisted: boolean;
|
|
67
|
-
readonly preset: string;
|
|
68
|
-
readonly title?: string;
|
|
69
|
-
}
|
|
70
|
-
/** True only for delegated subagents; ordinary forks also carry lineage. */
|
|
71
|
-
export declare function isSubagentSession(header: SessionHeader): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Unique header match by exact id or unique id prefix (root and subagent
|
|
74
|
-
* headers alike); the caller applies any lineage gate.
|
|
75
|
-
* @param headers - the persisted headers.
|
|
76
|
-
* @param wanted - the id or id prefix.
|
|
77
|
-
* @returns the uniquely matched header.
|
|
78
|
-
* @throws when nothing matches or the prefix is ambiguous.
|
|
79
|
-
*/
|
|
80
|
-
export declare function matchSessionId(headers: readonly SessionHeader[], wanted: string): SessionHeader;
|
|
81
|
-
/** The newest persisted ROOT session pinned to this cwd, or undefined. */
|
|
82
|
-
export declare function newestRootForCwd(headers: readonly SessionHeader[], cwd: string): SessionHeader | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* Filter/sort header-only records. No session log is loaded here. Sorting is
|
|
85
|
-
* by LAST ACTIVITY (`updated` — artifact mtime when the caller resolved one,
|
|
86
|
-
* else createdAt), matching the codex resume picker's default UpdatedAt
|
|
87
|
-
* ordering: a session you kept talking in outranks one created later but idle.
|
|
88
|
-
* @param records - the header-only records.
|
|
89
|
-
* @param options - filter/sort options.
|
|
90
|
-
* @param updated - per-session last-activity timestamps, when resolved.
|
|
91
|
-
*/
|
|
92
|
-
export declare function projectSessionRows(records: readonly SessionRecord[], options: SessionDirectoryOptions, updated?: ReadonlyMap<string, number>): SessionRow[];
|
|
93
|
-
/** Merge page-local title observations without disturbing directory order. */
|
|
94
|
-
export declare function mergeSessionTitles(rows: readonly SessionRow[], observations: readonly TitleObservationResult[]): SessionRow[];
|
|
95
|
-
/**
|
|
96
|
-
* Encode a session id the way the JSONL backend does for its on-disk layout
|
|
97
|
-
* (`encodeSegment`: safe units literal, everything else `~XXXX`). Used to
|
|
98
|
-
* validate and derive session directories — a local copy of the pure upstream
|
|
99
|
-
* contract, kept in sync with `session-persistence-jsonl/src/format.ts`.
|
|
100
|
-
*/
|
|
101
|
-
export declare function encodeSessionSegment(raw: string): string;
|
|
102
|
-
/**
|
|
103
|
-
* Encode a project cwd the way the JSONL backend groups sessions on disk
|
|
104
|
-
* (`projectKey`: separators collapse to one `-`, everything else mirrors
|
|
105
|
-
* `encodeSegment`, bounded to 251 chars). A local copy of the pure upstream
|
|
106
|
-
* contract, kept in sync with `session-persistence-jsonl/src/format.ts`.
|
|
107
|
-
*/
|
|
108
|
-
export declare function encodeProjectKey(cwd: string): string;
|
|
109
|
-
/**
|
|
110
|
-
* Derive one session's artifact directory under the JSONL backend root,
|
|
111
|
-
* mirroring the upstream `<root>/<projectKey(cwd)>/<encodeSegment(id)>/`
|
|
112
|
-
* layout (0.1.5 `sessionDir`/`projectDir`).
|
|
113
|
-
* @param root - the JSONL backend's configured session root.
|
|
114
|
-
* @param cwd - the session's pinned working directory, when the header has one.
|
|
115
|
-
* @param id - the session id.
|
|
116
|
-
* @returns the absolute session directory path.
|
|
117
|
-
*/
|
|
118
|
-
export declare function sessionDirectoryFor(root: string, cwd: string | undefined, id: string): string;
|
|
119
|
-
/**
|
|
120
|
-
* The canonical session-log artifact filenames the JSONL backend may create:
|
|
121
|
-
* format v0 writes the bare `session.jsonl` name; v1+ write
|
|
122
|
-
* `session.vN.jsonl`, each generation optionally zstd-compressed. Multiple
|
|
123
|
-
* immutable generations may coexist in one session directory (0.1.5). The
|
|
124
|
-
* range follows the installed session package's `SESSION_FORMAT_VERSION`, so
|
|
125
|
-
* a future generation joins the enumeration with the dependency bump.
|
|
126
|
-
*/
|
|
127
|
-
export declare function sessionArtifactNames(): readonly string[];
|
|
128
|
-
/** True for one canonical session-log artifact filename the backend may own. */
|
|
129
|
-
export declare function isSessionArtifactName(name: string): boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Guard a derived session directory before deletion (codex's scoped-path
|
|
132
|
-
* check, adapted to the JSONL layout): the directory's base name must be
|
|
133
|
-
* exactly `encodeSegment(id)` beneath its project grouping.
|
|
134
|
-
* @param dir - the derived session artifact directory.
|
|
135
|
-
* @param id - the session id the directory claims to belong to.
|
|
136
|
-
* @returns the guarded directory, or undefined when the layout is unexpected.
|
|
137
|
-
*/
|
|
138
|
-
export declare function sessionArtifactDirectory(dir: string, id: string): string | undefined;
|
|
139
|
-
/**
|
|
140
|
-
* The JSONL backend's configured session root, when the mounted backend
|
|
141
|
-
* exposes one. The upstream service contract dropped `locate()` in 0.1.5
|
|
142
|
-
* (artifact paths are backend-private; only refusal diagnostics carry them),
|
|
143
|
-
* so the TUI derives artifact paths from the backend's public plugin config.
|
|
144
|
-
* Backends without a JSONL-style config (or a foreign shape) yield undefined
|
|
145
|
-
* and callers degrade: mtime sorting falls back to createdAt and /delete
|
|
146
|
-
* refuses, exactly as before.
|
|
147
|
-
*/
|
|
148
|
-
export declare function jsonlSessionRoot(persistence: unknown): string | undefined;
|
|
149
|
-
/**
|
|
150
|
-
* Collect one session's deletion subtree: the id plus every record whose
|
|
151
|
-
* parent chain leads to it (codex deletes subagent threads with their root).
|
|
152
|
-
* @param records - the full directory listing.
|
|
153
|
-
* @param id - the root session id to delete.
|
|
154
|
-
* @returns the ids to delete, root first.
|
|
155
|
-
*/
|
|
156
|
-
export declare function collectDeletionSubtree(records: readonly SessionRecord[], id: string): string[];
|
|
157
|
-
/** One validated node of a deletion plan. */
|
|
158
|
-
export interface DeletionPlanNode {
|
|
159
|
-
/** Session id to remove. */
|
|
160
|
-
readonly id: string;
|
|
161
|
-
/** Distance from the deletion root (0 for the root itself). */
|
|
162
|
-
readonly depth: number;
|
|
163
|
-
}
|
|
164
|
-
/** A fully preflighted subtree deletion, or the refusal that produced none. */
|
|
165
|
-
export type SessionDeletionPlan = {
|
|
166
|
-
readonly ok: true;
|
|
167
|
-
readonly nodes: readonly DeletionPlanNode[];
|
|
168
|
-
} | {
|
|
169
|
-
readonly ok: false;
|
|
170
|
-
readonly reason: string;
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* Plan one session-subtree deletion with NO filesystem side effects: collect
|
|
174
|
-
* the doomed lineage, refuse when the root or ANY member is live (a live
|
|
175
|
-
* child would outlive its deleted parent) or missing from the listing, and
|
|
176
|
-
* order the result children-first so the executor can never leave a deleted
|
|
177
|
-
* parent behind surviving children. Artifact-location guards stay at the
|
|
178
|
-
* call site; this is the pure preflight they complete.
|
|
179
|
-
* @param records - the full directory listing.
|
|
180
|
-
* @param id - the root session id to delete.
|
|
181
|
-
* @returns the ordered plan, or a user-facing refusal reason.
|
|
182
|
-
*/
|
|
183
|
-
export declare function planSessionDeletion(records: readonly SessionRecord[], id: string): SessionDeletionPlan;
|
|
184
|
-
/**
|
|
185
|
-
* Codex-style relative time for session rows ("now", "5m ago", "3h ago",
|
|
186
|
-
* "2d ago"; older than a week falls back to the local date).
|
|
187
|
-
* @param timestamp - epoch milliseconds of the last activity.
|
|
188
|
-
* @param now - the pinned reference clock (one value per list render).
|
|
189
|
-
*/
|
|
190
|
-
export declare function formatRelativeTime(timestamp: number, now: number): string;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skip-tolerant session-query engine for this terminal.
|
|
3
|
-
*
|
|
4
|
-
* The upstream SqliteSessionQueryEngine reconciliation observes EVERY
|
|
5
|
-
* persisted session before each search, and ONE unreadable source (for
|
|
6
|
-
* example a pre-release session artifact the frozen format codecs reject)
|
|
7
|
-
* fails the whole pass with SESSION_QUERY_PERSISTENCE_FAILED — every
|
|
8
|
-
* cross-session search dies because of a single old file nobody opened
|
|
9
|
-
* otherwise. This subclass overrides only the observation loop so an
|
|
10
|
-
* unreadable source is skipped with a warning and the rest of the corpus
|
|
11
|
-
* indexes normally; skipped sessions are retried on later reconciliations
|
|
12
|
-
* and rejoin automatically once a host that can read them is installed.
|
|
13
|
-
*
|
|
14
|
-
* Vendored surface note: `_observeStable` and its module-local helpers are
|
|
15
|
-
* private upstream; this file re-declares the observation loop against the
|
|
16
|
-
* pinned @deepseek-ai line (see package.json peers) and must be re-checked
|
|
17
|
-
* whenever that line moves. The engine class and the tool boundary also
|
|
18
|
-
* share ONE physical parent-package instance through this bundle, which
|
|
19
|
-
* restores instanceof-based typed error messages on the search path.
|
|
20
|
-
*/
|
|
21
|
-
import SqliteSessionQueryEngine, { type Config } from '@deepseek-ai/dsh-session-query-sqlite';
|
|
22
|
-
import { buildSessionEventSearchDocuments } from '@deepseek-ai/dsh-session-query';
|
|
23
|
-
import type { SessionEvent, SessionHeader, SessionId, SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
24
|
-
import type { SessionPersistenceRevision, SessionPersistenceSnapshot } from '@deepseek-ai/dsh-session-persistence';
|
|
25
|
-
/** One observed session: detached header plus its derived search documents. */
|
|
26
|
-
interface ObservedSession {
|
|
27
|
-
header: SessionHeader;
|
|
28
|
-
inheritedEventCount: SessionLogOffset;
|
|
29
|
-
documents: readonly ReturnType<typeof buildSessionEventSearchDocuments>[number][];
|
|
30
|
-
fingerprint: string;
|
|
31
|
-
}
|
|
32
|
-
/** One persisted snapshot as the reconciliation sees it (loaded once readable). */
|
|
33
|
-
interface ObservedPersistedSession {
|
|
34
|
-
header: SessionHeader;
|
|
35
|
-
revision: SessionPersistenceRevision;
|
|
36
|
-
loaded?: ObservedSession;
|
|
37
|
-
/** Diagnosis for a cold read that failed; the session stays unindexed. */
|
|
38
|
-
unreadable?: string;
|
|
39
|
-
}
|
|
40
|
-
/** The engine-internal state the observation loop touches. */
|
|
41
|
-
export interface EngineSurface {
|
|
42
|
-
readonly ctx: {
|
|
43
|
-
sessions: {
|
|
44
|
-
list(): readonly {
|
|
45
|
-
header: SessionHeader;
|
|
46
|
-
inheritedEventCount: SessionLogOffset;
|
|
47
|
-
snapshotEvents(): readonly SessionEvent[];
|
|
48
|
-
id: SessionId;
|
|
49
|
-
}[];
|
|
50
|
-
get(id: SessionId): unknown;
|
|
51
|
-
};
|
|
52
|
-
logger?: {
|
|
53
|
-
warn(format: string, ...args: readonly unknown[]): void;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
readonly _persistenceBinding: {
|
|
57
|
-
readonly identity: symbol;
|
|
58
|
-
readonly service?: {
|
|
59
|
-
list(options?: {
|
|
60
|
-
readonly signal?: AbortSignal;
|
|
61
|
-
}): Promise<readonly SessionPersistenceSnapshot[]>;
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
_lastPersistenceIdentity: symbol | undefined;
|
|
65
|
-
}
|
|
66
|
-
type ColdRead = (persistence: NonNullable<EngineSurface['_persistenceBinding']['service']>, id: SessionId, signal: AbortSignal | undefined) => Promise<{
|
|
67
|
-
header: SessionHeader;
|
|
68
|
-
inheritedEventCount: SessionLogOffset;
|
|
69
|
-
events: readonly SessionEvent[];
|
|
70
|
-
}>;
|
|
71
|
-
/**
|
|
72
|
-
* The skip-tolerant observation pass: structurally the upstream loop, with
|
|
73
|
-
* the per-source cold read wrapped so one unreadable session degrades to a
|
|
74
|
-
* warning instead of failing every search. Exported for unit tests with an
|
|
75
|
-
* injectable cold reader.
|
|
76
|
-
*/
|
|
77
|
-
export declare function observeStableWithSkip(engine: EngineSurface, indexed: ReadonlyMap<SessionId, {
|
|
78
|
-
revision: SessionPersistenceRevision;
|
|
79
|
-
}>, signal: AbortSignal | undefined, readCold?: ColdRead): Promise<{
|
|
80
|
-
persistenceBinding: EngineSurface['_persistenceBinding'];
|
|
81
|
-
persisted: Map<SessionId, ObservedPersistedSession>;
|
|
82
|
-
live: Map<SessionId, ObservedSession>;
|
|
83
|
-
}>;
|
|
84
|
-
declare const EngineBase: abstract new (ctx: never, config: Config) => EngineSurface & object;
|
|
85
|
-
/** The engine this bundle mounts in place of the base `session-query-sqlite` row. */
|
|
86
|
-
export declare class SkipTolerantSessionQueryEngine extends EngineBase {
|
|
87
|
-
_observeStable(indexed: ReadonlyMap<SessionId, {
|
|
88
|
-
revision: SessionPersistenceRevision;
|
|
89
|
-
}>, signal: AbortSignal | undefined): Promise<unknown>;
|
|
90
|
-
}
|
|
91
|
-
declare const _default: typeof SqliteSessionQueryEngine;
|
|
92
|
-
export default _default;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** Latest-wins, idle-bound queue for safe Agent session changes. */
|
|
2
|
-
export interface IdleActivity {
|
|
3
|
-
readonly status: 'idle' | 'running';
|
|
4
|
-
whenIdle(): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export declare class SessionSwitchQueue<T> {
|
|
7
|
-
private readonly execute;
|
|
8
|
-
private readonly failed;
|
|
9
|
-
private pending;
|
|
10
|
-
private pumping;
|
|
11
|
-
constructor(execute: (value: T) => Promise<void>, failed: (error: unknown) => void);
|
|
12
|
-
/** Queue a request; a later request replaces any request still waiting. */
|
|
13
|
-
request(activity: IdleActivity, value: T): 'queued' | 'started';
|
|
14
|
-
/** Cancel only work that has not begun activation. */
|
|
15
|
-
cancel(): boolean;
|
|
16
|
-
private pump;
|
|
17
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Serialized, crash-atomic persistence for the small user-level JSON files
|
|
3
|
-
* under the DSH home (statusline.json, theme.json). Two guarantees the bare
|
|
4
|
-
* floating `writeFile` path could not give:
|
|
5
|
-
*
|
|
6
|
-
* 1. Every save is appended to ONE chain, so rapid consecutive edits land
|
|
7
|
-
* in submission order and the last snapshot is the one on disk (parallel
|
|
8
|
-
* floating writes let an older snapshot finish last and win).
|
|
9
|
-
* 2. Each write goes to a sibling temp file first and is renamed into
|
|
10
|
-
* place, so a crash mid-write can never leave a half-written JSON
|
|
11
|
-
* document behind.
|
|
12
|
-
*
|
|
13
|
-
* The chain itself never rejects: a failed write is reported to that
|
|
14
|
-
* save's caller while later saves keep their turn.
|
|
15
|
-
*
|
|
16
|
-
* @module @deepseek-ai/dsh-code/settings-file
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Write one file atomically: create the parent directory, write to a
|
|
20
|
-
* uniquely named temp file, and rename it into place. A crash midway
|
|
21
|
-
* can never leave a half-written document behind. Unique temp names
|
|
22
|
-
* keep concurrent writers (two terminals, two chains in one process)
|
|
23
|
-
* from sharing one temp path.
|
|
24
|
-
*/
|
|
25
|
-
export declare function writeFileAtomically(path: string, text: string): Promise<void>;
|
|
26
|
-
/** The serialized persistence surface; flush() is handed to the quit sequence. */
|
|
27
|
-
export interface UserSettingsPersistence {
|
|
28
|
-
/**
|
|
29
|
-
* Queue one file snapshot. Resolves when the chain reaches (and renames)
|
|
30
|
-
* it; rejects only to THIS caller when its own write failed.
|
|
31
|
-
*/
|
|
32
|
-
save(path: string, text: string): Promise<void>;
|
|
33
|
-
/** Wait for every queued write; safe to call repeatedly. */
|
|
34
|
-
flush(): Promise<void>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Create the shared settings-write chain. One instance per process keeps
|
|
38
|
-
* every user-level JSON file mutually serialized.
|
|
39
|
-
* @returns the persistence handle.
|
|
40
|
-
*/
|
|
41
|
-
export declare function createUserSettingsPersistence(): UserSettingsPersistence;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User-invocable skill watch for the `/` completion menu: the in-process
|
|
3
|
-
* equivalent of the web ui-skill trigger source. Skills are NOT commands —
|
|
4
|
-
* picking one lands the literal `/name ` text in the input, and submitting
|
|
5
|
-
* it as a normal prompt lets the host's tool-skill pre-step inject the body
|
|
6
|
-
* (the only entry point for model-disabled skills). Command descriptors win
|
|
7
|
-
* on a name collision; see the runner's dispatch.
|
|
8
|
-
*
|
|
9
|
-
* @module @deepseek-ai/dsh-code/skills
|
|
10
|
-
*/
|
|
11
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
12
|
-
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
13
|
-
/** One completion-menu row derived from a user-invocable skill. */
|
|
14
|
-
export interface SkillRow {
|
|
15
|
-
/** Skill name; the literal `/name` text is what a pick lands. */
|
|
16
|
-
name: string;
|
|
17
|
-
/** Human-readable description (suffixed when model-invocation is off). */
|
|
18
|
-
description: string;
|
|
19
|
-
/** Whether the model may also invoke this skill by name. */
|
|
20
|
-
modelInvocable: boolean;
|
|
21
|
-
}
|
|
22
|
-
/** The skill-catalog snapshot the completion menu subscribes to. */
|
|
23
|
-
export interface SkillsView {
|
|
24
|
-
/** Name-sorted user-invocable rows; empty until the first load lands. */
|
|
25
|
-
readonly rows: readonly SkillRow[];
|
|
26
|
-
/** Latest catalog-read failure; the help panel exposes it in place. */
|
|
27
|
-
readonly error?: string;
|
|
28
|
-
/** Subscribe to catalog changes; returns the unsubscribe function. */
|
|
29
|
-
subscribe(listener: () => void): () => void;
|
|
30
|
-
/** Retarget the agent whose workspace the catalog is read for. */
|
|
31
|
-
setAgent(agent: Agent): void;
|
|
32
|
-
}
|
|
33
|
-
/** Internal shape shared by {@link watchSkills} and its test doubles. */
|
|
34
|
-
interface SkillsWatch extends SkillsView {
|
|
35
|
-
setAgent(agent: Agent): void;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Watch the user-invocable skill catalog for one agent's workspace. The first
|
|
39
|
-
* load starts when the owning agent is known (`setAgent`); `skills/change`
|
|
40
|
-
* and agent retargets re-read. Read failures keep the last good rows (the
|
|
41
|
-
* next change notification is the retry surface) — a missing `skills`
|
|
42
|
-
* service leaves the view permanently empty.
|
|
43
|
-
* @param ctx - context carrying the `skills` service (optional).
|
|
44
|
-
* @returns the view the completion menu subscribes to.
|
|
45
|
-
*/
|
|
46
|
-
export declare function watchSkills(ctx: Context, fallbackCwd?: string): SkillsWatch;
|
|
47
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The interactive terminal app's command-line provider: parses `--resume`,
|
|
3
|
-
* `--continue`, `--session`, `--mode`, `--theme`, `--image`, an optional
|
|
4
|
-
* initial prompt, and `--help`, then
|
|
5
|
-
* publishes {@link TUI_STARTUP_SERVICE} for the runner to consume lazily.
|
|
6
|
-
* Follows the headless bundle's startup shape (a commander action publishing
|
|
7
|
-
* a service through {@link parseCmdline}).
|
|
8
|
-
*
|
|
9
|
-
* Semantics:
|
|
10
|
-
* - `--resume <id|prefix>` — continue the persisted session whose id or unique
|
|
11
|
-
* id-prefix matches; the TUI replays its transcript and appends to the same
|
|
12
|
-
* durable log.
|
|
13
|
-
* - `--continue` / `-c` — resume the most recently modified persisted session
|
|
14
|
-
* whose project directory matches the current working directory.
|
|
15
|
-
* - `--session <id>` — create a new session under an explicit identity (the
|
|
16
|
-
* id must not exist yet).
|
|
17
|
-
* - `--theme <dark|light|prismatic|rainbow|auto>` — the color palette; auto follows the
|
|
18
|
-
* terminal (dark fallback until OSC-11 detection lands).
|
|
19
|
-
* - no flags — a fresh session with a minted id.
|
|
20
|
-
*
|
|
21
|
-
* @module @deepseek-ai/dsh-tui/startup
|
|
22
|
-
*/
|
|
23
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
24
|
-
import { type ThemeName } from './theme.ts';
|
|
25
|
-
/** Stable Cordis plugin name. */
|
|
26
|
-
export declare const name = "tui-startup";
|
|
27
|
-
/** Services required before the invocation can be resolved. */
|
|
28
|
-
export declare const inject: string[];
|
|
29
|
-
/** How the runner obtains its session identity. */
|
|
30
|
-
export type TuiStartup = ({
|
|
31
|
-
readonly kind: 'fresh';
|
|
32
|
-
readonly mode?: string;
|
|
33
|
-
} & TuiStartupInput) | ({
|
|
34
|
-
readonly kind: 'named';
|
|
35
|
-
readonly sessionId: string;
|
|
36
|
-
readonly mode?: string;
|
|
37
|
-
} & TuiStartupInput) | ({
|
|
38
|
-
readonly kind: 'resume';
|
|
39
|
-
readonly sessionId: string;
|
|
40
|
-
} & TuiStartupInput) | ({
|
|
41
|
-
readonly kind: 'latest';
|
|
42
|
-
} & TuiStartupInput);
|
|
43
|
-
interface TuiStartupInput {
|
|
44
|
-
readonly theme?: ThemeName;
|
|
45
|
-
readonly prompt?: string;
|
|
46
|
-
readonly images?: readonly string[];
|
|
47
|
-
}
|
|
48
|
-
export interface TuiStartupOptions {
|
|
49
|
-
readonly resume?: string;
|
|
50
|
-
readonly continue?: boolean;
|
|
51
|
-
readonly session?: string;
|
|
52
|
-
readonly mode?: string;
|
|
53
|
-
readonly theme?: ThemeName;
|
|
54
|
-
readonly prompt?: string;
|
|
55
|
-
readonly images?: readonly string[];
|
|
56
|
-
}
|
|
57
|
-
/** Pure option policy shared by Commander and tests. */
|
|
58
|
-
export declare function resolveTuiStartup(options: TuiStartupOptions): TuiStartup;
|
|
59
|
-
/**
|
|
60
|
-
* Parse the invocation and publish the startup service. Mutual exclusions are
|
|
61
|
-
* usage errors rejected from the action before anything is provided.
|
|
62
|
-
* @param ctx - plugin context carrying the command line and exit request.
|
|
63
|
-
*/
|
|
64
|
-
export declare function apply(ctx: Context): void;
|
|
65
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Observable transcript store: folds session events into the projection view
|
|
3
|
-
* and notifies subscribers. The renderer subscribes through
|
|
4
|
-
* `useSyncExternalStore`; the runner owns event feeding.
|
|
5
|
-
*
|
|
6
|
-
* Folding runs on the same mutable replay accumulator the persisted-log
|
|
7
|
-
* path uses (`replayProjectEvent`: id-indexed row updates, in-place
|
|
8
|
-
* appends), so a live structural event costs O(1) entry work regardless of
|
|
9
|
-
* transcript length — the copy-on-write fold rebuilt the whole entries
|
|
10
|
-
* array per event, making a growing session quadratic. An immutable
|
|
11
|
-
* `TranscriptView` snapshot is materialized only when a changed view is
|
|
12
|
-
* READ (once per rendered frame under the notification throttle, never per
|
|
13
|
-
* event), and every snapshot copies its arrays, so a view already handed
|
|
14
|
-
* out never observes later folds.
|
|
15
|
-
*
|
|
16
|
-
* Notification coalescing: the fold stays synchronous — `getView()` always
|
|
17
|
-
* returns the latest state the moment `apply` returns — but listener
|
|
18
|
-
* notification is frame-throttled (~16ms) and deduplicated. The zai/GLM
|
|
19
|
-
* adapter delivers tokens as a sustained stream of sub-millisecond,
|
|
20
|
-
* microtask-spaced bursts: per-burst notification renders at microtask
|
|
21
|
-
* cadence, which chained SyncLane `useSyncExternalStore` rerenders past
|
|
22
|
-
* React's nested-update limit ("Maximum update depth exceeded"), while a
|
|
23
|
-
* bare `setImmediate` merges a whole macrotask turn's bursts into one
|
|
24
|
-
* chunky repaint (streaming text visibly staggers). The frame budget gives
|
|
25
|
-
* both: an event ≥16ms after the last paint notifies via `setImmediate`
|
|
26
|
-
* (sub-millisecond latency for sparse/first tokens), and anything denser
|
|
27
|
-
* defers to the next 16ms boundary — a 60fps render cap that also breaks
|
|
28
|
-
* the nesting chain by construction.
|
|
29
|
-
*
|
|
30
|
-
* @module @deepseek-ai/dsh-tui/store
|
|
31
|
-
*/
|
|
32
|
-
import type { AssistantStreamFrame } from '@deepseek-ai/dsh-agent';
|
|
33
|
-
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
34
|
-
import { type TranscriptView } from './render/projection.ts';
|
|
35
|
-
/** The externally readable, event-fed transcript store for one session. */
|
|
36
|
-
export interface TranscriptStore {
|
|
37
|
-
/** The current view; the same object identity until an event changes it. */
|
|
38
|
-
getView(): TranscriptView;
|
|
39
|
-
/** Subscribe to view changes; returns the unsubscribe function. */
|
|
40
|
-
subscribe(listener: () => void): () => void;
|
|
41
|
-
/** Fold one session event; ignored events change nothing and notify nobody. */
|
|
42
|
-
apply(event: SessionEvent): void;
|
|
43
|
-
/** Fold one live assistant-stream frame; frames without visible deltas stay silent. */
|
|
44
|
-
applyStreamFrame(frame: AssistantStreamFrame): void;
|
|
45
|
-
/** Drop the folded view entirely (/clear): the next event starts a fresh one. */
|
|
46
|
-
reset(): void;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Create one transcript store, optionally seeded with replayed history. The
|
|
50
|
-
* seed folds synchronously BEFORE the first render, so a resumed session
|
|
51
|
-
* paints its full transcript on mount (no live `session/event` fires for
|
|
52
|
-
* constructor seeds — the store's `session/event` feed only carries new
|
|
53
|
-
* appends).
|
|
54
|
-
* @param replay - persisted events in `seq` order (e.g. a resumed session's
|
|
55
|
-
* constructor seed); folded once and never re-notified.
|
|
56
|
-
* @returns the store the runner feeds and the renderer subscribes to.
|
|
57
|
-
*/
|
|
58
|
-
export declare function createTranscriptStore(replay?: readonly SessionEvent[]): TranscriptStore;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Live subagent activity feed: a bounded, display-only projection of CHILD
|
|
3
|
-
* session events. The transcript store folds only the root session (the
|
|
4
|
-
* durable truth this TUI renders); subagent conversations are their own
|
|
5
|
-
* sessions, and before this module their events were dropped entirely —
|
|
6
|
-
* a running subagent was invisible until its parent tool call settled.
|
|
7
|
-
*
|
|
8
|
-
* This is NOT a second transcript: each child folds to ONE row (label,
|
|
9
|
-
* running state, bounded last-activity text), capped at
|
|
10
|
-
* {@link MAX_SUBAGENT_ROWS}. The cap is a display budget, not a fan-out
|
|
11
|
-
* limit: a new running child evicts the OLDEST settled row when one
|
|
12
|
-
* exists, and while every row is busy the newcomer waits off-screen — but
|
|
13
|
-
* the observed-session total (getTotalSeen) keeps counting, so status
|
|
14
|
-
* totals never under-report the fan-out. Rows are advisory display
|
|
15
|
-
* state, rebuilt from live events; nothing here persists or replays.
|
|
16
|
-
* Notification is coalesced
|
|
17
|
-
* by the same ~16ms frame throttle as the transcript store (per-burst
|
|
18
|
-
* microtask notify chained SyncLane rerenders past React's nested update
|
|
19
|
-
* limit; a bare macrotask merge repaints a whole turn's bursts at once).
|
|
20
|
-
*
|
|
21
|
-
* @module @deepseek-ai/dsh-code/subagents
|
|
22
|
-
*/
|
|
23
|
-
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
24
|
-
/** Hard row cap: overflow evicts the oldest settled row; a fully busy feed waits. */
|
|
25
|
-
export declare const MAX_SUBAGENT_ROWS = 8;
|
|
26
|
-
/** One live subagent row in the feed. */
|
|
27
|
-
export interface SubagentRow {
|
|
28
|
-
/** Child session id. */
|
|
29
|
-
readonly id: string;
|
|
30
|
-
/** Display label (session title when observed, else a short id form). */
|
|
31
|
-
readonly label: string;
|
|
32
|
-
/** Coarse lifecycle state folded from the child's events. */
|
|
33
|
-
readonly state: 'running' | 'idle' | 'done';
|
|
34
|
-
/** Bounded last-activity text for the status line. */
|
|
35
|
-
readonly activity: string;
|
|
36
|
-
/** Last fold time (ms, event clock) — newest-first ordering key. */
|
|
37
|
-
readonly updatedAt: number;
|
|
38
|
-
}
|
|
39
|
-
/** The read-only snapshot surface the renderer subscribes to. */
|
|
40
|
-
export interface SubagentFeedView {
|
|
41
|
-
/** Subscribe to feed changes; returns the unsubscribe function. */
|
|
42
|
-
subscribe(listener: () => void): () => void;
|
|
43
|
-
/** Read the current rows (identity-stable between changes). */
|
|
44
|
-
getSnapshot(): readonly SubagentRow[];
|
|
45
|
-
/**
|
|
46
|
-
* Distinct child sessions observed since the last reset. The row cap is
|
|
47
|
-
* a display budget, not a count of the fan-out; totals surface this.
|
|
48
|
-
*/
|
|
49
|
-
getTotalSeen(): number;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Fold one child-session event into its feed row (pure).
|
|
53
|
-
* Unknown event kinds leave the row untouched.
|
|
54
|
-
* @param previous - the row's current state, when any.
|
|
55
|
-
* @param sessionId - the child session id.
|
|
56
|
-
* @param event - the child session event.
|
|
57
|
-
* @returns the next row state.
|
|
58
|
-
*/
|
|
59
|
-
export declare function foldSubagentRow(previous: SubagentRow | undefined, sessionId: string, event: SessionEvent): SubagentRow;
|
|
60
|
-
/**
|
|
61
|
-
* Create one subagent feed. `apply` folds a child event (the caller gates
|
|
62
|
-
* which sessions are children); `reset` clears on a session switch. Row
|
|
63
|
-
* order is first-seen; the snapshot array is frozen and only replaced when
|
|
64
|
-
* a row actually changed.
|
|
65
|
-
* @returns the mutable feed handle plus its `SubagentFeedView`.
|
|
66
|
-
*/
|
|
67
|
-
export declare function createSubagentFeed(): SubagentFeedView & {
|
|
68
|
-
apply(sessionId: string, event: SessionEvent): void;
|
|
69
|
-
reset(): void;
|
|
70
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal tab/window title management for the TUI.
|
|
3
|
-
*
|
|
4
|
-
* Terminals label their tab from the window title, which an application sets
|
|
5
|
-
* with an OSC 0 sequence; without one the tab shows the process name ("node").
|
|
6
|
-
* The title text is untrusted display content (session names arrive through
|
|
7
|
-
* events and user input), so it is sanitized before emission: control
|
|
8
|
-
* characters and bidi/invisible formatting codepoints are stripped, whitespace
|
|
9
|
-
* runs collapse to single spaces, and the result is bounded. Clearing writes
|
|
10
|
-
* an empty OSC payload and the terminal falls back to its own default; the
|
|
11
|
-
* previously set title is not portable to read back and is never restored.
|
|
12
|
-
*
|
|
13
|
-
* @module @deepseek-ai/dsh-code/terminal-title
|
|
14
|
-
*/
|
|
15
|
-
/** Tab label before a session carries a name. */
|
|
16
|
-
export declare const DEFAULT_TERMINAL_TITLE = "deepseek";
|
|
17
|
-
/** Practical upper bound on title length, in visible characters: long enough
|
|
18
|
-
* for session names, short enough for tab bars and window managers. */
|
|
19
|
-
export declare const MAX_TERMINAL_TITLE_CHARS = 240;
|
|
20
|
-
/** Normalize untrusted title text into one bounded display line: disallowed
|
|
21
|
-
* codepoints dropped, whitespace runs collapsed to single spaces, leading and
|
|
22
|
-
* trailing whitespace removed, length bounded. */
|
|
23
|
-
export declare function sanitizeTerminalTitle(text: string): string;
|
|
24
|
-
/** Build one OSC 0 title sequence. An empty sanitized title yields an empty
|
|
25
|
-
* string: emitting nothing is distinct from clearing, which is a separate
|
|
26
|
-
* policy decision made by the caller. */
|
|
27
|
-
export declare function terminalTitleSequence(text: string): string;
|
|
28
|
-
/** Clear the managed title with an empty OSC payload; the terminal falls back
|
|
29
|
-
* to its own default label. */
|
|
30
|
-
export declare function clearTerminalTitleSequence(): string;
|
|
31
|
-
/**
|
|
32
|
-
* Resolve the VS Code stable user-settings file for one platform and
|
|
33
|
-
* environment: `%APPDATA%` on Windows, the bundle data folder on macOS (NOT
|
|
34
|
-
* XDG `~/.config` — VS Code never reads that path there, so writing it
|
|
35
|
-
* silently no-ops and the tab kept showing the process name "node"), and
|
|
36
|
-
* XDG config on Linux.
|
|
37
|
-
*/
|
|
38
|
-
export declare function vscodeSettingsPath(platform: NodeJS.Platform, env: NodeJS.ProcessEnv): string | undefined;
|
|
39
|
-
/** Outcome of the VS Code settings alignment. */
|
|
40
|
-
export interface VsCodeTitleSettingResult {
|
|
41
|
-
wrote: boolean;
|
|
42
|
-
reason?: 'not-vscode' | 'unparseable' | 'key-present' | 'error';
|
|
43
|
-
}
|
|
44
|
-
/** VS Code renders an application-set tab title only when
|
|
45
|
-
* "terminal.integrated.tabs.title" maps to the sequence variable; the editor
|
|
46
|
-
* default shows the process name instead ("node" for a Node CLI). Inside a VS
|
|
47
|
-
* Code integrated terminal, align the user settings once: if the key is
|
|
48
|
-
* absent, insert it and keep a one-shot backup of the original file. A value
|
|
49
|
-
* the user already set is never overwritten, an unparseable file is never
|
|
50
|
-
* touched, and every failure degrades to a no-op - the OSC and process-title
|
|
51
|
-
* channels keep working everywhere else. */
|
|
52
|
-
export declare function ensureVsCodeTabTitleSetting(options?: {
|
|
53
|
-
env?: NodeJS.ProcessEnv;
|
|
54
|
-
settingsFile?: string;
|
|
55
|
-
isTTY?: boolean;
|
|
56
|
-
}): VsCodeTitleSettingResult;
|
|
57
|
-
/**
|
|
58
|
-
* Keep the terminal tab label on `title` (sanitized; empty titles leave the
|
|
59
|
-
* current label alone). Two delivery channels run in parallel: the OSC 0
|
|
60
|
-
* sequence to stdout, and the host process title. Writes are deduplicated by
|
|
61
|
-
* title, and on unmount the managed title is cleared and the process title
|
|
62
|
-
* restored so the host shell regains its default label.
|
|
63
|
-
*/
|
|
64
|
-
export declare function useTerminalTitle(title: string, options?: {
|
|
65
|
-
clearOnUnmount?: boolean;
|
|
66
|
-
}): void;
|