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.
Files changed (46) hide show
  1. package/README.md +201 -55
  2. package/README.zh.md +204 -61
  3. package/bin/deepseek.mjs +70 -0
  4. package/cordis.patch.yml +62 -6
  5. package/lib/index.mjs +4073 -1802
  6. package/lib/startup.mjs +34 -17
  7. package/lib/types/app.d.ts +23 -22
  8. package/lib/types/commands.d.ts +2 -0
  9. package/lib/types/index.d.ts +5 -5
  10. package/lib/types/internals.d.ts +2 -0
  11. package/lib/types/kernel-panels.d.ts +23 -0
  12. package/lib/types/plugin-inventory.d.ts +11 -0
  13. package/lib/types/presets.d.ts +32 -0
  14. package/lib/types/render/export.d.ts +15 -0
  15. package/lib/types/render/inspector.d.ts +34 -0
  16. package/lib/types/render/lines.d.ts +31 -0
  17. package/lib/types/render/projection.d.ts +95 -3
  18. package/lib/types/render/status.d.ts +19 -0
  19. package/lib/types/render/text.d.ts +27 -0
  20. package/lib/types/render/tool-detail.d.ts +92 -0
  21. package/lib/types/session-directory.d.ts +54 -0
  22. package/lib/types/session-switch.d.ts +17 -0
  23. package/lib/types/skills.d.ts +2 -0
  24. package/lib/types/startup.d.ts +11 -1
  25. package/lib/types/store.d.ts +2 -0
  26. package/package.json +16 -1
  27. package/src/app.ts +1367 -277
  28. package/src/commands.ts +15 -1
  29. package/src/index.ts +373 -128
  30. package/src/internals.ts +5 -0
  31. package/src/kernel-panels.ts +254 -0
  32. package/src/plugin-inventory.ts +47 -0
  33. package/src/presets.ts +64 -0
  34. package/src/render/export.ts +81 -0
  35. package/src/render/inspector.ts +88 -0
  36. package/src/render/lines.ts +207 -0
  37. package/src/render/markdown.ts +15 -1
  38. package/src/render/projection.ts +279 -16
  39. package/src/render/status.ts +51 -1
  40. package/src/render/text.ts +107 -0
  41. package/src/render/tool-detail.ts +197 -0
  42. package/src/session-directory.ts +102 -0
  43. package/src/session-switch.ts +58 -0
  44. package/src/skills.ts +20 -7
  45. package/src/startup.ts +38 -20
  46. 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
- descriptors = commands.list(agent)
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 () => {