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
|
@@ -8,19 +8,79 @@ window.__ModuleLoader__.load({
|
|
|
8
8
|
let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
|
|
9
9
|
let _deepseek_ai_dsh_client_ui_slots = require("@deepseek-ai/dsh-client-ui-slots");
|
|
10
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
-
|
|
11
|
+
//#region ../../util/values/src/index.ts
|
|
12
|
+
/**
|
|
13
|
+
* Weak-key lookup with a strongly retained iterable set of associated values.
|
|
14
|
+
*
|
|
15
|
+
* Each value must belong to only one key. The container performs no automatic
|
|
16
|
+
* cleanup; owners delete associations or clear the container at lifecycle end.
|
|
17
|
+
*/
|
|
18
|
+
var WeakMapWithValues = class {
|
|
19
|
+
keys = /* @__PURE__ */ new WeakMap();
|
|
20
|
+
valueSet = /* @__PURE__ */ new Set();
|
|
21
|
+
/** Live strongly retained values in insertion order. */
|
|
22
|
+
values = this.valueSet;
|
|
23
|
+
/**
|
|
24
|
+
* Read the value associated with a key.
|
|
25
|
+
* @param key - weakly held lookup key.
|
|
26
|
+
* @returns the associated value, or absence.
|
|
27
|
+
*/
|
|
28
|
+
get(key) {
|
|
29
|
+
return this.keys.get(key);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Test whether a key has an association.
|
|
33
|
+
* @param key - weakly held lookup key.
|
|
34
|
+
* @returns whether the key is present.
|
|
35
|
+
*/
|
|
36
|
+
has(key) {
|
|
37
|
+
return this.keys.has(key);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Associate one key with one caller-unique value.
|
|
41
|
+
* @param key - weakly held lookup key.
|
|
42
|
+
* @param value - strongly retained value that belongs to no other key.
|
|
43
|
+
* @returns this container.
|
|
44
|
+
*/
|
|
45
|
+
set(key, value) {
|
|
46
|
+
if (this.keys.has(key)) {
|
|
47
|
+
const previous = this.keys.get(key);
|
|
48
|
+
if (previous === value) return this;
|
|
49
|
+
this.valueSet.delete(previous);
|
|
50
|
+
}
|
|
51
|
+
this.keys.set(key, value);
|
|
52
|
+
this.valueSet.add(value);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Remove one association and its strongly retained value.
|
|
57
|
+
* @param key - weakly held lookup key.
|
|
58
|
+
* @returns whether an association was removed.
|
|
59
|
+
*/
|
|
60
|
+
delete(key) {
|
|
61
|
+
if (!this.keys.has(key)) return false;
|
|
62
|
+
const value = this.keys.get(key);
|
|
63
|
+
const deleted = this.keys.delete(key);
|
|
64
|
+
this.valueSet.delete(value);
|
|
65
|
+
return deleted;
|
|
66
|
+
}
|
|
67
|
+
/** Remove every association and strongly retained value. */
|
|
68
|
+
clear() {
|
|
69
|
+
this.keys = /* @__PURE__ */ new WeakMap();
|
|
70
|
+
this.valueSet.clear();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
12
74
|
//#region lib/types/client/session-provider.js
|
|
13
|
-
/** Session-owned rendering semantics for the standard SessionProvider seat. */
|
|
14
75
|
/**
|
|
15
76
|
* Render the selected Session body or its empty branch.
|
|
16
77
|
* @param binding - current Session scope binding.
|
|
17
78
|
* @param props - standard Session area render props.
|
|
18
|
-
* @returns the selected Session subtree
|
|
79
|
+
* @returns the selected Session subtree.
|
|
19
80
|
*/
|
|
20
81
|
function renderSessionArea(binding, { empty, children }) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return (0, react_jsx_runtime.jsx)(react.Fragment, { children }, sessionId);
|
|
82
|
+
if (binding.key === void 0) return (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: empty?.() ?? null });
|
|
83
|
+
return (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
24
84
|
}
|
|
25
85
|
//#endregion
|
|
26
86
|
//#region lib/types/client/index.js
|
|
@@ -72,20 +132,25 @@ window.__ModuleLoader__.load({
|
|
|
72
132
|
var UiSession = class extends _deepseek_ai_cordis.Service {
|
|
73
133
|
sessions;
|
|
74
134
|
descriptors = [BUILTIN_SOURCE];
|
|
75
|
-
bindings =
|
|
135
|
+
bindings = new WeakMapWithValues();
|
|
76
136
|
absent;
|
|
77
|
-
|
|
78
|
-
currentListeners = /* @__PURE__ */ new Set();
|
|
137
|
+
current;
|
|
79
138
|
pendingDomains = [];
|
|
80
139
|
pendingSnapshot = /* @__PURE__ */ new Map();
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
140
|
+
running = /* @__PURE__ */ new Map();
|
|
141
|
+
completionUnread = /* @__PURE__ */ new Set();
|
|
142
|
+
statusSnapshot = /* @__PURE__ */ new Map();
|
|
143
|
+
statusListeners = /* @__PURE__ */ new Set();
|
|
144
|
+
mainRetainId;
|
|
145
|
+
disposeMainRetain = () => {};
|
|
146
|
+
active = true;
|
|
147
|
+
/** Root source combining running, pending-interaction, and completion-reminder facts. */
|
|
148
|
+
sessionStatus = {
|
|
149
|
+
getSnapshot: () => this.statusSnapshot,
|
|
85
150
|
subscribe: (listener) => {
|
|
86
|
-
this.
|
|
151
|
+
this.statusListeners.add(listener);
|
|
87
152
|
return () => {
|
|
88
|
-
this.
|
|
153
|
+
this.statusListeners.delete(listener);
|
|
89
154
|
};
|
|
90
155
|
}
|
|
91
156
|
};
|
|
@@ -98,34 +163,51 @@ window.__ModuleLoader__.load({
|
|
|
98
163
|
constructor(ctx, sessions) {
|
|
99
164
|
super(ctx, "uiSession");
|
|
100
165
|
this.sessions = sessions;
|
|
101
|
-
this.absent = this.materializeAbsent();
|
|
102
|
-
this.
|
|
166
|
+
this.absent = createBindingSource(this.materializeAbsent());
|
|
167
|
+
this.current = createBindingSource(this.absent.value);
|
|
103
168
|
this.adapter = {
|
|
104
|
-
current:
|
|
105
|
-
|
|
106
|
-
subscribe: (listener) => {
|
|
107
|
-
this.currentListeners.add(listener);
|
|
108
|
-
return () => {
|
|
109
|
-
this.currentListeners.delete(listener);
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
resolve: (key) => this.resolve(key),
|
|
169
|
+
current: this.current,
|
|
170
|
+
bindingSource: (target) => this.bindingSource(target),
|
|
114
171
|
renderArea: renderSessionArea
|
|
115
172
|
};
|
|
116
173
|
ctx.effect(() => {
|
|
117
174
|
const disposeList = sessions.list.subscribe(() => {
|
|
118
|
-
this.
|
|
175
|
+
this.publishMain();
|
|
119
176
|
});
|
|
177
|
+
const disposeStatus = sessions.list.subscribe(() => {
|
|
178
|
+
this.reconcileStatus();
|
|
179
|
+
});
|
|
180
|
+
const disposeRemoteStatus = ctx.remote.$on("api-session/status", (sessionId, running) => {
|
|
181
|
+
this.observeRunning(sessionId, running);
|
|
182
|
+
});
|
|
183
|
+
this.publishMain();
|
|
184
|
+
this.reconcileStatus();
|
|
120
185
|
return () => {
|
|
186
|
+
this.active = false;
|
|
121
187
|
disposeList();
|
|
122
|
-
|
|
188
|
+
disposeStatus();
|
|
189
|
+
disposeRemoteStatus();
|
|
190
|
+
this.disposeMainRetain();
|
|
191
|
+
const records = [...this.bindings.values];
|
|
123
192
|
this.bindings.clear();
|
|
124
193
|
for (const record of records) record.release();
|
|
125
194
|
};
|
|
126
195
|
}, "ui-session: Session binding projection");
|
|
127
196
|
}
|
|
128
197
|
/**
|
|
198
|
+
* Resolve a stable renderer source for an owned Session reference or explicit absence.
|
|
199
|
+
* @param reference - active reference supplied by the Provider owner, or absence.
|
|
200
|
+
* @returns the binding source, which falls back to the absent projection when its generation ends.
|
|
201
|
+
* @throws when the reference does not belong to the active Controller generation.
|
|
202
|
+
*/
|
|
203
|
+
bindingSource(reference) {
|
|
204
|
+
if (!this.active) return this.absent;
|
|
205
|
+
if (reference === void 0) return this.absent;
|
|
206
|
+
const owner = reference.binding;
|
|
207
|
+
if (this.sessions.binding(reference.sessionId) !== owner) throw new Error("ui-session: Session reference is not active in this Controller");
|
|
208
|
+
return this.sourceFor(owner);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
129
211
|
* Register one Session-scoped standard-source contribution.
|
|
130
212
|
* @param descriptor - static member roster and per-binding resolver.
|
|
131
213
|
* @returns disposer owned by the caller's Cordis fiber.
|
|
@@ -177,38 +259,42 @@ window.__ModuleLoader__.load({
|
|
|
177
259
|
}
|
|
178
260
|
rebuildBindings() {
|
|
179
261
|
const absent = this.materializeAbsent();
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
this.
|
|
189
|
-
this.bindings = bindings;
|
|
190
|
-
for (const record of previous.values()) record.release();
|
|
191
|
-
this.publishCurrent();
|
|
262
|
+
const updates = [...this.bindings.values].map((record) => ({
|
|
263
|
+
source: record.source,
|
|
264
|
+
value: this.materialize(record.owner)
|
|
265
|
+
}));
|
|
266
|
+
this.absent.value = absent;
|
|
267
|
+
for (const { source, value } of updates) source.value = value;
|
|
268
|
+
(0, _deepseek_ai_dsh_client_store.notifySubscribers)(this.absent.listeners, "[ui-session] absent binding");
|
|
269
|
+
for (const { source } of updates) (0, _deepseek_ai_dsh_client_store.notifySubscribers)(source.listeners, "[ui-session] Session binding");
|
|
270
|
+
this.publishMain();
|
|
192
271
|
}
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
196
|
-
const cached = this.bindings.get(key);
|
|
197
|
-
if (cached?.owner === owner) return cached.value;
|
|
272
|
+
sourceFor(owner) {
|
|
273
|
+
const cached = this.bindings.get(owner);
|
|
274
|
+
if (cached !== void 0) return cached.source;
|
|
198
275
|
const record = this.createMaterializedBinding(owner);
|
|
199
|
-
this.bindings.set(
|
|
200
|
-
|
|
201
|
-
return record.value;
|
|
276
|
+
this.bindings.set(owner, record);
|
|
277
|
+
return record.source;
|
|
202
278
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
279
|
+
publishMain() {
|
|
280
|
+
if (!this.active) return;
|
|
281
|
+
const byId = this.sessions.list.getSnapshot().byId;
|
|
282
|
+
const currentId = this.current.value.key;
|
|
283
|
+
const nextId = currentId !== void 0 && (this.sessions.retainInfo(currentId).getSnapshot().retainedBy.mainView ?? 0) > 0 ? currentId : Object.values(byId).find((candidate) => (candidate.retainedBy.mainView ?? 0) > 0)?.id;
|
|
284
|
+
this.watchMainRetention(nextId);
|
|
285
|
+
const owner = nextId === void 0 ? void 0 : this.sessions.binding(nextId);
|
|
286
|
+
const value = owner === void 0 ? this.absent.value : this.sourceFor(owner).value;
|
|
287
|
+
if (this.current.value === value) return;
|
|
288
|
+
this.current.value = value;
|
|
289
|
+
(0, _deepseek_ai_dsh_client_store.notifySubscribers)(this.current.listeners, "[ui-session] main binding");
|
|
206
290
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
this.
|
|
211
|
-
|
|
291
|
+
watchMainRetention(sessionId) {
|
|
292
|
+
if (sessionId === this.mainRetainId) return;
|
|
293
|
+
this.disposeMainRetain();
|
|
294
|
+
this.mainRetainId = sessionId;
|
|
295
|
+
this.disposeMainRetain = sessionId === void 0 ? () => {} : this.sessions.retainInfo(sessionId).subscribe(() => {
|
|
296
|
+
this.publishMain();
|
|
297
|
+
});
|
|
212
298
|
}
|
|
213
299
|
publishPendingInteractions() {
|
|
214
300
|
const next = /* @__PURE__ */ new Map();
|
|
@@ -223,20 +309,66 @@ window.__ModuleLoader__.load({
|
|
|
223
309
|
const projected = new Map([...next].map(([sessionId, value]) => [sessionId, value.interaction]));
|
|
224
310
|
if (samePendingInteractions(this.pendingSnapshot, projected)) return;
|
|
225
311
|
this.pendingSnapshot = projected;
|
|
226
|
-
|
|
312
|
+
this.publishStatus();
|
|
313
|
+
}
|
|
314
|
+
observeRunning(sessionId, running) {
|
|
315
|
+
const previous = this.running.get(sessionId);
|
|
316
|
+
const beforeBaseline = this.sessions.list.getSnapshot().phase === "pending";
|
|
317
|
+
this.running.set(sessionId, running);
|
|
318
|
+
if (running) this.completionUnread.delete(sessionId);
|
|
319
|
+
else if ((previous === true || previous === void 0 && beforeBaseline) && !this.isMain(sessionId)) this.completionUnread.add(sessionId);
|
|
320
|
+
this.publishStatus();
|
|
321
|
+
}
|
|
322
|
+
reconcileStatus() {
|
|
323
|
+
const list = this.sessions.list.getSnapshot();
|
|
324
|
+
const present = new Set(Object.keys(list.byId));
|
|
325
|
+
for (const id of list.ids) {
|
|
326
|
+
const row = list.byId[id];
|
|
327
|
+
const previous = this.running.get(id);
|
|
328
|
+
if (previous === void 0) this.running.set(id, row.running);
|
|
329
|
+
else if (previous !== row.running) this.observeRunning(id, row.running);
|
|
330
|
+
}
|
|
331
|
+
for (const id of present) if (this.isMain(id)) this.completionUnread.delete(id);
|
|
332
|
+
if (list.phase === "ready") for (const id of this.running.keys()) {
|
|
333
|
+
if (present.has(id)) continue;
|
|
334
|
+
this.running.delete(id);
|
|
335
|
+
this.completionUnread.delete(id);
|
|
336
|
+
}
|
|
337
|
+
this.publishStatus();
|
|
338
|
+
}
|
|
339
|
+
isMain(sessionId) {
|
|
340
|
+
return (this.sessions.list.getSnapshot().byId[sessionId]?.retainedBy.mainView ?? 0) > 0;
|
|
341
|
+
}
|
|
342
|
+
publishStatus() {
|
|
343
|
+
const ids = new Set([
|
|
344
|
+
...Object.keys(this.sessions.list.getSnapshot().byId),
|
|
345
|
+
...this.running.keys(),
|
|
346
|
+
...this.pendingSnapshot.keys(),
|
|
347
|
+
...this.completionUnread
|
|
348
|
+
]);
|
|
349
|
+
const next = /* @__PURE__ */ new Map();
|
|
350
|
+
for (const id of ids) next.set(id, {
|
|
351
|
+
running: this.running.get(id),
|
|
352
|
+
pendingInteraction: this.pendingSnapshot.get(id),
|
|
353
|
+
completionUnread: this.completionUnread.has(id)
|
|
354
|
+
});
|
|
355
|
+
if (sameSessionStatus(this.statusSnapshot, next)) return;
|
|
356
|
+
this.statusSnapshot = next;
|
|
357
|
+
(0, _deepseek_ai_dsh_client_store.notifySubscribers)(this.statusListeners, "[ui-session] Session status");
|
|
227
358
|
}
|
|
228
359
|
createMaterializedBinding(owner) {
|
|
229
360
|
const value = this.materialize(owner);
|
|
361
|
+
this.ctx.slots.bindStoreScope(value);
|
|
362
|
+
const source = createBindingSource(value);
|
|
230
363
|
const releaseEffect = owner.ctx.effect(() => () => {
|
|
231
|
-
if (this.bindings.get(owner
|
|
232
|
-
this.
|
|
233
|
-
|
|
234
|
-
this.
|
|
235
|
-
(0, _deepseek_ai_dsh_client_store.notifySubscribers)(this.currentListeners, "[ui-session] current binding");
|
|
364
|
+
if (this.bindings.get(owner) === record) this.bindings.delete(owner);
|
|
365
|
+
source.value = this.absent.value;
|
|
366
|
+
(0, _deepseek_ai_dsh_client_store.notifySubscribers)(source.listeners, "[ui-session] Session binding");
|
|
367
|
+
this.publishMain();
|
|
236
368
|
}, `ui-session: binding ${owner.sessionId}`);
|
|
237
369
|
const record = {
|
|
238
370
|
owner,
|
|
239
|
-
|
|
371
|
+
source,
|
|
240
372
|
release: () => {
|
|
241
373
|
releaseEffect();
|
|
242
374
|
}
|
|
@@ -255,15 +387,13 @@ window.__ModuleLoader__.load({
|
|
|
255
387
|
copyDeclared("keyed hook", keyedHooks, descriptor.keyedHooks, contribution.keyedHooks, finalProps);
|
|
256
388
|
copyDeclared("prop", props, descriptor.props, contribution.props, finalProps);
|
|
257
389
|
}
|
|
258
|
-
|
|
390
|
+
return {
|
|
259
391
|
key: binding.sessionId,
|
|
260
392
|
ctx: binding.ctx,
|
|
261
393
|
hooks,
|
|
262
394
|
keyedHooks,
|
|
263
395
|
props
|
|
264
396
|
};
|
|
265
|
-
this.ctx.slots.bindStoreScope(value);
|
|
266
|
-
return value;
|
|
267
397
|
}
|
|
268
398
|
materializeAbsent() {
|
|
269
399
|
const hooks = {};
|
|
@@ -283,6 +413,20 @@ window.__ModuleLoader__.load({
|
|
|
283
413
|
};
|
|
284
414
|
}
|
|
285
415
|
};
|
|
416
|
+
function createBindingSource(value) {
|
|
417
|
+
const source = {
|
|
418
|
+
value,
|
|
419
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
420
|
+
getSnapshot: () => source.value,
|
|
421
|
+
subscribe: (listener) => {
|
|
422
|
+
source.listeners.add(listener);
|
|
423
|
+
return () => {
|
|
424
|
+
source.listeners.delete(listener);
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
return source;
|
|
429
|
+
}
|
|
286
430
|
function validateContribution(descriptor, contribution) {
|
|
287
431
|
rejectUndeclared("hook", descriptor.hooks, contribution.hooks);
|
|
288
432
|
rejectUndeclared("keyed hook", descriptor.keyedHooks, contribution.keyedHooks);
|
|
@@ -311,19 +455,34 @@ window.__ModuleLoader__.load({
|
|
|
311
455
|
finalProps.add(propName);
|
|
312
456
|
}
|
|
313
457
|
/** Required Controller and renderer services. */
|
|
314
|
-
const inject = [
|
|
458
|
+
const inject = [
|
|
459
|
+
"sessions",
|
|
460
|
+
"slots",
|
|
461
|
+
"remote"
|
|
462
|
+
];
|
|
315
463
|
/**
|
|
316
464
|
* Install the Session root source and scoped adapter.
|
|
317
465
|
* @param ctx - Client Cordis context.
|
|
318
466
|
*/
|
|
319
467
|
function apply(ctx) {
|
|
320
468
|
const service = new UiSession(ctx, ctx.sessions);
|
|
321
|
-
ctx.slots.provideRoot({
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
469
|
+
ctx.slots.provideRoot({
|
|
470
|
+
hooks: {
|
|
471
|
+
sessions: ctx.sessions.list,
|
|
472
|
+
sessionStatus: service.sessionStatus
|
|
473
|
+
},
|
|
474
|
+
keyedHooks: { sessionRetainInfo: (key) => ctx.sessions.retainInfo(key) }
|
|
475
|
+
});
|
|
325
476
|
ctx.slots.installScope("session", service.adapter);
|
|
326
477
|
}
|
|
478
|
+
function sameSessionStatus(left, right) {
|
|
479
|
+
if (left.size !== right.size) return false;
|
|
480
|
+
for (const [id, status] of left) {
|
|
481
|
+
const candidate = right.get(id);
|
|
482
|
+
if (candidate === void 0 || candidate.running !== status.running || candidate.pendingInteraction !== status.pendingInteraction || candidate.completionUnread !== status.completionUnread) return false;
|
|
483
|
+
}
|
|
484
|
+
return true;
|
|
485
|
+
}
|
|
327
486
|
function samePendingInteractions(left, right) {
|
|
328
487
|
if (left.size !== right.size) return false;
|
|
329
488
|
for (const [sessionId, interaction] of left) if (right.get(sessionId) !== interaction) return false;
|