dsh-code 1.0.5 → 1.0.6
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 +287 -286
- package/README.md +13 -12
- package/bin/deepseek.mjs +118 -3
- package/cordis.patch.yml +17 -7
- package/lib/index.mjs +1148 -347
- package/lib/types/app.d.ts +25 -6
- package/lib/types/attachments.d.ts +36 -4
- package/lib/types/index.d.ts +11 -2
- package/lib/types/provider-settings.d.ts +6 -11
- package/lib/types/render/animations.d.ts +74 -7
- package/lib/types/render/export.d.ts +0 -6
- package/lib/types/render/fuzzy.d.ts +21 -0
- package/lib/types/render/projection.d.ts +45 -4
- package/lib/types/session-directory.d.ts +48 -13
- package/lib/types/store.d.ts +3 -0
- package/package.json +168 -162
- package/src/app.ts +479 -198
- package/src/attachments.ts +110 -11
- package/src/commands.ts +35 -5
- package/src/index.ts +1868 -1779
- package/src/internals.ts +61 -40
- package/src/provider-settings.ts +12 -12
- package/src/render/animations.ts +606 -403
- package/src/render/export.ts +13 -3
- package/src/render/fuzzy.ts +83 -0
- package/src/render/projection.ts +1833 -1621
- package/src/session-directory.ts +94 -16
- package/src/skills.ts +23 -9
- package/src/store.ts +39 -1
- package/src/subagents.ts +26 -3
package/src/internals.ts
CHANGED
|
@@ -44,46 +44,67 @@ export const internals: {
|
|
|
44
44
|
// the keyboard protocol on terminals that can safely own those key events.
|
|
45
45
|
const keyboardEnhanced = shouldEnableKeyboardEnhancement()
|
|
46
46
|
const focusReporting = isVsCodeTerminalEnv()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
stdin:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
47
|
+
// Enter raw mode BEFORE pushing any protocol: xterm.js answers `?1004h`
|
|
48
|
+
// with an immediate focus report (ESC[I), and while the tty still carries
|
|
49
|
+
// the shell's cooked+ECHO settings that report is echoed to the screen as
|
|
50
|
+
// a literal `^[[I`. Ink only takes raw mode after its first commit, so
|
|
51
|
+
// this mount owns the window; the call is idempotent with Ink's later one.
|
|
52
|
+
if (process.stdin.isTTY === true) process.stdin.setRawMode?.(true)
|
|
53
|
+
try {
|
|
54
|
+
process.stdout.write(
|
|
55
|
+
(keyboardEnhanced ? KEYBOARD_ENHANCE_ENABLE : '')
|
|
56
|
+
+ BRACKETED_PASTE_ENABLE
|
|
57
|
+
+ (focusReporting ? TERMINAL_FOCUS_REPORT_ENABLE : ''),
|
|
58
|
+
)
|
|
59
|
+
// App owns Ctrl+C's deliberate three-state contract (interrupt, clear
|
|
60
|
+
// draft, quit). Ink's default `exitOnCtrlC: true` would intercept the
|
|
61
|
+
// normalized control byte first, unmount only its renderer, and leave the
|
|
62
|
+
// Harness runner plus the pushed keyboard protocol alive.
|
|
63
|
+
// stdin travels through the keypress splitter: Ink parses one chunk as
|
|
64
|
+
// one keypress, so a coalesced space-then-enter would drop both keys.
|
|
65
|
+
const tuiStdin = createSplitStdin(process.stdin)
|
|
66
|
+
// Ink only touches isTTY/setRawMode/ref/read on stdin; the object-mode
|
|
67
|
+
// proxy satisfies that contract without the full ReadStream surface.
|
|
68
|
+
const instance = render(element, {
|
|
69
|
+
exitOnCtrlC: false,
|
|
70
|
+
stdin: tuiStdin.stdin as unknown as NodeJS.ReadStream,
|
|
71
|
+
stdout: process.stdout,
|
|
72
|
+
})
|
|
73
|
+
return {
|
|
74
|
+
rerender(element: ReactElement): void {
|
|
75
|
+
instance.rerender(element)
|
|
76
|
+
},
|
|
77
|
+
unmount(): void {
|
|
78
|
+
// The cleanup below must run even when Ink's unmount throws (a
|
|
79
|
+
// render-teardown failure): a stdin tap or pushed terminal-protocol
|
|
80
|
+
// stack outliving the app wedges the terminal for whatever runs
|
|
81
|
+
// next, and a stray exception here must not skip the exit sequence.
|
|
82
|
+
// Pop the stack while raw mode still hides echo — xterm.js keeps
|
|
83
|
+
// reporting focus changes until `?1004l` lands, and one arriving
|
|
84
|
+
// after Ink restores the cooked tty would print as `^[[I`.
|
|
85
|
+
try {
|
|
86
|
+
process.stdout.write(
|
|
87
|
+
(keyboardEnhanced ? KEYBOARD_ENHANCE_DISABLE : '')
|
|
88
|
+
+ BRACKETED_PASTE_DISABLE
|
|
89
|
+
+ (focusReporting ? TERMINAL_FOCUS_REPORT_DISABLE : ''),
|
|
90
|
+
)
|
|
91
|
+
} finally {
|
|
92
|
+
try {
|
|
93
|
+
instance.unmount()
|
|
94
|
+
} finally {
|
|
95
|
+
tuiStdin.dispose()
|
|
96
|
+
// Belt and braces: give the tty back its cooked mode even when
|
|
97
|
+
// Ink never took raw mode over (idempotent at the termios level).
|
|
98
|
+
if (process.stdin.isTTY === true) process.stdin.setRawMode?.(false)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
} catch (error) {
|
|
104
|
+
// The synchronous mount path failed before Ink could own the terminal:
|
|
105
|
+
// undo the raw mode entered above so the shell keeps its echo.
|
|
106
|
+
if (process.stdin.isTTY === true) process.stdin.setRawMode?.(false)
|
|
107
|
+
throw error
|
|
87
108
|
}
|
|
88
109
|
},
|
|
89
110
|
stderr: process.stderr,
|
package/src/provider-settings.ts
CHANGED
|
@@ -33,6 +33,8 @@ interface LlmFace {
|
|
|
33
33
|
readonly settingsNs: string
|
|
34
34
|
readonly settingsPath: readonly string[]
|
|
35
35
|
readonly declared?: boolean
|
|
36
|
+
/** Configuration diagnostic for repair; unaffected models may remain serviceable. */
|
|
37
|
+
readonly error?: string
|
|
36
38
|
}[]
|
|
37
39
|
/**
|
|
38
40
|
* Registered endpoint model discovery; absent on an older service. The
|
|
@@ -256,18 +258,6 @@ export interface DiscoveredModelView {
|
|
|
256
258
|
readonly maxTokens?: number
|
|
257
259
|
}
|
|
258
260
|
|
|
259
|
-
/** One model an endpoint reported about itself (mirrors LlmDiscoveredModel). */
|
|
260
|
-
export interface DiscoveredModelView {
|
|
261
|
-
/** Model id the endpoint accepts. */
|
|
262
|
-
readonly id: string
|
|
263
|
-
/** Human-readable name when the endpoint supplies one. */
|
|
264
|
-
readonly name?: string
|
|
265
|
-
/** Context window when disclosed; adoption still owes it if absent. */
|
|
266
|
-
readonly contextWindow?: number
|
|
267
|
-
/** Output cap when disclosed. */
|
|
268
|
-
readonly maxTokens?: number
|
|
269
|
-
}
|
|
270
|
-
|
|
271
261
|
/**
|
|
272
262
|
* The seven canonical reasoning levels a reasoningEfforts key may name -
|
|
273
263
|
* pi-ai's THINKING_LEVELS. A pi-ai upgrade that adds or removes one fails
|
|
@@ -362,6 +352,12 @@ export interface ProviderTargetView {
|
|
|
362
352
|
readonly configuration: ProviderConfiguration
|
|
363
353
|
/** The owning adapter reports this route as hand-declared (absent when it draws no distinction). */
|
|
364
354
|
readonly declared?: boolean
|
|
355
|
+
/**
|
|
356
|
+
* Configuration diagnostic the adapter reported for this route (catalog or
|
|
357
|
+
* profile damage): the row stays listed and repairable instead of the whole
|
|
358
|
+
* provider vanishing; absent when the route reads clean.
|
|
359
|
+
*/
|
|
360
|
+
readonly diagnostic?: string
|
|
365
361
|
}
|
|
366
362
|
|
|
367
363
|
/** The resolved provider/settings/credential join. */
|
|
@@ -431,6 +427,7 @@ export async function loadProviderSettings(ctx: Context): Promise<ProviderSettin
|
|
|
431
427
|
settingsNs: string
|
|
432
428
|
settingsPath: readonly string[]
|
|
433
429
|
declared?: boolean
|
|
430
|
+
error?: string
|
|
434
431
|
}> = []
|
|
435
432
|
if (llm.listConfigurableProviders !== undefined) {
|
|
436
433
|
try {
|
|
@@ -462,6 +459,7 @@ export async function loadProviderSettings(ctx: Context): Promise<ProviderSettin
|
|
|
462
459
|
settingsNs: string
|
|
463
460
|
settingsPath: readonly string[]
|
|
464
461
|
declared?: boolean
|
|
462
|
+
error?: string
|
|
465
463
|
}> = [
|
|
466
464
|
...directoryEntries.map(entry => ({
|
|
467
465
|
provider: entry.provider,
|
|
@@ -470,6 +468,7 @@ export async function loadProviderSettings(ctx: Context): Promise<ProviderSettin
|
|
|
470
468
|
settingsNs: entry.settingsNs,
|
|
471
469
|
settingsPath: entry.settingsPath,
|
|
472
470
|
...entry.declared === undefined ? {} : { declared: entry.declared },
|
|
471
|
+
...entry.error === undefined ? {} : { error: singleLine(entry.error) },
|
|
473
472
|
})),
|
|
474
473
|
...registered
|
|
475
474
|
.filter(provider => !declared.has(provider.id))
|
|
@@ -508,6 +507,7 @@ export async function loadProviderSettings(ctx: Context): Promise<ProviderSettin
|
|
|
508
507
|
...credentialRef === undefined ? {} : { credentialRef },
|
|
509
508
|
suggestedRef: deriveCredentialRef(base.provider),
|
|
510
509
|
...base.declared === undefined ? {} : { declared: base.declared },
|
|
510
|
+
...base.error === undefined ? {} : { diagnostic: base.error },
|
|
511
511
|
}
|
|
512
512
|
})
|
|
513
513
|
const refs = [...new Set(rows.flatMap(row => row.credentialRef === undefined ? [] : [row.credentialRef]))]
|