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
|
@@ -4,8 +4,9 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
7
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
8
|
+
require("@deepseek-ai/cordis");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
10
|
let react = require("react");
|
|
10
11
|
let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
|
|
11
12
|
//#region lib/types/client/definition.js
|
|
@@ -13,14 +14,6 @@ window.__ModuleLoader__.load({
|
|
|
13
14
|
const FILES_KIND = "files";
|
|
14
15
|
/** This implementation's identity in the tab system, and the key its body registers under. */
|
|
15
16
|
const FILES_ID = "@deepseek-ai/dsh-client-ui-sidebar-files";
|
|
16
|
-
/** The type's coloured folder sheet at the guide capsule's glyph size, as the chip title draws it. */
|
|
17
|
-
function FolderSheetGlyph({ size, className }) {
|
|
18
|
-
return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.FileTypeIcon, {
|
|
19
|
-
kind: "folder",
|
|
20
|
-
size,
|
|
21
|
-
className
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
17
|
/**
|
|
25
18
|
* The files type's registry definition.
|
|
26
19
|
* @param t - namespace-bound translate, read fresh on every label call.
|
|
@@ -33,16 +26,225 @@ window.__ModuleLoader__.load({
|
|
|
33
26
|
priority: "builtin",
|
|
34
27
|
title: () => t("type.label"),
|
|
35
28
|
guide: [{
|
|
29
|
+
id: "workspace",
|
|
30
|
+
commandId: "workspace.files",
|
|
36
31
|
order: 10,
|
|
37
32
|
title: () => t("guide.title"),
|
|
38
33
|
description: () => t("guide.description"),
|
|
39
|
-
icon:
|
|
34
|
+
icon: _deepseek_ai_dsh_client_ui_primitives.GuideArtworkFiles
|
|
40
35
|
}]
|
|
41
36
|
};
|
|
42
37
|
}
|
|
43
38
|
//#endregion
|
|
39
|
+
//#region ../../typert/protocol/src/remote-error.ts
|
|
40
|
+
/**
|
|
41
|
+
* One Remote call failure: a real Error carrying its stable code and typed
|
|
42
|
+
* details. Owners throw it at the failure point; the Host Gateway encodes it
|
|
43
|
+
* onto the wire unchanged; the Client face rebuilds an instance for the
|
|
44
|
+
* `RemoteResult` error branch, so `throw result.error` keeps throw semantics.
|
|
45
|
+
* Discrimination is always by `code`, never by instanceof.
|
|
46
|
+
*/
|
|
47
|
+
var RemoteError = class extends Error {
|
|
48
|
+
code;
|
|
49
|
+
details;
|
|
50
|
+
/** Structural marker: cross-realm/bundle identification never uses instanceof. */
|
|
51
|
+
isDSHRemoteError = true;
|
|
52
|
+
/**
|
|
53
|
+
* @param code - stable failure code declared in {@link RemoteErrorDetailsMap}.
|
|
54
|
+
* @param message - human diagnostic carried across the wire.
|
|
55
|
+
* @param details - structured payload typed by the code.
|
|
56
|
+
* @param options - standard Error options (`cause` survives in-process only).
|
|
57
|
+
*/
|
|
58
|
+
constructor(code, message, details, options) {
|
|
59
|
+
super(message, options);
|
|
60
|
+
this.code = code;
|
|
61
|
+
this.details = details;
|
|
62
|
+
this.name = "RemoteError";
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region ../../typert/protocol/src/index.ts
|
|
67
|
+
/**
|
|
68
|
+
* Remote decorators and explicit Gateway bindings backed by versioned
|
|
69
|
+
* descriptors carried on decorated class prototypes. Strict reflection
|
|
70
|
+
* remains a Typert compiler responsibility.
|
|
71
|
+
* @module @deepseek-ai/dsh-typert-protocol
|
|
72
|
+
*/
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region lib/types/client/directory-node.js
|
|
75
|
+
/** One open directory and its active child nodes; cached view preferences live in the store. */
|
|
76
|
+
var DirectoryNode = class DirectoryNode {
|
|
77
|
+
path;
|
|
78
|
+
load;
|
|
79
|
+
watch;
|
|
80
|
+
failed;
|
|
81
|
+
restore;
|
|
82
|
+
/** Open direct-child directories, keyed by absolute path. */
|
|
83
|
+
children = /* @__PURE__ */ new Map();
|
|
84
|
+
controller = new AbortController();
|
|
85
|
+
signal;
|
|
86
|
+
task;
|
|
87
|
+
reading;
|
|
88
|
+
dirty = false;
|
|
89
|
+
initialized = false;
|
|
90
|
+
automatic = true;
|
|
91
|
+
constructor(path, load, watch, failed, lifetime, restore = []) {
|
|
92
|
+
this.path = path;
|
|
93
|
+
this.load = load;
|
|
94
|
+
this.watch = watch;
|
|
95
|
+
this.failed = failed;
|
|
96
|
+
this.restore = restore;
|
|
97
|
+
this.signal = AbortSignal.any([lifetime, this.controller.signal]);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Start observation once; readiness triggers the initial listing.
|
|
101
|
+
* @returns this node.
|
|
102
|
+
*/
|
|
103
|
+
open() {
|
|
104
|
+
this.task ??= this.follow();
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Find an active node in this subtree.
|
|
109
|
+
* @param path - absolute directory path.
|
|
110
|
+
* @returns the matching node, or undefined when that directory is closed.
|
|
111
|
+
*/
|
|
112
|
+
find(path) {
|
|
113
|
+
if (path === this.path) return this;
|
|
114
|
+
for (const child of this.children.values()) {
|
|
115
|
+
const found = child.find(path);
|
|
116
|
+
if (found !== void 0) return found;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Update the expansion preferences used by pending directory listings.
|
|
121
|
+
* @param expanded - latest expansion preferences from the store.
|
|
122
|
+
*/
|
|
123
|
+
setExpanded(expanded) {
|
|
124
|
+
this.restore = expanded;
|
|
125
|
+
for (const child of this.children.values()) child.setExpanded(expanded);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Open a direct child using this node's lifetime and automatic-refresh setting.
|
|
129
|
+
* @param path - absolute direct-child directory path.
|
|
130
|
+
* @param restore - descendant expansion preferences to restore after listing.
|
|
131
|
+
* @returns the active child, or undefined after cancellation.
|
|
132
|
+
*/
|
|
133
|
+
expand(path, restore = []) {
|
|
134
|
+
if (this.signal.aborted) return void 0;
|
|
135
|
+
let child = this.children.get(path);
|
|
136
|
+
if (child === void 0) {
|
|
137
|
+
child = new DirectoryNode(path, this.load, this.watch, this.failed, this.signal, restore);
|
|
138
|
+
child.automatic = this.automatic;
|
|
139
|
+
this.children.set(path, child);
|
|
140
|
+
}
|
|
141
|
+
return child.open();
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Remove a child and its pending restoration preferences.
|
|
145
|
+
* @param path - absolute direct-child directory path.
|
|
146
|
+
* @returns once the child subtree's reads and watches have ended.
|
|
147
|
+
*/
|
|
148
|
+
async collapse(path) {
|
|
149
|
+
this.restore = this.restore.filter((value) => value !== path && !value.startsWith(`${path}/`));
|
|
150
|
+
const child = this.children.get(path);
|
|
151
|
+
this.children.delete(path);
|
|
152
|
+
await child?.close();
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Control subtree rereads without ending subscriptions.
|
|
156
|
+
* @param enabled - refresh dirty nodes automatically.
|
|
157
|
+
*/
|
|
158
|
+
setAutomatic(enabled) {
|
|
159
|
+
this.automatic = enabled;
|
|
160
|
+
if (enabled && this.dirty) this.refresh();
|
|
161
|
+
for (const child of this.children.values()) child.setAutomatic(enabled);
|
|
162
|
+
}
|
|
163
|
+
/** Queue a reread, coalescing with active work. @returns completion of the active read and its coalesced rereads. */
|
|
164
|
+
refresh() {
|
|
165
|
+
this.dirty = true;
|
|
166
|
+
this.reading ??= this.read();
|
|
167
|
+
return this.reading;
|
|
168
|
+
}
|
|
169
|
+
/** Refresh this node and its open descendants. @returns once their listings settle. */
|
|
170
|
+
async refreshTree() {
|
|
171
|
+
await this.refresh();
|
|
172
|
+
await Promise.all([...this.children.values()].map((child) => child.refreshTree()));
|
|
173
|
+
}
|
|
174
|
+
/** Cancel the active subtree. @returns once all owned reads and watches have ended. */
|
|
175
|
+
async close() {
|
|
176
|
+
this.controller.abort();
|
|
177
|
+
await Promise.all([
|
|
178
|
+
this.task,
|
|
179
|
+
this.reading,
|
|
180
|
+
...[...this.children.values()].map((child) => child.close())
|
|
181
|
+
]);
|
|
182
|
+
this.children.clear();
|
|
183
|
+
}
|
|
184
|
+
async follow() {
|
|
185
|
+
try {
|
|
186
|
+
for await (const _event of this.watch(this.path, this.signal)) {
|
|
187
|
+
this.dirty = true;
|
|
188
|
+
if (!this.initialized || this.automatic) this.refresh();
|
|
189
|
+
}
|
|
190
|
+
} catch (error) {
|
|
191
|
+
if (!this.signal.aborted) {
|
|
192
|
+
if (!this.initialized) await this.refresh();
|
|
193
|
+
if (!(typeof error === "object" && error !== null && "code" in error && error.code === "workspace-file/watch-unsupported")) this.failed(this.path, error);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
async read() {
|
|
198
|
+
const readAgain = () => this.dirty && this.automatic && !this.signal.aborted;
|
|
199
|
+
try {
|
|
200
|
+
do {
|
|
201
|
+
this.dirty = false;
|
|
202
|
+
const level = await this.load(this.path, this.signal);
|
|
203
|
+
if (this.signal.aborted || level === void 0) return;
|
|
204
|
+
this.initialized = true;
|
|
205
|
+
const directories = new Set(level.entries.filter((entry) => entry.type === "directory").map((entry) => `${this.path.replace(/[/\\]+$/, "")}/${entry.name}`));
|
|
206
|
+
for (const path of this.children.keys()) if (!directories.has(path)) await this.collapse(path);
|
|
207
|
+
for (const path of directories) if (this.restore.includes(path)) this.expand(path, this.restore);
|
|
208
|
+
this.restore = [];
|
|
209
|
+
} while (readAgain());
|
|
210
|
+
} finally {
|
|
211
|
+
this.reading = void 0;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
//#endregion
|
|
44
216
|
//#region lib/types/client/face.js
|
|
45
217
|
/**
|
|
218
|
+
* Bind directory observation to the Remote stream supervisor.
|
|
219
|
+
* @param remote - Client Remote with workspace file streams.
|
|
220
|
+
* @returns a watcher that awaits stream disposal when its node ends.
|
|
221
|
+
*/
|
|
222
|
+
function createWatch(remote) {
|
|
223
|
+
return async function* (sessionId, path, signal) {
|
|
224
|
+
const aborted = () => signal.aborted;
|
|
225
|
+
if (aborted()) return;
|
|
226
|
+
const stream = remote.$stream({
|
|
227
|
+
name: `directory ${path}`,
|
|
228
|
+
open: (lifetime) => remote.workspaceFiles.changes(sessionId, path, lifetime),
|
|
229
|
+
ended: () => /* @__PURE__ */ new Error(`Directory watch ended: ${path}`)
|
|
230
|
+
});
|
|
231
|
+
const abort = () => {
|
|
232
|
+
stream.dispose();
|
|
233
|
+
};
|
|
234
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
235
|
+
try {
|
|
236
|
+
for await (const item of stream) {
|
|
237
|
+
if (aborted()) return;
|
|
238
|
+
if (item.value.kind === "ready") item.accept();
|
|
239
|
+
yield item.value.kind;
|
|
240
|
+
}
|
|
241
|
+
} finally {
|
|
242
|
+
signal.removeEventListener("abort", abort);
|
|
243
|
+
await stream.dispose();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
46
248
|
* Bind the listing to one Remote face, keeping only what the tree stores.
|
|
47
249
|
* @param remote - the Client Remote face carrying the `workspaceFiles` namespace.
|
|
48
250
|
* @returns the listing the tree's face performs.
|
|
@@ -75,12 +277,14 @@ window.__ModuleLoader__.load({
|
|
|
75
277
|
/**
|
|
76
278
|
* Bind the tree's face to one directory listing.
|
|
77
279
|
* @param list - the bound `workspaceFiles.list` call.
|
|
280
|
+
* @param watch - target-scoped directory observation.
|
|
78
281
|
* @returns the Slot `inject` factory: session and bound actions in, face out.
|
|
79
282
|
*/
|
|
80
|
-
function filesFace(list) {
|
|
283
|
+
function filesFace(list, watch) {
|
|
81
284
|
return (sessionId, actions) => {
|
|
82
285
|
/** Per tab, per absolute path: the listing generation a settlement must match; the latest request wins. */
|
|
83
286
|
const generations = /* @__PURE__ */ new Map();
|
|
287
|
+
const roots = /* @__PURE__ */ new Map();
|
|
84
288
|
const nextGeneration = (tabId, path) => {
|
|
85
289
|
const byPath = generations.get(tabId) ?? /* @__PURE__ */ new Map();
|
|
86
290
|
generations.set(tabId, byPath);
|
|
@@ -88,29 +292,52 @@ window.__ModuleLoader__.load({
|
|
|
88
292
|
byPath.set(path, generation);
|
|
89
293
|
return generation;
|
|
90
294
|
};
|
|
91
|
-
const load = (tabId, path, signal) => {
|
|
295
|
+
const load = async (tabId, path, signal) => {
|
|
92
296
|
if (signal.aborted) return;
|
|
93
297
|
const generation = nextGeneration(tabId, path);
|
|
94
298
|
actions.loading(tabId, path);
|
|
95
|
-
list(sessionId, path, signal).then((result) => {
|
|
96
|
-
if (generations.get(tabId)?.get(path) !== generation) return;
|
|
299
|
+
return list(sessionId, path, signal).then((result) => {
|
|
300
|
+
if (signal.aborted || generations.get(tabId)?.get(path) !== generation) return;
|
|
97
301
|
if (result.ok) actions.loaded(tabId, path, result.value);
|
|
98
302
|
else actions.failed(tabId, path, result.error);
|
|
303
|
+
return result.ok ? result.value : void 0;
|
|
99
304
|
});
|
|
100
305
|
};
|
|
101
306
|
return {
|
|
307
|
+
refresh: (tabId) => {
|
|
308
|
+
roots.get(tabId)?.refreshTree();
|
|
309
|
+
},
|
|
310
|
+
setAutoRefresh: (tabId, enabled) => {
|
|
311
|
+
actions.autoRefresh(tabId, enabled);
|
|
312
|
+
roots.get(tabId)?.setAutomatic(enabled);
|
|
313
|
+
},
|
|
102
314
|
start(tabId, root, signal) {
|
|
103
315
|
actions.start(tabId, root);
|
|
104
316
|
signal.addEventListener("abort", () => {
|
|
317
|
+
roots.get(tabId)?.close();
|
|
318
|
+
roots.delete(tabId);
|
|
105
319
|
generations.delete(tabId);
|
|
106
320
|
actions.forget(tabId);
|
|
107
321
|
}, { once: true });
|
|
108
|
-
|
|
322
|
+
roots.set(tabId, new DirectoryNode(root, (path, lifetime) => load(tabId, path, lifetime), (path, lifetime) => watch(sessionId, path, lifetime), (path, error) => {
|
|
323
|
+
if (!signal.aborted) actions.failed(tabId, path, new RemoteError("gateway/internal", error instanceof Error ? error.message : String(error), {}));
|
|
324
|
+
}, signal).open());
|
|
109
325
|
},
|
|
110
|
-
load,
|
|
111
|
-
|
|
326
|
+
load: (tabId, path, signal) => {
|
|
327
|
+
load(tabId, path, signal);
|
|
328
|
+
},
|
|
329
|
+
toggle(tabId, parentPath, path, expanded, signal) {
|
|
330
|
+
if (signal.aborted) return;
|
|
331
|
+
const root = roots.get(tabId);
|
|
332
|
+
if (root === void 0) return;
|
|
333
|
+
const parent = root.find(parentPath);
|
|
334
|
+
if (parent === void 0 && !expanded.includes(parentPath)) return;
|
|
335
|
+
const collapsing = expanded.includes(path);
|
|
336
|
+
const next = collapsing ? expanded.filter((value) => value !== path) : [...expanded, path];
|
|
337
|
+
root.setExpanded(next);
|
|
338
|
+
if (collapsing) parent?.collapse(path);
|
|
339
|
+
else parent?.expand(path, next);
|
|
112
340
|
actions.toggled(tabId, path);
|
|
113
|
-
if (!loaded) load(tabId, path, signal);
|
|
114
341
|
}
|
|
115
342
|
};
|
|
116
343
|
};
|
|
@@ -171,27 +398,6 @@ window.__ModuleLoader__.load({
|
|
|
171
398
|
return path.startsWith("/") || isWindowsStylePath(path);
|
|
172
399
|
}
|
|
173
400
|
/**
|
|
174
|
-
* Split a path for display: the directories through their last separator, and
|
|
175
|
-
* the final segment after it. Both `/` and `\` separate, so a Windows path
|
|
176
|
-
* splits where its own segments end; trailing separators are dropped first, so
|
|
177
|
-
* a directory path names its own last segment. A path with no separator, or a
|
|
178
|
-
* separator-only path, is all name.
|
|
179
|
-
* @param path - file or directory path using POSIX or Windows separators.
|
|
180
|
-
* @returns the directory prefix (possibly empty) and the final segment.
|
|
181
|
-
*/
|
|
182
|
-
function pathPartsOf(path) {
|
|
183
|
-
const trimmed = path.replace(/[/\\]+$/, "");
|
|
184
|
-
if (trimmed === "") return {
|
|
185
|
-
directory: "",
|
|
186
|
-
name: path
|
|
187
|
-
};
|
|
188
|
-
const cut = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\")) + 1;
|
|
189
|
-
return {
|
|
190
|
-
directory: trimmed.slice(0, cut),
|
|
191
|
-
name: trimmed.slice(cut)
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
401
|
* The address for a path as a caller holds it: a relative path, or an absolute
|
|
196
402
|
* path inside the Session's workspace, becomes a `session`-scoped address; an
|
|
197
403
|
* absolute path outside it, or one whose workspace root is unknown, keeps its
|
|
@@ -211,7 +417,7 @@ window.__ModuleLoader__.load({
|
|
|
211
417
|
}
|
|
212
418
|
//#endregion
|
|
213
419
|
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-sidebar-files/src/client/FilesBody.module.css.mjs
|
|
214
|
-
const css = ".k-1LKG_root{height:100%;min-height:0;color:var(--dsw-alias-label-primary);font-size:var(--dsh-content-font-size-secondary,13px);flex-direction:column;flex:auto;line-height:1.5;display:flex}.k-1LKG_header{box-sizing:border-box;border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:4px;height:38px;padding:0 6px 0 16px;display:flex}.k-1LKG_path{
|
|
420
|
+
const css = ".k-1LKG_root{height:100%;min-height:0;color:var(--dsw-alias-label-primary);font-size:var(--dsh-content-font-size-secondary,13px);flex-direction:column;flex:auto;line-height:1.5;display:flex}.k-1LKG_header{box-sizing:border-box;border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:4px;height:38px;padding:0 6px 0 16px;display:flex}.k-1LKG_path{margin-right:12px}.k-1LKG_body{scrollbar-gutter:stable;flex:auto;min-height:0;margin-right:2px;padding:8px 0 8px 8px;overflow:auto}.k-1LKG_body::-webkit-scrollbar-track{margin:2px}.k-1LKG_level{margin:0;padding:0;list-style:none}.k-1LKG_level .k-1LKG_level{padding-left:18px}.k-1LKG_item{margin:0;padding:0}.k-1LKG_row{width:100%;min-width:0;color:inherit;font:inherit;text-align:left;border-radius:var(--dsw-radius-md);cursor:pointer;background:0 0;border:0;align-items:center;gap:6px;padding:5px 10px;display:flex}.k-1LKG_row:hover{background:var(--dsw-alias-interactive-bg-hover)}.k-1LKG_icon{color:var(--dsw-alias-label-tertiary);flex:none}.k-1LKG_fileIcon{flex:none}.k-1LKG_name{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.k-1LKG_other{color:var(--dsw-alias-label-tertiary);cursor:default}.k-1LKG_other:hover{background:0 0}.k-1LKG_note{color:var(--dsw-alias-label-tertiary);margin:0;padding:3px 10px;font-size:12px}.k-1LKG_status{flex-direction:column;padding:12px 10px;display:flex}.k-1LKG_statusLine{color:var(--dsw-alias-label-secondary);font-size:var(--dsh-content-font-size-secondary,13px);margin:0;line-height:1.6}.k-1LKG_tool{width:28px;height:28px;color:var(--dsw-alias-label-secondary);border-radius:var(--dsw-radius-sm);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:6px;line-height:1;display:inline-flex}.k-1LKG_tool svg{width:15px;height:15px}.k-1LKG_tool:hover,.k-1LKG_tool[aria-pressed=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.k-1LKG_titleIcon{flex:none}";
|
|
215
421
|
const tagId = "@deepseek-ai/dsh-client-ui-sidebar-files/FilesBody.module.css";
|
|
216
422
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
217
423
|
const tag = document.createElement("style");
|
|
@@ -231,9 +437,6 @@ window.__ModuleLoader__.load({
|
|
|
231
437
|
"note": "k-1LKG_note",
|
|
232
438
|
"other": "k-1LKG_other",
|
|
233
439
|
"path": "k-1LKG_path",
|
|
234
|
-
"pathDirectory": "k-1LKG_pathDirectory",
|
|
235
|
-
"pathName": "k-1LKG_pathName",
|
|
236
|
-
"pathText": "k-1LKG_pathText",
|
|
237
440
|
"root": "k-1LKG_root",
|
|
238
441
|
"row": "k-1LKG_row",
|
|
239
442
|
"status": "k-1LKG_status",
|
|
@@ -250,10 +453,8 @@ window.__ModuleLoader__.load({
|
|
|
250
453
|
* for goes through its injected face. The component itself only decides what to
|
|
251
454
|
* draw for each absolute path and what a click means: a directory toggles, a
|
|
252
455
|
* file opens through the owner's `tabActions` for a `file:` viewer to claim, and
|
|
253
|
-
* anything else is shown but refuses to open. The header
|
|
254
|
-
*
|
|
255
|
-
* ink, then the one control at its end, reload, which drops every listed level
|
|
256
|
-
* and asks again for the expanded ones.
|
|
456
|
+
* anything else is shown but refuses to open. The header uses the shared
|
|
457
|
+
* PathLabel for the root, followed by reload for the expanded directories.
|
|
257
458
|
*/
|
|
258
459
|
/** Natural, case-insensitive name order, so `file2` precedes `file10`. */
|
|
259
460
|
const byName = new Intl.Collator(void 0, {
|
|
@@ -287,35 +488,6 @@ window.__ModuleLoader__.load({
|
|
|
287
488
|
default: return t("error.unavailable", { message: failure.message });
|
|
288
489
|
}
|
|
289
490
|
}
|
|
290
|
-
/**
|
|
291
|
-
* Keep the path row's `data-files-path-clipped` current: set while the path's
|
|
292
|
-
* text is wider than its box, so the stylesheet fades the clipped start. Read
|
|
293
|
-
* after each commit that can change the path or mount the header, and whenever
|
|
294
|
-
* either box resizes; written to the DOM directly because it changes only how
|
|
295
|
-
* the stylesheet fades what is already rendered.
|
|
296
|
-
*/
|
|
297
|
-
function usePathClipped(box, text, path) {
|
|
298
|
-
(0, react.useLayoutEffect)(() => {
|
|
299
|
-
const outer = box.current;
|
|
300
|
-
const inner = text.current;
|
|
301
|
-
if (outer === null || inner === null) return void 0;
|
|
302
|
-
const apply = () => {
|
|
303
|
-
if (inner.offsetWidth > outer.clientWidth) outer.dataset.filesPathClipped = "";
|
|
304
|
-
else delete outer.dataset.filesPathClipped;
|
|
305
|
-
};
|
|
306
|
-
apply();
|
|
307
|
-
const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(apply);
|
|
308
|
-
observer?.observe(outer);
|
|
309
|
-
observer?.observe(inner);
|
|
310
|
-
return () => {
|
|
311
|
-
observer?.disconnect();
|
|
312
|
-
};
|
|
313
|
-
}, [
|
|
314
|
-
box,
|
|
315
|
-
text,
|
|
316
|
-
path
|
|
317
|
-
]);
|
|
318
|
-
}
|
|
319
491
|
/** One entry's row, and its children when it is an expanded directory. */
|
|
320
492
|
function Entry({ parent, entry, tree }) {
|
|
321
493
|
const path = childPath(parent, entry.name);
|
|
@@ -330,9 +502,9 @@ window.__ModuleLoader__.load({
|
|
|
330
502
|
className: FilesBody_module_css_default.row,
|
|
331
503
|
"aria-expanded": expanded,
|
|
332
504
|
onClick: () => {
|
|
333
|
-
tree.onToggle(path);
|
|
505
|
+
tree.onToggle(parent, path);
|
|
334
506
|
},
|
|
335
|
-
children: [expanded ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.
|
|
507
|
+
children: [expanded ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpenRegular, { className: FilesBody_module_css_default.icon }) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderCloseRegular, { className: FilesBody_module_css_default.icon }), (0, react_jsx_runtime.jsx)("span", {
|
|
336
508
|
className: FilesBody_module_css_default.name,
|
|
337
509
|
children: entry.name
|
|
338
510
|
})]
|
|
@@ -397,6 +569,11 @@ window.__ModuleLoader__.load({
|
|
|
397
569
|
});
|
|
398
570
|
const entries = orderEntries(level.level.entries);
|
|
399
571
|
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
572
|
+
level.failure !== void 0 && (0, react_jsx_runtime.jsx)("li", {
|
|
573
|
+
className: FilesBody_module_css_default.note,
|
|
574
|
+
"data-files-row": "failed",
|
|
575
|
+
children: failureLine(t, level.failure)
|
|
576
|
+
}),
|
|
400
577
|
entries.length === 0 && (0, react_jsx_runtime.jsx)("li", {
|
|
401
578
|
className: FilesBody_module_css_default.note,
|
|
402
579
|
"data-files-row": "empty",
|
|
@@ -415,14 +592,36 @@ window.__ModuleLoader__.load({
|
|
|
415
592
|
] });
|
|
416
593
|
}
|
|
417
594
|
/** The file tree's body: the workspace root and whatever the reader has opened under it. */
|
|
418
|
-
function FilesBody({ useTabInfo, sessionId, useSessions, useStore, actions, start,
|
|
595
|
+
function FilesBody({ useTabInfo, sessionId, useSessions, useStore, actions, start, refresh, setAutoRefresh, toggle, t }) {
|
|
419
596
|
const { tab } = useTabInfo();
|
|
597
|
+
(0, react.useEffect)(() => tab.actions.bindCommands({ refresh: () => {
|
|
598
|
+
refresh(tab.id);
|
|
599
|
+
} }), [
|
|
600
|
+
tab.actions,
|
|
601
|
+
tab.id,
|
|
602
|
+
refresh
|
|
603
|
+
]);
|
|
420
604
|
const { signal, actions: tabActions } = tab;
|
|
421
605
|
const cwd = useSessions((sessions) => sessions.byId[sessionId]?.cwd);
|
|
422
606
|
const state = useStore((store) => store.byTab[tab.id]);
|
|
423
|
-
const
|
|
424
|
-
const
|
|
425
|
-
|
|
607
|
+
const bodyRef = (0, react.useRef)(null);
|
|
608
|
+
const scrollTopRef = (0, react.useRef)(0);
|
|
609
|
+
const seeded = state !== void 0;
|
|
610
|
+
(0, react.useLayoutEffect)(() => {
|
|
611
|
+
const body = bodyRef.current;
|
|
612
|
+
if (seeded && body !== null) {
|
|
613
|
+
body.scrollTop = state.scrollTop;
|
|
614
|
+
scrollTopRef.current = body.scrollTop;
|
|
615
|
+
}
|
|
616
|
+
}, [seeded]);
|
|
617
|
+
(0, react.useEffect)(() => () => {
|
|
618
|
+
if (seeded && !signal.aborted) actions.scrolled(tab.id, scrollTopRef.current);
|
|
619
|
+
}, [
|
|
620
|
+
seeded,
|
|
621
|
+
signal,
|
|
622
|
+
tab.id,
|
|
623
|
+
actions
|
|
624
|
+
]);
|
|
426
625
|
(0, react.useEffect)(() => {
|
|
427
626
|
if (state !== void 0 || cwd === void 0 || signal.aborted) return;
|
|
428
627
|
start(tab.id, cwd, signal);
|
|
@@ -444,8 +643,8 @@ window.__ModuleLoader__.load({
|
|
|
444
643
|
if (state === void 0) return null;
|
|
445
644
|
const tree = {
|
|
446
645
|
state,
|
|
447
|
-
onToggle: (path) => {
|
|
448
|
-
toggle(tab.id, path, state.
|
|
646
|
+
onToggle: (parent, path) => {
|
|
647
|
+
toggle(tab.id, parent, path, state.expanded, signal);
|
|
449
648
|
},
|
|
450
649
|
onOpen: (path) => {
|
|
451
650
|
tabActions.openResource(fileAddressFor(sessionId, state.root, path));
|
|
@@ -453,43 +652,58 @@ window.__ModuleLoader__.load({
|
|
|
453
652
|
t
|
|
454
653
|
};
|
|
455
654
|
const reload = () => {
|
|
456
|
-
|
|
457
|
-
for (const path of state.expanded) load(tab.id, path, signal);
|
|
655
|
+
refresh(tab.id);
|
|
458
656
|
};
|
|
459
|
-
const { directory, name } = pathPartsOf(state.root);
|
|
460
657
|
return (0, react_jsx_runtime.jsxs)("div", {
|
|
461
658
|
className: FilesBody_module_css_default.root,
|
|
462
659
|
"data-files-state": "tree",
|
|
463
660
|
"data-files-root": state.root,
|
|
464
661
|
children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
465
662
|
className: FilesBody_module_css_default.header,
|
|
466
|
-
children: [
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
children:
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
663
|
+
children: [
|
|
664
|
+
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.PathLabel, {
|
|
665
|
+
path: state.root,
|
|
666
|
+
className: FilesBody_module_css_default.path,
|
|
667
|
+
"data-files-path": true
|
|
668
|
+
}),
|
|
669
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
670
|
+
hidden: true,
|
|
671
|
+
children: (0, react_jsx_runtime.jsx)("button", {
|
|
672
|
+
type: "button",
|
|
673
|
+
className: FilesBody_module_css_default.tool,
|
|
674
|
+
"aria-label": t("autoRefresh"),
|
|
675
|
+
"aria-pressed": state.autoRefresh,
|
|
676
|
+
"data-files-auto-refresh": true,
|
|
677
|
+
title: t(state.autoRefresh ? "autoRefresh.disable" : "autoRefresh.enable"),
|
|
678
|
+
onClick: () => {
|
|
679
|
+
setAutoRefresh(tab.id, !state.autoRefresh);
|
|
680
|
+
},
|
|
681
|
+
children: state.autoRefresh ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPauseOutlineRegular, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlayOutlineRegular, {})
|
|
682
|
+
})
|
|
683
|
+
}),
|
|
684
|
+
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
685
|
+
label: t("reload"),
|
|
686
|
+
shortcutKeys: tab.refreshShortcut?.keys,
|
|
687
|
+
side: "bottom",
|
|
688
|
+
delayMs: 500,
|
|
689
|
+
children: (0, react_jsx_runtime.jsx)("button", {
|
|
690
|
+
type: "button",
|
|
691
|
+
className: FilesBody_module_css_default.tool,
|
|
692
|
+
"aria-label": t("reload"),
|
|
693
|
+
"aria-keyshortcuts": tab.refreshShortcut?.aria,
|
|
694
|
+
"data-files-reload": true,
|
|
695
|
+
onClick: reload,
|
|
696
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, {})
|
|
697
|
+
})
|
|
481
698
|
})
|
|
482
|
-
|
|
483
|
-
type: "button",
|
|
484
|
-
className: FilesBody_module_css_default.tool,
|
|
485
|
-
"aria-label": t("reload"),
|
|
486
|
-
title: t("reload"),
|
|
487
|
-
"data-files-reload": true,
|
|
488
|
-
onClick: reload,
|
|
489
|
-
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline16, {})
|
|
490
|
-
})]
|
|
699
|
+
]
|
|
491
700
|
}), (0, react_jsx_runtime.jsx)("div", {
|
|
701
|
+
ref: bodyRef,
|
|
492
702
|
className: FilesBody_module_css_default.body,
|
|
703
|
+
"data-files-body": true,
|
|
704
|
+
onScroll: (event) => {
|
|
705
|
+
scrollTopRef.current = event.currentTarget.scrollTop;
|
|
706
|
+
},
|
|
493
707
|
children: (0, react_jsx_runtime.jsx)("ul", {
|
|
494
708
|
className: FilesBody_module_css_default.level,
|
|
495
709
|
children: (0, react_jsx_runtime.jsx)(Level, {
|
|
@@ -519,6 +733,7 @@ window.__ModuleLoader__.load({
|
|
|
519
733
|
//#region lib/types/client/locales.js
|
|
520
734
|
/** Simplified Chinese dictionary and key-set source of truth. */
|
|
521
735
|
const zh = {
|
|
736
|
+
"shortcut.noSession": "请先选择会话",
|
|
522
737
|
"type.label": "文件",
|
|
523
738
|
"guide.title": "工作区文件",
|
|
524
739
|
"guide.description": "浏览会话工作区的文件",
|
|
@@ -527,6 +742,9 @@ window.__ModuleLoader__.load({
|
|
|
527
742
|
truncated: "条目太多,只显示了一部分。",
|
|
528
743
|
noWorkspace: "这个会话没有工作区目录。",
|
|
529
744
|
reload: "重新读取",
|
|
745
|
+
autoRefresh: "自动刷新",
|
|
746
|
+
"autoRefresh.enable": "开启自动刷新",
|
|
747
|
+
"autoRefresh.disable": "关闭自动刷新",
|
|
530
748
|
"entry.other": "这不是文件或目录,没法打开。",
|
|
531
749
|
"error.notFound": "这个目录不在了。可能已被移动或删除。",
|
|
532
750
|
"error.outsideWorkspace": "这个目录在工作区之外,侧栏不会读取它。",
|
|
@@ -535,6 +753,7 @@ window.__ModuleLoader__.load({
|
|
|
535
753
|
};
|
|
536
754
|
/** English dictionary, checked against the Chinese key set. */
|
|
537
755
|
const en = {
|
|
756
|
+
"shortcut.noSession": "Select a session first",
|
|
538
757
|
"type.label": "Files",
|
|
539
758
|
"guide.title": "Workspace files",
|
|
540
759
|
"guide.description": "Browse files in this session's workspace",
|
|
@@ -543,6 +762,9 @@ window.__ModuleLoader__.load({
|
|
|
543
762
|
truncated: "Too many entries, showing only some of them.",
|
|
544
763
|
noWorkspace: "This session has no workspace directory.",
|
|
545
764
|
reload: "Reload",
|
|
765
|
+
autoRefresh: "Auto refresh",
|
|
766
|
+
"autoRefresh.enable": "Enable auto refresh",
|
|
767
|
+
"autoRefresh.disable": "Disable auto refresh",
|
|
546
768
|
"entry.other": "Not a file or a directory, so it cannot be opened.",
|
|
547
769
|
"error.notFound": "That directory is gone. It may have been moved or deleted.",
|
|
548
770
|
"error.outsideWorkspace": "That directory is outside the workspace, so the sidebar will not read it.",
|
|
@@ -552,8 +774,8 @@ window.__ModuleLoader__.load({
|
|
|
552
774
|
//#endregion
|
|
553
775
|
//#region lib/types/client/store.js
|
|
554
776
|
/**
|
|
555
|
-
* The file tree's view state: which directories are expanded,
|
|
556
|
-
* loaded level contains.
|
|
777
|
+
* The file tree's view state: which directories are expanded, what each
|
|
778
|
+
* loaded level contains, and where the body is scrolled to.
|
|
557
779
|
*
|
|
558
780
|
* The tree is not one resource. A directory listing per level, expanded lazily,
|
|
559
781
|
* is state the type owns — so it lives in a Slot-standard exclusive store
|
|
@@ -586,6 +808,9 @@ window.__ModuleLoader__.load({
|
|
|
586
808
|
return (0, _deepseek_ai_dsh_client_store.defineStore)({
|
|
587
809
|
init: () => ({ byTab: {} }),
|
|
588
810
|
actions: {
|
|
811
|
+
autoRefresh: (d, tabId, enabled) => {
|
|
812
|
+
bucket(d, tabId).autoRefresh = enabled;
|
|
813
|
+
},
|
|
589
814
|
/**
|
|
590
815
|
* Seed one tab's tree at its workspace root, with the root expanded.
|
|
591
816
|
* @param d - draft state.
|
|
@@ -596,7 +821,9 @@ window.__ModuleLoader__.load({
|
|
|
596
821
|
d.byTab[tabId] = {
|
|
597
822
|
root,
|
|
598
823
|
levels: {},
|
|
599
|
-
expanded: [root]
|
|
824
|
+
expanded: [root],
|
|
825
|
+
scrollTop: 0,
|
|
826
|
+
autoRefresh: true
|
|
600
827
|
};
|
|
601
828
|
},
|
|
602
829
|
/**
|
|
@@ -606,7 +833,8 @@ window.__ModuleLoader__.load({
|
|
|
606
833
|
* @param path - absolute directory path.
|
|
607
834
|
*/
|
|
608
835
|
loading: (d, tabId, path) => {
|
|
609
|
-
bucket(d, tabId)
|
|
836
|
+
const state = bucket(d, tabId);
|
|
837
|
+
if (state.levels[path]?.kind !== "ready") state.levels[path] = { kind: "loading" };
|
|
610
838
|
},
|
|
611
839
|
/**
|
|
612
840
|
* Record one directory's contents.
|
|
@@ -616,7 +844,18 @@ window.__ModuleLoader__.load({
|
|
|
616
844
|
* @param level - the listing to show under it.
|
|
617
845
|
*/
|
|
618
846
|
loaded: (d, tabId, path, level) => {
|
|
619
|
-
bucket(d, tabId)
|
|
847
|
+
const state = bucket(d, tabId);
|
|
848
|
+
const previous = state.levels[path];
|
|
849
|
+
if (previous?.kind === "ready") {
|
|
850
|
+
const directories = new Set(level.entries.filter((entry) => entry.type === "directory").map((entry) => entry.name));
|
|
851
|
+
for (const entry of previous.level.entries) {
|
|
852
|
+
if (entry.type !== "directory" || directories.has(entry.name)) continue;
|
|
853
|
+
const removed = `${path.replace(/[/\\]+$/, "")}/${entry.name}`;
|
|
854
|
+
state.expanded = state.expanded.filter((value) => value !== removed && !value.startsWith(`${removed}/`));
|
|
855
|
+
state.levels = Object.fromEntries(Object.entries(state.levels).filter(([key]) => key !== removed && !key.startsWith(`${removed}/`)));
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
state.levels[path] = {
|
|
620
859
|
kind: "ready",
|
|
621
860
|
level
|
|
622
861
|
};
|
|
@@ -629,7 +868,11 @@ window.__ModuleLoader__.load({
|
|
|
629
868
|
* @param failure - the settled Remote failure.
|
|
630
869
|
*/
|
|
631
870
|
failed: (d, tabId, path, failure) => {
|
|
632
|
-
bucket(d, tabId).levels[path]
|
|
871
|
+
const level = bucket(d, tabId).levels[path];
|
|
872
|
+
bucket(d, tabId).levels[path] = level?.kind === "ready" ? {
|
|
873
|
+
...level,
|
|
874
|
+
failure
|
|
875
|
+
} : {
|
|
633
876
|
kind: "failed",
|
|
634
877
|
failure
|
|
635
878
|
};
|
|
@@ -649,6 +892,15 @@ window.__ModuleLoader__.load({
|
|
|
649
892
|
else state.expanded.push(path);
|
|
650
893
|
},
|
|
651
894
|
/**
|
|
895
|
+
* Record where one tab's body is scrolled to.
|
|
896
|
+
* @param d - draft state.
|
|
897
|
+
* @param tabId - the tab being drawn.
|
|
898
|
+
* @param scrollTop - the body's scroll offset, in px.
|
|
899
|
+
*/
|
|
900
|
+
scrolled: (d, tabId, scrollTop) => {
|
|
901
|
+
bucket(d, tabId).scrollTop = scrollTop;
|
|
902
|
+
},
|
|
903
|
+
/**
|
|
652
904
|
* Drop every loaded level, keeping what is expanded.
|
|
653
905
|
*
|
|
654
906
|
* This is the reload gesture's first half: the expanded set says which
|
|
@@ -682,6 +934,7 @@ window.__ModuleLoader__.load({
|
|
|
682
934
|
"slots",
|
|
683
935
|
"locale",
|
|
684
936
|
"sidebarRightTabs",
|
|
937
|
+
"sidebarRight",
|
|
685
938
|
"remote",
|
|
686
939
|
"remote.workspaceFiles"
|
|
687
940
|
];
|
|
@@ -691,13 +944,61 @@ window.__ModuleLoader__.load({
|
|
|
691
944
|
*/
|
|
692
945
|
function apply(ctx) {
|
|
693
946
|
const t = ctx.locale.bind(NS);
|
|
947
|
+
ctx.inject(["shortcuts"], (ctx) => {
|
|
948
|
+
ctx.effect(() => ctx.shortcuts.register({
|
|
949
|
+
id: "workspace.files",
|
|
950
|
+
label: () => t("guide.title"),
|
|
951
|
+
aliases: ["workspace files", "files"],
|
|
952
|
+
defaults: {
|
|
953
|
+
"desktop:macos": {
|
|
954
|
+
code: "KeyP",
|
|
955
|
+
modifiers: ["primary"]
|
|
956
|
+
},
|
|
957
|
+
"desktop:windows": {
|
|
958
|
+
code: "KeyP",
|
|
959
|
+
modifiers: ["primary"]
|
|
960
|
+
},
|
|
961
|
+
"desktop:linux": {
|
|
962
|
+
code: "KeyP",
|
|
963
|
+
modifiers: ["primary"]
|
|
964
|
+
},
|
|
965
|
+
"web:macos": {
|
|
966
|
+
code: "KeyP",
|
|
967
|
+
modifiers: ["primary", "alt"]
|
|
968
|
+
},
|
|
969
|
+
"web:windows": {
|
|
970
|
+
code: "KeyP",
|
|
971
|
+
modifiers: ["primary", "alt"]
|
|
972
|
+
}
|
|
973
|
+
},
|
|
974
|
+
regions: [
|
|
975
|
+
"page",
|
|
976
|
+
"editable",
|
|
977
|
+
"terminal"
|
|
978
|
+
],
|
|
979
|
+
modals: [],
|
|
980
|
+
resolve: ({ target: element }) => {
|
|
981
|
+
const target = ctx.sidebarRight.commandTarget(element);
|
|
982
|
+
if (target === void 0) return {
|
|
983
|
+
status: "blocked",
|
|
984
|
+
reason: t("shortcut.noSession")
|
|
985
|
+
};
|
|
986
|
+
return {
|
|
987
|
+
status: "handled",
|
|
988
|
+
run: () => {
|
|
989
|
+
ctx.sidebarRight.openTabFromTarget("files", target);
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
}), "ui-sidebar-files: shortcut");
|
|
994
|
+
});
|
|
694
995
|
ctx.effect(() => ctx.sidebarRightTabs.register(filesDefinition(t)), "ui-sidebar-files: files type");
|
|
695
996
|
ctx.effect(() => ctx.locale.register(NS, {
|
|
696
997
|
zh,
|
|
697
998
|
en
|
|
698
999
|
}), "ui-sidebar-files: dictionaries");
|
|
699
1000
|
const store = createFilesStore();
|
|
700
|
-
const inject = filesFace(createList(ctx.remote));
|
|
1001
|
+
const inject = filesFace(createList(ctx.remote), createWatch(ctx.remote));
|
|
701
1002
|
ctx.effect(() => ctx.slots.inject("sidebar.right.pane.tab", () => ctx.slots.register({
|
|
702
1003
|
name: "sidebar.right.pane.tab",
|
|
703
1004
|
key: FILES_ID,
|