dsh-code 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +278 -265
- package/README.md +277 -264
- package/cordis.patch.yml +7 -0
- package/lib/index.mjs +1649 -575
- package/lib/types/app.d.ts +19 -14
- package/lib/types/attachments.d.ts +14 -1
- package/lib/types/authorization-panel.d.ts +22 -0
- package/lib/types/authorization.d.ts +36 -0
- package/lib/types/keyboard.d.ts +32 -3
- package/lib/types/mentions.d.ts +4 -0
- package/lib/types/models.d.ts +3 -1
- package/lib/types/permissions.d.ts +4 -14
- package/lib/types/presets.d.ts +4 -17
- package/lib/types/render/animations.d.ts +27 -11
- package/lib/types/render/editor.d.ts +32 -7
- package/lib/types/render/lines.d.ts +1 -1
- package/lib/types/render/status.d.ts +1 -1
- package/package.json +49 -43
- package/src/app.ts +4570 -4188
- package/src/attachments.ts +93 -2
- package/src/authorization-panel.ts +285 -0
- package/src/authorization.ts +147 -0
- package/src/index.ts +34 -21
- package/src/internals.ts +26 -9
- package/src/keyboard.ts +164 -39
- package/src/mentions.ts +12 -1
- package/src/models.ts +20 -14
- package/src/permissions.ts +5 -13
- package/src/presets.ts +5 -18
- package/src/provider-settings.ts +1 -1
- package/src/render/animations.ts +447 -400
- package/src/render/editor.ts +125 -25
- package/src/render/lines.ts +16 -2
- package/src/render/projection.ts +7 -3
- package/src/render/status.ts +2 -2
- package/src/session-directory.ts +1 -1
package/lib/types/app.d.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { type ReactElement } from 'react';
|
|
17
17
|
import type { CommandDescriptor } from '@deepseek-ai/dsh-commands';
|
|
18
|
+
import type { ImageBlock } from '@deepseek-ai/dsh-llm';
|
|
19
|
+
import type { AuthorizationInteraction, AuthorizationStatus } from '@deepseek-ai/dsh-authorization';
|
|
18
20
|
import { type ThemeName } from './theme.ts';
|
|
19
21
|
import type { TranscriptStore } from './store.ts';
|
|
20
22
|
import { type TranscriptEntry } from './render/projection.ts';
|
|
@@ -24,7 +26,7 @@ import type { ModelDirectory, ModelRow } from './models.ts';
|
|
|
24
26
|
import type { ProviderConfiguration, ProviderSettingsDirectory, ProviderTargetView } from './provider-settings.ts';
|
|
25
27
|
import type { QuestionStore } from './questions.ts';
|
|
26
28
|
import type { SkillsView, SkillRow } from './skills.ts';
|
|
27
|
-
import type
|
|
29
|
+
import { type MentionCandidate } from './mentions.ts';
|
|
28
30
|
import type { SubagentFeedView } from './subagents.ts';
|
|
29
31
|
import { type JobRow } from './kernel-panels.ts';
|
|
30
32
|
import type { PresetRow } from './presets.ts';
|
|
@@ -32,6 +34,8 @@ import type { PermissionRow } from './permissions.ts';
|
|
|
32
34
|
import type { PluginRow } from './plugin-inventory.ts';
|
|
33
35
|
import type { SessionDirectoryOptions, SessionRow } from './session-directory.ts';
|
|
34
36
|
import type { GitDiffView } from './git-workflow.ts';
|
|
37
|
+
import { type ProviderAuthorizationDirectory, type ProviderAuthorizationRow } from './authorization.ts';
|
|
38
|
+
import { type ImagePathInspection } from './attachments.ts';
|
|
35
39
|
/** Visual priority for one bounded local notice. */
|
|
36
40
|
export type NoticeTone = 'info' | 'warning' | 'error';
|
|
37
41
|
/** Props the runner hands the app; callbacks stay owned by the runner. */
|
|
@@ -67,9 +71,9 @@ export interface AppProps {
|
|
|
67
71
|
/** Permission preset selected for the current or pending first session. */
|
|
68
72
|
permission: string;
|
|
69
73
|
/** Submit one line: slash commands to the registry, other text to the agent. */
|
|
70
|
-
dispatch(text: string): void;
|
|
74
|
+
dispatch(text: string, images?: readonly ImageBlock[]): void;
|
|
71
75
|
/** Submit steering: consumed at the running turn's next step boundary. */
|
|
72
|
-
steer(text: string): void;
|
|
76
|
+
steer(text: string, images?: readonly ImageBlock[]): void;
|
|
73
77
|
/** Interrupt the running turn (Esc); true when a turn was cancelled. */
|
|
74
78
|
interrupt(): boolean;
|
|
75
79
|
/** Quit: unmount, flush, and request process exit. */
|
|
@@ -78,6 +82,10 @@ export interface AppProps {
|
|
|
78
82
|
loadModels(): Promise<ModelDirectory>;
|
|
79
83
|
/** Load @mention candidates for the typed query (files + sessions). */
|
|
80
84
|
loadMentions(query: string, signal?: AbortSignal): Promise<readonly MentionCandidate[]>;
|
|
85
|
+
/** Validate draft image paths without committing attachment objects. */
|
|
86
|
+
inspectImages(paths: readonly string[]): Promise<readonly ImagePathInspection[]>;
|
|
87
|
+
/** Validate, normalize and persist images immediately before submission. */
|
|
88
|
+
prepareImages(paths: readonly string[], signal?: AbortSignal): Promise<readonly ImageBlock[]>;
|
|
81
89
|
/** Apply one /model selection (with an advertised reasoning effort, when picked); returns the display label. */
|
|
82
90
|
selectModel(row: ModelRow, effortId?: string): string;
|
|
83
91
|
/** The /subagent override label, '' when delegated agents follow the current model. */
|
|
@@ -100,6 +108,14 @@ export interface AppProps {
|
|
|
100
108
|
removeModelProvider?(target: ProviderTargetView): Promise<void>;
|
|
101
109
|
/** Save endpoint and explicit model capacities through the provider profile. */
|
|
102
110
|
saveModelProviderConfiguration?(target: ProviderTargetView, configuration: ProviderConfiguration): Promise<void>;
|
|
111
|
+
/** Provider authorization flows and value-free stored-record facts. */
|
|
112
|
+
loadProviderAuthorizations?(): Promise<ProviderAuthorizationDirectory>;
|
|
113
|
+
subscribeProviderAuthorizations?(listener: () => void): () => void;
|
|
114
|
+
beginProviderAuthorization?(row: ProviderAuthorizationRow, method: string, interaction: AuthorizationInteraction, signal: AbortSignal): Promise<AuthorizationStatus>;
|
|
115
|
+
cancelProviderAuthorization?(row: ProviderAuthorizationRow): void;
|
|
116
|
+
logoutProviderAuthorization?(row: ProviderAuthorizationRow): Promise<void>;
|
|
117
|
+
openAuthorizationUrl?(url: string): boolean;
|
|
118
|
+
copyTextValue?(text: string): Promise<void>;
|
|
103
119
|
/** Cycle to the next permission preset (Shift+Tab); returns the new label. */
|
|
104
120
|
cyclePermission(): string;
|
|
105
121
|
/** Select or inspect a permission preset without requiring a pre-existing session. */
|
|
@@ -148,17 +164,6 @@ export interface AppProps {
|
|
|
148
164
|
/** Cancel one queued inbox message by identity (Delete on the empty composer). */
|
|
149
165
|
cancelQueued(messageId: string): void;
|
|
150
166
|
}
|
|
151
|
-
/**
|
|
152
|
-
* One-row editor window keeping the logical cursor visible in long drafts.
|
|
153
|
-
* The caret and its surroundings slice at grapheme boundaries: splitting a
|
|
154
|
-
* star-plane surrogate pair would render an isolated half under the block
|
|
155
|
-
* caret with a width the terminal never draws.
|
|
156
|
-
*/
|
|
157
|
-
export declare function editorWindow(value: string, cursor: number, columns: number): {
|
|
158
|
-
before: string;
|
|
159
|
-
caret: string;
|
|
160
|
-
after: string;
|
|
161
|
-
};
|
|
162
167
|
/** One completion candidate row. */
|
|
163
168
|
interface CompletionCandidate {
|
|
164
169
|
/** Insertion text for the command name (with leading slash). */
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
/** Terminal image-file adapter over the Harness durable attachment service. */
|
|
2
2
|
import type { AttachmentStore, ImageMediaType } from '@deepseek-ai/dsh-attachment';
|
|
3
3
|
import type { 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
|
+
}
|
|
4
11
|
/** Detect the supported encoded raster formats from bytes, never from a path suffix. */
|
|
5
12
|
export declare function detectImageMediaType(data: Uint8Array): ImageMediaType | undefined;
|
|
13
|
+
/** Whether a path-like token is worth probing as an image attachment. */
|
|
14
|
+
export declare function looksLikeImagePath(path: string): boolean;
|
|
15
|
+
/** Parse a terminal paste/drop containing only one or more image paths. */
|
|
16
|
+
export declare function parsePastedImagePaths(input: string): readonly string[];
|
|
17
|
+
/** Validate path, byte size and encoded signature without writing an attachment object. */
|
|
18
|
+
export declare function inspectImagePaths(paths: readonly string[], attachments: AttachmentStore | undefined, cwd?: string): Promise<readonly ImagePathInspection[]>;
|
|
6
19
|
/** Read, validate, and persist an ordered image path list as model content blocks. */
|
|
7
|
-
export declare function saveImagePaths(paths: readonly string[], attachments: AttachmentStore | undefined): Promise<readonly ImageBlock[]>;
|
|
20
|
+
export declare function saveImagePaths(paths: readonly string[], attachments: AttachmentStore | undefined, signal?: AbortSignal): Promise<readonly ImageBlock[]>;
|
|
@@ -0,0 +1,22 @@
|
|
|
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;
|
|
@@ -0,0 +1,36 @@
|
|
|
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 };
|
package/lib/types/keyboard.d.ts
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* kitty CSI-u normalization layer.
|
|
4
4
|
*
|
|
5
5
|
* The TUI pushes the kitty keyboard protocol with DISAMBIGUATE_ESCAPE_CODES
|
|
6
|
-
* and REPORT_ALTERNATE_KEYS (flags 1|4 = `\x1b[>5u`)
|
|
7
|
-
* report Shift+Enter as `CSI 13;2u` instead of a bare CR. Event types are
|
|
6
|
+
* and REPORT_ALTERNATE_KEYS (flags 1|4 = `\x1b[>5u`). Event types are
|
|
8
7
|
* deliberately NOT requested: Ink 5's parser cannot decode the
|
|
9
8
|
* `:event-type` suffix, and repeat/release reporting buys this surface
|
|
10
9
|
* nothing.
|
|
@@ -14,17 +13,32 @@
|
|
|
14
13
|
* stdin read patch therefore rewrites every CSI-u form it can decode back
|
|
15
14
|
* to the legacy byte or canonical sequence the existing key handling
|
|
16
15
|
* already understands, before Ink ever parses the chunk.
|
|
17
|
-
*
|
|
18
16
|
* @module @deepseek-ai/dsh-code/keyboard
|
|
19
17
|
*/
|
|
20
18
|
/** Push keyboard enhancement (modifyOtherKeys off, kitty flags 1|4). */
|
|
21
19
|
export declare const KEYBOARD_ENHANCE_ENABLE = "\u001B[>4;0m\u001B[>5u";
|
|
22
20
|
/** Pop the enhancement stack and reset modifyOtherKeys (exit path). */
|
|
23
21
|
export declare const KEYBOARD_ENHANCE_DISABLE = "\u001B[<u\u001B[>4;0m";
|
|
22
|
+
/** Explicit environment overrides for terminal keyboard enhancement. */
|
|
23
|
+
export declare const DSH_DISABLE_KEYBOARD_ENHANCEMENT = "DSH_DISABLE_KEYBOARD_ENHANCEMENT";
|
|
24
|
+
export declare const DSH_ENABLE_KEYBOARD_ENHANCEMENT = "DSH_ENABLE_KEYBOARD_ENHANCEMENT";
|
|
25
|
+
/** True when the process is running inside the VS Code integrated terminal. */
|
|
26
|
+
export declare function isVsCodeTerminalEnv(env?: NodeJS.ProcessEnv): boolean;
|
|
27
|
+
/** Whether to push Kitty keyboard enhancement for the current terminal. */
|
|
28
|
+
export declare function shouldEnableKeyboardEnhancement(env?: NodeJS.ProcessEnv): boolean;
|
|
24
29
|
/** Enable bracketed paste reporting. */
|
|
25
30
|
export declare const BRACKETED_PASTE_ENABLE = "\u001B[?2004h";
|
|
26
31
|
/** Disable bracketed paste reporting. */
|
|
27
32
|
export declare const BRACKETED_PASTE_DISABLE = "\u001B[?2004l";
|
|
33
|
+
/** Enable terminal focus-in/focus-out reporting (xterm focus protocol). */
|
|
34
|
+
export declare const TERMINAL_FOCUS_REPORT_ENABLE = "\u001B[?1004h";
|
|
35
|
+
/** Disable terminal focus-in/focus-out reporting. */
|
|
36
|
+
export declare const TERMINAL_FOCUS_REPORT_DISABLE = "\u001B[?1004l";
|
|
37
|
+
/**
|
|
38
|
+
* Remove xterm focus reports from one input chunk and update the caller's
|
|
39
|
+
* focus state. Focus reports are terminal protocol, not composer text.
|
|
40
|
+
*/
|
|
41
|
+
export declare function stripTerminalFocusEvents(chunk: string, onFocus: (focused: boolean) => void): string;
|
|
28
42
|
/** Bracketed paste markers as Ink delivers them (it strips the leading ESC). */
|
|
29
43
|
export declare const PASTE_START_MARKER = "[200~";
|
|
30
44
|
export declare const PASTE_END_MARKER = "[201~";
|
|
@@ -41,3 +55,18 @@ export declare function stripPasteMarkers(text: string): string;
|
|
|
41
55
|
* unaffected.
|
|
42
56
|
*/
|
|
43
57
|
export declare function normalizeKeyboardChunk(chunk: string): string;
|
|
58
|
+
/** Editor actions Ink cannot distinguish reliably when terminal bytes batch. */
|
|
59
|
+
export type RawEditorToken = {
|
|
60
|
+
readonly kind: 'text';
|
|
61
|
+
readonly text: string;
|
|
62
|
+
} | {
|
|
63
|
+
readonly kind: 'home' | 'end' | 'delete-backward' | 'delete-word-backward' | 'delete-forward' | 'delete-word-forward';
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Tokenize a stdin chunk containing at least one editor-only key. Ink calls
|
|
67
|
+
* `useInput` once for a pasted/batched chunk, so preserving each action here
|
|
68
|
+
* prevents repeated Backspace/Home/End/Delete presses from collapsing into
|
|
69
|
+
* one blurred key event. Unknown escape sequences return undefined and stay
|
|
70
|
+
* under Ink's ownership.
|
|
71
|
+
*/
|
|
72
|
+
export declare function tokenizeRawEditorChunk(chunk: string): readonly RawEditorToken[] | undefined;
|
package/lib/types/mentions.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface MentionCandidate {
|
|
|
32
32
|
description: string;
|
|
33
33
|
/** Origin kind for icon/coloring decisions. */
|
|
34
34
|
kind: 'file' | 'directory' | 'session';
|
|
35
|
+
/** Absolute path for file candidates; never rendered or persisted directly. */
|
|
36
|
+
path?: string;
|
|
35
37
|
}
|
|
36
38
|
/** Prepared submission: readable content plus optional injected context. */
|
|
37
39
|
export interface PreparedMention {
|
|
@@ -42,6 +44,8 @@ export interface PreparedMention {
|
|
|
42
44
|
/** Aggregated snapshot for `agent.inject()`, undefined without references. */
|
|
43
45
|
additionalContext?: import('@deepseek-ai/dsh-session').UserMessage;
|
|
44
46
|
}
|
|
47
|
+
/** Whether a mention token is already navigating a filesystem path. */
|
|
48
|
+
export declare function isPathLikeMentionQuery(query: string): boolean;
|
|
45
49
|
/** The mention API the input editor and the runner share. */
|
|
46
50
|
export interface MentionsApi {
|
|
47
51
|
/** Ranked menu candidates for the typed `@` query. */
|
package/lib/types/models.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Context } from '@deepseek-ai/cordis';
|
|
11
11
|
import type { ModelSelection } from '@deepseek-ai/dsh-agent';
|
|
12
|
-
import { type LlmCallConfig, type LlmModelReasoningInfo } from '@deepseek-ai/dsh-llm';
|
|
12
|
+
import { type LlmCallConfig, type LlmModelReasoningInfo, type ModelModality } from '@deepseek-ai/dsh-llm';
|
|
13
13
|
/** Display metadata for one adapter-owned reasoning effort (mirrors `LlmReasoningEffortInfo`). */
|
|
14
14
|
export interface ModelReasoningEffort {
|
|
15
15
|
/** Opaque value accepted by the model's `GenerateOptions.reasoningEffort`. */
|
|
@@ -36,6 +36,8 @@ export interface ModelRow {
|
|
|
36
36
|
model: string;
|
|
37
37
|
/** Human-readable model name. */
|
|
38
38
|
modelName: string;
|
|
39
|
+
/** Request modalities advertised for this exact route; absent means unknown. */
|
|
40
|
+
inputModalities?: readonly ModelModality[];
|
|
39
41
|
/** Adapter-owned selectable reasoning levels when the model exposes any. */
|
|
40
42
|
reasoning?: ModelReasoning;
|
|
41
43
|
}
|
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
/** Permission-preset policy for pending and active TUI sessions. */
|
|
2
2
|
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
-
import type {
|
|
3
|
+
import type { PermissionPresetService } from '@deepseek-ai/dsh-permission-presets';
|
|
4
|
+
import type { Session } from '@deepseek-ai/dsh-session';
|
|
4
5
|
/** One selectable permission preset row for the /permission panel. */
|
|
5
6
|
export interface PermissionRow {
|
|
6
7
|
readonly id: string;
|
|
7
8
|
readonly description?: string;
|
|
8
9
|
}
|
|
9
|
-
/**
|
|
10
|
-
export
|
|
11
|
-
readonly names: readonly string[];
|
|
12
|
-
readonly defaultPreset: string;
|
|
13
|
-
resolve(name: string): unknown;
|
|
14
|
-
current(events: readonly SessionEvent[]): string;
|
|
15
|
-
set(session: Session, preset: string): void;
|
|
16
|
-
/** Client presentation metadata for one preset; may reject unknown names. */
|
|
17
|
-
optionOf?(name: string): {
|
|
18
|
-
name: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
} | undefined;
|
|
21
|
-
}
|
|
10
|
+
/** Public compatibility alias for the official upstream permission service. */
|
|
11
|
+
export type PermissionPresetsService = PermissionPresetService;
|
|
22
12
|
/** Read the optional Harness service without importing its runtime package. */
|
|
23
13
|
export declare function permissionPresetsFrom(ctx: Context): PermissionPresetsService | undefined;
|
|
24
14
|
/** Effective label for either an active session or the not-yet-created first one. */
|
package/lib/types/presets.d.ts
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
/** Agent-preset policy kept independent from the Ink surface. */
|
|
2
2
|
import type { Context } from '@deepseek-ai/cordis';
|
|
3
3
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
4
|
+
import type { AgentPreset, AgentPresets } from '@deepseek-ai/dsh-agent-presets';
|
|
4
5
|
import type { Session, SessionEvent } from '@deepseek-ai/dsh-session';
|
|
5
6
|
/** One discoverable agent composition. */
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
readonly name?: string;
|
|
10
|
-
readonly description?: string;
|
|
11
|
-
readonly order?: number;
|
|
12
|
-
readonly broken?: string;
|
|
13
|
-
}
|
|
14
|
-
/** Structural boundary for the optional upstream AgentPresets service. */
|
|
15
|
-
export interface AgentPresetsService {
|
|
16
|
-
readonly defaultId: string;
|
|
17
|
-
list(): Promise<PresetRow[]>;
|
|
18
|
-
resolve(id?: string): Promise<PresetRow>;
|
|
19
|
-
mount(agentCtx: Context, id?: string): Promise<PresetRow>;
|
|
20
|
-
recompose(agentCtx: Context, id: string): Promise<PresetRow>;
|
|
21
|
-
composedPreset(agentCtx: Context): string | undefined;
|
|
22
|
-
}
|
|
7
|
+
export type PresetRow = AgentPreset;
|
|
8
|
+
/** Public compatibility alias for the official upstream service type. */
|
|
9
|
+
export type AgentPresetsService = AgentPresets;
|
|
23
10
|
/** Read an optional Cordis service without requiring its package at build time. */
|
|
24
11
|
export declare function agentPresetsFrom(ctx: Context): AgentPresetsService | undefined;
|
|
25
12
|
/** A preset may change only before the first durable turn begins. */
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Terminal animation
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Claude-Code convention.
|
|
2
|
+
* Terminal animation helpers derived from the web design language:
|
|
3
|
+
* thinking uses Codex's slow shimmer sweep, the busy composer marker uses the
|
|
4
|
+
* original braille chase, and the streaming caret blink is the Claude-Code
|
|
5
|
+
* convention.
|
|
7
6
|
*
|
|
8
7
|
* The DeepSeek model-switch easter egg ports Codex's effort-ignition "Wave"
|
|
9
8
|
* style (`codex-rs/tui/src/bottom_pane/effort_ignition_styles.rs`): switching
|
|
@@ -17,14 +16,31 @@
|
|
|
17
16
|
* @module @deepseek-ai/dsh-code/render/animations
|
|
18
17
|
*/
|
|
19
18
|
import type { RgbTriple } from '../theme.ts';
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* per step — 8 frames × 125ms = the web's 1s cycle.
|
|
24
|
-
*/
|
|
19
|
+
/** Cadence for the original busy braille chase (8 frames × 125ms = 1s). */
|
|
20
|
+
export declare const BUSY_CHASE_TICK_MS = 125;
|
|
21
|
+
/** Original terminal StateDot chase frames. */
|
|
25
22
|
export declare const BUSY_CHASE_FRAMES: readonly ["⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"];
|
|
26
|
-
/** Chase frame for a monotonic tick
|
|
23
|
+
/** Chase frame for a monotonic tick. */
|
|
27
24
|
export declare function busyChaseFrame(tick: number): string;
|
|
25
|
+
/** Clock cadence for the Codex-style Deep diving shimmer. */
|
|
26
|
+
export declare const DEEP_DIVING_SHIMMER_TICK_MS = 33;
|
|
27
|
+
/** Codex shimmer timing and geometry. */
|
|
28
|
+
export declare const DEEP_DIVING_SHIMMER_DURATION_MS = 2000;
|
|
29
|
+
export declare const DEEP_DIVING_SHIMMER_PADDING = 10;
|
|
30
|
+
export declare const DEEP_DIVING_SHIMMER_HALF_WIDTH = 5;
|
|
31
|
+
export declare const DEEP_DIVING_SPARK_BREATH_DURATION_MS = 2000;
|
|
32
|
+
/**
|
|
33
|
+
* Codex's 2-second shimmer sweep, expressed in terminal ticks. The sweep has
|
|
34
|
+
* ten virtual columns of padding on either side and a five-column cosine
|
|
35
|
+
* highlight band, so the text changes gently rather than cycling rapidly.
|
|
36
|
+
*/
|
|
37
|
+
export declare function deepDivingShimmerIntensity(index: number, tick: number, graphemeCount: number): number;
|
|
38
|
+
/** Blue RGB color for one grapheme in the Codex-style shimmer. */
|
|
39
|
+
export declare function deepDivingGradientColor(index: number, tick: number, graphemeCount: number, base: RgbTriple, highlight: RgbTriple): RgbTriple;
|
|
40
|
+
/** Smooth breathing intensity for the always-visible Deep diving sparkle. */
|
|
41
|
+
export declare function deepDivingSparkIntensity(tick: number): number;
|
|
42
|
+
/** Blue RGB color for the breathing Deep diving sparkle. */
|
|
43
|
+
export declare function deepDivingSparkColor(tick: number, base: RgbTriple, highlight: RgbTriple): RgbTriple;
|
|
28
44
|
/** Caret visibility: half the ticks on, half off (530ms blink). */
|
|
29
45
|
export declare function caretVisible(tick: number): boolean;
|
|
30
46
|
/**
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
* grapheme boundaries) so the React state stays two primitives
|
|
9
9
|
* (value, cursor) and every operation here stays pure and testable.
|
|
10
10
|
*
|
|
11
|
-
* Word motion
|
|
12
|
-
*
|
|
13
|
-
* single word (two hanzi are one Alt+B step, not two).
|
|
11
|
+
* Word motion follows Codex's piece semantics: whitespace separates runs,
|
|
12
|
+
* punctuation runs stay atomic, and each Han grapheme is its own boundary.
|
|
14
13
|
*
|
|
15
14
|
* @module @deepseek-ai/dsh-code/render/editor
|
|
16
15
|
*/
|
|
@@ -79,6 +78,15 @@ export interface CaretSite {
|
|
|
79
78
|
row: number;
|
|
80
79
|
column: number;
|
|
81
80
|
}
|
|
81
|
+
/** Text slices for rendering one physical row with at most one caret. */
|
|
82
|
+
export interface EditorRowParts {
|
|
83
|
+
readonly before: string;
|
|
84
|
+
readonly caret: string;
|
|
85
|
+
readonly after: string;
|
|
86
|
+
readonly hasCaret: boolean;
|
|
87
|
+
}
|
|
88
|
+
/** Split one row around the authoritative caret; every other row stays whole. */
|
|
89
|
+
export declare function editorRowParts(row: EditorRowModel, rowIndex: number, caretRow: number, cursor: number, caretEnabled?: boolean): EditorRowParts;
|
|
82
90
|
/** Map a cursor offset to its caret site on the wrapped rows. */
|
|
83
91
|
export declare function caretSite(model: EditorModel, offset: number): CaretSite;
|
|
84
92
|
/**
|
|
@@ -123,6 +131,23 @@ export declare function killToLineStart(value: string, cursor: number): EditResu
|
|
|
123
131
|
export declare function killToLineEnd(value: string, cursor: number): EditResult;
|
|
124
132
|
/** Insert sanitized text at the cursor. */
|
|
125
133
|
export declare function insertText(value: string, cursor: number, text: string): EditResult;
|
|
134
|
+
/** Ctrl+A: current logical line start, then the previous line start on repeat. */
|
|
135
|
+
export declare function moveToLineStart(value: string, cursor: number, crossOnRepeat: boolean): number;
|
|
136
|
+
/** Ctrl+E: current logical line end, then the next line end on repeat. */
|
|
137
|
+
export declare function moveToLineEnd(value: string, cursor: number, crossOnRepeat: boolean): number;
|
|
138
|
+
/** One stable text range captured before an asynchronous draft operation. */
|
|
139
|
+
export interface DraftRange {
|
|
140
|
+
readonly start: number;
|
|
141
|
+
readonly end: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Remap a captured range when all intervening edits are wholly before or
|
|
145
|
+
* wholly after it. An edit overlapping either boundary invalidates the
|
|
146
|
+
* anchor instead of guessing and inserting content at a surprising place.
|
|
147
|
+
*/
|
|
148
|
+
export declare function remapStableRange(original: string, current: string, range: DraftRange): DraftRange | undefined;
|
|
149
|
+
/** Replace a current range while preserving a cursor moved after capture. */
|
|
150
|
+
export declare function replaceRangePreservingCursor(value: string, cursor: number, range: DraftRange, replacement: string): EditResult;
|
|
126
151
|
/**
|
|
127
152
|
* Composer editor row budget: the editor itself never grows past this many
|
|
128
153
|
* physical rows; deeper drafts scroll internally to keep the caret visible.
|
|
@@ -130,8 +155,8 @@ export declare function insertText(value: string, cursor: number, text: string):
|
|
|
130
155
|
*/
|
|
131
156
|
export declare function composerMaxRows(terminalRows: number): number;
|
|
132
157
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
158
|
+
* History navigation starts with Up on an empty draft, or after visual
|
|
159
|
+
* movement has reached the directional text edge of an unchanged recalled
|
|
160
|
+
* entry. Every other position remains under textarea movement.
|
|
136
161
|
*/
|
|
137
|
-
export declare function shouldRecallNavigate(value: string, cursor: number, lastRecalled: string | null): boolean;
|
|
162
|
+
export declare function shouldRecallNavigate(value: string, cursor: number, lastRecalled: string | null, direction: -1 | 1): boolean;
|
|
@@ -36,6 +36,6 @@ export declare function reasoningLines(text: string, columns: number): readonly
|
|
|
36
36
|
* Wrapped continuations keep a hanging indent aligned under each row's
|
|
37
37
|
* content (Codex history-cell alignment) instead of resetting to column 0.
|
|
38
38
|
*/
|
|
39
|
-
export declare function transcriptEntryLines(entry: TranscriptEntry, columns: number, showReasoning?: boolean, reasoningToggleHint?: boolean): readonly StyledLine[];
|
|
39
|
+
export declare function transcriptEntryLines(entry: TranscriptEntry, columns: number, showReasoning?: boolean, reasoningToggleHint?: boolean, showToolDetails?: boolean): readonly StyledLine[];
|
|
40
40
|
/** Settled-history variant carrying the Ctrl+R reasoning fold. */
|
|
41
41
|
export declare function settledEntryLines(entry: TranscriptEntry, columns: number, showReasoning: boolean): readonly StyledLine[];
|
|
@@ -26,7 +26,7 @@ export declare function formatDuration(ms: number): string;
|
|
|
26
26
|
/**
|
|
27
27
|
* Cache-hit share of billed prompt-side input.
|
|
28
28
|
* @param usage - cumulative token totals.
|
|
29
|
-
* @returns rounded
|
|
29
|
+
* @returns percent rounded to one decimal place, or null when no input was billed.
|
|
30
30
|
*/
|
|
31
31
|
export declare function cacheHitPercent(usage: TranscriptStats['usage']): number | null;
|
|
32
32
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-code",
|
|
3
3
|
"description": "DeepSeek Harness CLI core bundle: interactive coding terminal, durable sessions, and model management for dsh --profile cli",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"deepseek": "./bin/deepseek.mjs",
|
|
@@ -63,41 +63,43 @@
|
|
|
63
63
|
"node": "^22.19 || >=24"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@deepseek-ai/dsh-
|
|
66
|
+
"@deepseek-ai/dsh-authorization": "0.1.1-rc.2",
|
|
67
|
+
"@deepseek-ai/dsh-web-fetch-http": "0.1.1-rc.2",
|
|
67
68
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
68
69
|
"chalk": "^5.6.2",
|
|
69
|
-
"commander": "^
|
|
70
|
+
"commander": "^15.0.0",
|
|
70
71
|
"ink": "^5.2.1",
|
|
71
72
|
"react": "^18.3.1"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
75
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
75
76
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.2",
|
|
76
|
-
"@deepseek-ai/dsh-attachment": "
|
|
77
|
-
"@deepseek-ai/dsh-agent": "
|
|
78
|
-
"@deepseek-ai/dsh-agent-default-model": "
|
|
79
|
-
"@deepseek-ai/dsh-agent-presets": "
|
|
80
|
-
"@deepseek-ai/dsh-cmdline": "
|
|
81
|
-
"@deepseek-ai/dsh-code-runtime-worker-thread": "
|
|
82
|
-
"@deepseek-ai/dsh-commands": "
|
|
83
|
-
"@deepseek-ai/dsh-compaction": "
|
|
84
|
-
"@deepseek-ai/dsh-cordis-host-runner": "
|
|
85
|
-
"@deepseek-ai/dsh-
|
|
86
|
-
"@deepseek-ai/dsh-
|
|
87
|
-
"@deepseek-ai/dsh-
|
|
88
|
-
"@deepseek-ai/dsh-
|
|
89
|
-
"@deepseek-ai/dsh-
|
|
90
|
-
"@deepseek-ai/dsh-llm
|
|
91
|
-
"@deepseek-ai/dsh-
|
|
92
|
-
"@deepseek-ai/dsh-
|
|
93
|
-
"@deepseek-ai/dsh-
|
|
94
|
-
"@deepseek-ai/dsh-
|
|
95
|
-
"@deepseek-ai/dsh-session
|
|
96
|
-
"@deepseek-ai/dsh-session-
|
|
97
|
-
"@deepseek-ai/dsh-session-
|
|
98
|
-
"@deepseek-ai/dsh-
|
|
99
|
-
"@deepseek-ai/dsh-
|
|
100
|
-
"@deepseek-ai/dsh-user-
|
|
77
|
+
"@deepseek-ai/dsh-attachment": "0.1.1-rc.2",
|
|
78
|
+
"@deepseek-ai/dsh-agent": "0.1.1-rc.2",
|
|
79
|
+
"@deepseek-ai/dsh-agent-default-model": "0.1.1-rc.2",
|
|
80
|
+
"@deepseek-ai/dsh-agent-presets": "0.1.1-rc.2",
|
|
81
|
+
"@deepseek-ai/dsh-cmdline": "0.1.1-rc.2",
|
|
82
|
+
"@deepseek-ai/dsh-code-runtime-worker-thread": "0.1.1-rc.2",
|
|
83
|
+
"@deepseek-ai/dsh-commands": "0.1.1-rc.2",
|
|
84
|
+
"@deepseek-ai/dsh-compaction": "0.1.1-rc.2",
|
|
85
|
+
"@deepseek-ai/dsh-cordis-host-runner": "0.1.1-rc.2",
|
|
86
|
+
"@deepseek-ai/dsh-credentials": "0.1.1-rc.2",
|
|
87
|
+
"@deepseek-ai/dsh-file-reference-local": "0.1.1-rc.2",
|
|
88
|
+
"@deepseek-ai/dsh-goal": "0.1.1-rc.2",
|
|
89
|
+
"@deepseek-ai/dsh-invariants": "0.1.1-rc.2",
|
|
90
|
+
"@deepseek-ai/dsh-jobs": "0.1.1-rc.2",
|
|
91
|
+
"@deepseek-ai/dsh-llm": "0.1.1-rc.2",
|
|
92
|
+
"@deepseek-ai/dsh-llm-retry": "0.1.1-rc.2",
|
|
93
|
+
"@deepseek-ai/dsh-permission-presets": "0.1.1-rc.2",
|
|
94
|
+
"@deepseek-ai/dsh-plan-mode": "0.1.1-rc.2",
|
|
95
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.1.1-rc.2",
|
|
96
|
+
"@deepseek-ai/dsh-session": "0.1.1-rc.2",
|
|
97
|
+
"@deepseek-ai/dsh-session-persistence": "0.1.1-rc.2",
|
|
98
|
+
"@deepseek-ai/dsh-session-reference": "0.1.1-rc.2",
|
|
99
|
+
"@deepseek-ai/dsh-session-title": "0.1.1-rc.2",
|
|
100
|
+
"@deepseek-ai/dsh-skill": "0.1.1-rc.2",
|
|
101
|
+
"@deepseek-ai/dsh-user-approval": "0.1.1-rc.2",
|
|
102
|
+
"@deepseek-ai/dsh-user-questions": "0.1.1-rc.2"
|
|
101
103
|
},
|
|
102
104
|
"peerDependenciesMeta": {
|
|
103
105
|
"@deepseek-ai/cordis": { "optional": true },
|
|
@@ -108,13 +110,14 @@
|
|
|
108
110
|
"@deepseek-ai/dsh-agent-presets": { "optional": true },
|
|
109
111
|
"@deepseek-ai/dsh-cmdline": { "optional": true },
|
|
110
112
|
"@deepseek-ai/dsh-cordis-host-runner": { "optional": true },
|
|
113
|
+
"@deepseek-ai/dsh-credentials": { "optional": true },
|
|
111
114
|
"@deepseek-ai/dsh-file-reference-local": { "optional": true },
|
|
112
115
|
"@deepseek-ai/dsh-code-runtime-worker-thread": { "optional": true },
|
|
113
116
|
"@deepseek-ai/dsh-commands": { "optional": true },
|
|
114
117
|
"@deepseek-ai/dsh-compaction": { "optional": true },
|
|
115
118
|
"@deepseek-ai/dsh-goal": { "optional": true },
|
|
116
119
|
"@deepseek-ai/dsh-invariants": { "optional": true },
|
|
117
|
-
"@deepseek-ai/dsh-jobs
|
|
120
|
+
"@deepseek-ai/dsh-jobs": { "optional": true },
|
|
118
121
|
"@deepseek-ai/dsh-llm": { "optional": true },
|
|
119
122
|
"@deepseek-ai/dsh-llm-retry": { "optional": true },
|
|
120
123
|
"@deepseek-ai/dsh-permission-presets": { "optional": true },
|
|
@@ -129,20 +132,23 @@
|
|
|
129
132
|
"@deepseek-ai/dsh-user-questions": { "optional": true }
|
|
130
133
|
},
|
|
131
134
|
"devDependencies": {
|
|
132
|
-
"@deepseek-ai/dsh-
|
|
133
|
-
"@deepseek-ai/dsh-
|
|
134
|
-
"@deepseek-ai/dsh-
|
|
135
|
-
"@deepseek-ai/dsh-
|
|
136
|
-
"@deepseek-ai/dsh-
|
|
137
|
-
"@deepseek-ai/dsh-
|
|
138
|
-
"@deepseek-ai/dsh-
|
|
139
|
-
"@deepseek-ai/dsh-
|
|
140
|
-
"@deepseek-ai/dsh-
|
|
141
|
-
"@deepseek-ai/dsh-
|
|
142
|
-
"@deepseek-ai/dsh-
|
|
143
|
-
"@deepseek-ai/dsh-
|
|
144
|
-
"@deepseek-ai/dsh-
|
|
145
|
-
"@deepseek-ai/dsh-
|
|
135
|
+
"@deepseek-ai/dsh-agent-presets": "0.1.1-rc.2",
|
|
136
|
+
"@deepseek-ai/dsh-attachment": "0.1.1-rc.2",
|
|
137
|
+
"@deepseek-ai/dsh-compaction": "0.1.1-rc.2",
|
|
138
|
+
"@deepseek-ai/dsh-commands": "0.1.1-rc.2",
|
|
139
|
+
"@deepseek-ai/dsh-credentials": "0.1.1-rc.2",
|
|
140
|
+
"@deepseek-ai/dsh-goal": "0.1.1-rc.2",
|
|
141
|
+
"@deepseek-ai/dsh-jobs": "0.1.1-rc.2",
|
|
142
|
+
"@deepseek-ai/dsh-llm-retry": "0.1.1-rc.2",
|
|
143
|
+
"@deepseek-ai/dsh-permission-presets": "0.1.1-rc.2",
|
|
144
|
+
"@deepseek-ai/dsh-plan-mode": "0.1.1-rc.2",
|
|
145
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.1.1-rc.2",
|
|
146
|
+
"@deepseek-ai/dsh-session-persistence": "0.1.1-rc.2",
|
|
147
|
+
"@deepseek-ai/dsh-session-reference": "0.1.1-rc.2",
|
|
148
|
+
"@deepseek-ai/dsh-session-title": "0.1.1-rc.2",
|
|
149
|
+
"@deepseek-ai/dsh-skill": "0.1.1-rc.2",
|
|
150
|
+
"@deepseek-ai/dsh-user-approval": "0.1.1-rc.2",
|
|
151
|
+
"@deepseek-ai/dsh-user-questions": "0.1.1-rc.2",
|
|
146
152
|
"@types/node": "^24.0.0",
|
|
147
153
|
"@types/react": "~18.3.1",
|
|
148
154
|
"tsdown": "^0.22.2",
|