@aiwayds/dsh-tui-pi 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 (67) hide show
  1. package/README.md +205 -68
  2. package/lib/agent-manager.d.ts +125 -0
  3. package/lib/agent-manager.js +298 -0
  4. package/lib/agent-manager.js.map +1 -0
  5. package/lib/agents.d.ts +30 -0
  6. package/lib/agents.js +468 -0
  7. package/lib/agents.js.map +1 -0
  8. package/lib/append-system.d.ts +2 -0
  9. package/lib/append-system.js +1 -1
  10. package/lib/append-system.js.map +1 -1
  11. package/lib/dsh-events.d.ts +12 -0
  12. package/lib/editor.d.ts +58 -0
  13. package/lib/editor.js +92 -0
  14. package/lib/editor.js.map +1 -1
  15. package/lib/footer.d.ts +8 -0
  16. package/lib/footer.js +8 -0
  17. package/lib/footer.js.map +1 -1
  18. package/lib/hotkeys.d.ts +93 -0
  19. package/lib/hotkeys.js +305 -0
  20. package/lib/hotkeys.js.map +1 -0
  21. package/lib/index.js +342 -38
  22. package/lib/index.js.map +1 -1
  23. package/lib/keymap.d.ts +177 -0
  24. package/lib/keymap.js +189 -0
  25. package/lib/keymap.js.map +1 -0
  26. package/lib/live-widgets.d.ts +82 -29
  27. package/lib/live-widgets.js +222 -92
  28. package/lib/live-widgets.js.map +1 -1
  29. package/lib/messages.d.ts +4 -2
  30. package/lib/messages.js +8 -3
  31. package/lib/messages.js.map +1 -1
  32. package/lib/panels.d.ts +177 -0
  33. package/lib/panels.js +331 -0
  34. package/lib/panels.js.map +1 -0
  35. package/lib/provider-catalog.d.ts +31 -8
  36. package/lib/provider-catalog.js +63 -8
  37. package/lib/provider-catalog.js.map +1 -1
  38. package/lib/selectors.d.ts +12 -1
  39. package/lib/selectors.js +5 -2
  40. package/lib/selectors.js.map +1 -1
  41. package/lib/session.d.ts +36 -0
  42. package/lib/session.js +171 -10
  43. package/lib/session.js.map +1 -1
  44. package/lib/settings.d.ts +1 -2
  45. package/lib/settings.js +29 -2
  46. package/lib/settings.js.map +1 -1
  47. package/lib/subagent-policy.d.ts +58 -0
  48. package/lib/subagent-policy.js +137 -0
  49. package/lib/subagent-policy.js.map +1 -0
  50. package/lib/subagent-viewer.d.ts +49 -0
  51. package/lib/subagent-viewer.js +523 -0
  52. package/lib/subagent-viewer.js.map +1 -0
  53. package/lib/theme/index.js +4 -0
  54. package/lib/theme/index.js.map +1 -1
  55. package/lib/theme/palette.d.ts +21 -3
  56. package/lib/theme/palette.js +27 -6
  57. package/lib/theme/palette.js.map +1 -1
  58. package/lib/theme-settings.d.ts +39 -4
  59. package/lib/theme-settings.js +69 -12
  60. package/lib/theme-settings.js.map +1 -1
  61. package/lib/tui.d.ts +32 -12
  62. package/lib/tui.js +109 -36
  63. package/lib/tui.js.map +1 -1
  64. package/package.json +3 -4
  65. package/patches/@earendil-works__pi-tui.patch +206 -2
  66. package/scripts/dev-install.mjs +87 -0
  67. package/scripts/link-dsh-closure.mjs +85 -0
package/lib/tui.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tui.js","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,SAAS,EACT,UAAU,EACV,eAAe,EACf,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,MAAM,GAGP,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAuC,MAAM,kBAAkB,CAAA;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAoDvC,MAAM,UAAU,QAAQ,CAAC,UAA2B,EAAE;IACpD,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAA;IACtC,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IAC5C,wEAAwE;IACxE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pi",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "pi-style terminal UI for DeepSeek Harness (dsh) — pi-tui look & feel, dsh slash commands, GitHub light/dark themes, powerline footer",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -18,23 +18,22 @@
18
18
  "cordis.patch.yml",
19
19
  "patches",
20
20
  "pnpm-workspace.yaml",
21
+ "scripts",
21
22
  "templates",
22
23
  "README.md",
23
24
  "LICENSE"
24
25
  ],
25
26
  "scripts": {
27
+ "postinstall": "node scripts/link-dsh-closure.mjs",
26
28
  "build": "tsc -p tsconfig.json",
27
29
  "check": "tsc --noEmit -p tsconfig.json",
28
30
  "pretest": "npm run build",
29
31
  "test": "node --test test/*.test.mjs"
30
32
  },
31
33
  "dependencies": {
32
- "@deepseek-ai/dsh-client-schema-form": "0.1.0-rc.6",
33
34
  "@earendil-works/pi-tui": "0.84.2"
34
35
  },
35
36
  "devDependencies": {
36
- "@deepseek-ai/dsh-settings": "0.1.0-rc.6",
37
- "@deepseek-ai/schemastery": "3.18.1",
38
37
  "@types/node": "^24.0.0",
39
38
  "typescript": "~5.9.0"
40
39
  },
@@ -1,8 +1,54 @@
1
+ diff --git a/dist/components/editor.d.ts b/dist/components/editor.d.ts
2
+ index a6fedc9e3b36d066e34860d040db6df47d88c432..f4d9afd8bc64f5ce5aafa06bb1aa8db3338c4f7d 100644
3
+ --- a/dist/components/editor.d.ts
4
+ +++ b/dist/components/editor.d.ts
5
+ @@ -24,6 +24,8 @@ export interface TextChunk {
6
+ export declare function wordWrapLine(line: string, maxWidth: number, preSegmented?: Intl.SegmentData[]): TextChunk[];
7
+ export interface EditorTheme {
8
+ borderColor: (str: string) => string;
9
+ + /** Optional style for the editor's input text rows. Absent → the terminal default foreground is used (invisible on an app-painted dark canvas). */
10
+ + textColor?: (str: string) => string;
11
+ selectList: SelectListTheme;
12
+ }
13
+ export interface EditorOptions {
1
14
  diff --git a/dist/components/editor.js b/dist/components/editor.js
2
- index 4786b46932b65785cfbd2304610ca77ccead910a..e0e4e39c3be8e5d4d828621ad2d3d8768984add8 100644
15
+ index 4786b46932b65785cfbd2304610ca77ccead910a..93c5f7e1596a0b567cf9fc59600c16596a60e567 100644
3
16
  --- a/dist/components/editor.js
4
17
  +++ b/dist/components/editor.js
5
- @@ -463,14 +463,20 @@ export class Editor {
18
+ @@ -433,13 +433,13 @@ export class Editor {
19
+ const afterGraphemes = [...this.segment(after, "grapheme")];
20
+ const firstGrapheme = afterGraphemes[0]?.segment || "";
21
+ const restAfter = after.slice(firstGrapheme.length);
22
+ - const cursor = `\x1b[7m${firstGrapheme}\x1b[0m`;
23
+ + const cursor = `\x1b[7m${firstGrapheme}\x1b[27m`;
24
+ displayText = before + marker + cursor + restAfter;
25
+ // lineVisibleWidth stays the same - we're replacing, not adding
26
+ }
27
+ else {
28
+ // Cursor is at the end - add highlighted space
29
+ - const cursor = "\x1b[7m \x1b[0m";
30
+ + const cursor = "\x1b[7m \x1b[27m";
31
+ displayText = before + marker + cursor;
32
+ lineVisibleWidth = lineVisibleWidth + 1;
33
+ // If cursor overflows content width into the padding, flag it
34
+ @@ -451,8 +451,14 @@ export class Editor {
35
+ // Calculate padding based on actual visible width
36
+ const padding = " ".repeat(Math.max(0, contentWidth - lineVisibleWidth));
37
+ const lineRightPadding = cursorInPadding ? rightPadding.slice(1) : rightPadding;
38
+ - // Render the line (no side borders, just horizontal lines above and below)
39
+ - result.push(`${leftPadding}${displayText}${padding}${lineRightPadding}`);
40
+ + // Render the line (no side borders, just horizontal lines above and below).
41
+ + // The theme's optional textColor styles the input rows — without it they
42
+ + // fall back to the terminal default foreground, which is invisible on an
43
+ + // app-painted dark canvas. Applied per line; the cursor's reverse-video
44
+ + // closes with ESC[27m (reverse off, not full reset) so the themed
45
+ + // foreground survives past a mid-text cursor.
46
+ + const styledText = this.theme.textColor ? this.theme.textColor(displayText) : displayText;
47
+ + result.push(`${leftPadding}${styledText}${padding}${lineRightPadding}`);
48
+ }
49
+ // Render bottom border (with scroll indicator if more content below)
50
+ const linesBelow = layoutLines.length - (this.scrollOffset + visibleLines.length);
51
+ @@ -463,14 +469,20 @@ export class Editor {
6
52
  else {
7
53
  result.push(horizontal.repeat(width));
8
54
  }
@@ -70,3 +116,161 @@ index 2e9231150951c3d3f3e13ac8ae8d623f06d38d5d..d5c8859ecd08fe4eccdc3cfca8ac7a32
70
116
  }
71
117
  getPrimaryColumnWidth() {
72
118
  const { min, max } = this.getPrimaryColumnBounds();
119
+ diff --git a/dist/index.d.ts b/dist/index.d.ts
120
+ index 50b5aeb61f12011642978bc2c31d8a2eb36d17d3..28b70df8001dc6b78056c408bdd6016f34f44e46 100644
121
+ --- a/dist/index.d.ts
122
+ +++ b/dist/index.d.ts
123
+ @@ -25,7 +25,7 @@ export { ProcessTerminal, type Terminal } from "./terminal.ts";
124
+ export { parseOsc11BackgroundColor, parseTerminalColorSchemeReport, type RgbColor, type TerminalColorScheme, } from "./terminal-colors.ts";
125
+ export { allocateImageId, type CellDimensions, calculateImageRows, deleteAllKittyImages, deleteKittyImage, detectCapabilities, encodeITerm2, encodeKitty, getCapabilities, getCellDimensions, getGifDimensions, getImageDimensions, getJpegDimensions, getPngDimensions, getWebpDimensions, hyperlink, type ImageDimensions, type ImageProtocol, type ImageRenderOptions, imageFallback, renderImage, resetCapabilitiesCache, setCapabilities, setCellDimensions, type TerminalCapabilities, } from "./terminal-image.ts";
126
+ export { type Component, Container, CURSOR_MARKER, compositeTuiLine, type Focusable, isFocusable, isViewportTUI, type OverlayAnchor, type OverlayHandle, type OverlayMargin, type OverlayOptions, type OverlayUnfocusOptions, type SizeValue, type TUI, type TuiInputListener, type TuiInputListenerResult, type TuiMode, type TuiStopOptions, type ViewportTUI, } from "./tui.ts";
127
+ -export { TuiAltScreen, type TuiAltScreenOptions } from "./tui-alt-screen.ts";
128
+ +export { paintCanvasRow, TuiAltScreen, type TuiAltScreenOptions } from "./tui-alt-screen.ts";
129
+ export { TuiMainScreen, type TuiMainScreenRenderState } from "./tui-main-screen.ts";
130
+ export { getOsc8LinkAtColumn, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "./utils.ts";
131
+ //# sourceMappingURL=index.d.ts.map
132
+
133
+ diff --git a/dist/index.js b/dist/index.js
134
+ index 97acf774699dded9c5e490f2441a93ec05b73be5..80a1abf6ac515c4df22e3bf78fc0504d50ad6dd4 100644
135
+ --- a/dist/index.js
136
+ +++ b/dist/index.js
137
+ @@ -35,7 +35,7 @@ export { parseOsc11BackgroundColor, parseTerminalColorSchemeReport, } from "./te
138
+ // Terminal image support
139
+ export { allocateImageId, calculateImageRows, deleteAllKittyImages, deleteKittyImage, detectCapabilities, encodeITerm2, encodeKitty, getCapabilities, getCellDimensions, getGifDimensions, getImageDimensions, getJpegDimensions, getPngDimensions, getWebpDimensions, hyperlink, imageFallback, renderImage, resetCapabilitiesCache, setCapabilities, setCellDimensions, } from "./terminal-image.js";
140
+ export { Container, CURSOR_MARKER, compositeTuiLine, isFocusable, isViewportTUI, } from "./tui.js";
141
+ -export { TuiAltScreen } from "./tui-alt-screen.js";
142
+ +export { paintCanvasRow, TuiAltScreen } from "./tui-alt-screen.js";
143
+ export { TuiMainScreen } from "./tui-main-screen.js";
144
+ // Utilities
145
+ export { getOsc8LinkAtColumn, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "./utils.js";
146
+ diff --git a/dist/tui-alt-screen.d.ts b/dist/tui-alt-screen.d.ts
147
+ index 848119411c1ff2885b8d1efe97f2f297bd4cd470..96422839632a71e6382a1fc6fcd9b43e7b435609 100644
148
+ --- a/dist/tui-alt-screen.d.ts
149
+ +++ b/dist/tui-alt-screen.d.ts
150
+ @@ -1,5 +1,11 @@
151
+ import type { Terminal } from "./terminal.ts";
152
+ import { type Component, TuiBase, type TuiStopOptions, VIEWPORT_TUI, type ViewportTUI } from "./tui.ts";
153
+ +/**
154
+ + * Paint one screen row with a canvas background SGR: prefix the row with the
155
+ + * bg code, re-inject it after every SGR that clears the background, and pad
156
+ + * to the full row width so the erase-line remainder carries the color too.
157
+ + */
158
+ +export declare function paintCanvasRow(line: string, background: string, width: number): string;
159
+ export interface TuiAltScreenOptions {
160
+ /** Number of logical lines moved for each mouse-wheel event. */
161
+ wheelScrollLines?: number;
162
+ @@ -57,11 +63,20 @@ export declare class TuiAltScreen extends TuiBase implements ViewportTUI {
163
+ private readonly openUrl?;
164
+ private readonly onRightClickPaste?;
165
+ private readonly copySelection?;
166
+ + private canvasBackground?;
167
+ constructor(terminal: Terminal, showHardwareCursor?: boolean, logDirectory?: string, options?: TuiAltScreenOptions);
168
+ get viewportTop(): number;
169
+ get isFollowingOutput(): boolean;
170
+ setLayoutRoot(component: Component | undefined): void;
171
+ render(width: number): string[];
172
+ + /**
173
+ + * Paint every rendered row with a canvas background SGR (e.g.
174
+ + * "\x1b[48;2;13;17;23m"). `undefined` restores the transparent default
175
+ + * (the terminal background shows through). The code is re-injected after
176
+ + * every SGR that clears the background and rows are padded to the full
177
+ + * width, so the whole screen carries the color — image rows excepted.
178
+ + */
179
+ + setCanvasBackground(background: string | undefined): void;
180
+ protected getMountedRoots(): readonly Component[];
181
+ private getPrimaryScrollView;
182
+ protected beforeTerminalStart(): void;
183
+ diff --git a/dist/tui-alt-screen.js b/dist/tui-alt-screen.js
184
+ index 4edcf845ba7866782a8ec7219508a2dce0073a91..338f2b29e7ba926399f3d663b0b79669c8ac6c13 100644
185
+ --- a/dist/tui-alt-screen.js
186
+ +++ b/dist/tui-alt-screen.js
187
+ @@ -21,6 +21,51 @@ const END_SYNCHRONIZED_OUTPUT = "\x1b[?2026l";
188
+ const OSC133_ZONE_PREFIX = /^(?:\x1b\]133;[ABC](?:\x07|\x1b\\))+/;
189
+ const OSC133_PROMPT_START = /^\x1b\]133;A(?:\x07|\x1b\\)/;
190
+ const PAGE_SCROLL_OVERLAP = 4;
191
+ +const CSI_PATTERN = /\x1b\[[0-9;:]*[A-Za-z]/g;
192
+ +/**
193
+ + * True when an SGR sequence resets the background to the terminal default:
194
+ + * a full reset (empty params or param 0) or the explicit default-bg param 49.
195
+ + * Intentional background sets (48/4…, 48;2;…) do not clear, so they win.
196
+ + */
197
+ +function sgrClearsBackground(sequence) {
198
+ + const params = sequence.slice(2, -1);
199
+ + if (params === "") return true;
200
+ + // A color-set (3x foreground / 4x background — ANSI 30-37/40-47, truecolor
201
+ + // 38;2/48;2, 256-color 38;5/48;5) never clears the background, even when a
202
+ + // channel is 0: 48;2;0;121;107 (teal) would otherwise read the 0 as the
203
+ + // reset param and re-inject the canvas over the segment. (49 alone — bg →
204
+ + // default — IS a clear and falls through to the loop below.)
205
+ + if (/^(?:3[0-7]|38;|4[0-8]|48;)/.test(params)) return false;
206
+ + for (const param of params.split(";")) {
207
+ + const code = param === "" ? 0 : Number.parseInt(param, 10);
208
+ + if (Number.isNaN(code)) continue;
209
+ + if (code === 0 || code === 49) return true;
210
+ + }
211
+ + return false;
212
+ +}
213
+ +/**
214
+ + * Paint one screen row with a canvas background SGR: prefix the row with the
215
+ + * bg code, re-inject it after every SGR that clears the background, and pad
216
+ + * to the full row width so the erase-line remainder carries the color too.
217
+ + * Image rows are the caller's responsibility (they must stay untouched).
218
+ + */
219
+ +export function paintCanvasRow(line, background, width) {
220
+ + let painted = background;
221
+ + let last = 0;
222
+ + for (const match of line.matchAll(CSI_PATTERN)) {
223
+ + const sequence = match[0];
224
+ + painted += line.slice(last, match.index);
225
+ + painted += sequence;
226
+ + if (sequence.endsWith("m") && sgrClearsBackground(sequence)) {
227
+ + painted += background;
228
+ + }
229
+ + last = match.index + sequence.length;
230
+ + }
231
+ + painted += line.slice(last);
232
+ + const pad = width - visibleWidth(line);
233
+ + if (pad > 0) painted += " ".repeat(pad);
234
+ + return `${painted}\x1b[0m`;
235
+ +}
236
+ const MAX_CACHED_OFFSCREEN_KITTY_IMAGES = 16;
237
+ const MAX_CACHED_OFFSCREEN_KITTY_TRANSMISSION_BYTES = 32 * 1024 * 1024;
238
+ const MAX_CACHED_OFFSCREEN_KITTY_DECODED_BYTES = 64 * 1024 * 1024;
239
+ @@ -64,6 +109,7 @@ export class TuiAltScreen extends TuiBase {
240
+ openUrl;
241
+ onRightClickPaste;
242
+ copySelection;
243
+ + canvasBackground;
244
+ constructor(terminal, showHardwareCursor, logDirectory, options = {}) {
245
+ super(terminal, showHardwareCursor, logDirectory);
246
+ this.implicitDocument = {
247
+ @@ -100,6 +146,18 @@ export class TuiAltScreen extends TuiBase {
248
+ render(width) {
249
+ return this.layoutRoot?.render(width) ?? super.render(width);
250
+ }
251
+ + /**
252
+ + * Paint every rendered row with a canvas background SGR (e.g.
253
+ + * "\x1b[48;2;13;17;23m"). `undefined` restores the transparent default
254
+ + * (the terminal background shows through). The code is re-injected after
255
+ + * every SGR that clears the background and rows are padded to the full
256
+ + * width, so the whole screen carries the color — image rows excepted.
257
+ + */
258
+ + setCanvasBackground(background) {
259
+ + if (this.canvasBackground === background) return;
260
+ + this.canvasBackground = background;
261
+ + this.requestRender();
262
+ + }
263
+ getMountedRoots() {
264
+ return this.layoutRoot ? [this.layoutRoot] : this.children;
265
+ }
266
+ @@ -1099,6 +1157,10 @@ export class TuiAltScreen extends TuiBase {
267
+ return line;
268
+ return sliceByColumn(line, 0, width, true);
269
+ });
270
+ + if (this.canvasBackground !== undefined) {
271
+ + const canvasBackground = this.canvasBackground;
272
+ + screen = screen.map((line) => (isImageLine(line) ? line : paintCanvasRow(line, canvasBackground, width)));
273
+ + }
274
+ const fullRedraw = this.previousScreen.length === 0 || this.previousScreenWidth !== width || this.previousScreenHeight !== height;
275
+ const imagesNeedRedraw = screen.some((line, row) => line !== this.previousScreen[row] && (isImageLine(line) || isImageLine(this.previousScreen[row] ?? "")));
276
+ const redrawImages = fullRedraw || imagesNeedRedraw;
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Dev loop: build → pack → install into a dsh profile — the same flow a real
4
+ * user gets (`dsh plugin add <tarball>`), no `link:` mount, no live-repo
5
+ * resolution at runtime.
6
+ *
7
+ * Usage: node scripts/dev-install.mjs [profile]
8
+ * (profile defaults to "tui")
9
+ *
10
+ * Steps:
11
+ * 1. `pnpm build` — emit lib/ from src/.
12
+ * 2. `pnpm pack` — produce <name>-<version>.tgz in the repo root.
13
+ * 3. In ~/.dsh/profiles/<profile>: remove the two installed copies of the
14
+ * plugin (bundle name `dsh-tui-pi` + scoped `@aiwayds/dsh-tui-pi`), then
15
+ * `pnpm install`. The file: tarball deps are reinstalled from the fresh
16
+ * tarball (pnpm does NOT re-read a changed tarball while the node_modules
17
+ * entry exists — the remove is what forces the refresh).
18
+ *
19
+ * The profile's package.json must declare BOTH keys pointing at the tarball:
20
+ * "dsh-tui-pi": "file:<repo>/<name>-<version>.tgz" (bundle resolution)
21
+ * "@aiwayds/dsh-tui-pi": "file:<repo>/<name>-<version>.tgz" (loader import)
22
+ * and pnpm-workspace.yaml must carry the pi-tui patchedDependencies (see
23
+ * ~/.dsh/profiles/tui/pnpm-workspace.yaml).
24
+ *
25
+ * After installing: restart dsh (or /reload inside the TUI) to load the new
26
+ * copy.
27
+ */
28
+
29
+ import { execFileSync } from 'node:child_process'
30
+ import { existsSync, readFileSync, rmSync } from 'node:fs'
31
+ import { homedir } from 'node:os'
32
+ import { dirname, join } from 'node:path'
33
+ import { fileURLToPath } from 'node:url'
34
+
35
+ const repoRoot = dirname(dirname(fileURLToPath(import.meta.url)))
36
+ const profileName = process.argv[2] ?? 'tui'
37
+ const profileDir = join(homedir(), '.dsh', 'profiles', profileName)
38
+
39
+ function run(cmd, args, cwd) {
40
+ console.log(`$ ${cmd} ${args.join(' ')}`)
41
+ execFileSync(cmd, args, { cwd, stdio: 'inherit' })
42
+ }
43
+
44
+ if (!existsSync(join(profileDir, 'package.json'))) {
45
+ console.error(`[dev-install] profile not found: ${profileDir}`)
46
+ process.exit(1)
47
+ }
48
+
49
+ // 1. build
50
+ run('pnpm', ['build'], repoRoot)
51
+
52
+ // 2. pack
53
+ run('pnpm', ['pack'], repoRoot)
54
+ const manifest = JSON.parse(readFileSync(join(repoRoot, 'package.json'), 'utf8'))
55
+ // pnpm packs scoped packages as <scope>-<name>-<version>.tgz (@aiwayds/dsh-tui-pi
56
+ // → aiwayds-dsh-tui-pi-0.2.0.tgz).
57
+ const tarballName = `${manifest.name.replace(/^@/, '').replace('/', '-')}-${manifest.version}.tgz`
58
+ const tarball = join(repoRoot, tarballName)
59
+ if (!existsSync(tarball)) {
60
+ console.error(`[dev-install] tarball not produced: ${tarball}`)
61
+ process.exit(1)
62
+ }
63
+ console.log(`[dev-install] tarball: ${tarball}`)
64
+
65
+ // B3: the profile's file: deps must reference THIS tarball. After a version
66
+ // bump the profile still points at the old <name>-<oldversion>.tgz — installing
67
+ // would silently load the stale package. Fail loudly instead.
68
+ const profileManifest = JSON.parse(readFileSync(join(profileDir, 'package.json'), 'utf8'))
69
+ for (const key of ['dsh-tui-pi', '@aiwayds/dsh-tui-pi']) {
70
+ const ref = profileManifest.dependencies?.[key]
71
+ if (typeof ref !== 'string' || !ref.includes(tarballName)) {
72
+ console.error(
73
+ `[dev-install] profile ${profileName} dependency "${key}" does not reference ${tarballName} ` +
74
+ `(got: ${ref}); update ~/.dsh/profiles/${profileName}/package.json first.`,
75
+ )
76
+ process.exit(1)
77
+ }
78
+ }
79
+
80
+ // 3. refresh the profile's installed copies (remove forces reinstall of the
81
+ // changed file: tarball — pnpm skips re-reading it while the entry exists)
82
+ for (const dir of ['dsh-tui-pi', join('@aiwayds', 'dsh-tui-pi')]) {
83
+ rmSync(join(profileDir, 'node_modules', dir), { recursive: true, force: true })
84
+ }
85
+ run('pnpm', ['install'], profileDir)
86
+
87
+ console.log(`[dev-install] installed into ${profileName} — restart dsh (or /reload) to load the new copy.`)
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Postinstall linker: point every `node_modules/@deepseek-ai/*` entry at the
3
+ * global dsh closure.
4
+ *
5
+ * Why this exists: dsh-tui-pi is a plugin that runs *inside* the installed
6
+ * dsh CLI, and its source imports the `@deepseek-ai/*` packages (cordis,
7
+ * dsh-session, dsh-settings, schemastery, …). Those packages are **not**
8
+ * resolvable from the public npm registry in a usable way (their rc.6
9
+ * versions live only in the dsh install's own node_modules), so the repo
10
+ * resolves them from the *global dsh closure* —
11
+ * `$(realpath $(which dsh))/node_modules/@deepseek-ai` — via plain symlinks.
12
+ *
13
+ * The contract: ALL `@deepseek-ai/*` resolve to that single closure instance,
14
+ * so there is exactly one `@deepseek-ai/cordis` in the type graph. Declaring
15
+ * any of them in package.json made `pnpm install` create a second local copy
16
+ * in `.pnpm`, which broke the cordis `declare module` augmentation
17
+ * (`Property 'settings' does not exist on type 'Context'`), so they must stay
18
+ * *undeclared*. pnpm then treats the closure links as extraneous — and, as
19
+ * it prunes entries it once managed, the links can still disappear after an
20
+ * install. This script re-creates them on every `pnpm install` (postinstall).
21
+ *
22
+ * It is a no-op (exit 0) when no global dsh install is found — a dev machine
23
+ * without dsh simply cannot typecheck against dsh types.
24
+ */
25
+
26
+ import { execFileSync } from 'node:child_process'
27
+ import { existsSync, mkdirSync, readdirSync, realpathSync, rmSync, symlinkSync } from 'node:fs'
28
+ import { dirname, join } from 'node:path'
29
+ import { fileURLToPath } from 'node:url'
30
+
31
+ const repoRoot = dirname(dirname(fileURLToPath(import.meta.url)))
32
+ // Guard: this postinstall is a dev-machine convenience for THIS repo. A
33
+ // published tarball carries scripts/ but no src/, and must never touch a
34
+ // consumer's node_modules (it would delete their @deepseek-ai packages and
35
+ // replace them with symlinks into their global dsh closure). pnpm ≥10 blocks
36
+ // dependency lifecycle scripts by default, but npm would run this — exit
37
+ // silently outside the repo.
38
+ if (!existsSync(join(repoRoot, 'src'))) {
39
+ process.exit(0)
40
+ }
41
+ const scopeDir = join(repoRoot, 'node_modules', '@deepseek-ai')
42
+
43
+ /** The global dsh package's own `node_modules/@deepseek-ai` closure dir. */
44
+ function findDshClosure() {
45
+ // 1) Follow the `dsh` bin — the most faithful pointer to the installed CLI
46
+ // (`/opt/homebrew/bin/dsh` → …/lib/bin.js → pkg dir → its node_modules).
47
+ try {
48
+ const bin = execFileSync('which', ['dsh'], { encoding: 'utf8' }).trim()
49
+ if (bin !== '') {
50
+ const real = realpathSync(bin)
51
+ const closure = join(dirname(dirname(real)), 'node_modules', '@deepseek-ai')
52
+ if (existsSync(join(closure, 'cordis'))) return closure
53
+ }
54
+ } catch { /* dsh not on PATH */ }
55
+ // 2) Fall back to the global node_modules root.
56
+ try {
57
+ const root = execFileSync('npm', ['root', '-g'], { encoding: 'utf8' }).trim()
58
+ const closure = join(root, '@deepseek-ai', 'dsh', 'node_modules', '@deepseek-ai')
59
+ if (existsSync(join(closure, 'cordis'))) return closure
60
+ } catch { /* npm unavailable */ }
61
+ return undefined
62
+ }
63
+
64
+ const closure = findDshClosure()
65
+ if (closure === undefined) {
66
+ console.warn('[link-dsh-closure] global dsh not found — skipping @deepseek-ai links (dev without dsh)')
67
+ process.exit(0)
68
+ }
69
+
70
+ mkdirSync(scopeDir, { recursive: true })
71
+ let linked = 0
72
+ for (const name of readdirSync(closure)) {
73
+ const target = join(scopeDir, name)
74
+ const source = join(closure, name)
75
+ try {
76
+ // Replace any existing entry (stale symlink, or a local .pnpm copy a
77
+ // previous install created) with the closure link.
78
+ rmSync(target, { recursive: true, force: true })
79
+ symlinkSync(source, target, 'junction')
80
+ linked++
81
+ } catch (error) {
82
+ console.warn(`[link-dsh-closure] failed to link ${name}: ${(error instanceof Error ? error.message : String(error))}`)
83
+ }
84
+ }
85
+ console.log(`[link-dsh-closure] linked ${linked} @deepseek-ai/* packages from ${closure}`)