@toddzheng024/dscode-bundle 0.7.12 → 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.
Files changed (152) hide show
  1. package/THIRD_PARTY_NOTICES.md +3 -3
  2. package/cordis.patch.yml +1 -1
  3. package/package.json +5 -4
  4. package/plugins/session-metrics/view.mjs +10 -2
  5. package/vendor/tui/lib/app.mjs +6674 -0
  6. package/vendor/tui/lib/approval.mjs +122 -0
  7. package/vendor/tui/lib/attachments.mjs +218 -0
  8. package/vendor/tui/lib/authorization-panel.mjs +242 -0
  9. package/vendor/tui/lib/authorization.mjs +111 -0
  10. package/vendor/tui/lib/commands.mjs +123 -0
  11. package/vendor/tui/lib/dscode/chat.mjs +64 -0
  12. package/vendor/tui/lib/dscode/flags.mjs +32 -0
  13. package/vendor/tui/lib/dscode/model-search.mjs +68 -0
  14. package/vendor/tui/lib/dscode/paste.mjs +87 -0
  15. package/vendor/tui/lib/dscode/telemetry.mjs +82 -0
  16. package/vendor/tui/lib/dscode/welcome.mjs +100 -0
  17. package/vendor/tui/lib/editor-keys.mjs +346 -0
  18. package/vendor/tui/lib/editor.mjs +50 -0
  19. package/vendor/tui/lib/fork.mjs +24 -0
  20. package/vendor/tui/lib/git-workflow.mjs +278 -0
  21. package/vendor/tui/{types/history.d.ts → lib/history.mjs} +69 -26
  22. package/vendor/tui/{types/i18n.d.ts → lib/i18n.mjs} +23 -15
  23. package/vendor/tui/lib/index.mjs +2198 -0
  24. package/vendor/tui/lib/input-split.mjs +170 -0
  25. package/vendor/tui/lib/internals.mjs +90 -0
  26. package/vendor/tui/lib/invariant.mjs +22 -0
  27. package/vendor/tui/lib/kernel-panels.mjs +1265 -0
  28. package/vendor/tui/lib/keyboard.mjs +283 -0
  29. package/vendor/tui/lib/language-panel.mjs +41 -0
  30. package/vendor/tui/lib/locales/en.mjs +495 -0
  31. package/vendor/tui/lib/locales/zh.mjs +495 -0
  32. package/vendor/tui/lib/mentions.mjs +150 -0
  33. package/vendor/tui/lib/model-capabilities.mjs +245 -0
  34. package/vendor/tui/lib/models.mjs +215 -0
  35. package/vendor/tui/{types/panel-accent.d.ts → lib/panel-accent.mjs} +11 -7
  36. package/vendor/tui/lib/permissions.mjs +45 -0
  37. package/vendor/tui/lib/plugin-inventory.mjs +27 -0
  38. package/vendor/tui/lib/presets.mjs +46 -0
  39. package/vendor/tui/lib/provider-settings.mjs +600 -0
  40. package/vendor/tui/lib/questions.mjs +116 -0
  41. package/vendor/tui/lib/rainbow.mjs +181 -0
  42. package/vendor/tui/lib/render/animations.mjs +665 -0
  43. package/vendor/tui/lib/render/editor.mjs +437 -0
  44. package/vendor/tui/lib/render/export.mjs +119 -0
  45. package/vendor/tui/lib/render/fuzzy.mjs +79 -0
  46. package/vendor/tui/lib/render/ime-cursor.mjs +135 -0
  47. package/vendor/tui/lib/render/inspector.mjs +93 -0
  48. package/vendor/tui/lib/render/lines.mjs +538 -0
  49. package/vendor/tui/lib/render/markdown.mjs +592 -0
  50. package/vendor/tui/lib/render/projection.mjs +1862 -0
  51. package/vendor/tui/lib/render/status.mjs +591 -0
  52. package/vendor/tui/lib/render/text.mjs +157 -0
  53. package/vendor/tui/lib/render/tool-detail.mjs +187 -0
  54. package/vendor/tui/lib/render/tool-preview.mjs +79 -0
  55. package/vendor/tui/lib/render/usage.mjs +336 -0
  56. package/vendor/tui/lib/render/width.mjs +191 -0
  57. package/vendor/tui/lib/session-directory.mjs +329 -0
  58. package/vendor/tui/lib/session-query.mjs +184 -0
  59. package/vendor/tui/lib/session-switch.mjs +51 -0
  60. package/vendor/tui/lib/settings-file.mjs +75 -0
  61. package/vendor/tui/lib/skills.mjs +119 -0
  62. package/vendor/tui/lib/startup.mjs +111 -0
  63. package/vendor/tui/lib/store.mjs +129 -0
  64. package/vendor/tui/lib/subagents.mjs +200 -0
  65. package/vendor/tui/lib/terminal-title.mjs +186 -0
  66. package/vendor/tui/lib/theme-panel.mjs +60 -0
  67. package/vendor/tui/lib/theme.mjs +379 -0
  68. package/vendor/tui/lib/update-panel.mjs +239 -0
  69. package/vendor/tui/lib/update.mjs +101 -0
  70. package/vendor/tui/lib/version.mjs +105 -0
  71. package/vendor/tui/lib/whale-glyph.mjs +20 -0
  72. package/vendor/tui/LICENSE +0 -21
  73. package/vendor/tui/devtools-CdTl3MNy.mjs +0 -3643
  74. package/vendor/tui/dscode-email/cli.mjs +0 -32
  75. package/vendor/tui/dscode-email/contacts.mjs +0 -36
  76. package/vendor/tui/dscode-email/gmail-oauth.mjs +0 -69
  77. package/vendor/tui/dscode-email/gmail-store.mjs +0 -2
  78. package/vendor/tui/dscode-email/gmail.mjs +0 -194
  79. package/vendor/tui/dscode-email/imap.mjs +0 -136
  80. package/vendor/tui/dscode-email/inbox.d.mts +0 -25
  81. package/vendor/tui/dscode-email/inbox.mjs +0 -76
  82. package/vendor/tui/dscode-email/smtp.mjs +0 -69
  83. package/vendor/tui/dscode-email/store.mjs +0 -32
  84. package/vendor/tui/dscode-providers/catalog.mjs +0 -136
  85. package/vendor/tui/dscode-providers/effort.mjs +0 -35
  86. package/vendor/tui/dscode-providers/openrouter-account.mjs +0 -171
  87. package/vendor/tui/index.mjs +0 -44441
  88. package/vendor/tui/invariant.mjs +0 -21
  89. package/vendor/tui/rolldown-runtime-CMFfr-1z.mjs +0 -26
  90. package/vendor/tui/session-query.mjs +0 -150
  91. package/vendor/tui/startup.mjs +0 -109
  92. package/vendor/tui/theme-7u5Qo3dF.mjs +0 -1265
  93. package/vendor/tui/types/app.d.ts +0 -348
  94. package/vendor/tui/types/approval.d.ts +0 -59
  95. package/vendor/tui/types/attachments.d.ts +0 -52
  96. package/vendor/tui/types/authorization-panel.d.ts +0 -22
  97. package/vendor/tui/types/authorization.d.ts +0 -36
  98. package/vendor/tui/types/commands.d.ts +0 -52
  99. package/vendor/tui/types/editor-keys.d.ts +0 -105
  100. package/vendor/tui/types/editor.d.ts +0 -6
  101. package/vendor/tui/types/fork.d.ts +0 -8
  102. package/vendor/tui/types/git-workflow.d.ts +0 -121
  103. package/vendor/tui/types/index.d.ts +0 -223
  104. package/vendor/tui/types/input-split.d.ts +0 -54
  105. package/vendor/tui/types/internals.d.ts +0 -26
  106. package/vendor/tui/types/invariant.d.ts +0 -15
  107. package/vendor/tui/types/kernel-panels.d.ts +0 -245
  108. package/vendor/tui/types/keyboard.d.ts +0 -80
  109. package/vendor/tui/types/language-panel.d.ts +0 -12
  110. package/vendor/tui/types/locales/en.d.ts +0 -450
  111. package/vendor/tui/types/locales/zh.d.ts +0 -9
  112. package/vendor/tui/types/mentions.d.ts +0 -85
  113. package/vendor/tui/types/model-capabilities.d.ts +0 -82
  114. package/vendor/tui/types/models.d.ts +0 -133
  115. package/vendor/tui/types/permissions.d.ts +0 -27
  116. package/vendor/tui/types/plugin-inventory.d.ts +0 -11
  117. package/vendor/tui/types/presets.d.ts +0 -22
  118. package/vendor/tui/types/provider-settings.d.ts +0 -239
  119. package/vendor/tui/types/questions.d.ts +0 -54
  120. package/vendor/tui/types/rainbow.d.ts +0 -69
  121. package/vendor/tui/types/render/animations.d.ts +0 -307
  122. package/vendor/tui/types/render/editor.d.ts +0 -163
  123. package/vendor/tui/types/render/export.d.ts +0 -9
  124. package/vendor/tui/types/render/fuzzy.d.ts +0 -21
  125. package/vendor/tui/types/render/ime-cursor.d.ts +0 -60
  126. package/vendor/tui/types/render/inspector.d.ts +0 -62
  127. package/vendor/tui/types/render/lines.d.ts +0 -86
  128. package/vendor/tui/types/render/markdown.d.ts +0 -29
  129. package/vendor/tui/types/render/projection.d.ts +0 -587
  130. package/vendor/tui/types/render/status.d.ts +0 -196
  131. package/vendor/tui/types/render/text.d.ts +0 -64
  132. package/vendor/tui/types/render/tool-detail.d.ts +0 -94
  133. package/vendor/tui/types/render/tool-preview.d.ts +0 -28
  134. package/vendor/tui/types/render/usage.d.ts +0 -113
  135. package/vendor/tui/types/render/width.d.ts +0 -29
  136. package/vendor/tui/types/session-directory.d.ts +0 -190
  137. package/vendor/tui/types/session-query.d.ts +0 -92
  138. package/vendor/tui/types/session-switch.d.ts +0 -17
  139. package/vendor/tui/types/settings-file.d.ts +0 -41
  140. package/vendor/tui/types/skills.d.ts +0 -47
  141. package/vendor/tui/types/startup.d.ts +0 -65
  142. package/vendor/tui/types/store.d.ts +0 -58
  143. package/vendor/tui/types/subagents.d.ts +0 -70
  144. package/vendor/tui/types/terminal-title.d.ts +0 -66
  145. package/vendor/tui/types/theme-panel.d.ts +0 -24
  146. package/vendor/tui/types/theme.d.ts +0 -434
  147. package/vendor/tui/types/update-panel.d.ts +0 -49
  148. package/vendor/tui/types/update.d.ts +0 -75
  149. package/vendor/tui/types/version.d.ts +0 -19
  150. package/vendor/tui/types/whale-glyph.d.ts +0 -6
  151. /package/vendor/tui/{dscode-clipboard-image → lib/dscode/clipboard-image}/clipboard-image.swift +0 -0
  152. /package/vendor/tui/{dscode-clipboard-image → lib/dscode/clipboard-image}/index.mjs +0 -0
@@ -1,348 +0,0 @@
1
- /**
2
- * The Ink terminal app: whale-and-wordmark header in DeepSeek blue, the live
3
- * transcript, the todo panel, the streaming line, the approval bar, the model
4
- * panel, local notices, and the input box with history and slash-command
5
- * completion. All state arrives through the transcript store (derived from
6
- * the durable session log) plus local input state; the app owns no session
7
- * mutation of its own.
8
- *
9
- * Element construction uses `createElement` (not JSX): the `dsh` source launch
10
- * compiles this file through tsx's ESM-only hook, which does not adopt this
11
- * package's `jsx: react-jsx` compiler option, and the classic JSX runtime
12
- * would demand a React global.
13
- *
14
- * @module @deepseek-ai/dsh-code/app
15
- */
16
- import { type ReactElement } from 'react';
17
- import type { CommandDescriptor } from '@deepseek-ai/dsh-commands';
18
- import type { ContentBlock, FileBlock, ImageBlock } from '@deepseek-ai/dsh-llm';
19
- import type { AuthorizationInteraction, AuthorizationStatus } from '@deepseek-ai/dsh-authorization';
20
- import { type ThemeName } from './theme.ts';
21
- import { type LanguageName } from './i18n.ts';
22
- import type { LauncherUpdateStatus } from './update.ts';
23
- import type { TranscriptStore } from './store.ts';
24
- import { type TranscriptEntry } from './render/projection.ts';
25
- import type { ApprovalStore } from './approval.ts';
26
- import { type CommandsView } from './commands.ts';
27
- import type { ModelDirectory, ModelRow } from './models.ts';
28
- import { type DiscoveredModelView, type ProviderConfiguration, type ProviderSettingsDirectory, type ProviderTargetView } from './provider-settings.ts';
29
- import type { QuestionStore } from './questions.ts';
30
- import type { SkillsView, SkillRow } from './skills.ts';
31
- import { type MentionCandidate } from './mentions.ts';
32
- import type { SubagentFeedView } from './subagents.ts';
33
- import type { UsageView } from './render/usage.ts';
34
- import { type JobRow, type SearchRow } from './kernel-panels.ts';
35
- import type { PresetRow } from './presets.ts';
36
- import type { PermissionRow } from './permissions.ts';
37
- import type { PluginRow } from './plugin-inventory.ts';
38
- import type { SessionDirectoryOptions, SessionRow } from './session-directory.ts';
39
- import { type GitDiffView, type ReviewBranch, type ReviewCommit, type ReviewSelection } from './git-workflow.ts';
40
- import { type ProviderAuthorizationDirectory, type ProviderAuthorizationRow } from './authorization.ts';
41
- import { type FilePathInspection, type ImagePathInspection } from './attachments.ts';
42
- /** Visual priority for one bounded local notice. */
43
- export type NoticeTone = 'info' | 'warning' | 'error';
44
- /** One mutation the terminal may request for a pending next-turn inbox item. */
45
- export type QueueMutation = {
46
- readonly kind: 'remove';
47
- } | {
48
- readonly kind: 'edit';
49
- readonly text: string;
50
- } | {
51
- readonly kind: 'steer';
52
- };
53
- /** Props the runner hands the app; callbacks stay owned by the runner. */
54
- export interface AppProps {
55
- /** Event-fed transcript store for the live session. */
56
- store: TranscriptStore;
57
- /** Approval-question store fed by the answerer listener. */
58
- approval: ApprovalStore;
59
- /** ask_user_question store fed by the single UI provider. */
60
- questions: QuestionStore;
61
- /** Live subagent activity feed (child sessions of the current root). */
62
- subagents: SubagentFeedView;
63
- /** Live slash-command descriptor list (completion candidates). */
64
- commands: CommandsView;
65
- /** Live user-invocable skill catalog (completion candidates). */
66
- skills: SkillsView;
67
- /** `provider/model` selection serving this session (updated on /model). */
68
- model: string;
69
- /** Effective reasoning effort in force ('' when none), for the /model picker mark. */
70
- effort?: string;
71
- /** Working-directory basename the session serves. */
72
- cwd: string;
73
- /** Absolute working directory used by session filters and references. */
74
- workspaceRoot: string;
75
- /** Git branch name, empty outside a repository. */
76
- branch: string;
77
- /** Short session identifier. */
78
- sessionId: string;
79
- /** Whether this session was resumed from persistence. */
80
- resumed: boolean;
81
- /** Agent preset selected for the current or pending first session. */
82
- mode: string;
83
- /** Permission preset selected for the current or pending first session. */
84
- permission: string;
85
- /**
86
- * Submit one line: slash commands to the registry, other text to the agent.
87
- * The optional origin names the session the submission was composed for —
88
- * an attachment prepare resolves after the app remounted onto another
89
- * session, and the runner drops the stale delivery then.
90
- */
91
- dispatch: (text: string, attachments?: readonly ContentBlock[], origin?: string) => void;
92
- /**
93
- * Submit one line as steering: it joins the turn already running at its next
94
- * step boundary instead of waiting for the next turn. Same stale-delivery
95
- * guard as {@link dispatch}.
96
- */
97
- steer: (text: string, attachments?: readonly ContentBlock[], origin?: string) => void;
98
- /**
99
- * The FULL current session identity ('' while the first session is pending)
100
- * — the stale-delivery origin above. Distinct from the short display id.
101
- */
102
- sessionKey: string;
103
- /** Interrupt the running turn (Esc); true when a turn was cancelled. */
104
- interrupt: () => boolean;
105
- /** Quit: unmount, flush, and request process exit. */
106
- quit: () => void;
107
- /** Load the selectable model directory (called when /model opens). */
108
- loadModels: () => Promise<ModelDirectory>;
109
- /** Load @mention candidates for the typed query (files + sessions). */
110
- loadMentions: (query: string, signal?: AbortSignal) => Promise<readonly MentionCandidate[]>;
111
- /** Validate draft image paths without committing attachment objects. */
112
- inspectImages: (paths: readonly string[]) => Promise<readonly ImagePathInspection[]>;
113
- /** Validate, normalize and persist images immediately before submission. */
114
- prepareImages: (paths: readonly string[], signal?: AbortSignal) => Promise<readonly ImageBlock[]>;
115
- /** Validate draft non-image file paths without committing attachment objects. */
116
- inspectFiles: (paths: readonly string[]) => Promise<readonly FilePathInspection[]>;
117
- /** Persist non-image files immediately before submission as durable file blocks. */
118
- prepareFiles: (paths: readonly string[], signal?: AbortSignal) => Promise<readonly FileBlock[]>;
119
- /** Apply one /model selection (with an advertised reasoning effort, when picked); returns the display label. */
120
- selectModel: (row: ModelRow, effortId?: string) => string;
121
- /** The /subagent override label, '' when delegated agents follow the current model. */
122
- subagentModel: string;
123
- /** Apply one /subagent model pick; returns the override label. */
124
- setSubagentModel: (row: ModelRow, effortId?: string) => string;
125
- /** Drop the /subagent override (delegated agents follow the current model). */
126
- clearSubagentModel: () => void;
127
- /** Delete one session subtree; resolves with the outcome line. */
128
- deleteSession: (id: string) => Promise<string>;
129
- /** Load provider/settings/credential facts for the optional /model provider stage. */
130
- loadModelProviders?: () => Promise<ProviderSettingsDirectory>;
131
- /** Subscribe to Harness credential/settings/adapter invalidations while /model is open. */
132
- subscribeModelProviders?: (listener: () => void) => () => void;
133
- /** Store or rotate one provider credential through the Harness credential service. */
134
- saveModelProviderCredential?: (target: ProviderTargetView, key: string) => Promise<void>;
135
- /** Remove one writable provider credential without removing its settings profile. */
136
- unsetModelProviderCredential?: (target: ProviderTargetView) => Promise<void>;
137
- /** Remove one user-owned provider profile and its page-managed credential. */
138
- removeModelProvider?: (target: ProviderTargetView) => Promise<void>;
139
- /** Save endpoint and explicit model capacities through the provider profile. */
140
- saveModelProviderConfiguration?: (target: ProviderTargetView, configuration: ProviderConfiguration) => Promise<void>;
141
- /**
142
- * Interrogate the provider's real endpoint (typed key wins over the stored
143
- * credential) for the models it actually serves — the discovery stage of
144
- * the provider setup page.
145
- */
146
- discoverModelProvider?: (target: ProviderTargetView, request: {
147
- readonly apiKey?: string;
148
- readonly baseURL?: string;
149
- }, signal?: AbortSignal) => Promise<readonly DiscoveredModelView[]>;
150
- /** Provider authorization flows and value-free stored-record facts. */
151
- loadProviderAuthorizations?: () => Promise<ProviderAuthorizationDirectory>;
152
- subscribeProviderAuthorizations?: (listener: () => void) => () => void;
153
- beginProviderAuthorization?: (row: ProviderAuthorizationRow, method: string, interaction: AuthorizationInteraction, signal: AbortSignal) => Promise<AuthorizationStatus>;
154
- cancelProviderAuthorization?: (row: ProviderAuthorizationRow) => void;
155
- logoutProviderAuthorization?: (row: ProviderAuthorizationRow) => Promise<void>;
156
- openAuthorizationUrl?: (url: string) => boolean;
157
- copyTextValue?: (text: string) => Promise<void>;
158
- /** Cycle to the next mode station (Shift+Tab): a permission preset or a plan switch; returns the notice label. */
159
- cycleMode: () => string;
160
- /** Pre-session plan choice: shows the plan badge before the first session exists. */
161
- pendingPlan?: boolean;
162
- /** Select or inspect a permission preset without requiring a pre-existing session. */
163
- setPermission: (id: string) => string;
164
- /** Export the transcript to a markdown file (/export [path]); reports via notices. */
165
- exportTranscript: (argument: string) => Promise<void>;
166
- /** Rename the session (/title <text>); returns the outcome line for the notice. */
167
- renameTitle: (argument: string) => string;
168
- /** Copy the latest complete assistant response; resolves to notice text. */
169
- copyLastResponse: () => Promise<string>;
170
- /** Load a complete read-only Git diff for the file-oriented viewport. */
171
- loadGitDiff: (argument: string) => Promise<GitDiffView>;
172
- /** Local branches for the /review picker (absent: the picker hides the branch phase's list). */
173
- listReviewBranches?: (signal?: AbortSignal) => Promise<readonly ReviewBranch[]>;
174
- /** Recent commits on the current branch for the /review picker. */
175
- listReviewCommits?: (signal?: AbortSignal) => Promise<readonly ReviewCommit[]>;
176
- /** Start a model review after applying the read-only permission preset. */
177
- reviewChanges: (selection: ReviewSelection) => void;
178
- /** Preset/session/plugin kernel operations. */
179
- loadPresets: () => Promise<readonly PresetRow[]>;
180
- switchMode: (id: string) => Promise<string>;
181
- /** Load the switchable permission presets for the /permission panel. */
182
- loadPermissions: () => Promise<readonly PermissionRow[]>;
183
- createSession: (mode?: string) => void;
184
- /** Fork the active session at a completed-turn boundary. */
185
- forkSession: (argument: string) => void;
186
- loadSessions: (options: SessionDirectoryOptions, signal?: AbortSignal) => Promise<readonly SessionRow[]>;
187
- loadSessionTranscript: (id: string, signal?: AbortSignal) => Promise<string>;
188
- /** Read the current session's usage blocks (projections plus per-turn fold). */
189
- loadUsage: () => Promise<UsageView>;
190
- /**
191
- * Full-text search over every persisted session (the in-process
192
- * session-query engine). Absent when the deployment disabled the row;
193
- * /search degrades to a notice instead of opening the panel.
194
- */
195
- searchSessions?: (query: string, signal?: AbortSignal) => Promise<readonly SearchRow[]>;
196
- /** Load this session's subagent conversations (children by lineage). */
197
- loadSubagents: () => Promise<readonly SessionRow[]>;
198
- switchSession: (row: SessionRow) => void;
199
- cancelSessionSwitch: () => boolean;
200
- loadPlugins: () => readonly PluginRow[];
201
- /** Caller-visible background jobs (the host jobs registry, read-only). */
202
- loadJobs: () => readonly JobRow[];
203
- /** Probe the launcher's aligned update plan (read-only; never installs). */
204
- probeUpdate: () => Promise<LauncherUpdateStatus>;
205
- /** Run the launcher's aligned update; streams sanitized lines; resolves with the exit code. */
206
- applyUpdate: (onLine: (line: string) => void, plan?: {
207
- readonly dshSpec: string;
208
- readonly codeSpec: string;
209
- readonly pluginSpecs: readonly string[];
210
- }) => Promise<number>;
211
- /** Registers the app's notice channel with the runner (called once on mount). */
212
- onBridgeReady: (bridge: {
213
- notify: (text: string, tone?: NoticeTone) => void;
214
- }) => void;
215
- /** Ordered enabled status items (/statusline config); the runner owns persistence. */
216
- statusline: readonly string[];
217
- /** Persist a new statusline item set; the runner surfaces IO failures as notices. */
218
- saveStatusline: (items: readonly string[]) => void;
219
- /** Apply and persist one /language selection; the runner owns the language.json file. */
220
- saveLanguage: (name: LanguageName) => void;
221
- /** Apply and persist one /theme selection; the runner owns the theme.json file. */
222
- saveTheme?: (name: ThemeName) => void;
223
- /** Whether timed animations run at startup (animations.json; on by default
224
- * — like parseAnimationsPref, only an explicit false disables them). */
225
- animations?: boolean;
226
- /** Apply and persist one /animation toggle; the runner owns the file. */
227
- saveAnimations?: (enabled: boolean) => void;
228
- /** Persistent cross-session input history (oldest first); the runner owns the file. */
229
- history: readonly string[];
230
- /** Persist one submitted prompt to the global history file. */
231
- recordHistory: (text: string) => void;
232
- /** Mutate one next-turn inbox message; durable inbox splices reconcile the result. */
233
- updateQueued?: (messageId: string, action: QueueMutation) => void;
234
- /** Apply the Ctrl+R terminal passthrough to the detected editor (/vscode-keys); resolves to a one-line summary. */
235
- applyEditorKeys: () => Promise<string>;
236
- }
237
- /** Rows in the exact next-turn inbox order, never transcript append order. */
238
- export declare function queuedInboxRows(entries: readonly TranscriptEntry[], ids: readonly string[]): readonly Extract<TranscriptEntry, {
239
- kind: 'pending';
240
- }>[];
241
- /** One completion candidate row. */
242
- interface CompletionCandidate {
243
- /** Insertion text for the command name (with leading slash). */
244
- label: string;
245
- /** Human-readable description shown beside the label. */
246
- description: string;
247
- /** Candidate origin; skills land the same literal text but route through the prompt. */
248
- origin: 'command' | 'skill' | 'mention';
249
- }
250
- /**
251
- * Resolve completion candidates for the current input: TUI-local commands,
252
- * the live registry descriptors, and user-invocable skills, filtered by the
253
- * typed prefix. Command names win collisions (the dispatch tries the
254
- * registry first and only then falls through to the skill gesture), and a
255
- * later duplicate name never renders twice.
256
- *
257
- * A bare `/` returns the FULL merged list — Codex's command popup shows every
258
- * command inside a scroll window on an empty filter, and the menu's own
259
- * selection window bounds the visible rows, so no slice cap is needed.
260
- */
261
- export declare function completionCandidates(value: string, descriptors: readonly CommandDescriptor[], skills: readonly SkillRow[]): readonly CompletionCandidate[];
262
- /** One cached settled row: the row Box plus its roomy-prompt spacers. */
263
- interface SettledRowRecord {
264
- /** The row Box element (keyed by the entry's settled index). */
265
- box: ReactElement;
266
- /** The roomy-prompt spacer BEFORE the row, or undefined. */
267
- before: ReactElement | undefined;
268
- /** The roomy-prompt spacer AFTER the row, or undefined. */
269
- after: ReactElement | undefined;
270
- /** Physical rows this record contributes (row body plus spacers) — the
271
- * unit of the rendered-history cap. */
272
- rows: number;
273
- }
274
- /** The incremental settled-history cache (see `computeSettledRows`). */
275
- interface SettledRowsCache {
276
- /** The exact settled entries the cache covers (the WINDOW: the newest
277
- * `entries.length` settled entries, oldest dropped entries excluded). */
278
- entries: TranscriptEntry[];
279
- /** Records keyed by entry identity; mutated in place so the append path
280
- * never copies the whole map. */
281
- records: Map<TranscriptEntry, SettledRowRecord>;
282
- /** The header element (depends only on `resumed`). */
283
- header: ReactElement;
284
- /** The `resumed` the header was built with. */
285
- resumed: boolean;
286
- /** The toggle state the rows were built with. */
287
- showReasoning: boolean;
288
- /** The refreshEpoch the rows was built for; a bump forces a full rebuild. */
289
- epoch: number;
290
- /** The terminal width the rows were wrapped for; a change forces a rebuild. */
291
- columns: number;
292
- /** The flat row list (header + optional hint + per-entry before/box/after). */
293
- flat: ReactElement[];
294
- /** Settled entries dropped from the window's head (rendering only — the
295
- * event log keeps everything; Ctrl+O and /export read it directly). */
296
- droppedEntries: number;
297
- /** Physical rows the window's entries contribute (excludes header/hint). */
298
- totalRows: number;
299
- /** The window overflowed the trim hysteresis; one source-backed replay
300
- * (epoch bump) will re-window the cache. The append path never mutates
301
- * flat's head, so <Static> only ever sees tail appends between remounts. */
302
- needsTrim: boolean;
303
- }
304
- /** One step of `computeSettledRows`. */
305
- interface SettledRowsResult {
306
- cache: SettledRowsCache;
307
- /** How many rows had to be BUILT by this step (0 = pure reuse). */
308
- built: number;
309
- }
310
- /**
311
- * The settled `<Static>` row set as a PURE incremental state machine (App
312
- * drives it from the memo; tests drive it directly and read `built`).
313
- *
314
- * The settled prefix is permanently final: the projection only APPENDS below
315
- * the flush boundary, removes pending rows at or beyond it, and replaces
316
- * running tool/retry/command rows there too. So extending the cache never
317
- * rescans the old prefix — a grown boundary builds ONLY the newly settled
318
- * suffix and reuses every cached element, letting React bail out of unchanged
319
- * rows and keeping long histories out of the per-durable-event path (no O(N)
320
- * rebuild of rows, Map, or MarkdownBody parses). `records` is mutated in place
321
- * on the append/toggle paths to stay O(delta).
322
- *
323
- * RENDERED-HISTORY CAP: the window holds at most `rowCap` physical rows of
324
- * settled transcript (header and hint reserved on top). The cap exists only
325
- * here — the event log, the store projection, /export, Ctrl+O, and /resume
326
- * keep the full history. Ink 5's <Static> is a consumption counter
327
- * (items.slice(index) keyed on length): deleting head items mid-stream while
328
- * appending tail items can permanently swallow new rows, so the append branch
329
- * NEVER drops the head — it only accounts rows and flags `needsTrim` once the
330
- * window overflows cap + margin. The flag fires one source-backed replay
331
- * (epoch bump = the existing clear + <Static> remount), whose rebuild branch
332
- * walks the settled entries BACKWARD from the newest, keeps whole entries
333
- * until the cap, and counts everything older as `droppedEntries` (those
334
- * entries never even reach settledEntryLines). Hysteresis bounds replays to
335
- * at most one per 25% growth; resize / Ctrl+L / idle Ctrl+R replays re-window
336
- * for free on the same path.
337
- *
338
- * Full rebuilds run only on the rare, deliberate paths: no cache yet, a
339
- * source-backed replay (`epoch` bump: resize / Ctrl+L / an idle Ctrl+R fold
340
- * toggle / a cap trim remounts `<Static>` and must re-flush the CURRENT rows
341
- * at the CURRENT fold state), a `resumed` change, or a shrink (`store.reset`).
342
- * While a turn is busy or streaming, Ctrl+R only flips the live region; rows
343
- * already emitted to native scrollback change exclusively through rebuilds.
344
- */
345
- export declare function computeSettledRows(previous: SettledRowsCache | undefined, entries: readonly TranscriptEntry[], settled: number, showReasoning: boolean, resumed: boolean, epoch: number, columns?: number, rowCap?: number): SettledRowsResult;
346
- /** The whole terminal app; state arrives via the store, output via Ink. */
347
- export declare function App(props: AppProps): ReactElement;
348
- export {};
@@ -1,59 +0,0 @@
1
- /**
2
- * The terminal approval answerer: one `approval/request` waterfall listener
3
- * that renders the pending question as a y/n bar and resolves the decision
4
- * back into the waterfall. Mirrors the web host's composer takeover — the
5
- * service (audit pair, policy gate, fail-closed defaults) all live in
6
- * dsh-base; this module only answers for agents this TUI owns.
7
- *
8
- * Vocabulary note: a client answerer may only ever resolve `'allowed-once'`
9
- * or `'rejected'`; `'cancelled'` belongs to the request signal and
10
- * `'unavailable'` to the fail-closed waterfall default.
11
- *
12
- * @module @deepseek-ai/dsh-code/approval
13
- */
14
- import type { Context } from '@deepseek-ai/cordis';
15
- import type { Agent } from '@deepseek-ai/dsh-agent';
16
- import type { ApprovalRequest } from '@deepseek-ai/dsh-user-approval';
17
- /** The answer values a client answerer may resolve with. */
18
- export type ApprovalAnswer = 'allowed-once' | 'rejected';
19
- /** One pending approval question, derived from the request for rendering. */
20
- export interface PendingApproval {
21
- /** The asker's human-readable explanation, or a generic fallback. */
22
- headline: string;
23
- /** The tool the question is about. */
24
- toolName: string;
25
- /** Command-line preview resolved from the paired streaming tool call. */
26
- command: string;
27
- /** Resolve the ask; calling twice is inert (one-shot latch). */
28
- answer(outcome: ApprovalAnswer): void;
29
- }
30
- /** The pending-question snapshot the renderer subscribes to. */
31
- export interface ApprovalSnapshot {
32
- /** The question on screen (queue head), or undefined when none is asked. */
33
- pending: PendingApproval | undefined;
34
- /** Presentational: an answer was submitted, the ask has not settled yet. */
35
- answered: boolean;
36
- /** Further asks waiting behind the on-screen one (FIFO, Codex-style). */
37
- queued: number;
38
- }
39
- /** Store the pending question lands in; the renderer reads, the answerer writes. */
40
- export interface ApprovalStore {
41
- /** Subscribe to pending-state changes; returns the unsubscribe function. */
42
- subscribe(listener: () => void): () => void;
43
- /** Read the current snapshot (identity-stable between changes). */
44
- getSnapshot(): ApprovalSnapshot;
45
- }
46
- /**
47
- * Create the approval store and mount the answerer listener on the context.
48
- * The listener claims only requests for `owns`-owned agents and defers every
49
- * other request back into the waterfall (`next()`), so sibling answerers stay
50
- * usable. An aborted ask never reaches the human. Plugin teardown removes the
51
- * listener; the service then fails its own question closed.
52
- * @param ctx - plugin context whose event bus carries `approval/request`.
53
- * @param owns - agents this terminal answers for.
54
- * @param preview - resolves a tool-call preview for a pending request (the
55
- * request contract carries no arguments; the UI self-serves from the
56
- * transcript projection via `callId`).
57
- * @returns the store the renderer subscribes to.
58
- */
59
- export declare function mountApprovalAnswerer(ctx: Context, owns: (agent: Agent) => boolean, preview: (request: ApprovalRequest) => string): ApprovalStore;
@@ -1,52 +0,0 @@
1
- /** Terminal image- and file-attachment adapter over the Harness durable attachment service. */
2
- import type { AttachmentStore, ImageMediaType } from '@deepseek-ai/dsh-attachment';
3
- import type { FileBlock, ImageBlock } from '@deepseek-ai/dsh-llm';
4
- /** A validated path retained in the editor until submission persists it. */
5
- export interface ImagePathInspection {
6
- readonly path: string;
7
- readonly name: string;
8
- readonly mediaType: ImageMediaType;
9
- readonly bytes: number;
10
- }
11
- /** A validated non-image file path retained the same way (0.1.5 file blocks). */
12
- export interface FilePathInspection {
13
- readonly path: string;
14
- readonly name: string;
15
- readonly bytes: number;
16
- }
17
- /**
18
- * Terminal-side file admission bounds. Upstream exposes image limits through
19
- * the attachment service but no file limits (files ride verbatim storage);
20
- * these keep a dragged file from silently ingesting a disk-sized blob and
21
- * bound one message the way the image batch is bounded.
22
- */
23
- export declare const MAX_FILE_BYTES: number;
24
- export declare const MAX_FILES_PER_MESSAGE = 8;
25
- /** Detect the supported encoded raster formats from bytes, never from a path suffix. */
26
- export declare function detectImageMediaType(data: Uint8Array): ImageMediaType | undefined;
27
- /** Whether a path-like token is worth probing as an image attachment. */
28
- export declare function looksLikeImagePath(path: string): boolean;
29
- /**
30
- * Parse a paste/drop into its image and file paths: image-suffixed tokens
31
- * stay images, other path-shaped tokens ride as file attachments (0.1.5
32
- * file blocks), and anything that is neither leaves both empty — the caller
33
- * then treats the paste as plain text.
34
- *
35
- * File tokens are held to an absolute-path-with-shape bar (drive/backslash
36
- * or a dot-suffixed leaf after a separator): a dropped terminal path always
37
- * carries one of those, while prose, slash commands, and option flags never
38
- * do. A POSIX absolute path without any dot-suffixed leaf falls through as
39
- * text — the @ mention route still attaches such files deliberately.
40
- */
41
- export declare function parsePastedAttachmentPaths(input: string): {
42
- readonly images: readonly string[];
43
- readonly files: readonly string[];
44
- };
45
- /** Validate path, byte size and encoded signature without writing an attachment object. */
46
- export declare function inspectImagePaths(paths: readonly string[], attachments: AttachmentStore | undefined, cwd?: string): Promise<readonly ImagePathInspection[]>;
47
- /** Read, validate, and persist an ordered image path list as model content blocks. */
48
- export declare function saveImagePaths(paths: readonly string[], attachments: AttachmentStore | undefined, signal?: AbortSignal): Promise<readonly ImageBlock[]>;
49
- /** Validate path and byte size for non-image file attachments without writing. */
50
- export declare function inspectFilePaths(paths: readonly string[], attachments: AttachmentStore | undefined, cwd?: string): Promise<readonly FilePathInspection[]>;
51
- /** Read and persist an ordered non-image file path list as model file blocks. */
52
- export declare function saveFilePaths(paths: readonly string[], attachments: AttachmentStore | undefined, signal?: AbortSignal): Promise<readonly FileBlock[]>;
@@ -1,22 +0,0 @@
1
- /** Bounded Ink surfaces for provider login and logout. */
2
- import { type ReactElement } from 'react';
3
- import { type AuthorizationInteraction, type AuthorizationStatus } from '@deepseek-ai/dsh-authorization';
4
- import type { CredentialKey } from '@deepseek-ai/dsh-credentials';
5
- import type { ProviderAuthorizationRow } from './authorization.ts';
6
- export interface ProviderAuthorizationPanelProps {
7
- readonly row: ProviderAuthorizationRow;
8
- begin(row: ProviderAuthorizationRow, method: string, interaction: AuthorizationInteraction, signal: AbortSignal): Promise<AuthorizationStatus>;
9
- cancel(key: CredentialKey): void;
10
- openUrl(url: string): boolean;
11
- copy(text: string): Promise<void>;
12
- done(): void;
13
- back(): void;
14
- }
15
- /** Run one upstream authorization flow without letting notices or prompts exceed the panel budget. */
16
- export declare function ProviderAuthorizationPanel(props: ProviderAuthorizationPanelProps): ReactElement;
17
- export declare function ProviderAuthorizationLogoutPanel({ row, confirm, done, back }: {
18
- row: ProviderAuthorizationRow;
19
- confirm: (row: ProviderAuthorizationRow) => Promise<void>;
20
- done: () => void;
21
- back: () => void;
22
- }): ReactElement;
@@ -1,36 +0,0 @@
1
- /** Terminal adapter over the Harness provider-authorization and credential-record seams. */
2
- import type { Context } from '@deepseek-ai/cordis';
3
- import type { AuthorizationEntry, AuthorizationInteraction, AuthorizationMethod, AuthorizationStatus } from '@deepseek-ai/dsh-authorization';
4
- import { type CredentialKey, type CredentialRecordInfo } from '@deepseek-ai/dsh-credentials';
5
- /** One provider login flow joined with its value-free stored-record facts. */
6
- export interface ProviderAuthorizationRow {
7
- readonly key: CredentialKey;
8
- readonly provider: string;
9
- readonly label: string;
10
- readonly methods: readonly AuthorizationMethod[];
11
- readonly inFlight: boolean;
12
- readonly record: CredentialRecordInfo;
13
- }
14
- /** The provider-login directory plus non-fatal record lookup failures. */
15
- export interface ProviderAuthorizationDirectory {
16
- readonly rows: readonly ProviderAuthorizationRow[];
17
- readonly failures: readonly string[];
18
- }
19
- /** Load only model-provider flows; unrelated future authorization domains stay out of `/model`. */
20
- export declare function loadProviderAuthorizations(ctx: Context): Promise<ProviderAuthorizationDirectory>;
21
- /** Subscribe to login settlement and credential-record changes. */
22
- export declare function subscribeProviderAuthorizations(ctx: Context, listener: () => void): () => void;
23
- /** Begin one provider login through the interaction surface owned by the caller. */
24
- export declare function beginProviderAuthorization(ctx: Context, row: Pick<ProviderAuthorizationRow, 'key'>, method: string, interaction: AuthorizationInteraction, signal?: AbortSignal): Promise<AuthorizationStatus>;
25
- /** Cancel the attempt currently serving this provider, if any. */
26
- export declare function cancelProviderAuthorization(ctx: Context, key: CredentialKey): void;
27
- /** Remove an authorization record without changing the provider's settings profile. */
28
- export declare function logoutProviderAuthorization(ctx: Context, row: ProviderAuthorizationRow): Promise<void>;
29
- /** Open an authorization URL with the platform default browser, without invoking a shell. */
30
- export declare function openAuthorizationUrl(raw: string): boolean;
31
- /** Compact value-free status for the provider list. */
32
- export declare function providerAuthorizationStatus(row: ProviderAuthorizationRow | undefined): string;
33
- /** Find a provider's login flow from a previously loaded directory. */
34
- export declare function authorizationForProvider(directory: ProviderAuthorizationDirectory | undefined, provider: string): ProviderAuthorizationRow | undefined;
35
- /** Preserve the upstream entry type in declarations without leaking service internals into the TUI. */
36
- export type { AuthorizationEntry };
@@ -1,52 +0,0 @@
1
- /**
2
- * Slash-command bridge: forwards terminal command lines into the shared
3
- * `ctx.commands` registry (the same surface the web composer dispatches
4
- * through) and exposes the live descriptor list as completion candidates.
5
- * The runner keeps only its own TUI-local commands (`/help`, `/quit`,
6
- * `/clear`, `/model`) ahead of the registry dispatch.
7
- *
8
- * @module @deepseek-ai/dsh-tui/commands
9
- */
10
- import type { Context } from '@deepseek-ai/cordis';
11
- import type { Agent } from '@deepseek-ai/dsh-agent';
12
- import type { CommandDescriptor } from '@deepseek-ai/dsh-commands';
13
- /** Descriptor list snapshot the completion menu renders from. */
14
- export interface CommandsView {
15
- /** Name-sorted descriptors after scoped shadowing. */
16
- readonly descriptors: readonly CommandDescriptor[];
17
- /** Latest descriptor-read failure; the help panel exposes it in place. */
18
- readonly error?: string;
19
- /** Subscribe to list changes (`commands/change`); returns the unsubscribe function. */
20
- subscribe(listener: () => void): () => void;
21
- /** Retarget the agent whose scoped view the list is read through. */
22
- setAgent(agent: Agent): void;
23
- }
24
- /**
25
- * Watch the live command registry. Reads the current list immediately and
26
- * re-reads on every registry mutation or agent retarget; notification
27
- * failures are contained by the registry itself, so this watcher only ever
28
- * re-reads. Without a `commands` service the view stays empty and all lines
29
- * fall through to normal prompts.
30
- * @param ctx - context carrying the `commands` service (optional).
31
- * @returns the view the completion menu subscribes to.
32
- */
33
- export declare function watchCommands(ctx: Context): CommandsView;
34
- /**
35
- * Whether one command line is a syntactically valid slash command.
36
- * @param line - the complete candidate line.
37
- * @returns true when the line parses as `/name` or `/name input`.
38
- */
39
- export declare function isSlashLine(line: string): boolean;
40
- /**
41
- * The submission payload for one composer line. Trim is a blank check, not a
42
- * rewrite: an ordinary prompt keeps its exact leading indentation, inner
43
- * layout, and trailing spaces (pasted code must reach the model verbatim).
44
- * Only trailing line terminators are stripped — a draft's final newline is a
45
- * paste/Enter artifact (an open bracketed paste turns Enter into an inserted
46
- * newline), never deliberate content. A syntactic slash line still normalizes
47
- * fully so command routing stays stable (completion inserts a trailing space
48
- * after `/name`).
49
- * @param line - the complete draft text.
50
- * @returns the text to submit verbatim.
51
- */
52
- export declare function submissionPayload(line: string): string;