codexmate 0.0.24 → 0.0.26
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 +416 -391
- package/README.zh.md +349 -324
- package/cli/agents-files.js +224 -224
- package/cli/archive-helpers.js +446 -446
- package/cli/auth-profiles.js +375 -375
- package/cli/builtin-proxy.js +1079 -1044
- package/cli/claude-proxy.js +1022 -998
- package/cli/config-bootstrap.js +384 -384
- package/cli/config-health.js +338 -338
- package/cli/doctor-core.js +903 -903
- package/cli/import-skills-url.js +356 -334
- package/cli/openai-bridge.js +997 -950
- package/cli/openclaw-config.js +629 -629
- package/cli/session-convert-args.js +65 -0
- package/cli/session-convert-io.js +82 -0
- package/cli/session-convert.js +43 -0
- package/cli/session-usage.concurrent.js +28 -28
- package/cli/session-usage.js +118 -112
- package/cli/session-usage.models.js +176 -176
- package/cli/skills.js +1141 -1141
- package/cli/zip-commands.js +510 -510
- package/cli.js +15218 -13310
- package/lib/automation.js +404 -0
- package/lib/cli-file-utils.js +151 -151
- package/lib/cli-models-utils.js +379 -379
- package/lib/cli-network-utils.js +190 -190
- package/lib/cli-path-utils.js +85 -69
- package/lib/cli-session-utils.js +121 -121
- package/lib/cli-sessions.js +417 -386
- package/lib/cli-utils.js +155 -155
- package/lib/download-artifacts.js +92 -77
- package/lib/mcp-stdio.js +453 -440
- package/lib/task-orchestrator.js +869 -869
- package/lib/text-diff.js +303 -303
- package/lib/workflow-engine.js +340 -340
- package/package.json +74 -77
- package/plugins/README.md +20 -20
- package/plugins/README.zh-CN.md +20 -20
- package/plugins/prompt-templates/comment-polish/index.mjs +25 -25
- package/plugins/prompt-templates/computed.mjs +253 -253
- package/plugins/prompt-templates/index.mjs +8 -8
- package/plugins/prompt-templates/manifest.mjs +15 -15
- package/plugins/prompt-templates/methods.mjs +619 -619
- package/plugins/prompt-templates/overview.mjs +90 -90
- package/plugins/prompt-templates/ownership.mjs +19 -19
- package/plugins/prompt-templates/rule-ack/index.mjs +21 -21
- package/plugins/prompt-templates/storage.mjs +64 -64
- package/plugins/registry.mjs +16 -16
- package/web-ui/app.js +625 -609
- package/web-ui/index.html +35 -35
- package/web-ui/logic.agents-diff.mjs +386 -386
- package/web-ui/logic.claude.mjs +168 -168
- package/web-ui/logic.mjs +5 -5
- package/web-ui/logic.runtime.mjs +128 -128
- package/web-ui/logic.session-convert.mjs +70 -0
- package/web-ui/logic.sessions.mjs +709 -614
- package/web-ui/modules/api.mjs +90 -90
- package/web-ui/modules/app.computed.dashboard.mjs +171 -126
- package/web-ui/modules/app.computed.index.mjs +17 -17
- package/web-ui/modules/app.computed.main-tabs.mjs +205 -205
- package/web-ui/modules/app.computed.session.mjs +946 -653
- package/web-ui/modules/app.constants.mjs +15 -15
- package/web-ui/modules/app.methods.agents.mjs +632 -632
- package/web-ui/modules/app.methods.claude-config.mjs +179 -174
- package/web-ui/modules/app.methods.codex-config.mjs +860 -784
- package/web-ui/modules/app.methods.index.mjs +92 -92
- package/web-ui/modules/app.methods.install.mjs +205 -177
- package/web-ui/modules/app.methods.navigation.mjs +743 -695
- package/web-ui/modules/app.methods.openclaw-core.mjs +814 -814
- package/web-ui/modules/app.methods.openclaw-editing.mjs +372 -372
- package/web-ui/modules/app.methods.openclaw-persist.mjs +369 -369
- package/web-ui/modules/app.methods.providers.mjs +404 -404
- package/web-ui/modules/app.methods.runtime.mjs +345 -345
- package/web-ui/modules/app.methods.session-actions.mjs +596 -537
- package/web-ui/modules/app.methods.session-browser.mjs +985 -698
- package/web-ui/modules/app.methods.session-timeline.mjs +479 -448
- package/web-ui/modules/app.methods.session-trash.mjs +424 -422
- package/web-ui/modules/app.methods.startup-claude.mjs +522 -417
- package/web-ui/modules/app.methods.task-orchestration.mjs +556 -556
- package/web-ui/modules/config-mode.computed.mjs +124 -124
- package/web-ui/modules/config-template-confirm-pref.mjs +33 -33
- package/web-ui/modules/i18n.dict.mjs +2113 -2039
- package/web-ui/modules/i18n.mjs +56 -56
- package/web-ui/modules/plugins.computed.mjs +3 -3
- package/web-ui/modules/plugins.methods.mjs +3 -3
- package/web-ui/modules/plugins.storage.mjs +11 -11
- package/web-ui/modules/sessions-filters-url.mjs +85 -85
- package/web-ui/modules/skills.computed.mjs +107 -107
- package/web-ui/modules/skills.methods.mjs +481 -481
- package/web-ui/partials/index/layout-footer.html +13 -13
- package/web-ui/partials/index/layout-header.html +475 -465
- package/web-ui/partials/index/modal-config-template-agents.html +174 -174
- package/web-ui/partials/index/modal-confirm-toast.html +32 -32
- package/web-ui/partials/index/modal-health-check.html +45 -45
- package/web-ui/partials/index/modal-openclaw-config.html +280 -280
- package/web-ui/partials/index/modal-skills.html +200 -200
- package/web-ui/partials/index/modals-basic.html +165 -165
- package/web-ui/partials/index/panel-config-claude.html +184 -179
- package/web-ui/partials/index/panel-config-codex.html +283 -283
- package/web-ui/partials/index/panel-config-openclaw.html +83 -83
- package/web-ui/partials/index/panel-dashboard.html +186 -186
- package/web-ui/partials/index/panel-docs.html +147 -147
- package/web-ui/partials/index/panel-market.html +177 -177
- package/web-ui/partials/index/panel-orchestration.html +391 -391
- package/web-ui/partials/index/panel-plugins.html +279 -279
- package/web-ui/partials/index/panel-sessions.html +326 -301
- package/web-ui/partials/index/panel-settings.html +258 -258
- package/web-ui/partials/index/panel-usage.html +342 -354
- package/{res → web-ui/res}/json5.min.js +1 -1
- package/{res → web-ui/res}/vue.global.prod.js +13 -13
- package/web-ui/session-helpers.mjs +576 -573
- package/web-ui/source-bundle.cjs +233 -233
- package/web-ui/styles/base-theme.css +268 -264
- package/web-ui/styles/controls-forms.css +423 -376
- package/web-ui/styles/dashboard.css +274 -274
- package/web-ui/styles/docs-panel.css +247 -247
- package/web-ui/styles/feedback.css +108 -108
- package/web-ui/styles/health-check-dialog.css +144 -144
- package/web-ui/styles/layout-shell.css +603 -602
- package/web-ui/styles/modals-core.css +464 -464
- package/web-ui/styles/navigation-panels.css +390 -390
- package/web-ui/styles/openclaw-structured.css +266 -266
- package/web-ui/styles/plugins-panel.css +523 -523
- package/web-ui/styles/responsive.css +454 -456
- package/web-ui/styles/sessions-list.css +415 -400
- package/web-ui/styles/sessions-preview.css +411 -411
- package/web-ui/styles/sessions-toolbar-trash.css +330 -268
- package/web-ui/styles/sessions-usage.css +945 -888
- package/web-ui/styles/settings-panel.css +166 -166
- package/web-ui/styles/skills-list.css +303 -303
- package/web-ui/styles/skills-market.css +406 -406
- package/web-ui/styles/task-orchestration.css +822 -822
- package/web-ui/styles/titles-cards.css +408 -408
- package/web-ui/styles.css +21 -21
- package/web-ui.html +17 -17
- /package/{res → web-ui/res}/logo-pack.webp +0 -0
|
@@ -1,784 +1,860 @@
|
|
|
1
|
-
import { runLatestOnlyQueue } from '../logic.mjs';
|
|
2
|
-
import { normalizeConfigTemplateDiffConfirmEnabled } from './config-template-confirm-pref.mjs';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
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
|
-
URL.
|
|
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
|
-
await
|
|
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
|
-
this.
|
|
231
|
-
|
|
232
|
-
this.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
this.
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
await this.applyCodexConfigDirect({
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
this
|
|
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
|
-
this.
|
|
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
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
this.
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
.
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
this.
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
if (
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
this.
|
|
630
|
-
this.
|
|
631
|
-
|
|
632
|
-
this.
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
this.
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1
|
+
import { runLatestOnlyQueue } from '../logic.mjs';
|
|
2
|
+
import { normalizeConfigTemplateDiffConfirmEnabled } from './config-template-confirm-pref.mjs';
|
|
3
|
+
import {
|
|
4
|
+
getConvertTargetSource,
|
|
5
|
+
normalizeSessionConvertSource
|
|
6
|
+
} from '../logic.session-convert.mjs';
|
|
7
|
+
import { syncSessionsFilterUrl } from './sessions-filters-url.mjs';
|
|
8
|
+
|
|
9
|
+
function hasResponseError(response) {
|
|
10
|
+
if (!response || typeof response !== 'object') {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (typeof response.error === 'string') {
|
|
14
|
+
return response.error.trim().length > 0;
|
|
15
|
+
}
|
|
16
|
+
return response.error !== undefined && response.error !== null && response.error !== false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getResponseMessage(response, fallback) {
|
|
20
|
+
if (!response || typeof response !== 'object') {
|
|
21
|
+
return fallback;
|
|
22
|
+
}
|
|
23
|
+
for (const key of ['error', 'message', 'detail']) {
|
|
24
|
+
const value = response[key];
|
|
25
|
+
if (typeof value === 'string' && value.trim()) {
|
|
26
|
+
return value.trim();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return fallback;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function createCodexConfigMethods(options = {}) {
|
|
33
|
+
const {
|
|
34
|
+
api,
|
|
35
|
+
defaultModelContextWindow = 190000,
|
|
36
|
+
defaultModelAutoCompactTokenLimit = 185000,
|
|
37
|
+
getProviderConfigModeMeta
|
|
38
|
+
} = options;
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
downloadTextFile(fileName, content, mimeType = 'text/markdown;charset=utf-8') {
|
|
42
|
+
const BOM = '\uFEFF';
|
|
43
|
+
const blob = new Blob([BOM + content], { type: mimeType });
|
|
44
|
+
const url = URL.createObjectURL(blob);
|
|
45
|
+
const link = document.createElement('a');
|
|
46
|
+
link.href = url;
|
|
47
|
+
link.download = fileName;
|
|
48
|
+
link.click();
|
|
49
|
+
URL.revokeObjectURL(url);
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
async exportSession(session) {
|
|
53
|
+
const key = this.getSessionExportKey(session);
|
|
54
|
+
if (this.sessionExporting[key]) return;
|
|
55
|
+
|
|
56
|
+
this.sessionExporting[key] = true;
|
|
57
|
+
try {
|
|
58
|
+
const res = await api('export-session', {
|
|
59
|
+
source: session.source,
|
|
60
|
+
sessionId: session.sessionId,
|
|
61
|
+
filePath: session.filePath
|
|
62
|
+
});
|
|
63
|
+
if (res.error) {
|
|
64
|
+
this.showMessage(res.error, 'error');
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const fileName = res.fileName || `${session.source || 'session'}-${session.sessionId || Date.now()}.md`;
|
|
69
|
+
this.downloadTextFile(fileName, res.content || '');
|
|
70
|
+
if (res.truncated) {
|
|
71
|
+
const maxLabel = res.maxMessages === 'all' ? 'all' : res.maxMessages;
|
|
72
|
+
this.showMessage(`会话导出完成(已截断:最多 ${maxLabel} 条消息)`, 'info');
|
|
73
|
+
} else {
|
|
74
|
+
this.showMessage('操作成功', 'success');
|
|
75
|
+
}
|
|
76
|
+
} catch (e) {
|
|
77
|
+
this.showMessage('导出失败', 'error');
|
|
78
|
+
} finally {
|
|
79
|
+
this.sessionExporting[key] = false;
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
async convertSession(session) {
|
|
84
|
+
const source = normalizeSessionConvertSource(session && session.source ? session.source : '');
|
|
85
|
+
const target = getConvertTargetSource(source);
|
|
86
|
+
if (!source || !target) {
|
|
87
|
+
this.showMessage('不支持此操作', 'error');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const key = this.getSessionExportKey(session);
|
|
91
|
+
if (this.sessionConverting[key]) return;
|
|
92
|
+
this.sessionConverting[key] = true;
|
|
93
|
+
try {
|
|
94
|
+
const res = await api('convert-session', {
|
|
95
|
+
source,
|
|
96
|
+
target,
|
|
97
|
+
sessionId: session.sessionId,
|
|
98
|
+
filePath: session.filePath,
|
|
99
|
+
maxMessages: 'all'
|
|
100
|
+
});
|
|
101
|
+
if (res && res.error) {
|
|
102
|
+
this.showMessage(res.error, 'error');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const converted = res && res.session ? res.session : null;
|
|
106
|
+
if (!converted) {
|
|
107
|
+
this.showMessage('转换失败', 'error');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (res && res.truncated) {
|
|
111
|
+
const maxLabel = res.maxMessages === 'all' ? 'all' : res.maxMessages;
|
|
112
|
+
const targetLabel = converted && converted.sourceLabel ? String(converted.sourceLabel).trim() : '';
|
|
113
|
+
if (targetLabel && typeof this.sessionFilterSource === 'string' && this.sessionFilterSource !== converted.source) {
|
|
114
|
+
this.showMessage(`已生成派生会话(来源:${targetLabel},已截断:最多 ${maxLabel} 条消息)`, 'info');
|
|
115
|
+
} else {
|
|
116
|
+
this.showMessage(`已生成派生会话(已截断:最多 ${maxLabel} 条消息)`, 'info');
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
const targetLabel = converted && converted.sourceLabel ? String(converted.sourceLabel).trim() : '';
|
|
120
|
+
if (targetLabel && typeof this.sessionFilterSource === 'string' && this.sessionFilterSource !== converted.source) {
|
|
121
|
+
this.showMessage(`已生成派生会话(来源:${targetLabel})`, 'success');
|
|
122
|
+
} else {
|
|
123
|
+
this.showMessage('已生成派生会话', 'success');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (converted && converted.source && typeof this.sessionFilterSource === 'string') {
|
|
128
|
+
if (this.sessionFilterSource !== converted.source) {
|
|
129
|
+
this.sessionFilterSource = converted.source;
|
|
130
|
+
if (typeof this.refreshSessionPathOptions === 'function') {
|
|
131
|
+
this.refreshSessionPathOptions(this.sessionFilterSource);
|
|
132
|
+
}
|
|
133
|
+
if (typeof this.persistSessionFilterCache === 'function') {
|
|
134
|
+
this.persistSessionFilterCache();
|
|
135
|
+
}
|
|
136
|
+
syncSessionsFilterUrl(this);
|
|
137
|
+
this.sessionsList = [converted];
|
|
138
|
+
} else {
|
|
139
|
+
const list = Array.isArray(this.sessionsList) ? this.sessionsList : [];
|
|
140
|
+
const next = [converted, ...list.filter(item => !(item && item.filePath === converted.filePath && item.source === converted.source))];
|
|
141
|
+
this.sessionsList = next;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (typeof this.selectSession === 'function') {
|
|
145
|
+
await this.selectSession(converted);
|
|
146
|
+
}
|
|
147
|
+
} catch (e) {
|
|
148
|
+
this.showMessage('转换失败', 'error');
|
|
149
|
+
} finally {
|
|
150
|
+
this.sessionConverting[key] = false;
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
async quickSwitchProvider(name) {
|
|
155
|
+
const target = String(name || '').trim();
|
|
156
|
+
const visualTarget = String(this.providerSwitchDisplayTarget || '').trim();
|
|
157
|
+
if (!target || target === visualTarget || target === this.pendingProviderSwitch) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (!this.providerSwitchInProgress && target === this.currentProvider) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
await this.switchProvider(target);
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
async waitForCodexApplyIdle(maxWaitMs = 20000) {
|
|
167
|
+
const startedAt = Date.now();
|
|
168
|
+
while (this.codexApplying) {
|
|
169
|
+
if ((Date.now() - startedAt) > maxWaitMs) {
|
|
170
|
+
throw new Error('等待配置应用完成超时');
|
|
171
|
+
}
|
|
172
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
async performProviderSwitch(name) {
|
|
177
|
+
await this.waitForCodexApplyIdle();
|
|
178
|
+
const previousProvider = this.currentProvider;
|
|
179
|
+
const previousModel = this.currentModel;
|
|
180
|
+
const previousModels = Array.isArray(this.models) ? [...this.models] : [];
|
|
181
|
+
const previousModelsSource = this.modelsSource;
|
|
182
|
+
const previousModelsHasCurrent = this.modelsHasCurrent;
|
|
183
|
+
this.currentProvider = name;
|
|
184
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
185
|
+
|
|
186
|
+
// 不要把“切换提供商”强绑定到 /models 成功与否:
|
|
187
|
+
// 部分 OpenAI 兼容服务 /models 不可用或很慢,但用户仍希望一次点击即可完成切换。
|
|
188
|
+
// 这里做“短等待 + 后台补齐”:
|
|
189
|
+
// 1) 先启动 models 拉取(静默)
|
|
190
|
+
// 2) 给一个很短的窗口等待它完成,以便能立即选到第一个模型
|
|
191
|
+
// 3) 无论 models 是否成功,先应用 provider 切换
|
|
192
|
+
// 4) models 后续若补齐并发现当前 model 不在列表,则自动切到首个 model 并再应用一次
|
|
193
|
+
const modelsTask = this.loadModelsForProvider(name, { silentError: true })
|
|
194
|
+
.catch(() => {});
|
|
195
|
+
|
|
196
|
+
await Promise.race([modelsTask, delay(250)]);
|
|
197
|
+
|
|
198
|
+
if (this.modelsSource === 'remote' && this.models.length > 0 && !this.models.includes(this.currentModel)) {
|
|
199
|
+
this.currentModel = this.models[0];
|
|
200
|
+
this.modelsHasCurrent = true;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (getProviderConfigModeMeta(this.configMode)) {
|
|
204
|
+
await this.waitForCodexApplyIdle();
|
|
205
|
+
await this.applyCodexConfigDirect({ silent: true });
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
await modelsTask;
|
|
209
|
+
|
|
210
|
+
if (this.currentProvider === name) {
|
|
211
|
+
if (this.modelsSource === 'remote' && this.models.length > 0 && !this.models.includes(this.currentModel)) {
|
|
212
|
+
this.currentModel = this.models[0];
|
|
213
|
+
this.modelsHasCurrent = true;
|
|
214
|
+
if (getProviderConfigModeMeta(this.configMode)) {
|
|
215
|
+
await this.waitForCodexApplyIdle();
|
|
216
|
+
await this.applyCodexConfigDirect({ silent: true });
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
async switchProvider(name) {
|
|
223
|
+
const target = String(name || '').trim();
|
|
224
|
+
if (!target) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (target === String(this.providerSwitchDisplayTarget || '').trim()) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
this.providerSwitchDisplayTarget = target;
|
|
231
|
+
if (this.providerSwitchInProgress) {
|
|
232
|
+
this.pendingProviderSwitch = target;
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
this.providerSwitchInProgress = true;
|
|
236
|
+
let lastError = '';
|
|
237
|
+
try {
|
|
238
|
+
this.pendingProviderSwitch = '';
|
|
239
|
+
const result = await runLatestOnlyQueue(target, {
|
|
240
|
+
perform: async (queuedTarget) => {
|
|
241
|
+
this.providerSwitchDisplayTarget = queuedTarget;
|
|
242
|
+
await this.performProviderSwitch(queuedTarget);
|
|
243
|
+
},
|
|
244
|
+
consumePending: () => {
|
|
245
|
+
const queued = this.pendingProviderSwitch;
|
|
246
|
+
this.pendingProviderSwitch = '';
|
|
247
|
+
return queued;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
if (result && typeof result.lastError === 'string') {
|
|
251
|
+
lastError = result.lastError;
|
|
252
|
+
}
|
|
253
|
+
} finally {
|
|
254
|
+
this.providerSwitchInProgress = false;
|
|
255
|
+
this.pendingProviderSwitch = '';
|
|
256
|
+
this.providerSwitchDisplayTarget = '';
|
|
257
|
+
}
|
|
258
|
+
if (lastError) {
|
|
259
|
+
this.showMessage(lastError, 'error');
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
async onModelChange() {
|
|
264
|
+
await this.applyCodexConfigDirect();
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
async onServiceTierChange() {
|
|
268
|
+
await this.applyCodexConfigDirect({ silent: true });
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
async onReasoningEffortChange() {
|
|
272
|
+
await this.applyCodexConfigDirect({ silent: true });
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
sanitizePositiveIntegerDraft(field) {
|
|
276
|
+
if (!field || typeof this[field] === 'undefined') return;
|
|
277
|
+
const current = typeof this[field] === 'string'
|
|
278
|
+
? this[field]
|
|
279
|
+
: String(this[field] || '');
|
|
280
|
+
const sanitized = current.replace(/[^\d]/g, '');
|
|
281
|
+
if (sanitized !== current) {
|
|
282
|
+
this[field] = sanitized;
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
normalizePositiveIntegerInput(value, label, fallback = '') {
|
|
287
|
+
const fallbackText = fallback === '' ? '' : String(fallback).trim();
|
|
288
|
+
const raw = typeof value === 'string'
|
|
289
|
+
? value.trim()
|
|
290
|
+
: String(value == null ? '' : value).trim();
|
|
291
|
+
const text = raw || fallbackText;
|
|
292
|
+
if (!text) {
|
|
293
|
+
return { ok: true, value: null, text: '' };
|
|
294
|
+
}
|
|
295
|
+
if (!/^\d+$/.test(text)) {
|
|
296
|
+
return { ok: false, error: `${label} 请输入正整数` };
|
|
297
|
+
}
|
|
298
|
+
const num = Number.parseInt(text, 10);
|
|
299
|
+
if (!Number.isSafeInteger(num) || num <= 0) {
|
|
300
|
+
return { ok: false, error: `${label} 请输入正整数` };
|
|
301
|
+
}
|
|
302
|
+
return { ok: true, value: num, text: String(num) };
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
async onModelContextWindowBlur() {
|
|
306
|
+
this.editingCodexBudgetField = '';
|
|
307
|
+
const normalized = this.normalizePositiveIntegerInput(
|
|
308
|
+
this.modelContextWindowInput,
|
|
309
|
+
'model_context_window',
|
|
310
|
+
defaultModelContextWindow
|
|
311
|
+
);
|
|
312
|
+
if (!normalized.ok) {
|
|
313
|
+
this.showMessage(normalized.error, 'error');
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
this.modelContextWindowInput = normalized.text;
|
|
317
|
+
await this.applyCodexConfigDirect({
|
|
318
|
+
silent: true,
|
|
319
|
+
modelContextWindow: normalized.value
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
async onModelAutoCompactTokenLimitBlur() {
|
|
324
|
+
this.editingCodexBudgetField = '';
|
|
325
|
+
const normalized = this.normalizePositiveIntegerInput(
|
|
326
|
+
this.modelAutoCompactTokenLimitInput,
|
|
327
|
+
'model_auto_compact_token_limit',
|
|
328
|
+
defaultModelAutoCompactTokenLimit
|
|
329
|
+
);
|
|
330
|
+
if (!normalized.ok) {
|
|
331
|
+
this.showMessage(normalized.error, 'error');
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
this.modelAutoCompactTokenLimitInput = normalized.text;
|
|
335
|
+
await this.applyCodexConfigDirect({
|
|
336
|
+
silent: true,
|
|
337
|
+
modelAutoCompactTokenLimit: normalized.value
|
|
338
|
+
});
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
async resetCodexContextBudgetDefaults() {
|
|
342
|
+
this.modelContextWindowInput = String(defaultModelContextWindow);
|
|
343
|
+
this.modelAutoCompactTokenLimitInput = String(defaultModelAutoCompactTokenLimit);
|
|
344
|
+
await this.applyCodexConfigDirect({
|
|
345
|
+
modelContextWindow: defaultModelContextWindow,
|
|
346
|
+
modelAutoCompactTokenLimit: defaultModelAutoCompactTokenLimit
|
|
347
|
+
});
|
|
348
|
+
},
|
|
349
|
+
|
|
350
|
+
async runHealthCheck(options = {}) {
|
|
351
|
+
this.healthCheckLoading = true;
|
|
352
|
+
this.healthCheckResult = null;
|
|
353
|
+
this.healthCheckBatchTotal = 0;
|
|
354
|
+
this.healthCheckBatchDone = 0;
|
|
355
|
+
this.healthCheckBatchFailed = 0;
|
|
356
|
+
try {
|
|
357
|
+
const silent = !!(options && options.silent);
|
|
358
|
+
const forceRefresh = !!(options && options.forceRefresh);
|
|
359
|
+
const useDoctor = !!(options && options.doctor);
|
|
360
|
+
if (useDoctor) {
|
|
361
|
+
const res = await api('doctor', {
|
|
362
|
+
lang: this.lang,
|
|
363
|
+
remote: true,
|
|
364
|
+
range: this.sessionsUsageTimeRange,
|
|
365
|
+
targetApp: this.skillsTargetApp,
|
|
366
|
+
includeUsage: true,
|
|
367
|
+
includeTasks: true,
|
|
368
|
+
includeSkills: true,
|
|
369
|
+
includeInstall: true,
|
|
370
|
+
forceRefresh
|
|
371
|
+
});
|
|
372
|
+
if (hasResponseError(res)) {
|
|
373
|
+
this.healthCheckResult = null;
|
|
374
|
+
if (!silent) {
|
|
375
|
+
this.showMessage(getResponseMessage(res, '检查失败'), 'error');
|
|
376
|
+
}
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if (res && typeof res === 'object') {
|
|
380
|
+
this.healthCheckResult = res;
|
|
381
|
+
const report = res.report && typeof res.report === 'object' ? res.report : null;
|
|
382
|
+
const summary = report && report.summary && typeof report.summary === 'object' ? report.summary : null;
|
|
383
|
+
const total = summary && Number.isFinite(Number(summary.total))
|
|
384
|
+
? Math.max(0, Math.floor(Number(summary.total)))
|
|
385
|
+
: (Array.isArray(res.issues) ? res.issues.length : 0);
|
|
386
|
+
const errors = summary && Number.isFinite(Number(summary.error)) ? Math.max(0, Math.floor(Number(summary.error))) : 0;
|
|
387
|
+
const warns = summary && Number.isFinite(Number(summary.warn)) ? Math.max(0, Math.floor(Number(summary.warn))) : 0;
|
|
388
|
+
this.healthCheckBatchTotal = total;
|
|
389
|
+
this.healthCheckBatchDone = total;
|
|
390
|
+
this.healthCheckBatchFailed = errors + warns;
|
|
391
|
+
if (!silent && res.ok) {
|
|
392
|
+
this.showMessage('检查通过', 'success');
|
|
393
|
+
}
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
this.healthCheckResult = null;
|
|
397
|
+
if (!silent) {
|
|
398
|
+
this.showMessage('检查失败', 'error');
|
|
399
|
+
}
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (this.configMode === 'claude') {
|
|
404
|
+
const entries = Object.entries(this.claudeConfigs || {});
|
|
405
|
+
this.healthCheckBatchTotal = entries.length;
|
|
406
|
+
|
|
407
|
+
const speedTasks = entries.map(([name, config]) => this.runClaudeSpeedTest(name, config)
|
|
408
|
+
.then((result) => {
|
|
409
|
+
if (!result || result.ok !== true) {
|
|
410
|
+
this.healthCheckBatchFailed += 1;
|
|
411
|
+
}
|
|
412
|
+
return { name, result };
|
|
413
|
+
})
|
|
414
|
+
.catch((err) => {
|
|
415
|
+
this.healthCheckBatchFailed += 1;
|
|
416
|
+
return {
|
|
417
|
+
name,
|
|
418
|
+
result: { ok: false, error: err && err.message ? err.message : 'Speed test failed' }
|
|
419
|
+
};
|
|
420
|
+
})
|
|
421
|
+
.finally(() => {
|
|
422
|
+
this.healthCheckBatchDone += 1;
|
|
423
|
+
})
|
|
424
|
+
);
|
|
425
|
+
|
|
426
|
+
const pairs = await Promise.all(speedTasks);
|
|
427
|
+
const results = {};
|
|
428
|
+
const issues = [];
|
|
429
|
+
for (const pair of pairs) {
|
|
430
|
+
results[pair.name] = pair.result || null;
|
|
431
|
+
if (typeof this.buildSpeedTestIssue === 'function') {
|
|
432
|
+
const issue = this.buildSpeedTestIssue(pair.name, pair.result);
|
|
433
|
+
if (issue) issues.push(issue);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
const ok = issues.length === 0 && this.healthCheckBatchFailed === 0;
|
|
437
|
+
this.healthCheckResult = {
|
|
438
|
+
ok,
|
|
439
|
+
issues,
|
|
440
|
+
remote: {
|
|
441
|
+
type: 'speed-test',
|
|
442
|
+
speedTests: results
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
if (ok && !silent) {
|
|
446
|
+
this.showMessage('检查通过', 'success');
|
|
447
|
+
}
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
const shouldRunSpeedTests = this.configMode === 'codex';
|
|
452
|
+
const speedTimeoutMs = shouldRunSpeedTests ? 3500 : 0;
|
|
453
|
+
const providers = shouldRunSpeedTests
|
|
454
|
+
? (this.providersList || [])
|
|
455
|
+
.map((provider) => typeof provider === 'string'
|
|
456
|
+
? provider.trim()
|
|
457
|
+
: String((provider && provider.name) || '').trim())
|
|
458
|
+
.filter(Boolean)
|
|
459
|
+
: [];
|
|
460
|
+
const currentProvider = String(this.currentProvider || '').trim();
|
|
461
|
+
const orderedProviders = currentProvider && providers.includes(currentProvider)
|
|
462
|
+
? [currentProvider, ...providers.filter((name) => name !== currentProvider)]
|
|
463
|
+
: providers;
|
|
464
|
+
this.healthCheckBatchTotal = orderedProviders.length;
|
|
465
|
+
|
|
466
|
+
const speedTasks = orderedProviders.map((provider) => this.runSpeedTest(provider, { silent: true, timeoutMs: speedTimeoutMs })
|
|
467
|
+
.then((result) => {
|
|
468
|
+
if (!result || result.ok !== true) {
|
|
469
|
+
this.healthCheckBatchFailed += 1;
|
|
470
|
+
}
|
|
471
|
+
return { name: provider, result };
|
|
472
|
+
})
|
|
473
|
+
.catch((err) => {
|
|
474
|
+
this.healthCheckBatchFailed += 1;
|
|
475
|
+
return {
|
|
476
|
+
name: provider,
|
|
477
|
+
result: { ok: false, error: err && err.message ? err.message : 'Speed test failed' }
|
|
478
|
+
};
|
|
479
|
+
})
|
|
480
|
+
.finally(() => {
|
|
481
|
+
this.healthCheckBatchDone += 1;
|
|
482
|
+
})
|
|
483
|
+
);
|
|
484
|
+
|
|
485
|
+
const configTask = api('config-health-check', { remote: this.configMode === 'codex' });
|
|
486
|
+
const [res, pairs] = await Promise.all([
|
|
487
|
+
configTask,
|
|
488
|
+
Promise.all(speedTasks)
|
|
489
|
+
]);
|
|
490
|
+
if (hasResponseError(res)) {
|
|
491
|
+
this.healthCheckResult = null;
|
|
492
|
+
if (!silent) {
|
|
493
|
+
this.showMessage(getResponseMessage(res, '检查失败'), 'error');
|
|
494
|
+
}
|
|
495
|
+
} else if (res && typeof res === 'object') {
|
|
496
|
+
const issues = Array.isArray(res.issues) ? [...res.issues] : [];
|
|
497
|
+
let remote = res.remote || null;
|
|
498
|
+
if (shouldRunSpeedTests) {
|
|
499
|
+
const results = {};
|
|
500
|
+
for (const pair of pairs) {
|
|
501
|
+
results[pair.name] = pair.result || null;
|
|
502
|
+
const issue = this.buildSpeedTestIssue(pair.name, pair.result);
|
|
503
|
+
if (issue) issues.push(issue);
|
|
504
|
+
}
|
|
505
|
+
remote = remote && typeof remote === 'object'
|
|
506
|
+
? { ...remote, speedTests: results }
|
|
507
|
+
: { type: 'speed-test', speedTests: results };
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
const ok = issues.length === 0;
|
|
511
|
+
this.healthCheckResult = {
|
|
512
|
+
...res,
|
|
513
|
+
ok,
|
|
514
|
+
issues,
|
|
515
|
+
remote
|
|
516
|
+
};
|
|
517
|
+
if (ok && !silent) {
|
|
518
|
+
this.showMessage('检查通过', 'success');
|
|
519
|
+
}
|
|
520
|
+
} else {
|
|
521
|
+
this.healthCheckResult = null;
|
|
522
|
+
if (!silent) {
|
|
523
|
+
this.showMessage('检查失败', 'error');
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
} catch (e) {
|
|
527
|
+
this.healthCheckResult = null;
|
|
528
|
+
if (!(options && options.silent)) {
|
|
529
|
+
this.showMessage('检查失败', 'error');
|
|
530
|
+
}
|
|
531
|
+
} finally {
|
|
532
|
+
this.healthCheckBatchTotal = this.healthCheckBatchTotal || 0;
|
|
533
|
+
this.healthCheckBatchDone = Math.min(this.healthCheckBatchDone || 0, this.healthCheckBatchTotal || 0);
|
|
534
|
+
this.healthCheckLoading = false;
|
|
535
|
+
}
|
|
536
|
+
},
|
|
537
|
+
|
|
538
|
+
escapeTomlString(value) {
|
|
539
|
+
return String(value || '')
|
|
540
|
+
.replace(/\\/g, '\\\\')
|
|
541
|
+
.replace(/"/g, '\\"');
|
|
542
|
+
},
|
|
543
|
+
|
|
544
|
+
async openConfigTemplateEditor(options = {}) {
|
|
545
|
+
this.resetConfigTemplateDiffState();
|
|
546
|
+
const modelContextWindow = this.normalizePositiveIntegerInput(
|
|
547
|
+
this.modelContextWindowInput,
|
|
548
|
+
'model_context_window',
|
|
549
|
+
defaultModelContextWindow
|
|
550
|
+
);
|
|
551
|
+
if (!modelContextWindow.ok) {
|
|
552
|
+
this.showMessage(modelContextWindow.error, 'error');
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
const modelAutoCompactTokenLimit = this.normalizePositiveIntegerInput(
|
|
556
|
+
this.modelAutoCompactTokenLimitInput,
|
|
557
|
+
'model_auto_compact_token_limit',
|
|
558
|
+
defaultModelAutoCompactTokenLimit
|
|
559
|
+
);
|
|
560
|
+
if (!modelAutoCompactTokenLimit.ok) {
|
|
561
|
+
this.showMessage(modelAutoCompactTokenLimit.error, 'error');
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
try {
|
|
565
|
+
const res = await api('get-config-template', {
|
|
566
|
+
provider: this.currentProvider,
|
|
567
|
+
model: this.currentModel,
|
|
568
|
+
serviceTier: this.serviceTier,
|
|
569
|
+
reasoningEffort: this.modelReasoningEffort,
|
|
570
|
+
modelContextWindow: modelContextWindow.value,
|
|
571
|
+
modelAutoCompactTokenLimit: modelAutoCompactTokenLimit.value
|
|
572
|
+
});
|
|
573
|
+
if (res.error) {
|
|
574
|
+
this.showMessage(res.error, 'error');
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
let template = res.template || '';
|
|
578
|
+
const appendHint = typeof options.appendHint === 'string' ? options.appendHint.trim() : '';
|
|
579
|
+
const appendBlock = typeof options.appendBlock === 'string' ? options.appendBlock.trim() : '';
|
|
580
|
+
if (appendHint) {
|
|
581
|
+
template = `${template.trimEnd()}\n\n# -------------------------------\n# ${appendHint}\n# -------------------------------\n`;
|
|
582
|
+
}
|
|
583
|
+
if (appendBlock) {
|
|
584
|
+
template = `${template.trimEnd()}\n\n${appendBlock}\n`;
|
|
585
|
+
}
|
|
586
|
+
this.configTemplateContent = template;
|
|
587
|
+
this.showConfigTemplateModal = true;
|
|
588
|
+
} catch (e) {
|
|
589
|
+
this.showMessage('加载模板失败', 'error');
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
|
|
593
|
+
async applyCodexConfigDirect(options = {}) {
|
|
594
|
+
if (this.codexApplying) {
|
|
595
|
+
this._pendingCodexApplyOptions = {
|
|
596
|
+
...(this._pendingCodexApplyOptions || {}),
|
|
597
|
+
...options
|
|
598
|
+
};
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
const provider = (this.currentProvider || '').trim();
|
|
603
|
+
const model = (this.currentModel || '').trim();
|
|
604
|
+
if (!provider || !model) {
|
|
605
|
+
this.showMessage('请选择提供商和模型', 'error');
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
const modelContextWindow = this.normalizePositiveIntegerInput(
|
|
610
|
+
options.modelContextWindow !== undefined ? options.modelContextWindow : this.modelContextWindowInput,
|
|
611
|
+
'model_context_window',
|
|
612
|
+
defaultModelContextWindow
|
|
613
|
+
);
|
|
614
|
+
if (!modelContextWindow.ok) {
|
|
615
|
+
this.showMessage(modelContextWindow.error, 'error');
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
const modelAutoCompactTokenLimit = this.normalizePositiveIntegerInput(
|
|
619
|
+
options.modelAutoCompactTokenLimit !== undefined
|
|
620
|
+
? options.modelAutoCompactTokenLimit
|
|
621
|
+
: this.modelAutoCompactTokenLimitInput,
|
|
622
|
+
'model_auto_compact_token_limit',
|
|
623
|
+
defaultModelAutoCompactTokenLimit
|
|
624
|
+
);
|
|
625
|
+
if (!modelAutoCompactTokenLimit.ok) {
|
|
626
|
+
this.showMessage(modelAutoCompactTokenLimit.error, 'error');
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
this.modelContextWindowInput = modelContextWindow.text;
|
|
630
|
+
this.modelAutoCompactTokenLimitInput = modelAutoCompactTokenLimit.text;
|
|
631
|
+
|
|
632
|
+
this.codexApplying = true;
|
|
633
|
+
try {
|
|
634
|
+
const tplRes = await api('get-config-template', {
|
|
635
|
+
provider,
|
|
636
|
+
model,
|
|
637
|
+
serviceTier: this.serviceTier,
|
|
638
|
+
reasoningEffort: this.modelReasoningEffort,
|
|
639
|
+
modelContextWindow: modelContextWindow.value,
|
|
640
|
+
modelAutoCompactTokenLimit: modelAutoCompactTokenLimit.value
|
|
641
|
+
});
|
|
642
|
+
if (tplRes.error) {
|
|
643
|
+
this.showMessage(
|
|
644
|
+
(typeof tplRes.error === 'string' && tplRes.error.trim())
|
|
645
|
+
|| (typeof tplRes.message === 'string' && tplRes.message.trim())
|
|
646
|
+
|| (typeof tplRes.detail === 'string' && tplRes.detail.trim())
|
|
647
|
+
|| '获取模板失败',
|
|
648
|
+
'error'
|
|
649
|
+
);
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
const applyRes = await api('apply-config-template', {
|
|
654
|
+
template: tplRes.template
|
|
655
|
+
});
|
|
656
|
+
if (applyRes.error) {
|
|
657
|
+
this.showMessage(
|
|
658
|
+
(typeof applyRes.error === 'string' && applyRes.error.trim())
|
|
659
|
+
|| (typeof applyRes.message === 'string' && applyRes.message.trim())
|
|
660
|
+
|| (typeof applyRes.detail === 'string' && applyRes.detail.trim())
|
|
661
|
+
|| '应用模板失败',
|
|
662
|
+
'error'
|
|
663
|
+
);
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
if (options.silent !== true) {
|
|
668
|
+
this.showMessage('配置已应用', 'success');
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
const refreshOptions = options.silent === true
|
|
672
|
+
? { preserveLoading: true }
|
|
673
|
+
: {};
|
|
674
|
+
try {
|
|
675
|
+
await this.loadAll(refreshOptions);
|
|
676
|
+
} catch (_) {
|
|
677
|
+
this.showMessage('配置已应用,但界面刷新失败,请手动刷新', 'error');
|
|
678
|
+
}
|
|
679
|
+
} catch (e) {
|
|
680
|
+
this.showMessage('应用失败', 'error');
|
|
681
|
+
} finally {
|
|
682
|
+
this.codexApplying = false;
|
|
683
|
+
const pendingOptions = this._pendingCodexApplyOptions;
|
|
684
|
+
this._pendingCodexApplyOptions = null;
|
|
685
|
+
if (pendingOptions) {
|
|
686
|
+
await this.applyCodexConfigDirect(pendingOptions);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
|
|
691
|
+
closeConfigTemplateModal(options = {}) {
|
|
692
|
+
const force = !!options.force;
|
|
693
|
+
if (!force && (this.configTemplateApplying || this.configTemplateDiffLoading)) {
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
this.showConfigTemplateModal = false;
|
|
697
|
+
this.configTemplateContent = '';
|
|
698
|
+
this.resetConfigTemplateDiffState();
|
|
699
|
+
},
|
|
700
|
+
|
|
701
|
+
resetConfigTemplateDiffState() {
|
|
702
|
+
this.configTemplateDiffVisible = false;
|
|
703
|
+
this.configTemplateDiffLoading = false;
|
|
704
|
+
this.configTemplateDiffError = '';
|
|
705
|
+
this.configTemplateDiffLines = [];
|
|
706
|
+
this.configTemplateDiffStats = { added: 0, removed: 0, unchanged: 0 };
|
|
707
|
+
this.configTemplateDiffHasChangesValue = false;
|
|
708
|
+
this.configTemplateDiffFingerprint = '';
|
|
709
|
+
this._configTemplateDiffPreviewRequestToken = null;
|
|
710
|
+
},
|
|
711
|
+
|
|
712
|
+
onConfigTemplateContentInput() {
|
|
713
|
+
if (this.configTemplateDiffVisible || (this.configTemplateDiffLines && this.configTemplateDiffLines.length)) {
|
|
714
|
+
this.resetConfigTemplateDiffState();
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
|
|
718
|
+
buildConfigTemplateDiffFingerprint() {
|
|
719
|
+
const content = typeof this.configTemplateContent === 'string' ? this.configTemplateContent : '';
|
|
720
|
+
return `${content.length}::${content}`;
|
|
721
|
+
},
|
|
722
|
+
|
|
723
|
+
hasConfigTemplateDiffChanges() {
|
|
724
|
+
if (this.configTemplateDiffHasChangesValue !== undefined && this.configTemplateDiffHasChangesValue !== null) {
|
|
725
|
+
return !!this.configTemplateDiffHasChangesValue;
|
|
726
|
+
}
|
|
727
|
+
const stats = this.configTemplateDiffStats && typeof this.configTemplateDiffStats === 'object'
|
|
728
|
+
? this.configTemplateDiffStats
|
|
729
|
+
: {};
|
|
730
|
+
const added = Number(stats.added || 0);
|
|
731
|
+
const removed = Number(stats.removed || 0);
|
|
732
|
+
return added > 0 || removed > 0;
|
|
733
|
+
},
|
|
734
|
+
|
|
735
|
+
async prepareConfigTemplateDiff() {
|
|
736
|
+
const requestFingerprint = this.buildConfigTemplateDiffFingerprint();
|
|
737
|
+
const requestToken = Symbol('config-template-diff-preview');
|
|
738
|
+
this._configTemplateDiffPreviewRequestToken = requestToken;
|
|
739
|
+
this.configTemplateDiffVisible = true;
|
|
740
|
+
this.configTemplateDiffLoading = true;
|
|
741
|
+
this.configTemplateDiffError = '';
|
|
742
|
+
this.configTemplateDiffLines = [];
|
|
743
|
+
this.configTemplateDiffStats = { added: 0, removed: 0, unchanged: 0 };
|
|
744
|
+
this.configTemplateDiffHasChangesValue = false;
|
|
745
|
+
try {
|
|
746
|
+
const shouldApply = () => (
|
|
747
|
+
this.configTemplateDiffVisible
|
|
748
|
+
&& this._configTemplateDiffPreviewRequestToken === requestToken
|
|
749
|
+
&& this.buildConfigTemplateDiffFingerprint() === requestFingerprint
|
|
750
|
+
);
|
|
751
|
+
const res = await api('preview-config-template-diff', {
|
|
752
|
+
template: this.configTemplateContent
|
|
753
|
+
});
|
|
754
|
+
if (!shouldApply()) {
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
if (res.error) {
|
|
758
|
+
this.configTemplateDiffError = res.error;
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
const diff = res.diff && typeof res.diff === 'object' ? res.diff : {};
|
|
762
|
+
const lines = Array.isArray(diff.lines) ? diff.lines : [];
|
|
763
|
+
this.configTemplateDiffLines = lines.filter(line => line && line.type);
|
|
764
|
+
const stats = diff.stats && typeof diff.stats === 'object' ? diff.stats : null;
|
|
765
|
+
if (stats) {
|
|
766
|
+
this.configTemplateDiffStats = {
|
|
767
|
+
added: Number(stats.added || 0),
|
|
768
|
+
removed: Number(stats.removed || 0),
|
|
769
|
+
unchanged: Number(stats.unchanged || 0)
|
|
770
|
+
};
|
|
771
|
+
} else {
|
|
772
|
+
const nextStats = { added: 0, removed: 0, unchanged: 0 };
|
|
773
|
+
for (const line of this.configTemplateDiffLines) {
|
|
774
|
+
if (line && line.type === 'add') nextStats.added += 1;
|
|
775
|
+
else if (line && line.type === 'del') nextStats.removed += 1;
|
|
776
|
+
else nextStats.unchanged += 1;
|
|
777
|
+
}
|
|
778
|
+
this.configTemplateDiffStats = nextStats;
|
|
779
|
+
}
|
|
780
|
+
this.configTemplateDiffHasChangesValue = !!diff.hasChanges;
|
|
781
|
+
this.configTemplateDiffFingerprint = requestFingerprint;
|
|
782
|
+
} catch (_) {
|
|
783
|
+
if (this._configTemplateDiffPreviewRequestToken === requestToken) {
|
|
784
|
+
this.configTemplateDiffError = '生成差异失败';
|
|
785
|
+
}
|
|
786
|
+
} finally {
|
|
787
|
+
if (this._configTemplateDiffPreviewRequestToken === requestToken) {
|
|
788
|
+
this.configTemplateDiffLoading = false;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
|
|
793
|
+
async applyConfigTemplate() {
|
|
794
|
+
if (this.configTemplateApplying) {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
if (!this.configTemplateContent || !this.configTemplateContent.trim()) {
|
|
798
|
+
this.showMessage('模板不能为空', 'error');
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// Default to two-step confirmation when the setting is unset.
|
|
803
|
+
// (The normalize helper lives in session-actions; keep a safe fallback here.)
|
|
804
|
+
const shouldUseTwoStepConfirm = normalizeConfigTemplateDiffConfirmEnabled(this.configTemplateDiffConfirmEnabled);
|
|
805
|
+
|
|
806
|
+
const performApply = async () => {
|
|
807
|
+
this.configTemplateApplying = true;
|
|
808
|
+
try {
|
|
809
|
+
const res = await api('apply-config-template', {
|
|
810
|
+
template: this.configTemplateContent
|
|
811
|
+
});
|
|
812
|
+
if (res.error) {
|
|
813
|
+
this.showMessage(res.error, 'error');
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
this.showMessage('模板已应用', 'success');
|
|
817
|
+
this.closeConfigTemplateModal({ force: true });
|
|
818
|
+
try {
|
|
819
|
+
await this.loadAll();
|
|
820
|
+
} catch (_) {
|
|
821
|
+
this.showMessage('模板已应用,但界面刷新失败,请手动刷新', 'error');
|
|
822
|
+
}
|
|
823
|
+
} catch (e) {
|
|
824
|
+
this.showMessage('应用模板失败', 'error');
|
|
825
|
+
} finally {
|
|
826
|
+
this.configTemplateApplying = false;
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
// One-step mode: apply immediately unless user explicitly entered the diff preview state.
|
|
831
|
+
if (!shouldUseTwoStepConfirm && !this.configTemplateDiffVisible) {
|
|
832
|
+
await performApply();
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
if (!this.configTemplateDiffVisible) {
|
|
837
|
+
await this.prepareConfigTemplateDiff();
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
if (this.configTemplateDiffLoading) {
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
if (this.configTemplateDiffError) {
|
|
844
|
+
this.showMessage(this.configTemplateDiffError, 'error');
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
const fingerprint = this.buildConfigTemplateDiffFingerprint();
|
|
848
|
+
if (this.configTemplateDiffFingerprint !== fingerprint) {
|
|
849
|
+
await this.prepareConfigTemplateDiff();
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
if (!this.hasConfigTemplateDiffChanges()) {
|
|
853
|
+
this.showMessage('未检测到改动', 'info');
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
await performApply();
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
}
|