codexmate 0.0.31 → 0.0.32
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 +363 -363
- package/README.zh.md +371 -371
- 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 +1725 -1725
- package/cli/claude-proxy.js +1022 -1022
- package/cli/config-bootstrap.js +402 -402
- package/cli/config-health.js +454 -454
- package/cli/doctor-core.js +903 -903
- package/cli/import-skills-url.js +356 -356
- package/cli/local-bridge.js +324 -324
- package/cli/openai-bridge.js +1653 -1653
- package/cli/openclaw-config.js +629 -629
- package/cli/session-convert-args.js +69 -69
- package/cli/session-convert-io.js +82 -82
- package/cli/session-convert.js +150 -150
- package/cli/session-usage.concurrent.js +28 -28
- package/cli/session-usage.js +118 -118
- package/cli/session-usage.models.js +176 -176
- package/cli/skills.js +1141 -1141
- package/cli/zip-commands.js +510 -510
- package/cli.js +15829 -15778
- package/lib/automation.js +404 -404
- package/lib/cli-file-utils.js +151 -151
- package/lib/cli-models-utils.js +440 -440
- package/lib/cli-network-utils.js +190 -190
- package/lib/cli-path-utils.js +85 -85
- package/lib/cli-session-utils.js +121 -121
- package/lib/cli-sessions.js +426 -417
- package/lib/cli-utils.js +155 -155
- package/lib/cli-webhook.js +126 -126
- package/lib/download-artifacts.js +92 -92
- package/lib/mcp-stdio.js +453 -453
- package/lib/task-orchestrator.js +869 -869
- package/lib/text-diff.js +303 -303
- package/lib/workflow-engine.js +340 -340
- package/package.json +76 -76
- 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 +553 -553
- package/plugins/prompt-templates/overview.mjs +91 -91
- 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 +647 -646
- package/web-ui/index.html +36 -36
- package/web-ui/logic.agents-diff.mjs +386 -386
- package/web-ui/logic.claude.mjs +168 -168
- package/web-ui/logic.codex.mjs +69 -69
- package/web-ui/logic.mjs +5 -5
- package/web-ui/logic.runtime.mjs +128 -128
- package/web-ui/logic.session-convert.mjs +70 -70
- package/web-ui/logic.sessions.mjs +781 -765
- package/web-ui/modules/api.mjs +90 -90
- package/web-ui/modules/app.computed.dashboard.mjs +248 -248
- 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 +693 -999
- package/web-ui/modules/app.constants.mjs +15 -15
- package/web-ui/modules/app.methods.agents.mjs +651 -632
- package/web-ui/modules/app.methods.claude-config.mjs +200 -200
- package/web-ui/modules/app.methods.codex-config.mjs +861 -841
- package/web-ui/modules/app.methods.index.mjs +94 -94
- package/web-ui/modules/app.methods.install.mjs +205 -205
- package/web-ui/modules/app.methods.navigation.mjs +774 -774
- 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 +529 -529
- package/web-ui/modules/app.methods.runtime.mjs +345 -345
- package/web-ui/modules/app.methods.session-actions.mjs +591 -591
- package/web-ui/modules/app.methods.session-browser.mjs +1012 -984
- package/web-ui/modules/app.methods.session-timeline.mjs +479 -479
- package/web-ui/modules/app.methods.session-trash.mjs +438 -438
- package/web-ui/modules/app.methods.startup-claude.mjs +537 -534
- package/web-ui/modules/app.methods.task-orchestration.mjs +556 -556
- package/web-ui/modules/app.methods.webhook.mjs +79 -79
- 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 +3177 -3174
- package/web-ui/modules/i18n.mjs +62 -62
- 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/provider-url-display.mjs +17 -17
- 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 +482 -482
- package/web-ui/partials/index/layout-footer.html +13 -13
- package/web-ui/partials/index/layout-header.html +503 -500
- package/web-ui/partials/index/modal-config-template-agents.html +185 -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 +162 -162
- package/web-ui/partials/index/panel-config-claude.html +136 -194
- package/web-ui/partials/index/panel-config-codex.html +197 -357
- package/web-ui/partials/index/panel-config-openclaw.html +83 -83
- package/web-ui/partials/index/panel-dashboard.html +219 -219
- package/web-ui/partials/index/panel-docs.html +115 -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 +253 -253
- package/web-ui/partials/index/panel-sessions.html +313 -302
- package/web-ui/partials/index/panel-settings.html +190 -190
- package/web-ui/partials/index/panel-trash.html +83 -88
- package/web-ui/partials/index/panel-usage.html +138 -371
- package/web-ui/res/json5.min.js +1 -1
- package/web-ui/res/vue.global.prod.js +13 -13
- package/web-ui/session-helpers.mjs +591 -591
- package/web-ui/source-bundle.cjs +233 -233
- package/web-ui/styles/base-theme.css +281 -281
- package/web-ui/styles/bridge-pool.css +197 -197
- package/web-ui/styles/controls-forms.css +433 -422
- package/web-ui/styles/dashboard.css +406 -406
- package/web-ui/styles/docs-panel.css +245 -271
- 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 +638 -626
- package/web-ui/styles/modals-core.css +466 -466
- package/web-ui/styles/navigation-panels.css +391 -391
- package/web-ui/styles/openclaw-structured.css +266 -266
- package/web-ui/styles/plugins-panel.css +564 -564
- package/web-ui/styles/responsive.css +392 -454
- package/web-ui/styles/sessions-list.css +647 -417
- package/web-ui/styles/sessions-preview.css +407 -407
- package/web-ui/styles/sessions-toolbar-trash.css +518 -348
- package/web-ui/styles/sessions-usage.css +588 -1040
- package/web-ui/styles/settings-panel.css +349 -349
- package/web-ui/styles/skills-list.css +305 -305
- package/web-ui/styles/skills-market.css +429 -429
- package/web-ui/styles/task-orchestration.css +822 -822
- package/web-ui/styles/titles-cards.css +472 -472
- package/web-ui/styles/trash-panel.css +90 -90
- package/web-ui/styles/webhook.css +81 -81
- package/web-ui/styles.css +24 -24
- package/web-ui.html +17 -17
- package/web-ui/partials/index/panel-config-codex.html.bak +0 -337
package/web-ui/app.js
CHANGED
|
@@ -1,646 +1,647 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_MODEL_AUTO_COMPACT_TOKEN_LIMIT,
|
|
3
|
-
DEFAULT_MODEL_CONTEXT_WINDOW,
|
|
4
|
-
DEFAULT_OPENCLAW_TEMPLATE,
|
|
5
|
-
SESSION_TRASH_PAGE_SIZE
|
|
6
|
-
} from './modules/app.constants.mjs';
|
|
7
|
-
import { createAppComputed } from './modules/app.computed.index.mjs';
|
|
8
|
-
import { createAppMethods } from './modules/app.methods.index.mjs';
|
|
9
|
-
import { loadConfigTemplateDiffConfirmEnabledFromStorage } from './modules/config-template-confirm-pref.mjs';
|
|
10
|
-
|
|
11
|
-
document.addEventListener('DOMContentLoaded', () => {
|
|
12
|
-
if (typeof Vue === 'undefined') {
|
|
13
|
-
console.error('Vue 库未能在 DOMContentLoaded 触发前加载完成。');
|
|
14
|
-
const fallbackTarget = document.querySelector('#app') || document.querySelector('[v-cloak]');
|
|
15
|
-
if (fallbackTarget) {
|
|
16
|
-
fallbackTarget.removeAttribute('v-cloak');
|
|
17
|
-
fallbackTarget.classList.remove('v-cloak');
|
|
18
|
-
fallbackTarget.innerHTML = '';
|
|
19
|
-
const notice = document.createElement('div');
|
|
20
|
-
notice.className = 'fallback-message';
|
|
21
|
-
notice.textContent = 'Web UI 加载失败:Vue 未加载。请检查网络或刷新页面。';
|
|
22
|
-
fallbackTarget.appendChild(notice);
|
|
23
|
-
}
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const { createApp } = Vue;
|
|
28
|
-
|
|
29
|
-
const app = createApp({
|
|
30
|
-
data() {
|
|
31
|
-
return {
|
|
32
|
-
lang: 'zh',
|
|
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
|
-
this.
|
|
424
|
-
this.
|
|
425
|
-
this.
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
this.
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
this.
|
|
489
|
-
this.
|
|
490
|
-
this.
|
|
491
|
-
this.
|
|
492
|
-
this.
|
|
493
|
-
|
|
494
|
-
window.addEventListener('
|
|
495
|
-
window.addEventListener('
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
config.
|
|
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
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
void this.
|
|
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
|
-
this.
|
|
617
|
-
this.
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
this._initialLoadOnWindowLoad
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
this._initialLoadRafId
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
this._initialLoadTimer
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
window.removeEventListener('
|
|
632
|
-
window.removeEventListener('
|
|
633
|
-
this.
|
|
634
|
-
this.
|
|
635
|
-
this.
|
|
636
|
-
this.
|
|
637
|
-
this.
|
|
638
|
-
this.
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_MODEL_AUTO_COMPACT_TOKEN_LIMIT,
|
|
3
|
+
DEFAULT_MODEL_CONTEXT_WINDOW,
|
|
4
|
+
DEFAULT_OPENCLAW_TEMPLATE,
|
|
5
|
+
SESSION_TRASH_PAGE_SIZE
|
|
6
|
+
} from './modules/app.constants.mjs';
|
|
7
|
+
import { createAppComputed } from './modules/app.computed.index.mjs';
|
|
8
|
+
import { createAppMethods } from './modules/app.methods.index.mjs';
|
|
9
|
+
import { loadConfigTemplateDiffConfirmEnabledFromStorage } from './modules/config-template-confirm-pref.mjs';
|
|
10
|
+
|
|
11
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
12
|
+
if (typeof Vue === 'undefined') {
|
|
13
|
+
console.error('Vue 库未能在 DOMContentLoaded 触发前加载完成。');
|
|
14
|
+
const fallbackTarget = document.querySelector('#app') || document.querySelector('[v-cloak]');
|
|
15
|
+
if (fallbackTarget) {
|
|
16
|
+
fallbackTarget.removeAttribute('v-cloak');
|
|
17
|
+
fallbackTarget.classList.remove('v-cloak');
|
|
18
|
+
fallbackTarget.innerHTML = '';
|
|
19
|
+
const notice = document.createElement('div');
|
|
20
|
+
notice.className = 'fallback-message';
|
|
21
|
+
notice.textContent = 'Web UI 加载失败:Vue 未加载。请检查网络或刷新页面。';
|
|
22
|
+
fallbackTarget.appendChild(notice);
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { createApp } = Vue;
|
|
28
|
+
|
|
29
|
+
const app = createApp({
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
lang: 'zh',
|
|
33
|
+
appVersion: '',
|
|
34
|
+
mainTab: 'dashboard',
|
|
35
|
+
configMode: 'codex',
|
|
36
|
+
currentProvider: '',
|
|
37
|
+
currentModel: '',
|
|
38
|
+
currentModels: {},
|
|
39
|
+
serviceTier: 'fast',
|
|
40
|
+
modelReasoningEffort: 'medium',
|
|
41
|
+
modelContextWindowInput: String(DEFAULT_MODEL_CONTEXT_WINDOW),
|
|
42
|
+
modelAutoCompactTokenLimitInput: String(DEFAULT_MODEL_AUTO_COMPACT_TOKEN_LIMIT),
|
|
43
|
+
editingCodexBudgetField: '',
|
|
44
|
+
providersList: [],
|
|
45
|
+
localBridgeExcluded: [],
|
|
46
|
+
models: [],
|
|
47
|
+
codexModelsLoading: false,
|
|
48
|
+
modelsSource: 'remote',
|
|
49
|
+
modelsHasCurrent: true,
|
|
50
|
+
claudeModels: [],
|
|
51
|
+
claudeModelsSource: 'idle',
|
|
52
|
+
claudeModelsHasCurrent: true,
|
|
53
|
+
claudeModelsLoading: false,
|
|
54
|
+
codexModelsRequestSeq: 0,
|
|
55
|
+
claudeModelsRequestSeq: 0,
|
|
56
|
+
loading: true,
|
|
57
|
+
initError: '',
|
|
58
|
+
message: '',
|
|
59
|
+
messageType: '',
|
|
60
|
+
showAddModal: false,
|
|
61
|
+
showEditModal: false,
|
|
62
|
+
showModelModal: false,
|
|
63
|
+
showModelListModal: false,
|
|
64
|
+
showClaudeConfigModal: false,
|
|
65
|
+
showEditConfigModal: false,
|
|
66
|
+
showOpenclawConfigModal: false,
|
|
67
|
+
showConfigTemplateModal: false,
|
|
68
|
+
showAgentsModal: false,
|
|
69
|
+
showSkillsModal: false,
|
|
70
|
+
showHealthCheckModal: false,
|
|
71
|
+
// Plugins
|
|
72
|
+
pluginsActiveId: 'prompt-templates',
|
|
73
|
+
pluginsLoading: false,
|
|
74
|
+
pluginsError: '',
|
|
75
|
+
promptTemplatesListRaw: [],
|
|
76
|
+
promptTemplatesLoadedOnce: false,
|
|
77
|
+
promptTemplatesKeyword: '',
|
|
78
|
+
promptTemplateSelectedId: '',
|
|
79
|
+
promptTemplateDraftRaw: null,
|
|
80
|
+
promptTemplateVarValuesRaw: {},
|
|
81
|
+
promptTemplatesMode: 'compose',
|
|
82
|
+
promptComposerCommand: '',
|
|
83
|
+
promptComposerPickerVisible: false,
|
|
84
|
+
promptComposerPickerKeyword: '',
|
|
85
|
+
promptComposerSelectedTemplateId: '',
|
|
86
|
+
promptComposerVarValuesRaw: {},
|
|
87
|
+
showConfirmDialog: false,
|
|
88
|
+
confirmDialogTitle: '',
|
|
89
|
+
confirmDialogMessage: '',
|
|
90
|
+
confirmDialogConfirmText: '确认',
|
|
91
|
+
confirmDialogCancelText: '取消',
|
|
92
|
+
confirmDialogDanger: false,
|
|
93
|
+
confirmDialogConfirmDisabled: false,
|
|
94
|
+
confirmDialogDisableWhen: null,
|
|
95
|
+
confirmDialogResolver: null,
|
|
96
|
+
configTemplateContent: '',
|
|
97
|
+
configTemplateApplying: false,
|
|
98
|
+
configTemplateDiffVisible: false,
|
|
99
|
+
configTemplateDiffLoading: false,
|
|
100
|
+
configTemplateDiffError: '',
|
|
101
|
+
configTemplateDiffLines: [],
|
|
102
|
+
configTemplateDiffStats: {
|
|
103
|
+
added: 0,
|
|
104
|
+
removed: 0,
|
|
105
|
+
unchanged: 0
|
|
106
|
+
},
|
|
107
|
+
configTemplateDiffHasChangesValue: false,
|
|
108
|
+
configTemplateDiffFingerprint: '',
|
|
109
|
+
_configTemplateDiffPreviewRequestToken: null,
|
|
110
|
+
configTemplateDiffConfirmEnabled: true,
|
|
111
|
+
codexApplying: false,
|
|
112
|
+
_pendingCodexApplyOptions: null,
|
|
113
|
+
agentsContent: '',
|
|
114
|
+
agentsPath: '',
|
|
115
|
+
agentsExists: false,
|
|
116
|
+
agentsLineEnding: '\n',
|
|
117
|
+
agentsLoading: false,
|
|
118
|
+
agentsSaving: false,
|
|
119
|
+
agentsOriginalContent: '',
|
|
120
|
+
agentsDiffVisible: false,
|
|
121
|
+
agentsDiffLoading: false,
|
|
122
|
+
agentsDiffError: '',
|
|
123
|
+
agentsDiffLines: [],
|
|
124
|
+
agentsDiffStats: {
|
|
125
|
+
added: 0,
|
|
126
|
+
removed: 0,
|
|
127
|
+
unchanged: 0
|
|
128
|
+
},
|
|
129
|
+
agentsDiffTruncated: false,
|
|
130
|
+
agentsDiffHasChangesValue: false,
|
|
131
|
+
agentsDiffFingerprint: '',
|
|
132
|
+
agentsContext: 'codex',
|
|
133
|
+
agentsModalTitle: 'AGENTS.md 编辑器',
|
|
134
|
+
agentsModalHint: '保存后会写入目标 AGENTS.md(与 config.toml 同级)。',
|
|
135
|
+
skillsTargetApp: 'codex',
|
|
136
|
+
skillsRootPath: '',
|
|
137
|
+
skillsList: [],
|
|
138
|
+
skillsSelectedNames: [],
|
|
139
|
+
skillsLoading: false,
|
|
140
|
+
skillsDeleting: false,
|
|
141
|
+
skillsKeyword: '',
|
|
142
|
+
skillsStatusFilter: 'all',
|
|
143
|
+
skillsImportList: [],
|
|
144
|
+
skillsImportSelectedKeys: [],
|
|
145
|
+
skillsScanningImports: false,
|
|
146
|
+
skillsImporting: false,
|
|
147
|
+
skillsZipImporting: false,
|
|
148
|
+
skillsExporting: false,
|
|
149
|
+
skillsMarketLoading: false,
|
|
150
|
+
skillsMarketLocalLoadedOnce: false,
|
|
151
|
+
skillsMarketImportLoadedOnce: false,
|
|
152
|
+
sessionPinnedMap: {},
|
|
153
|
+
__mainTabSwitchState: {
|
|
154
|
+
intent: '',
|
|
155
|
+
pendingTarget: '',
|
|
156
|
+
pendingConfigMode: '',
|
|
157
|
+
ticket: 0
|
|
158
|
+
},
|
|
159
|
+
sessionsViewMode: 'browser',
|
|
160
|
+
sessionsUsageTimeRange: (function () { try { const saved = localStorage.getItem('sessionsUsageTimeRange'); if (saved === '7d' || saved === '30d' || saved === 'all') return saved; } catch (_) {} return '7d'; })(),
|
|
161
|
+
sessionsUsageList: [],
|
|
162
|
+
sessionsUsageCompareEnabled: false,
|
|
163
|
+
sessionsUsageSelectedDayKey: '',
|
|
164
|
+
sessionsUsageLoadedOnce: false,
|
|
165
|
+
sessionsUsageLoadedLimit: 0,
|
|
166
|
+
sessionsUsageLoading: false,
|
|
167
|
+
sessionsUsageError: '',
|
|
168
|
+
sessionsList: [],
|
|
169
|
+
sessionsLoadedOnce: false,
|
|
170
|
+
sessionsLoading: false,
|
|
171
|
+
sessionFilterSource: 'all',
|
|
172
|
+
sessionPathFilter: '',
|
|
173
|
+
sessionQuery: '',
|
|
174
|
+
sessionRoleFilter: 'all',
|
|
175
|
+
sessionTimePreset: 'all',
|
|
176
|
+
sessionSortMode: 'time',
|
|
177
|
+
sessionPathOptions: [],
|
|
178
|
+
sessionPathOptionsLoading: false,
|
|
179
|
+
sessionPathOptionsMap: {
|
|
180
|
+
all: [],
|
|
181
|
+
codex: [],
|
|
182
|
+
claude: [],
|
|
183
|
+
gemini: []
|
|
184
|
+
},
|
|
185
|
+
sessionPathOptionsLoadedMap: {
|
|
186
|
+
all: false,
|
|
187
|
+
codex: false,
|
|
188
|
+
claude: false,
|
|
189
|
+
gemini: false
|
|
190
|
+
},
|
|
191
|
+
sessionPathRequestSeqMap: {
|
|
192
|
+
all: 0,
|
|
193
|
+
codex: 0,
|
|
194
|
+
claude: 0,
|
|
195
|
+
gemini: 0
|
|
196
|
+
},
|
|
197
|
+
sessionExporting: {},
|
|
198
|
+
sessionConverting: {},
|
|
199
|
+
sessionImportingNative: {},
|
|
200
|
+
sessionCloning: {},
|
|
201
|
+
sessionDeleting: {},
|
|
202
|
+
activeSession: null,
|
|
203
|
+
activeSessionMessages: [],
|
|
204
|
+
activeSessionDetailError: '',
|
|
205
|
+
activeSessionDetailClipped: false,
|
|
206
|
+
sessionDetailLoading: false,
|
|
207
|
+
sessionDetailRequestSeq: 0,
|
|
208
|
+
sessionDetailInitialMessageLimit: 300,
|
|
209
|
+
sessionDetailFetchStep: 300,
|
|
210
|
+
sessionDetailMessageLimit: 80,
|
|
211
|
+
sessionDetailMessageLimitCap: 1000,
|
|
212
|
+
sessionTimelineActiveKey: '',
|
|
213
|
+
sessionTimelineRafId: 0,
|
|
214
|
+
sessionTimelineLastSyncAt: 0,
|
|
215
|
+
sessionTimelineLastScrollTop: 0,
|
|
216
|
+
sessionTimelineLastAnchorY: 0,
|
|
217
|
+
sessionTimelineLastDirection: 0,
|
|
218
|
+
sessionTimelineEnabled: true,
|
|
219
|
+
sessionMessageRefMap: Object.create(null),
|
|
220
|
+
sessionMessageRefBinderMap: Object.create(null),
|
|
221
|
+
sessionPreviewScrollEl: null,
|
|
222
|
+
sessionPreviewContainerEl: null,
|
|
223
|
+
sessionPreviewHeaderEl: null,
|
|
224
|
+
sessionPreviewHeaderResizeObserver: null,
|
|
225
|
+
sessionListRenderEnabled: false,
|
|
226
|
+
sessionListVisibleCount: 0,
|
|
227
|
+
sessionListInitialBatchSize: 40,
|
|
228
|
+
sessionListLoadStep: 80,
|
|
229
|
+
sessionPreviewRenderEnabled: false,
|
|
230
|
+
sessionTabRenderTicket: 0,
|
|
231
|
+
sessionPreviewVisibleCount: 0,
|
|
232
|
+
sessionPreviewInitialBatchSize: 12,
|
|
233
|
+
sessionPreviewLoadStep: 24,
|
|
234
|
+
sessionPreviewPendingVisibleCount: 0,
|
|
235
|
+
sessionPreviewLoadingMore: false,
|
|
236
|
+
sessionStandalone: false,
|
|
237
|
+
sessionStandaloneError: '',
|
|
238
|
+
sessionStandaloneText: '',
|
|
239
|
+
sessionStandaloneTitle: '',
|
|
240
|
+
sessionStandaloneSourceLabel: '',
|
|
241
|
+
sessionStandaloneLoading: false,
|
|
242
|
+
sessionStandaloneRequestSeq: 0,
|
|
243
|
+
speedResults: {},
|
|
244
|
+
speedLoading: {},
|
|
245
|
+
claudeSpeedResults: {},
|
|
246
|
+
claudeSpeedLoading: {},
|
|
247
|
+
claudeShareLoading: {},
|
|
248
|
+
providerShareLoading: {},
|
|
249
|
+
shareCommandPrefix: 'npm start',
|
|
250
|
+
providerSwitchInProgress: false,
|
|
251
|
+
pendingProviderSwitch: '',
|
|
252
|
+
providerSwitchDisplayTarget: '',
|
|
253
|
+
healthCheckBatchTotal: 0,
|
|
254
|
+
healthCheckBatchDone: 0,
|
|
255
|
+
healthCheckBatchFailed: 0,
|
|
256
|
+
installPackageManager: 'npm',
|
|
257
|
+
installCommandAction: 'install',
|
|
258
|
+
installRegistryPreset: 'default',
|
|
259
|
+
installRegistryCustom: '',
|
|
260
|
+
installStatusTargets: null,
|
|
261
|
+
newProvider: { name: '', url: '', key: '', useTransform: false, _suggestedModel: '' },
|
|
262
|
+
resetConfigLoading: false,
|
|
263
|
+
editingProvider: { name: '', url: '', key: '', readOnly: false, nonEditable: false },
|
|
264
|
+
newModelName: '',
|
|
265
|
+
currentClaudeConfig: '',
|
|
266
|
+
currentClaudeModel: '',
|
|
267
|
+
claudeCustomModelDraft: '',
|
|
268
|
+
editingConfig: { name: '', apiKey: '', baseUrl: '', model: '' },
|
|
269
|
+
claudeConfigs: {
|
|
270
|
+
'智谱GLM': {
|
|
271
|
+
apiKey: '',
|
|
272
|
+
baseUrl: 'https://open.bigmodel.cn/api/anthropic',
|
|
273
|
+
model: 'glm-4.7',
|
|
274
|
+
hasKey: false
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
newClaudeConfig: {
|
|
278
|
+
name: '',
|
|
279
|
+
apiKey: '',
|
|
280
|
+
baseUrl: '',
|
|
281
|
+
model: ''
|
|
282
|
+
},
|
|
283
|
+
currentOpenclawConfig: '',
|
|
284
|
+
openclawConfigs: {
|
|
285
|
+
'默认配置': {
|
|
286
|
+
content: DEFAULT_OPENCLAW_TEMPLATE
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
openclawEditing: { name: '', content: '', lockName: false },
|
|
290
|
+
openclawEditorTitle: '添加 OpenClaw 配置',
|
|
291
|
+
openclawConfigPath: '',
|
|
292
|
+
openclawConfigExists: false,
|
|
293
|
+
openclawLineEnding: '\n',
|
|
294
|
+
openclawAuthProfilesByProvider: {},
|
|
295
|
+
openclawPendingAuthProfileUpdates: {},
|
|
296
|
+
openclawFileLoading: false,
|
|
297
|
+
openclawSaving: false,
|
|
298
|
+
openclawApplying: false,
|
|
299
|
+
openclawWorkspaceFileName: 'SOUL.md',
|
|
300
|
+
agentsWorkspaceFileName: '',
|
|
301
|
+
openclawStructured: {
|
|
302
|
+
agentPrimary: '',
|
|
303
|
+
agentFallbacks: [],
|
|
304
|
+
workspace: '',
|
|
305
|
+
timeout: '',
|
|
306
|
+
contextTokens: '',
|
|
307
|
+
maxConcurrent: '',
|
|
308
|
+
envItems: [],
|
|
309
|
+
toolsProfile: 'default',
|
|
310
|
+
toolsAllow: [],
|
|
311
|
+
toolsDeny: []
|
|
312
|
+
},
|
|
313
|
+
openclawQuick: {
|
|
314
|
+
providerName: '',
|
|
315
|
+
baseUrl: '',
|
|
316
|
+
baseUrlReadOnly: false,
|
|
317
|
+
baseUrlDisplayKind: 'missing',
|
|
318
|
+
apiKey: '',
|
|
319
|
+
apiKeyReadOnly: false,
|
|
320
|
+
apiKeyDisplayKind: 'missing',
|
|
321
|
+
apiKeySourceKind: '',
|
|
322
|
+
apiKeySourceProfileId: '',
|
|
323
|
+
apiKeySourceWriteField: '',
|
|
324
|
+
apiKeySourceOriginalValue: '',
|
|
325
|
+
apiKeySourceCredentialType: '',
|
|
326
|
+
apiType: 'openai-responses',
|
|
327
|
+
modelId: '',
|
|
328
|
+
modelName: '',
|
|
329
|
+
contextWindow: '',
|
|
330
|
+
maxTokens: '',
|
|
331
|
+
setPrimary: true,
|
|
332
|
+
overrideProvider: true,
|
|
333
|
+
overrideModels: true,
|
|
334
|
+
showKey: false
|
|
335
|
+
},
|
|
336
|
+
openclawAgentsList: [],
|
|
337
|
+
openclawProviders: [],
|
|
338
|
+
openclawMissingProviders: [],
|
|
339
|
+
healthCheckLoading: false,
|
|
340
|
+
healthCheckResult: null,
|
|
341
|
+
healthCheckRemote: false,
|
|
342
|
+
providersHealthLoading: false,
|
|
343
|
+
providersHealthResult: null,
|
|
344
|
+
claudeDownloadLoading: false,
|
|
345
|
+
claudeDownloadProgress: 0,
|
|
346
|
+
claudeDownloadTimer: null,
|
|
347
|
+
codexDownloadLoading: false,
|
|
348
|
+
codexDownloadProgress: 0,
|
|
349
|
+
codexDownloadTimer: null,
|
|
350
|
+
settingsTab: 'general',
|
|
351
|
+
sessionTrashEnabled: true,
|
|
352
|
+
sessionTrashItems: [],
|
|
353
|
+
sessionTrashVisibleCount: SESSION_TRASH_PAGE_SIZE,
|
|
354
|
+
sessionTrashTotalCount: 0,
|
|
355
|
+
sessionTrashCountLoadedOnce: false,
|
|
356
|
+
sessionTrashLoadedOnce: false,
|
|
357
|
+
sessionTrashLastLoadFailed: false,
|
|
358
|
+
sessionTrashCountRequestToken: 0,
|
|
359
|
+
sessionTrashListRequestToken: 0,
|
|
360
|
+
sessionTrashCountPendingOptions: null,
|
|
361
|
+
sessionTrashPendingOptions: null,
|
|
362
|
+
sessionTrashCountLoading: false,
|
|
363
|
+
sessionTrashLoading: false,
|
|
364
|
+
sessionTrashRestoring: {},
|
|
365
|
+
sessionTrashPurging: {},
|
|
366
|
+
sessionTrashClearing: false,
|
|
367
|
+
sessionTrashRetentionDays: 30,
|
|
368
|
+
claudeImportLoading: false,
|
|
369
|
+
codexImportLoading: false,
|
|
370
|
+
codexAuthProfiles: [],
|
|
371
|
+
forceCompactLayout: false,
|
|
372
|
+
taskOrchestrationTabEnabled: true,
|
|
373
|
+
taskOrchestration: {
|
|
374
|
+
loading: false,
|
|
375
|
+
planning: false,
|
|
376
|
+
running: false,
|
|
377
|
+
queueAdding: false,
|
|
378
|
+
queueStarting: false,
|
|
379
|
+
retrying: false,
|
|
380
|
+
target: '',
|
|
381
|
+
title: '',
|
|
382
|
+
notes: '',
|
|
383
|
+
followUpsText: '',
|
|
384
|
+
workflowIdsText: '',
|
|
385
|
+
selectedEngine: 'codex',
|
|
386
|
+
runMode: 'write',
|
|
387
|
+
concurrency: 2,
|
|
388
|
+
autoFixRounds: 1,
|
|
389
|
+
plan: null,
|
|
390
|
+
planFingerprint: '',
|
|
391
|
+
planIssues: [],
|
|
392
|
+
planWarnings: [],
|
|
393
|
+
overviewWarnings: [],
|
|
394
|
+
workflows: [],
|
|
395
|
+
queue: [],
|
|
396
|
+
runs: [],
|
|
397
|
+
selectedRunId: '',
|
|
398
|
+
workspaceTab: 'queue',
|
|
399
|
+
selectedRunDetail: null,
|
|
400
|
+
selectedRunLoading: false,
|
|
401
|
+
selectedRunError: '',
|
|
402
|
+
detailRequestToken: 0,
|
|
403
|
+
lastLoadedAt: '',
|
|
404
|
+
lastError: ''
|
|
405
|
+
},
|
|
406
|
+
_taskOrchestrationPollTimer: 0,
|
|
407
|
+
webhookConfig: { enabled: false, url: '', events: ['provider-switch', 'claude-md-edit'] },
|
|
408
|
+
webhookEventOptions: ['provider-switch', 'claude-md-edit'],
|
|
409
|
+
webhookSaving: false,
|
|
410
|
+
webhookTestResult: null,
|
|
411
|
+
webhookTesting: false,
|
|
412
|
+
};
|
|
413
|
+
},
|
|
414
|
+
|
|
415
|
+
mounted() {
|
|
416
|
+
if (typeof this.initI18n === 'function') {
|
|
417
|
+
this.initI18n();
|
|
418
|
+
}
|
|
419
|
+
if (typeof this.loadWebhookSettings === 'function') {
|
|
420
|
+
this.loadWebhookSettings();
|
|
421
|
+
}
|
|
422
|
+
if (typeof this.t === 'function') {
|
|
423
|
+
this.confirmDialogConfirmText = this.t('confirm.ok');
|
|
424
|
+
this.confirmDialogCancelText = this.t('confirm.cancel');
|
|
425
|
+
this.agentsModalTitle = this.t('modal.agents.title');
|
|
426
|
+
this.agentsModalHint = this.t('modal.agents.hint');
|
|
427
|
+
}
|
|
428
|
+
{
|
|
429
|
+
const NAV_STATE_STORAGE_KEY = 'codexmateNavState.v1';
|
|
430
|
+
const mainTabSet = new Set(['dashboard', 'config', 'sessions', 'usage', 'orchestration', 'market', 'plugins', 'docs', 'settings', 'trash']);
|
|
431
|
+
let restored = null;
|
|
432
|
+
try {
|
|
433
|
+
const raw = localStorage.getItem(NAV_STATE_STORAGE_KEY) || '';
|
|
434
|
+
restored = raw ? JSON.parse(raw) : null;
|
|
435
|
+
} catch (_) {
|
|
436
|
+
restored = null;
|
|
437
|
+
}
|
|
438
|
+
const nextMainTab = restored && typeof restored.mainTab === 'string'
|
|
439
|
+
? restored.mainTab.trim().toLowerCase()
|
|
440
|
+
: '';
|
|
441
|
+
const nextConfigMode = restored && typeof restored.configMode === 'string'
|
|
442
|
+
? restored.configMode.trim().toLowerCase()
|
|
443
|
+
: '';
|
|
444
|
+
const nextSettingsTab = restored && typeof restored.settingsTab === 'string'
|
|
445
|
+
? restored.settingsTab.trim().toLowerCase()
|
|
446
|
+
: '';
|
|
447
|
+
let urlMainTab = '';
|
|
448
|
+
try {
|
|
449
|
+
const url = new URL(window.location.href);
|
|
450
|
+
if (url.pathname !== '/session') {
|
|
451
|
+
urlMainTab = String(url.searchParams.get('tab') || '').trim().toLowerCase();
|
|
452
|
+
}
|
|
453
|
+
} catch (_) {
|
|
454
|
+
urlMainTab = '';
|
|
455
|
+
}
|
|
456
|
+
const resolvedMainTab = urlMainTab && mainTabSet.has(urlMainTab)
|
|
457
|
+
? urlMainTab
|
|
458
|
+
: nextMainTab;
|
|
459
|
+
if (nextSettingsTab && (nextSettingsTab === 'general' || nextSettingsTab === 'data')) {
|
|
460
|
+
this.settingsTab = nextSettingsTab;
|
|
461
|
+
}
|
|
462
|
+
if (nextConfigMode && typeof this.switchConfigMode === 'function') {
|
|
463
|
+
this.__navStateRestoring = true;
|
|
464
|
+
try {
|
|
465
|
+
if (nextConfigMode === 'codex' || nextConfigMode === 'claude' || nextConfigMode === 'openclaw') {
|
|
466
|
+
this.configMode = nextConfigMode;
|
|
467
|
+
}
|
|
468
|
+
if (resolvedMainTab && mainTabSet.has(resolvedMainTab) && resolvedMainTab !== this.mainTab) {
|
|
469
|
+
this.switchMainTab(resolvedMainTab);
|
|
470
|
+
}
|
|
471
|
+
} finally {
|
|
472
|
+
this.__navStateRestoring = false;
|
|
473
|
+
}
|
|
474
|
+
} else if (resolvedMainTab && mainTabSet.has(resolvedMainTab) && resolvedMainTab !== this.mainTab) {
|
|
475
|
+
this.__navStateRestoring = true;
|
|
476
|
+
try {
|
|
477
|
+
this.switchMainTab(resolvedMainTab);
|
|
478
|
+
} finally {
|
|
479
|
+
this.__navStateRestoring = false;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
this.initSessionStandalone();
|
|
484
|
+
this.updateCompactLayoutMode();
|
|
485
|
+
if (!this.taskOrchestrationTabEnabled && this.mainTab === 'orchestration') {
|
|
486
|
+
this.mainTab = 'config';
|
|
487
|
+
}
|
|
488
|
+
this.restoreSessionFilterCache();
|
|
489
|
+
this.restoreSessionPinnedMap();
|
|
490
|
+
this.shareCommandPrefix = this.normalizeShareCommandPrefix(localStorage.getItem('codexmateShareCommandPrefix'));
|
|
491
|
+
this.sessionTrashEnabled = this.normalizeSessionTrashEnabled(localStorage.getItem('codexmateSessionTrashEnabled'));
|
|
492
|
+
this.sessionTrashRetentionDays = this.normalizeSessionTrashRetentionDays(localStorage.getItem('codexmateSessionTrashRetentionDays'));
|
|
493
|
+
this.configTemplateDiffConfirmEnabled = loadConfigTemplateDiffConfirmEnabledFromStorage(localStorage);
|
|
494
|
+
window.addEventListener('resize', this.onWindowResize);
|
|
495
|
+
window.addEventListener('keydown', this.handleGlobalKeydown);
|
|
496
|
+
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
497
|
+
const savedConfigs = localStorage.getItem('claudeConfigs');
|
|
498
|
+
if (savedConfigs) {
|
|
499
|
+
try {
|
|
500
|
+
this.claudeConfigs = JSON.parse(savedConfigs);
|
|
501
|
+
for (const [name, config] of Object.entries(this.claudeConfigs)) {
|
|
502
|
+
if (config.apiKey && config.apiKey.includes('****')) {
|
|
503
|
+
config.apiKey = '';
|
|
504
|
+
config.hasKey = false;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
localStorage.setItem('claudeConfigs', JSON.stringify(this.claudeConfigs));
|
|
508
|
+
} catch (e) {
|
|
509
|
+
console.error('加载 Claude 配置失败:', e);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
{
|
|
513
|
+
const savedCurrentClaudeConfig = localStorage.getItem('currentClaudeConfig');
|
|
514
|
+
if (savedCurrentClaudeConfig && this.claudeConfigs[savedCurrentClaudeConfig]) {
|
|
515
|
+
this.currentClaudeConfig = savedCurrentClaudeConfig;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (!this.currentClaudeConfig) {
|
|
519
|
+
const claudeConfigNames = Object.keys(this.claudeConfigs || {});
|
|
520
|
+
if (claudeConfigNames.length > 0) {
|
|
521
|
+
this.currentClaudeConfig = claudeConfigNames[0];
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
if (this.currentClaudeConfig && !this.currentClaudeModel) {
|
|
525
|
+
const initialClaudeConfig = this.claudeConfigs[this.currentClaudeConfig];
|
|
526
|
+
this.currentClaudeModel = initialClaudeConfig && initialClaudeConfig.model ? initialClaudeConfig.model : '';
|
|
527
|
+
}
|
|
528
|
+
const normalizeOpenclawConfigs = (configs) => {
|
|
529
|
+
const source = configs && typeof configs === 'object' && !Array.isArray(configs)
|
|
530
|
+
? configs
|
|
531
|
+
: {};
|
|
532
|
+
const defaultEntry = source['默认配置']
|
|
533
|
+
&& typeof source['默认配置'] === 'object'
|
|
534
|
+
&& !Array.isArray(source['默认配置'])
|
|
535
|
+
? source['默认配置']
|
|
536
|
+
: { content: DEFAULT_OPENCLAW_TEMPLATE };
|
|
537
|
+
const normalized = {
|
|
538
|
+
'默认配置': {
|
|
539
|
+
content: typeof defaultEntry.content === 'string' ? defaultEntry.content : DEFAULT_OPENCLAW_TEMPLATE
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
for (const [name, value] of Object.entries(source)) {
|
|
543
|
+
if (name === '默认配置') continue;
|
|
544
|
+
normalized[name] = value;
|
|
545
|
+
}
|
|
546
|
+
return normalized;
|
|
547
|
+
};
|
|
548
|
+
const savedOpenclawConfigs = localStorage.getItem('openclawConfigs');
|
|
549
|
+
if (savedOpenclawConfigs) {
|
|
550
|
+
try {
|
|
551
|
+
this.openclawConfigs = normalizeOpenclawConfigs(JSON.parse(savedOpenclawConfigs));
|
|
552
|
+
} catch (e) {
|
|
553
|
+
console.error('加载 OpenClaw 配置失败:', e);
|
|
554
|
+
this.openclawConfigs = normalizeOpenclawConfigs(this.openclawConfigs);
|
|
555
|
+
}
|
|
556
|
+
} else {
|
|
557
|
+
this.openclawConfigs = normalizeOpenclawConfigs(this.openclawConfigs);
|
|
558
|
+
}
|
|
559
|
+
const configNames = Object.keys(this.openclawConfigs);
|
|
560
|
+
if (configNames.length > 0) {
|
|
561
|
+
this.currentOpenclawConfig = this.openclawConfigs['默认配置'] ? '默认配置' : configNames[0];
|
|
562
|
+
}
|
|
563
|
+
const runInitialLoad = () => {
|
|
564
|
+
const triggerLoad = async () => {
|
|
565
|
+
this._initialLoadTimer = 0;
|
|
566
|
+
const startupOk = await this.loadAll();
|
|
567
|
+
if (!startupOk) {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
if (this.mainTab === 'dashboard') {
|
|
571
|
+
if (!this.__doctorLoadedOnce) {
|
|
572
|
+
this.__doctorLoadedOnce = true;
|
|
573
|
+
if (typeof this.runHealthCheck === 'function') {
|
|
574
|
+
void this.runHealthCheck({ doctor: true, silent: true });
|
|
575
|
+
}
|
|
576
|
+
if (typeof this.runProvidersHealthCheck === 'function') {
|
|
577
|
+
void this.runProvidersHealthCheck({ remote: true });
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
void this.refreshClaudeSelectionFromSettings({ silent: true });
|
|
582
|
+
void this.syncDefaultOpenclawConfigEntry({ silent: true });
|
|
583
|
+
};
|
|
584
|
+
if (typeof requestAnimationFrame === 'function') {
|
|
585
|
+
this._initialLoadRafId = requestAnimationFrame(() => {
|
|
586
|
+
this._initialLoadRafId = 0;
|
|
587
|
+
if (typeof setTimeout === 'function') {
|
|
588
|
+
this._initialLoadTimer = setTimeout(triggerLoad, 120);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
triggerLoad();
|
|
592
|
+
});
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if (typeof setTimeout === 'function') {
|
|
596
|
+
this._initialLoadTimer = setTimeout(triggerLoad, 120);
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
triggerLoad();
|
|
600
|
+
};
|
|
601
|
+
if (document.readyState === 'complete') {
|
|
602
|
+
runInitialLoad();
|
|
603
|
+
} else {
|
|
604
|
+
this._initialLoadOnWindowLoad = () => {
|
|
605
|
+
if (typeof window !== 'undefined' && typeof window.removeEventListener === 'function') {
|
|
606
|
+
window.removeEventListener('load', this._initialLoadOnWindowLoad);
|
|
607
|
+
}
|
|
608
|
+
this._initialLoadOnWindowLoad = null;
|
|
609
|
+
runInitialLoad();
|
|
610
|
+
};
|
|
611
|
+
window.addEventListener('load', this._initialLoadOnWindowLoad, { once: true });
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
|
|
615
|
+
beforeUnmount() {
|
|
616
|
+
this.teardownSessionTabRender();
|
|
617
|
+
this.cancelScheduledSessionTabDeferredTeardown();
|
|
618
|
+
this.disconnectSessionPreviewHeaderResizeObserver();
|
|
619
|
+
if (this._initialLoadOnWindowLoad) {
|
|
620
|
+
window.removeEventListener('load', this._initialLoadOnWindowLoad);
|
|
621
|
+
this._initialLoadOnWindowLoad = null;
|
|
622
|
+
}
|
|
623
|
+
if (this._initialLoadRafId) {
|
|
624
|
+
cancelAnimationFrame(this._initialLoadRafId);
|
|
625
|
+
this._initialLoadRafId = 0;
|
|
626
|
+
}
|
|
627
|
+
if (this._initialLoadTimer) {
|
|
628
|
+
clearTimeout(this._initialLoadTimer);
|
|
629
|
+
this._initialLoadTimer = 0;
|
|
630
|
+
}
|
|
631
|
+
window.removeEventListener('resize', this.onWindowResize);
|
|
632
|
+
window.removeEventListener('keydown', this.handleGlobalKeydown);
|
|
633
|
+
window.removeEventListener('beforeunload', this.handleBeforeUnload);
|
|
634
|
+
this.applyCompactLayoutClass(false);
|
|
635
|
+
this.stopTaskOrchestrationPolling();
|
|
636
|
+
this.sessionPreviewScrollEl = null;
|
|
637
|
+
this.sessionPreviewContainerEl = null;
|
|
638
|
+
this.sessionPreviewHeaderEl = null;
|
|
639
|
+
this.clearSessionTimelineRefs();
|
|
640
|
+
},
|
|
641
|
+
|
|
642
|
+
computed: createAppComputed(),
|
|
643
|
+
methods: createAppMethods()
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
app.mount('#app');
|
|
647
|
+
});
|