codexmate 0.1.28 → 0.1.30
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 +53 -44
- package/README.vi.md +45 -36
- package/README.zh.md +51 -42
- package/cli/session-usage.js +2 -2
- package/cli/skills.js +33 -8
- package/cli.js +379 -19
- package/package.json +6 -1
- package/web-ui/app.js +12 -1
- package/web-ui/index.html +3 -2
- package/web-ui/logic.sessions.mjs +30 -4
- package/web-ui/modules/app.computed.dashboard.mjs +1 -1
- package/web-ui/modules/app.computed.session.mjs +52 -33
- package/web-ui/modules/app.methods.agents.mjs +36 -0
- package/web-ui/modules/app.methods.codex-config.mjs +3 -1
- package/web-ui/modules/app.methods.providers.mjs +12 -4
- package/web-ui/modules/app.methods.session-actions.mjs +10 -8
- package/web-ui/modules/app.methods.session-browser.mjs +8 -2
- package/web-ui/modules/app.methods.session-trash.mjs +16 -16
- package/web-ui/modules/app.methods.system-prompt.mjs +1 -8
- package/web-ui/modules/app.methods.theme.mjs +5 -4
- package/web-ui/modules/i18n/locales/en.mjs +80 -1
- package/web-ui/modules/i18n/locales/ja.mjs +80 -1
- package/web-ui/modules/i18n/locales/vi.mjs +80 -1
- package/web-ui/modules/i18n/locales/zh-tw.mjs +80 -1
- package/web-ui/modules/i18n/locales/zh.mjs +80 -1
- package/web-ui/modules/i18n.mjs +23 -0
- package/web-ui/modules/skills.computed.mjs +11 -0
- package/web-ui/modules/skills.methods.mjs +58 -8
- package/web-ui/partials/index/layout-footer.html +1 -1
- package/web-ui/partials/index/layout-header.html +32 -12
- package/web-ui/partials/index/modal-config-template-agents.html +1 -1
- package/web-ui/partials/index/modal-health-check.html +1 -1
- package/web-ui/partials/index/modal-openclaw-config.html +50 -50
- package/web-ui/partials/index/panel-dashboard.html +1 -1
- package/web-ui/partials/index/panel-market.html +23 -5
- package/web-ui/partials/index/panel-prompts.html +2 -2
- package/web-ui/partials/index/panel-sessions.html +52 -42
- package/web-ui/partials/index/panel-settings.html +6 -0
- package/web-ui/partials/index/panel-trash.html +3 -0
- package/web-ui/res/web-ui-render.precompiled.js +567 -439
- package/web-ui/session-helpers.mjs +3 -0
- package/web-ui/styles/base-theme.css +2 -2
- package/web-ui/styles/bridge-pool.css +1 -1
- package/web-ui/styles/feedback.css +26 -0
- package/web-ui/styles/layout-shell.css +66 -3
- package/web-ui/styles/navigation-panels.css +4 -10
- package/web-ui/styles/sessions-list.css +19 -1
- package/web-ui/styles/sessions-preview.css +88 -1
- package/web-ui/styles/sessions-toolbar-trash.css +2 -2
- package/web-ui/styles/settings-panel.css +1 -1
- package/web-ui/styles/skills-market.css +47 -0
- package/web-ui/styles/theme-dark-tokens.css +2 -2
- package/web-ui/styles/theme-dark.css +2 -2
- package/web-ui/styles/theme-ocean-tokens.css +88 -0
- package/web-ui/styles/theme-ocean.css +920 -0
- package/web-ui/styles/titles-cards.css +1 -1
- package/web-ui/styles/trash-panel.css +43 -6
- package/web-ui/styles.css +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexmate",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"description": "Codex/Claude Code/OpenClaw 配置、会话与任务编排 CLI + Web 工具",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -41,6 +41,9 @@
|
|
|
41
41
|
"test:ci": "node tools/ci/run-check.js all",
|
|
42
42
|
"test:unit": "node tests/unit/run.mjs",
|
|
43
43
|
"test:e2e": "node tests/e2e/run.js",
|
|
44
|
+
"test:e2e:browser": "e2e run",
|
|
45
|
+
"test:e2e:browser:install": "e2e-web install chromium --with-deps",
|
|
46
|
+
"test:e2e:browser:list": "e2e list",
|
|
44
47
|
"setup:git": "git remote set-url origin https://github.com/SakuraByteCore/codexmate.git && gh auth setup-git",
|
|
45
48
|
"reset:dev": "node tools/dev/reset-and-dev.js",
|
|
46
49
|
"pretest": "node tools/ci/ensure-test-deps.js"
|
|
@@ -72,7 +75,9 @@
|
|
|
72
75
|
"author": "ymkiux",
|
|
73
76
|
"license": "Apache-2.0",
|
|
74
77
|
"devDependencies": {
|
|
78
|
+
"@e2e-dev/web": "0.15.4",
|
|
75
79
|
"@vue/compiler-dom": "^3.5.34",
|
|
80
|
+
"e2e": "0.22.0",
|
|
76
81
|
"opencc-js": "^1.3.1",
|
|
77
82
|
"vitepress": "^1.6.4"
|
|
78
83
|
}
|
package/web-ui/app.js
CHANGED
|
@@ -60,8 +60,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
60
60
|
data() {
|
|
61
61
|
return {
|
|
62
62
|
lang: 'zh',
|
|
63
|
+
languageMenuOpen: false,
|
|
63
64
|
appVersion: '',
|
|
64
65
|
mainTab: 'dashboard',
|
|
66
|
+
navigationReady: false,
|
|
65
67
|
configMode: 'codex',
|
|
66
68
|
currentProvider: '',
|
|
67
69
|
currentModel: '',
|
|
@@ -264,6 +266,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
264
266
|
skillsRootPath: '',
|
|
265
267
|
skillsList: [],
|
|
266
268
|
skillsSelectedNames: [],
|
|
269
|
+
skillsMarketSelectedNames: [],
|
|
267
270
|
skillsLoading: false,
|
|
268
271
|
skillsDeleting: false,
|
|
269
272
|
skillsKeyword: '',
|
|
@@ -274,6 +277,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
274
277
|
skillsImporting: false,
|
|
275
278
|
skillsZipImporting: false,
|
|
276
279
|
skillsExporting: false,
|
|
280
|
+
skillsBackingUp: false,
|
|
277
281
|
skillsMarketLoading: false,
|
|
278
282
|
skillsMarketLocalLoadedOnce: false,
|
|
279
283
|
skillsMarketImportLoadedOnce: false,
|
|
@@ -333,6 +337,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
333
337
|
opencode: 0
|
|
334
338
|
},
|
|
335
339
|
sessionExporting: {},
|
|
340
|
+
sessionExportNotice: null,
|
|
341
|
+
sessionSearchInfo: null,
|
|
336
342
|
sessionConverting: {},
|
|
337
343
|
sessionImportingNative: {},
|
|
338
344
|
sessionCloning: {},
|
|
@@ -621,11 +627,16 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
621
627
|
return true;
|
|
622
628
|
}
|
|
623
629
|
})();
|
|
624
|
-
this.loadWebUiPreferences({ applyNavigation: applyPreferenceNavigation })
|
|
630
|
+
const preferencesReady = this.loadWebUiPreferences({ applyNavigation: applyPreferenceNavigation });
|
|
631
|
+
preferencesReady.then(() => {
|
|
625
632
|
if (this.mainTab === 'prompts' && typeof this.loadPromptsTabContent === 'function') {
|
|
626
633
|
this.loadPromptsTabContent();
|
|
627
634
|
}
|
|
635
|
+
}).finally(() => {
|
|
636
|
+
this.navigationReady = true;
|
|
628
637
|
});
|
|
638
|
+
} else {
|
|
639
|
+
this.navigationReady = true;
|
|
629
640
|
}
|
|
630
641
|
if (typeof this.t === 'function') {
|
|
631
642
|
this.confirmDialogConfirmText = this.t('confirm.ok');
|
package/web-ui/index.html
CHANGED
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
// server preference store loads. Kept in sync by applyDocumentTheme().
|
|
17
17
|
(function () {
|
|
18
18
|
try {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
var cachedTheme = localStorage.getItem('codexmateThemeCache');
|
|
20
|
+
if (cachedTheme === 'dark' || cachedTheme === 'ocean') {
|
|
21
|
+
document.documentElement.setAttribute('data-theme', cachedTheme);
|
|
21
22
|
}
|
|
22
23
|
} catch (_) {}
|
|
23
24
|
})();
|
|
@@ -1,6 +1,31 @@
|
|
|
1
|
+
export const DEFAULT_SESSION_CONTENT_SCAN_LIMIT = 50;
|
|
1
2
|
export const DEFAULT_SESSION_LIST_LIMIT = 200;
|
|
2
3
|
export const DEFAULT_SESSION_LIST_FAST_LIMIT = 20;
|
|
3
4
|
|
|
5
|
+
|
|
6
|
+
function decodeSessionTitleValue(value) {
|
|
7
|
+
return String(value || '')
|
|
8
|
+
.replace(/\x26quot;/gi, '"')
|
|
9
|
+
.replace(/\x26apos;/gi, "'")
|
|
10
|
+
.replace(/\x26lt;/gi, '<')
|
|
11
|
+
.replace(/\x26gt;/gi, '>')
|
|
12
|
+
.replace(/\x26amp;/gi, '&')
|
|
13
|
+
.trim();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function parseSessionTitleInfo(session = {}) {
|
|
17
|
+
const rawTitle = typeof session.title === 'string' ? session.title.trim() : '';
|
|
18
|
+
const skillTag = rawTitle.match(/<skill\b([^>]*)>/i);
|
|
19
|
+
const attributes = {};
|
|
20
|
+
const attributePattern = /([\w:-]+)\s*=\s*(["'])(.*?)\2/g;
|
|
21
|
+
let match;
|
|
22
|
+
while ((match = attributePattern.exec(skillTag ? skillTag[1] : '')) !== null) {
|
|
23
|
+
attributes[match[1].toLowerCase()] = decodeSessionTitleValue(match[3]);
|
|
24
|
+
}
|
|
25
|
+
const title = attributes.name || (skillTag ? '' : rawTitle) || session.sessionId || '';
|
|
26
|
+
const location = attributes.location || (typeof session.cwd === 'string' ? session.cwd.trim() : '');
|
|
27
|
+
return { title, location };
|
|
28
|
+
}
|
|
4
29
|
function shouldUseFastSessionBrowseLimit(options = {}) {
|
|
5
30
|
if (options.forceRefresh) {
|
|
6
31
|
return false;
|
|
@@ -29,14 +54,14 @@ function shouldUseFastSessionBrowseLimit(options = {}) {
|
|
|
29
54
|
|
|
30
55
|
export function isSessionQueryEnabled(source) {
|
|
31
56
|
const normalized = normalizeSessionSource(source, '');
|
|
32
|
-
return normalized === 'codex' || normalized === 'claude' || normalized === 'gemini' || normalized === 'codebuddy' || normalized === 'workbuddy' || normalized === 'pi' || normalized === 'opencode' || normalized === 'all';
|
|
57
|
+
return normalized === 'codex' || normalized === 'claude' || normalized === 'gemini' || normalized === 'codebuddy' || normalized === 'workbuddy' || normalized === 'pi' || normalized === 'opencode' || normalized === 'zed' || normalized === 'all';
|
|
33
58
|
}
|
|
34
59
|
|
|
35
60
|
export function normalizeSessionSource(source, fallback = 'all') {
|
|
36
61
|
const normalized = typeof source === 'string'
|
|
37
62
|
? source.trim().toLowerCase()
|
|
38
63
|
: '';
|
|
39
|
-
if (normalized === 'codex' || normalized === 'claude' || normalized === 'gemini' || normalized === 'codebuddy' || normalized === 'workbuddy' || normalized === 'pi' || normalized === 'opencode' || normalized === 'all') {
|
|
64
|
+
if (normalized === 'codex' || normalized === 'claude' || normalized === 'gemini' || normalized === 'codebuddy' || normalized === 'workbuddy' || normalized === 'pi' || normalized === 'opencode' || normalized === 'zed' || normalized === 'all') {
|
|
40
65
|
return normalized;
|
|
41
66
|
}
|
|
42
67
|
return fallback;
|
|
@@ -64,10 +89,11 @@ function getSessionSourceLabel(source) {
|
|
|
64
89
|
if (source === 'workbuddy') return 'WorkBuddy AI';
|
|
65
90
|
if (source === 'pi') return 'Pi';
|
|
66
91
|
if (source === 'opencode') return 'OpenCode';
|
|
92
|
+
if (source === 'zed') return 'Zed';
|
|
67
93
|
return 'Codex';
|
|
68
94
|
}
|
|
69
95
|
|
|
70
|
-
const SESSION_USAGE_SOURCE_ORDER = ['codex', 'claude', 'gemini', 'codebuddy', 'workbuddy', 'pi', 'opencode'];
|
|
96
|
+
const SESSION_USAGE_SOURCE_ORDER = ['codex', 'claude', 'gemini', 'codebuddy', 'workbuddy', 'pi', 'opencode', 'zed'];
|
|
71
97
|
|
|
72
98
|
function collectSessionModelNames(session) {
|
|
73
99
|
if (!session || typeof session !== 'object') {
|
|
@@ -154,7 +180,7 @@ export function buildSessionListParams(options = {}) {
|
|
|
154
180
|
query: queryValue,
|
|
155
181
|
queryMode: 'and',
|
|
156
182
|
queryScope: 'content',
|
|
157
|
-
contentScanLimit:
|
|
183
|
+
contentScanLimit: DEFAULT_SESSION_CONTENT_SCAN_LIMIT,
|
|
158
184
|
roleFilter,
|
|
159
185
|
timeRangePreset,
|
|
160
186
|
limit,
|
|
@@ -184,7 +184,7 @@ export function createDashboardComputed() {
|
|
|
184
184
|
if (this.codexModelsLoading || this.claudeModelsLoading) tasks.push(this.t('dashboard.busy.models'));
|
|
185
185
|
if (this.codexApplying || this.configTemplateApplying || this.openclawApplying) tasks.push(this.t('dashboard.busy.configApply'));
|
|
186
186
|
if (this.agentsSaving) tasks.push(this.t('dashboard.busy.agents'));
|
|
187
|
-
if (this.skillsLoading || this.skillsDeleting || this.skillsScanningImports || this.skillsImporting || this.skillsZipImporting || this.skillsExporting) tasks.push(this.t('dashboard.busy.skills'));
|
|
187
|
+
if (this.skillsLoading || this.skillsDeleting || this.skillsScanningImports || this.skillsImporting || this.skillsZipImporting || this.skillsExporting || this.skillsBackingUp) tasks.push(this.t('dashboard.busy.skills'));
|
|
188
188
|
return tasks.length ? tasks.join(' / ') : this.t('dashboard.busy.idle');
|
|
189
189
|
},
|
|
190
190
|
inspectorMessageSummary() {
|
|
@@ -250,48 +250,65 @@ export function buildSessionWorkspaceSummary(session, messages, options = {}) {
|
|
|
250
250
|
return summary;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
const DURATION_UNIT_TABLES = {
|
|
254
|
+
en: {
|
|
255
|
+
zero: '0m',
|
|
256
|
+
underOne: '<1m',
|
|
257
|
+
spaced: true,
|
|
258
|
+
spaceCompact: false,
|
|
259
|
+
compact: [['d', 1440], ['h', 60], ['m', 1]],
|
|
260
|
+
long: [['day', 1440], ['hr', 60], ['min', 1]]
|
|
261
|
+
},
|
|
262
|
+
ja: {
|
|
263
|
+
zero: '0分',
|
|
264
|
+
underOne: '<1分',
|
|
265
|
+
spaced: false,
|
|
266
|
+
spaceCompact: false,
|
|
267
|
+
compact: [['日', 1440], ['時間', 60], ['分', 1]],
|
|
268
|
+
long: [['日', 1440], ['時間', 60], ['分', 1]]
|
|
269
|
+
},
|
|
270
|
+
vi: {
|
|
271
|
+
zero: '0 phút',
|
|
272
|
+
underOne: '<1 phút',
|
|
273
|
+
spaced: true,
|
|
274
|
+
spaceCompact: true,
|
|
275
|
+
compact: [['ngày', 1440], ['giờ', 60], ['phút', 1]],
|
|
276
|
+
long: [['ngày', 1440], ['giờ', 60], ['phút', 1]]
|
|
277
|
+
},
|
|
278
|
+
zh: {
|
|
279
|
+
zero: '0分',
|
|
280
|
+
underOne: '<1分',
|
|
281
|
+
spaced: false,
|
|
282
|
+
spaceCompact: false,
|
|
283
|
+
compact: [['天', 1440], ['时', 60], ['分', 1]],
|
|
284
|
+
long: [['天', 1440], ['小时', 60], ['分', 1]]
|
|
285
|
+
},
|
|
286
|
+
'zh-tw': {
|
|
287
|
+
zero: '0分',
|
|
288
|
+
underOne: '<1分',
|
|
289
|
+
spaced: false,
|
|
290
|
+
spaceCompact: false,
|
|
291
|
+
compact: [['天', 1440], ['時', 60], ['分', 1]],
|
|
292
|
+
long: [['天', 1440], ['小時', 60], ['分', 1]]
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
253
296
|
function formatUsageDuration(value, options = {}) {
|
|
254
297
|
const normalizedLang = typeof options.lang === 'string' ? options.lang.trim().toLowerCase() : '';
|
|
255
|
-
const
|
|
298
|
+
const unitSet = DURATION_UNIT_TABLES[normalizedLang] || DURATION_UNIT_TABLES.zh;
|
|
256
299
|
const numeric = Number(value);
|
|
257
300
|
if (!Number.isFinite(numeric) || numeric <= 0) {
|
|
258
|
-
return
|
|
301
|
+
return unitSet.zero;
|
|
259
302
|
}
|
|
260
303
|
const totalMinutes = Math.floor(numeric / 60000);
|
|
261
304
|
if (totalMinutes <= 0) {
|
|
262
|
-
return
|
|
305
|
+
return unitSet.underOne;
|
|
263
306
|
}
|
|
264
307
|
const maxParts = Number.isFinite(Number(options.maxParts))
|
|
265
308
|
? Math.max(1, Math.floor(Number(options.maxParts)))
|
|
266
309
|
: 2;
|
|
267
310
|
const compact = options.compact !== false;
|
|
268
|
-
const units = compact
|
|
269
|
-
? (
|
|
270
|
-
isEn
|
|
271
|
-
? [
|
|
272
|
-
{ label: 'd', value: 24 * 60 },
|
|
273
|
-
{ label: 'h', value: 60 },
|
|
274
|
-
{ label: 'm', value: 1 }
|
|
275
|
-
]
|
|
276
|
-
: [
|
|
277
|
-
{ label: '天', value: 24 * 60 },
|
|
278
|
-
{ label: '时', value: 60 },
|
|
279
|
-
{ label: '分', value: 1 }
|
|
280
|
-
]
|
|
281
|
-
)
|
|
282
|
-
: (
|
|
283
|
-
isEn
|
|
284
|
-
? [
|
|
285
|
-
{ label: 'day', value: 24 * 60 },
|
|
286
|
-
{ label: 'hr', value: 60 },
|
|
287
|
-
{ label: 'min', value: 1 }
|
|
288
|
-
]
|
|
289
|
-
: [
|
|
290
|
-
{ label: '天', value: 24 * 60 },
|
|
291
|
-
{ label: '小时', value: 60 },
|
|
292
|
-
{ label: '分', value: 1 }
|
|
293
|
-
]
|
|
294
|
-
);
|
|
311
|
+
const units = (compact ? unitSet.compact : unitSet.long).map(([label, minutes]) => ({ label, value: minutes }));
|
|
295
312
|
let remainingMinutes = totalMinutes;
|
|
296
313
|
const parts = [];
|
|
297
314
|
for (const unit of units) {
|
|
@@ -302,13 +319,14 @@ function formatUsageDuration(value, options = {}) {
|
|
|
302
319
|
if (count <= 0) {
|
|
303
320
|
continue;
|
|
304
321
|
}
|
|
305
|
-
parts.push(compact ?
|
|
322
|
+
parts.push((compact ? unitSet.spaceCompact : unitSet.spaced) ? `${count} ${unit.label}` : `${count}${unit.label}`);
|
|
306
323
|
remainingMinutes -= count * unit.value;
|
|
307
324
|
if (parts.length >= maxParts) {
|
|
308
325
|
break;
|
|
309
326
|
}
|
|
310
327
|
}
|
|
311
|
-
|
|
328
|
+
const separator = compact ? (unitSet.spaceCompact ? ' ' : '') : ' ';
|
|
329
|
+
return parts.length ? parts.join(separator) : unitSet.zero;
|
|
312
330
|
}
|
|
313
331
|
|
|
314
332
|
export function createSessionComputed() {
|
|
@@ -325,7 +343,8 @@ export function createSessionComputed() {
|
|
|
325
343
|
{ value: "codebuddy", label: this.t("sessions.source.codebuddy") },
|
|
326
344
|
{ value: "workbuddy", label: this.t("sessions.source.workbuddy") },
|
|
327
345
|
{ value: "pi", label: this.t("sessions.source.pi") },
|
|
328
|
-
{ value: "opencode", label: this.t("sessions.source.opencode") }
|
|
346
|
+
{ value: "opencode", label: this.t("sessions.source.opencode") },
|
|
347
|
+
{ value: "zed", label: this.t("sessions.source.zed") }
|
|
329
348
|
];
|
|
330
349
|
},
|
|
331
350
|
activeSessionExportKey() {
|
|
@@ -252,6 +252,38 @@ export function createAgentsMethods(options = {}) {
|
|
|
252
252
|
this.agentsDiffFingerprint = '';
|
|
253
253
|
this._agentsDiffPreviewRequestToken = null;
|
|
254
254
|
},
|
|
255
|
+
trapModalFocus(event) {
|
|
256
|
+
const overlays = typeof document !== 'undefined' && typeof document.querySelectorAll === 'function'
|
|
257
|
+
? Array.from(document.querySelectorAll('.modal-overlay'))
|
|
258
|
+
: [];
|
|
259
|
+
if (!overlays.length) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const modal = overlays[overlays.length - 1];
|
|
263
|
+
const focusableSelector = 'button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';
|
|
264
|
+
const focusables = Array.from(modal.querySelectorAll(focusableSelector))
|
|
265
|
+
.filter((el) => el.offsetParent !== null || el === document.activeElement);
|
|
266
|
+
if (!focusables.length) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const first = focusables[0];
|
|
270
|
+
const last = focusables[focusables.length - 1];
|
|
271
|
+
const active = document.activeElement;
|
|
272
|
+
if (!modal.contains(active)) {
|
|
273
|
+
event.preventDefault();
|
|
274
|
+
first.focus();
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (event.shiftKey && active === first) {
|
|
278
|
+
event.preventDefault();
|
|
279
|
+
last.focus();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (!event.shiftKey && active === last) {
|
|
283
|
+
event.preventDefault();
|
|
284
|
+
first.focus();
|
|
285
|
+
}
|
|
286
|
+
},
|
|
255
287
|
handleGlobalKeydown(event) {
|
|
256
288
|
if (!event) {
|
|
257
289
|
return;
|
|
@@ -293,6 +325,10 @@ export function createAgentsMethods(options = {}) {
|
|
|
293
325
|
}
|
|
294
326
|
return;
|
|
295
327
|
}
|
|
328
|
+
if (key === 'Tab') {
|
|
329
|
+
this.trapModalFocus(event);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
296
332
|
if (key !== 'Escape') {
|
|
297
333
|
return;
|
|
298
334
|
}
|
|
@@ -75,7 +75,8 @@ export function createCodexConfigMethods(options = {}) {
|
|
|
75
75
|
const res = await api('export-session', {
|
|
76
76
|
source: session.source,
|
|
77
77
|
sessionId: session.sessionId,
|
|
78
|
-
filePath: session.filePath
|
|
78
|
+
filePath: session.filePath,
|
|
79
|
+
maxMessages: 'all'
|
|
79
80
|
});
|
|
80
81
|
if (res.error) {
|
|
81
82
|
this.showMessage(res.error, 'error');
|
|
@@ -84,6 +85,7 @@ export function createCodexConfigMethods(options = {}) {
|
|
|
84
85
|
|
|
85
86
|
const fileName = res.fileName || `${session.source || 'session'}-${session.sessionId || Date.now()}.md`;
|
|
86
87
|
this.downloadTextFile(fileName, res.content || '');
|
|
88
|
+
this.sessionExportNotice = res.truncated ? { key } : null;
|
|
87
89
|
if (res.truncated) {
|
|
88
90
|
const maxLabel = res.maxMessages === 'all' ? 'all' : res.maxMessages;
|
|
89
91
|
this.showMessage(`会话导出完成(已截断:最多 ${maxLabel} 条消息)`, 'info');
|
|
@@ -479,6 +479,14 @@ export function createProvidersMethods(options = {}) {
|
|
|
479
479
|
|
|
480
480
|
async resetConfig() {
|
|
481
481
|
if (this.resetConfigLoading) return;
|
|
482
|
+
const confirmed = await this.requestConfirmDialog({
|
|
483
|
+
title: this.t('settings.reset.confirmTitle'),
|
|
484
|
+
message: this.t('settings.reset.confirmMessage'),
|
|
485
|
+
confirmText: this.t('settings.reset.button'),
|
|
486
|
+
cancelText: this.t('confirm.cancel'),
|
|
487
|
+
danger: true
|
|
488
|
+
});
|
|
489
|
+
if (!confirmed) return;
|
|
482
490
|
this.resetConfigLoading = true;
|
|
483
491
|
try {
|
|
484
492
|
const res = await api('reset-config');
|
|
@@ -486,7 +494,7 @@ export function createProvidersMethods(options = {}) {
|
|
|
486
494
|
this.showMessage(res.error, 'error');
|
|
487
495
|
return;
|
|
488
496
|
}
|
|
489
|
-
const backup = res.backupFile ?
|
|
497
|
+
const backup = res.backupFile ? this.t('toast.provider.resetBackup', { file: res.backupFile }) : '';
|
|
490
498
|
this.showMessage(this.t('toast.provider.resetSuccess', { backup }), 'success');
|
|
491
499
|
await this.loadAll();
|
|
492
500
|
} catch (e) {
|
|
@@ -498,7 +506,7 @@ export function createProvidersMethods(options = {}) {
|
|
|
498
506
|
|
|
499
507
|
async addModel() {
|
|
500
508
|
if (!this.newModelName || !this.newModelName.trim()) {
|
|
501
|
-
return this.showMessage('
|
|
509
|
+
return this.showMessage(this.t('toast.provider.modelRequired'), 'error');
|
|
502
510
|
}
|
|
503
511
|
try {
|
|
504
512
|
const modelName = this.newModelName.trim();
|
|
@@ -523,7 +531,7 @@ export function createProvidersMethods(options = {}) {
|
|
|
523
531
|
this.closeModelModal();
|
|
524
532
|
}
|
|
525
533
|
} catch (_) {
|
|
526
|
-
this.showMessage('
|
|
534
|
+
this.showMessage(this.t('toast.provider.addModelFail'), 'error');
|
|
527
535
|
}
|
|
528
536
|
},
|
|
529
537
|
|
|
@@ -546,7 +554,7 @@ export function createProvidersMethods(options = {}) {
|
|
|
546
554
|
this.showMessage(this.t('toast.operation.success'), 'success');
|
|
547
555
|
}
|
|
548
556
|
} catch (_) {
|
|
549
|
-
this.showMessage('
|
|
557
|
+
this.showMessage(this.t('toast.provider.deleteModelFail'), 'error');
|
|
550
558
|
}
|
|
551
559
|
},
|
|
552
560
|
|
|
@@ -28,8 +28,8 @@ export function createSessionActionMethods(options = {}) {
|
|
|
28
28
|
let error = '';
|
|
29
29
|
if (!source) {
|
|
30
30
|
error = '缺少 source 参数';
|
|
31
|
-
} else if (source !== 'codex' && source !== 'claude' && source !== 'gemini' && source !== 'codebuddy' && source !== 'workbuddy' && source !== 'pi' && source !== 'opencode') {
|
|
32
|
-
error = 'source 仅支持 codex、claude、gemini、codebuddy、workbuddy、pi 或
|
|
31
|
+
} else if (source !== 'codex' && source !== 'claude' && source !== 'gemini' && source !== 'codebuddy' && source !== 'workbuddy' && source !== 'pi' && source !== 'opencode' && source !== 'zed') {
|
|
32
|
+
error = 'source 仅支持 codex、claude、gemini、codebuddy、workbuddy、pi、opencode 或 zed';
|
|
33
33
|
}
|
|
34
34
|
if (!sessionId && !filePath) {
|
|
35
35
|
error = error ? `${error},还缺少 sessionId 或 filePath` : '缺少 sessionId 或 filePath 参数';
|
|
@@ -77,11 +77,13 @@ export function createSessionActionMethods(options = {}) {
|
|
|
77
77
|
? 'Pi'
|
|
78
78
|
: (context.params.source === 'opencode'
|
|
79
79
|
? 'OpenCode'
|
|
80
|
-
: (context.params.source === '
|
|
81
|
-
? '
|
|
82
|
-
: (context.params.source === '
|
|
83
|
-
? '
|
|
84
|
-
: context.params.source
|
|
80
|
+
: (context.params.source === 'zed'
|
|
81
|
+
? 'Zed'
|
|
82
|
+
: (context.params.source === 'codebuddy'
|
|
83
|
+
? 'CodeBuddy Code'
|
|
84
|
+
: (context.params.source === 'workbuddy'
|
|
85
|
+
? 'WorkBuddy AI'
|
|
86
|
+
: context.params.source)))))))
|
|
85
87
|
this.activeSession = {
|
|
86
88
|
source: context.params.source,
|
|
87
89
|
sourceLabel,
|
|
@@ -110,7 +112,7 @@ export function createSessionActionMethods(options = {}) {
|
|
|
110
112
|
buildSessionStandaloneUrl(session) {
|
|
111
113
|
if (!session) return '';
|
|
112
114
|
const source = typeof session.source === 'string' ? session.source.trim().toLowerCase() : '';
|
|
113
|
-
if (!source || (source !== 'codex' && source !== 'claude' && source !== 'gemini' && source !== 'codebuddy' && source !== 'workbuddy' && source !== 'pi' && source !== 'opencode')) return '';
|
|
115
|
+
if (!source || (source !== 'codex' && source !== 'claude' && source !== 'gemini' && source !== 'codebuddy' && source !== 'workbuddy' && source !== 'pi' && source !== 'opencode' && source !== 'zed')) return '';
|
|
114
116
|
const sessionId = typeof session.sessionId === 'string' ? session.sessionId.trim() : '';
|
|
115
117
|
const filePath = typeof session.filePath === 'string' ? session.filePath.trim() : '';
|
|
116
118
|
if (!sessionId && !filePath) return '';
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
isSessionQueryEnabled,
|
|
4
4
|
normalizeSessionMessageRole,
|
|
5
5
|
normalizeSessionPathFilter,
|
|
6
|
-
normalizeSessionSource
|
|
6
|
+
normalizeSessionSource,
|
|
7
|
+
parseSessionTitleInfo
|
|
7
8
|
} from '../logic.mjs';
|
|
8
9
|
import {
|
|
9
10
|
applySessionsFilterUrlState,
|
|
@@ -78,6 +79,9 @@ export function createSessionBrowserMethods(options = {}) {
|
|
|
78
79
|
normalizeSessionPathValue(value) {
|
|
79
80
|
return normalizeSessionPathFilter(value);
|
|
80
81
|
},
|
|
82
|
+
parseSessionTitleInfo(session) {
|
|
83
|
+
return parseSessionTitleInfo(session);
|
|
84
|
+
},
|
|
81
85
|
|
|
82
86
|
mergeSessionPathOptions(baseList = [], incomingList = []) {
|
|
83
87
|
const merged = [];
|
|
@@ -524,7 +528,9 @@ export function createSessionBrowserMethods(options = {}) {
|
|
|
524
528
|
? this.t('sessions.source.pi')
|
|
525
529
|
: (this.sessionFilterSource === 'opencode'
|
|
526
530
|
? this.t('sessions.source.opencode')
|
|
527
|
-
: this.sessionFilterSource
|
|
531
|
+
: (this.sessionFilterSource === 'zed'
|
|
532
|
+
? this.t('sessions.source.zed')
|
|
533
|
+
: this.sessionFilterSource)))))));
|
|
528
534
|
chips.push({ key: 'source', title: this.t('sessions.filters.source'), value: label });
|
|
529
535
|
}
|
|
530
536
|
if (this.sessionPathFilter) {
|
|
@@ -292,7 +292,7 @@ export function createSessionTrashMethods(options = {}) {
|
|
|
292
292
|
this.sessionTrashCountLoadedOnce = true;
|
|
293
293
|
} catch (e) {
|
|
294
294
|
if (this.isLatestSessionTrashCountRequestToken(requestToken) && options.silent !== true) {
|
|
295
|
-
this.showMessage('
|
|
295
|
+
this.showMessage(this.t('settings.trash.loadCountFail'), 'error');
|
|
296
296
|
}
|
|
297
297
|
} finally {
|
|
298
298
|
this.sessionTrashCountLoading = false;
|
|
@@ -365,7 +365,7 @@ export function createSessionTrashMethods(options = {}) {
|
|
|
365
365
|
} catch (e) {
|
|
366
366
|
if (this.isLatestSessionTrashListRequestToken(requestToken)) {
|
|
367
367
|
this.sessionTrashLastLoadFailed = true;
|
|
368
|
-
this.showMessage('
|
|
368
|
+
this.showMessage(this.t('settings.trash.loadFail'), 'error');
|
|
369
369
|
}
|
|
370
370
|
} finally {
|
|
371
371
|
this.sessionTrashLoading = false;
|
|
@@ -392,7 +392,7 @@ export function createSessionTrashMethods(options = {}) {
|
|
|
392
392
|
this.showMessage(res.error, 'error');
|
|
393
393
|
return;
|
|
394
394
|
}
|
|
395
|
-
this.showMessage('
|
|
395
|
+
this.showMessage(this.t('settings.trash.restored'), 'success');
|
|
396
396
|
if (typeof this.invalidateSessionsUsageData === 'function') {
|
|
397
397
|
this.invalidateSessionsUsageData({ preserveList: true });
|
|
398
398
|
}
|
|
@@ -402,7 +402,7 @@ export function createSessionTrashMethods(options = {}) {
|
|
|
402
402
|
await this.loadSessions();
|
|
403
403
|
}
|
|
404
404
|
} catch (e) {
|
|
405
|
-
this.showMessage('
|
|
405
|
+
this.showMessage(this.t('settings.trash.restoreFail'), 'error');
|
|
406
406
|
} finally {
|
|
407
407
|
this.sessionTrashRestoring[key] = false;
|
|
408
408
|
}
|
|
@@ -414,10 +414,10 @@ export function createSessionTrashMethods(options = {}) {
|
|
|
414
414
|
return;
|
|
415
415
|
}
|
|
416
416
|
const confirmed = await this.requestConfirmDialog({
|
|
417
|
-
title: '
|
|
418
|
-
message: '
|
|
419
|
-
confirmText: '
|
|
420
|
-
cancelText: '
|
|
417
|
+
title: this.t('settings.trash.purgeConfirmTitle'),
|
|
418
|
+
message: this.t('settings.trash.purgeConfirmMessage'),
|
|
419
|
+
confirmText: this.t('settings.trash.purge'),
|
|
420
|
+
cancelText: this.t('confirm.cancel'),
|
|
421
421
|
danger: true
|
|
422
422
|
});
|
|
423
423
|
if (!confirmed) {
|
|
@@ -430,11 +430,11 @@ export function createSessionTrashMethods(options = {}) {
|
|
|
430
430
|
this.showMessage(res.error, 'error');
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
this.showMessage('
|
|
433
|
+
this.showMessage(this.t('settings.trash.purged'), 'success');
|
|
434
434
|
this.invalidateSessionTrashRequests();
|
|
435
435
|
await this.loadSessionTrash({ forceRefresh: true });
|
|
436
436
|
} catch (e) {
|
|
437
|
-
this.showMessage('
|
|
437
|
+
this.showMessage(this.t('settings.trash.purgeFail'), 'error');
|
|
438
438
|
} finally {
|
|
439
439
|
this.sessionTrashPurging[key] = false;
|
|
440
440
|
}
|
|
@@ -446,10 +446,10 @@ export function createSessionTrashMethods(options = {}) {
|
|
|
446
446
|
return;
|
|
447
447
|
}
|
|
448
448
|
const confirmed = await this.requestConfirmDialog({
|
|
449
|
-
title: '
|
|
450
|
-
message: '
|
|
451
|
-
confirmText: '
|
|
452
|
-
cancelText: '
|
|
449
|
+
title: this.t('settings.trash.clearConfirmTitle'),
|
|
450
|
+
message: this.t('settings.trash.clearConfirmMessage'),
|
|
451
|
+
confirmText: this.t('settings.trash.clearConfirmButton'),
|
|
452
|
+
cancelText: this.t('confirm.cancel'),
|
|
453
453
|
danger: true
|
|
454
454
|
});
|
|
455
455
|
if (!confirmed) {
|
|
@@ -462,11 +462,11 @@ export function createSessionTrashMethods(options = {}) {
|
|
|
462
462
|
this.showMessage(res.error, 'error');
|
|
463
463
|
return;
|
|
464
464
|
}
|
|
465
|
-
this.showMessage('
|
|
465
|
+
this.showMessage(this.t('settings.trash.cleared'), 'success');
|
|
466
466
|
this.invalidateSessionTrashRequests();
|
|
467
467
|
await this.loadSessionTrash({ forceRefresh: true });
|
|
468
468
|
} catch (e) {
|
|
469
|
-
this.showMessage('
|
|
469
|
+
this.showMessage(this.t('settings.trash.clearFail'), 'error');
|
|
470
470
|
} finally {
|
|
471
471
|
this.sessionTrashClearing = false;
|
|
472
472
|
}
|
|
@@ -248,14 +248,7 @@ export function createSystemPromptMethods(options = {}) {
|
|
|
248
248
|
const content = typeof this.sysPromptContent === 'string' ? this.sysPromptContent : '';
|
|
249
249
|
if (!content) return;
|
|
250
250
|
const filename = (this.sysPromptMode === 'system' ? 'SYSTEM.md' : 'APPEND_SYSTEM.md');
|
|
251
|
-
|
|
252
|
-
const a = document.createElement('a');
|
|
253
|
-
a.href = URL.createObjectURL(blob);
|
|
254
|
-
a.download = filename;
|
|
255
|
-
document.body.appendChild(a);
|
|
256
|
-
a.click();
|
|
257
|
-
a.remove();
|
|
258
|
-
URL.revokeObjectURL(a.href);
|
|
251
|
+
this.downloadTextFile(filename, content, 'text/markdown;charset=utf-8');
|
|
259
252
|
},
|
|
260
253
|
|
|
261
254
|
async pasteSysPromptContent() {
|
|
@@ -3,14 +3,15 @@ const THEME_STORAGE_CACHE_KEY = 'codexmateThemeCache';
|
|
|
3
3
|
export function createThemeMethods() {
|
|
4
4
|
return {
|
|
5
5
|
normalizeTheme(value) {
|
|
6
|
-
|
|
6
|
+
const normalized = typeof value === 'string' ? value.trim().toLowerCase() : '';
|
|
7
|
+
return normalized === 'dark' || normalized === 'ocean' ? normalized : 'light';
|
|
7
8
|
},
|
|
8
9
|
applyDocumentTheme() {
|
|
9
10
|
try {
|
|
10
11
|
if (typeof document === 'undefined' || !document.documentElement) return;
|
|
11
12
|
const next = this.normalizeTheme(this.theme);
|
|
12
|
-
if (next === 'dark') {
|
|
13
|
-
document.documentElement.setAttribute('data-theme',
|
|
13
|
+
if (next === 'dark' || next === 'ocean') {
|
|
14
|
+
document.documentElement.setAttribute('data-theme', next);
|
|
14
15
|
} else {
|
|
15
16
|
document.documentElement.removeAttribute('data-theme');
|
|
16
17
|
}
|
|
@@ -19,7 +20,7 @@ export function createThemeMethods() {
|
|
|
19
20
|
// the server-side webUi preference store.
|
|
20
21
|
const storage = typeof globalThis !== 'undefined' ? globalThis.localStorage : null;
|
|
21
22
|
if (storage && typeof storage.setItem === 'function' && typeof storage.removeItem === 'function') {
|
|
22
|
-
if (next === 'dark') storage.setItem(THEME_STORAGE_CACHE_KEY,
|
|
23
|
+
if (next === 'dark' || next === 'ocean') storage.setItem(THEME_STORAGE_CACHE_KEY, next);
|
|
23
24
|
else storage.removeItem(THEME_STORAGE_CACHE_KEY);
|
|
24
25
|
}
|
|
25
26
|
} catch (_) {}
|