@deepseek-insight/dsi 0.6.2 → 0.6.4
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/bin/dsi.mjs +69 -9
- package/build/client/_app/immutable/assets/{2.D6PL9MJd.css → 2.BGqV97Jd.css} +1 -1
- package/build/client/_app/immutable/chunks/BwKqFYD7.js +1 -0
- package/build/client/_app/immutable/chunks/CAYtjzEm.js +1 -0
- package/build/client/_app/immutable/chunks/{Cy_g8G-H.js → CdhRVZei.js} +2 -2
- package/build/client/_app/immutable/chunks/{D1QINeUi.js → ifNG6R2V.js} +1 -1
- package/build/client/_app/immutable/entry/{app.CXE1IG8X.js → app.BZxw5dG4.js} +2 -2
- package/build/client/_app/immutable/entry/start.Dokd35UA.js +1 -0
- package/build/client/_app/immutable/nodes/{1.BNp3xTdo.js → 1.DDxq2YPY.js} +1 -1
- package/build/client/_app/immutable/nodes/{2.C9PI6lyi.js → 2.BtlOjw8Q.js} +104 -104
- package/build/client/_app/version.json +1 -1
- package/build/handler.js +4 -4
- package/build/index.js +4 -4
- package/build/server/chunks/chunks/{dsh-events.js-CyvSb4O3.js → dsh-events.js-D9tSYE7f.js} +3 -1
- package/build/server/chunks/chunks/{git-probe.js-dOJ4Z5Hb.js → git-probe.js-D_H3YQbR.js} +2 -2
- package/build/server/chunks/chunks/{internal.js-DsUajvrO.js → internal.js-BzzxrDDl.js} +2 -2
- package/build/server/chunks/chunks/{state.js-BtreSUn6.js → state.js-BTxzeSxQ.js} +2 -2
- package/build/server/chunks/chunks/{watcher.js-bCH9-ZiR.js → watcher.js-DU-MZGLU.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/a2a/{_server.ts.js-CqAXkMAm.js → _server.ts.js-BvEDeAhP.js} +3 -3
- package/build/server/chunks/entries/endpoints/api/a2a/register/{_server.ts.js-FBi0PplP.js → _server.ts.js-DLJ4sQBq.js} +3 -3
- package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/events/{_server.ts.js-CYZUxBob.js → _server.ts.js-vydjdEkJ.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/history/{_server.ts.js-DGGCIii3.js → _server.ts.js-SchAEll8.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/workspace/file-write/{_server.ts.js-BIOHsnn2.js → _server.ts.js-BmEUPTSa.js} +3 -3
- package/build/server/chunks/entries/endpoints/api/workspace/git-events/{_server.ts.js-BLfn9ZtS.js → _server.ts.js-_1uYvYEA.js} +3 -3
- package/build/server/chunks/entries/endpoints/api/workspace/git-file-head/{_server.ts.js-p-potXo3.js → _server.ts.js-DaXO3et9.js} +3 -3
- package/build/server/chunks/entries/endpoints/api/workspace/git-map/{_server.ts.js-DYFs7MEO.js → _server.ts.js-hp85iKSu.js} +3 -3
- package/build/server/chunks/entries/endpoints/api/workspace/git-status/{_server.ts.js-BB2bcMwC.js → _server.ts.js-CPB-9252.js} +3 -3
- package/build/server/chunks/entries/endpoints/api/workspace/write-gate/{_server.ts.js-DFnO84k1.js → _server.ts.js-DKqzSQBE.js} +3 -3
- package/build/server/chunks/entries/pages/{_error.svelte.js-D6O3Y5u2.js → _error.svelte.js-D3waDB7P.js} +3 -3
- package/build/server/chunks/entries/pages/{_page.server.ts.js-Cqf2xfOc.js → _page.server.ts.js-DTjoTdYK.js} +2 -2
- package/build/server/chunks/entries/pages/{_page.svelte.js-KMQA_6l7.js → _page.svelte.js-CsfYmlsX.js} +75 -5
- package/build/server/chunks/{handler-DDf2L-zB.js → handler-B6-GSygl.js} +3 -3
- package/build/server/chunks/{index.js-BAmbTnM5.js → index.js-CnMCjYHC.js} +2 -2
- package/build/server/chunks/{manifest.js-0LY0s8-F.js → manifest.js-0V3eqw-_.js} +14 -14
- package/build/server/chunks/nodes/1.js-HaE4A25V.js +9 -0
- package/build/server/chunks/nodes/{2.js-BPtjg-62.js → 2.js-BJORAo_U.js} +6 -6
- package/package.json +2 -2
- package/build/client/_app/immutable/chunks/B9TIQpmf.js +0 -1
- package/build/client/_app/immutable/chunks/BBAtuGck.js +0 -1
- package/build/client/_app/immutable/entry/start.CsK-Qb0T.js +0 -1
- package/build/server/chunks/nodes/1.js-COCS1z-W.js +0 -9
package/bin/dsi.mjs
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
import { spawn, spawnSync } from 'node:child_process';
|
|
22
22
|
import net from 'node:net';
|
|
23
|
-
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
23
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFileSync } from 'node:fs';
|
|
24
24
|
import { homedir } from 'node:os';
|
|
25
25
|
import path from 'node:path';
|
|
26
26
|
import { fileURLToPath } from 'node:url';
|
|
@@ -69,7 +69,10 @@ const USAGE = [
|
|
|
69
69
|
'',
|
|
70
70
|
' Ports: `dsi dsh --sync` serves the DSI page on 5174 and opens your',
|
|
71
71
|
' browser there. With --dev the Vite dev server takes 5175 instead',
|
|
72
|
-
' and the browser follows. Override with PORT=<n>.',
|
|
72
|
+
' and the browser follows. Override with PORT=<n>. The HOST half',
|
|
73
|
+
' takes 3080 by default; when that port is held by a dsh web you',
|
|
74
|
+
' must keep running (another conversation floor), forward',
|
|
75
|
+
' --port <n> — it goes to `dsh web` and DSI follows it automatically.',
|
|
73
76
|
'',
|
|
74
77
|
' All commands (flags — see above):',
|
|
75
78
|
'',
|
|
@@ -156,6 +159,11 @@ function isRecord(value) {
|
|
|
156
159
|
const ORPHAN_PATTERNS = [
|
|
157
160
|
'dsh-web-synced.sh',
|
|
158
161
|
'@deepseek-ai/dsh/lib/bin.js',
|
|
162
|
+
// The npx-published launch's REAL argv shape (observed 2026-11-06:
|
|
163
|
+
// `node …/_npx/<hash>/node_modules/.bin/dsh web`) — the published
|
|
164
|
+
// package's own .bin shim, which neither lib/bin.js nor the npx shims
|
|
165
|
+
// pattern above matches.
|
|
166
|
+
'_npx/[^/]*/node_modules/.bin/dsh',
|
|
159
167
|
'apps/cli/src/bin.ts web',
|
|
160
168
|
'deepseek-insight/build/index.js',
|
|
161
169
|
// --dev mode's UI half (scoped to the DSI checkout's vite, never a
|
|
@@ -370,16 +378,24 @@ async function runSyncedPair(extraArgs, dev = false) {
|
|
|
370
378
|
// takes 5175 instead (vite.config.ts pins 5174 strictPort, so pair mode
|
|
371
379
|
// passes 5175 explicitly), giving the two-port dev shape.
|
|
372
380
|
const uiPort = process.env.PORT ?? (dev ? '5175' : '5174');
|
|
381
|
+
// The host half takes --port <n> when forwarded (a 3080 held by a
|
|
382
|
+
// dsh web this CLI does not own — e.g. another live conversation
|
|
383
|
+
// floor — is exactly the case the preflight must not kill). The
|
|
384
|
+
// forwarded flag goes to `dsh web` untouched; DSI follows via
|
|
385
|
+
// DSH_BASE_URL so the page dials the host wherever it landed.
|
|
386
|
+
warnIfFirstRunDownload();
|
|
387
|
+
const hostPort = hostPortFromArgs(extraArgs) ?? 3080;
|
|
388
|
+
const dshBase = hostPort === 3080 ? undefined : `http://127.0.0.1:${hostPort}`;
|
|
373
389
|
// Preflight BOTH halves: a forgotten previous run holds not just the
|
|
374
|
-
// host
|
|
390
|
+
// host port but often the UI port too — the host would only crash
|
|
375
391
|
// later, and the UI server would crash first with EADDRINUSE.
|
|
376
|
-
await preflightPort(
|
|
392
|
+
await preflightPort(hostPort, 'dsh host');
|
|
377
393
|
await preflightPort(uiPort, 'DSI page');
|
|
378
394
|
const host = spawn('/bin/sh', [script, ...extraArgs], {
|
|
379
395
|
stdio: 'inherit',
|
|
380
396
|
env: { ...process.env, DSH_WEB_VERSION: dshWebVersion() }
|
|
381
397
|
});
|
|
382
|
-
const ui = dev ? startDsiDevServer(uiPort) : startDsiServer(uiPort);
|
|
398
|
+
const ui = dev ? startDsiDevServer(uiPort, dshBase) : startDsiServer(uiPort, dshBase);
|
|
383
399
|
// The browser follows the UI: the built page (5174) — or, in --dev mode,
|
|
384
400
|
// the dev server (5175).
|
|
385
401
|
openBrowser(`http://localhost:${uiPort}/`);
|
|
@@ -557,7 +573,7 @@ function runSkillsMirror() {
|
|
|
557
573
|
* sources and devDependencies exist — a published tarball (bin + build)
|
|
558
574
|
* refuses loudly instead of half-booting. The --port CLI flag overrides the
|
|
559
575
|
* config's server.port while strictPort keeps the fail-loud contract. */
|
|
560
|
-
function startDsiDevServer(defaultPort = '5175') {
|
|
576
|
+
function startDsiDevServer(defaultPort = '5175', dshBase = undefined) {
|
|
561
577
|
const viteBin = path.join(packageRoot, 'node_modules', 'vite', 'bin', 'vite.js');
|
|
562
578
|
if (!existsSync(viteBin)) {
|
|
563
579
|
console.error(`dsi dsh --dev: no vite at ${viteBin} — --dev needs a full DSI checkout (pnpm install); use the built server instead`);
|
|
@@ -575,12 +591,13 @@ function startDsiDevServer(defaultPort = '5175') {
|
|
|
575
591
|
// Dev-floor marker (RCA 2026-09-27): the plugin-rack bounce reads
|
|
576
592
|
// this from the API server's env to re-serve --dev instead of the
|
|
577
593
|
// stale build. Nothing else may set it.
|
|
578
|
-
DSI_DEV: '1'
|
|
594
|
+
DSI_DEV: '1',
|
|
595
|
+
...(dshBase !== undefined ? { DSH_BASE_URL: dshBase } : {})
|
|
579
596
|
}
|
|
580
597
|
});
|
|
581
598
|
}
|
|
582
599
|
|
|
583
|
-
function startDsiServer(defaultPort = '5174') {
|
|
600
|
+
function startDsiServer(defaultPort = '5174', dshBase = undefined) {
|
|
584
601
|
const serverEntry = path.join(packageRoot, 'build', 'index.js');
|
|
585
602
|
if (!existsSync(serverEntry)) {
|
|
586
603
|
console.error(`dsi: no build found at ${serverEntry} — run \`pnpm run build\` first`);
|
|
@@ -594,11 +611,54 @@ function startDsiServer(defaultPort = '5174') {
|
|
|
594
611
|
HOST: process.env.HOST ?? '127.0.0.1',
|
|
595
612
|
// First-start bootstrap seam: the server clones template/.dsi to ~/.dsi
|
|
596
613
|
// when the operator home is absent (src/lib/server/settings-document.ts).
|
|
597
|
-
DSI_TEMPLATE_PATH: process.env.DSI_TEMPLATE_PATH ?? path.join(packageRoot, 'template', '.dsi')
|
|
614
|
+
DSI_TEMPLATE_PATH: process.env.DSI_TEMPLATE_PATH ?? path.join(packageRoot, 'template', '.dsi'),
|
|
615
|
+
...(dshBase !== undefined ? { DSH_BASE_URL: dshBase } : {})
|
|
598
616
|
}
|
|
599
617
|
});
|
|
600
618
|
}
|
|
601
619
|
|
|
620
|
+
/** True when @deepseek-ai/dsh@version already sits in an npx cache —
|
|
621
|
+
* the probe scans the same cache layout npm exec populates
|
|
622
|
+
* (the _npx cache dirs npm exec populates). */
|
|
623
|
+
function dshPackageCached(version) {
|
|
624
|
+
const npxCache = path.join(process.env.npm_config_cache ?? path.join(homedir(), '.npm'), '_npx');
|
|
625
|
+
if (!existsSync(npxCache)) return true; // no cache dir — skip the guess, stay quiet
|
|
626
|
+
try {
|
|
627
|
+
for (const entry of readdirSync(npxCache)) {
|
|
628
|
+
const manifest = path.join(npxCache, entry, 'node_modules', '@deepseek-ai', 'dsh', 'package.json');
|
|
629
|
+
if (existsSync(manifest) && JSON.parse(readFileSync(manifest, 'utf-8')).version === version) return true;
|
|
630
|
+
}
|
|
631
|
+
} catch {
|
|
632
|
+
// unreadable cache — stay quiet rather than warn on a guess
|
|
633
|
+
}
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/** The silent-minutes bug (2026-11-06): piped through the token watcher,
|
|
638
|
+
* npm exec suppresses its download progress entirely, so a FIRST run of a
|
|
639
|
+
* new pinned dsh installs for minutes with zero output while the DSI half
|
|
640
|
+
* is already serving a floor whose every /api call fails. This heads-up
|
|
641
|
+
* fires before the host spawns, only when the pin is NOT yet cached. */
|
|
642
|
+
function warnIfFirstRunDownload() {
|
|
643
|
+
if (process.env.DSH_WEB_CMD !== undefined) return;
|
|
644
|
+
// The env override (same one dsh-web-synced.sh honors) wins over the pin.
|
|
645
|
+
const version = process.env.DSH_WEB_VERSION ?? dshWebVersion();
|
|
646
|
+
if (dshPackageCached(version)) return;
|
|
647
|
+
console.log(`dsi dsh: fetching @deepseek-ai/dsh@${version} — first run for this pin, the download can take a few minutes; the DSI page may open before the host answers, just refresh once it prints its URL`);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/** The host port a forwarded --port <n> (or --port=<n>) names, else null.
|
|
651
|
+
* Only the LAST occurrence wins — the same value `dsh web` would resolve. */
|
|
652
|
+
function hostPortFromArgs(args) {
|
|
653
|
+
let port = null;
|
|
654
|
+
for (let i = 0; i < args.length; i++) {
|
|
655
|
+
if (args[i] === '--port' && /^\d+$/.test(args[i + 1] ?? '')) port = Number(args[i + 1]);
|
|
656
|
+
const eq = /^--port=(\d+)$/.exec(args[i] ?? '');
|
|
657
|
+
if (eq) port = Number(eq[1]);
|
|
658
|
+
}
|
|
659
|
+
return port;
|
|
660
|
+
}
|
|
661
|
+
|
|
602
662
|
// The web command ends the script — and MUST fall off here, not dsh's:
|
|
603
663
|
// before this guard existed, `dsi dsh --sync` fell through to the web
|
|
604
664
|
// launcher below and spawned a SECOND build server on the same 5174 the
|