dsh-edge 0.18.0 → 0.19.0-alpha.2
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.i18n.yaml +2 -2
- package/README.md +8 -8
- package/README.zh.md +8 -8
- package/THIRD_PARTY_NOTICES.md +2011 -449
- package/dist/assets/fonts/Montserrat-OFL.txt +93 -0
- package/dist/assets/fonts/montserrat-light-Cvd2VjE_.woff2 +0 -0
- package/dist/assets/fonts/montserrat-medium-B4OyO9CN.woff2 +0 -0
- package/dist/assets/fonts/montserrat-regular-DYep38cA.woff2 +0 -0
- package/dist/assets/index-Cq6ljTv2.css +1 -0
- package/dist/assets/index-Dy0OhsZ5.js +127 -0
- package/dist/assets/langs/asciidoc-Ve4PFQV2.js +2 -0
- package/dist/assets/langs/bat-BkioyH1T.js +2 -0
- package/dist/assets/langs/bibtex-CHM0blh-.js +2 -0
- package/dist/assets/langs/clojure-P80f7IUj.js +2 -0
- package/dist/assets/langs/cmake-D1j8_8rp.js +2 -0
- package/dist/assets/langs/csv-fuZLfV_i.js +2 -0
- package/dist/assets/langs/dart-bE4Kk8sk.js +2 -0
- package/dist/assets/langs/diff-D97Zzqfu.js +2 -0
- package/dist/assets/langs/dotenv-Da5cRb03.js +2 -0
- package/dist/assets/langs/elixir-CvYZzuDY.js +2 -0
- package/dist/assets/langs/erlang-DsQrWhSR.js +2 -0
- package/dist/assets/langs/fish-BvzEVeQv.js +2 -0
- package/dist/assets/langs/fsharp-CXgrBDvD.js +2 -0
- package/dist/assets/langs/graphql-DujV8YkJ.js +2 -0
- package/dist/assets/langs/groovy-gcz8RCvz.js +2 -0
- package/dist/assets/langs/haskell-Df6bDoY_.js +2 -0
- package/dist/assets/langs/hcl-BWvSN4gD.js +2 -0
- package/dist/assets/langs/html-derivative-DOyKdj44.js +2 -0
- package/dist/assets/langs/html-fwsONPVS.js +2 -0
- package/dist/assets/langs/http-DcV90OkR.js +2 -0
- package/dist/assets/langs/javascript-DI5JR1nB.js +2 -0
- package/dist/assets/langs/julia-BpJ6DjL_.js +2 -0
- package/dist/assets/langs/latex-B4C7GdlO.js +2 -0
- package/dist/assets/langs/log-2UxHyX5q.js +2 -0
- package/dist/assets/langs/make-CHLpvVh8.js +2 -0
- package/dist/assets/langs/nix-CwoSXNpI.js +2 -0
- package/dist/assets/langs/perl-DsWkoyyU.js +2 -0
- package/dist/assets/langs/php-LEPfNACG.js +2 -0
- package/dist/assets/langs/powershell-Dpen1YoG.js +2 -0
- package/dist/assets/langs/proto-C7zT0LnQ.js +2 -0
- package/dist/assets/langs/r-Dspwwk_N.js +2 -0
- package/dist/assets/langs/rst-BbocfKWr.js +2 -0
- package/dist/assets/langs/ruby-R292Iif0.js +2 -0
- package/dist/assets/langs/scala-C151Ov-r.js +2 -0
- package/dist/assets/langs/svelte-DNMY6jOf.js +2 -0
- package/dist/assets/langs/system-verilog-CnnmHF94.js +2 -0
- package/dist/assets/langs/vb-D17OF-Vu.js +2 -0
- package/dist/assets/langs/verilog-BQ8w6xss.js +2 -0
- package/dist/assets/langs/vue-Dq2x6432.js +2 -0
- package/dist/favicon-dark.svg +3 -0
- package/dist/favicon.svg +0 -5
- package/dist/index.html +5 -4
- package/dist/manifest.webmanifest +3 -4
- package/dist/plugins/@deepseek-ai/dsh-api-gateway/client.js +353 -101
- package/dist/plugins/@deepseek-ai/dsh-api-job-controller/client.js +367 -0
- package/dist/plugins/@deepseek-ai/dsh-api-remotes/client.js +7223 -3584
- package/dist/plugins/@deepseek-ai/dsh-api-session-controller/client.js +1107 -991
- package/dist/plugins/@deepseek-ai/dsh-api-workspace-controller/client.js +119 -6
- package/dist/plugins/@deepseek-ai/dsh-api-workspace-files/client.js +41 -35
- package/dist/plugins/@deepseek-ai/dsh-client-connection/client.js +354 -5279
- package/dist/plugins/@deepseek-ai/dsh-client-file-upload/client.js +10 -23
- package/dist/plugins/@deepseek-ai/dsh-client-locale/client.js +234 -80
- package/dist/plugins/@deepseek-ai/dsh-client-modules/client.js +554 -46
- package/dist/plugins/@deepseek-ai/dsh-client-shortcuts/client.js +2006 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-agent-preset/client.js +1090 -914
- package/dist/plugins/@deepseek-ai/dsh-client-ui-approval/client.js +79 -6
- package/dist/plugins/@deepseek-ai/dsh-client-ui-attachment/client.js +126 -155
- package/dist/plugins/@deepseek-ai/dsh-client-ui-chat/client.js +5776 -1593
- package/dist/plugins/@deepseek-ai/dsh-client-ui-commands/client.js +375 -121
- package/dist/plugins/@deepseek-ai/dsh-client-ui-conversation/client.js +3524 -1923
- package/dist/plugins/@deepseek-ai/dsh-client-ui-deliverables/client.js +1615 -258
- package/dist/plugins/@deepseek-ai/dsh-client-ui-directory-picker-browse/client.js +9 -9
- package/dist/plugins/@deepseek-ai/dsh-client-ui-goal/client.js +25 -10
- package/dist/plugins/@deepseek-ai/dsh-client-ui-input-trigger/client.js +169 -24
- package/dist/plugins/@deepseek-ai/dsh-client-ui-jobs/client.js +413 -63
- package/dist/plugins/@deepseek-ai/dsh-client-ui-layout/client.js +131 -14
- package/dist/plugins/@deepseek-ai/dsh-client-ui-message-feedback/client.js +24 -22
- package/dist/plugins/@deepseek-ai/dsh-client-ui-model-selection/client.js +281 -128
- package/dist/plugins/@deepseek-ai/dsh-client-ui-open-in-app/client.js +674 -223
- package/dist/plugins/@deepseek-ai/dsh-client-ui-plan/client.js +596 -18
- package/dist/plugins/@deepseek-ai/dsh-client-ui-reference/client.js +92 -9
- package/dist/plugins/@deepseek-ai/dsh-client-ui-renderer/client.js +467 -59
- package/dist/plugins/@deepseek-ai/dsh-client-ui-session/client.js +231 -72
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings/client.js +281 -117
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-general/client.js +642 -122
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-models/client.js +1565 -438
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/client.js +201 -75
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugins/client.js +30 -1628
- package/dist/plugins/@deepseek-ai/dsh-client-ui-shortcuts/client.js +1163 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar/client.js +165 -39
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-browser/client.js +1648 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client.js +5515 -25622
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-files/client.js +419 -118
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-right/client.js +5692 -260
- package/dist/plugins/@deepseek-ai/dsh-client-ui-skill/client.js +156 -41
- package/dist/plugins/@deepseek-ai/dsh-client-ui-subagent/client.js +386 -263
- package/dist/plugins/@deepseek-ai/dsh-client-ui-theme/client.js +183 -73
- package/dist/plugins/@deepseek-ai/dsh-client-ui-tool/client.js +2367 -429
- package/dist/plugins/@deepseek-ai/dsh-client-ui-trajectory/client.js +788 -270
- package/dist/plugins/@deepseek-ai/dsh-client-ui-user-questions/client.js +87 -79
- package/dist/plugins/@deepseek-ai/dsh-client-ui-workflow-run/client.js +28 -14
- package/dist/plugins/@deepseek-ai/dsh-client-ui-workspace/client.js +2647 -1044
- package/dist/plugins/@deepseek-ai/dsh-typert-registry/client.js +22 -7
- package/dist/plugins/dsh-edge-client-ui/client.js +1 -10
- package/package.json +96 -86
- package/scripts/cli.mjs +16 -4
- package/scripts/install.d.mts +12 -2
- package/scripts/install.mjs +36 -9
- package/scripts/legal-files.mjs +15 -0
- package/worker/direct/index.js +2564 -1822
- package/worker/isolated/index.js +2144 -1402
- package/dist/assets/index-BKQ_L1z6.js +0 -117
- package/dist/assets/index-DPX2bQLO.css +0 -1
- package/dist/assets/langs/html-CfGypltT.js +0 -2
- package/dist/assets/langs/php-DJl5gRdb.js +0 -2
- package/dist/assets/langs/ruby-5eNB0pDK.js +0 -2
- package/dist/plugins/@deepseek-ai/dsh-client-ui-permission-presets/client.js +0 -505
- package/dist/plugins/@deepseek-ai/dsh-client-ui-schedule/client.js +0 -307
|
@@ -16,6 +16,7 @@ window.__ModuleLoader__.load({
|
|
|
16
16
|
remote;
|
|
17
17
|
items = [];
|
|
18
18
|
archivedSessionIds = [];
|
|
19
|
+
pinnedSessionIds = [];
|
|
19
20
|
state = "loading";
|
|
20
21
|
phase = "pending";
|
|
21
22
|
error = null;
|
|
@@ -25,6 +26,10 @@ window.__ModuleLoader__.load({
|
|
|
25
26
|
orderFrameGeneration = 0;
|
|
26
27
|
/** Last complete order accepted from a baseline, increment, or current unary echo. */
|
|
27
28
|
committedOrder = [];
|
|
29
|
+
/** Latest archive-set request; a later request or a pushed set supersedes it. */
|
|
30
|
+
archiveRequestSeq = 0;
|
|
31
|
+
/** Latest pin-set request; a later request or a pushed set supersedes it. */
|
|
32
|
+
pinRequestSeq = 0;
|
|
28
33
|
/** Host Workspace ids are never reused, so delayed data cannot resurrect a removed row. */
|
|
29
34
|
removedIds = /* @__PURE__ */ new Set();
|
|
30
35
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -49,6 +54,16 @@ window.__ModuleLoader__.load({
|
|
|
49
54
|
return result;
|
|
50
55
|
}
|
|
51
56
|
/**
|
|
57
|
+
* Initialize the default Workspace and merge its authoritative row.
|
|
58
|
+
* @param signal - caller lifetime.
|
|
59
|
+
* @returns generated Remote result.
|
|
60
|
+
*/
|
|
61
|
+
async initializeDefault(signal) {
|
|
62
|
+
const result = await this.remote.initializeDefault(signal);
|
|
63
|
+
if (result.ok && result.value !== void 0) this.upsert(result.value.workspace);
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
52
67
|
* Rename a Workspace and merge the unary result immediately.
|
|
53
68
|
* @param workspaceId - target Workspace.
|
|
54
69
|
* @param title - new display title.
|
|
@@ -108,12 +123,57 @@ window.__ModuleLoader__.load({
|
|
|
108
123
|
}
|
|
109
124
|
/**
|
|
110
125
|
* Archive one Session and install the returned complete archive set.
|
|
126
|
+
* A reply superseded by a later archive request or a pushed set installs nothing.
|
|
111
127
|
* @param sessionId - Session to archive.
|
|
128
|
+
* @param options - Whether the Host stops the Session's running work instead of refusing.
|
|
129
|
+
* @returns generated Remote result.
|
|
130
|
+
*/
|
|
131
|
+
async archiveSession(sessionId, options = {}) {
|
|
132
|
+
const requestSeq = ++this.archiveRequestSeq;
|
|
133
|
+
const result = await this.remote.archiveSession({
|
|
134
|
+
sessionId,
|
|
135
|
+
...options.stopActivity === true ? { stopActivity: true } : {}
|
|
136
|
+
});
|
|
137
|
+
if (result.ok && requestSeq === this.archiveRequestSeq) {
|
|
138
|
+
this.installArchived(result.value.archivedSessionIds);
|
|
139
|
+
this.installPinned(this.pinnedSessionIds.filter((id) => id !== sessionId));
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Unarchive one Session and install the returned complete archive set.
|
|
145
|
+
* A reply superseded by a later archive request or a pushed set installs nothing.
|
|
146
|
+
* @param sessionId - Session to unarchive.
|
|
147
|
+
* @returns generated Remote result.
|
|
148
|
+
*/
|
|
149
|
+
async unarchiveSession(sessionId) {
|
|
150
|
+
const requestSeq = ++this.archiveRequestSeq;
|
|
151
|
+
const result = await this.remote.unarchiveSession({ sessionId });
|
|
152
|
+
if (result.ok && requestSeq === this.archiveRequestSeq) this.installArchived(result.value.archivedSessionIds);
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Pin one Session and install the returned complete pin set.
|
|
157
|
+
* A reply superseded by a later pin request or a pushed set installs nothing.
|
|
158
|
+
* @param sessionId - Session to pin.
|
|
159
|
+
* @returns generated Remote result.
|
|
160
|
+
*/
|
|
161
|
+
async pinSession(sessionId) {
|
|
162
|
+
const requestSeq = ++this.pinRequestSeq;
|
|
163
|
+
const result = await this.remote.pinSession({ sessionId });
|
|
164
|
+
if (result.ok && requestSeq === this.pinRequestSeq) this.installPinned(result.value.pinnedSessionIds);
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Unpin one Session and install the returned complete pin set.
|
|
169
|
+
* A reply superseded by a later pin request or a pushed set installs nothing.
|
|
170
|
+
* @param sessionId - Session to unpin.
|
|
112
171
|
* @returns generated Remote result.
|
|
113
172
|
*/
|
|
114
|
-
async
|
|
115
|
-
const
|
|
116
|
-
|
|
173
|
+
async unpinSession(sessionId) {
|
|
174
|
+
const requestSeq = ++this.pinRequestSeq;
|
|
175
|
+
const result = await this.remote.unpinSession({ sessionId });
|
|
176
|
+
if (result.ok && requestSeq === this.pinRequestSeq) this.installPinned(result.value.pinnedSessionIds);
|
|
117
177
|
return result;
|
|
118
178
|
}
|
|
119
179
|
/**
|
|
@@ -122,8 +182,11 @@ window.__ModuleLoader__.load({
|
|
|
122
182
|
*/
|
|
123
183
|
replaceBaseline(baseline) {
|
|
124
184
|
this.orderFrameGeneration++;
|
|
185
|
+
this.archiveRequestSeq++;
|
|
186
|
+
this.pinRequestSeq++;
|
|
125
187
|
this.installViews(baseline.items);
|
|
126
188
|
this.installArchived(baseline.archivedSessionIds);
|
|
189
|
+
this.installPinned(baseline.pinnedSessionIds);
|
|
127
190
|
this.state = "idle";
|
|
128
191
|
this.phase = "ready";
|
|
129
192
|
this.error = null;
|
|
@@ -147,8 +210,17 @@ window.__ModuleLoader__.load({
|
|
|
147
210
|
* @param archivedSessionIds - complete Host-confirmed archive set.
|
|
148
211
|
*/
|
|
149
212
|
replaceArchived(archivedSessionIds) {
|
|
213
|
+
this.archiveRequestSeq++;
|
|
150
214
|
this.installArchived(archivedSessionIds);
|
|
151
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Replace the pinned Session set from the current follow generation.
|
|
218
|
+
* @param pinnedSessionIds - complete Host-confirmed pin set, most recently pinned first.
|
|
219
|
+
*/
|
|
220
|
+
replacePinned(pinnedSessionIds) {
|
|
221
|
+
this.pinRequestSeq++;
|
|
222
|
+
this.installPinned(pinnedSessionIds);
|
|
223
|
+
}
|
|
152
224
|
/** Keep the last complete projection visible while a lost carrier reconnects. */
|
|
153
225
|
handleCarrierFailure() {
|
|
154
226
|
this.state = "loading";
|
|
@@ -188,6 +260,7 @@ window.__ModuleLoader__.load({
|
|
|
188
260
|
return {
|
|
189
261
|
items: this.items,
|
|
190
262
|
archivedSessionIds: this.archivedSessionIds,
|
|
263
|
+
pinnedSessionIds: this.pinnedSessionIds,
|
|
191
264
|
state: this.state,
|
|
192
265
|
phase: this.phase,
|
|
193
266
|
error: this.error
|
|
@@ -198,6 +271,11 @@ window.__ModuleLoader__.load({
|
|
|
198
271
|
this.archivedSessionIds = [...archivedSessionIds];
|
|
199
272
|
this.invalidate();
|
|
200
273
|
}
|
|
274
|
+
installPinned(pinnedSessionIds) {
|
|
275
|
+
if (pinnedSessionIds.length === this.pinnedSessionIds.length && pinnedSessionIds.every((id, index) => id === this.pinnedSessionIds[index])) return;
|
|
276
|
+
this.pinnedSessionIds = [...pinnedSessionIds];
|
|
277
|
+
this.invalidate();
|
|
278
|
+
}
|
|
201
279
|
installOrder(workspaceIds, committed = false) {
|
|
202
280
|
if (committed) this.committedOrder = [...workspaceIds];
|
|
203
281
|
const rank = new Map(workspaceIds.map((id, index) => [id, index]));
|
|
@@ -285,6 +363,20 @@ window.__ModuleLoader__.load({
|
|
|
285
363
|
this.rpcError = rpcError;
|
|
286
364
|
}
|
|
287
365
|
};
|
|
366
|
+
/**
|
|
367
|
+
* Archive failed on the Host. `rpcError.code` distinguishes the active-session
|
|
368
|
+
* refusal (`workspace/session-active`, whose details name what still runs)
|
|
369
|
+
* from a missing session or a carrier fault.
|
|
370
|
+
*/
|
|
371
|
+
var WorkspaceArchiveError = class extends Error {
|
|
372
|
+
rpcError;
|
|
373
|
+
name = "WorkspaceArchiveError";
|
|
374
|
+
/** @param rpcError - Host business or folded carrier failure. */
|
|
375
|
+
constructor(rpcError) {
|
|
376
|
+
super(`workspace session archive failed: ${rpcError.code}: ${rpcError.message}`);
|
|
377
|
+
this.rpcError = rpcError;
|
|
378
|
+
}
|
|
379
|
+
};
|
|
288
380
|
/** Owns the bare Workspace snapshot and Workspace-only commands. */
|
|
289
381
|
var WorkspaceController = class extends _deepseek_ai_cordis.Service {
|
|
290
382
|
model;
|
|
@@ -303,6 +395,11 @@ window.__ModuleLoader__.load({
|
|
|
303
395
|
if (!result.ok) throw new WorkspaceCreateError(result.error);
|
|
304
396
|
return result.value.workspace;
|
|
305
397
|
}
|
|
398
|
+
async initializeDefault(signal) {
|
|
399
|
+
const result = await this.model.initializeDefault(signal);
|
|
400
|
+
if (!result.ok) throw new WorkspaceCreateError(result.error);
|
|
401
|
+
return result.value?.workspace;
|
|
402
|
+
}
|
|
306
403
|
async rename(workspaceId, title) {
|
|
307
404
|
const result = await this.model.rename(workspaceId, title);
|
|
308
405
|
if (!result.ok) throw commandError("rename", result.error);
|
|
@@ -316,9 +413,21 @@ window.__ModuleLoader__.load({
|
|
|
316
413
|
const result = await this.model.insertBefore(workspaceId, beforeWorkspaceId);
|
|
317
414
|
if (!result.ok) throw commandError("reorder", result.error);
|
|
318
415
|
}
|
|
319
|
-
async archiveSession(sessionId) {
|
|
320
|
-
const result = await this.model.archiveSession(sessionId);
|
|
321
|
-
if (!result.ok) throw
|
|
416
|
+
async archiveSession(sessionId, options = {}) {
|
|
417
|
+
const result = await this.model.archiveSession(sessionId, options);
|
|
418
|
+
if (!result.ok) throw new WorkspaceArchiveError(result.error);
|
|
419
|
+
}
|
|
420
|
+
async unarchiveSession(sessionId) {
|
|
421
|
+
const result = await this.model.unarchiveSession(sessionId);
|
|
422
|
+
if (!result.ok) throw commandError("session unarchive", result.error);
|
|
423
|
+
}
|
|
424
|
+
async pinSession(sessionId) {
|
|
425
|
+
const result = await this.model.pinSession(sessionId);
|
|
426
|
+
if (!result.ok) throw commandError("session pin", result.error);
|
|
427
|
+
}
|
|
428
|
+
async unpinSession(sessionId) {
|
|
429
|
+
const result = await this.model.unpinSession(sessionId);
|
|
430
|
+
if (!result.ok) throw commandError("session unpin", result.error);
|
|
322
431
|
}
|
|
323
432
|
async insertSessionBefore(workspaceId, sessionId, beforeSessionId) {
|
|
324
433
|
const result = await this.model.insertSessionBefore(workspaceId, sessionId, beforeSessionId);
|
|
@@ -393,6 +502,9 @@ window.__ModuleLoader__.load({
|
|
|
393
502
|
case "archived":
|
|
394
503
|
accept.replaceArchived(frame.archivedSessionIds);
|
|
395
504
|
return;
|
|
505
|
+
case "pinned":
|
|
506
|
+
accept.replacePinned(frame.pinnedSessionIds);
|
|
507
|
+
return;
|
|
396
508
|
/* v8 ignore next -- the generated Remote codec validates this closed union */
|
|
397
509
|
default: return assertNever(frame);
|
|
398
510
|
}
|
|
@@ -403,6 +515,7 @@ window.__ModuleLoader__.load({
|
|
|
403
515
|
}
|
|
404
516
|
//#endregion
|
|
405
517
|
exports.ClientWorkspaceModel = ClientWorkspaceModel;
|
|
518
|
+
exports.WorkspaceArchiveError = WorkspaceArchiveError;
|
|
406
519
|
exports.WorkspaceController = WorkspaceController;
|
|
407
520
|
exports.WorkspaceCreateError = WorkspaceCreateError;
|
|
408
521
|
exports.apply = apply;
|
|
@@ -72,7 +72,7 @@ window.__ModuleLoader__.load({
|
|
|
72
72
|
while (true) {
|
|
73
73
|
const next = this.pending.shift();
|
|
74
74
|
if (next !== void 0) {
|
|
75
|
-
if (this.hostKey === void 0 || next.key === this.hostKey) yield next.notice;
|
|
75
|
+
if (next.notice.kind === "refresh" || this.hostKey === void 0 || next.key === this.hostKey) yield next.notice;
|
|
76
76
|
continue;
|
|
77
77
|
}
|
|
78
78
|
if (this.ended) return;
|
|
@@ -86,26 +86,28 @@ window.__ModuleLoader__.load({
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
/** The stream and followers of one
|
|
89
|
+
/** The stream and followers of one Session and requested path. */
|
|
90
90
|
var SessionFeed = class {
|
|
91
91
|
onClose;
|
|
92
92
|
followers = /* @__PURE__ */ new Set();
|
|
93
93
|
stream;
|
|
94
94
|
closed = false;
|
|
95
95
|
started = false;
|
|
96
|
+
acknowledged = false;
|
|
96
97
|
/**
|
|
97
98
|
* @param remote - the Remote face carrying `workspaceFiles.changes`.
|
|
98
|
-
* @param sessionId - the
|
|
99
|
-
* @param
|
|
99
|
+
* @param sessionId - the Session whose filesystem this feed observes.
|
|
100
|
+
* @param path - target path submitted to the Host.
|
|
101
|
+
* @param after - the previous feed of this target still closing, if any; the stream opens once it has settled.
|
|
100
102
|
* @param onClose - called once when the stream is gone, whatever the cause, with the dispose that is closing it.
|
|
101
103
|
*/
|
|
102
|
-
constructor(remote, sessionId, after, onClose) {
|
|
104
|
+
constructor(remote, sessionId, path, after, onClose) {
|
|
103
105
|
this.onClose = onClose;
|
|
104
106
|
this.stream = remote.$stream({
|
|
105
107
|
name: `workspace file changes of ${sessionId}`,
|
|
106
108
|
open: (signal) => {
|
|
107
109
|
this.started = false;
|
|
108
|
-
return openAfter(after, () => remote.workspaceFiles.changes(sessionId, signal));
|
|
110
|
+
return openAfter(after, () => remote.workspaceFiles.changes(sessionId, path, signal));
|
|
109
111
|
},
|
|
110
112
|
ended: () => /* @__PURE__ */ new Error(`workspace file changes of ${sessionId} ended`)
|
|
111
113
|
});
|
|
@@ -135,7 +137,11 @@ window.__ModuleLoader__.load({
|
|
|
135
137
|
case "ready":
|
|
136
138
|
item.accept();
|
|
137
139
|
this.started = true;
|
|
138
|
-
for (const follower of this.followers)
|
|
140
|
+
for (const follower of this.followers) {
|
|
141
|
+
follower.start();
|
|
142
|
+
if (this.acknowledged) follower.push({ kind: "refresh" }, "");
|
|
143
|
+
}
|
|
144
|
+
this.acknowledged = true;
|
|
139
145
|
break;
|
|
140
146
|
case "change": {
|
|
141
147
|
const key = keyOf(frame.change.absolutePath);
|
|
@@ -184,7 +190,7 @@ window.__ModuleLoader__.load({
|
|
|
184
190
|
throw new Error(`Unexpected workspace file watch frame: ${JSON.stringify(frame)}`);
|
|
185
191
|
}
|
|
186
192
|
/**
|
|
187
|
-
* Per-
|
|
193
|
+
* Per-target sharing of the Host's workspace file change streams.
|
|
188
194
|
*
|
|
189
195
|
* Owned by the provider; one instance serves every session of the Client.
|
|
190
196
|
*/
|
|
@@ -192,7 +198,7 @@ window.__ModuleLoader__.load({
|
|
|
192
198
|
remote;
|
|
193
199
|
/** Live feeds only: a feed removes itself when its stream closes. */
|
|
194
200
|
sessions = /* @__PURE__ */ new Map();
|
|
195
|
-
/** Streams still closing, by
|
|
201
|
+
/** Streams still closing, by Session and path; a successor waits for its predecessor. */
|
|
196
202
|
closing = /* @__PURE__ */ new Map();
|
|
197
203
|
/**
|
|
198
204
|
* @param remote - the Remote face carrying `$stream` and `workspaceFiles.changes`.
|
|
@@ -205,19 +211,20 @@ window.__ModuleLoader__.load({
|
|
|
205
211
|
*
|
|
206
212
|
* The follower is registered on call, not on first pull. Changes delivered
|
|
207
213
|
* to this Client are queued while stat is pending. The first follower starts
|
|
208
|
-
*
|
|
209
|
-
* when `signal` aborts or when the
|
|
214
|
+
* target's local `changes` call. The iterable ends
|
|
215
|
+
* when `signal` aborts or when the target stream is gone; ending it early
|
|
210
216
|
* (`break`, `return`) unregisters the follower as well, and the last follower
|
|
211
|
-
* of a
|
|
217
|
+
* of a target disposes its stream. Await a true `ready` result before stat
|
|
212
218
|
* so the Host subscription is active, then bind each stat's absolute path. Until binding,
|
|
213
|
-
* any
|
|
219
|
+
* any target invalidation can trigger a retry; after binding, only matching queued
|
|
214
220
|
* and live changes pass.
|
|
215
|
-
* @param sessionId - the
|
|
221
|
+
* @param sessionId - the Session providing the file's read authority.
|
|
222
|
+
* @param path - requested file path; followers share a stream only for the same Session and path.
|
|
216
223
|
* @param signal - ends the follow.
|
|
217
224
|
* @returns a single-consumer subscription with Host-path binding and explicit disposal.
|
|
218
225
|
*/
|
|
219
|
-
follow(sessionId, signal) {
|
|
220
|
-
const feed = signal.aborted ? void 0 : this.feedOf(sessionId);
|
|
226
|
+
follow(sessionId, path, signal) {
|
|
227
|
+
const feed = signal.aborted ? void 0 : this.feedOf(sessionId, path);
|
|
221
228
|
const leave = () => {
|
|
222
229
|
signal.removeEventListener("abort", leave);
|
|
223
230
|
follower.end();
|
|
@@ -239,17 +246,18 @@ window.__ModuleLoader__.load({
|
|
|
239
246
|
async settle() {
|
|
240
247
|
await Promise.all(this.closing.values());
|
|
241
248
|
}
|
|
242
|
-
feedOf(sessionId) {
|
|
243
|
-
const
|
|
249
|
+
feedOf(sessionId, path) {
|
|
250
|
+
const key = JSON.stringify([sessionId, path]);
|
|
251
|
+
const existing = this.sessions.get(key);
|
|
244
252
|
if (existing !== void 0) return existing;
|
|
245
|
-
const feed = new SessionFeed(this.remote, sessionId, this.closing.get(
|
|
246
|
-
this.sessions.delete(
|
|
253
|
+
const feed = new SessionFeed(this.remote, sessionId, path, this.closing.get(key), (closed) => {
|
|
254
|
+
this.sessions.delete(key);
|
|
247
255
|
const tracked = closed.then(() => void 0, () => void 0).then(() => {
|
|
248
|
-
if (this.closing.get(
|
|
256
|
+
if (this.closing.get(key) === tracked) this.closing.delete(key);
|
|
249
257
|
});
|
|
250
|
-
this.closing.set(
|
|
258
|
+
this.closing.set(key, tracked);
|
|
251
259
|
});
|
|
252
|
-
this.sessions.set(
|
|
260
|
+
this.sessions.set(key, feed);
|
|
253
261
|
return feed;
|
|
254
262
|
}
|
|
255
263
|
};
|
|
@@ -338,7 +346,7 @@ window.__ModuleLoader__.load({
|
|
|
338
346
|
/**
|
|
339
347
|
* Build the `file` provider over one Remote face and one change feed.
|
|
340
348
|
* @param remote - the Remote face carrying `workspaceFiles.stat`.
|
|
341
|
-
* @param changes -
|
|
349
|
+
* @param changes - target-scoped change streams shared by file resources.
|
|
342
350
|
* @returns the provider to register into `ctx.resources`.
|
|
343
351
|
*/
|
|
344
352
|
function createFileResourceProvider(remote, changes) {
|
|
@@ -351,12 +359,18 @@ window.__ModuleLoader__.load({
|
|
|
351
359
|
return;
|
|
352
360
|
}
|
|
353
361
|
const { sessionId, path } = resolved.value;
|
|
354
|
-
const notices = changes.follow(sessionId, signal);
|
|
362
|
+
const notices = changes.follow(sessionId, path, signal);
|
|
355
363
|
const stat = () => remote.workspaceFiles.stat(sessionId, path, signal);
|
|
356
364
|
const aborted = () => signal.aborted;
|
|
357
365
|
let current;
|
|
358
366
|
try {
|
|
359
|
-
if (!await notices.ready
|
|
367
|
+
if (!await notices.ready) {
|
|
368
|
+
if (aborted()) return;
|
|
369
|
+
const result = await stat();
|
|
370
|
+
if (!aborted()) yield result;
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (aborted()) return;
|
|
360
374
|
const first = await stat();
|
|
361
375
|
if (aborted()) return;
|
|
362
376
|
if (first.ok) {
|
|
@@ -368,19 +382,11 @@ window.__ModuleLoader__.load({
|
|
|
368
382
|
};
|
|
369
383
|
} else yield first;
|
|
370
384
|
for await (const notice of notices) {
|
|
385
|
+
if (aborted()) return;
|
|
371
386
|
if (current === void 0) {
|
|
372
387
|
if (notice.kind === "absent") continue;
|
|
373
388
|
} else if (notice.kind === "changed") {
|
|
374
389
|
if (notice.version === current.version) continue;
|
|
375
|
-
current = {
|
|
376
|
-
...current,
|
|
377
|
-
version: notice.version
|
|
378
|
-
};
|
|
379
|
-
yield {
|
|
380
|
-
ok: true,
|
|
381
|
-
value: current
|
|
382
|
-
};
|
|
383
|
-
continue;
|
|
384
390
|
}
|
|
385
391
|
const again = await stat();
|
|
386
392
|
if (aborted()) return;
|