codexmate 0.0.16 → 0.0.18

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/web-ui/logic.mjs CHANGED
@@ -1,4 +1,394 @@
1
1
  // 逻辑纯函数:供 Web UI 与单元测试共享
2
+ export const DEFAULT_API_BODY_LIMIT_BYTES = 4 * 1024 * 1024;
3
+ const LARGE_DIFF_LINE_LIMIT = 3000;
4
+ const LARGE_DIFF_SYNC_LOOKAHEAD = 64;
5
+
6
+ function measureUtf8ByteLength(input) {
7
+ const text = typeof input === 'string' ? input : String(input ?? '');
8
+ if (typeof TextEncoder === 'function') {
9
+ return new TextEncoder().encode(text).length;
10
+ }
11
+ if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
12
+ return Buffer.byteLength(text, 'utf8');
13
+ }
14
+ return unescape(encodeURIComponent(text)).length;
15
+ }
16
+
17
+ function buildApiRequestByteLength(action, params) {
18
+ return measureUtf8ByteLength(JSON.stringify({ action, params }));
19
+ }
20
+
21
+ function normalizeDiffText(input) {
22
+ const safe = typeof input === 'string' ? input : '';
23
+ const withoutBom = safe.charCodeAt(0) === 0xFEFF ? safe.slice(1) : safe;
24
+ return withoutBom.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
25
+ }
26
+
27
+ function splitDiffLines(input) {
28
+ let normalized = normalizeDiffText(input);
29
+ if (!normalized) return [];
30
+ if (normalized.endsWith('\n')) {
31
+ normalized = normalized.slice(0, -1);
32
+ }
33
+ if (!normalized) return [];
34
+ return normalized.split('\n');
35
+ }
36
+
37
+ function buildDiffLcsMatrix(beforeLines, afterLines) {
38
+ const rows = beforeLines.length + 1;
39
+ const cols = afterLines.length + 1;
40
+ const matrix = Array.from({ length: rows }, () => new Array(cols).fill(0));
41
+ for (let i = 1; i < rows; i += 1) {
42
+ const beforeLine = beforeLines[i - 1];
43
+ for (let j = 1; j < cols; j += 1) {
44
+ if (beforeLine === afterLines[j - 1]) {
45
+ matrix[i][j] = matrix[i - 1][j - 1] + 1;
46
+ } else {
47
+ const up = matrix[i - 1][j];
48
+ const left = matrix[i][j - 1];
49
+ matrix[i][j] = up >= left ? up : left;
50
+ }
51
+ }
52
+ }
53
+ return matrix;
54
+ }
55
+
56
+ function countDiffStats(lines) {
57
+ let added = 0;
58
+ let removed = 0;
59
+ let unchanged = 0;
60
+ for (const line of lines) {
61
+ if (line.type === 'add') {
62
+ added += 1;
63
+ } else if (line.type === 'del') {
64
+ removed += 1;
65
+ } else {
66
+ unchanged += 1;
67
+ }
68
+ }
69
+ return { added, removed, unchanged };
70
+ }
71
+
72
+ function buildCollapsedContextLine(hiddenCount) {
73
+ return {
74
+ type: 'context',
75
+ value: `... ${hiddenCount} unchanged lines ...`,
76
+ oldNumber: null,
77
+ newNumber: null
78
+ };
79
+ }
80
+
81
+ function compactContextRuns(lines, contextSize = 3) {
82
+ const compacted = [];
83
+ const keepCount = Number.isFinite(contextSize) ? Math.max(1, Math.floor(contextSize)) : 3;
84
+ let index = 0;
85
+ while (index < lines.length) {
86
+ if (!lines[index] || lines[index].type !== 'context') {
87
+ compacted.push(lines[index]);
88
+ index += 1;
89
+ continue;
90
+ }
91
+ const start = index;
92
+ while (index < lines.length && lines[index] && lines[index].type === 'context') {
93
+ index += 1;
94
+ }
95
+ const run = lines.slice(start, index);
96
+ if (run.length <= keepCount * 2 + 1) {
97
+ compacted.push(...run);
98
+ continue;
99
+ }
100
+ compacted.push(...run.slice(0, keepCount));
101
+ compacted.push(buildCollapsedContextLine(run.length - keepCount * 2));
102
+ compacted.push(...run.slice(-keepCount));
103
+ }
104
+ return compacted;
105
+ }
106
+
107
+ function buildExactDiffLines(beforeLines, afterLines) {
108
+ const matrix = buildDiffLcsMatrix(beforeLines, afterLines);
109
+ const lines = [];
110
+ let i = beforeLines.length;
111
+ let j = afterLines.length;
112
+ while (i > 0 || j > 0) {
113
+ if (i > 0 && j > 0 && beforeLines[i - 1] === afterLines[j - 1]) {
114
+ lines.push({
115
+ type: 'context',
116
+ value: beforeLines[i - 1],
117
+ oldNumber: i,
118
+ newNumber: j
119
+ });
120
+ i -= 1;
121
+ j -= 1;
122
+ continue;
123
+ }
124
+ const canAdd = j > 0;
125
+ const canDel = i > 0;
126
+ if (canAdd && (!canDel || matrix[i][j - 1] >= matrix[i - 1][j])) {
127
+ lines.push({
128
+ type: 'add',
129
+ value: afterLines[j - 1],
130
+ oldNumber: null,
131
+ newNumber: j
132
+ });
133
+ j -= 1;
134
+ continue;
135
+ }
136
+ if (canDel) {
137
+ lines.push({
138
+ type: 'del',
139
+ value: beforeLines[i - 1],
140
+ oldNumber: i,
141
+ newNumber: null
142
+ });
143
+ i -= 1;
144
+ }
145
+ }
146
+ lines.reverse();
147
+ return lines;
148
+ }
149
+
150
+ function findSyncPointInWindow(beforeLines, afterLines, beforeIndex, afterIndex, maxBeforeOffset, maxAfterOffset) {
151
+ if (maxBeforeOffset <= 0 && maxAfterOffset <= 0) {
152
+ return null;
153
+ }
154
+
155
+ for (let offset = 1; offset <= maxAfterOffset; offset += 1) {
156
+ if (beforeLines[beforeIndex] === afterLines[afterIndex + offset]) {
157
+ return { beforeIndex, afterIndex: afterIndex + offset };
158
+ }
159
+ }
160
+ for (let offset = 1; offset <= maxBeforeOffset; offset += 1) {
161
+ if (beforeLines[beforeIndex + offset] === afterLines[afterIndex]) {
162
+ return { beforeIndex: beforeIndex + offset, afterIndex };
163
+ }
164
+ }
165
+
166
+ const maxDistance = maxBeforeOffset + maxAfterOffset;
167
+ for (let distance = 2; distance <= maxDistance; distance += 1) {
168
+ const beforeStart = Math.max(1, distance - maxAfterOffset);
169
+ const beforeEnd = Math.min(maxBeforeOffset, distance - 1);
170
+ for (let beforeOffset = beforeStart; beforeOffset <= beforeEnd; beforeOffset += 1) {
171
+ const afterOffset = distance - beforeOffset;
172
+ if (beforeLines[beforeIndex + beforeOffset] === afterLines[afterIndex + afterOffset]) {
173
+ return {
174
+ beforeIndex: beforeIndex + beforeOffset,
175
+ afterIndex: afterIndex + afterOffset
176
+ };
177
+ }
178
+ }
179
+ }
180
+ return null;
181
+ }
182
+
183
+ function findNextSyncPoint(beforeLines, afterLines, beforeIndex, afterIndex, lookahead = LARGE_DIFF_SYNC_LOOKAHEAD) {
184
+ const remainingBefore = Math.max(0, beforeLines.length - beforeIndex - 1);
185
+ const remainingAfter = Math.max(0, afterLines.length - afterIndex - 1);
186
+ const maxWindow = Math.max(remainingBefore, remainingAfter);
187
+ if (maxWindow <= 0) {
188
+ return null;
189
+ }
190
+
191
+ const initialWindow = Number.isFinite(lookahead)
192
+ ? Math.max(1, Math.floor(lookahead))
193
+ : LARGE_DIFF_SYNC_LOOKAHEAD;
194
+ let window = Math.min(maxWindow, initialWindow);
195
+ while (window > 0) {
196
+ const syncPoint = findSyncPointInWindow(
197
+ beforeLines,
198
+ afterLines,
199
+ beforeIndex,
200
+ afterIndex,
201
+ Math.min(window, remainingBefore),
202
+ Math.min(window, remainingAfter)
203
+ );
204
+ if (syncPoint) {
205
+ return syncPoint;
206
+ }
207
+ if (window >= maxWindow) {
208
+ return null;
209
+ }
210
+ window = Math.min(maxWindow, window * 2);
211
+ }
212
+ return null;
213
+ }
214
+
215
+ function buildLargeDiffLines(beforeLines, afterLines) {
216
+ const rawLines = [];
217
+ let beforeIndex = 0;
218
+ let afterIndex = 0;
219
+
220
+ while (beforeIndex < beforeLines.length && afterIndex < afterLines.length) {
221
+ if (beforeLines[beforeIndex] === afterLines[afterIndex]) {
222
+ rawLines.push({
223
+ type: 'context',
224
+ value: beforeLines[beforeIndex],
225
+ oldNumber: beforeIndex + 1,
226
+ newNumber: afterIndex + 1
227
+ });
228
+ beforeIndex += 1;
229
+ afterIndex += 1;
230
+ continue;
231
+ }
232
+
233
+ const syncPoint = findNextSyncPoint(beforeLines, afterLines, beforeIndex, afterIndex);
234
+ if (!syncPoint) {
235
+ rawLines.push({
236
+ type: 'del',
237
+ value: beforeLines[beforeIndex],
238
+ oldNumber: beforeIndex + 1,
239
+ newNumber: null
240
+ });
241
+ rawLines.push({
242
+ type: 'add',
243
+ value: afterLines[afterIndex],
244
+ oldNumber: null,
245
+ newNumber: afterIndex + 1
246
+ });
247
+ beforeIndex += 1;
248
+ afterIndex += 1;
249
+ continue;
250
+ }
251
+
252
+ while (beforeIndex < syncPoint.beforeIndex) {
253
+ rawLines.push({
254
+ type: 'del',
255
+ value: beforeLines[beforeIndex],
256
+ oldNumber: beforeIndex + 1,
257
+ newNumber: null
258
+ });
259
+ beforeIndex += 1;
260
+ }
261
+ while (afterIndex < syncPoint.afterIndex) {
262
+ rawLines.push({
263
+ type: 'add',
264
+ value: afterLines[afterIndex],
265
+ oldNumber: null,
266
+ newNumber: afterIndex + 1
267
+ });
268
+ afterIndex += 1;
269
+ }
270
+ }
271
+
272
+ while (beforeIndex < beforeLines.length) {
273
+ rawLines.push({
274
+ type: 'del',
275
+ value: beforeLines[beforeIndex],
276
+ oldNumber: beforeIndex + 1,
277
+ newNumber: null
278
+ });
279
+ beforeIndex += 1;
280
+ }
281
+ while (afterIndex < afterLines.length) {
282
+ rawLines.push({
283
+ type: 'add',
284
+ value: afterLines[afterIndex],
285
+ oldNumber: null,
286
+ newNumber: afterIndex + 1
287
+ });
288
+ afterIndex += 1;
289
+ }
290
+
291
+ return {
292
+ lines: compactContextRuns(rawLines),
293
+ stats: countDiffStats(rawLines)
294
+ };
295
+ }
296
+
297
+ export function buildLineDiff(beforeText, afterText) {
298
+ const beforeLines = splitDiffLines(beforeText);
299
+ const afterLines = splitDiffLines(afterText);
300
+ const result = (beforeLines.length > LARGE_DIFF_LINE_LIMIT || afterLines.length > LARGE_DIFF_LINE_LIMIT)
301
+ ? buildLargeDiffLines(beforeLines, afterLines)
302
+ : {
303
+ lines: buildExactDiffLines(beforeLines, afterLines),
304
+ stats: null
305
+ };
306
+ const stats = result.stats || countDiffStats(result.lines);
307
+ return {
308
+ lines: result.lines,
309
+ stats,
310
+ oldLineCount: beforeLines.length,
311
+ newLineCount: afterLines.length,
312
+ truncated: false
313
+ };
314
+ }
315
+
316
+ export function buildAgentsDiffPreview(options = {}) {
317
+ const beforeText = normalizeDiffText(options.baseContent);
318
+ const afterText = normalizeDiffText(options.content);
319
+ const diff = buildLineDiff(beforeText, afterText);
320
+ return {
321
+ ...diff,
322
+ truncated: !!diff.truncated,
323
+ hasChanges: diff.truncated
324
+ ? beforeText !== afterText
325
+ : (diff.stats.added > 0 || diff.stats.removed > 0)
326
+ };
327
+ }
328
+
329
+ export function buildAgentsDiffPreviewRequest(options = {}) {
330
+ const contextRaw = typeof options.context === 'string' ? options.context.trim() : '';
331
+ const context = contextRaw || 'codex';
332
+ const params = {
333
+ content: typeof options.content === 'string' ? options.content : '',
334
+ lineEnding: options.lineEnding === '\r\n' ? '\r\n' : '\n',
335
+ context
336
+ };
337
+ if (context === 'openclaw-workspace') {
338
+ const fileName = typeof options.fileName === 'string' ? options.fileName.trim() : '';
339
+ if (fileName) {
340
+ params.fileName = fileName;
341
+ }
342
+ }
343
+
344
+ const maxRequestBytes = Number.isFinite(options.maxRequestBytes)
345
+ ? Math.max(1024, Math.floor(options.maxRequestBytes))
346
+ : DEFAULT_API_BODY_LIMIT_BYTES;
347
+ const hasBaseContent = typeof options.baseContent === 'string';
348
+ const paramsWithBaseContent = hasBaseContent
349
+ ? { ...params, baseContent: options.baseContent }
350
+ : params;
351
+ if (!hasBaseContent) {
352
+ return {
353
+ params,
354
+ omittedBaseContent: false,
355
+ exceedsBodyLimit: buildApiRequestByteLength('preview-agents-diff', params) > maxRequestBytes
356
+ };
357
+ }
358
+ if (buildApiRequestByteLength('preview-agents-diff', paramsWithBaseContent) <= maxRequestBytes) {
359
+ return {
360
+ params: paramsWithBaseContent,
361
+ omittedBaseContent: false,
362
+ exceedsBodyLimit: false
363
+ };
364
+ }
365
+ return {
366
+ params,
367
+ omittedBaseContent: true,
368
+ exceedsBodyLimit: buildApiRequestByteLength('preview-agents-diff', params) > maxRequestBytes
369
+ };
370
+ }
371
+
372
+ export function isAgentsDiffPreviewPayloadTooLarge(result = {}) {
373
+ const status = Number(result && result.status);
374
+ const errorCode = result && typeof result.errorCode === 'string' ? result.errorCode : '';
375
+ return status === 413 || errorCode === 'payload-too-large';
376
+ }
377
+
378
+ export function shouldApplyAgentsDiffPreviewResponse(options = {}) {
379
+ const requestToken = options && options.requestToken;
380
+ const activeRequestToken = options && options.activeRequestToken;
381
+ if (!requestToken || requestToken !== activeRequestToken) {
382
+ return false;
383
+ }
384
+ if (!options || !options.isVisible) {
385
+ return false;
386
+ }
387
+ const requestFingerprint = typeof options.requestFingerprint === 'string' ? options.requestFingerprint : '';
388
+ const currentFingerprint = typeof options.currentFingerprint === 'string' ? options.currentFingerprint : '';
389
+ return requestFingerprint === currentFingerprint;
390
+ }
391
+
2
392
  export function normalizeClaudeValue(value) {
3
393
  return typeof value === 'string' ? value.trim() : '';
4
394
  }
@@ -8,33 +398,63 @@ export function normalizeClaudeConfig(config) {
8
398
  return {
9
399
  apiKey: normalizeClaudeValue(safe.apiKey),
10
400
  baseUrl: normalizeClaudeValue(safe.baseUrl),
11
- model: normalizeClaudeValue(safe.model)
401
+ model: normalizeClaudeValue(safe.model),
402
+ authToken: normalizeClaudeValue(safe.authToken),
403
+ useKey: normalizeClaudeValue(safe.useKey),
404
+ externalCredentialType: normalizeClaudeValue(safe.externalCredentialType)
12
405
  };
13
406
  }
14
407
 
15
408
  export function normalizeClaudeSettingsEnv(env) {
16
409
  const safe = env && typeof env === 'object' ? env : {};
410
+ const apiKey = normalizeClaudeValue(safe.ANTHROPIC_API_KEY);
411
+ const authToken = normalizeClaudeValue(safe.ANTHROPIC_AUTH_TOKEN);
412
+ const useKey = normalizeClaudeValue(safe.CLAUDE_CODE_USE_KEY);
17
413
  return {
18
- apiKey: normalizeClaudeValue(safe.ANTHROPIC_API_KEY),
414
+ apiKey,
19
415
  baseUrl: normalizeClaudeValue(safe.ANTHROPIC_BASE_URL),
20
- model: normalizeClaudeValue(safe.ANTHROPIC_MODEL)
416
+ model: normalizeClaudeValue(safe.ANTHROPIC_MODEL) || 'glm-4.7',
417
+ authToken,
418
+ useKey,
419
+ externalCredentialType: apiKey
420
+ ? ''
421
+ : (authToken ? 'auth-token' : (useKey ? 'claude-code-use-key' : ''))
21
422
  };
22
423
  }
23
424
 
425
+ function normalizeClaudeComparableUrl(value) {
426
+ const trimmed = normalizeClaudeValue(value);
427
+ if (!trimmed) return '';
428
+ return trimmed.replace(/\/+$/g, '');
429
+ }
430
+
431
+ function hasClaudeCredential(config = {}) {
432
+ return !!(config.apiKey || config.authToken || config.useKey);
433
+ }
434
+
24
435
  export function matchClaudeConfigFromSettings(claudeConfigs = {}, env = {}) {
25
436
  const normalizedSettings = normalizeClaudeSettingsEnv(env);
26
- if (!normalizedSettings.apiKey || !normalizedSettings.baseUrl || !normalizedSettings.model) {
437
+ if (!normalizedSettings.baseUrl || !normalizedSettings.model || !hasClaudeCredential(normalizedSettings)) {
27
438
  return '';
28
439
  }
440
+ const comparableSettingsUrl = normalizeClaudeComparableUrl(normalizedSettings.baseUrl);
29
441
  const entries = Object.entries(claudeConfigs || {});
30
442
  for (const [name, config] of entries) {
31
443
  const normalizedConfig = normalizeClaudeConfig(config);
32
- if (!normalizedConfig.apiKey || !normalizedConfig.baseUrl || !normalizedConfig.model) {
444
+ if (!normalizedConfig.baseUrl || !normalizedConfig.model) {
33
445
  continue;
34
446
  }
35
- if (normalizedConfig.apiKey === normalizedSettings.apiKey
36
- && normalizedConfig.baseUrl === normalizedSettings.baseUrl
37
- && normalizedConfig.model === normalizedSettings.model) {
447
+ if (normalizeClaudeComparableUrl(normalizedConfig.baseUrl) !== comparableSettingsUrl
448
+ || normalizedConfig.model !== normalizedSettings.model) {
449
+ continue;
450
+ }
451
+ if (normalizedSettings.apiKey && normalizedConfig.apiKey === normalizedSettings.apiKey) {
452
+ return name;
453
+ }
454
+ if (!normalizedSettings.apiKey
455
+ && normalizedConfig.apiKey === ''
456
+ && normalizedConfig.externalCredentialType
457
+ && normalizedConfig.externalCredentialType === normalizedSettings.externalCredentialType) {
38
458
  return name;
39
459
  }
40
460
  }
@@ -43,18 +463,30 @@ export function matchClaudeConfigFromSettings(claudeConfigs = {}, env = {}) {
43
463
 
44
464
  export function findDuplicateClaudeConfigName(claudeConfigs = {}, config) {
45
465
  const normalized = normalizeClaudeConfig(config);
46
- if (!normalized.apiKey || !normalized.baseUrl || !normalized.model) {
466
+ if (!normalized.baseUrl || !normalized.model) {
467
+ return '';
468
+ }
469
+ const comparableUrl = normalizeClaudeComparableUrl(normalized.baseUrl);
470
+ const isExternal = !normalized.apiKey && !!normalized.externalCredentialType;
471
+ if (!normalized.apiKey && !isExternal) {
47
472
  return '';
48
473
  }
49
474
  const entries = Object.entries(claudeConfigs || {});
50
475
  for (const [name, existing] of entries) {
51
476
  const normalizedExisting = normalizeClaudeConfig(existing);
52
- if (!normalizedExisting.apiKey || !normalizedExisting.baseUrl || !normalizedExisting.model) {
477
+ if (!normalizedExisting.baseUrl || !normalizedExisting.model) {
478
+ continue;
479
+ }
480
+ if (normalizeClaudeComparableUrl(normalizedExisting.baseUrl) !== comparableUrl
481
+ || normalizedExisting.model !== normalized.model) {
53
482
  continue;
54
483
  }
55
- if (normalizedExisting.apiKey === normalized.apiKey
56
- && normalizedExisting.baseUrl === normalized.baseUrl
57
- && normalizedExisting.model === normalized.model) {
484
+ if (normalized.apiKey && normalizedExisting.apiKey === normalized.apiKey) {
485
+ return name;
486
+ }
487
+ if (isExternal
488
+ && !normalizedExisting.apiKey
489
+ && normalizedExisting.externalCredentialType === normalized.externalCredentialType) {
58
490
  return name;
59
491
  }
60
492
  }
@@ -126,6 +558,64 @@ export function buildSpeedTestIssue(name, result) {
126
558
  return null;
127
559
  }
128
560
 
561
+ export async function runLatestOnlyQueue(initialTarget, options = {}) {
562
+ const perform = typeof options.perform === 'function'
563
+ ? options.perform
564
+ : async () => {};
565
+ const consumePending = typeof options.consumePending === 'function'
566
+ ? options.consumePending
567
+ : () => '';
568
+ let currentTarget = typeof initialTarget === 'string' ? initialTarget.trim() : '';
569
+ let lastError = '';
570
+
571
+ while (currentTarget) {
572
+ try {
573
+ await perform(currentTarget);
574
+ lastError = '';
575
+ } catch (e) {
576
+ lastError = e && e.message ? e.message : 'queue task failed';
577
+ }
578
+ const queued = String(consumePending() || '').trim();
579
+ if (!queued || queued === currentTarget) {
580
+ break;
581
+ }
582
+ currentTarget = queued;
583
+ }
584
+
585
+ return {
586
+ lastTarget: currentTarget,
587
+ lastError
588
+ };
589
+ }
590
+
591
+ export function shouldForceCompactLayoutMode(options = {}) {
592
+ const viewportWidth = Number(options.viewportWidth || 0);
593
+ const screenWidth = Number(options.screenWidth || 0);
594
+ const screenHeight = Number(options.screenHeight || 0);
595
+ const shortEdge = Number(options.shortEdge || (screenWidth > 0 && screenHeight > 0 ? Math.min(screenWidth, screenHeight) : 0));
596
+ const maxTouchPoints = Number(options.maxTouchPoints || 0);
597
+ const userAgent = typeof options.userAgent === 'string' ? options.userAgent : '';
598
+ const isMobileUa = typeof options.isMobileUa === 'boolean'
599
+ ? options.isMobileUa
600
+ : /(Android|iPhone|iPad|iPod|Mobile)/i.test(userAgent);
601
+ const coarsePointer = !!options.coarsePointer;
602
+ const noHover = !!options.noHover;
603
+ const isSmallPhysicalScreen = shortEdge > 0 && shortEdge <= 920;
604
+ const isNarrowViewport = viewportWidth > 0 && viewportWidth <= 960;
605
+ const pointerSuggestsTouchOnly = coarsePointer && noHover;
606
+
607
+ if (isMobileUa) {
608
+ return isNarrowViewport || isSmallPhysicalScreen;
609
+ }
610
+ if (!pointerSuggestsTouchOnly) {
611
+ return false;
612
+ }
613
+ if (maxTouchPoints <= 0) {
614
+ return false;
615
+ }
616
+ return isSmallPhysicalScreen;
617
+ }
618
+
129
619
  // Session filtering helpers
130
620
  export function isSessionQueryEnabled(source) {
131
621
  const normalized = normalizeSessionSource(source, '');
@@ -308,7 +308,13 @@
308
308
  this.showMessage('请先选择要删除的 skill', 'error');
309
309
  return;
310
310
  }
311
- const confirmed = window.confirm(`确认删除 ${selected.length} 个 skill 吗?此操作不可撤销。`);
311
+ const confirmed = await this.requestConfirmDialog({
312
+ title: '删除 Skills',
313
+ message: `确认删除 ${selected.length} 个 skill 吗?此操作不可撤销。`,
314
+ confirmText: '删除',
315
+ cancelText: '取消',
316
+ danger: true
317
+ });
312
318
  if (!confirmed) {
313
319
  return;
314
320
  }