codexmate 0.1.32 → 0.1.34
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 +18 -2
- package/README.vi.md +18 -2
- package/README.zh.md +18 -2
- package/cli/claude-proxy.js +2 -2
- package/cli/local-bridge.js +10 -6
- package/cli/openai-chat-routing.js +38 -0
- package/cli/prompt-history.js +2 -0
- package/cli/routing-bridge.js +143 -0
- package/cli/system-prompt-files.js +75 -53
- package/cli.js +325 -215
- package/lib/cli-config-engine.js +6 -1
- package/lib/cli-file-utils.js +6 -1
- package/lib/config-change-fs.js +132 -0
- package/lib/config-changes.js +293 -0
- package/lib/file-sharing-lan.js +111 -0
- package/lib/file-sharing.js +196 -0
- package/lib/handoff-mcp.js +18 -2
- package/lib/local-feature-store.js +39 -0
- package/lib/model-test-client.js +61 -0
- package/lib/model-test.js +126 -0
- package/lib/routing-groups.js +161 -0
- package/lib/session-bookmarks.js +72 -0
- package/lib/session-context-health.js +23 -3
- package/lib/session-diagnostics.js +75 -0
- package/lib/session-feature-settings.js +21 -0
- package/lib/session-features.js +63 -0
- package/lib/session-handoff-draft.js +43 -0
- package/lib/session-projects.js +76 -0
- package/lib/session-search-index.js +188 -0
- package/lib/thread-handoff.js +8 -0
- package/lib/web-server.js +216 -0
- package/package.json +1 -1
- package/plugins/file-sharing/manifest.mjs +10 -0
- package/plugins/file-sharing/methods.mjs +101 -0
- package/plugins/file-sharing/overview.mjs +3 -0
- package/plugins/file-sharing/ownership.mjs +5 -0
- package/plugins/registry.mjs +3 -0
- package/web-ui/app.js +22 -3
- package/web-ui/index.html +4 -2
- package/web-ui/logic.context-window.mjs +15 -0
- package/web-ui/modules/api.mjs +72 -39
- package/web-ui/modules/app.computed.main-tabs.mjs +3 -0
- package/web-ui/modules/app.methods.agents.mjs +17 -0
- package/web-ui/modules/app.methods.claude-config.mjs +2 -0
- package/web-ui/modules/app.methods.codex-config.mjs +9 -0
- package/web-ui/modules/app.methods.config-changes.mjs +124 -0
- package/web-ui/modules/app.methods.install.mjs +23 -3
- package/web-ui/modules/app.methods.kilocode-config.mjs +2 -0
- package/web-ui/modules/app.methods.navigation.mjs +2 -0
- package/web-ui/modules/app.methods.openclaw-persist.mjs +2 -0
- package/web-ui/modules/app.methods.opencode-config.mjs +2 -0
- package/web-ui/modules/app.methods.pi-config.mjs +12 -3
- package/web-ui/modules/app.methods.prompts-editor.mjs +7 -4
- package/web-ui/modules/app.methods.provider-cache.mjs +9 -3
- package/web-ui/modules/app.methods.providers.mjs +6 -0
- package/web-ui/modules/app.methods.session-actions.mjs +2 -2
- package/web-ui/modules/app.methods.startup-claude.mjs +8 -47
- package/web-ui/modules/app.methods.system-prompt.mjs +88 -17
- package/web-ui/modules/app.methods.theme.mjs +4 -3
- package/web-ui/modules/app.methods.web-ui-preferences.mjs +7 -0
- package/web-ui/modules/config-change-actions.mjs +9 -0
- package/web-ui/modules/i18n/locales/en.mjs +254 -8
- package/web-ui/modules/i18n/locales/ja.mjs +254 -8
- package/web-ui/modules/i18n/locales/vi.mjs +254 -8
- package/web-ui/modules/i18n/locales/zh-tw.mjs +254 -8
- package/web-ui/modules/i18n/locales/zh.mjs +254 -8
- package/web-ui/modules/model-test.mjs +82 -0
- package/web-ui/modules/plugins.methods.mjs +3 -1
- package/web-ui/modules/prompt-ecosystem.methods.mjs +4 -3
- package/web-ui/modules/request-deadline.mjs +33 -0
- package/web-ui/modules/routing.mjs +206 -0
- package/web-ui/modules/session-features.mjs +279 -0
- package/web-ui/modules/thread-handoff.mjs +1 -1
- package/web-ui/partials/index/config-changes.html +25 -0
- package/web-ui/partials/index/context-window-reference.html +17 -0
- package/web-ui/partials/index/layout-header.html +40 -42
- package/web-ui/partials/index/modal-openclaw-config.html +0 -2
- package/web-ui/partials/index/modal-skills.html +0 -1
- package/web-ui/partials/index/modals-basic.html +15 -8
- package/web-ui/partials/index/modals-pi-provider.html +0 -1
- package/web-ui/partials/index/panel-config-codex.html +0 -3
- package/web-ui/partials/index/panel-config-openclaw.html +16 -13
- package/web-ui/partials/index/panel-dashboard.html +0 -2
- package/web-ui/partials/index/panel-plugins.html +3 -10
- package/web-ui/partials/index/panel-prompts.html +13 -8
- package/web-ui/partials/index/panel-routing.html +3 -0
- package/web-ui/partials/index/panel-sessions.html +9 -0
- package/web-ui/partials/index/panel-settings.html +12 -13
- package/web-ui/partials/index/panel-trash.html +0 -1
- package/web-ui/partials/index/plugin-file-sharing.html +47 -0
- package/web-ui/partials/index/routing-model-test.html +53 -0
- package/web-ui/partials/index/session-diagnostics.html +32 -0
- package/web-ui/partials/index/session-features.html +107 -0
- package/web-ui/partials/index/thread-handoff.html +6 -3
- package/web-ui/res/web-ui-render.precompiled.js +1689 -246
- package/web-ui/styles/base-theme.css +1 -1
- package/web-ui/styles/config-changes.css +30 -0
- package/web-ui/styles/modals-core.css +6 -5
- package/web-ui/styles/navigation-panels.css +4 -0
- package/web-ui/styles/openclaw-structured.css +205 -189
- package/web-ui/styles/plugins-panel.css +40 -1
- package/web-ui/styles/responsive.css +10 -5
- package/web-ui/styles/routing.css +78 -0
- package/web-ui/styles/session-features.css +258 -0
- package/web-ui/styles/settings-panel.css +30 -0
- package/web-ui/styles/system-prompt.css +8 -7
- package/web-ui/styles/theme-violet-tokens.css +52 -0
- package/web-ui/styles/theme-violet.css +1736 -0
- package/web-ui/styles.css +5 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withRequestDeadline } from './request-deadline.mjs';
|
|
1
2
|
import {
|
|
2
3
|
findDuplicateClaudeConfigName,
|
|
3
4
|
getClaudeModelCatalogForBaseUrl,
|
|
@@ -29,6 +30,7 @@ function shouldSuppressDeletedClaudeSettingsImport(env = {}, deletedEntries = []
|
|
|
29
30
|
export function createStartupClaudeMethods(options = {}) {
|
|
30
31
|
const {
|
|
31
32
|
api,
|
|
33
|
+
configLoadTimeoutMs = 6000,
|
|
32
34
|
defaultModelContextWindow = 190000,
|
|
33
35
|
defaultModelAutoCompactTokenLimit = 185000
|
|
34
36
|
} = options;
|
|
@@ -41,26 +43,6 @@ export function createStartupClaudeMethods(options = {}) {
|
|
|
41
43
|
}
|
|
42
44
|
const preserveLoading = !!options.preserveLoading;
|
|
43
45
|
const run = async () => {
|
|
44
|
-
const configLoadTimeoutMs = 6000;
|
|
45
|
-
const withTimeout = async (promise, ms) => {
|
|
46
|
-
const timeoutMs = Number.isFinite(Number(ms)) ? Math.max(0, Number(ms)) : 0;
|
|
47
|
-
if (!timeoutMs) {
|
|
48
|
-
return promise;
|
|
49
|
-
}
|
|
50
|
-
let timer = null;
|
|
51
|
-
try {
|
|
52
|
-
return await Promise.race([
|
|
53
|
-
promise,
|
|
54
|
-
new Promise((_, reject) => {
|
|
55
|
-
timer = setTimeout(() => reject(new Error('timeout')), timeoutMs);
|
|
56
|
-
})
|
|
57
|
-
]);
|
|
58
|
-
} finally {
|
|
59
|
-
if (timer) {
|
|
60
|
-
clearTimeout(timer);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
46
|
if (!preserveLoading) {
|
|
65
47
|
this.loading = true;
|
|
66
48
|
}
|
|
@@ -68,12 +50,12 @@ export function createStartupClaudeMethods(options = {}) {
|
|
|
68
50
|
const startedAt = Date.now();
|
|
69
51
|
const timeLeftMs = () => configLoadTimeoutMs - (Date.now() - startedAt);
|
|
70
52
|
try {
|
|
71
|
-
const statusRes = await
|
|
53
|
+
const statusRes = await withRequestDeadline(signal => api('status', {}, { signal }), { timeoutMs: Math.max(0, timeLeftMs()) });
|
|
72
54
|
if (statusRes && statusRes.error) {
|
|
73
55
|
this.initError = statusRes.error;
|
|
74
56
|
return false;
|
|
75
57
|
}
|
|
76
|
-
const listRes = await
|
|
58
|
+
const listRes = await withRequestDeadline(signal => api('list', {}, { signal }), { timeoutMs: Math.max(0, timeLeftMs()) });
|
|
77
59
|
if (listRes && listRes.error) {
|
|
78
60
|
this.initError = listRes.error;
|
|
79
61
|
return false;
|
|
@@ -91,7 +73,7 @@ export function createStartupClaudeMethods(options = {}) {
|
|
|
91
73
|
: '';
|
|
92
74
|
this.currentModel = dictModelForCurrent || statusRes.model;
|
|
93
75
|
try {
|
|
94
|
-
const installRes = await
|
|
76
|
+
const installRes = await withRequestDeadline(signal => api('install-status', {}, { signal }), { timeoutMs: Math.max(0, Math.min(1200, timeLeftMs())) });
|
|
95
77
|
if (installRes && !installRes.error) {
|
|
96
78
|
const targets = Array.isArray(installRes.targets) ? installRes.targets : null;
|
|
97
79
|
if (targets) {
|
|
@@ -162,9 +144,8 @@ export function createStartupClaudeMethods(options = {}) {
|
|
|
162
144
|
this.maybeShowStarPrompt();
|
|
163
145
|
return true;
|
|
164
146
|
} catch (e) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
147
|
+
this.initError = e && e.message === 'timeout'
|
|
148
|
+
? '读取配置超时' : '连接失败: ' + (e && e.message || '');
|
|
168
149
|
return false;
|
|
169
150
|
} finally {
|
|
170
151
|
if (!preserveLoading) {
|
|
@@ -340,28 +321,8 @@ export function createStartupClaudeMethods(options = {}) {
|
|
|
340
321
|
const silent = !!options.silent;
|
|
341
322
|
const silentModelError = !!options.silentModelError || silent;
|
|
342
323
|
const run = async () => {
|
|
343
|
-
const configLoadTimeoutMs = 6000;
|
|
344
|
-
const withTimeout = async (promise, ms) => {
|
|
345
|
-
const timeoutMs = Number.isFinite(Number(ms)) ? Math.max(0, Number(ms)) : 0;
|
|
346
|
-
if (!timeoutMs) {
|
|
347
|
-
return promise;
|
|
348
|
-
}
|
|
349
|
-
let timer = null;
|
|
350
|
-
try {
|
|
351
|
-
return await Promise.race([
|
|
352
|
-
promise,
|
|
353
|
-
new Promise((_, reject) => {
|
|
354
|
-
timer = setTimeout(() => reject(new Error('timeout')), timeoutMs);
|
|
355
|
-
})
|
|
356
|
-
]);
|
|
357
|
-
} finally {
|
|
358
|
-
if (timer) {
|
|
359
|
-
clearTimeout(timer);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
324
|
try {
|
|
364
|
-
const res = await
|
|
325
|
+
const res = await withRequestDeadline(signal => api('get-claude-settings', {}, { signal }), { timeoutMs: configLoadTimeoutMs });
|
|
365
326
|
if (res && res.error) {
|
|
366
327
|
if (!silent) {
|
|
367
328
|
this.showMessage('读取配置失败', 'error');
|
|
@@ -14,19 +14,83 @@ export function createSystemPromptMethods(options = {}) {
|
|
|
14
14
|
|
|
15
15
|
return {
|
|
16
16
|
|
|
17
|
+
currentSysPromptFileName() {
|
|
18
|
+
return this.sysPromptFileName || (this.sysPromptMode === 'append' ? 'APPEND_SYSTEM.md' : 'SYSTEM.md');
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
isSysPromptCustomFile() {
|
|
22
|
+
return !['SYSTEM.md', 'APPEND_SYSTEM.md'].includes(this.currentSysPromptFileName());
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
sysPromptTargetParams() {
|
|
26
|
+
return {
|
|
27
|
+
scope: this.sysPromptScope || 'global', mode: this.sysPromptMode || 'append',
|
|
28
|
+
...(this.sysPromptFileName ? { fileName: this.sysPromptFileName } : {})
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
canSwitchSysPromptTarget() {
|
|
33
|
+
if (this.sysPromptLoading || this.sysPromptSaving || this.sysPromptDiffVisible) return false;
|
|
34
|
+
if (!this.hasSysPromptContentChanged()) return true;
|
|
35
|
+
this.showMessage(this.t('sysPrompt.fileUnsaved'), 'info');
|
|
36
|
+
return false;
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
async loadSystemPromptFiles() {
|
|
40
|
+
if (this.sysPromptFilesLoading) return;
|
|
41
|
+
const scope = this.sysPromptScope || 'global';
|
|
42
|
+
const token = issueLatestRequestToken(this, '_sysPromptFilesRequestToken');
|
|
43
|
+
this.sysPromptFilesLoading = true;
|
|
44
|
+
try {
|
|
45
|
+
const result = await api('list-system-prompt-files', { scope });
|
|
46
|
+
if (!isLatestRequestToken(this, '_sysPromptFilesRequestToken', token) || scope !== this.sysPromptScope) return;
|
|
47
|
+
if (result.error) throw new Error(result.error);
|
|
48
|
+
this.sysPromptFiles = result.files;
|
|
49
|
+
const isListed = result.files.some(file => file.filename === this.currentSysPromptFileName());
|
|
50
|
+
if (!isListed) this.sysPromptFileMissing = true;
|
|
51
|
+
this.sysPromptFilesError = !isListed ? this.t('sysPrompt.fileMissing')
|
|
52
|
+
: (this.sysPromptFileMissing ? this.sysPromptFilesError : '');
|
|
53
|
+
} catch (error) {
|
|
54
|
+
if (isLatestRequestToken(this, '_sysPromptFilesRequestToken', token) && scope === this.sysPromptScope) {
|
|
55
|
+
this.sysPromptFilesError = error.message || this.t('toast.load.fail');
|
|
56
|
+
}
|
|
57
|
+
} finally {
|
|
58
|
+
if (isLatestRequestToken(this, '_sysPromptFilesRequestToken', token)) this.sysPromptFilesLoading = false;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
switchSysPromptFileName(filename, event) {
|
|
63
|
+
if (event) event.target.value = this.currentSysPromptFileName();
|
|
64
|
+
if (filename === this.currentSysPromptFileName() || !this.canSwitchSysPromptTarget()) return;
|
|
65
|
+
if (!this.sysPromptFiles.some(file => file.filename === filename)) return;
|
|
66
|
+
this.sysPromptFileName = filename;
|
|
67
|
+
if (filename === 'SYSTEM.md') this.sysPromptMode = 'system';
|
|
68
|
+
if (filename === 'APPEND_SYSTEM.md') this.sysPromptMode = 'append';
|
|
69
|
+
this.closeSysHistory();
|
|
70
|
+
this.loadSystemPrompt();
|
|
71
|
+
},
|
|
72
|
+
|
|
17
73
|
switchSysPromptScope(scope) {
|
|
18
|
-
if (this.
|
|
74
|
+
if (!this.canSwitchSysPromptTarget()) return;
|
|
19
75
|
const normalized = scope === 'project' ? scope : 'global';
|
|
20
76
|
if (normalized === this.sysPromptScope) return;
|
|
21
77
|
this.sysPromptScope = normalized;
|
|
78
|
+
this.sysPromptFileName = '';
|
|
79
|
+
this.sysPromptFiles = [];
|
|
80
|
+
this._sysPromptFilesRequestToken = null;
|
|
81
|
+
this.sysPromptFilesLoading = false;
|
|
82
|
+
this.closeSysHistory();
|
|
83
|
+
this.loadSystemPromptFiles();
|
|
22
84
|
this.loadSystemPrompt();
|
|
23
85
|
},
|
|
24
86
|
|
|
25
87
|
switchSysPromptMode(mode) {
|
|
26
|
-
if (this.
|
|
88
|
+
if (!this.canSwitchSysPromptTarget()) return;
|
|
27
89
|
const normalized = mode === 'system' ? mode : 'append';
|
|
28
90
|
if (normalized === this.sysPromptMode) return;
|
|
29
91
|
this.sysPromptMode = normalized;
|
|
92
|
+
this.sysPromptFileName = normalized === 'system' ? 'SYSTEM.md' : 'APPEND_SYSTEM.md';
|
|
93
|
+
this.closeSysHistory();
|
|
30
94
|
this.loadSystemPrompt();
|
|
31
95
|
},
|
|
32
96
|
|
|
@@ -53,24 +117,29 @@ export function createSystemPromptMethods(options = {}) {
|
|
|
53
117
|
const mode = this.sysPromptMode || 'append';
|
|
54
118
|
const content = typeof this.sysPromptContent === 'string' ? this.sysPromptContent : '';
|
|
55
119
|
const original = typeof this.sysPromptOriginalContent === 'string' ? this.sysPromptOriginalContent : '';
|
|
56
|
-
return `${scope}::${mode}::${content.length}::${content}::${original.length}::${original}`;
|
|
120
|
+
return `${scope}::${mode}::${this.currentSysPromptFileName()}::${content.length}::${content}::${original.length}::${original}`;
|
|
57
121
|
},
|
|
58
122
|
|
|
59
123
|
async loadSystemPrompt() {
|
|
60
124
|
const requestToken = issueLatestRequestToken(this, '_sysPromptOpenRequestToken');
|
|
125
|
+
const filename = this.currentSysPromptFileName();
|
|
61
126
|
this.sysPromptLoading = true;
|
|
127
|
+
this.sysPromptFileMissing = true;
|
|
62
128
|
this.resetSysPromptDiffState();
|
|
63
129
|
try {
|
|
64
|
-
const params =
|
|
65
|
-
scope: this.sysPromptScope || 'global',
|
|
66
|
-
mode: this.sysPromptMode || 'append'
|
|
67
|
-
};
|
|
130
|
+
const params = this.sysPromptTargetParams();
|
|
68
131
|
const res = await api('get-system-prompt', params);
|
|
69
|
-
if (!isLatestRequestToken(this, '_sysPromptOpenRequestToken', requestToken)
|
|
70
|
-
|
|
71
|
-
|
|
132
|
+
if (!isLatestRequestToken(this, '_sysPromptOpenRequestToken', requestToken)
|
|
133
|
+
|| params.scope !== this.sysPromptScope || filename !== this.currentSysPromptFileName()) return;
|
|
134
|
+
if (res.error || (this.isSysPromptCustomFile() && !res.exists)) {
|
|
135
|
+
this.sysPromptFileMissing = true;
|
|
136
|
+
this.sysPromptFilesError = res.error || this.t('sysPrompt.fileMissing');
|
|
137
|
+
this.showMessage(this.sysPromptFilesError, 'error');
|
|
72
138
|
return;
|
|
73
139
|
}
|
|
140
|
+
this.sysPromptFileName = res.filename || this.currentSysPromptFileName();
|
|
141
|
+
this.sysPromptFileMissing = false;
|
|
142
|
+
this.sysPromptFilesError = '';
|
|
74
143
|
this.sysPromptContent = res.content || '';
|
|
75
144
|
this.sysPromptOriginalContent = this.sysPromptContent;
|
|
76
145
|
this.sysPromptPath = res.path || '';
|
|
@@ -79,7 +148,9 @@ export function createSystemPromptMethods(options = {}) {
|
|
|
79
148
|
this.sysHistoryBucket = res.historyBucket || '';
|
|
80
149
|
} catch (e) {
|
|
81
150
|
if (!isLatestRequestToken(this, '_sysPromptOpenRequestToken', requestToken)) return;
|
|
82
|
-
this.
|
|
151
|
+
this.sysPromptFileMissing = true;
|
|
152
|
+
this.sysPromptFilesError = this.t('toast.load.fail');
|
|
153
|
+
this.showMessage(this.sysPromptFilesError, 'error');
|
|
83
154
|
} finally {
|
|
84
155
|
if (isLatestRequestToken(this, '_sysPromptOpenRequestToken', requestToken)) {
|
|
85
156
|
this.sysPromptLoading = false;
|
|
@@ -147,8 +218,7 @@ export function createSystemPromptMethods(options = {}) {
|
|
|
147
218
|
}
|
|
148
219
|
const rpcParams = {
|
|
149
220
|
...previewRequest.params,
|
|
150
|
-
|
|
151
|
-
mode: this.sysPromptMode || 'append'
|
|
221
|
+
...this.sysPromptTargetParams()
|
|
152
222
|
};
|
|
153
223
|
const res = await apiWithMeta('preview-system-prompt-diff', rpcParams);
|
|
154
224
|
if (!shouldApplyPreviewState()) return;
|
|
@@ -188,7 +258,7 @@ export function createSystemPromptMethods(options = {}) {
|
|
|
188
258
|
},
|
|
189
259
|
|
|
190
260
|
async applySystemPrompt() {
|
|
191
|
-
if (this.sysPromptSaving) return;
|
|
261
|
+
if (this.sysPromptSaving || this.sysPromptFileMissing) return;
|
|
192
262
|
if (!this.sysPromptDiffVisible) {
|
|
193
263
|
if (!this.hasSysPromptContentChanged()) {
|
|
194
264
|
this.showMessage(this.t('toast.noChanges'), 'info');
|
|
@@ -214,8 +284,7 @@ export function createSystemPromptMethods(options = {}) {
|
|
|
214
284
|
this.sysPromptSaving = true;
|
|
215
285
|
try {
|
|
216
286
|
const params = {
|
|
217
|
-
|
|
218
|
-
mode: this.sysPromptMode || 'append',
|
|
287
|
+
...this.sysPromptTargetParams(),
|
|
219
288
|
content: this.sysPromptContent,
|
|
220
289
|
baseHash: this.sysPromptHash
|
|
221
290
|
};
|
|
@@ -248,7 +317,7 @@ export function createSystemPromptMethods(options = {}) {
|
|
|
248
317
|
exportSysPromptContent() {
|
|
249
318
|
const content = typeof this.sysPromptContent === 'string' ? this.sysPromptContent : '';
|
|
250
319
|
if (!content) return;
|
|
251
|
-
const filename = (this.sysPromptMode === 'system' ? 'SYSTEM.md' : 'APPEND_SYSTEM.md');
|
|
320
|
+
const filename = this.sysPromptFileName || (this.sysPromptMode === 'system' ? 'SYSTEM.md' : 'APPEND_SYSTEM.md');
|
|
252
321
|
this.downloadTextFile(filename, content, 'text/markdown;charset=utf-8');
|
|
253
322
|
},
|
|
254
323
|
|
|
@@ -292,6 +361,7 @@ export function createSystemPromptMethods(options = {}) {
|
|
|
292
361
|
if (typeof this.sysHistoryBucket === 'string' && this.sysHistoryBucket) {
|
|
293
362
|
return this.sysHistoryBucket;
|
|
294
363
|
}
|
|
364
|
+
if (this.isSysPromptCustomFile()) return '';
|
|
295
365
|
const scope = this.sysPromptScope || 'global';
|
|
296
366
|
return 'system_' + scope + '_global';
|
|
297
367
|
},
|
|
@@ -299,6 +369,7 @@ export function createSystemPromptMethods(options = {}) {
|
|
|
299
369
|
async openSysHistory() {
|
|
300
370
|
if (this.sysHistoryLoading) return;
|
|
301
371
|
const bucket = this.resolveSysHistoryBucket();
|
|
372
|
+
if (!bucket || this.sysPromptFileMissing) return;
|
|
302
373
|
this.sysHistoryVisible = true;
|
|
303
374
|
this.sysHistoryError = '';
|
|
304
375
|
await this.loadSysHistory(bucket);
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
const THEME_STORAGE_CACHE_KEY = 'codexmateThemeCache';
|
|
2
|
+
const NON_DEFAULT_THEMES = ['dark', 'ocean', 'violet'];
|
|
2
3
|
|
|
3
4
|
export function createThemeMethods() {
|
|
4
5
|
return {
|
|
5
6
|
normalizeTheme(value) {
|
|
6
7
|
const normalized = typeof value === 'string' ? value.trim().toLowerCase() : '';
|
|
7
|
-
return normalized
|
|
8
|
+
return NON_DEFAULT_THEMES.includes(normalized) ? normalized : 'light';
|
|
8
9
|
},
|
|
9
10
|
applyDocumentTheme() {
|
|
10
11
|
try {
|
|
11
12
|
if (typeof document === 'undefined' || !document.documentElement) return;
|
|
12
13
|
const next = this.normalizeTheme(this.theme);
|
|
13
|
-
if (next
|
|
14
|
+
if (NON_DEFAULT_THEMES.includes(next)) {
|
|
14
15
|
document.documentElement.setAttribute('data-theme', next);
|
|
15
16
|
} else {
|
|
16
17
|
document.documentElement.removeAttribute('data-theme');
|
|
@@ -20,7 +21,7 @@ export function createThemeMethods() {
|
|
|
20
21
|
// the server-side webUi preference store.
|
|
21
22
|
const storage = typeof globalThis !== 'undefined' ? globalThis.localStorage : null;
|
|
22
23
|
if (storage && typeof storage.setItem === 'function' && typeof storage.removeItem === 'function') {
|
|
23
|
-
if (next
|
|
24
|
+
if (NON_DEFAULT_THEMES.includes(next)) storage.setItem(THEME_STORAGE_CACHE_KEY, next);
|
|
24
25
|
else storage.removeItem(THEME_STORAGE_CACHE_KEY);
|
|
25
26
|
}
|
|
26
27
|
} catch (_) {}
|
|
@@ -108,6 +108,8 @@ function normalizeNavigationSnapshot(vm, source = {}) {
|
|
|
108
108
|
return {
|
|
109
109
|
mainTab: typeof source.mainTab === 'string' ? source.mainTab : vm.mainTab,
|
|
110
110
|
configMode: typeof source.configMode === 'string' ? source.configMode : vm.configMode,
|
|
111
|
+
modelTestTarget: source.modelTestTarget === 'pi' || source.modelTestTarget === 'codex'
|
|
112
|
+
? source.modelTestTarget : vm.modelTestTarget === 'pi' ? 'pi' : 'codex',
|
|
111
113
|
settingsTab: typeof source.settingsTab === 'string' ? source.settingsTab : vm.settingsTab,
|
|
112
114
|
skillsTargetApp: source.skillsTargetApp === 'claude' || source.skillsTargetApp === 'codex' || source.skillsTargetApp === 'pi'
|
|
113
115
|
? source.skillsTargetApp
|
|
@@ -481,6 +483,11 @@ export function createWebUiPreferencesMethods(options = {}) {
|
|
|
481
483
|
if (Array.isArray(source.deletedClaudeSettingsImports)) {
|
|
482
484
|
this.deletedClaudeSettingsImports = source.deletedClaudeSettingsImports;
|
|
483
485
|
}
|
|
486
|
+
const modelTestTarget = source.navigation && source.navigation.modelTestTarget;
|
|
487
|
+
if (modelTestTarget === 'codex' || modelTestTarget === 'pi') {
|
|
488
|
+
if (typeof this.setModelTestTarget === 'function') this.setModelTestTarget(modelTestTarget);
|
|
489
|
+
else this.modelTestTarget = modelTestTarget;
|
|
490
|
+
}
|
|
484
491
|
if (shouldApplyNavigation && source.navigation && typeof source.navigation === 'object') {
|
|
485
492
|
const nav = source.navigation;
|
|
486
493
|
if (typeof nav.settingsTab === 'string' && typeof this.normalizeSettingsTab === 'function') {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Keep this contract aligned with CONFIG_CHANGE_ACTIONS in cli.js.
|
|
2
|
+
export const CONFIG_CHANGE_ACTIONS = Object.freeze({
|
|
3
|
+
'apply-config-template': 'codex', 'add-provider': 'codex', 'update-provider': 'codex',
|
|
4
|
+
'delete-provider': 'codex', 'reset-config': 'codex', 'add-model': 'codex', 'delete-model': 'codex',
|
|
5
|
+
'apply-claude-settings-raw': 'claude', 'apply-claude-config': 'claude',
|
|
6
|
+
'apply-opencode-config': 'opencode', 'update-opencode-selection': 'opencode',
|
|
7
|
+
'apply-kilocode-config': 'kilocode', 'apply-openclaw-config': 'openclaw',
|
|
8
|
+
'write-pi-models': 'pi', 'write-pi-settings': 'pi', 'apply-pi-config-history': 'pi'
|
|
9
|
+
});
|