dsh-remote-vs 0.29.0 → 0.31.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.en.md +53 -20
- package/README.md +41 -19
- package/THIRD-PARTY-NOTICES.md +6 -6
- package/cordis.patch.yml +31 -76
- package/lib/client.js +319 -91
- package/lib/index.js +845 -129
- package/lib/p2-router-fs.js +15 -1
- package/lib/types/changes/recorder.d.ts +65 -10
- package/lib/types/changes/status.d.ts +48 -3
- package/lib/types/client/ConnectionsSection.d.ts +73 -0
- package/lib/types/client/WorkspacesView.d.ts +2 -0
- package/lib/types/client/api.d.ts +41 -2
- package/lib/types/client/composer.d.ts +8 -1
- package/lib/types/client/scm/actions.d.ts +25 -1
- package/lib/types/client/selection-popup.d.ts +1 -1
- package/lib/types/client/ui.d.ts +7 -4
- package/lib/types/p2/helper-rpc.d.ts +48 -0
- package/lib/types/p2/router-fs.d.ts +9 -1
- package/lib/types/p2/worlds.d.ts +51 -0
- package/lib/types/pool.d.ts +245 -10
- package/lib/types/protocol.d.ts +96 -0
- package/lib/{worlds-RG8K5eom.js → worlds-BdxLeKul.js} +134 -7
- package/package.json +46 -46
- package/src/changes/recorder.ts +151 -15
- package/src/changes/status.ts +59 -4
- package/src/client/ConnectionsSection.tsx +359 -0
- package/src/client/DirectoryFlow.tsx +8 -0
- package/src/client/EditorPane.tsx +5 -1
- package/src/client/HostsView.tsx +2 -0
- package/src/client/MonitorView.tsx +14 -0
- package/src/client/RemoteExplorer.tsx +11 -2
- package/src/client/RemoteRoot.tsx +1 -0
- package/src/client/SettingsHosts.tsx +1 -0
- package/src/client/WorkspaceWizard.tsx +1 -0
- package/src/client/WorkspacesView.tsx +21 -1
- package/src/client/api.ts +72 -4
- package/src/client/composer.ts +8 -1
- package/src/client/i18n.ts +50 -2
- package/src/client/scm/DiffView.tsx +5 -2
- package/src/client/scm/actions.ts +63 -12
- package/src/client/selection-popup.ts +1 -1
- package/src/client/ui.tsx +9 -7
- package/src/client/vsc/vsc.css +231 -3
- package/src/index.ts +31 -0
- package/src/p2/helper-rpc.ts +73 -5
- package/src/p2/router-fs.ts +29 -1
- package/src/p2/worlds.ts +116 -1
- package/src/pool.ts +736 -111
- package/src/protocol.ts +100 -0
- package/src/routes.ts +85 -13
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.3-alpha.3-linux-x64.helper.json +20 -0
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.3-alpha.3-linux-x64.tar.gz +4 -0
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.3-alpha.3-linux-x64.tar.gz.sha256 +1 -0
- package/vendor/dsh-remote-helpers/pkg-sea-bare-import.patch +30 -0
- package/vendor/dsh-remote-helpers/ssh-helper-runtime-deps.patch +4 -3
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.2-rc.4-linux-x64.helper.json +0 -19
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.2-rc.4-linux-x64.tar.gz +0 -4
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.2-rc.4-linux-x64.tar.gz.sha256 +0 -1
|
@@ -19245,6 +19245,17 @@ var RpcConnection = class {
|
|
|
19245
19245
|
* grow host memory.
|
|
19246
19246
|
*/
|
|
19247
19247
|
stderrTail = "";
|
|
19248
|
+
/**
|
|
19249
|
+
* Teardown of the ROUTED transport this attempt rides (proxy socket / jump-host
|
|
19250
|
+
* tunnel), or undefined for a direct dial.
|
|
19251
|
+
*
|
|
19252
|
+
* It lives on the instance because the release has to outlive the handshake: the
|
|
19253
|
+
* tunnel must stay open exactly as long as the SSH connection rides it, so the
|
|
19254
|
+
* call belongs in `teardownTransport` (dispose, reconnect, failed open) rather
|
|
19255
|
+
* than in the dial promise. The pool's release is idempotent, so calling it from
|
|
19256
|
+
* a failure path AND from the teardown is safe.
|
|
19257
|
+
*/
|
|
19258
|
+
releaseRoute;
|
|
19248
19259
|
/** Per-connection in-flight cap; see MAX_IN_FLIGHT. */
|
|
19249
19260
|
gate = new InFlightGate(MAX_IN_FLIGHT);
|
|
19250
19261
|
constructor(opts) {
|
|
@@ -19258,6 +19269,17 @@ var RpcConnection = class {
|
|
|
19258
19269
|
get diagnostics() {
|
|
19259
19270
|
return this.stderrTail.trim();
|
|
19260
19271
|
}
|
|
19272
|
+
/**
|
|
19273
|
+
* How many helper calls are in flight right now.
|
|
19274
|
+
*
|
|
19275
|
+
* Read-only diagnostics for the monitor: the helper caps itself at its own
|
|
19276
|
+
* gate, so a saturated helper shows up as a number here instead of looking
|
|
19277
|
+
* like an idle connection. It is NOT a queue — a call waits inside the gate
|
|
19278
|
+
* before it counts, so this number never exceeds the gate's ceiling.
|
|
19279
|
+
*/
|
|
19280
|
+
get inFlight() {
|
|
19281
|
+
return this.gate.inFlight;
|
|
19282
|
+
}
|
|
19261
19283
|
get ready() {
|
|
19262
19284
|
if (this.readyPromise === void 0) this.readyPromise = this.open();
|
|
19263
19285
|
return this.readyPromise;
|
|
@@ -19358,9 +19380,12 @@ var RpcConnection = class {
|
|
|
19358
19380
|
this.channel = void 0;
|
|
19359
19381
|
this.conn = void 0;
|
|
19360
19382
|
this.stderrTail = "";
|
|
19383
|
+
const release = this.releaseRoute;
|
|
19384
|
+
this.releaseRoute = void 0;
|
|
19385
|
+
release?.();
|
|
19361
19386
|
}
|
|
19362
19387
|
async open() {
|
|
19363
|
-
const conn = new import_lib.Client();
|
|
19388
|
+
const conn = this.opts.makeClient?.() ?? new import_lib.Client();
|
|
19364
19389
|
this.conn = conn;
|
|
19365
19390
|
try {
|
|
19366
19391
|
const hello = await this.dialAndHello(conn);
|
|
@@ -19378,6 +19403,19 @@ var RpcConnection = class {
|
|
|
19378
19403
|
async dialAndHello(conn) {
|
|
19379
19404
|
const { entry } = this.opts;
|
|
19380
19405
|
const generation = this.generation;
|
|
19406
|
+
/**
|
|
19407
|
+
* The route the HOST resolves for this alias — a proxy tunnel socket or a
|
|
19408
|
+
* jump-host channel — or nothing for a direct connection. It is acquired
|
|
19409
|
+
* BEFORE the handshake so a route failure surfaces as itself (`proxy auth
|
|
19410
|
+
* failed: …` / `jump host "x" failed: …`) instead of as a mysterious
|
|
19411
|
+
* connection timeout.
|
|
19412
|
+
*
|
|
19413
|
+
* The release is stashed for `teardownTransport`, which runs on every way this
|
|
19414
|
+
* attempt can end (ready-then-lost, failed open, reconnect, dispose). If the
|
|
19415
|
+
* acquisition itself throws there is nothing to release.
|
|
19416
|
+
*/
|
|
19417
|
+
const routed = this.opts.openSocket === void 0 ? void 0 : await this.opts.openSocket();
|
|
19418
|
+
if (routed !== void 0) this.releaseRoute = routed.release;
|
|
19381
19419
|
await new Promise((resolve, reject) => {
|
|
19382
19420
|
let settled = false;
|
|
19383
19421
|
conn.on("ready", () => {
|
|
@@ -19400,9 +19438,12 @@ var RpcConnection = class {
|
|
|
19400
19438
|
if (generation === this.generation) this.invalidate(/* @__PURE__ */ new Error("ssh connection closed"));
|
|
19401
19439
|
});
|
|
19402
19440
|
try {
|
|
19403
|
-
|
|
19441
|
+
const transport = routed?.sock === void 0 ? {
|
|
19404
19442
|
host: entry.host,
|
|
19405
|
-
port: entry.port
|
|
19443
|
+
port: entry.port
|
|
19444
|
+
} : { sock: routed.sock };
|
|
19445
|
+
if (entry.auth.kind === "key") conn.connect({
|
|
19446
|
+
...transport,
|
|
19406
19447
|
username: entry.user,
|
|
19407
19448
|
privateKey: readFileSync(entry.auth.keyPath),
|
|
19408
19449
|
passphrase: entry.auth.passphrase,
|
|
@@ -19411,8 +19452,7 @@ var RpcConnection = class {
|
|
|
19411
19452
|
keepaliveCountMax: 3
|
|
19412
19453
|
});
|
|
19413
19454
|
else conn.connect({
|
|
19414
|
-
|
|
19415
|
-
port: entry.port,
|
|
19455
|
+
...transport,
|
|
19416
19456
|
username: entry.user,
|
|
19417
19457
|
password: entry.auth.password,
|
|
19418
19458
|
readyTimeout: CONNECT_READY_TIMEOUT_MS,
|
|
@@ -19608,7 +19648,24 @@ var RemoteWorlds = class {
|
|
|
19608
19648
|
ctx;
|
|
19609
19649
|
deps;
|
|
19610
19650
|
rpcs = /* @__PURE__ */ new Map();
|
|
19651
|
+
/**
|
|
19652
|
+
* Aliases whose helper connection is still being dialed.
|
|
19653
|
+
*
|
|
19654
|
+
* `rpcs` holds the PROMISE, so a caller that awaits it waits for the whole
|
|
19655
|
+
* dial (up to `CONNECT_READY_TIMEOUT_MS`, 45 s through a proxy or a jump host).
|
|
19656
|
+
* The monitor polls `helperLane` every few seconds and must never inherit that
|
|
19657
|
+
* wait — the route is read-only and would report the previous sample for the
|
|
19658
|
+
* whole dial, or hold the client's single-flight guard. A name in this set is
|
|
19659
|
+
* therefore "cannot say yet", which the client already renders as no row.
|
|
19660
|
+
*/
|
|
19661
|
+
dialingRpc = /* @__PURE__ */ new Map();
|
|
19611
19662
|
fsViews = /* @__PURE__ */ new Map();
|
|
19663
|
+
/**
|
|
19664
|
+
* Native Workspace registration id -> alias dir, refreshed by every
|
|
19665
|
+
* `syncWorkspaces()`. DSH reports a sidebar workspace deletion by its own id,
|
|
19666
|
+
* which carries no path, so this is the only way back to the binding.
|
|
19667
|
+
*/
|
|
19668
|
+
nativeWorkspaces = /* @__PURE__ */ new Map();
|
|
19612
19669
|
fsReady = /* @__PURE__ */ new Map();
|
|
19613
19670
|
procs = /* @__PURE__ */ new Map();
|
|
19614
19671
|
/** Consecutive dial failures per alias; while the cooldown is set, no dial is attempted. */
|
|
@@ -19784,6 +19841,7 @@ var RemoteWorlds = class {
|
|
|
19784
19841
|
*/
|
|
19785
19842
|
toSessionPath(route, remoteAbsPath) {
|
|
19786
19843
|
if (!this.underRemoteBase(route, remoteAbsPath)) return remoteAbsPath;
|
|
19844
|
+
if (remoteAbsPath === this.remoteRoot(route)) return route.aliasPath;
|
|
19787
19845
|
let routed;
|
|
19788
19846
|
try {
|
|
19789
19847
|
routed = this.routeDir(remoteAbsPath);
|
|
@@ -19793,9 +19851,14 @@ var RemoteWorlds = class {
|
|
|
19793
19851
|
if (routed.kind === "remote" && routed.id === route.id) return remoteAbsPath;
|
|
19794
19852
|
return this.toAliasPath(route, remoteAbsPath);
|
|
19795
19853
|
}
|
|
19854
|
+
/** One binding's remote root, without a trailing slash (except `/` itself). */
|
|
19855
|
+
remoteRoot(route) {
|
|
19856
|
+
const root = route.remotePath;
|
|
19857
|
+
return root.endsWith("/") && root !== "/" ? root.slice(0, -1) : root;
|
|
19858
|
+
}
|
|
19796
19859
|
/** Inverse of {@link toRemotePath}: the alias spelling of a remote path. */
|
|
19797
19860
|
toAliasPath(route, remoteAbsPath) {
|
|
19798
|
-
const base =
|
|
19861
|
+
const base = this.remoteRoot(route);
|
|
19799
19862
|
if (!this.containsRemote(base, remoteAbsPath)) return remoteAbsPath;
|
|
19800
19863
|
if (remoteAbsPath === base) return route.aliasPath;
|
|
19801
19864
|
const rel = remoteAbsPath.slice(base === "/" ? 1 : base.length + 1);
|
|
@@ -19871,6 +19934,42 @@ var RemoteWorlds = class {
|
|
|
19871
19934
|
} catch {}
|
|
19872
19935
|
}
|
|
19873
19936
|
}
|
|
19937
|
+
this.nativeWorkspaces.clear();
|
|
19938
|
+
if (registry === void 0 || typeof registry.list !== "function") return;
|
|
19939
|
+
let registered;
|
|
19940
|
+
try {
|
|
19941
|
+
registered = registry.list();
|
|
19942
|
+
} catch {
|
|
19943
|
+
return;
|
|
19944
|
+
}
|
|
19945
|
+
for (const workspace of registered) try {
|
|
19946
|
+
if (!this.contains(aliasRoot(), workspace.path)) continue;
|
|
19947
|
+
this.nativeWorkspaces.set(String(workspace.id), workspace.path);
|
|
19948
|
+
} catch {}
|
|
19949
|
+
}
|
|
19950
|
+
/**
|
|
19951
|
+
* A native Workspace under the alias root was deleted by the user (DSH's own
|
|
19952
|
+
* sidebar): its binding follows — unbind + tombstone.
|
|
19953
|
+
*
|
|
19954
|
+
* The reverse direction is deliberately NOT symmetric: unbinding from this
|
|
19955
|
+
* plugin keeps the native Workspace record (the user asked for exactly that —
|
|
19956
|
+
* the workspace stays listed and only a fail-closed tombstone is added), while
|
|
19957
|
+
* deleting the Workspace in DSH's sidebar is the user removing it outright, so
|
|
19958
|
+
* the binding that named it goes with it. Without this, a deleted native
|
|
19959
|
+
* workspace left a binding routing into an alias dir nobody can reach.
|
|
19960
|
+
*
|
|
19961
|
+
* @param nativeId - DSH's Workspace registration id.
|
|
19962
|
+
* @returns the binding id that was removed, when one matched.
|
|
19963
|
+
*/
|
|
19964
|
+
forgetNativeWorkspace(nativeId) {
|
|
19965
|
+
const path = this.nativeWorkspaces.get(nativeId);
|
|
19966
|
+
if (path === void 0) return void 0;
|
|
19967
|
+
this.nativeWorkspaces.delete(nativeId);
|
|
19968
|
+
if (!this.contains(aliasRoot(), path)) return void 0;
|
|
19969
|
+
const basename = path.replace(/[\\/]+$/u, "").split(/[\\/]/u).pop() ?? "";
|
|
19970
|
+
if (basename === "") return void 0;
|
|
19971
|
+
if (!this.deps.store.listWorkspaces().some((binding) => binding.id === basename)) return void 0;
|
|
19972
|
+
return this.deps.store.removeWorkspace(basename) ? basename : void 0;
|
|
19874
19973
|
}
|
|
19875
19974
|
/** Remote $HOME for one host alias (deploy record, else one probe). */
|
|
19876
19975
|
async homeFor(alias) {
|
|
@@ -19904,6 +20003,30 @@ var RemoteWorlds = class {
|
|
|
19904
20003
|
const result = await this.deps.pool.exec(alias, spillDirSweepCommand(dir, ttlDays), { timeoutMs: 2e4 });
|
|
19905
20004
|
if (!result.success) throw new Error(`remote spill dir sweep failed: ${result.stderr || result.error || `exit ${result.exitCode}`}`);
|
|
19906
20005
|
}
|
|
20006
|
+
/**
|
|
20007
|
+
* The helper connection of one alias, for the monitor's fifth lane.
|
|
20008
|
+
*
|
|
20009
|
+
* The helper dials its OWN SSH connection (see `RpcConnection`), so the pool
|
|
20010
|
+
* cannot report it — this is the only place that knows. Read-only by
|
|
20011
|
+
* contract: it awaits a record that already exists and never starts a dial, a
|
|
20012
|
+
* deploy or a reconnect, because the monitor polls this every few seconds and
|
|
20013
|
+
* a diagnostic must not be able to bring a helper up (or keep a dead one
|
|
20014
|
+
* alive). `undefined` means "cannot say": no record, a record still dialing, or
|
|
20015
|
+
* a record the router is about to replace — the client then omits the row
|
|
20016
|
+
* rather than claiming the helper is closed.
|
|
20017
|
+
*/
|
|
20018
|
+
async helperLane(alias) {
|
|
20019
|
+
if (this.dialingRpc.has(alias)) return void 0;
|
|
20020
|
+
const pending = this.rpcs.get(alias);
|
|
20021
|
+
if (pending === void 0) return void 0;
|
|
20022
|
+
const conn = await pending.catch(() => void 0);
|
|
20023
|
+
if (conn === void 0 || !conn.alive) return void 0;
|
|
20024
|
+
return {
|
|
20025
|
+
open: true,
|
|
20026
|
+
channels: 1,
|
|
20027
|
+
held: conn.inFlight
|
|
20028
|
+
};
|
|
20029
|
+
}
|
|
19907
20030
|
/** Drop one host's RPC + fs view + proc runtime (call after host update/delete). */
|
|
19908
20031
|
async dropHost(alias) {
|
|
19909
20032
|
this.fsReady.delete(alias);
|
|
@@ -20041,9 +20164,12 @@ var RemoteWorlds = class {
|
|
|
20041
20164
|
if (pending === void 0) {
|
|
20042
20165
|
pending = this.createRpc(alias);
|
|
20043
20166
|
this.rpcs.set(alias, pending);
|
|
20167
|
+
this.dialingRpc.set(alias, pending);
|
|
20044
20168
|
pending.then(() => {
|
|
20169
|
+
if (this.dialingRpc.get(alias) === pending) this.dialingRpc.delete(alias);
|
|
20045
20170
|
this.dialFailures.delete(alias);
|
|
20046
20171
|
}, (error) => {
|
|
20172
|
+
if (this.dialingRpc.get(alias) === pending) this.dialingRpc.delete(alias);
|
|
20047
20173
|
if (this.rpcs.get(alias) === pending) this.rpcs.delete(alias);
|
|
20048
20174
|
this.noteDialFailure(alias, error);
|
|
20049
20175
|
});
|
|
@@ -20119,7 +20245,8 @@ var RemoteWorlds = class {
|
|
|
20119
20245
|
helperPath,
|
|
20120
20246
|
helperHash: helper.sha256,
|
|
20121
20247
|
workspace: home,
|
|
20122
|
-
leaseMs: 6e4
|
|
20248
|
+
leaseMs: 6e4,
|
|
20249
|
+
openSocket: () => this.deps.pool.openRoutedSocket(alias)
|
|
20123
20250
|
});
|
|
20124
20251
|
try {
|
|
20125
20252
|
await conn.ready;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-remote-vs",
|
|
3
3
|
"description": "VSCode-style remote development for DSH: SSH host manager (key/password), helper deploy pipeline with version check, remote file explorer + editor + terminal in dsh-better-sidebar.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.31.0",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"dsh",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"./locale/*.json": "./locale/*.json"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
|
-
"dsh": ">=0.2.
|
|
62
|
+
"dsh": ">=0.2.3-alpha.3 <0.3.0"
|
|
63
63
|
},
|
|
64
64
|
"dsh": {
|
|
65
65
|
"bundle": {
|
|
@@ -121,9 +121,9 @@
|
|
|
121
121
|
"@codemirror/search": "6.5.11",
|
|
122
122
|
"@codemirror/state": "^6.7.6",
|
|
123
123
|
"@codemirror/view": "^6.43.14",
|
|
124
|
-
"@deepseek-ai/dsh-fs-ssh": "0.2.
|
|
125
|
-
"@deepseek-ai/dsh-ssh": "0.2.
|
|
126
|
-
"@deepseek-ai/schemastery": "3.
|
|
124
|
+
"@deepseek-ai/dsh-fs-ssh": "0.2.3-alpha.3",
|
|
125
|
+
"@deepseek-ai/dsh-ssh": "0.2.3-alpha.3",
|
|
126
|
+
"@deepseek-ai/schemastery": "3.20.0-alpha.2",
|
|
127
127
|
"@lezer/highlight": "1.2.3",
|
|
128
128
|
"@xterm/addon-fit": "^0.11.0",
|
|
129
129
|
"@xterm/xterm": "^6.0.0",
|
|
@@ -131,53 +131,53 @@
|
|
|
131
131
|
"zod": "4.6.6"
|
|
132
132
|
},
|
|
133
133
|
"peerDependencies": {
|
|
134
|
-
"@deepseek-ai/cordis": "^4.
|
|
135
|
-
"@deepseek-ai/dsh-agent-preset": "^0.2.
|
|
136
|
-
"@deepseek-ai/dsh-bash-local": "^0.2.
|
|
137
|
-
"@deepseek-ai/dsh-file-reference": "^0.2.
|
|
138
|
-
"@deepseek-ai/dsh-fs": "^0.2.
|
|
139
|
-
"@deepseek-ai/dsh-shell": "^0.2.
|
|
140
|
-
"@deepseek-ai/dsh-spill": "^0.2.
|
|
141
|
-
"@deepseek-ai/dsh-subprocess": "^0.2.
|
|
142
|
-
"@deepseek-ai/dsh-tools": "^0.2.
|
|
143
|
-
"react": "^
|
|
144
|
-
"react-dom": "^
|
|
134
|
+
"@deepseek-ai/cordis": "^4.2.0-alpha.2",
|
|
135
|
+
"@deepseek-ai/dsh-agent-preset": "^0.2.3-alpha.3",
|
|
136
|
+
"@deepseek-ai/dsh-bash-local": "^0.2.3-alpha.3",
|
|
137
|
+
"@deepseek-ai/dsh-file-reference": "^0.2.3-alpha.3",
|
|
138
|
+
"@deepseek-ai/dsh-fs": "^0.2.3-alpha.3",
|
|
139
|
+
"@deepseek-ai/dsh-shell": "^0.2.3-alpha.3",
|
|
140
|
+
"@deepseek-ai/dsh-spill": "^0.2.3-alpha.3",
|
|
141
|
+
"@deepseek-ai/dsh-subprocess": "^0.2.3-alpha.3",
|
|
142
|
+
"@deepseek-ai/dsh-tools": "^0.2.3-alpha.3",
|
|
143
|
+
"react": "^19.3.1",
|
|
144
|
+
"react-dom": "^19.3.1"
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": {
|
|
147
|
-
"@deepseek-ai/cordis": "^4.
|
|
148
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
149
|
-
"@deepseek-ai/dsh-agent-preset-registry": "0.2.
|
|
150
|
-
"@deepseek-ai/dsh-api-remotes": "0.2.
|
|
151
|
-
"@deepseek-ai/dsh-bash-local": "0.2.
|
|
152
|
-
"@deepseek-ai/dsh-client-locale": "0.2.
|
|
153
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.2.
|
|
154
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.2.
|
|
155
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.2.
|
|
156
|
-
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.
|
|
157
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.2.
|
|
158
|
-
"@deepseek-ai/dsh-client-ui-workspace": "0.2.
|
|
159
|
-
"@deepseek-ai/dsh-file-reference": "0.2.
|
|
160
|
-
"@deepseek-ai/dsh-fs": "0.2.
|
|
161
|
-
"@deepseek-ai/dsh-host-directory-picker": "0.2.
|
|
162
|
-
"@deepseek-ai/dsh-host-webserver": "0.2.
|
|
163
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
164
|
-
"@deepseek-ai/dsh-sandbox": "0.2.
|
|
165
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
166
|
-
"@deepseek-ai/dsh-shell": "0.2.
|
|
167
|
-
"@deepseek-ai/dsh-spill": "0.2.
|
|
168
|
-
"@deepseek-ai/dsh-subprocess": "0.2.
|
|
169
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
170
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
171
|
-
"@deepseek-ai/dsh-working-directory": "0.2.
|
|
172
|
-
"@deepseek-ai/dsh-workspace": "0.2.
|
|
147
|
+
"@deepseek-ai/cordis": "^4.2.0-alpha.2",
|
|
148
|
+
"@deepseek-ai/dsh-agent": "0.2.3-alpha.3",
|
|
149
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.3-alpha.3",
|
|
150
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.3-alpha.3",
|
|
151
|
+
"@deepseek-ai/dsh-bash-local": "0.2.3-alpha.3",
|
|
152
|
+
"@deepseek-ai/dsh-client-locale": "0.2.3-alpha.3",
|
|
153
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.3-alpha.3",
|
|
154
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.3-alpha.3",
|
|
155
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.3-alpha.3",
|
|
156
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.3-alpha.3",
|
|
157
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.3-alpha.3",
|
|
158
|
+
"@deepseek-ai/dsh-client-ui-workspace": "0.2.3-alpha.3",
|
|
159
|
+
"@deepseek-ai/dsh-file-reference": "0.2.3-alpha.3",
|
|
160
|
+
"@deepseek-ai/dsh-fs": "0.2.3-alpha.3",
|
|
161
|
+
"@deepseek-ai/dsh-host-directory-picker": "0.2.3-alpha.3",
|
|
162
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.3-alpha.3",
|
|
163
|
+
"@deepseek-ai/dsh-llm": "0.2.3-alpha.3",
|
|
164
|
+
"@deepseek-ai/dsh-sandbox": "0.2.3-alpha.3",
|
|
165
|
+
"@deepseek-ai/dsh-session": "0.2.3-alpha.3",
|
|
166
|
+
"@deepseek-ai/dsh-shell": "0.2.3-alpha.3",
|
|
167
|
+
"@deepseek-ai/dsh-spill": "0.2.3-alpha.3",
|
|
168
|
+
"@deepseek-ai/dsh-subprocess": "0.2.3-alpha.3",
|
|
169
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.3-alpha.3",
|
|
170
|
+
"@deepseek-ai/dsh-tools": "0.2.3-alpha.3",
|
|
171
|
+
"@deepseek-ai/dsh-working-directory": "0.2.3-alpha.3",
|
|
172
|
+
"@deepseek-ai/dsh-workspace": "0.2.3-alpha.3",
|
|
173
173
|
"@types/node": "^22.20.0",
|
|
174
|
-
"@types/react": "~
|
|
175
|
-
"@types/react-dom": "
|
|
174
|
+
"@types/react": "~19.3.3",
|
|
175
|
+
"@types/react-dom": "~19.3.0",
|
|
176
176
|
"@types/ssh2": "^1.15.5",
|
|
177
177
|
"@types/ws": "^8.5.13",
|
|
178
178
|
"jsdom": "^30.1.2",
|
|
179
|
-
"react": "^
|
|
180
|
-
"react-dom": "^
|
|
179
|
+
"react": "^19.3.1",
|
|
180
|
+
"react-dom": "^19.3.1",
|
|
181
181
|
"ssh2": "^1.17.0",
|
|
182
182
|
"tsdown": "0.22.2",
|
|
183
183
|
"typescript": "~5.7.2"
|
package/src/changes/recorder.ts
CHANGED
|
@@ -41,6 +41,7 @@ import type { RemotePool } from '../pool.ts'
|
|
|
41
41
|
import type { RemoteWorlds, WorldRoute } from '../p2/worlds.ts'
|
|
42
42
|
import {
|
|
43
43
|
excludeDirNames,
|
|
44
|
+
isUntrackedDirectoryPath,
|
|
44
45
|
parseReads,
|
|
45
46
|
parseStatusZ,
|
|
46
47
|
parseUntrackedZ,
|
|
@@ -50,12 +51,26 @@ import {
|
|
|
50
51
|
trackedStatusCommand,
|
|
51
52
|
UNTRACKED_EXCLUDED_DIRECTORIES,
|
|
52
53
|
untrackedCommand,
|
|
54
|
+
untrackedExpandCommand,
|
|
53
55
|
type ChangeStatus,
|
|
54
56
|
type ReadResult,
|
|
55
57
|
type StatusEntry,
|
|
56
58
|
} from './status.ts'
|
|
57
59
|
import { diffText, filePatch, hunkPatch, type TextHunk } from './text-diff.ts'
|
|
58
60
|
|
|
61
|
+
/**
|
|
62
|
+
* How many collapsed directories one untracked scan will expand.
|
|
63
|
+
*
|
|
64
|
+
* The fast walk (`--directory`) answers in one command no matter how many
|
|
65
|
+
* untracked directories there are; expanding each one is another `git ls-files`
|
|
66
|
+
* on the SAME shared connection, so the count has to be bounded. Twenty is the
|
|
67
|
+
* budget that keeps a normal monorepo complete (a session creates a handful of
|
|
68
|
+
* directories) while a checkout full of un-ignored build output stops early and
|
|
69
|
+
* says so (`truncated`), instead of turning one background scan into hundreds of
|
|
70
|
+
* exec channels.
|
|
71
|
+
*/
|
|
72
|
+
export const UNTRACKED_EXPAND_DIRS = 20
|
|
73
|
+
|
|
59
74
|
/** The two facts a turn boundary needs from a Session, kept cordis-free. */
|
|
60
75
|
export interface LedgerTarget {
|
|
61
76
|
sessionId: string
|
|
@@ -362,6 +377,16 @@ interface Ledger {
|
|
|
362
377
|
tracked: StatusEntry[]
|
|
363
378
|
/** Latest untracked scan; undefined until the first one lands. */
|
|
364
379
|
untracked: StatusEntry[] | undefined
|
|
380
|
+
/**
|
|
381
|
+
* The latest untracked list is INCOMPLETE on purpose.
|
|
382
|
+
*
|
|
383
|
+
* Set when the expansion of `--directory` entries hit its bounds — more
|
|
384
|
+
* directories than {@link UNTRACKED_EXPAND_DIRS}, the file cap, the scan's
|
|
385
|
+
* deadline, or a failed expansion. Folded into the published `truncated` flag
|
|
386
|
+
* so the panel says "the list is short" instead of presenting a bounded answer
|
|
387
|
+
* as the whole truth.
|
|
388
|
+
*/
|
|
389
|
+
untrackedTruncated: boolean
|
|
365
390
|
/** When the last untracked scan STARTED, for the cadence. */
|
|
366
391
|
untrackedAt: number
|
|
367
392
|
/** How long the last completed untracked scan took, for the cadence. */
|
|
@@ -964,6 +989,7 @@ export class SessionChanges {
|
|
|
964
989
|
ledger.adoptedSubdir = false
|
|
965
990
|
ledger.tracked = []
|
|
966
991
|
ledger.untracked = undefined
|
|
992
|
+
ledger.untrackedTruncated = false
|
|
967
993
|
ledger.untrackedAt = 0
|
|
968
994
|
ledger.untrackedMs = undefined
|
|
969
995
|
// The self-heal window describes THIS tree's scan cost; another root may be
|
|
@@ -1069,6 +1095,7 @@ export class SessionChanges {
|
|
|
1069
1095
|
subdir: '',
|
|
1070
1096
|
tracked: [],
|
|
1071
1097
|
untracked: undefined,
|
|
1098
|
+
untrackedTruncated: false,
|
|
1072
1099
|
untrackedAt: 0,
|
|
1073
1100
|
untrackedMs: undefined,
|
|
1074
1101
|
scanMs: undefined,
|
|
@@ -1172,7 +1199,11 @@ export class SessionChanges {
|
|
|
1172
1199
|
const entries = [...merged.values()].sort((left, right) => left.path.localeCompare(right.path))
|
|
1173
1200
|
const cap = this.deps.maxFiles ?? 500
|
|
1174
1201
|
const listed = entries.slice(0, cap)
|
|
1175
|
-
|
|
1202
|
+
// The untracked list can be short for a reason of its own: its expansion phase
|
|
1203
|
+
// is bounded (`UNTRACKED_EXPAND_DIRS`/cap/deadline). Reporting that as
|
|
1204
|
+
// `truncated` keeps the panel honest — a bounded answer presented as complete
|
|
1205
|
+
// would read as "the session created nothing else".
|
|
1206
|
+
const truncated = entries.length > cap || ledger.untrackedTruncated
|
|
1176
1207
|
|
|
1177
1208
|
if (!ledger.baselineTaken) {
|
|
1178
1209
|
// First observation: everything dirty RIGHT NOW predates this ledger, so
|
|
@@ -1769,6 +1800,11 @@ export class SessionChanges {
|
|
|
1769
1800
|
* runs twice at once, and only runs again after {@link untrackedCadence}. A
|
|
1770
1801
|
* repository that cannot answer inside {@link untrackedBudget} is written off
|
|
1771
1802
|
* for the session (`untrackedGivenUp`) rather than retried every turn.
|
|
1803
|
+
*
|
|
1804
|
+
* Two phases since the scan learned `--directory`: one fast walk that collapses
|
|
1805
|
+
* untracked directories (`build/` instead of 3000 paths) and then a BOUNDED
|
|
1806
|
+
* expansion of the collapsed entries, because the panel's contract is a list of
|
|
1807
|
+
* FILES. A walk that already answered with files expands nothing at all.
|
|
1772
1808
|
*/
|
|
1773
1809
|
private async kickUntracked(ledger: Ledger): Promise<void> {
|
|
1774
1810
|
if (ledger.disposed || ledger.untrackedGivenUp || ledger.untrackedJob !== undefined) return
|
|
@@ -1778,14 +1814,23 @@ export class SessionChanges {
|
|
|
1778
1814
|
// merge the previous tree's names into the new one.
|
|
1779
1815
|
const root = ledger.root
|
|
1780
1816
|
ledger.untrackedAt = Date.now()
|
|
1817
|
+
// One deadline for BOTH phases: the bound that matters is how long this scan
|
|
1818
|
+
// holds an exec channel on the shared connection, not how long one command of
|
|
1819
|
+
// it takes.
|
|
1820
|
+
const deadline = ledger.untrackedAt + this.untrackedBudget()
|
|
1781
1821
|
const job = (async () => {
|
|
1782
1822
|
const started = Date.now()
|
|
1783
|
-
const
|
|
1784
|
-
ledger.
|
|
1823
|
+
const excluded = this.excludedDirs()
|
|
1824
|
+
const scan = await this.run(ledger.alias, untrackedCommand(root, excluded), Math.max(1, deadline - Date.now()))
|
|
1785
1825
|
if (ledger.disposed) return
|
|
1786
1826
|
if (ledger.root !== root) return
|
|
1787
1827
|
if (!scan.ok) {
|
|
1828
|
+
ledger.untrackedMs = Date.now() - started
|
|
1788
1829
|
ledger.untrackedGivenUp = true
|
|
1830
|
+
// A walk that failed says nothing about HOW COMPLETE the previous one
|
|
1831
|
+
// was: leaving the old verdict behind would keep the panel claiming a
|
|
1832
|
+
// partial list it can no longer justify.
|
|
1833
|
+
ledger.untrackedTruncated = false
|
|
1789
1834
|
// Keep WHY: the panel can show it, and its absence would make a dead
|
|
1790
1835
|
// capability look like "this session created no files".
|
|
1791
1836
|
ledger.untrackedFailure = scan.reason
|
|
@@ -1793,7 +1838,14 @@ export class SessionChanges {
|
|
|
1793
1838
|
return
|
|
1794
1839
|
}
|
|
1795
1840
|
ledger.untrackedFailure = undefined
|
|
1796
|
-
|
|
1841
|
+
const expanded = await this.expandUntracked(ledger, root, parseUntrackedZ(scan.stdout), excluded, deadline)
|
|
1842
|
+
if (ledger.disposed) return
|
|
1843
|
+
if (ledger.root !== root) return
|
|
1844
|
+
// The cadence backs off on what the scan COSTS, and both phases are that
|
|
1845
|
+
// cost — a fast walk followed by twenty expansions is not a 0.2s scan.
|
|
1846
|
+
ledger.untrackedMs = Date.now() - started
|
|
1847
|
+
ledger.untracked = expanded.entries
|
|
1848
|
+
ledger.untrackedTruncated = expanded.truncated
|
|
1797
1849
|
await this.absorbPreExisting(ledger)
|
|
1798
1850
|
// A completed scan is worth one more publish: it is the only source of
|
|
1799
1851
|
// "a file appeared" rows — and of the per-turn delta that must include
|
|
@@ -1805,6 +1857,75 @@ export class SessionChanges {
|
|
|
1805
1857
|
ledger.untrackedJob = job
|
|
1806
1858
|
}
|
|
1807
1859
|
|
|
1860
|
+
/**
|
|
1861
|
+
* Turn the fast walk's collapsed directories back into files, within bounds.
|
|
1862
|
+
*
|
|
1863
|
+
* Bounded THREE ways, because every expansion is another `git ls-files` on the
|
|
1864
|
+
* same shared connection and the scan runs in the background where nobody is
|
|
1865
|
+
* watching:
|
|
1866
|
+
*
|
|
1867
|
+
* - at most {@link UNTRACKED_EXPAND_DIRS} directories, sorted first so the
|
|
1868
|
+
* choice is deterministic (a rescan of an unchanged tree expands the same
|
|
1869
|
+
* ones, and the gate can pin exactly which);
|
|
1870
|
+
* - the same file cap the panel lists (`maxFiles`, 500 by default), so one
|
|
1871
|
+
* huge directory cannot push the list past what is displayable;
|
|
1872
|
+
* - the fast walk's own deadline: when it runs out the phase stops.
|
|
1873
|
+
*
|
|
1874
|
+
* Hitting any of them — or an expansion that fails — marks the result
|
|
1875
|
+
* `truncated` instead of returning a short list silently. A failed expansion is
|
|
1876
|
+
* NOT `untrackedGivenUp`: the fast walk answered, so new-file detection still
|
|
1877
|
+
* works; only part of it is missing.
|
|
1878
|
+
*
|
|
1879
|
+
* @returns the file entries (walk files + expanded ones) and whether the list
|
|
1880
|
+
* is incomplete.
|
|
1881
|
+
*/
|
|
1882
|
+
private async expandUntracked(
|
|
1883
|
+
ledger: Ledger,
|
|
1884
|
+
root: string,
|
|
1885
|
+
walked: readonly StatusEntry[],
|
|
1886
|
+
excludeDirs: readonly string[],
|
|
1887
|
+
deadline: number,
|
|
1888
|
+
): Promise<{ entries: StatusEntry[]; truncated: boolean }> {
|
|
1889
|
+
const entries = walked.filter(entry => !isUntrackedDirectoryPath(entry.path))
|
|
1890
|
+
const dirs = walked
|
|
1891
|
+
.filter(entry => isUntrackedDirectoryPath(entry.path))
|
|
1892
|
+
.map(entry => entry.path.replace(/\/+$/, ''))
|
|
1893
|
+
.filter(path => path !== '')
|
|
1894
|
+
.sort()
|
|
1895
|
+
// Nothing collapsed (no untracked directory at all): the walk's answer IS the
|
|
1896
|
+
// answer, and this costs zero extra commands.
|
|
1897
|
+
if (dirs.length === 0) return { entries, truncated: false }
|
|
1898
|
+
|
|
1899
|
+
// ONE command for every directory (see `untrackedExpandCommand`): a directory
|
|
1900
|
+
// that only holds ignored or nothing at all then costs nothing, and cannot
|
|
1901
|
+
// push a real directory out of the budget below.
|
|
1902
|
+
const cap = this.deps.maxFiles ?? 500
|
|
1903
|
+
let truncated = dirs.length > UNTRACKED_EXPAND_DIRS
|
|
1904
|
+
const pending = dirs.slice(0, UNTRACKED_EXPAND_DIRS)
|
|
1905
|
+
const remaining = deadline - Date.now()
|
|
1906
|
+
if (remaining <= 0) {
|
|
1907
|
+
this.warn(`untracked expansion ran out of its budget before asking about ${pending.length} directories`)
|
|
1908
|
+
return { entries, truncated: true }
|
|
1909
|
+
}
|
|
1910
|
+
const result = await this.run(ledger.alias, untrackedExpandCommand(root, pending, excludeDirs), remaining)
|
|
1911
|
+
if (ledger.disposed || ledger.root !== root) return { entries, truncated: true }
|
|
1912
|
+
if (!result.ok) {
|
|
1913
|
+
this.warn(`expanding ${pending.length} untracked directories failed (${result.reason}); new files under them are not listed`)
|
|
1914
|
+
return { entries, truncated: true }
|
|
1915
|
+
}
|
|
1916
|
+
const seen = new Set(entries.map(entry => entry.path))
|
|
1917
|
+
for (const entry of parseUntrackedZ(result.stdout)) {
|
|
1918
|
+
if (seen.has(entry.path)) continue
|
|
1919
|
+
seen.add(entry.path)
|
|
1920
|
+
entries.push(entry)
|
|
1921
|
+
if (entries.length >= cap) {
|
|
1922
|
+
truncated = true
|
|
1923
|
+
break
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
return { entries, truncated }
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1808
1929
|
/**
|
|
1809
1930
|
* How long before the untracked scan may run again.
|
|
1810
1931
|
*
|
|
@@ -1908,12 +2029,22 @@ export class SessionChanges {
|
|
|
1908
2029
|
return parseReads(result.stdout)
|
|
1909
2030
|
}
|
|
1910
2031
|
|
|
1911
|
-
/**
|
|
2032
|
+
/**
|
|
2033
|
+
* Run one command on the host, normalizing failure into a reason string.
|
|
2034
|
+
*
|
|
2035
|
+
* Every command this ledger issues is a git command (a repository read: `git
|
|
2036
|
+
* status`, the untracked walk, its expansion, the file-content reads — the
|
|
2037
|
+
* recorder never mutates). So they all spend the host's git-command budget
|
|
2038
|
+
* (`lane: 'git'`) instead of a shared exec slot: these scans run in the HOST
|
|
2039
|
+
* process while the user is working, and a 300-second `git status` must not be
|
|
2040
|
+
* the reason a monitor sample, the process panel or an agent tool answers
|
|
2041
|
+
* "host is busy".
|
|
2042
|
+
*/
|
|
1912
2043
|
private async run(alias: string, command: string, budget = this.execBudget()): Promise<
|
|
1913
2044
|
{ ok: true; stdout: string } | { ok: false; reason: string; code?: number | null }
|
|
1914
2045
|
> {
|
|
1915
2046
|
try {
|
|
1916
|
-
const call = this.deps.pool.exec(alias, command, { timeoutMs: budget })
|
|
2047
|
+
const call = this.deps.pool.exec(alias, command, { timeoutMs: budget, lane: 'git' })
|
|
1917
2048
|
const result = await this.withWatchdog(call, budget + Math.min(WATCHDOG_GRACE_MS, budget))
|
|
1918
2049
|
if (result === WATCHDOG_FIRED) {
|
|
1919
2050
|
// The host call never came back. Measured: `git ls-files --others` on a
|
|
@@ -1948,19 +2079,24 @@ export class SessionChanges {
|
|
|
1948
2079
|
return this.budget(this.deps.timeouts().gitMs, 5_000, 60_000)
|
|
1949
2080
|
}
|
|
1950
2081
|
|
|
1951
|
-
/** The untracked scan gets its own, more generous budget. */
|
|
1952
2082
|
/**
|
|
1953
|
-
* The untracked scan gets its own,
|
|
2083
|
+
* The untracked scan gets its own, more generous budget — one minute.
|
|
2084
|
+
*
|
|
2085
|
+
* The walk is proportional to the whole checkout, not to the session, so it
|
|
2086
|
+
* cannot use the ordinary git budget. It used to be three minutes; that ceiling
|
|
2087
|
+
* was set before the scan learned `--directory`, when a monorepo's answer really
|
|
2088
|
+
* could take that long. Now the fast walk collapses whole directories, so a
|
|
2089
|
+
* minute is already several times the useful wait, and every second past it is
|
|
2090
|
+
* spent holding an exec channel on the SHARED connection while the tree is
|
|
2091
|
+
* still being walked for nothing. Past a minute the honest answer is "this host
|
|
2092
|
+
* cannot enumerate new files quickly enough" — `untrackedFailure` says so and the
|
|
2093
|
+
* panel offers a retry, which is the same contract as before, just cut shorter.
|
|
1954
2094
|
*
|
|
1955
|
-
*
|
|
1956
|
-
*
|
|
1957
|
-
* been measured past a minute cold. Waiting is acceptable here because the
|
|
1958
|
-
* scan runs in the background and the tracked changes are already on screen;
|
|
1959
|
-
* giving up early is not, because the files a session creates with a shell
|
|
1960
|
-
* command are visible ONLY through this scan.
|
|
2095
|
+
* The floor (10s) is untouched: a small repository must never be cut off by a
|
|
2096
|
+
* tiny configured `gitMs`.
|
|
1961
2097
|
*/
|
|
1962
2098
|
private untrackedBudget(): number {
|
|
1963
|
-
return this.deps.untrackedBudgetMs ?? this.budget(this.deps.timeouts().gitMs, 10_000,
|
|
2099
|
+
return this.deps.untrackedBudgetMs ?? this.budget(this.deps.timeouts().gitMs, 10_000, 60_000)
|
|
1964
2100
|
}
|
|
1965
2101
|
|
|
1966
2102
|
/**
|