dsh-code 0.1.0 → 0.3.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 (43) hide show
  1. package/README.md +17 -4
  2. package/README.zh.md +17 -4
  3. package/cordis.patch.yml +22 -5
  4. package/lib/index.mjs +1888 -100
  5. package/lib/invariant.mjs +1 -1
  6. package/lib/startup.mjs +70 -0
  7. package/lib/types/app.d.ts +64 -9
  8. package/lib/types/approval.d.ts +57 -0
  9. package/lib/types/commands.d.ts +37 -0
  10. package/lib/types/index.d.ts +19 -7
  11. package/lib/types/invariant.d.ts +2 -2
  12. package/lib/types/mentions.d.ts +70 -0
  13. package/lib/types/models.d.ts +37 -0
  14. package/lib/types/questions.d.ts +48 -0
  15. package/lib/types/render/animations.d.ts +15 -0
  16. package/lib/types/render/markdown.d.ts +27 -0
  17. package/lib/types/render/projection.d.ts +37 -3
  18. package/lib/types/render/status.d.ts +4 -0
  19. package/lib/types/render/text.d.ts +18 -0
  20. package/lib/types/render/tool-preview.d.ts +15 -0
  21. package/lib/types/skills.d.ts +45 -0
  22. package/lib/types/startup.d.ts +44 -0
  23. package/lib/types/store.d.ts +8 -2
  24. package/lib/types/theme.d.ts +4 -0
  25. package/package.json +36 -3
  26. package/src/app.ts +971 -57
  27. package/src/approval.ts +126 -0
  28. package/src/commands.ts +71 -0
  29. package/src/index.ts +353 -40
  30. package/src/invariant.ts +3 -3
  31. package/src/mentions.ts +193 -0
  32. package/src/models.ts +66 -0
  33. package/src/questions.ts +143 -0
  34. package/src/render/animations.ts +22 -0
  35. package/src/render/markdown.ts +235 -0
  36. package/src/render/projection.ts +117 -10
  37. package/src/render/status.ts +14 -2
  38. package/src/render/text.ts +24 -0
  39. package/src/render/tool-preview.ts +34 -0
  40. package/src/skills.ts +104 -0
  41. package/src/startup.ts +91 -0
  42. package/src/store.ts +10 -4
  43. package/src/theme.ts +4 -0
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Bounded preview line for a tool invocation's raw JSON arguments: the first
3
+ * human-meaningful string among the well-known keys (command, path, query, …)
4
+ * with a fallback to the bounded raw JSON. Shared by the tool card in the
5
+ * transcript and the approval bar's command preview.
6
+ *
7
+ * @module @deepseek-ai/dsh-code/render/tool-preview
8
+ */
9
+ /**
10
+ * Resolve one bounded preview for raw tool arguments.
11
+ * @param args - raw JSON arguments string as the model produced it.
12
+ * @param toolName - the tool the arguments belong to (fallback label).
13
+ * @returns the preview line; empty when nothing useful resolves.
14
+ */
15
+ export declare function toolArgumentsPreview(args: string, toolName: string): string;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * User-invocable skill watch for the `/` completion menu: the in-process
3
+ * equivalent of the web ui-skill trigger source. Skills are NOT commands —
4
+ * picking one lands the literal `/name ` text in the input, and submitting
5
+ * it as a normal prompt lets the host's tool-skill pre-step inject the body
6
+ * (the only entry point for model-disabled skills). Command descriptors win
7
+ * on a name collision; see the runner's dispatch.
8
+ *
9
+ * @module @deepseek-ai/dsh-code/skills
10
+ */
11
+ import type { Context } from '@deepseek-ai/cordis';
12
+ import type { Agent } from '@deepseek-ai/dsh-agent';
13
+ /** One completion-menu row derived from a user-invocable skill. */
14
+ export interface SkillRow {
15
+ /** Skill name; the literal `/name` text is what a pick lands. */
16
+ name: string;
17
+ /** Human-readable description (suffixed when model-invocation is off). */
18
+ description: string;
19
+ /** Whether the model may also invoke this skill by name. */
20
+ modelInvocable: boolean;
21
+ }
22
+ /** The skill-catalog snapshot the completion menu subscribes to. */
23
+ export interface SkillsView {
24
+ /** Name-sorted user-invocable rows; empty until the first load lands. */
25
+ readonly rows: readonly SkillRow[];
26
+ /** Subscribe to catalog changes; returns the unsubscribe function. */
27
+ subscribe(listener: () => void): () => void;
28
+ /** Retarget the agent whose workspace the catalog is read for. */
29
+ setAgent(agent: Agent): void;
30
+ }
31
+ /** Internal shape shared by {@link watchSkills} and its test doubles. */
32
+ interface SkillsWatch extends SkillsView {
33
+ setAgent(agent: Agent): void;
34
+ }
35
+ /**
36
+ * Watch the user-invocable skill catalog for one agent's workspace. The first
37
+ * load starts when the owning agent is known (`setAgent`); `skills/change`
38
+ * and agent retargets re-read. Read failures keep the last good rows (the
39
+ * next change notification is the retry surface) — a missing `skills`
40
+ * service leaves the view permanently empty.
41
+ * @param ctx - context carrying the `skills` service (optional).
42
+ * @returns the view the completion menu subscribes to.
43
+ */
44
+ export declare function watchSkills(ctx: Context): SkillsWatch;
45
+ export {};
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The interactive terminal app's command-line provider: parses `--resume`,
3
+ * `--continue`, `--session`, and `--help`, then publishes
4
+ * {@link TUI_STARTUP_SERVICE} for the runner to consume lazily. Follows the
5
+ * headless bundle's startup shape (a commander action publishing a service
6
+ * through {@link parseCmdline}).
7
+ *
8
+ * Semantics:
9
+ * - `--resume <id|prefix>` — continue the persisted session whose id or unique
10
+ * id-prefix matches; the TUI replays its transcript and appends to the same
11
+ * durable log.
12
+ * - `--continue` / `-c` — resume the most recently modified persisted session
13
+ * whose project directory matches the current working directory.
14
+ * - `--session <id>` — create a new session under an explicit identity (the
15
+ * id must not exist yet).
16
+ * - no flags — a fresh session with a minted id.
17
+ *
18
+ * @module @deepseek-ai/dsh-tui/startup
19
+ */
20
+ import type { Context } from '@deepseek-ai/cordis';
21
+ /** Stable Cordis plugin name. */
22
+ export declare const name = "tui-startup";
23
+ /** Services required before the invocation can be resolved. */
24
+ export declare const inject: string[];
25
+ /** Service provided by this plugin and injected by the terminal runner. */
26
+ export declare const TUI_STARTUP_SERVICE = "tuiStartup";
27
+ /** How the runner obtains its session identity. */
28
+ export type TuiStartup = {
29
+ readonly kind: 'fresh';
30
+ } | {
31
+ readonly kind: 'named';
32
+ readonly sessionId: string;
33
+ } | {
34
+ readonly kind: 'resume';
35
+ readonly sessionId: string;
36
+ } | {
37
+ readonly kind: 'latest';
38
+ };
39
+ /**
40
+ * Parse the invocation and publish the startup service. Mutual exclusions are
41
+ * usage errors rejected from the action before anything is provided.
42
+ * @param ctx - plugin context carrying the command line and exit request.
43
+ */
44
+ export declare function apply(ctx: Context): void;
@@ -18,7 +18,13 @@ export interface TranscriptStore {
18
18
  apply(event: SessionEvent): void;
19
19
  }
20
20
  /**
21
- * Create one transcript store.
21
+ * Create one transcript store, optionally seeded with replayed history. The
22
+ * seed folds synchronously BEFORE the first render, so a resumed session
23
+ * paints its full transcript on mount (no live `session/event` fires for
24
+ * constructor seeds — the store's `session/event` feed only carries new
25
+ * appends).
26
+ * @param replay - persisted events in `seq` order (e.g. a resumed session's
27
+ * constructor seed); folded once and never re-notified.
22
28
  * @returns the store the runner feeds and the renderer subscribes to.
23
29
  */
24
- export declare function createTranscriptStore(): TranscriptStore;
30
+ export declare function createTranscriptStore(replay?: readonly SessionEvent[]): TranscriptStore;
@@ -25,6 +25,10 @@ export declare const TUI_RGB: {
25
25
  readonly error: readonly [239, 68, 68];
26
26
  /** Warning amber — `--dsw-static-amber-500`. */
27
27
  readonly warn: readonly [245, 158, 11];
28
+ /** Default foreground text — `--dsw-static-neutral-50`. */
29
+ readonly text: readonly [236, 240, 246];
30
+ /** Inline/fenced code — soft sky blue, distinct from brand accents. */
31
+ readonly code: readonly [125, 211, 252];
28
32
  };
29
33
  /** Paint with the primary brand blue: whale, wordmark, tool names, accents. */
30
34
  export declare function brand(text: string): string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-code",
3
3
  "description": "Claude-Code-style interactive TUI bundle for DeepSeek Harness (dsh): DeepSeek-blue whale banner, live session transcript, and a blended status line",
4
- "version": "0.1.0",
4
+ "version": "0.3.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",
7
7
  "types": "lib/types/index.d.ts",
@@ -10,6 +10,10 @@
10
10
  "types": "./lib/types/index.d.ts",
11
11
  "default": "./lib/index.mjs"
12
12
  },
13
+ "./startup": {
14
+ "types": "./lib/types/startup.d.ts",
15
+ "default": "./lib/startup.mjs"
16
+ },
13
17
  "./invariant": {
14
18
  "types": "./lib/types/invariant.d.ts",
15
19
  "default": "./lib/invariant.mjs"
@@ -24,6 +28,16 @@
24
28
  "src"
25
29
  ],
26
30
  "license": "MIT",
31
+ "keywords": [
32
+ "deepseek",
33
+ "dsh",
34
+ "deepseek-harness",
35
+ "tui",
36
+ "terminal",
37
+ "claude-code",
38
+ "agent",
39
+ "ink"
40
+ ],
27
41
  "repository": {
28
42
  "type": "git",
29
43
  "url": "git+https://github.com/unlinearity/dsh-code.git"
@@ -37,13 +51,16 @@
37
51
  "build": "tsdown && tsc -p tsconfig.json",
38
52
  "test": "vitest run",
39
53
  "typecheck": "tsc -p tsconfig.json --noEmit",
40
- "gen:whale": "tsx scripts/gen-whale-glyph.ts"
54
+ "gen:whale": "tsx scripts/gen-whale-glyph.ts",
55
+ "prepublishOnly": "pnpm typecheck && pnpm test && pnpm build"
41
56
  },
42
57
  "engines": {
43
58
  "node": "^22.19 || >=24"
44
59
  },
45
60
  "dependencies": {
61
+ "@deepseek-ai/schemastery": "^3.18.1",
46
62
  "chalk": "^5.6.2",
63
+ "commander": "^14.0.2",
47
64
  "ink": "^5.2.1",
48
65
  "react": "^18.3.1"
49
66
  },
@@ -54,11 +71,27 @@
54
71
  "@deepseek-ai/dsh-agent-default-model": "^0.1.0-rc.6",
55
72
  "@deepseek-ai/dsh-cmdline": "^0.1.0-rc.6",
56
73
  "@deepseek-ai/dsh-code-runtime-worker-thread": "^0.1.0-rc.6",
74
+ "@deepseek-ai/dsh-commands": "^0.1.0-rc.6",
57
75
  "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
58
76
  "@deepseek-ai/dsh-llm": "^0.1.0-rc.6",
59
- "@deepseek-ai/dsh-session": "^0.1.0-rc.6"
77
+ "@deepseek-ai/dsh-permission-presets": "^0.1.0-rc.6",
78
+ "@deepseek-ai/dsh-plan-mode": "^0.1.0-rc.6",
79
+ "@deepseek-ai/dsh-session": "^0.1.0-rc.6",
80
+ "@deepseek-ai/dsh-session-persistence": "^0.1.0-rc.6",
81
+ "@deepseek-ai/dsh-session-reference": "^0.1.0-rc.6",
82
+ "@deepseek-ai/dsh-skill": "^0.1.0-rc.6",
83
+ "@deepseek-ai/dsh-user-approval": "^0.1.0-rc.6",
84
+ "@deepseek-ai/dsh-user-questions": "^0.1.0-rc.6"
60
85
  },
61
86
  "devDependencies": {
87
+ "@deepseek-ai/dsh-commands": "^0.1.0-rc.6",
88
+ "@deepseek-ai/dsh-permission-presets": "^0.1.0-rc.6",
89
+ "@deepseek-ai/dsh-plan-mode": "^0.1.0-rc.6",
90
+ "@deepseek-ai/dsh-session-persistence": "^0.1.0-rc.6",
91
+ "@deepseek-ai/dsh-session-reference": "^0.1.0-rc.6",
92
+ "@deepseek-ai/dsh-skill": "^0.1.0-rc.6",
93
+ "@deepseek-ai/dsh-user-approval": "^0.1.0-rc.6",
94
+ "@deepseek-ai/dsh-user-questions": "^0.1.0-rc.6",
62
95
  "@types/node": "^24.0.0",
63
96
  "@types/react": "~18.3.1",
64
97
  "tsdown": "^0.22.2",