dsh-edit-diff 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -18
- package/docs//344/274/230/345/214/226diff.webp +0 -0
- package/docs//345/216/237/347/211/210diff.webp +0 -0
- package/lib/client.js +603 -438
- package/lib/client.js.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.js +8 -7
- package/package.json +22 -5
- package/docs//345/216/273/351/207/215/345/244/215diff.webp +0 -0
package/lib/client.js
CHANGED
|
@@ -1,440 +1,605 @@
|
|
|
1
|
-
// dsh-edit-diff 浏览器端,标准 dsh client bundle 形态。
|
|
2
|
-
//
|
|
3
|
-
// 通过 window.__ModuleLoader__.load 注册模块表条目,factory 从注入的 require
|
|
4
|
-
// 解析 react 等外部依赖。默认导出 Cordis 插件对象,由浏览器内核挂载。
|
|
5
|
-
//
|
|
6
|
-
// 接管 edit/write 工具卡片:内置 DiffBlock 对新旧全文逐行染色,不做行级匹配,
|
|
7
|
-
// 相同行在红绿两区各渲染一遍。本插件接管 tool.call.toolview 的 edit/write key,
|
|
8
|
-
// 用近线性行级 diff 公共前缀/后缀收缩 + Myers 跳过相同行,替换行做字符级
|
|
9
|
-
// 下划线高亮。视觉对齐内置 DiffBlock/ToolRow。卡片默认收起,长 diff 二次折叠。
|
|
10
|
-
// PTC 模式下 run_code 子调用中的 edit/write 同样显示去重 diff,
|
|
11
|
-
// 通过 callId 中的 :code: 标记识别子调用,从 argsRaw 动态构建 diff。
|
|
12
|
-
|
|
13
1
|
window.__ModuleLoader__.load({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
2
|
+
id: "dsh-edit-diff",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperties(exports, {
|
|
7
|
+
__esModule: { value: true },
|
|
8
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
9
|
+
});
|
|
10
|
+
//#region \0rolldown/runtime.js
|
|
11
|
+
var __create = Object.create;
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
15
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
16
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
19
|
+
key = keys[i];
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
21
|
+
get: ((k) => from[k]).bind(null, key),
|
|
22
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
//#endregion
|
|
32
|
+
let react = require("react");
|
|
33
|
+
react = __toESM(react, 1);
|
|
34
|
+
//#region src/client.ts
|
|
35
|
+
/** 文档对象,非浏览器环境下为 null。 */
|
|
36
|
+
const DOC = typeof document !== "undefined" ? document : null;
|
|
37
|
+
/** 行级 Myers:前缀/后缀收缩后仅对中间核心区跑 diff,返回 op 数组。 */
|
|
38
|
+
function myersDiff(aList, bList) {
|
|
39
|
+
const N = aList.length;
|
|
40
|
+
const M = bList.length;
|
|
41
|
+
const max = N + M;
|
|
42
|
+
let prev = { 1: 0 };
|
|
43
|
+
const trace = [];
|
|
44
|
+
let dMax = 0;
|
|
45
|
+
let found = false;
|
|
46
|
+
for (let d = 0; d <= max; d++) {
|
|
47
|
+
trace.push({ ...prev });
|
|
48
|
+
const cur = {};
|
|
49
|
+
for (let k = -d; k <= d; k += 2) {
|
|
50
|
+
let x;
|
|
51
|
+
if (k === -d || k !== d && (prev[k - 1] ?? -Infinity) < (prev[k + 1] ?? -Infinity)) x = prev[k + 1] ?? 0;
|
|
52
|
+
else x = (prev[k - 1] ?? -1) + 1;
|
|
53
|
+
let y = x - k;
|
|
54
|
+
while (x < N && y < M && aList[x] === bList[y]) {
|
|
55
|
+
x++;
|
|
56
|
+
y++;
|
|
57
|
+
}
|
|
58
|
+
cur[k] = x;
|
|
59
|
+
if (x >= N && y >= M) {
|
|
60
|
+
dMax = d;
|
|
61
|
+
found = true;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
prev = cur;
|
|
66
|
+
if (found) break;
|
|
67
|
+
}
|
|
68
|
+
if (!found) {
|
|
69
|
+
const ops = [];
|
|
70
|
+
for (let i = 0; i < N; i++) ops.push({
|
|
71
|
+
type: "del",
|
|
72
|
+
a: i,
|
|
73
|
+
b: -1
|
|
74
|
+
});
|
|
75
|
+
for (let j = 0; j < M; j++) ops.push({
|
|
76
|
+
type: "add",
|
|
77
|
+
a: -1,
|
|
78
|
+
b: j
|
|
79
|
+
});
|
|
80
|
+
return ops;
|
|
81
|
+
}
|
|
82
|
+
const ops = [];
|
|
83
|
+
let x = N;
|
|
84
|
+
let y = M;
|
|
85
|
+
for (let d = dMax; d > 0; d--) {
|
|
86
|
+
const t = trace[d] ?? {};
|
|
87
|
+
const k = x - y;
|
|
88
|
+
let prevK;
|
|
89
|
+
if (k === -d || k !== d && (t[k - 1] ?? -Infinity) < (t[k + 1] ?? -Infinity)) prevK = k + 1;
|
|
90
|
+
else prevK = k - 1;
|
|
91
|
+
const prevX = t[prevK] ?? 0;
|
|
92
|
+
const prevY = prevX - prevK;
|
|
93
|
+
while (x > prevX && y > prevY) {
|
|
94
|
+
ops.push({
|
|
95
|
+
type: "same",
|
|
96
|
+
a: x - 1,
|
|
97
|
+
b: y - 1
|
|
98
|
+
});
|
|
99
|
+
x--;
|
|
100
|
+
y--;
|
|
101
|
+
}
|
|
102
|
+
if (x === prevX) {
|
|
103
|
+
ops.push({
|
|
104
|
+
type: "add",
|
|
105
|
+
a: -1,
|
|
106
|
+
b: y - 1
|
|
107
|
+
});
|
|
108
|
+
y--;
|
|
109
|
+
} else {
|
|
110
|
+
ops.push({
|
|
111
|
+
type: "del",
|
|
112
|
+
a: x - 1,
|
|
113
|
+
b: -1
|
|
114
|
+
});
|
|
115
|
+
x--;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
while (x > 0 && y > 0) {
|
|
119
|
+
ops.push({
|
|
120
|
+
type: "same",
|
|
121
|
+
a: x - 1,
|
|
122
|
+
b: y - 1
|
|
123
|
+
});
|
|
124
|
+
x--;
|
|
125
|
+
y--;
|
|
126
|
+
}
|
|
127
|
+
ops.reverse();
|
|
128
|
+
return ops;
|
|
129
|
+
}
|
|
130
|
+
/** 行级 diff:线性前缀/后缀收缩,仅对中间核心区跑 Myers。 */
|
|
131
|
+
function lineDiff(aLines, bLines) {
|
|
132
|
+
let p = 0;
|
|
133
|
+
const minLen = Math.min(aLines.length, bLines.length);
|
|
134
|
+
while (p < minLen && aLines[p] === bLines[p]) p++;
|
|
135
|
+
let s = 0;
|
|
136
|
+
const al = aLines.length;
|
|
137
|
+
const bl = bLines.length;
|
|
138
|
+
while (s < minLen - p && aLines[al - 1 - s] === bLines[bl - 1 - s]) s++;
|
|
139
|
+
const ops = [];
|
|
140
|
+
for (let i = 0; i < p; i++) ops.push({
|
|
141
|
+
type: "same",
|
|
142
|
+
a: i,
|
|
143
|
+
b: i
|
|
144
|
+
});
|
|
145
|
+
const aMid = aLines.slice(p, al - s);
|
|
146
|
+
const bMid = bLines.slice(p, bl - s);
|
|
147
|
+
for (const op of myersDiff(aMid, bMid)) ops.push({
|
|
148
|
+
type: op.type,
|
|
149
|
+
a: op.a === -1 ? -1 : op.a + p,
|
|
150
|
+
b: op.b === -1 ? -1 : op.b + p
|
|
151
|
+
});
|
|
152
|
+
for (let i = 0; i < s; i++) ops.push({
|
|
153
|
+
type: "same",
|
|
154
|
+
a: al - s + i,
|
|
155
|
+
b: bl - s + i
|
|
156
|
+
});
|
|
157
|
+
return ops;
|
|
158
|
+
}
|
|
159
|
+
/** 把字符级 op 汇总成高亮区间 [start, end)。 */
|
|
160
|
+
function charRanges(ops) {
|
|
161
|
+
const delIdx = [];
|
|
162
|
+
const addIdx = [];
|
|
163
|
+
for (const op of ops) if (op.type === "del") delIdx.push(op.a);
|
|
164
|
+
else if (op.type === "add") addIdx.push(op.b);
|
|
165
|
+
const mk = (idx) => {
|
|
166
|
+
if (idx.length === 0) return [];
|
|
167
|
+
idx.sort((a, b) => a - b);
|
|
168
|
+
const out = [];
|
|
169
|
+
let start = idx[0];
|
|
170
|
+
let end = start;
|
|
171
|
+
for (let i = 1; i < idx.length; i++) {
|
|
172
|
+
const value = idx[i];
|
|
173
|
+
if (value === end + 1) end = value;
|
|
174
|
+
else {
|
|
175
|
+
out.push([start, end + 1]);
|
|
176
|
+
start = value;
|
|
177
|
+
end = value;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
out.push([start, end + 1]);
|
|
181
|
+
return out;
|
|
182
|
+
};
|
|
183
|
+
return {
|
|
184
|
+
del: mk(delIdx),
|
|
185
|
+
add: mk(addIdx)
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function lineHighlight(oldStr, newStr) {
|
|
189
|
+
return charRanges(myersDiff([...oldStr], [...newStr]));
|
|
190
|
+
}
|
|
191
|
+
function contentLines(text) {
|
|
192
|
+
if (text === "") return [];
|
|
193
|
+
return (text.endsWith("\n") ? text.slice(0, -1) : text).split("\n");
|
|
194
|
+
}
|
|
195
|
+
/** 从 ops 构建渲染行,仅含真实差异;替换对删/增行数相等做行内字符高亮。 */
|
|
196
|
+
function buildDiffLines(oldLines, newLines) {
|
|
197
|
+
const ops = lineDiff(oldLines, newLines);
|
|
198
|
+
const out = [];
|
|
199
|
+
let i = 0;
|
|
200
|
+
while (i < ops.length) {
|
|
201
|
+
if (ops[i]?.type === "same") {
|
|
202
|
+
i++;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const dStart = i;
|
|
206
|
+
while (i < ops.length && ops[i]?.type === "del") i++;
|
|
207
|
+
const addStart = i;
|
|
208
|
+
while (i < ops.length && ops[i]?.type === "add") i++;
|
|
209
|
+
const delOps = ops.slice(dStart, addStart);
|
|
210
|
+
const addOps = ops.slice(addStart, i);
|
|
211
|
+
if (delOps.length === addOps.length && delOps.length > 0) for (let k = 0; k < delOps.length; k++) {
|
|
212
|
+
const del = delOps[k];
|
|
213
|
+
const add = addOps[k];
|
|
214
|
+
if (del === void 0 || add === void 0) continue;
|
|
215
|
+
const oldText = oldLines[del.a] ?? "";
|
|
216
|
+
const newText = newLines[add.b] ?? "";
|
|
217
|
+
const hl = lineHighlight(oldText, newText);
|
|
218
|
+
out.push({
|
|
219
|
+
kind: "del",
|
|
220
|
+
text: oldText,
|
|
221
|
+
hl: hl.del
|
|
222
|
+
});
|
|
223
|
+
out.push({
|
|
224
|
+
kind: "add",
|
|
225
|
+
text: newText,
|
|
226
|
+
hl: hl.add
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
for (const op of delOps) out.push({
|
|
231
|
+
kind: "del",
|
|
232
|
+
text: oldLines[op.a] ?? "",
|
|
233
|
+
hl: []
|
|
234
|
+
});
|
|
235
|
+
for (const op of addOps) out.push({
|
|
236
|
+
kind: "add",
|
|
237
|
+
text: newLines[op.b] ?? "",
|
|
238
|
+
hl: []
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return out;
|
|
243
|
+
}
|
|
244
|
+
/** 收窄外部 diff 数据,字段不合法时返回 null。 */
|
|
245
|
+
function narrowDiffs(diffs) {
|
|
246
|
+
if (!Array.isArray(diffs) || diffs.length === 0) return null;
|
|
247
|
+
const out = [];
|
|
248
|
+
for (const item of diffs) {
|
|
249
|
+
if (item === null || typeof item !== "object") return null;
|
|
250
|
+
const record = item;
|
|
251
|
+
if (typeof record.path !== "string") return null;
|
|
252
|
+
if (record.oldText !== null && typeof record.oldText !== "string") return null;
|
|
253
|
+
if (typeof record.newText !== "string") return null;
|
|
254
|
+
out.push({
|
|
255
|
+
path: record.path,
|
|
256
|
+
oldText: record.oldText,
|
|
257
|
+
newText: record.newText
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
return out;
|
|
261
|
+
}
|
|
262
|
+
/** 从卡片数据块中取出 diff,取不到时回退到参数意图。 */
|
|
263
|
+
function extractDiffs(block) {
|
|
264
|
+
const done = "kind" in block;
|
|
265
|
+
const subCall = block.parentCallId !== void 0 || typeof block.callId === "string" && block.callId.includes(":code:");
|
|
266
|
+
if (done && !subCall && block.isError !== true) {
|
|
267
|
+
const meta = block.meta;
|
|
268
|
+
if (meta !== null && typeof meta === "object" && !Array.isArray(meta)) {
|
|
269
|
+
const diffs = meta.diffs;
|
|
270
|
+
if (Array.isArray(diffs) && diffs.length > 0) {
|
|
271
|
+
const narrowed = narrowDiffs(diffs);
|
|
272
|
+
if (narrowed !== null) return narrowed;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if (done && !subCall && block.isError === true) return null;
|
|
277
|
+
const rawArgs = (block.call !== void 0 ? block.call.argsRaw : block.argsRaw) ?? "";
|
|
278
|
+
const argsRaw = typeof rawArgs === "string" ? rawArgs : "";
|
|
279
|
+
const name = block.call !== void 0 ? block.call.name : block.name;
|
|
280
|
+
if (name === "edit" || name === "write") try {
|
|
281
|
+
const args = JSON.parse(argsRaw);
|
|
282
|
+
if (args !== null && typeof args === "object") {
|
|
283
|
+
const record = args;
|
|
284
|
+
const filePath = record.file_path;
|
|
285
|
+
if (typeof filePath === "string" && filePath !== "") {
|
|
286
|
+
if (name === "write" && typeof record.content === "string") return narrowDiffs([{
|
|
287
|
+
path: filePath,
|
|
288
|
+
oldText: null,
|
|
289
|
+
newText: record.content
|
|
290
|
+
}]);
|
|
291
|
+
if (name === "edit" && typeof record.old_string === "string" && typeof record.new_string === "string") return narrowDiffs([{
|
|
292
|
+
path: filePath,
|
|
293
|
+
oldText: record.old_string || null,
|
|
294
|
+
newText: record.new_string
|
|
295
|
+
}]);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
} catch {}
|
|
299
|
+
if (!done) {
|
|
300
|
+
const callView = block.callView;
|
|
301
|
+
if (callView === null || typeof callView !== "object" || callView.card !== "diff") return null;
|
|
302
|
+
return narrowDiffs(callView.diffs);
|
|
303
|
+
}
|
|
304
|
+
const resultView = block.resultView;
|
|
305
|
+
if (resultView === null || typeof resultView !== "object" || resultView.card !== "diff") return null;
|
|
306
|
+
return narrowDiffs(resultView.diffs);
|
|
307
|
+
}
|
|
308
|
+
/** 汇总工具结果文本。 */
|
|
309
|
+
function resultText(block) {
|
|
310
|
+
if (!("kind" in block)) return "";
|
|
311
|
+
const parts = [];
|
|
312
|
+
const content = Array.isArray(block.content) ? block.content : [];
|
|
313
|
+
for (const item of content) {
|
|
314
|
+
const record = item !== null && typeof item === "object" ? item : null;
|
|
315
|
+
const isText = record !== null && record.type === "text" && typeof record.text === "string";
|
|
316
|
+
parts.push(isText ? record.text : JSON.stringify(item));
|
|
317
|
+
}
|
|
318
|
+
if (parts.length === 0 && block.error !== void 0) parts.push(String(block.error.name) + ": " + String(block.error.code));
|
|
319
|
+
return parts.join("\n");
|
|
320
|
+
}
|
|
321
|
+
function firstLine(t) {
|
|
322
|
+
const n = t.indexOf("\n");
|
|
323
|
+
return n === -1 ? t : t.slice(0, n);
|
|
324
|
+
}
|
|
325
|
+
/** 由数据块推导卡片模型。 */
|
|
326
|
+
function buildCardModel(block, toolName, cwd) {
|
|
327
|
+
const done = "kind" in block;
|
|
328
|
+
const rawArgs = done ? block.call?.argsRaw ?? "" : block.argsRaw ?? "";
|
|
329
|
+
const argsRaw = typeof rawArgs === "string" ? rawArgs : "";
|
|
330
|
+
const state = !done ? "running" : block.error?.code === "interrupted" ? "stopped" : block.isError === true ? "error" : "ok";
|
|
331
|
+
let filePath;
|
|
332
|
+
let summary = "";
|
|
333
|
+
try {
|
|
334
|
+
const parsed = JSON.parse(argsRaw);
|
|
335
|
+
if (parsed !== null && typeof parsed === "object") {
|
|
336
|
+
const record = parsed;
|
|
337
|
+
const p = record.file_path ?? record.path;
|
|
338
|
+
if (typeof p === "string" && p !== "") filePath = firstLine(p);
|
|
339
|
+
const values = Object.values(record).filter((v) => typeof v === "string" && v !== "");
|
|
340
|
+
summary = values.length > 0 ? firstLine(values[0]) : argsRaw;
|
|
341
|
+
} else summary = firstLine(argsRaw);
|
|
342
|
+
} catch {
|
|
343
|
+
summary = firstLine(argsRaw);
|
|
344
|
+
}
|
|
345
|
+
if (filePath !== void 0) summary = filePath;
|
|
346
|
+
if (filePath !== void 0 && cwd !== void 0) {
|
|
347
|
+
const root = cwd.replace(/[/\\]+$/, "");
|
|
348
|
+
if (filePath.startsWith(root + "/") || filePath.startsWith(root + "\\")) summary = filePath.slice(root.length + 1);
|
|
349
|
+
}
|
|
350
|
+
const title = toolName === "edit" ? "Edit" : toolName === "write" ? "Write" : toolName ?? "";
|
|
351
|
+
const diffs = extractDiffs(block);
|
|
352
|
+
const output = done ? resultText(block) || null : null;
|
|
353
|
+
return {
|
|
354
|
+
title,
|
|
355
|
+
summary,
|
|
356
|
+
filePath,
|
|
357
|
+
state,
|
|
358
|
+
diffs,
|
|
359
|
+
output
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function DiffCard(props) {
|
|
363
|
+
const { block, cwd, openFile, inspect, toolName } = props;
|
|
364
|
+
const [open, setOpen] = react.useState(false);
|
|
365
|
+
const [revealed, setRevealed] = react.useState(false);
|
|
366
|
+
const [copied, setCopied] = react.useState(false);
|
|
367
|
+
const m = buildCardModel(block, toolName, cwd);
|
|
368
|
+
const fileLines = m.diffs === null ? null : m.diffs.map((d) => ({
|
|
369
|
+
path: d.path,
|
|
370
|
+
lines: buildDiffLines(contentLines(d.oldText ?? ""), contentLines(d.newText))
|
|
371
|
+
}));
|
|
372
|
+
const displayLines = fileLines !== null && fileLines.some((f) => f.lines.length > 0) ? fileLines : null;
|
|
373
|
+
const addCount = displayLines === null ? 0 : displayLines.reduce((sum, f) => sum + f.lines.filter((l) => l.kind === "add").length, 0);
|
|
374
|
+
const delCount = displayLines === null ? 0 : displayLines.reduce((sum, f) => sum + f.lines.filter((l) => l.kind === "del").length, 0);
|
|
375
|
+
const files = m.diffs === null ? 0 : m.diffs.length;
|
|
376
|
+
const expandable = displayLines !== null || m.output !== null;
|
|
377
|
+
const status = m.state === "running" ? "运行中" : m.state === "error" ? "失败" : m.state === "stopped" ? "已中断" : null;
|
|
378
|
+
const failureSummary = m.state === "error" && m.output !== null ? firstLine(m.output) : null;
|
|
379
|
+
const summaryText = failureSummary !== null ? failureSummary : m.summary || m.title;
|
|
380
|
+
const fileLink = m.filePath !== void 0 && openFile !== void 0 && failureSummary === null;
|
|
381
|
+
const MAX = 14;
|
|
382
|
+
let flatLines = null;
|
|
383
|
+
let hidden = 0;
|
|
384
|
+
if (displayLines !== null && open) {
|
|
385
|
+
const rows = [];
|
|
386
|
+
for (const f of displayLines) {
|
|
387
|
+
rows.push({
|
|
388
|
+
kind: "path",
|
|
389
|
+
text: f.path,
|
|
390
|
+
hl: []
|
|
391
|
+
});
|
|
392
|
+
rows.push(...f.lines);
|
|
393
|
+
}
|
|
394
|
+
hidden = rows.length - MAX;
|
|
395
|
+
if (hidden < 0) hidden = 0;
|
|
396
|
+
if (hidden > 0 && !revealed) {
|
|
397
|
+
const headN = Math.ceil(MAX / 2);
|
|
398
|
+
flatLines = [
|
|
399
|
+
...rows.slice(0, headN),
|
|
400
|
+
{
|
|
401
|
+
kind: "mid",
|
|
402
|
+
text: "⋯ 展开其余 " + hidden + " 行差异",
|
|
403
|
+
hl: []
|
|
404
|
+
},
|
|
405
|
+
...rows.slice(rows.length - 7)
|
|
406
|
+
];
|
|
407
|
+
} else flatLines = rows;
|
|
408
|
+
}
|
|
409
|
+
const onToggle = () => {
|
|
410
|
+
setOpen((v) => !v);
|
|
411
|
+
setRevealed(false);
|
|
412
|
+
};
|
|
413
|
+
const onOpenFile = (event) => {
|
|
414
|
+
event.stopPropagation();
|
|
415
|
+
if (m.filePath !== void 0 && openFile !== void 0) openFile(m.filePath);
|
|
416
|
+
};
|
|
417
|
+
const onCopy = () => {
|
|
418
|
+
if (copied || flatLines === null || flatLines.length === 0) return;
|
|
419
|
+
copyTextIntoClipboard(flatLines.map((l) => l.kind === "del" ? "- " + l.text : l.kind === "add" ? "+ " + l.text : l.text).join("\n"));
|
|
420
|
+
setCopied(true);
|
|
421
|
+
const timeout = timerRef.timeout;
|
|
422
|
+
if (timeout !== null) timeout(() => setCopied(false), 1200);
|
|
423
|
+
};
|
|
424
|
+
const rowType = m.title === "Write" ? "write" : m.title === "Edit" ? "edit" : "file";
|
|
425
|
+
return react.createElement("div", {
|
|
426
|
+
className: "edd-root",
|
|
427
|
+
"data-variant": rowType,
|
|
428
|
+
"data-state": m.state
|
|
429
|
+
}, status !== null && react.createElement("span", { className: "edd-vh" }, status), react.createElement("div", {
|
|
430
|
+
className: "edd-row",
|
|
431
|
+
onClick: onToggle,
|
|
432
|
+
role: "button",
|
|
433
|
+
tabIndex: expandable ? 0 : -1,
|
|
434
|
+
"aria-expanded": open
|
|
435
|
+
}, react.createElement("span", { className: "edd-icon" }, "✎"), react.createElement("span", { className: "edd-title" }, m.title), summaryText !== "" && react.createElement(react.Fragment, null, react.createElement("span", {
|
|
436
|
+
className: "edd-sep",
|
|
437
|
+
"aria-hidden": true
|
|
438
|
+
}), fileLink ? react.createElement("button", {
|
|
439
|
+
type: "button",
|
|
440
|
+
className: "edd-filelink",
|
|
441
|
+
onClick: onOpenFile
|
|
442
|
+
}, summaryText) : react.createElement("span", { className: "edd-summary" + (failureSummary !== null ? " edd-err" : "") }, summaryText)), expandable && react.createElement("span", { className: "edd-chev" + (open ? " edd-chev-open" : "") }, "›")), react.createElement("div", { className: "edd-bodyWrap" }, flatLines === null ? null : react.createElement("div", { className: "edd-body" }, react.createElement("button", {
|
|
443
|
+
type: "button",
|
|
444
|
+
className: "edd-copy",
|
|
445
|
+
onClick: onCopy
|
|
446
|
+
}, copied ? "复制成功" : "复制"), flatLines.map((line, idx) => {
|
|
447
|
+
if (line.kind === "mid") return react.createElement("button", {
|
|
448
|
+
key: idx,
|
|
449
|
+
type: "button",
|
|
450
|
+
className: "edd-expand",
|
|
451
|
+
onClick: () => setRevealed(true)
|
|
452
|
+
}, line.text);
|
|
453
|
+
const prefix = line.kind === "del" ? "-" : line.kind === "add" ? "+" : "";
|
|
454
|
+
const kids = [];
|
|
455
|
+
if (prefix !== "") kids.push(react.createElement("span", {
|
|
456
|
+
key: "p",
|
|
457
|
+
className: "edd-marker"
|
|
458
|
+
}, prefix));
|
|
459
|
+
if (line.kind === "del" || line.kind === "add") {
|
|
460
|
+
if (line.text.length === 0) kids.push(react.createElement("span", {
|
|
461
|
+
key: "e",
|
|
462
|
+
className: "edd-empty"
|
|
463
|
+
}, "␣"));
|
|
464
|
+
else if (line.hl.length > 0) {
|
|
465
|
+
let last = 0;
|
|
466
|
+
for (const range of line.hl) {
|
|
467
|
+
if (range[0] > last) kids.push(react.createElement("span", {
|
|
468
|
+
key: "t" + last,
|
|
469
|
+
className: "edd-plain"
|
|
470
|
+
}, line.text.slice(last, range[0])));
|
|
471
|
+
kids.push(react.createElement("span", {
|
|
472
|
+
key: "h" + range[0],
|
|
473
|
+
className: "edd-hl"
|
|
474
|
+
}, line.text.slice(range[0], range[1])));
|
|
475
|
+
last = range[1];
|
|
476
|
+
}
|
|
477
|
+
if (last < line.text.length) kids.push(react.createElement("span", {
|
|
478
|
+
key: "t" + last,
|
|
479
|
+
className: "edd-plain"
|
|
480
|
+
}, line.text.slice(last)));
|
|
481
|
+
} else kids.push(react.createElement("span", {
|
|
482
|
+
key: "t",
|
|
483
|
+
className: "edd-plain"
|
|
484
|
+
}, line.text));
|
|
485
|
+
} else kids.push(react.createElement("span", {
|
|
486
|
+
key: "t",
|
|
487
|
+
className: "edd-plain"
|
|
488
|
+
}, line.text));
|
|
489
|
+
return react.createElement("div", {
|
|
490
|
+
key: idx,
|
|
491
|
+
className: "edd-line " + (line.kind === "del" ? "edd-del" : line.kind === "add" ? "edd-add" : line.kind === "path" ? "edd-path" : "edd-plain-line")
|
|
492
|
+
}, kids);
|
|
493
|
+
})), open && m.output !== null && flatLines === null && react.createElement("div", { className: "edd-io" }, react.createElement("span", { className: "edd-iolabel" }, "OUT"), react.createElement("span", { className: "edd-iotext" }, m.output)), open && (flatLines !== null && flatLines.length > 0 || m.output !== null) && react.createElement("div", { className: "edd-foot" }, "└ +" + addCount + " -" + delCount + " · " + files + " file" + (files === 1 ? "" : "s")), open && react.createElement("div", { className: "edd-actions" }, inspect !== void 0 && (flatLines !== null && flatLines.length > 0 || m.output !== null) && react.createElement("button", {
|
|
494
|
+
type: "button",
|
|
495
|
+
className: "edd-inspect",
|
|
496
|
+
onClick: inspect
|
|
497
|
+
}, "Inspect"))));
|
|
498
|
+
}
|
|
499
|
+
/** 宿主 timer 服务的时间回调,未注入时为 null。 */
|
|
500
|
+
const timerRef = { timeout: null };
|
|
501
|
+
function copyTextIntoClipboard(txt) {
|
|
502
|
+
if (typeof navigator !== "undefined" && navigator.clipboard !== void 0 && navigator.clipboard.writeText !== void 0) {
|
|
503
|
+
navigator.clipboard.writeText(txt).catch(() => {});
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (DOC === null) return;
|
|
507
|
+
const ta = DOC.createElement("textarea");
|
|
508
|
+
ta.value = txt;
|
|
509
|
+
ta.style.position = "fixed";
|
|
510
|
+
ta.style.opacity = "0";
|
|
511
|
+
DOC.body.appendChild(ta);
|
|
512
|
+
ta.select();
|
|
513
|
+
try {
|
|
514
|
+
DOC.execCommand("copy");
|
|
515
|
+
} catch {}
|
|
516
|
+
DOC.body.removeChild(ta);
|
|
517
|
+
}
|
|
518
|
+
const CSS = [
|
|
519
|
+
".edd-root{box-sizing:border-box;color:var(--dsw-alias-label-primary);}",
|
|
520
|
+
".edd-vh{position:absolute;width:1px;height:1px;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap;}",
|
|
521
|
+
".edd-row{display:flex;align-items:center;gap:6px;cursor:pointer;min-height:24px;padding:4px 0;font-size:14px;line-height:24px;}",
|
|
522
|
+
".edd-icon{color:var(--dsw-alias-label-secondary);flex:none;font-style:normal;}",
|
|
523
|
+
".edd-title{font-weight:400;flex:none;color:var(--dsw-alias-label-primary);}",
|
|
524
|
+
".edd-sep{flex:none;width:2px;height:2px;border-radius:1px;margin:0 8px;background:var(--dsw-alias-label-caption);}",
|
|
525
|
+
".edd-summary{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:24px;color:var(--dsw-alias-label-tertiary);text-align:left;}",
|
|
526
|
+
".edd-err{color:var(--dsw-alias-state-error-primary);}",
|
|
527
|
+
".edd-filelink{flex:1 1 auto;min-width:0;margin:0;padding:0;border:none;background:none;font-family:inherit;font-size:14px;line-height:24px;color:var(--dsw-alias-label-secondary);text-decoration:underline;text-decoration-color:var(--dsw-alias-label-quaternary);text-underline-offset:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;cursor:pointer;}",
|
|
528
|
+
".edd-filelink:hover{color:var(--dsw-alias-label-primary);text-decoration-color:currentColor;}",
|
|
529
|
+
".edd-chev{margin-left:auto;color:var(--dsw-alias-label-secondary);flex:none;transition:transform .12s;display:inline-block;}",
|
|
530
|
+
".edd-chev-open{transform:rotate(90deg);}",
|
|
531
|
+
".edd-bodyWrap{overflow:hidden;}",
|
|
532
|
+
".edd-body{position:relative;margin:8px 0;background:var(--dsw-alias-markdown-code-block);border-radius:12px;font:var(--dsw-font-markdown-code-block);overflow-x:auto;overflow-y:hidden;padding:12px 14px 12px 14px;box-sizing:border-box;}",
|
|
533
|
+
".edd-copy{position:absolute;top:8px;right:12px;z-index:1;background-color:transparent;border:none;padding:0;margin:0;color:var(--dsw-alias-label-secondary);cursor:pointer;font:var(--dsw-font-xs-13);}",
|
|
534
|
+
".edd-copy:hover{color:var(--dsw-alias-label-primary);}",
|
|
535
|
+
".edd-path{color:var(--dsw-alias-label-primary);font-weight:600;padding-right:56px;}",
|
|
536
|
+
".edd-line{min-height:22px;white-space:pre;}",
|
|
537
|
+
".edd-del{color:var(--dsw-alias-state-error-primary);}",
|
|
538
|
+
".edd-add{color:var(--dsw-alias-state-success-primary);}",
|
|
539
|
+
".edd-marker{color:inherit;opacity:1;user-select:none;}",
|
|
540
|
+
".edd-plain{white-space:pre;}",
|
|
541
|
+
".edd-empty{opacity:.5;font-style:italic;}",
|
|
542
|
+
".edd-hl{text-decoration:underline;text-decoration-thickness:2px;text-decoration-color:currentColor;font-weight:600;}",
|
|
543
|
+
".edd-expand{display:inline-block;margin:2px 0;padding:1px 0;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;font:var(--dsw-font-markdown-code-block);text-align:left;}",
|
|
544
|
+
".edd-expand:hover{color:var(--dsw-alias-label-secondary);}",
|
|
545
|
+
".edd-foot{padding:0 14px 12px;font:var(--dsw-font-markdown-code-block);color:var(--dsw-alias-label-tertiary);}",
|
|
546
|
+
".edd-io{padding:8px 14px;}",
|
|
547
|
+
".edd-iolabel{margin-right:8px;color:var(--dsw-alias-label-caption);font-weight:600;}",
|
|
548
|
+
".edd-iotext{color:var(--dsw-alias-label-secondary);white-space:pre-wrap;word-break:break-word;}",
|
|
549
|
+
".edd-actions{padding:4px 0 2px 4px;}",
|
|
550
|
+
".edd-inspect{display:inline-flex;align-items:center;gap:4px;margin:0;padding:2px 8px;border:1px solid var(--dsw-alias-border-l2);border-radius:999px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);font-size:11px;line-height:16px;cursor:pointer;opacity:0;transition:opacity .12s ease;}",
|
|
551
|
+
".edd-root:hover .edd-inspect,.edd-inspect:focus-visible{opacity:1;}",
|
|
552
|
+
".edd-inspect:hover{background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary);}"
|
|
553
|
+
].join("");
|
|
554
|
+
let styleTag = null;
|
|
555
|
+
function ensureStyle() {
|
|
556
|
+
if (DOC === null || styleTag !== null) return;
|
|
557
|
+
const tag = DOC.createElement("style");
|
|
558
|
+
tag.dataset.plugin = "dsh-edit-diff";
|
|
559
|
+
tag.textContent = CSS;
|
|
560
|
+
DOC.head.appendChild(tag);
|
|
561
|
+
styleTag = tag;
|
|
562
|
+
}
|
|
563
|
+
const plugin = {
|
|
564
|
+
name: "dsh-edit-diff",
|
|
565
|
+
inject: ["slots", "timer"],
|
|
566
|
+
apply(ctx) {
|
|
567
|
+
const slots = ctx.get?.("slots");
|
|
568
|
+
if (slots === void 0) return;
|
|
569
|
+
const timer = ctx.get?.("timer");
|
|
570
|
+
if (timer !== void 0 && typeof timer.timeout === "function") timerRef.timeout = (callback, ms) => {
|
|
571
|
+
timer.timeout(callback, ms);
|
|
572
|
+
};
|
|
573
|
+
ctx.effect(function() {
|
|
574
|
+
ensureStyle();
|
|
575
|
+
return function() {
|
|
576
|
+
if (styleTag !== null && styleTag.parentNode !== null) styleTag.parentNode.removeChild(styleTag);
|
|
577
|
+
styleTag = null;
|
|
578
|
+
};
|
|
579
|
+
});
|
|
580
|
+
slots.inject("tool.call.toolview", () => {
|
|
581
|
+
slots.register({
|
|
582
|
+
name: "tool.call.toolview",
|
|
583
|
+
key: "edit",
|
|
584
|
+
priority: -1
|
|
585
|
+
}, DiffCard);
|
|
586
|
+
slots.register({
|
|
587
|
+
name: "tool.call.toolview",
|
|
588
|
+
key: "write",
|
|
589
|
+
priority: -1
|
|
590
|
+
}, DiffCard);
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
const name = plugin.name;
|
|
595
|
+
const inject = plugin.inject;
|
|
596
|
+
//#endregion
|
|
597
|
+
exports.apply = plugin.apply;
|
|
598
|
+
exports.default = plugin;
|
|
599
|
+
exports.inject = inject;
|
|
600
|
+
exports.name = name;
|
|
601
|
+
return module.exports;
|
|
602
|
+
}
|
|
603
|
+
});
|
|
436
604
|
|
|
437
|
-
|
|
438
|
-
return module.exports
|
|
439
|
-
},
|
|
440
|
-
})
|
|
605
|
+
//# sourceMappingURL=client.js.map
|