dsh-code 0.3.0 → 0.5.0
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.md +201 -55
- package/README.zh.md +204 -61
- package/bin/deepseek.mjs +70 -0
- package/cordis.patch.yml +62 -6
- package/lib/index.mjs +4073 -1802
- package/lib/startup.mjs +34 -17
- package/lib/types/app.d.ts +23 -22
- package/lib/types/commands.d.ts +2 -0
- package/lib/types/index.d.ts +5 -5
- package/lib/types/internals.d.ts +2 -0
- package/lib/types/kernel-panels.d.ts +23 -0
- package/lib/types/plugin-inventory.d.ts +11 -0
- package/lib/types/presets.d.ts +32 -0
- package/lib/types/render/export.d.ts +15 -0
- package/lib/types/render/inspector.d.ts +34 -0
- package/lib/types/render/lines.d.ts +31 -0
- package/lib/types/render/projection.d.ts +95 -3
- package/lib/types/render/status.d.ts +19 -0
- package/lib/types/render/text.d.ts +27 -0
- package/lib/types/render/tool-detail.d.ts +92 -0
- package/lib/types/session-directory.d.ts +54 -0
- package/lib/types/session-switch.d.ts +17 -0
- package/lib/types/skills.d.ts +2 -0
- package/lib/types/startup.d.ts +11 -1
- package/lib/types/store.d.ts +2 -0
- package/package.json +16 -1
- package/src/app.ts +1367 -277
- package/src/commands.ts +15 -1
- package/src/index.ts +373 -128
- package/src/internals.ts +5 -0
- package/src/kernel-panels.ts +254 -0
- package/src/plugin-inventory.ts +47 -0
- package/src/presets.ts +64 -0
- package/src/render/export.ts +81 -0
- package/src/render/inspector.ts +88 -0
- package/src/render/lines.ts +207 -0
- package/src/render/markdown.ts +15 -1
- package/src/render/projection.ts +279 -16
- package/src/render/status.ts +51 -1
- package/src/render/text.ts +107 -0
- package/src/render/tool-detail.ts +197 -0
- package/src/session-directory.ts +102 -0
- package/src/session-switch.ts +58 -0
- package/src/skills.ts +20 -7
- package/src/startup.ts +38 -20
- package/src/store.ts +8 -0
package/src/commands.ts
CHANGED
|
@@ -16,6 +16,8 @@ import type { CommandDescriptor } from '@deepseek-ai/dsh-commands'
|
|
|
16
16
|
export interface CommandsView {
|
|
17
17
|
/** Name-sorted descriptors after scoped shadowing. */
|
|
18
18
|
readonly descriptors: readonly CommandDescriptor[]
|
|
19
|
+
/** Latest descriptor-read failure; the help panel exposes it in place. */
|
|
20
|
+
readonly error?: string
|
|
19
21
|
/** Subscribe to list changes (`commands/change`); returns the unsubscribe function. */
|
|
20
22
|
subscribe(listener: () => void): () => void
|
|
21
23
|
/** Retarget the agent whose scoped view the list is read through. */
|
|
@@ -35,10 +37,19 @@ export function watchCommands(ctx: Context): CommandsView {
|
|
|
35
37
|
const commands = ctx.get('commands')
|
|
36
38
|
let agent: Agent | undefined
|
|
37
39
|
let descriptors: readonly CommandDescriptor[] = []
|
|
40
|
+
let error: string | undefined
|
|
38
41
|
const listeners = new Set<() => void>()
|
|
39
42
|
const refresh = (): void => {
|
|
40
43
|
if (commands === undefined || agent === undefined) return
|
|
41
|
-
|
|
44
|
+
try {
|
|
45
|
+
descriptors = commands.list(agent)
|
|
46
|
+
error = undefined
|
|
47
|
+
} catch (cause: unknown) {
|
|
48
|
+
// Keep the last good catalog, but change its identity so subscribers
|
|
49
|
+
// can render the recoverable failure in /help.
|
|
50
|
+
descriptors = [...descriptors]
|
|
51
|
+
error = cause instanceof Error ? cause.message : String(cause)
|
|
52
|
+
}
|
|
42
53
|
for (const listener of listeners) listener()
|
|
43
54
|
}
|
|
44
55
|
if (commands !== undefined) {
|
|
@@ -48,6 +59,9 @@ export function watchCommands(ctx: Context): CommandsView {
|
|
|
48
59
|
get descriptors(): readonly CommandDescriptor[] {
|
|
49
60
|
return descriptors
|
|
50
61
|
},
|
|
62
|
+
get error(): string | undefined {
|
|
63
|
+
return error
|
|
64
|
+
},
|
|
51
65
|
subscribe(listener: () => void): () => void {
|
|
52
66
|
listeners.add(listener)
|
|
53
67
|
return () => {
|