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,12 +8,280 @@ window.__ModuleLoader__.load({
|
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let react = require("react");
|
|
10
10
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
11
|
+
//#region lib/types/changes.js
|
|
12
|
+
/** Authenticated GET route serving one announced change summary while its Session lives. */
|
|
13
|
+
const CHANGED_FILES_PATH = "/api/changes.summary";
|
|
14
|
+
/** Authenticated GET route serving one listed file's turn-start and turn-end comparison while its Session lives. */
|
|
15
|
+
const CHANGES_DIFF_PATH = "/api/changes.diff";
|
|
16
|
+
/** Authenticated POST route for opening a changed file on the Host desktop. */
|
|
17
|
+
const CHANGES_OPEN_PATH = "/api/changes.open";
|
|
18
|
+
/**
|
|
19
|
+
* Browser-relative form of {@link CHANGED_FILES_PATH}; see
|
|
20
|
+
* .agents/notes/implemented/architecture/2026-09-14-web-document-relative-app-routes.md.
|
|
21
|
+
*/
|
|
22
|
+
const CHANGED_FILES_ROUTE = CHANGED_FILES_PATH.slice(1);
|
|
23
|
+
/** Browser-relative form of {@link CHANGES_DIFF_PATH}. */
|
|
24
|
+
const CHANGES_DIFF_ROUTE = CHANGES_DIFF_PATH.slice(1);
|
|
25
|
+
/** Browser-relative form of {@link CHANGES_OPEN_PATH}. */
|
|
26
|
+
const CHANGES_OPEN_ROUTE = CHANGES_OPEN_PATH.slice(1);
|
|
27
|
+
/** Resource-address prefix of a turn's review tab in the right Sidebar. */
|
|
28
|
+
const CHANGES_REVIEW_ADDRESS = "dsh-resource://changes-review/session/";
|
|
29
|
+
function isRecord$1(value) {
|
|
30
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validate one changed-file record read from the summary route.
|
|
34
|
+
* @param value - decoded JSON.
|
|
35
|
+
* @returns whether the record carries a path, a display path, and line counts.
|
|
36
|
+
*/
|
|
37
|
+
function isChangedFile(value) {
|
|
38
|
+
if (!isRecord$1(value)) return false;
|
|
39
|
+
const { path, display, added, deleted, binary, oversized } = value;
|
|
40
|
+
return typeof path === "string" && path.length > 0 && typeof display === "string" && display.length > 0 && Number.isSafeInteger(added) && Number.isSafeInteger(deleted) && (binary === void 0 || binary === true) && (oversized === void 0 || oversized === true);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Validate a summary read from the summary route.
|
|
44
|
+
* @param value - decoded JSON.
|
|
45
|
+
* @returns whether the value identifies a turn, a complete file list, the total count, and the line totals.
|
|
46
|
+
*/
|
|
47
|
+
function isChangesSummary(value) {
|
|
48
|
+
if (!isRecord$1(value)) return false;
|
|
49
|
+
const { turn, files, total, added, deleted } = value;
|
|
50
|
+
return Number.isSafeInteger(turn) && turn >= 1 && Number.isSafeInteger(total) && Number.isSafeInteger(added) && Number.isSafeInteger(deleted) && Array.isArray(files) && files.every(isChangedFile);
|
|
51
|
+
}
|
|
52
|
+
function isHunk(value) {
|
|
53
|
+
if (!isRecord$1(value)) return false;
|
|
54
|
+
const { oldStart, oldLines, newStart, newLines, lines } = value;
|
|
55
|
+
return [
|
|
56
|
+
oldStart,
|
|
57
|
+
oldLines,
|
|
58
|
+
newStart,
|
|
59
|
+
newLines
|
|
60
|
+
].every((field) => Number.isSafeInteger(field) && field >= 0) && Array.isArray(lines) && lines.every((line) => typeof line === "string" && /^[+ -]/.test(line));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Validate a comparison read from the comparison route.
|
|
64
|
+
* @param value - decoded JSON.
|
|
65
|
+
* @returns whether the value is a text comparison with well-formed hunks, or a binary or oversized refusal.
|
|
66
|
+
*/
|
|
67
|
+
function isChangesDiff(value) {
|
|
68
|
+
if (!isRecord$1(value)) return false;
|
|
69
|
+
const { kind, path, display } = value;
|
|
70
|
+
if (typeof path !== "string" || path.length === 0 || typeof display !== "string" || display.length === 0) return false;
|
|
71
|
+
if (kind === "binary" || kind === "oversized") return true;
|
|
72
|
+
if (kind !== "text") return false;
|
|
73
|
+
const { before, after, hunks, coarse } = value;
|
|
74
|
+
return typeof before === "boolean" && typeof after === "boolean" && typeof coarse === "boolean" && Array.isArray(hunks) && hunks.every(isHunk);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Validate the `workspace/changes` event data read from a Session log.
|
|
78
|
+
* @param value - decoded durable event data.
|
|
79
|
+
* @returns whether the event names a turn.
|
|
80
|
+
*/
|
|
81
|
+
function isChangesEvent(value) {
|
|
82
|
+
return isRecord$1(value) && Number.isSafeInteger(value.turn) && value.turn >= 1;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Build authenticated coordinates for the summary one `workspace/changes` event announced.
|
|
86
|
+
* @param sessionId - owning Session.
|
|
87
|
+
* @param seq - event sequence.
|
|
88
|
+
* @returns document-relative summary route.
|
|
89
|
+
*/
|
|
90
|
+
function changesSummaryUrl(sessionId, seq) {
|
|
91
|
+
return `${CHANGED_FILES_ROUTE}?${new URLSearchParams({
|
|
92
|
+
sessionId,
|
|
93
|
+
seq: String(seq)
|
|
94
|
+
})}`;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Build authenticated coordinates for one listed file's comparison.
|
|
98
|
+
* @param sessionId - owning Session.
|
|
99
|
+
* @param seq - workspace/changes event sequence.
|
|
100
|
+
* @param index - original index in the summary's files array.
|
|
101
|
+
* @returns document-relative comparison route.
|
|
102
|
+
*/
|
|
103
|
+
function changesDiffUrl(sessionId, seq, index) {
|
|
104
|
+
return `${CHANGES_DIFF_ROUTE}?${new URLSearchParams({
|
|
105
|
+
sessionId,
|
|
106
|
+
seq: String(seq),
|
|
107
|
+
index: String(index)
|
|
108
|
+
})}`;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Build authenticated coordinates for a changed file's native open.
|
|
112
|
+
* @param sessionId - owning Session.
|
|
113
|
+
* @param seq - workspace/changes event sequence.
|
|
114
|
+
* @param index - original index in the summary's files array.
|
|
115
|
+
* @returns document-relative action route.
|
|
116
|
+
*/
|
|
117
|
+
function changedFileUrl(sessionId, seq, index) {
|
|
118
|
+
return `${CHANGES_OPEN_ROUTE}?${new URLSearchParams({
|
|
119
|
+
sessionId,
|
|
120
|
+
seq: String(seq),
|
|
121
|
+
index: String(index)
|
|
122
|
+
})}`;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The right-Sidebar address of one turn's review. The Session and the event
|
|
126
|
+
* sequence identify the content; the turn rides along for the tab title.
|
|
127
|
+
* @param coordinates - viewed Session, announcing event, and turn.
|
|
128
|
+
* @returns a `dsh-resource://changes-review/session/…` address.
|
|
129
|
+
*/
|
|
130
|
+
function changesReviewAddress(coordinates) {
|
|
131
|
+
const { sessionId, seq, turn } = coordinates;
|
|
132
|
+
return `${CHANGES_REVIEW_ADDRESS}${encodeURIComponent(sessionId)}/${seq}/${turn}`;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Read the coordinates back out of a review address.
|
|
136
|
+
* @param address - a resource address.
|
|
137
|
+
* @returns the coordinates, or undefined for any other address.
|
|
138
|
+
*/
|
|
139
|
+
function parseChangesReviewAddress(address) {
|
|
140
|
+
if (!address.startsWith("dsh-resource://changes-review/session/")) return void 0;
|
|
141
|
+
const parts = address.slice(38).split("/");
|
|
142
|
+
if (parts.length !== 3) return void 0;
|
|
143
|
+
const [sessionId, seq, turn] = parts;
|
|
144
|
+
if (sessionId === "" || !/^\d+$/.test(seq) || !/^[1-9]\d*$/.test(turn)) return void 0;
|
|
145
|
+
try {
|
|
146
|
+
return {
|
|
147
|
+
sessionId: decodeURIComponent(sessionId),
|
|
148
|
+
seq: Number(seq),
|
|
149
|
+
turn: Number(turn)
|
|
150
|
+
};
|
|
151
|
+
} catch {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region lib/types/client/host-read-store.js
|
|
157
|
+
/**
|
|
158
|
+
* Fetch-once cache of Host-served records keyed by their authenticated URL:
|
|
159
|
+
* one read per URL while a state stands, cleared on connection replacement,
|
|
160
|
+
* cancelled on disposal. Each store decides what a response means and which
|
|
161
|
+
* states a later request reads again.
|
|
162
|
+
*/
|
|
163
|
+
/** One browser plugin's reads of one record kind. */
|
|
164
|
+
var HostReadStore = class {
|
|
165
|
+
policy;
|
|
166
|
+
/** Record URLs key the state across Sessions and turns. */
|
|
167
|
+
state = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({});
|
|
168
|
+
lifetime = new AbortController();
|
|
169
|
+
/** The connection generation the current states belong to; a reset aborts it so no older read publishes. */
|
|
170
|
+
generation = new AbortController();
|
|
171
|
+
pending = /* @__PURE__ */ new Set();
|
|
172
|
+
constructor(policy) {
|
|
173
|
+
this.policy = policy;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Read one URL unless a state the policy keeps already stands for it.
|
|
177
|
+
* @param url - the record's authenticated URL.
|
|
178
|
+
* @returns after the state is published.
|
|
179
|
+
*/
|
|
180
|
+
async loadUrl(url) {
|
|
181
|
+
const current = this.state.getSnapshot()[url];
|
|
182
|
+
if (this.lifetime.signal.aborted || current !== void 0 && !this.policy.retryable(current)) return;
|
|
183
|
+
this.state.update((state) => {
|
|
184
|
+
state[url] = this.policy.loading;
|
|
185
|
+
});
|
|
186
|
+
const task = this.read(url, AbortSignal.any([this.lifetime.signal, this.generation.signal]));
|
|
187
|
+
this.pending.add(task);
|
|
188
|
+
try {
|
|
189
|
+
await task;
|
|
190
|
+
} finally {
|
|
191
|
+
this.pending.delete(task);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/** Forget every state and abandon in-flight reads; a replaced connection may reach a Host that no longer serves them. */
|
|
195
|
+
reset() {
|
|
196
|
+
this.generation.abort();
|
|
197
|
+
this.generation = new AbortController();
|
|
198
|
+
this.state.set({});
|
|
199
|
+
}
|
|
200
|
+
/** Cancel outstanding reads and wait until none can publish state. */
|
|
201
|
+
async dispose() {
|
|
202
|
+
this.lifetime.abort();
|
|
203
|
+
await Promise.all(this.pending);
|
|
204
|
+
}
|
|
205
|
+
async read(url, signal) {
|
|
206
|
+
let next;
|
|
207
|
+
try {
|
|
208
|
+
next = await this.policy.decode(await fetch(url, { signal }));
|
|
209
|
+
} catch {
|
|
210
|
+
next = this.policy.failed;
|
|
211
|
+
}
|
|
212
|
+
if (!signal.aborted) this.state.update((state) => {
|
|
213
|
+
state[url] = next;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region lib/types/client/changes-diff.js
|
|
219
|
+
/** One browser plugin's comparison reads; a failed read is the one state a later request replaces. */
|
|
220
|
+
var ChangesDiffStore = class extends HostReadStore {
|
|
221
|
+
constructor() {
|
|
222
|
+
super({
|
|
223
|
+
loading: "loading",
|
|
224
|
+
failed: "error",
|
|
225
|
+
retryable: (state) => state === "error",
|
|
226
|
+
decode: async (response) => {
|
|
227
|
+
if (response.status === 404) return "missing";
|
|
228
|
+
if (!response.ok) return "error";
|
|
229
|
+
const value = await response.json();
|
|
230
|
+
return isChangesDiff(value) ? value : "error";
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Read one comparison; a cached comparison or a missing one is kept, a failed one is read again.
|
|
236
|
+
* @param sessionId - viewed Session.
|
|
237
|
+
* @param seq - the announcing event's sequence.
|
|
238
|
+
* @param index - the file's index in the summary.
|
|
239
|
+
* @returns after the state is published.
|
|
240
|
+
*/
|
|
241
|
+
load(sessionId, seq, index) {
|
|
242
|
+
return this.loadUrl(changesDiffUrl(sessionId, seq, index));
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region lib/types/client/changes-summary.js
|
|
247
|
+
/** One browser plugin's summary reads; a summary or a missing answer is kept until the connection is replaced. */
|
|
248
|
+
var ChangesSummaryStore = class extends HostReadStore {
|
|
249
|
+
constructor() {
|
|
250
|
+
super({
|
|
251
|
+
loading: "loading",
|
|
252
|
+
failed: "missing",
|
|
253
|
+
retryable: () => false,
|
|
254
|
+
decode: async (response) => {
|
|
255
|
+
if (!response.ok) return "missing";
|
|
256
|
+
const value = await response.json();
|
|
257
|
+
return isChangesSummary(value) ? value : "missing";
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Read one summary once; a later read of the same coordinates returns the cached state.
|
|
263
|
+
* @param sessionId - viewed Session.
|
|
264
|
+
* @param seq - the announcing event's sequence.
|
|
265
|
+
* @returns after the state is published.
|
|
266
|
+
*/
|
|
267
|
+
load(sessionId, seq) {
|
|
268
|
+
return this.loadUrl(changesSummaryUrl(sessionId, seq));
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
//#endregion
|
|
11
272
|
//#region lib/types/presented.js
|
|
12
273
|
/** Authenticated POST route for opening a workspace file on the Host desktop. */
|
|
13
274
|
const PRESENT_OPEN_PATH = "/api/present.open";
|
|
14
275
|
/** Authenticated desktop availability and destination metadata. */
|
|
15
276
|
const PRESENT_HOST_PATH = "/api/present.host";
|
|
16
277
|
/**
|
|
278
|
+
* Browser-relative form of {@link PRESENT_OPEN_PATH}; see
|
|
279
|
+
* .agents/notes/implemented/architecture/2026-09-14-web-document-relative-app-routes.md.
|
|
280
|
+
*/
|
|
281
|
+
const PRESENT_OPEN_ROUTE = PRESENT_OPEN_PATH.slice(1);
|
|
282
|
+
/** Browser-relative form of {@link PRESENT_HOST_PATH}. */
|
|
283
|
+
const PRESENT_HOST_ROUTE = PRESENT_HOST_PATH.slice(1);
|
|
284
|
+
/**
|
|
17
285
|
* Validate desktop metadata received over HTTP.
|
|
18
286
|
* @param value - decoded response.
|
|
19
287
|
* @returns whether all displayed and actionable fields are supported.
|
|
@@ -38,10 +306,10 @@ window.__ModuleLoader__.load({
|
|
|
38
306
|
* @param sessionId - owning Session.
|
|
39
307
|
* @param seq - deliverables/presented event sequence.
|
|
40
308
|
* @param index - original index in the event's files array.
|
|
41
|
-
* @returns
|
|
309
|
+
* @returns document-relative file action route.
|
|
42
310
|
*/
|
|
43
311
|
function presentedFileUrl(sessionId, seq, index) {
|
|
44
|
-
return `${
|
|
312
|
+
return `${PRESENT_OPEN_ROUTE}?${new URLSearchParams({
|
|
45
313
|
sessionId,
|
|
46
314
|
seq: String(seq),
|
|
47
315
|
index: String(index)
|
|
@@ -68,13 +336,16 @@ window.__ModuleLoader__.load({
|
|
|
68
336
|
}
|
|
69
337
|
//#endregion
|
|
70
338
|
//#region lib/types/client/present-open.js
|
|
71
|
-
/** Shared native-open status for delivery cards and closing-message file mentions. */
|
|
339
|
+
/** Shared native-open status for delivery cards, the changed-files card, and closing-message file mentions. */
|
|
340
|
+
/** Success feedback remains fully visible for five seconds before fading. */
|
|
341
|
+
const PRESENTED_SUCCESS_HOLD_MS = 5e3;
|
|
72
342
|
/** One browser plugin's file-open requests, cancelled when that plugin is disposed. */
|
|
73
343
|
var PresentedOpenController = class {
|
|
74
344
|
/** File action URLs key the state across Sessions, turns, and both clickable surfaces. */
|
|
75
345
|
state = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({});
|
|
76
346
|
/** Native destination metadata, or a retryable read failure. */
|
|
77
347
|
host = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(null);
|
|
348
|
+
expiry = /* @__PURE__ */ new Map();
|
|
78
349
|
loading;
|
|
79
350
|
metadata = new AbortController();
|
|
80
351
|
lifetime = new AbortController();
|
|
@@ -86,19 +357,35 @@ window.__ModuleLoader__.load({
|
|
|
86
357
|
* @param seq - durable delivery event sequence.
|
|
87
358
|
* @param index - original file index within that event.
|
|
88
359
|
* @param action - default application open or file-manager reveal.
|
|
89
|
-
* @
|
|
360
|
+
* @param application - registered handler identifier for an explicit application choice.
|
|
361
|
+
* @returns null after a successful handoff, or the failure to announce after publishing card status.
|
|
90
362
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
363
|
+
open(sessionId, seq, index, action = "open", application) {
|
|
364
|
+
return this.openUrl(presentedFileUrl(sessionId, seq, index), action, application);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Open one recorded changed file in the Host's default application.
|
|
368
|
+
* @param sessionId - viewed Session.
|
|
369
|
+
* @param seq - durable workspace/changes event sequence.
|
|
370
|
+
* @param index - original file index within that event.
|
|
371
|
+
* @param action - application open or file-manager reveal.
|
|
372
|
+
* @param application - registered handler identifier for an explicit application choice.
|
|
373
|
+
* @returns null after a successful handoff, or the failure to announce after publishing card status.
|
|
374
|
+
*/
|
|
375
|
+
openChanged(sessionId, seq, index, action = "open", application) {
|
|
376
|
+
return this.openUrl(changedFileUrl(sessionId, seq, index), action, application);
|
|
377
|
+
}
|
|
378
|
+
async openUrl(url, action, application) {
|
|
93
379
|
const phase = this.state.getSnapshot()[url];
|
|
94
|
-
if (this.lifetime.signal.aborted || phase === "opening" || phase === "revealing") return;
|
|
380
|
+
if (this.lifetime.signal.aborted || phase === "opening" || phase === "revealing") return null;
|
|
381
|
+
this.clearExpiry(url);
|
|
95
382
|
this.state.update((state) => {
|
|
96
383
|
state[url] = action === "open" ? "opening" : "revealing";
|
|
97
384
|
});
|
|
98
|
-
const task = this.request(url, action);
|
|
385
|
+
const task = this.request(url, action, application);
|
|
99
386
|
this.pending.add(task);
|
|
100
387
|
try {
|
|
101
|
-
await task;
|
|
388
|
+
return await task;
|
|
102
389
|
} finally {
|
|
103
390
|
this.pending.delete(task);
|
|
104
391
|
}
|
|
@@ -133,7 +420,7 @@ window.__ModuleLoader__.load({
|
|
|
133
420
|
async readHost(signal) {
|
|
134
421
|
let host = "error";
|
|
135
422
|
try {
|
|
136
|
-
const response = await fetch(
|
|
423
|
+
const response = await fetch(PRESENT_HOST_ROUTE, { signal });
|
|
137
424
|
if (response.ok) {
|
|
138
425
|
const value = await response.json();
|
|
139
426
|
if (isPresentedHost(value)) host = value;
|
|
@@ -146,13 +433,19 @@ window.__ModuleLoader__.load({
|
|
|
146
433
|
/** Cancel outstanding requests and wait until no request can publish state. */
|
|
147
434
|
async dispose() {
|
|
148
435
|
this.lifetime.abort();
|
|
436
|
+
for (const url of this.expiry.keys()) this.clearExpiry(url);
|
|
149
437
|
await Promise.all(this.pending);
|
|
150
438
|
}
|
|
151
|
-
|
|
439
|
+
clearExpiry(url) {
|
|
440
|
+
clearTimeout(this.expiry.get(url));
|
|
441
|
+
this.expiry.delete(url);
|
|
442
|
+
}
|
|
443
|
+
async request(url, action, application) {
|
|
152
444
|
const failure = action === "open" ? "error" : "revealError";
|
|
153
445
|
let phase = action === "open" ? "opened" : "revealed";
|
|
154
446
|
try {
|
|
155
|
-
const
|
|
447
|
+
const target = action === "reveal" ? `${url}&action=reveal` : application === void 0 ? url : `${url}&application=${encodeURIComponent(application)}`;
|
|
448
|
+
const response = await fetch(target, {
|
|
156
449
|
method: "POST",
|
|
157
450
|
signal: this.lifetime.signal
|
|
158
451
|
});
|
|
@@ -160,20 +453,29 @@ window.__ModuleLoader__.load({
|
|
|
160
453
|
} catch {
|
|
161
454
|
phase = failure;
|
|
162
455
|
}
|
|
163
|
-
if (!this.lifetime.signal.aborted)
|
|
164
|
-
|
|
165
|
-
|
|
456
|
+
if (!this.lifetime.signal.aborted) {
|
|
457
|
+
if (phase === "opened" || phase === "revealed") this.expiry.set(url, setTimeout(() => {
|
|
458
|
+
this.expiry.delete(url);
|
|
459
|
+
this.state.update((state) => {
|
|
460
|
+
Reflect.deleteProperty(state, url);
|
|
461
|
+
});
|
|
462
|
+
}, 5200));
|
|
463
|
+
this.state.update((state) => {
|
|
464
|
+
state[url] = phase;
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
return phase === "opened" || phase === "revealed" ? null : action === "reveal" ? "revealError" : "openError";
|
|
166
468
|
}
|
|
167
469
|
};
|
|
168
470
|
//#endregion
|
|
169
471
|
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-deliverables/src/client/PresentRow.module.css.mjs
|
|
170
|
-
const css$
|
|
171
|
-
const tagId$
|
|
172
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
472
|
+
const css$4 = "._93YTAG_summary{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;margin-left:8px;font-size:12px;display:flex}._93YTAG_summary>:first-child{flex-shrink:0}._93YTAG_paths{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._93YTAG_output{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);white-space:pre-wrap;overflow-wrap:anywhere;margin:8px 0;padding:12px;font-size:12px}._93YTAG_inspect{color:var(--dsw-alias-link);font:inherit;cursor:pointer;background:0 0;border:none;align-self:flex-start;padding:4px 0;font-size:12px}";
|
|
473
|
+
const tagId$4 = "@deepseek-ai/dsh-client-ui-deliverables/PresentRow.module.css";
|
|
474
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
|
|
173
475
|
const tag = document.createElement("style");
|
|
174
476
|
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-deliverables";
|
|
175
|
-
tag.dataset.pluginCss = tagId$
|
|
176
|
-
tag.textContent = css$
|
|
477
|
+
tag.dataset.pluginCss = tagId$4;
|
|
478
|
+
tag.textContent = css$4;
|
|
177
479
|
document.head.appendChild(tag);
|
|
178
480
|
}
|
|
179
481
|
var PresentRow_module_css_default = {
|
|
@@ -185,6 +487,8 @@ window.__ModuleLoader__.load({
|
|
|
185
487
|
//#endregion
|
|
186
488
|
//#region lib/types/client/PresentRow.js
|
|
187
489
|
/** Present call status and expandable durable result text. */
|
|
490
|
+
/* v8 ignore next -- Non-expandable rows never invoke DisclosureRow's required toggle callback. */
|
|
491
|
+
const noop = () => void 0;
|
|
188
492
|
/** Raw arguments can be partial while a call is streaming. */
|
|
189
493
|
function fileNames(raw) {
|
|
190
494
|
let args;
|
|
@@ -201,7 +505,25 @@ window.__ModuleLoader__.load({
|
|
|
201
505
|
* @param props - tool call and localized status copy.
|
|
202
506
|
* @returns a status row with a result disclosure.
|
|
203
507
|
*/
|
|
204
|
-
function PresentRow(
|
|
508
|
+
function PresentRow(props) {
|
|
509
|
+
return props.phase === "preparing" ? (0, react_jsx_runtime.jsx)(PreparingPresentRow, { ...props }) : (0, react_jsx_runtime.jsx)(StartedPresentRow, { ...props });
|
|
510
|
+
}
|
|
511
|
+
function PreparingPresentRow({ t }) {
|
|
512
|
+
return (0, react_jsx_runtime.jsx)("div", {
|
|
513
|
+
"data-tool": "present",
|
|
514
|
+
"data-state": "preparing",
|
|
515
|
+
"aria-label": t("row.preparing"),
|
|
516
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
|
|
517
|
+
title: t("row.title"),
|
|
518
|
+
icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDeliverDocRegular, { size: 14 }),
|
|
519
|
+
open: false,
|
|
520
|
+
expandable: false,
|
|
521
|
+
onToggle: noop,
|
|
522
|
+
running: true
|
|
523
|
+
})
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
function StartedPresentRow({ block, inspect, t }) {
|
|
205
527
|
const settled = "kind" in block;
|
|
206
528
|
const state = !settled ? "running" : block.error?.code === "interrupted" ? "stopped" : block.isError ? "error" : "ok";
|
|
207
529
|
const args = (settled ? block.call?.argsRaw : block.argsRaw) ?? "";
|
|
@@ -212,7 +534,7 @@ window.__ModuleLoader__.load({
|
|
|
212
534
|
"data-state": state,
|
|
213
535
|
children: (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
|
|
214
536
|
title: t("row.title"),
|
|
215
|
-
icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.
|
|
537
|
+
icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDeliverDocRegular, { size: 14 }),
|
|
216
538
|
open: expanded && details !== "",
|
|
217
539
|
expandable: details !== "",
|
|
218
540
|
expandOnRowClick: true,
|
|
@@ -240,10 +562,475 @@ window.__ModuleLoader__.load({
|
|
|
240
562
|
});
|
|
241
563
|
}
|
|
242
564
|
//#endregion
|
|
565
|
+
//#region ../../util/workspace-path/lib/index.js
|
|
566
|
+
/**
|
|
567
|
+
* The `dsh-resource://file/…` address grammar: how a file is named across the
|
|
568
|
+
* Sidebar and the resource model, built and parsed without touching a
|
|
569
|
+
* filesystem.
|
|
570
|
+
* @module
|
|
571
|
+
*/
|
|
572
|
+
/** The scheme and type every file address opens with. */
|
|
573
|
+
const FILE_ADDRESS_PREFIX = "dsh-resource://file/";
|
|
574
|
+
/** Component-encode one id or path segment, keeping `:` literal for drive letters. */
|
|
575
|
+
function encodeSegment(segment) {
|
|
576
|
+
return encodeURIComponent(segment).replace(/%3A/gi, ":");
|
|
577
|
+
}
|
|
578
|
+
/** Encode a `/`-separated path segment by segment. */
|
|
579
|
+
function encodePath(path) {
|
|
580
|
+
return path.split("/").map(encodeSegment).join("/");
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Build the address of a file read through one Session.
|
|
584
|
+
* @param sessionId - the Session whose Host workspace resolves the path.
|
|
585
|
+
* @param path - absolute or workspace-relative path; backslashes are normalized to `/`, and leading `./` prefixes are dropped.
|
|
586
|
+
* @returns the `dsh-resource://file/session/<sessionId>/<path>` address.
|
|
587
|
+
*/
|
|
588
|
+
function sessionFileAddress(sessionId, path) {
|
|
589
|
+
const normalized = path.replace(/\\/g, "/").replace(/^(?:\.\/)+/, "");
|
|
590
|
+
return `${FILE_ADDRESS_PREFIX}session/${encodeSegment(sessionId)}/${encodePath(normalized)}`;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Browser-safe Workspace path and display helpers.
|
|
594
|
+
* @module @deepseek-ai/dsh-util-workspace-path
|
|
595
|
+
*/
|
|
596
|
+
/** Whether a path uses a Windows drive or UNC prefix. */
|
|
597
|
+
function isWindowsStylePath(value) {
|
|
598
|
+
return /^[A-Za-z]:[/\\]/.test(value) || value.startsWith("\\\\");
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Whether a path is absolute in either spelling the Host accepts: POSIX (`/a/b`) or Windows drive or UNC.
|
|
602
|
+
* @param path - the path to classify.
|
|
603
|
+
* @returns `true` for an absolute path; `false` for a Workspace-relative one.
|
|
604
|
+
*/
|
|
605
|
+
function isAbsoluteWorkspacePath(path) {
|
|
606
|
+
return path.startsWith("/") || isWindowsStylePath(path);
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Resolve a Workspace-relative path into the Host-facing spelling used by path operations.
|
|
610
|
+
* @param cwd - Session Workspace root, when known.
|
|
611
|
+
* @param path - Absolute or Workspace-relative path.
|
|
612
|
+
* @returns an absolute path when a Workspace root is available, otherwise the original path.
|
|
613
|
+
*/
|
|
614
|
+
function resolveWorkspacePath(cwd, path) {
|
|
615
|
+
if (isAbsoluteWorkspacePath(path)) return path;
|
|
616
|
+
if (cwd === void 0 || cwd === "") return path;
|
|
617
|
+
const separator = isWindowsStylePath(cwd) && cwd.includes("\\") ? "\\" : "/";
|
|
618
|
+
return `${cwd.replace(/[/\\]+$/, "")}${separator}${path.replace(/^[/\\]+/, "")}`;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* The address for a path as a caller holds it: a relative path, or an absolute
|
|
622
|
+
* path inside the Session's workspace, becomes a `session`-scoped address; an
|
|
623
|
+
* absolute path outside it, or one whose workspace root is unknown, keeps its
|
|
624
|
+
* absolute path in that Session's address.
|
|
625
|
+
* @param sessionId - the Session the path is read in.
|
|
626
|
+
* @param cwd - that Session's workspace root, when known.
|
|
627
|
+
* @param path - absolute or workspace-relative path, in either separator spelling.
|
|
628
|
+
* @returns the `dsh-resource://file/…` address.
|
|
629
|
+
*/
|
|
630
|
+
function fileAddressFor(sessionId, cwd, path) {
|
|
631
|
+
const normalized = path.replace(/\\/g, "/");
|
|
632
|
+
if (!isAbsoluteWorkspacePath(normalized)) return sessionFileAddress(sessionId, normalized);
|
|
633
|
+
const root = cwd === void 0 ? "" : cwd.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
634
|
+
if (root !== "" && normalized === root) return sessionFileAddress(sessionId, "");
|
|
635
|
+
if (root !== "" && normalized.startsWith(`${root}/`)) return sessionFileAddress(sessionId, normalized.slice(root.length + 1));
|
|
636
|
+
return sessionFileAddress(sessionId, normalized);
|
|
637
|
+
}
|
|
638
|
+
//#endregion
|
|
639
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-deliverables/src/client/FileDiff.module.css.mjs
|
|
640
|
+
const css$3 = ".IP6KhG_root{--diff-empty-fill:color-mix(in srgb, var(--dsw-alias-interactive-bg-hover) 50%, transparent);box-sizing:border-box;width:100%;min-height:0;color:var(--dsw-alias-label-primary);flex-direction:column;display:flex}.IP6KhG_header{box-sizing:border-box;border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:6px;height:38px;padding:0 6px 0 8px;display:flex}.IP6KhG_status{color:var(--dsw-alias-label-secondary);align-items:center;gap:12px;margin:0;padding:16px;font-size:13px;display:flex}.IP6KhG_body{min-height:0;font:var(--dsw-font-markdown-code-block);flex-direction:column;flex:auto;padding:8px 0 16px;display:flex;overflow:auto}.IP6KhG_columns{flex:auto;grid-template-columns:minmax(0,1fr) minmax(0,1fr);min-height:0;display:grid}.IP6KhG_column,.IP6KhG_body[data-review-view=unified]:not([data-review-wrap]){grid-template-columns:minmax(max-content,100%);align-content:start;display:grid}.IP6KhG_column{overscroll-behavior:none;min-width:0;overflow-x:scroll}.IP6KhG_column+.IP6KhG_column{border-left:.5px solid var(--dsw-alias-border-l3)}.IP6KhG_sideLine{box-sizing:border-box;white-space:pre;grid-template-columns:3.5em max-content;width:max-content;min-width:100%;min-height:22px;line-height:22px;display:grid}.IP6KhG_note{font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary);margin:0;padding:4px 16px 8px}.IP6KhG_hunk{margin-bottom:8px}.IP6KhG_hunkHeader{color:var(--dsw-alias-label-tertiary);white-space:pre;padding:4px 16px}.IP6KhG_line{box-sizing:border-box;white-space:pre;grid-template-columns:3.5em 3.5em 1.2em minmax(0,1fr);min-height:22px;line-height:22px;display:grid}.IP6KhG_splitLine{white-space:pre;grid-template-columns:minmax(0,1fr) minmax(0,1fr);min-height:22px;line-height:22px;display:grid}.IP6KhG_cell{box-sizing:border-box;grid-template-columns:3.5em minmax(0,1fr);min-width:0;display:grid}.IP6KhG_cell+.IP6KhG_cell{border-left:.5px solid var(--dsw-alias-border-l3)}.IP6KhG_number{color:var(--dsw-alias-label-tertiary);text-align:right;user-select:none;padding-right:8px}.IP6KhG_sign{text-align:center;user-select:none}.IP6KhG_text{padding-right:16px}.IP6KhG_body[data-review-wrap] .IP6KhG_line,.IP6KhG_body[data-review-wrap] .IP6KhG_splitLine{white-space:pre-wrap}.IP6KhG_body[data-review-wrap] .IP6KhG_text{overflow-wrap:anywhere}.IP6KhG_add{--diff-gutter-fill:var(--dsw-alias-file-diff-added-gutter);--diff-marker:var(--dsw-alias-file-diff-added-marker);background:var(--dsw-alias-file-diff-added-bg)}.IP6KhG_del{--diff-gutter-fill:var(--dsw-alias-file-diff-deleted-gutter);--diff-marker:var(--dsw-alias-file-diff-deleted-marker);background:var(--dsw-alias-file-diff-deleted-bg)}.IP6KhG_add .IP6KhG_number,.IP6KhG_del .IP6KhG_number{background:var(--diff-gutter-fill);color:var(--diff-marker)}.IP6KhG_add .IP6KhG_number:first-child,.IP6KhG_del .IP6KhG_number:first-child{box-shadow:inset 3px 0 0 var(--diff-marker)}.IP6KhG_add .IP6KhG_sign,.IP6KhG_del .IP6KhG_sign{color:var(--diff-marker)}.IP6KhG_context .IP6KhG_text{color:var(--dsw-alias-label-secondary)}.IP6KhG_empty{background:var(--diff-empty-fill)}";
|
|
641
|
+
const tagId$3 = "@deepseek-ai/dsh-client-ui-deliverables/FileDiff.module.css";
|
|
642
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
|
|
643
|
+
const tag = document.createElement("style");
|
|
644
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-deliverables";
|
|
645
|
+
tag.dataset.pluginCss = tagId$3;
|
|
646
|
+
tag.textContent = css$3;
|
|
647
|
+
document.head.appendChild(tag);
|
|
648
|
+
}
|
|
649
|
+
var FileDiff_module_css_default = {
|
|
650
|
+
"add": "IP6KhG_add",
|
|
651
|
+
"body": "IP6KhG_body",
|
|
652
|
+
"cell": "IP6KhG_cell",
|
|
653
|
+
"column": "IP6KhG_column",
|
|
654
|
+
"columns": "IP6KhG_columns",
|
|
655
|
+
"context": "IP6KhG_context",
|
|
656
|
+
"del": "IP6KhG_del",
|
|
657
|
+
"empty": "IP6KhG_empty",
|
|
658
|
+
"header": "IP6KhG_header",
|
|
659
|
+
"hunk": "IP6KhG_hunk",
|
|
660
|
+
"hunkHeader": "IP6KhG_hunkHeader",
|
|
661
|
+
"line": "IP6KhG_line",
|
|
662
|
+
"note": "IP6KhG_note",
|
|
663
|
+
"number": "IP6KhG_number",
|
|
664
|
+
"root": "IP6KhG_root",
|
|
665
|
+
"sideLine": "IP6KhG_sideLine",
|
|
666
|
+
"sign": "IP6KhG_sign",
|
|
667
|
+
"splitLine": "IP6KhG_splitLine",
|
|
668
|
+
"status": "IP6KhG_status",
|
|
669
|
+
"text": "IP6KhG_text"
|
|
670
|
+
};
|
|
671
|
+
//#endregion
|
|
672
|
+
//#region lib/types/client/FileDiff.js
|
|
673
|
+
/** Shared file comparison for the turn-tail hover preview and Sidebar review. */
|
|
674
|
+
/** Maximum rendered lines per comparison. */
|
|
675
|
+
const MAX_RENDERED_LINES = 5e3;
|
|
676
|
+
function highlightedSide(rows, side, highlighter) {
|
|
677
|
+
const source = rows.flatMap((row) => {
|
|
678
|
+
const no = row[side];
|
|
679
|
+
return no === void 0 ? [] : [{
|
|
680
|
+
no,
|
|
681
|
+
text: row.text
|
|
682
|
+
}];
|
|
683
|
+
});
|
|
684
|
+
if (source.length === 0) return /* @__PURE__ */ new Map();
|
|
685
|
+
const highlighted = highlighter(source.map((line) => line.text).join("\n"));
|
|
686
|
+
if (highlighted === void 0) return void 0;
|
|
687
|
+
return new Map(source.map((line, index) => {
|
|
688
|
+
return [line.no, highlighted[index] ?? []];
|
|
689
|
+
}));
|
|
690
|
+
}
|
|
691
|
+
function hunkHighlights(hunk, highlighter) {
|
|
692
|
+
const rows = hunkRows(hunk);
|
|
693
|
+
return {
|
|
694
|
+
old: highlightedSide(rows, "old", highlighter),
|
|
695
|
+
new: highlightedSide(rows, "new", highlighter)
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
function DiffText({ text, spans }) {
|
|
699
|
+
return (0, react_jsx_runtime.jsx)("span", {
|
|
700
|
+
className: FileDiff_module_css_default.text,
|
|
701
|
+
"data-diff-code": spans === void 0 ? void 0 : "",
|
|
702
|
+
children: spans === void 0 ? text : spans.map((span, index) => (0, react_jsx_runtime.jsx)("span", {
|
|
703
|
+
style: span.style,
|
|
704
|
+
children: span.text
|
|
705
|
+
}, index))
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Number a hunk's lines: context lines count on both sides, deletions on the
|
|
710
|
+
* old side, additions on the new side.
|
|
711
|
+
* @param hunk - a served hunk.
|
|
712
|
+
* @returns the rows in order.
|
|
713
|
+
*/
|
|
714
|
+
function hunkRows(hunk) {
|
|
715
|
+
let oldNo = hunk.oldStart;
|
|
716
|
+
let newNo = hunk.newStart;
|
|
717
|
+
return hunk.lines.map((line) => {
|
|
718
|
+
const text = line.slice(1);
|
|
719
|
+
switch (line[0]) {
|
|
720
|
+
case "+": return {
|
|
721
|
+
kind: "add",
|
|
722
|
+
old: void 0,
|
|
723
|
+
new: newNo++,
|
|
724
|
+
text
|
|
725
|
+
};
|
|
726
|
+
case "-": return {
|
|
727
|
+
kind: "del",
|
|
728
|
+
old: oldNo++,
|
|
729
|
+
new: void 0,
|
|
730
|
+
text
|
|
731
|
+
};
|
|
732
|
+
default: return {
|
|
733
|
+
kind: "context",
|
|
734
|
+
old: oldNo++,
|
|
735
|
+
new: newNo++,
|
|
736
|
+
text
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Pair a hunk's lines for the side-by-side view: each run of deletions is
|
|
743
|
+
* aligned with the run of additions that follows it, row by row, and context
|
|
744
|
+
* lines sit on both sides.
|
|
745
|
+
* @param hunk - a served hunk.
|
|
746
|
+
* @returns the rows in order.
|
|
747
|
+
*/
|
|
748
|
+
function splitRows(hunk) {
|
|
749
|
+
const rows = [];
|
|
750
|
+
let dels = [];
|
|
751
|
+
let adds = [];
|
|
752
|
+
const flush = () => {
|
|
753
|
+
for (let at = 0; at < Math.max(dels.length, adds.length); at += 1) {
|
|
754
|
+
const left = dels[at];
|
|
755
|
+
const right = adds[at];
|
|
756
|
+
rows.push({
|
|
757
|
+
...left === void 0 ? {} : { left },
|
|
758
|
+
...right === void 0 ? {} : { right }
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
dels = [];
|
|
762
|
+
adds = [];
|
|
763
|
+
};
|
|
764
|
+
for (const row of hunkRows(hunk)) if (row.kind === "del") dels.push({
|
|
765
|
+
no: row.old,
|
|
766
|
+
text: row.text,
|
|
767
|
+
kind: "del"
|
|
768
|
+
});
|
|
769
|
+
else if (row.kind === "add") adds.push({
|
|
770
|
+
no: row.new,
|
|
771
|
+
text: row.text,
|
|
772
|
+
kind: "add"
|
|
773
|
+
});
|
|
774
|
+
else {
|
|
775
|
+
flush();
|
|
776
|
+
rows.push({
|
|
777
|
+
left: {
|
|
778
|
+
no: row.old,
|
|
779
|
+
text: row.text,
|
|
780
|
+
kind: "context"
|
|
781
|
+
},
|
|
782
|
+
right: {
|
|
783
|
+
no: row.new,
|
|
784
|
+
text: row.text,
|
|
785
|
+
kind: "context"
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
flush();
|
|
790
|
+
return rows;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* The hunks to draw, cut at {@link MAX_RENDERED_LINES} lines in total.
|
|
794
|
+
* @param hunks - served hunks.
|
|
795
|
+
* @returns the hunks with the last one shortened as needed, and whether anything was cut.
|
|
796
|
+
*/
|
|
797
|
+
function renderedHunks(hunks) {
|
|
798
|
+
let budget = MAX_RENDERED_LINES;
|
|
799
|
+
const kept = [];
|
|
800
|
+
for (const hunk of hunks) {
|
|
801
|
+
if (budget === 0) return {
|
|
802
|
+
hunks: kept,
|
|
803
|
+
truncated: true
|
|
804
|
+
};
|
|
805
|
+
kept.push(hunk.lines.length <= budget ? hunk : {
|
|
806
|
+
...hunk,
|
|
807
|
+
lines: hunk.lines.slice(0, budget)
|
|
808
|
+
});
|
|
809
|
+
budget -= Math.min(budget, hunk.lines.length);
|
|
810
|
+
}
|
|
811
|
+
return {
|
|
812
|
+
hunks: kept,
|
|
813
|
+
truncated: hunks.some((hunk, at) => kept[at] !== hunk)
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
/** The one-line fact about a text comparison worth stating above its hunks, if any. */
|
|
817
|
+
function noteOf(diff) {
|
|
818
|
+
if (!diff.before) return "diff.created";
|
|
819
|
+
if (!diff.after) return "diff.deleted";
|
|
820
|
+
if (diff.hunks.length === 0) return "diff.unchanged";
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Render a file comparison with the same states and highlighting in previews and review tabs.
|
|
824
|
+
* Addition-only and deletion-only comparisons use one column without changing the requested layout.
|
|
825
|
+
* @param props - comparison state, layout choices, retry action, and localized copy.
|
|
826
|
+
* @returns the comparison or its loading, unavailable, or error state.
|
|
827
|
+
*/
|
|
828
|
+
function FileDiff({ state, split, wrap, retry, t }) {
|
|
829
|
+
if (state === void 0 || state === "loading") return (0, react_jsx_runtime.jsx)("p", {
|
|
830
|
+
className: FileDiff_module_css_default.status,
|
|
831
|
+
role: "status",
|
|
832
|
+
children: t("diff.loading")
|
|
833
|
+
});
|
|
834
|
+
if (state === "missing") return (0, react_jsx_runtime.jsx)("p", {
|
|
835
|
+
className: FileDiff_module_css_default.status,
|
|
836
|
+
children: t("diff.missing")
|
|
837
|
+
});
|
|
838
|
+
if (state === "error") return (0, react_jsx_runtime.jsxs)("div", {
|
|
839
|
+
className: FileDiff_module_css_default.status,
|
|
840
|
+
children: [(0, react_jsx_runtime.jsx)("span", { children: t("diff.error") }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
841
|
+
size: "sm",
|
|
842
|
+
onClick: retry,
|
|
843
|
+
children: t("presented.retry")
|
|
844
|
+
})]
|
|
845
|
+
});
|
|
846
|
+
if (state.kind === "binary") return (0, react_jsx_runtime.jsx)("p", {
|
|
847
|
+
className: FileDiff_module_css_default.status,
|
|
848
|
+
children: t("diff.binary")
|
|
849
|
+
});
|
|
850
|
+
if (state.kind === "oversized") return (0, react_jsx_runtime.jsx)("p", {
|
|
851
|
+
className: FileDiff_module_css_default.status,
|
|
852
|
+
children: t("diff.oversized")
|
|
853
|
+
});
|
|
854
|
+
const oneSided = state.hunks.some((hunk) => hunk.lines.some((line) => line.startsWith("+"))) !== state.hunks.some((hunk) => hunk.lines.some((line) => line.startsWith("-")));
|
|
855
|
+
return (0, react_jsx_runtime.jsx)(TextDiff, {
|
|
856
|
+
diff: state,
|
|
857
|
+
split: split && !oneSided,
|
|
858
|
+
wrap,
|
|
859
|
+
t
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
/** The kind a paired row carries: a deletion or addition on either side, otherwise context. */
|
|
863
|
+
function splitRowKind(row) {
|
|
864
|
+
return row.left?.kind === "del" ? "del" : row.right?.kind === "add" ? "add" : "context";
|
|
865
|
+
}
|
|
866
|
+
function hunkHeader(hunk) {
|
|
867
|
+
return `@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* The side-by-side view without wrapping: two columns that clip their long
|
|
871
|
+
* lines and scroll together on both axes, so a long line on one side never
|
|
872
|
+
* runs under the other and both sides show the same rows and columns of text.
|
|
873
|
+
* Every line is one fixed-height row, which keeps the sides aligned.
|
|
874
|
+
* The columns suppress elastic overscroll while retaining native in-range scrolling.
|
|
875
|
+
*/
|
|
876
|
+
function SplitColumns({ hunks, highlights }) {
|
|
877
|
+
const paired = (0, react.useMemo)(() => hunks.map((hunk) => ({
|
|
878
|
+
header: hunkHeader(hunk),
|
|
879
|
+
rows: splitRows(hunk)
|
|
880
|
+
})), [hunks]);
|
|
881
|
+
const columns = (0, react.useRef)({
|
|
882
|
+
left: null,
|
|
883
|
+
right: null
|
|
884
|
+
});
|
|
885
|
+
const offsets = (0, react.useRef)({
|
|
886
|
+
left: {
|
|
887
|
+
scrollLeft: 0,
|
|
888
|
+
scrollTop: 0
|
|
889
|
+
},
|
|
890
|
+
right: {
|
|
891
|
+
scrollLeft: 0,
|
|
892
|
+
scrollTop: 0
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
const follow = (side) => (event) => {
|
|
896
|
+
const peer = side === "left" ? "right" : "left";
|
|
897
|
+
const other = columns.current[peer];
|
|
898
|
+
/* v8 ignore next -- Both column refs are attached before browser scroll events can run. */
|
|
899
|
+
if (other === null) return;
|
|
900
|
+
for (const axis of ["scrollLeft", "scrollTop"]) {
|
|
901
|
+
const value = event.currentTarget[axis];
|
|
902
|
+
if (offsets.current[side][axis] === value) continue;
|
|
903
|
+
offsets.current[side][axis] = value;
|
|
904
|
+
other[axis] = value;
|
|
905
|
+
offsets.current[peer][axis] = other[axis];
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
return (0, react_jsx_runtime.jsx)("div", {
|
|
909
|
+
className: FileDiff_module_css_default.columns,
|
|
910
|
+
children: ["left", "right"].map((side) => (0, react_jsx_runtime.jsx)("div", {
|
|
911
|
+
className: FileDiff_module_css_default.column,
|
|
912
|
+
"data-diff-side": side,
|
|
913
|
+
ref: (element) => {
|
|
914
|
+
columns.current[side] = element;
|
|
915
|
+
},
|
|
916
|
+
onScroll: follow(side),
|
|
917
|
+
children: paired.map((hunk, position) => (0, react_jsx_runtime.jsxs)("section", {
|
|
918
|
+
className: FileDiff_module_css_default.hunk,
|
|
919
|
+
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
920
|
+
className: FileDiff_module_css_default.hunkHeader,
|
|
921
|
+
"data-diff-hunk-header": true,
|
|
922
|
+
children: hunk.header
|
|
923
|
+
}), hunk.rows.map((row, at) => {
|
|
924
|
+
const cell = row[side];
|
|
925
|
+
const spans = cell === void 0 ? void 0 : highlights[position]?.[side === "left" ? "old" : "new"]?.get(cell.no);
|
|
926
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
927
|
+
className: `${FileDiff_module_css_default.sideLine} ${cell === void 0 ? FileDiff_module_css_default.empty : FileDiff_module_css_default[cell.kind]}`,
|
|
928
|
+
"data-diff-line": splitRowKind(row),
|
|
929
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
930
|
+
className: FileDiff_module_css_default.number,
|
|
931
|
+
children: cell?.no ?? ""
|
|
932
|
+
}), (0, react_jsx_runtime.jsx)(DiffText, {
|
|
933
|
+
text: cell?.text ?? "",
|
|
934
|
+
spans
|
|
935
|
+
})]
|
|
936
|
+
}, at);
|
|
937
|
+
})]
|
|
938
|
+
}, position))
|
|
939
|
+
}, side))
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
/** The hunks of a text comparison with their line numbers, unified or side by side. */
|
|
943
|
+
function TextDiff({ diff, split, wrap, t }) {
|
|
944
|
+
const note = noteOf(diff);
|
|
945
|
+
const { hunks, truncated } = (0, react.useMemo)(() => renderedHunks(diff.hunks), [diff.hunks]);
|
|
946
|
+
const highlighter = (0, _deepseek_ai_dsh_client_ui_primitives.useCodeHighlighter)((0, _deepseek_ai_dsh_client_ui_primitives.languageForPath)(diff.path));
|
|
947
|
+
const highlights = (0, react.useMemo)(() => hunks.map((hunk) => hunkHighlights(hunk, highlighter)), [hunks, highlighter]);
|
|
948
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
949
|
+
className: FileDiff_module_css_default.body,
|
|
950
|
+
"data-review-view": split ? "split" : "unified",
|
|
951
|
+
"data-review-wrap": wrap || void 0,
|
|
952
|
+
children: [
|
|
953
|
+
note !== void 0 && (0, react_jsx_runtime.jsx)("p", {
|
|
954
|
+
className: FileDiff_module_css_default.note,
|
|
955
|
+
"data-diff-note": hunks.length === 0 ? "empty" : "metadata",
|
|
956
|
+
children: t(note)
|
|
957
|
+
}),
|
|
958
|
+
diff.coarse && (0, react_jsx_runtime.jsx)("p", {
|
|
959
|
+
className: FileDiff_module_css_default.note,
|
|
960
|
+
"data-diff-coarse": true,
|
|
961
|
+
children: t("diff.coarse")
|
|
962
|
+
}),
|
|
963
|
+
truncated && (0, react_jsx_runtime.jsx)("p", {
|
|
964
|
+
className: FileDiff_module_css_default.note,
|
|
965
|
+
"data-diff-truncated": true,
|
|
966
|
+
children: t("diff.truncated", { count: String(5e3) })
|
|
967
|
+
}),
|
|
968
|
+
split && !wrap ? (0, react_jsx_runtime.jsx)(SplitColumns, {
|
|
969
|
+
hunks,
|
|
970
|
+
highlights
|
|
971
|
+
}) : hunks.map((hunk, position) => {
|
|
972
|
+
const highlighted = highlights[position];
|
|
973
|
+
return (0, react_jsx_runtime.jsxs)("section", {
|
|
974
|
+
className: FileDiff_module_css_default.hunk,
|
|
975
|
+
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
976
|
+
className: FileDiff_module_css_default.hunkHeader,
|
|
977
|
+
"data-diff-hunk-header": true,
|
|
978
|
+
children: hunkHeader(hunk)
|
|
979
|
+
}), split ? splitRows(hunk).map((row, at) => (0, react_jsx_runtime.jsxs)("div", {
|
|
980
|
+
className: FileDiff_module_css_default.splitLine,
|
|
981
|
+
"data-diff-line": splitRowKind(row),
|
|
982
|
+
children: [(0, react_jsx_runtime.jsxs)("span", {
|
|
983
|
+
className: `${FileDiff_module_css_default.cell} ${row.left === void 0 ? FileDiff_module_css_default.empty : FileDiff_module_css_default[row.left.kind]}`,
|
|
984
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
985
|
+
className: FileDiff_module_css_default.number,
|
|
986
|
+
children: row.left?.no ?? ""
|
|
987
|
+
}), (0, react_jsx_runtime.jsx)(DiffText, {
|
|
988
|
+
text: row.left?.text ?? "",
|
|
989
|
+
spans: row.left === void 0 ? void 0 : highlighted?.old?.get(row.left.no)
|
|
990
|
+
})]
|
|
991
|
+
}), (0, react_jsx_runtime.jsxs)("span", {
|
|
992
|
+
className: `${FileDiff_module_css_default.cell} ${row.right === void 0 ? FileDiff_module_css_default.empty : FileDiff_module_css_default[row.right.kind]}`,
|
|
993
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
994
|
+
className: FileDiff_module_css_default.number,
|
|
995
|
+
children: row.right?.no ?? ""
|
|
996
|
+
}), (0, react_jsx_runtime.jsx)(DiffText, {
|
|
997
|
+
text: row.right?.text ?? "",
|
|
998
|
+
spans: row.right === void 0 ? void 0 : highlighted?.new?.get(row.right.no)
|
|
999
|
+
})]
|
|
1000
|
+
})]
|
|
1001
|
+
}, at)) : hunkRows(hunk).map((row, at) => (0, react_jsx_runtime.jsxs)("div", {
|
|
1002
|
+
className: `${FileDiff_module_css_default.line} ${FileDiff_module_css_default[row.kind]}`,
|
|
1003
|
+
"data-diff-line": row.kind,
|
|
1004
|
+
children: [
|
|
1005
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
1006
|
+
className: FileDiff_module_css_default.number,
|
|
1007
|
+
children: row.old ?? ""
|
|
1008
|
+
}),
|
|
1009
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
1010
|
+
className: FileDiff_module_css_default.number,
|
|
1011
|
+
children: row.new ?? ""
|
|
1012
|
+
}),
|
|
1013
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
1014
|
+
className: FileDiff_module_css_default.sign,
|
|
1015
|
+
children: row.kind === "add" ? "+" : row.kind === "del" ? "-" : " "
|
|
1016
|
+
}),
|
|
1017
|
+
(0, react_jsx_runtime.jsx)(DiffText, {
|
|
1018
|
+
text: row.text,
|
|
1019
|
+
spans: row.kind === "add" ? highlighted?.new?.get(row.new) : highlighted?.old?.get(row.old)
|
|
1020
|
+
})
|
|
1021
|
+
]
|
|
1022
|
+
}, at))]
|
|
1023
|
+
}, position);
|
|
1024
|
+
})
|
|
1025
|
+
]
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
//#endregion
|
|
243
1029
|
//#region ../../core/session/lib/types/surface.js
|
|
244
1030
|
/** Runtime counterpart of the message-producing event union. */
|
|
245
1031
|
const SURFACE_EVENT_TYPES = new Set([
|
|
246
1032
|
"system/message",
|
|
1033
|
+
"developer/message",
|
|
247
1034
|
"user/message",
|
|
248
1035
|
"assistant/message",
|
|
249
1036
|
"tool/result"
|
|
@@ -275,12 +1062,13 @@ window.__ModuleLoader__.load({
|
|
|
275
1062
|
//#region lib/types/client/turn-deliverables.js
|
|
276
1063
|
/**
|
|
277
1064
|
* Turn-scoped produced-file Definition and readers. Client-only and
|
|
278
|
-
* model-free:
|
|
279
|
-
*
|
|
1065
|
+
* model-free: produced paths come from successful first-party mutation calls,
|
|
1066
|
+
* changed files from the Host's recorded git summary, and deliveries from
|
|
1067
|
+
* `present`; never from presentation data or the closing prose.
|
|
280
1068
|
*/
|
|
281
1069
|
/**
|
|
282
1070
|
* Extract the path from a supported first-party mutation call. Session
|
|
283
|
-
* `tool/call` events are root calls;
|
|
1071
|
+
* `tool/call` events are root calls; PTC dispatch children do not enter this
|
|
284
1072
|
* Definition independently.
|
|
285
1073
|
* @param name - wire tool name.
|
|
286
1074
|
* @param argsRaw - model-produced JSON arguments.
|
|
@@ -377,6 +1165,10 @@ window.__ModuleLoader__.load({
|
|
|
377
1165
|
id: String(event.data.turn),
|
|
378
1166
|
role: "update"
|
|
379
1167
|
} : null;
|
|
1168
|
+
if (event.type === "workspace/changes") return isChangesEvent(event.data) ? {
|
|
1169
|
+
id: String(event.data.turn),
|
|
1170
|
+
role: "update"
|
|
1171
|
+
} : null;
|
|
380
1172
|
if (event.type === "tool/result" && isAppendSurfaceEvent(event)) return {
|
|
381
1173
|
id: String(event.data.turn),
|
|
382
1174
|
role: "update"
|
|
@@ -392,6 +1184,10 @@ window.__ModuleLoader__.load({
|
|
|
392
1184
|
};
|
|
393
1185
|
},
|
|
394
1186
|
update: (context, match) => {
|
|
1187
|
+
if (match.event.type === "workspace/changes") return {
|
|
1188
|
+
...context.state,
|
|
1189
|
+
changes: { seq: match.event.seq }
|
|
1190
|
+
};
|
|
395
1191
|
if (match.event.type === "deliverables/presented") {
|
|
396
1192
|
const { files } = match.event.data;
|
|
397
1193
|
const seq = match.event.seq;
|
|
@@ -419,7 +1215,7 @@ window.__ModuleLoader__.load({
|
|
|
419
1215
|
};
|
|
420
1216
|
}
|
|
421
1217
|
if (match.event.type !== "tool/result") return context.state;
|
|
422
|
-
if (match.event.data.message.
|
|
1218
|
+
if (match.event.data.message.isError === true) return context.state;
|
|
423
1219
|
const callId = String(match.event.data.message.source.callId);
|
|
424
1220
|
const path = context.state.calls.get(callId);
|
|
425
1221
|
return path === null || path === void 0 ? context.state : {
|
|
@@ -432,19 +1228,28 @@ window.__ModuleLoader__.load({
|
|
|
432
1228
|
},
|
|
433
1229
|
buildLocationData: (context, scope, previous) => {
|
|
434
1230
|
if (scope !== "turn" || context.state === void 0) return null;
|
|
435
|
-
if (previous?.kind === "turn" && previous.turn === context.state.turn && previous.key === "deliverables" && previous.value.produced === context.state.produced && previous.value.presented === context.state.presented) return previous;
|
|
1231
|
+
if (previous?.kind === "turn" && previous.turn === context.state.turn && previous.key === "deliverables" && previous.value.produced === context.state.produced && previous.value.presented === context.state.presented && previous.value.changes === context.state.changes) return previous;
|
|
436
1232
|
return {
|
|
437
1233
|
kind: "turn",
|
|
438
1234
|
turn: context.state.turn,
|
|
439
1235
|
key: "deliverables",
|
|
440
1236
|
value: {
|
|
441
1237
|
produced: context.state.produced,
|
|
442
|
-
...context.state.presented === void 0 ? {} : { presented: context.state.presented }
|
|
1238
|
+
...context.state.presented === void 0 ? {} : { presented: context.state.presented },
|
|
1239
|
+
...context.state.changes === void 0 ? {} : { changes: context.state.changes }
|
|
443
1240
|
}
|
|
444
1241
|
};
|
|
445
1242
|
}
|
|
446
1243
|
};
|
|
447
1244
|
/**
|
|
1245
|
+
* The turn's latest change announcement.
|
|
1246
|
+
* @param owner - closing turn.
|
|
1247
|
+
* @returns the announcement, or null when the Host recorded none.
|
|
1248
|
+
*/
|
|
1249
|
+
function changesForClosing(owner) {
|
|
1250
|
+
return owner.turn.data.get("deliverables")?.changes ?? null;
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
448
1253
|
* Select the latest declaration of each path before the closing reply.
|
|
449
1254
|
* @param owner - closing turn and sequence.
|
|
450
1255
|
* @returns replayable deliveries in first-seen path order.
|
|
@@ -455,12 +1260,10 @@ window.__ModuleLoader__.load({
|
|
|
455
1260
|
return [...files.values()];
|
|
456
1261
|
}
|
|
457
1262
|
/**
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
* guessing, so a mention link can never open the wrong file or 404.
|
|
463
|
-
* @param paths - The turn's produced paths (tool order, already deduped).
|
|
1263
|
+
* Resolves inline-code references against one turn's produced or delivered
|
|
1264
|
+
* paths. Exact paths resolve directly; a basename resolves only when exactly
|
|
1265
|
+
* one supplied path has that basename. Ambiguous and unknown tokens stay inert.
|
|
1266
|
+
* @param paths - The turn's produced or delivered paths, already deduplicated.
|
|
464
1267
|
* @param openFile - The chat view's file opener.
|
|
465
1268
|
* @param label - Localizes the accessible open-label for a resolved path.
|
|
466
1269
|
* @returns The resolver MarkdownText consumes; the full path rides `title`,
|
|
@@ -479,129 +1282,235 @@ window.__ModuleLoader__.load({
|
|
|
479
1282
|
};
|
|
480
1283
|
} };
|
|
481
1284
|
}
|
|
482
|
-
/** The single
|
|
1285
|
+
/** The single supplied path whose basename is exactly `value`, else undefined. */
|
|
483
1286
|
function onlyPathWithBasename(paths, value) {
|
|
484
1287
|
const matches = paths.filter((path) => basename(path) === value);
|
|
485
1288
|
return matches.length === 1 ? matches[0] : void 0;
|
|
486
1289
|
}
|
|
487
1290
|
//#endregion
|
|
488
|
-
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-deliverables/src/client/
|
|
489
|
-
const css$
|
|
490
|
-
const tagId$
|
|
491
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
1291
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-deliverables/src/client/ChangedFiles.module.css.mjs
|
|
1292
|
+
const css$2 = ".hz8-rW_card{--changes-fill:var(--dsw-static-neutral-50);--changes-hover:var(--dsw-static-neutral-100);border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);min-width:0;color:var(--dsw-alias-label-primary);flex-direction:column;margin-top:4px;display:flex;overflow:hidden}.hz8-rW_card[data-single=true]{border-color:var(--dsw-alias-border-l1)}body[data-ds-dark-theme] .hz8-rW_card{--changes-fill:var(--dsw-static-neutral-850);--changes-hover:var(--dsw-static-neutral-800)}.hz8-rW_header{box-sizing:border-box;background:var(--changes-fill);width:100%;min-width:0;height:60px;color:inherit;font:inherit;text-align:left;border:0;align-items:center;gap:10px;margin:0;padding:8px 10px;display:flex}button.hz8-rW_header{cursor:pointer;transition:background-color .12s}button.hz8-rW_header:hover:not(:disabled),button.hz8-rW_header:focus-visible{background:var(--changes-hover)}button.hz8-rW_header:focus-visible{box-shadow:inset 0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline:none}button.hz8-rW_header:disabled{cursor:progress}.hz8-rW_tile{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:color-mix(in srgb, var(--dsw-static-neutral-00) 50%, transparent);flex:none;place-items:center;width:40px;height:40px;display:grid}body[data-ds-dark-theme] .hz8-rW_tile{background:color-mix(in srgb, var(--dsw-static-neutral-00) 5%, transparent)}.hz8-rW_titles{flex-direction:column;flex:1;min-width:0;display:flex}.hz8-rW_title{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500;line-height:20px;overflow:hidden}.hz8-rW_stat{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:16px;display:inline-flex}.hz8-rW_statCounts{font-family:var(--ds-font-family-code);gap:6px;display:inline-flex}.hz8-rW_previewHint,.hz8-rW_header:hover .hz8-rW_statCounts,.hz8-rW_header:focus-visible .hz8-rW_statCounts{display:none}.hz8-rW_header:hover .hz8-rW_previewHint,.hz8-rW_header:focus-visible .hz8-rW_previewHint{display:inline}.hz8-rW_stat[data-error=true],.hz8-rW_counts[data-error=true]{color:var(--dsw-alias-state-error-primary)}.hz8-rW_added{color:var(--dsw-alias-state-success-primary)}.hz8-rW_deleted{color:var(--dsw-alias-state-error-primary)}.hz8-rW_list{border-top:.5px solid var(--dsw-alias-border-l2);margin:0;padding:0;list-style:none}.hz8-rW_row{box-sizing:border-box;width:100%;min-width:0;min-height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-family:var(--ds-font-family-code);text-align:left;background:0 0;border:0;justify-content:space-between;align-items:center;gap:10px;margin:0;padding:7px 18px 7px 14px;font-size:11px;line-height:18px;display:flex}.hz8-rW_row:hover:not(:disabled),.hz8-rW_row:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.hz8-rW_row:focus-visible{box-shadow:inset 0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline:none}.hz8-rW_row:disabled{cursor:progress}.hz8-rW_path{min-width:0;font-family:var(--dsw-font-family);text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}.hz8-rW_counts{white-space:nowrap;color:var(--dsw-alias-label-tertiary);flex:none;gap:6px;display:inline-flex}.hz8-rW_toggle{box-sizing:border-box;width:100%;color:var(--dsw-alias-label-tertiary);cursor:pointer;font:inherit;text-align:left;background:0 0;border:0;justify-content:flex-start;align-items:center;gap:4px;margin:0;padding:10px 18px 10px 14px;font-size:12px;line-height:18px;display:inline-flex}.hz8-rW_toggle:hover{background:var(--dsw-alias-interactive-bg-hover)}.hz8-rW_toggle svg{flex:none;width:14px;height:14px}@media (pointer:coarse){.hz8-rW_row,.hz8-rW_toggle{min-height:44px}}.hz8-rW_preview{max-height:100%;overflow:hidden}.hz8-rW_previewPath{min-width:0;color:var(--dsw-alias-label-tertiary);font-family:var(--ds-font-family-code);white-space:nowrap;flex:auto;font-size:12px;line-height:20px;overflow:auto hidden}.hz8-rW_preview [data-diff-note=metadata],.hz8-rW_preview [data-diff-hunk-header]{display:none}";
|
|
1293
|
+
const tagId$2 = "@deepseek-ai/dsh-client-ui-deliverables/ChangedFiles.module.css";
|
|
1294
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
|
|
492
1295
|
const tag = document.createElement("style");
|
|
493
1296
|
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-deliverables";
|
|
494
|
-
tag.dataset.pluginCss = tagId$
|
|
495
|
-
tag.textContent = css$
|
|
1297
|
+
tag.dataset.pluginCss = tagId$2;
|
|
1298
|
+
tag.textContent = css$2;
|
|
496
1299
|
document.head.appendChild(tag);
|
|
497
1300
|
}
|
|
498
|
-
var
|
|
499
|
-
"
|
|
500
|
-
"
|
|
501
|
-
"
|
|
502
|
-
"
|
|
503
|
-
"
|
|
504
|
-
"
|
|
505
|
-
"
|
|
506
|
-
"
|
|
1301
|
+
var ChangedFiles_module_css_default = {
|
|
1302
|
+
"added": "hz8-rW_added",
|
|
1303
|
+
"card": "hz8-rW_card",
|
|
1304
|
+
"counts": "hz8-rW_counts",
|
|
1305
|
+
"deleted": "hz8-rW_deleted",
|
|
1306
|
+
"header": "hz8-rW_header",
|
|
1307
|
+
"list": "hz8-rW_list",
|
|
1308
|
+
"path": "hz8-rW_path",
|
|
1309
|
+
"preview": "hz8-rW_preview",
|
|
1310
|
+
"previewHint": "hz8-rW_previewHint",
|
|
1311
|
+
"previewPath": "hz8-rW_previewPath",
|
|
1312
|
+
"row": "hz8-rW_row",
|
|
1313
|
+
"stat": "hz8-rW_stat",
|
|
1314
|
+
"statCounts": "hz8-rW_statCounts",
|
|
1315
|
+
"tile": "hz8-rW_tile",
|
|
1316
|
+
"title": "hz8-rW_title",
|
|
1317
|
+
"titles": "hz8-rW_titles",
|
|
1318
|
+
"toggle": "hz8-rW_toggle"
|
|
507
1319
|
};
|
|
508
1320
|
//#endregion
|
|
509
|
-
//#region lib/types/client/
|
|
510
|
-
/**
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
1321
|
+
//#region lib/types/client/ChangedFiles.js
|
|
1322
|
+
/** Turn changes use a compact single-file card or a header with a folded file list. */
|
|
1323
|
+
/** Rows shown before the fold; the design's summary height for a closing message. */
|
|
1324
|
+
const COLLAPSED_ROWS = 4;
|
|
1325
|
+
const GROUPED$1 = new Intl.NumberFormat("en-US");
|
|
1326
|
+
/** Added and deleted line counts in the card's colors. */
|
|
1327
|
+
function Counts$1({ added, deleted, t }) {
|
|
1328
|
+
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("span", {
|
|
1329
|
+
className: ChangedFiles_module_css_default.added,
|
|
1330
|
+
children: t("changes.added", { count: GROUPED$1.format(added) })
|
|
1331
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
1332
|
+
className: ChangedFiles_module_css_default.deleted,
|
|
1333
|
+
children: t("changes.deleted", { count: GROUPED$1.format(deleted) })
|
|
1334
|
+
})] });
|
|
514
1335
|
}
|
|
515
1336
|
/**
|
|
516
|
-
* Render one turn's
|
|
517
|
-
*
|
|
518
|
-
*
|
|
1337
|
+
* Render one turn's changed files. The header opens the turn's review in the
|
|
1338
|
+
* right Sidebar on its first file. A single file uses only the header; it and
|
|
1339
|
+
* multi-file rows preview their comparison after a 500ms hover.
|
|
1340
|
+
* @param props - the recorded summary, the review opener, and localized copy.
|
|
1341
|
+
* @returns the card.
|
|
519
1342
|
*/
|
|
520
|
-
function
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
1343
|
+
function ChangedFiles({ changes, cwd, openReview, t, sessionId, useChangesDiff, loadChangesDiff }) {
|
|
1344
|
+
const cardRef = (0, react.useRef)(null);
|
|
1345
|
+
const pathDescriptionId = (0, react.useId)();
|
|
1346
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
1347
|
+
const singleFile = changes.total === 1 ? changes.files[0] : void 0;
|
|
1348
|
+
const foldable = changes.files.length > COLLAPSED_ROWS;
|
|
1349
|
+
const rows = foldable && !expanded ? changes.files.slice(0, COLLAPSED_ROWS) : changes.files;
|
|
1350
|
+
const header = (0, react_jsx_runtime.jsxs)("button", {
|
|
1351
|
+
type: "button",
|
|
1352
|
+
className: ChangedFiles_module_css_default.header,
|
|
1353
|
+
"aria-label": singleFile === void 0 ? t("changes.openReview") : t("changes.viewDiff", { name: singleFile.display }),
|
|
1354
|
+
"aria-describedby": singleFile === void 0 ? void 0 : pathDescriptionId,
|
|
1355
|
+
onClick: () => {
|
|
1356
|
+
openReview(0);
|
|
1357
|
+
},
|
|
524
1358
|
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
525
|
-
className:
|
|
526
|
-
children:
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
children: [shown.map((path) => (0, react_jsx_runtime.jsxs)("button", {
|
|
533
|
-
type: "button",
|
|
534
|
-
className: ProducedFiles_module_css_default.file,
|
|
535
|
-
title: path,
|
|
536
|
-
"aria-label": t("produced.open", { name: path }),
|
|
537
|
-
onClick: () => {
|
|
538
|
-
openFile(path);
|
|
539
|
-
},
|
|
540
|
-
children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.LinkIcon, {
|
|
541
|
-
kind: (0, _deepseek_ai_dsh_client_ui_primitives.classifyLinkPath)(path),
|
|
542
|
-
className: ProducedFiles_module_css_default.fileIcon
|
|
543
|
-
}), (0, react_jsx_runtime.jsx)("span", {
|
|
544
|
-
className: ProducedFiles_module_css_default.fileName,
|
|
545
|
-
children: basename(path)
|
|
546
|
-
})]
|
|
547
|
-
}, path)), shown.map((_, index) => {
|
|
548
|
-
const shownCount = index + 1;
|
|
549
|
-
const remainder = paths.length - shownCount;
|
|
550
|
-
if (remainder <= 0) return null;
|
|
551
|
-
return (0, react_jsx_runtime.jsx)("span", {
|
|
552
|
-
className: ProducedFiles_module_css_default.more,
|
|
553
|
-
"data-shown": shownCount,
|
|
554
|
-
children: moreLabel(t, remainder)
|
|
555
|
-
}, shownCount);
|
|
556
|
-
})]
|
|
1359
|
+
className: ChangedFiles_module_css_default.tile,
|
|
1360
|
+
children: singleFile === void 0 ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.FileTypeIcon, {
|
|
1361
|
+
kind: "code",
|
|
1362
|
+
size: 20
|
|
1363
|
+
}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.FileTypeIcon, {
|
|
1364
|
+
path: singleFile.path,
|
|
1365
|
+
size: 20
|
|
557
1366
|
})
|
|
1367
|
+
}), (0, react_jsx_runtime.jsxs)("span", {
|
|
1368
|
+
className: ChangedFiles_module_css_default.titles,
|
|
1369
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
1370
|
+
className: ChangedFiles_module_css_default.title,
|
|
1371
|
+
children: singleFile === void 0 ? t("changes.title", { count: String(changes.total) }) : t("changes.singleTitle", { name: basename(singleFile.path) })
|
|
1372
|
+
}), (0, react_jsx_runtime.jsxs)("span", {
|
|
1373
|
+
className: ChangedFiles_module_css_default.stat,
|
|
1374
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
1375
|
+
className: ChangedFiles_module_css_default.statCounts,
|
|
1376
|
+
children: singleFile?.binary === true ? t("changes.binary") : singleFile?.oversized === true ? t("changes.oversized") : (0, react_jsx_runtime.jsx)(Counts$1, {
|
|
1377
|
+
t,
|
|
1378
|
+
added: changes.added,
|
|
1379
|
+
deleted: changes.deleted
|
|
1380
|
+
})
|
|
1381
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
1382
|
+
className: ChangedFiles_module_css_default.previewHint,
|
|
1383
|
+
children: t("presented.preview")
|
|
1384
|
+
})]
|
|
1385
|
+
})]
|
|
558
1386
|
})]
|
|
559
1387
|
});
|
|
1388
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
1389
|
+
ref: cardRef,
|
|
1390
|
+
className: ChangedFiles_module_css_default.card,
|
|
1391
|
+
"data-changed-files": true,
|
|
1392
|
+
"data-single": singleFile !== void 0 || void 0,
|
|
1393
|
+
children: [
|
|
1394
|
+
singleFile === void 0 ? header : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.HoverCard, {
|
|
1395
|
+
variant: "preview",
|
|
1396
|
+
widthAnchorRef: cardRef,
|
|
1397
|
+
openDelayMs: 500,
|
|
1398
|
+
anchor: header,
|
|
1399
|
+
content: (0, react_jsx_runtime.jsx)(ChangedFilePreview, {
|
|
1400
|
+
sessionId,
|
|
1401
|
+
seq: changes.seq,
|
|
1402
|
+
index: 0,
|
|
1403
|
+
display: resolveWorkspacePath(cwd, singleFile.path),
|
|
1404
|
+
useChangesDiff,
|
|
1405
|
+
loadChangesDiff,
|
|
1406
|
+
t
|
|
1407
|
+
})
|
|
1408
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
1409
|
+
id: pathDescriptionId,
|
|
1410
|
+
hidden: true,
|
|
1411
|
+
children: resolveWorkspacePath(cwd, singleFile.path)
|
|
1412
|
+
})] }),
|
|
1413
|
+
singleFile === void 0 && (0, react_jsx_runtime.jsx)("ul", {
|
|
1414
|
+
className: ChangedFiles_module_css_default.list,
|
|
1415
|
+
children: rows.map((file, index) => (0, react_jsx_runtime.jsxs)("li", { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.HoverCard, {
|
|
1416
|
+
variant: "preview",
|
|
1417
|
+
widthAnchorRef: cardRef,
|
|
1418
|
+
openDelayMs: 500,
|
|
1419
|
+
content: (0, react_jsx_runtime.jsx)(ChangedFilePreview, {
|
|
1420
|
+
sessionId,
|
|
1421
|
+
seq: changes.seq,
|
|
1422
|
+
index,
|
|
1423
|
+
display: resolveWorkspacePath(cwd, file.path),
|
|
1424
|
+
useChangesDiff,
|
|
1425
|
+
loadChangesDiff,
|
|
1426
|
+
t
|
|
1427
|
+
}),
|
|
1428
|
+
anchor: (0, react_jsx_runtime.jsxs)("button", {
|
|
1429
|
+
type: "button",
|
|
1430
|
+
className: ChangedFiles_module_css_default.row,
|
|
1431
|
+
"aria-label": t("changes.viewDiff", { name: file.display }),
|
|
1432
|
+
"aria-describedby": `${pathDescriptionId}-${index}`,
|
|
1433
|
+
onClick: () => {
|
|
1434
|
+
openReview(index);
|
|
1435
|
+
},
|
|
1436
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
1437
|
+
className: ChangedFiles_module_css_default.path,
|
|
1438
|
+
children: file.display
|
|
1439
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
1440
|
+
className: ChangedFiles_module_css_default.counts,
|
|
1441
|
+
children: file.binary === true ? t("changes.binary") : file.oversized === true ? t("changes.oversized") : (0, react_jsx_runtime.jsx)(Counts$1, {
|
|
1442
|
+
t,
|
|
1443
|
+
added: file.added,
|
|
1444
|
+
deleted: file.deleted
|
|
1445
|
+
})
|
|
1446
|
+
})]
|
|
1447
|
+
})
|
|
1448
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
1449
|
+
id: `${pathDescriptionId}-${index}`,
|
|
1450
|
+
hidden: true,
|
|
1451
|
+
children: resolveWorkspacePath(cwd, file.path)
|
|
1452
|
+
})] }, file.display))
|
|
1453
|
+
}),
|
|
1454
|
+
foldable && (0, react_jsx_runtime.jsxs)("button", {
|
|
1455
|
+
type: "button",
|
|
1456
|
+
className: ChangedFiles_module_css_default.toggle,
|
|
1457
|
+
"aria-expanded": expanded,
|
|
1458
|
+
"aria-label": t(expanded ? "changes.collapseAria" : "changes.expandAria", { count: String(changes.files.length) }),
|
|
1459
|
+
onClick: () => {
|
|
1460
|
+
setExpanded((value) => !value);
|
|
1461
|
+
},
|
|
1462
|
+
children: [(0, react_jsx_runtime.jsx)("span", { children: t(expanded ? "changes.collapse" : "changes.all", { count: String(changes.files.length) }) }), expanded ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronUpOutlineRegular, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, {})]
|
|
1463
|
+
})
|
|
1464
|
+
]
|
|
1465
|
+
});
|
|
560
1466
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
1467
|
+
/** Mounted only while its hover card is open, so passing over a row does not read a comparison. */
|
|
1468
|
+
function ChangedFilePreview({ sessionId, seq, index, display, useChangesDiff, loadChangesDiff, t }) {
|
|
1469
|
+
const state = useChangesDiff((value) => value[changesDiffUrl(sessionId, seq, index)]);
|
|
1470
|
+
(0, react.useEffect)(() => {
|
|
1471
|
+
if (state === void 0) loadChangesDiff(sessionId, seq, index);
|
|
1472
|
+
}, [
|
|
1473
|
+
state,
|
|
1474
|
+
sessionId,
|
|
1475
|
+
seq,
|
|
1476
|
+
index,
|
|
1477
|
+
loadChangesDiff
|
|
1478
|
+
]);
|
|
1479
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
1480
|
+
className: `${FileDiff_module_css_default.root} ${ChangedFiles_module_css_default.preview}`,
|
|
1481
|
+
"data-changes-hover-preview": true,
|
|
1482
|
+
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
1483
|
+
className: FileDiff_module_css_default.header,
|
|
1484
|
+
children: (0, react_jsx_runtime.jsx)("span", {
|
|
1485
|
+
className: ChangedFiles_module_css_default.previewPath,
|
|
1486
|
+
"data-changes-preview-path": true,
|
|
1487
|
+
children: display
|
|
1488
|
+
})
|
|
1489
|
+
}), (0, react_jsx_runtime.jsx)(FileDiff, {
|
|
1490
|
+
state,
|
|
1491
|
+
split: false,
|
|
1492
|
+
wrap: false,
|
|
1493
|
+
t,
|
|
1494
|
+
retry: () => {
|
|
1495
|
+
loadChangesDiff(sessionId, seq, index);
|
|
1496
|
+
}
|
|
1497
|
+
})]
|
|
1498
|
+
});
|
|
590
1499
|
}
|
|
591
1500
|
//#endregion
|
|
592
1501
|
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-deliverables/src/client/Deliverables.module.css.mjs
|
|
593
|
-
const css = ".nyYjTG_root{--deliverable-fill:var(--dsw-static-neutral-50);--deliverable-hover:var(--dsw-static-neutral-100);flex-direction:column;gap:16px;min-width:0;margin-top:4px;display:flex;container-type:inline-size}.nyYjTG_root[data-after-
|
|
594
|
-
const tagId = "@deepseek-ai/dsh-client-ui-deliverables/Deliverables.module.css";
|
|
595
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
1502
|
+
const css$1 = ".nyYjTG_root{--deliverable-fill:var(--dsw-static-neutral-50);--deliverable-hover:var(--dsw-static-neutral-100);flex-direction:column;gap:16px;min-width:0;margin-top:4px;display:flex;container-type:inline-size}.nyYjTG_root[data-after-changes=true]{margin-top:0}body[data-ds-dark-theme] .nyYjTG_root{--deliverable-fill:var(--dsw-static-neutral-850);--deliverable-hover:var(--dsw-static-neutral-800)}.nyYjTG_hostStatus{color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;font-size:12px;line-height:18px;display:flex}.nyYjTG_presented{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;min-width:0;display:grid}.nyYjTG_presented[data-single=true]{grid-template-columns:minmax(0,1fr)}.nyYjTG_file{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:var(--deliverable-fill);min-width:0;height:60px;color:var(--dsw-alias-label-primary);align-items:center;gap:10px;padding:8px 10px;transition:background-color .12s;display:flex;position:relative;overflow:hidden}.nyYjTG_file:hover{background:var(--deliverable-hover)}.nyYjTG_cardPreview{z-index:1;border-radius:inherit;cursor:pointer;background:0 0;border:0;width:100%;padding:0;position:absolute;inset:0}.nyYjTG_cardPreview:focus-visible{box-shadow:inset 0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline:none}.nyYjTG_fileIcon{z-index:2;box-sizing:border-box;pointer-events:none;border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:color-mix(in srgb, var(--dsw-static-neutral-00) 50%, transparent);width:40px;height:40px;color:var(--dsw-alias-link);flex:none;place-items:center;display:grid;position:relative;overflow:hidden}body[data-ds-dark-theme] .nyYjTG_fileIcon{background:color-mix(in srgb, var(--dsw-static-neutral-00) 5%, transparent)}.nyYjTG_fileBody{z-index:2;pointer-events:none;flex:1;justify-content:space-between;align-items:center;gap:12px;min-width:0;display:flex;position:relative}.nyYjTG_details{flex-direction:column;flex:1;justify-content:center;gap:2px;min-width:0;display:flex}.nyYjTG_fileName{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500;line-height:20px;overflow:hidden}.nyYjTG_description{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;font-weight:400;line-height:16px;overflow:hidden}.nyYjTG_description[data-error=true]{color:var(--dsw-alias-state-error-primary)}.nyYjTG_previewHint,.nyYjTG_file:hover .nyYjTG_description:not([role=status]) .nyYjTG_secondaryText{display:none}.nyYjTG_file:hover .nyYjTG_description:not([role=status]) .nyYjTG_previewHint{display:inline}.nyYjTG_toggle{border-radius:var(--dsw-radius-sm);min-width:0;color:var(--dsw-alias-label-tertiary);cursor:pointer;font:inherit;background:0 0;border:0;align-self:center;align-items:center;gap:4px;padding:1px 11px;font-size:12px;line-height:18px;display:inline-flex}.nyYjTG_toggle:hover{background:var(--dsw-alias-interactive-bg-hover)}.nyYjTG_toggle svg{flex:none;width:14px;height:14px}@container (width<=620px){.nyYjTG_presented{grid-template-columns:minmax(0,1fr)}}.nyYjTG_actions{pointer-events:auto;flex:none;display:inline-flex}.nyYjTG_secondaryText[data-success]{animation-name:nyYjTG_success-fade;animation-timing-function:ease-out;animation-fill-mode:forwards}@keyframes nyYjTG_success-fade{to{opacity:0}}@media (prefers-reduced-motion:reduce){.nyYjTG_secondaryText[data-success]{animation-name:none}}";
|
|
1503
|
+
const tagId$1 = "@deepseek-ai/dsh-client-ui-deliverables/Deliverables.module.css";
|
|
1504
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
596
1505
|
const tag = document.createElement("style");
|
|
597
1506
|
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-deliverables";
|
|
598
|
-
tag.dataset.pluginCss = tagId;
|
|
599
|
-
tag.textContent = css;
|
|
1507
|
+
tag.dataset.pluginCss = tagId$1;
|
|
1508
|
+
tag.textContent = css$1;
|
|
600
1509
|
document.head.appendChild(tag);
|
|
601
1510
|
}
|
|
602
1511
|
var Deliverables_module_css_default = {
|
|
1512
|
+
"actions": "nyYjTG_actions",
|
|
603
1513
|
"cardPreview": "nyYjTG_cardPreview",
|
|
604
|
-
"chevron": "nyYjTG_chevron",
|
|
605
1514
|
"description": "nyYjTG_description",
|
|
606
1515
|
"details": "nyYjTG_details",
|
|
607
1516
|
"file": "nyYjTG_file",
|
|
@@ -609,19 +1518,15 @@ window.__ModuleLoader__.load({
|
|
|
609
1518
|
"fileIcon": "nyYjTG_fileIcon",
|
|
610
1519
|
"fileName": "nyYjTG_fileName",
|
|
611
1520
|
"hostStatus": "nyYjTG_hostStatus",
|
|
612
|
-
"menuActionIcon": "nyYjTG_menuActionIcon",
|
|
613
|
-
"menuAnchor": "nyYjTG_menuAnchor",
|
|
614
|
-
"open": "nyYjTG_open",
|
|
615
1521
|
"presented": "nyYjTG_presented",
|
|
616
1522
|
"previewHint": "nyYjTG_previewHint",
|
|
617
1523
|
"root": "nyYjTG_root",
|
|
618
1524
|
"secondaryText": "nyYjTG_secondaryText",
|
|
619
|
-
"
|
|
1525
|
+
"success-fade": "nyYjTG_success-fade",
|
|
620
1526
|
"toggle": "nyYjTG_toggle"
|
|
621
1527
|
};
|
|
622
1528
|
//#endregion
|
|
623
1529
|
//#region lib/types/client/PresentedFileCard.js
|
|
624
|
-
/** File identity and explicit default-app or file-manager actions for one delivery. */
|
|
625
1530
|
function cardDescription(description, fallback) {
|
|
626
1531
|
const trimmed = description?.replace(/\s*(?:\([^()]*\)|([^()]*))\s*$/u, "").trim();
|
|
627
1532
|
return trimmed === void 0 || trimmed === "" ? fallback : trimmed;
|
|
@@ -631,17 +1536,9 @@ window.__ModuleLoader__.load({
|
|
|
631
1536
|
* @param props - durable file metadata, Sidebar preview, Host capabilities, gesture status, and localized copy.
|
|
632
1537
|
* @returns the file card and its anchored action menu.
|
|
633
1538
|
*/
|
|
634
|
-
function PresentedFileCard({ file, cwd, phase, host, onPreview,
|
|
635
|
-
const
|
|
636
|
-
const previewRef = (0, react.useRef)(null);
|
|
637
|
-
const menuDisabled = phase === "opening" || phase === "revealing" || host === null || !host.available;
|
|
638
|
-
if (menuDisabled && menuOpen) setMenuOpen(false);
|
|
1539
|
+
function PresentedFileCard({ file, cwd, phase, host, onPreview, actions, t }) {
|
|
1540
|
+
const succeeded = phase === "opened" || phase === "revealed";
|
|
639
1541
|
const reveal = host?.fileManager ?? "directory";
|
|
640
|
-
const act = (action) => {
|
|
641
|
-
setMenuOpen(false);
|
|
642
|
-
previewRef.current?.focus();
|
|
643
|
-
onAction(action);
|
|
644
|
-
};
|
|
645
1542
|
const name = basename(file.path);
|
|
646
1543
|
const metadata = (0, _deepseek_ai_dsh_client_ui_primitives.fileExtension)(name).toUpperCase() || t("presented.file");
|
|
647
1544
|
const status = phase === void 0 ? cardDescription(file.description, metadata) : t(reveal === "directory" && phase === "revealed" ? "presented.directoryOpened" : reveal === "directory" && phase === "revealing" ? "presented.directoryOpening" : reveal === "directory" && phase === "revealError" ? "presented.directoryError" : `presented.${phase}`);
|
|
@@ -672,62 +1569,25 @@ window.__ModuleLoader__.load({
|
|
|
672
1569
|
children: name
|
|
673
1570
|
}), (0, react_jsx_runtime.jsxs)("span", {
|
|
674
1571
|
className: Deliverables_module_css_default.description,
|
|
1572
|
+
"data-presented-description": true,
|
|
675
1573
|
role: phase === void 0 ? void 0 : "status",
|
|
676
1574
|
"data-error": phase === "error" || phase === "revealError" || phase === "nativeUnavailable" ? true : void 0,
|
|
677
1575
|
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
678
1576
|
className: Deliverables_module_css_default.secondaryText,
|
|
1577
|
+
"data-success": succeeded || void 0,
|
|
1578
|
+
style: succeeded ? {
|
|
1579
|
+
animationDelay: `${PRESENTED_SUCCESS_HOLD_MS}ms`,
|
|
1580
|
+
animationDuration: `200ms`
|
|
1581
|
+
} : void 0,
|
|
679
1582
|
children: status
|
|
680
1583
|
}), (0, react_jsx_runtime.jsx)("span", {
|
|
681
1584
|
className: Deliverables_module_css_default.previewHint,
|
|
682
1585
|
children: t("presented.preview")
|
|
683
1586
|
})]
|
|
684
1587
|
})]
|
|
685
|
-
}), (0, react_jsx_runtime.
|
|
686
|
-
className: Deliverables_module_css_default.
|
|
687
|
-
children:
|
|
688
|
-
ref: previewRef,
|
|
689
|
-
type: "button",
|
|
690
|
-
className: Deliverables_module_css_default.open,
|
|
691
|
-
"aria-label": t("presented.previewButton", { name: file.path }),
|
|
692
|
-
onClick: onPreview,
|
|
693
|
-
children: t("presented.action")
|
|
694
|
-
}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
695
|
-
className: Deliverables_module_css_default.menuAnchor,
|
|
696
|
-
open: menuOpen && !menuDisabled,
|
|
697
|
-
autoFocus: true,
|
|
698
|
-
portal: true,
|
|
699
|
-
align: "end",
|
|
700
|
-
onClose: () => {
|
|
701
|
-
setMenuOpen(false);
|
|
702
|
-
},
|
|
703
|
-
anchor: (0, react_jsx_runtime.jsx)("button", {
|
|
704
|
-
type: "button",
|
|
705
|
-
className: Deliverables_module_css_default.chevron,
|
|
706
|
-
disabled: menuDisabled,
|
|
707
|
-
"aria-haspopup": "menu",
|
|
708
|
-
"aria-expanded": menuOpen && !menuDisabled,
|
|
709
|
-
"aria-label": t("presented.more", { name: file.path }),
|
|
710
|
-
onClick: () => {
|
|
711
|
-
setMenuOpen((value) => !value);
|
|
712
|
-
},
|
|
713
|
-
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { size: 11 })
|
|
714
|
-
}),
|
|
715
|
-
items: [{
|
|
716
|
-
id: "open",
|
|
717
|
-
icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRightUpOutline16, {
|
|
718
|
-
size: 16,
|
|
719
|
-
className: Deliverables_module_css_default.menuActionIcon
|
|
720
|
-
}),
|
|
721
|
-
label: t("presented.defaultApp")
|
|
722
|
-
}, {
|
|
723
|
-
id: "reveal",
|
|
724
|
-
icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpenOutline16, {}),
|
|
725
|
-
label: t(`presented.${reveal}`)
|
|
726
|
-
}],
|
|
727
|
-
onSelect: (id) => {
|
|
728
|
-
act(id === "reveal" ? "reveal" : "open");
|
|
729
|
-
}
|
|
730
|
-
})]
|
|
1588
|
+
}), (0, react_jsx_runtime.jsx)("div", {
|
|
1589
|
+
className: Deliverables_module_css_default.actions,
|
|
1590
|
+
children: actions
|
|
731
1591
|
})]
|
|
732
1592
|
})
|
|
733
1593
|
]
|
|
@@ -735,47 +1595,82 @@ window.__ModuleLoader__.load({
|
|
|
735
1595
|
}
|
|
736
1596
|
//#endregion
|
|
737
1597
|
//#region lib/types/client/Deliverables.js
|
|
738
|
-
/**
|
|
1598
|
+
/** The changed-files card, shown only while the Host serves the turn's summary, and explicitly declared files for a closing turn. */
|
|
739
1599
|
const COLLAPSED_PRESENTED_COUNT = 4;
|
|
740
1600
|
/**
|
|
741
|
-
* Claim turns
|
|
1601
|
+
* Claim turns with a change announcement or declared files.
|
|
742
1602
|
* @param owner - closing turn.
|
|
743
|
-
* @returns matched
|
|
1603
|
+
* @returns matched announcement and deliveries, or null for a turn with neither.
|
|
744
1604
|
*/
|
|
745
1605
|
function selectDeliverables(owner) {
|
|
746
|
-
const
|
|
1606
|
+
const changes = changesForClosing(owner);
|
|
747
1607
|
const presented = presentedForClosing(owner);
|
|
748
|
-
return
|
|
749
|
-
|
|
1608
|
+
return changes === null && presented.length === 0 ? null : {
|
|
1609
|
+
changes,
|
|
750
1610
|
presented
|
|
751
1611
|
};
|
|
752
1612
|
}
|
|
753
1613
|
/**
|
|
754
|
-
*
|
|
755
|
-
* @param props -
|
|
1614
|
+
* Contribute file deliveries alongside other completed-Turn artifacts.
|
|
1615
|
+
* @param props - closing Turn, file actions, and localized copy.
|
|
1616
|
+
* @returns file rows, or null when the Turn declares none.
|
|
1617
|
+
*/
|
|
1618
|
+
function DeliverablesTail(props) {
|
|
1619
|
+
const matched = selectDeliverables(props);
|
|
1620
|
+
return matched === null ? null : (0, react_jsx_runtime.jsx)(Deliverables, {
|
|
1621
|
+
...props,
|
|
1622
|
+
matched
|
|
1623
|
+
});
|
|
1624
|
+
}
|
|
1625
|
+
/**
|
|
1626
|
+
* Render the changed-files card, once the Host has served the announced
|
|
1627
|
+
* summary and it lists a file, and shared native opening controls for declared
|
|
1628
|
+
* files. A summary the Host no longer serves leaves no card.
|
|
1629
|
+
* @param props - matched announcement and files, workspace opener, and localized copy.
|
|
756
1630
|
* @returns the closing turn's file rows.
|
|
757
1631
|
*/
|
|
758
|
-
function Deliverables({ matched, openFile, t, sessionId, useSessions, openPresented, usePresentedOpen, usePresentedHost, reloadPresentedHost }) {
|
|
1632
|
+
function Deliverables({ matched, openFile, t, sessionId, useSessions, openPresented, openChangesReview, usePresentedOpen, usePresentedHost, useChangesDiff, loadChangesDiff, useChangesSummary, reloadPresentedHost, loadChangesSummary, useShowCodeDiff, renderSlot }) {
|
|
759
1633
|
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
1634
|
+
const showCodeDiff = useShowCodeDiff((value) => value);
|
|
760
1635
|
const cwd = useSessions((state) => state.byId[sessionId]?.cwd);
|
|
761
1636
|
const states = usePresentedOpen((value) => value);
|
|
762
1637
|
const host = usePresentedHost((value) => value);
|
|
763
|
-
const
|
|
764
|
-
const
|
|
1638
|
+
const announced = showCodeDiff ? matched.changes : null;
|
|
1639
|
+
const summary = useChangesSummary((value) => announced === null ? void 0 : value[changesSummaryUrl(sessionId, announced.seq)]);
|
|
765
1640
|
(0, react.useEffect)(() => {
|
|
766
|
-
if (
|
|
1641
|
+
if (announced !== null && summary === void 0) loadChangesSummary(sessionId, announced.seq);
|
|
767
1642
|
}, [
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
1643
|
+
announced,
|
|
1644
|
+
summary,
|
|
1645
|
+
sessionId,
|
|
1646
|
+
loadChangesSummary
|
|
771
1647
|
]);
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
1648
|
+
const changes = announced !== null && typeof summary === "object" && summary.files.length > 0 ? {
|
|
1649
|
+
seq: announced.seq,
|
|
1650
|
+
...summary
|
|
1651
|
+
} : null;
|
|
1652
|
+
const collapsible = matched.presented.length > COLLAPSED_PRESENTED_COUNT;
|
|
1653
|
+
const presented = collapsible && !expanded ? matched.presented.slice(0, COLLAPSED_PRESENTED_COUNT) : matched.presented;
|
|
1654
|
+
(0, react.useEffect)(() => {
|
|
1655
|
+
if (host === null) reloadPresentedHost();
|
|
1656
|
+
}, [host, reloadPresentedHost]);
|
|
1657
|
+
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [changes !== null && (0, react_jsx_runtime.jsx)(ChangedFiles, {
|
|
1658
|
+
changes,
|
|
1659
|
+
cwd,
|
|
1660
|
+
t,
|
|
1661
|
+
sessionId,
|
|
1662
|
+
useChangesDiff,
|
|
1663
|
+
loadChangesDiff,
|
|
1664
|
+
openReview: (index) => {
|
|
1665
|
+
openChangesReview({
|
|
1666
|
+
sessionId,
|
|
1667
|
+
seq: changes.seq,
|
|
1668
|
+
turn: changes.turn
|
|
1669
|
+
}, index);
|
|
1670
|
+
}
|
|
776
1671
|
}), matched.presented.length > 0 && (0, react_jsx_runtime.jsxs)("div", {
|
|
777
1672
|
className: Deliverables_module_css_default.root,
|
|
778
|
-
"data-after-
|
|
1673
|
+
"data-after-changes": changes !== null || void 0,
|
|
779
1674
|
children: [
|
|
780
1675
|
host === "error" && (0, react_jsx_runtime.jsxs)("div", {
|
|
781
1676
|
className: Deliverables_module_css_default.hostStatus,
|
|
@@ -804,9 +1699,12 @@ window.__ModuleLoader__.load({
|
|
|
804
1699
|
onPreview: () => {
|
|
805
1700
|
openFile(file.path);
|
|
806
1701
|
},
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
1702
|
+
actions: renderSlot("deliverables.file.actions", {
|
|
1703
|
+
actionUrl: presentedFileUrl(sessionId, file.seq, file.index),
|
|
1704
|
+
available: host !== null && host !== "error" && host.available,
|
|
1705
|
+
pending: states[presentedFileUrl(sessionId, file.seq, file.index)] === "opening" || states[presentedFileUrl(sessionId, file.seq, file.index)] === "revealing",
|
|
1706
|
+
onAction: (action, application) => openPresented(sessionId, file.seq, file.index, action, application)
|
|
1707
|
+
})
|
|
810
1708
|
}, `${file.seq}:${file.index}`))
|
|
811
1709
|
}),
|
|
812
1710
|
collapsible && (0, react_jsx_runtime.jsxs)("button", {
|
|
@@ -817,14 +1715,389 @@ window.__ModuleLoader__.load({
|
|
|
817
1715
|
onClick: () => {
|
|
818
1716
|
setExpanded((value) => !value);
|
|
819
1717
|
},
|
|
820
|
-
children: [(0, react_jsx_runtime.jsx)("span", { children: t(expanded ? "presented.collapse" : "presented.all", { count: matched.presented.length }) }), expanded ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.
|
|
1718
|
+
children: [(0, react_jsx_runtime.jsx)("span", { children: t(expanded ? "presented.collapse" : "presented.all", { count: matched.presented.length }) }), expanded ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronUpOutlineRegular, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, {})]
|
|
821
1719
|
})
|
|
822
1720
|
]
|
|
823
1721
|
})] });
|
|
824
1722
|
}
|
|
825
1723
|
//#endregion
|
|
1724
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-deliverables/src/client/ReviewTab.module.css.mjs
|
|
1725
|
+
const css = ".ZDDmpq_root{height:100%}.ZDDmpq_selector{flex:0 auto;min-width:0}.ZDDmpq_selectorLabel{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;font-size:12px;overflow:hidden}.ZDDmpq_selectorButton{box-sizing:border-box;border-radius:var(--dsw-radius-sm);max-width:100%;height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;font:inherit;background:0 0;border:0;align-items:center;gap:4px;padding:0 6px 0 8px;font-size:12px;line-height:20px;display:inline-flex}.ZDDmpq_selectorButton:hover,.ZDDmpq_selectorButton[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.ZDDmpq_selectorButton svg{flex:none;display:block}.ZDDmpq_item{justify-content:space-between;align-items:center;gap:12px;min-width:0;display:flex}.ZDDmpq_itemPath{text-overflow:ellipsis;white-space:nowrap;min-width:0;line-height:20px;overflow:hidden}.ZDDmpq_itemCounts,.ZDDmpq_counts{font-family:var(--ds-font-family-code);color:var(--dsw-alias-label-tertiary);flex:none;align-items:center;gap:6px;font-size:12px;line-height:20px;display:inline-flex}.ZDDmpq_counts{min-width:0;margin-right:auto}.ZDDmpq_added{color:var(--dsw-alias-state-success-primary)}.ZDDmpq_deleted{color:var(--dsw-alias-state-error-primary)}.ZDDmpq_label{color:var(--dsw-alias-label-tertiary)}.ZDDmpq_tools{flex:none;align-items:center;gap:2px;margin-left:auto;display:inline-flex}.ZDDmpq_tool{border-radius:var(--dsw-radius-sm);width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:6px;display:inline-flex}.ZDDmpq_tool svg{width:15px;height:15px}.ZDDmpq_tool:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.ZDDmpq_tool[aria-pressed=true] .ZDDmpq_compareIcon{transform:rotate(90deg)}.ZDDmpq_tool:disabled{cursor:progress}.ZDDmpq_tool[data-error]{color:var(--dsw-alias-state-error-primary)}";
|
|
1726
|
+
const tagId = "@deepseek-ai/dsh-client-ui-deliverables/ReviewTab.module.css";
|
|
1727
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
1728
|
+
const tag = document.createElement("style");
|
|
1729
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-deliverables";
|
|
1730
|
+
tag.dataset.pluginCss = tagId;
|
|
1731
|
+
tag.textContent = css;
|
|
1732
|
+
document.head.appendChild(tag);
|
|
1733
|
+
}
|
|
1734
|
+
var ReviewTab_module_css_default = {
|
|
1735
|
+
"added": "ZDDmpq_added",
|
|
1736
|
+
"compareIcon": "ZDDmpq_compareIcon",
|
|
1737
|
+
"counts": "ZDDmpq_counts",
|
|
1738
|
+
"deleted": "ZDDmpq_deleted",
|
|
1739
|
+
"item": "ZDDmpq_item",
|
|
1740
|
+
"itemCounts": "ZDDmpq_itemCounts",
|
|
1741
|
+
"itemPath": "ZDDmpq_itemPath",
|
|
1742
|
+
"label": "ZDDmpq_label",
|
|
1743
|
+
"root": "ZDDmpq_root",
|
|
1744
|
+
"selector": "ZDDmpq_selector",
|
|
1745
|
+
"selectorButton": "ZDDmpq_selectorButton",
|
|
1746
|
+
"selectorLabel": "ZDDmpq_selectorLabel",
|
|
1747
|
+
"tool": "ZDDmpq_tool",
|
|
1748
|
+
"tools": "ZDDmpq_tools"
|
|
1749
|
+
};
|
|
1750
|
+
//#endregion
|
|
1751
|
+
//#region lib/types/client/ReviewTab.js
|
|
1752
|
+
/**
|
|
1753
|
+
* The review tab: one turn's changed files behind a file selector, with the
|
|
1754
|
+
* selected file's turn-start and turn-end comparison drawn unified or side by
|
|
1755
|
+
* side, wrapped or scrolling, and controls to open the file itself.
|
|
1756
|
+
*/
|
|
1757
|
+
const GROUPED = new Intl.NumberFormat("en-US");
|
|
1758
|
+
/** The file index a navigation names, when it names one. */
|
|
1759
|
+
function navigatedIndex(params) {
|
|
1760
|
+
const index = params?.index;
|
|
1761
|
+
return typeof index === "number" && Number.isSafeInteger(index) && index >= 0 ? index : void 0;
|
|
1762
|
+
}
|
|
1763
|
+
/** Added and deleted line counts in the card's colors. */
|
|
1764
|
+
function Counts({ file, t }) {
|
|
1765
|
+
if (file.binary === true) return (0, react_jsx_runtime.jsx)("span", {
|
|
1766
|
+
className: ReviewTab_module_css_default.label,
|
|
1767
|
+
children: t("changes.binary")
|
|
1768
|
+
});
|
|
1769
|
+
if (file.oversized === true) return (0, react_jsx_runtime.jsx)("span", {
|
|
1770
|
+
className: ReviewTab_module_css_default.label,
|
|
1771
|
+
children: t("changes.oversized")
|
|
1772
|
+
});
|
|
1773
|
+
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("span", {
|
|
1774
|
+
className: ReviewTab_module_css_default.added,
|
|
1775
|
+
children: t("changes.added", { count: GROUPED.format(file.added) })
|
|
1776
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
1777
|
+
className: ReviewTab_module_css_default.deleted,
|
|
1778
|
+
children: t("changes.deleted", { count: GROUPED.format(file.deleted) })
|
|
1779
|
+
})] });
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* The review type's body, registered under `sidebar.right.pane.tab` as `changes-review`.
|
|
1783
|
+
* @param props - composed slot props.
|
|
1784
|
+
* @returns the selected file's comparison behind the file selector, or the state that stands in for it.
|
|
1785
|
+
*/
|
|
1786
|
+
function ReviewTab({ useTabInfo, sessionId, useSessions, useStore, actions, useChangesSummary, useChangesDiff, usePresentedOpen, usePresentedHost, loadChangesSummary, loadChangesDiff, reloadPresentedHost, openChanged, t, renderSlot }) {
|
|
1787
|
+
const { tab } = useTabInfo();
|
|
1788
|
+
const { navigation, signal } = tab;
|
|
1789
|
+
const coordinates = (0, react.useMemo)(() => parseChangesReviewAddress(tab.contentId), [tab.contentId]);
|
|
1790
|
+
if (coordinates === void 0) throw new Error(`ui-deliverables: not a review address "${tab.contentId}"`);
|
|
1791
|
+
const { seq } = coordinates;
|
|
1792
|
+
const cwd = useSessions((sessions) => sessions.byId[sessionId]?.cwd);
|
|
1793
|
+
const summary = useChangesSummary((value) => value[changesSummaryUrl(sessionId, seq)]);
|
|
1794
|
+
const state = useStore((store) => store.byTab[tab.id]);
|
|
1795
|
+
const host = usePresentedHost((value) => value);
|
|
1796
|
+
(0, react.useEffect)(() => {
|
|
1797
|
+
if (state?.navigated === navigation.revision) return;
|
|
1798
|
+
actions.navigated(tab.id, navigation.revision, navigatedIndex(navigation.params) ?? state?.index ?? 0);
|
|
1799
|
+
}, [
|
|
1800
|
+
state,
|
|
1801
|
+
navigation.revision,
|
|
1802
|
+
navigation.params,
|
|
1803
|
+
actions,
|
|
1804
|
+
tab.id
|
|
1805
|
+
]);
|
|
1806
|
+
(0, react.useEffect)(() => {
|
|
1807
|
+
const forget = () => {
|
|
1808
|
+
actions.forget(tab.id);
|
|
1809
|
+
};
|
|
1810
|
+
signal.addEventListener("abort", forget, { once: true });
|
|
1811
|
+
return () => {
|
|
1812
|
+
signal.removeEventListener("abort", forget);
|
|
1813
|
+
};
|
|
1814
|
+
}, [
|
|
1815
|
+
signal,
|
|
1816
|
+
actions,
|
|
1817
|
+
tab.id
|
|
1818
|
+
]);
|
|
1819
|
+
(0, react.useEffect)(() => {
|
|
1820
|
+
if (summary === void 0) loadChangesSummary(sessionId, seq);
|
|
1821
|
+
}, [
|
|
1822
|
+
summary,
|
|
1823
|
+
sessionId,
|
|
1824
|
+
seq,
|
|
1825
|
+
loadChangesSummary
|
|
1826
|
+
]);
|
|
1827
|
+
(0, react.useEffect)(() => {
|
|
1828
|
+
if (host === null) reloadPresentedHost();
|
|
1829
|
+
}, [host, reloadPresentedHost]);
|
|
1830
|
+
const files = typeof summary === "object" ? summary.files : [];
|
|
1831
|
+
const index = state !== void 0 && files[state.index] !== void 0 ? state.index : 0;
|
|
1832
|
+
const file = files[index];
|
|
1833
|
+
const diffState = useChangesDiff((value) => file === void 0 ? void 0 : value[changesDiffUrl(sessionId, seq, index)]);
|
|
1834
|
+
(0, react.useEffect)(() => {
|
|
1835
|
+
if (file !== void 0 && diffState === void 0) loadChangesDiff(sessionId, seq, index);
|
|
1836
|
+
}, [
|
|
1837
|
+
file,
|
|
1838
|
+
diffState,
|
|
1839
|
+
sessionId,
|
|
1840
|
+
seq,
|
|
1841
|
+
index,
|
|
1842
|
+
loadChangesDiff
|
|
1843
|
+
]);
|
|
1844
|
+
const phase = usePresentedOpen((value) => file === void 0 ? void 0 : value[changedFileUrl(sessionId, seq, index)]);
|
|
1845
|
+
const [menuOpen, setMenuOpen] = (0, react.useState)(false);
|
|
1846
|
+
const split = state?.split === true;
|
|
1847
|
+
const wrap = state?.wrap === true;
|
|
1848
|
+
const native = host !== null && host !== "error" && host.available && phase !== "nativeUnavailable";
|
|
1849
|
+
const summaryState = summary === void 0 || summary === "loading" ? "loading" : summary === "missing" ? "missing" : "ready";
|
|
1850
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
1851
|
+
className: `${FileDiff_module_css_default.root} ${ReviewTab_module_css_default.root}`,
|
|
1852
|
+
"data-changes-review": true,
|
|
1853
|
+
"data-review-state": summaryState,
|
|
1854
|
+
children: [
|
|
1855
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
1856
|
+
className: FileDiff_module_css_default.header,
|
|
1857
|
+
children: [
|
|
1858
|
+
file === void 0 ? (0, react_jsx_runtime.jsx)("span", {
|
|
1859
|
+
className: ReviewTab_module_css_default.selectorLabel,
|
|
1860
|
+
children: t("review.title", { turn: String(coordinates.turn) })
|
|
1861
|
+
}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
1862
|
+
className: ReviewTab_module_css_default.selector,
|
|
1863
|
+
open: menuOpen,
|
|
1864
|
+
autoFocus: true,
|
|
1865
|
+
portal: true,
|
|
1866
|
+
align: "start",
|
|
1867
|
+
dense: true,
|
|
1868
|
+
onClose: () => {
|
|
1869
|
+
setMenuOpen(false);
|
|
1870
|
+
},
|
|
1871
|
+
anchor: (0, react_jsx_runtime.jsxs)("button", {
|
|
1872
|
+
type: "button",
|
|
1873
|
+
className: ReviewTab_module_css_default.selectorButton,
|
|
1874
|
+
"aria-haspopup": "menu",
|
|
1875
|
+
"aria-expanded": menuOpen,
|
|
1876
|
+
"aria-label": t("review.selectFile"),
|
|
1877
|
+
title: file.display,
|
|
1878
|
+
"data-review-file": file.path,
|
|
1879
|
+
onClick: () => {
|
|
1880
|
+
setMenuOpen((value) => !value);
|
|
1881
|
+
},
|
|
1882
|
+
children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.PathLabel, { path: file.display }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { size: 12 })]
|
|
1883
|
+
}),
|
|
1884
|
+
items: files.map((entry, at) => ({
|
|
1885
|
+
id: String(at),
|
|
1886
|
+
label: (0, react_jsx_runtime.jsxs)("span", {
|
|
1887
|
+
className: ReviewTab_module_css_default.item,
|
|
1888
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
1889
|
+
className: ReviewTab_module_css_default.itemPath,
|
|
1890
|
+
children: entry.display
|
|
1891
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
1892
|
+
className: ReviewTab_module_css_default.itemCounts,
|
|
1893
|
+
children: (0, react_jsx_runtime.jsx)(Counts, {
|
|
1894
|
+
file: entry,
|
|
1895
|
+
t
|
|
1896
|
+
})
|
|
1897
|
+
})]
|
|
1898
|
+
})
|
|
1899
|
+
})),
|
|
1900
|
+
selectedId: String(index),
|
|
1901
|
+
onSelect: (id) => {
|
|
1902
|
+
actions.selected(tab.id, Number(id));
|
|
1903
|
+
setMenuOpen(false);
|
|
1904
|
+
}
|
|
1905
|
+
}),
|
|
1906
|
+
file !== void 0 && (0, react_jsx_runtime.jsx)("span", {
|
|
1907
|
+
className: ReviewTab_module_css_default.counts,
|
|
1908
|
+
children: (0, react_jsx_runtime.jsx)(Counts, {
|
|
1909
|
+
file,
|
|
1910
|
+
t
|
|
1911
|
+
})
|
|
1912
|
+
}),
|
|
1913
|
+
(0, react_jsx_runtime.jsxs)("span", {
|
|
1914
|
+
className: ReviewTab_module_css_default.tools,
|
|
1915
|
+
children: [
|
|
1916
|
+
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
1917
|
+
label: t(split ? "review.unified" : "review.split"),
|
|
1918
|
+
side: "bottom",
|
|
1919
|
+
delayMs: 500,
|
|
1920
|
+
children: (0, react_jsx_runtime.jsx)("button", {
|
|
1921
|
+
type: "button",
|
|
1922
|
+
className: ReviewTab_module_css_default.tool,
|
|
1923
|
+
"aria-pressed": split,
|
|
1924
|
+
"aria-label": t("review.splitAria"),
|
|
1925
|
+
"data-review-tool": "split",
|
|
1926
|
+
onClick: () => {
|
|
1927
|
+
actions.toggledSplit(tab.id);
|
|
1928
|
+
},
|
|
1929
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCompareSplitOutlineRegular, { className: ReviewTab_module_css_default.compareIcon })
|
|
1930
|
+
})
|
|
1931
|
+
}),
|
|
1932
|
+
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
1933
|
+
label: t(wrap ? "review.nowrap" : "review.wrap"),
|
|
1934
|
+
side: "bottom",
|
|
1935
|
+
delayMs: 500,
|
|
1936
|
+
children: (0, react_jsx_runtime.jsx)("button", {
|
|
1937
|
+
type: "button",
|
|
1938
|
+
className: ReviewTab_module_css_default.tool,
|
|
1939
|
+
"aria-pressed": wrap,
|
|
1940
|
+
"aria-label": t("review.wrapAria"),
|
|
1941
|
+
"data-review-tool": "wrap",
|
|
1942
|
+
onClick: () => {
|
|
1943
|
+
actions.toggledWrap(tab.id);
|
|
1944
|
+
},
|
|
1945
|
+
children: wrap ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconNowrapFillRegular, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWrapFillRegular, {})
|
|
1946
|
+
})
|
|
1947
|
+
}),
|
|
1948
|
+
file !== void 0 && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
1949
|
+
label: t("review.openFile"),
|
|
1950
|
+
side: "bottom",
|
|
1951
|
+
delayMs: 500,
|
|
1952
|
+
children: (0, react_jsx_runtime.jsx)("button", {
|
|
1953
|
+
type: "button",
|
|
1954
|
+
className: ReviewTab_module_css_default.tool,
|
|
1955
|
+
"aria-label": t("review.openFileAria", { name: file.display }),
|
|
1956
|
+
"data-review-tool": "open-file",
|
|
1957
|
+
onClick: () => {
|
|
1958
|
+
tab.actions.openResource(fileAddressFor(sessionId, cwd, file.path));
|
|
1959
|
+
},
|
|
1960
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutlineRegular, {})
|
|
1961
|
+
})
|
|
1962
|
+
}),
|
|
1963
|
+
file !== void 0 && renderSlot("deliverables.review.file.actions", {
|
|
1964
|
+
actionUrl: changedFileUrl(sessionId, seq, index),
|
|
1965
|
+
available: native,
|
|
1966
|
+
pending: phase === "opening" || phase === "revealing",
|
|
1967
|
+
onAction: (action, application) => openChanged(sessionId, seq, index, action, application)
|
|
1968
|
+
})
|
|
1969
|
+
]
|
|
1970
|
+
})
|
|
1971
|
+
]
|
|
1972
|
+
}),
|
|
1973
|
+
summaryState === "loading" && (0, react_jsx_runtime.jsx)("p", {
|
|
1974
|
+
className: FileDiff_module_css_default.status,
|
|
1975
|
+
role: "status",
|
|
1976
|
+
children: t("diff.loading")
|
|
1977
|
+
}),
|
|
1978
|
+
summaryState === "missing" && (0, react_jsx_runtime.jsx)("p", {
|
|
1979
|
+
className: FileDiff_module_css_default.status,
|
|
1980
|
+
children: t("diff.missing")
|
|
1981
|
+
}),
|
|
1982
|
+
file !== void 0 && (0, react_jsx_runtime.jsx)(FileDiff, {
|
|
1983
|
+
state: diffState,
|
|
1984
|
+
split,
|
|
1985
|
+
wrap,
|
|
1986
|
+
t,
|
|
1987
|
+
retry: () => {
|
|
1988
|
+
loadChangesDiff(sessionId, seq, index);
|
|
1989
|
+
}
|
|
1990
|
+
})
|
|
1991
|
+
]
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
//#endregion
|
|
1995
|
+
//#region lib/types/client/review-definition.js
|
|
1996
|
+
/** The tab kind this package owns. */
|
|
1997
|
+
const CHANGES_REVIEW_KIND = "changes-review";
|
|
1998
|
+
/** This implementation's identity in the tab system, and the key its body registers under. */
|
|
1999
|
+
const CHANGES_REVIEW_ID = "@deepseek-ai/dsh-client-ui-deliverables";
|
|
2000
|
+
/**
|
|
2001
|
+
* The review type's registry definition.
|
|
2002
|
+
* @param t - namespace-bound translate, read fresh on every title call.
|
|
2003
|
+
* @returns the definition to register.
|
|
2004
|
+
*/
|
|
2005
|
+
function changesReviewDefinition(t) {
|
|
2006
|
+
return {
|
|
2007
|
+
id: CHANGES_REVIEW_ID,
|
|
2008
|
+
kind: CHANGES_REVIEW_KIND,
|
|
2009
|
+
patterns: ["dsh-resource://changes-review/**"],
|
|
2010
|
+
priority: "builtin",
|
|
2011
|
+
canOpen: (address) => parseChangesReviewAddress(address) !== void 0,
|
|
2012
|
+
title: (address) => {
|
|
2013
|
+
const turn = parseChangesReviewAddress(address)?.turn;
|
|
2014
|
+
return turn === void 0 ? address : t("review.title", { turn: String(turn) });
|
|
2015
|
+
}
|
|
2016
|
+
};
|
|
2017
|
+
}
|
|
2018
|
+
//#endregion
|
|
2019
|
+
//#region lib/types/client/review-store.js
|
|
2020
|
+
/**
|
|
2021
|
+
* The review tab's view state: which listed file is shown, whether hunks are
|
|
2022
|
+
* drawn side by side, and whether long lines wrap. One bucket per tab, so two
|
|
2023
|
+
* reviews in one session keep their own choices; the bucket ends with the
|
|
2024
|
+
* tab record's signal.
|
|
2025
|
+
*/
|
|
2026
|
+
function bucket(state, tabId) {
|
|
2027
|
+
const tab = state.byTab[tabId];
|
|
2028
|
+
if (tab === void 0) throw new Error(`ui-deliverables: no review state for tab "${tabId}"`);
|
|
2029
|
+
return tab;
|
|
2030
|
+
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Declare the review tab's store; the registration declares it as an
|
|
2033
|
+
* exclusive store, so the framework mints one instance per session.
|
|
2034
|
+
* @returns the store handle to declare on the registration.
|
|
2035
|
+
*/
|
|
2036
|
+
function createReviewStore() {
|
|
2037
|
+
return (0, _deepseek_ai_dsh_client_store.defineStore)({
|
|
2038
|
+
init: () => ({ byTab: {} }),
|
|
2039
|
+
actions: {
|
|
2040
|
+
/**
|
|
2041
|
+
* Apply a navigation: seed a side-by-side, unwrapped tab on its first one, then show the navigated file.
|
|
2042
|
+
* @param d - draft state.
|
|
2043
|
+
* @param tabId - the tab being drawn.
|
|
2044
|
+
* @param revision - the navigation revision being applied.
|
|
2045
|
+
* @param index - the file index the navigation named, or the current one.
|
|
2046
|
+
*/
|
|
2047
|
+
navigated: (d, tabId, revision, index) => {
|
|
2048
|
+
const tab = d.byTab[tabId];
|
|
2049
|
+
if (tab === void 0) d.byTab[tabId] = {
|
|
2050
|
+
index,
|
|
2051
|
+
split: true,
|
|
2052
|
+
wrap: false,
|
|
2053
|
+
navigated: revision
|
|
2054
|
+
};
|
|
2055
|
+
else {
|
|
2056
|
+
tab.index = index;
|
|
2057
|
+
tab.navigated = revision;
|
|
2058
|
+
}
|
|
2059
|
+
},
|
|
2060
|
+
/**
|
|
2061
|
+
* Show another listed file.
|
|
2062
|
+
* @param d - draft state.
|
|
2063
|
+
* @param tabId - the tab being drawn.
|
|
2064
|
+
* @param index - original index in the summary's files array.
|
|
2065
|
+
*/
|
|
2066
|
+
selected: (d, tabId, index) => {
|
|
2067
|
+
bucket(d, tabId).index = index;
|
|
2068
|
+
},
|
|
2069
|
+
/**
|
|
2070
|
+
* Switch between the unified and the side-by-side view.
|
|
2071
|
+
* @param d - draft state.
|
|
2072
|
+
* @param tabId - the tab being drawn.
|
|
2073
|
+
*/
|
|
2074
|
+
toggledSplit: (d, tabId) => {
|
|
2075
|
+
const tab = bucket(d, tabId);
|
|
2076
|
+
tab.split = !tab.split;
|
|
2077
|
+
},
|
|
2078
|
+
/**
|
|
2079
|
+
* Switch line wrapping.
|
|
2080
|
+
* @param d - draft state.
|
|
2081
|
+
* @param tabId - the tab being drawn.
|
|
2082
|
+
*/
|
|
2083
|
+
toggledWrap: (d, tabId) => {
|
|
2084
|
+
const tab = bucket(d, tabId);
|
|
2085
|
+
tab.wrap = !tab.wrap;
|
|
2086
|
+
},
|
|
2087
|
+
/**
|
|
2088
|
+
* Drop a tab's bucket once its record is gone.
|
|
2089
|
+
* @param d - draft state.
|
|
2090
|
+
* @param tabId - the tab that ended.
|
|
2091
|
+
*/
|
|
2092
|
+
forget: (d, tabId) => {
|
|
2093
|
+
d.byTab = Object.fromEntries(Object.entries(d.byTab).filter(([id]) => id !== tabId));
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
//#endregion
|
|
826
2099
|
//#region lib/types/client/locales.js
|
|
827
|
-
/** `deliverables` namespace dictionaries. */
|
|
2100
|
+
/** `deliverables` namespace dictionaries: cards, comparison tab, and file-mention copy. */
|
|
828
2101
|
/** Dictionary namespace owned by this plugin. */
|
|
829
2102
|
const NS = "deliverables";
|
|
830
2103
|
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
@@ -836,15 +2109,9 @@ window.__ModuleLoader__.load({
|
|
|
836
2109
|
"presented.directoryOpened": "已请求打开所在文件夹",
|
|
837
2110
|
"presented.revealed": "已请求在文件管理器中显示",
|
|
838
2111
|
"presented.revealing": "正在文件管理器中显示…",
|
|
839
|
-
"presented.unavailable": "
|
|
2112
|
+
"presented.unavailable": "此主机没有可用的桌面,无法使用外部程序打开文件或文件夹;文件仍可在侧边栏预览",
|
|
840
2113
|
"presented.retry": "重试",
|
|
841
2114
|
"presented.hostError": "无法读取主机桌面信息",
|
|
842
|
-
"presented.directory": "打开所在文件夹",
|
|
843
|
-
"presented.explorer": "在文件资源管理器中显示",
|
|
844
|
-
"presented.finder": "在 Finder 中显示",
|
|
845
|
-
"presented.defaultApp": "用默认应用打开",
|
|
846
|
-
"presented.more": "{name} 的更多文件操作",
|
|
847
|
-
"presented.action": "打开",
|
|
848
2115
|
"presented.preview": "在侧边栏预览",
|
|
849
2116
|
"presented.previewButton": "在侧边栏打开 {name}",
|
|
850
2117
|
"presented.previewCard": "在侧边栏预览 {name}",
|
|
@@ -853,20 +2120,48 @@ window.__ModuleLoader__.load({
|
|
|
853
2120
|
"presented.collapse": "收起",
|
|
854
2121
|
"presented.collapseAria": "收起交付文件列表",
|
|
855
2122
|
"presented.opening": "正在打开…",
|
|
856
|
-
"presented.opened": "
|
|
2123
|
+
"presented.opened": "已请求打开",
|
|
857
2124
|
"presented.error": "打开失败,点击重试",
|
|
858
2125
|
"presented.file": "文件",
|
|
859
2126
|
"row.title": "交付文件",
|
|
860
2127
|
"row.running": "正在交付",
|
|
2128
|
+
"row.preparing": "准备交付",
|
|
861
2129
|
"row.ok": "已交付",
|
|
862
2130
|
"row.error": "交付失败",
|
|
863
2131
|
"row.stopped": "已中断",
|
|
864
2132
|
"row.inspect": "查看调用",
|
|
865
|
-
"
|
|
866
|
-
"
|
|
867
|
-
"
|
|
868
|
-
"
|
|
869
|
-
"
|
|
2133
|
+
"changes.title": "已编辑 {count} 个文件",
|
|
2134
|
+
"changes.singleTitle": "已编辑 {name}",
|
|
2135
|
+
"changes.added": "+{count}",
|
|
2136
|
+
"changes.deleted": "-{count}",
|
|
2137
|
+
"changes.binary": "二进制",
|
|
2138
|
+
"changes.openReview": "在侧边栏查看本轮改动",
|
|
2139
|
+
"changes.all": "全部 {count} 个文件",
|
|
2140
|
+
"changes.expandAria": "展开全部 {count} 个改动文件",
|
|
2141
|
+
"changes.collapse": "收起",
|
|
2142
|
+
"changes.collapseAria": "收起改动文件列表",
|
|
2143
|
+
"changes.oversized": "过大",
|
|
2144
|
+
"changes.viewDiff": "查看 {name} 的改动",
|
|
2145
|
+
"review.title": "第 {turn} 轮改动",
|
|
2146
|
+
"review.selectFile": "选择要查看的文件",
|
|
2147
|
+
"review.split": "切换为左右对比",
|
|
2148
|
+
"review.unified": "切换为单栏对比",
|
|
2149
|
+
"review.splitAria": "左右对比",
|
|
2150
|
+
"review.wrap": "开启自动换行",
|
|
2151
|
+
"review.nowrap": "关闭自动换行",
|
|
2152
|
+
"review.wrapAria": "自动换行",
|
|
2153
|
+
"review.openFile": "在侧边栏打开整个文件",
|
|
2154
|
+
"review.openFileAria": "在侧边栏打开 {name}",
|
|
2155
|
+
"diff.loading": "正在读取改动…",
|
|
2156
|
+
"diff.missing": "这轮改动的内容已不可用",
|
|
2157
|
+
"diff.error": "无法读取改动",
|
|
2158
|
+
"diff.binary": "二进制文件,无法显示改动",
|
|
2159
|
+
"diff.oversized": "文件过大,无法显示改动",
|
|
2160
|
+
"diff.created": "本轮新建的文件",
|
|
2161
|
+
"diff.deleted": "本轮删除的文件",
|
|
2162
|
+
"diff.unchanged": "两侧内容相同",
|
|
2163
|
+
"diff.coarse": "逐行对比超时,按整个文件替换显示",
|
|
2164
|
+
"diff.truncated": "只显示前 {count} 行"
|
|
870
2165
|
};
|
|
871
2166
|
/** English dictionary (same key set). */
|
|
872
2167
|
const en = {
|
|
@@ -877,15 +2172,9 @@ window.__ModuleLoader__.load({
|
|
|
877
2172
|
"presented.directoryOpened": "Requested opening containing folder",
|
|
878
2173
|
"presented.revealed": "Requested display in file manager",
|
|
879
2174
|
"presented.revealing": "Showing in file manager…",
|
|
880
|
-
"presented.unavailable": "This Host has no desktop available to open files or folders",
|
|
2175
|
+
"presented.unavailable": "This Host has no desktop available to open files or folders in external apps. Files can still be previewed in the sidebar.",
|
|
881
2176
|
"presented.retry": "Retry",
|
|
882
2177
|
"presented.hostError": "Could not read the Host desktop information",
|
|
883
|
-
"presented.directory": "Open containing folder",
|
|
884
|
-
"presented.explorer": "Show in File Explorer",
|
|
885
|
-
"presented.finder": "Show in Finder",
|
|
886
|
-
"presented.defaultApp": "Open in default app",
|
|
887
|
-
"presented.more": "More file actions for {name}",
|
|
888
|
-
"presented.action": "Open",
|
|
889
2178
|
"presented.preview": "Preview in sidebar",
|
|
890
2179
|
"presented.previewButton": "Open {name} in sidebar",
|
|
891
2180
|
"presented.previewCard": "Preview {name} in sidebar",
|
|
@@ -894,40 +2183,79 @@ window.__ModuleLoader__.load({
|
|
|
894
2183
|
"presented.collapse": "Collapse",
|
|
895
2184
|
"presented.collapseAria": "Collapse delivered files",
|
|
896
2185
|
"presented.opening": "Opening…",
|
|
897
|
-
"presented.opened": "
|
|
2186
|
+
"presented.opened": "Open requested",
|
|
898
2187
|
"presented.error": "Could not open. Click to retry.",
|
|
899
2188
|
"presented.file": "File",
|
|
900
2189
|
"row.title": "Present files",
|
|
901
2190
|
"row.running": "Delivering",
|
|
2191
|
+
"row.preparing": "Preparing deliverables",
|
|
902
2192
|
"row.ok": "Delivered",
|
|
903
2193
|
"row.error": "Delivery failed",
|
|
904
2194
|
"row.stopped": "Interrupted",
|
|
905
2195
|
"row.inspect": "Inspect call",
|
|
906
|
-
"
|
|
907
|
-
"
|
|
908
|
-
"
|
|
909
|
-
"
|
|
910
|
-
"
|
|
2196
|
+
"changes.title": "Edited {count} files",
|
|
2197
|
+
"changes.singleTitle": "Edited {name}",
|
|
2198
|
+
"changes.added": "+{count}",
|
|
2199
|
+
"changes.deleted": "-{count}",
|
|
2200
|
+
"changes.binary": "binary",
|
|
2201
|
+
"changes.openReview": "Review this turn’s changes in the sidebar",
|
|
2202
|
+
"changes.all": "All {count} files",
|
|
2203
|
+
"changes.expandAria": "Show all {count} changed files",
|
|
2204
|
+
"changes.collapse": "Collapse",
|
|
2205
|
+
"changes.collapseAria": "Collapse changed files",
|
|
2206
|
+
"changes.oversized": "too large",
|
|
2207
|
+
"changes.viewDiff": "View changes to {name}",
|
|
2208
|
+
"review.title": "Review · turn {turn}",
|
|
2209
|
+
"review.selectFile": "Choose the file to review",
|
|
2210
|
+
"review.split": "Switch to split view",
|
|
2211
|
+
"review.unified": "Switch to unified view",
|
|
2212
|
+
"review.splitAria": "Split view",
|
|
2213
|
+
"review.wrap": "Enable line wrap",
|
|
2214
|
+
"review.nowrap": "Disable line wrap",
|
|
2215
|
+
"review.wrapAria": "Line wrap",
|
|
2216
|
+
"review.openFile": "Open the whole file in the sidebar",
|
|
2217
|
+
"review.openFileAria": "Open {name} in sidebar",
|
|
2218
|
+
"diff.loading": "Reading changes…",
|
|
2219
|
+
"diff.missing": "The contents of this turn’s changes are no longer available",
|
|
2220
|
+
"diff.error": "Could not read the changes",
|
|
2221
|
+
"diff.binary": "Binary file; changes cannot be shown",
|
|
2222
|
+
"diff.oversized": "File too large; changes cannot be shown",
|
|
2223
|
+
"diff.created": "Created in this turn",
|
|
2224
|
+
"diff.deleted": "Deleted in this turn",
|
|
2225
|
+
"diff.unchanged": "Both sides hold the same lines",
|
|
2226
|
+
"diff.coarse": "Line comparison timed out; shown as a whole-file replacement",
|
|
2227
|
+
"diff.truncated": "Showing the first {count} lines"
|
|
911
2228
|
};
|
|
912
2229
|
//#endregion
|
|
913
2230
|
//#region lib/types/client/index.js
|
|
914
|
-
/** Required services for the tail-slot
|
|
2231
|
+
/** Required services for the tail-slot and tab-type registrations and their dictionaries. */
|
|
915
2232
|
const inject = [
|
|
916
2233
|
"slots",
|
|
917
2234
|
"locale",
|
|
918
2235
|
"uiConversation",
|
|
919
2236
|
"remote",
|
|
920
|
-
"remote.session"
|
|
2237
|
+
"remote.session",
|
|
2238
|
+
"sidebarRightTabs",
|
|
2239
|
+
"sidebarRight",
|
|
2240
|
+
"configForms"
|
|
921
2241
|
];
|
|
922
2242
|
/**
|
|
923
|
-
* Client plugin body: register the dictionaries
|
|
2243
|
+
* Client plugin body: register the dictionaries, the turn-tail entry, and the comparison tab type.
|
|
924
2244
|
* @param ctx - client root context.
|
|
925
2245
|
*/
|
|
926
2246
|
function apply(ctx) {
|
|
927
2247
|
const opener = new PresentedOpenController();
|
|
928
|
-
|
|
2248
|
+
const summaries = new ChangesSummaryStore();
|
|
2249
|
+
const diffs = new ChangesDiffStore();
|
|
2250
|
+
ctx.effect(() => () => Promise.all([
|
|
2251
|
+
opener.dispose(),
|
|
2252
|
+
summaries.dispose(),
|
|
2253
|
+
diffs.dispose()
|
|
2254
|
+
]));
|
|
929
2255
|
ctx.on("connection/reset", () => {
|
|
930
2256
|
opener.resetHost();
|
|
2257
|
+
summaries.reset();
|
|
2258
|
+
diffs.reset();
|
|
931
2259
|
});
|
|
932
2260
|
ctx.uiConversation.events.register(deliverablesDefinition);
|
|
933
2261
|
ctx.effect(() => ctx.locale.register(NS, {
|
|
@@ -936,40 +2264,69 @@ window.__ModuleLoader__.load({
|
|
|
936
2264
|
}), "ui-deliverables: dictionaries");
|
|
937
2265
|
ctx.slots.inject("conversation.chat.turnTail", () => ctx.slots.register({
|
|
938
2266
|
name: "conversation.chat.turnTail",
|
|
939
|
-
|
|
2267
|
+
id: "@deepseek-ai/dsh-client-ui-deliverables",
|
|
940
2268
|
locale: NS,
|
|
2269
|
+
children: { "deliverables.file.actions": {
|
|
2270
|
+
kind: "list",
|
|
2271
|
+
scope: "session"
|
|
2272
|
+
} },
|
|
941
2273
|
inject: () => ({
|
|
942
2274
|
hooks: {
|
|
2275
|
+
changesDiff: diffs.state,
|
|
943
2276
|
presentedOpen: opener.state,
|
|
944
|
-
presentedHost: opener.host
|
|
2277
|
+
presentedHost: opener.host,
|
|
2278
|
+
changesSummary: summaries.state,
|
|
2279
|
+
showCodeDiff: ctx.configForms.developerTools.enabled
|
|
945
2280
|
},
|
|
2281
|
+
loadChangesDiff: (sessionId, seq, index) => diffs.load(sessionId, seq, index),
|
|
946
2282
|
reloadPresentedHost: () => opener.loadHost(),
|
|
947
|
-
|
|
2283
|
+
loadChangesSummary: (sessionId, seq) => summaries.load(sessionId, seq),
|
|
2284
|
+
openPresented: (sessionId, seq, index, action, application) => opener.open(sessionId, seq, index, action, application),
|
|
2285
|
+
openChanged: (sessionId, seq, index, action, application) => opener.openChanged(sessionId, seq, index, action, application),
|
|
2286
|
+
openChangesReview: (coordinates, index) => {
|
|
2287
|
+
ctx.sidebarRight.openResource(changesReviewAddress(coordinates), { params: { index } });
|
|
2288
|
+
}
|
|
948
2289
|
})
|
|
949
|
-
},
|
|
2290
|
+
}, DeliverablesTail));
|
|
950
2291
|
ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
|
|
951
2292
|
name: "tool.call.toolview",
|
|
952
2293
|
key: "present",
|
|
953
2294
|
locale: NS
|
|
954
2295
|
}, PresentRow));
|
|
955
2296
|
const t = ctx.locale.bind(NS);
|
|
956
|
-
ctx.
|
|
2297
|
+
ctx.effect(() => ctx.sidebarRightTabs.register(changesReviewDefinition(t)), "ui-deliverables: changes-review type");
|
|
2298
|
+
ctx.effect(() => ctx.slots.inject("sidebar.right.pane.tab", () => ctx.slots.register({
|
|
2299
|
+
name: "sidebar.right.pane.tab",
|
|
2300
|
+
key: CHANGES_REVIEW_ID,
|
|
2301
|
+
locale: NS,
|
|
2302
|
+
store: createReviewStore(),
|
|
2303
|
+
children: { "deliverables.review.file.actions": {
|
|
2304
|
+
kind: "list",
|
|
2305
|
+
scope: "session"
|
|
2306
|
+
} },
|
|
2307
|
+
inject: () => ({
|
|
2308
|
+
hooks: {
|
|
2309
|
+
changesSummary: summaries.state,
|
|
2310
|
+
changesDiff: diffs.state,
|
|
2311
|
+
presentedOpen: opener.state,
|
|
2312
|
+
presentedHost: opener.host
|
|
2313
|
+
},
|
|
2314
|
+
loadChangesSummary: (sessionId, seq) => summaries.load(sessionId, seq),
|
|
2315
|
+
loadChangesDiff: (sessionId, seq, index) => diffs.load(sessionId, seq, index),
|
|
2316
|
+
reloadPresentedHost: () => opener.loadHost(),
|
|
2317
|
+
openChanged: (sessionId, seq, index, action, application) => opener.openChanged(sessionId, seq, index, action, application)
|
|
2318
|
+
})
|
|
2319
|
+
}, ReviewTab)), "ui-deliverables: changes-review body");
|
|
2320
|
+
ctx.provide("chatFileMentions", { forClosing(owner) {
|
|
957
2321
|
const paths = selectProducedFiles(owner);
|
|
958
2322
|
const presented = presentedForClosing(owner);
|
|
959
2323
|
if (paths === null && presented.length === 0) return void 0;
|
|
960
|
-
|
|
961
|
-
return producedFileMentions([...new Set([...paths ?? [], ...deliveries.keys()])], (path) => {
|
|
962
|
-
const file = deliveries.get(path);
|
|
963
|
-
if (file === void 0) owner.openFile(path);
|
|
964
|
-
else opener.open(sessionId, file.seq, file.index);
|
|
965
|
-
}, (path) => t(deliveries.has(path) ? "presented.open" : "produced.open", { name: path }));
|
|
2324
|
+
return producedFileMentions([...new Set([...paths ?? [], ...presented.map((file) => file.path)])], owner.openFile, (path) => t("presented.previewButton", { name: path }));
|
|
966
2325
|
} });
|
|
967
2326
|
}
|
|
968
2327
|
//#endregion
|
|
969
|
-
exports.ProducedFiles = ProducedFiles;
|
|
970
2328
|
exports.apply = apply;
|
|
971
2329
|
exports.inject = inject;
|
|
972
|
-
exports.producedForClosing = producedForClosing;
|
|
973
2330
|
return module.exports;
|
|
974
2331
|
}
|
|
975
2332
|
});
|