codexmate 0.0.38 → 0.0.40

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.
Files changed (43) hide show
  1. package/cli/builtin-proxy.js +626 -207
  2. package/cli/config-bootstrap.js +6 -1
  3. package/cli/openai-bridge.js +541 -210
  4. package/cli.js +189 -4
  5. package/package.json +1 -1
  6. package/plugins/prompt-templates/computed.mjs +61 -3
  7. package/plugins/prompt-templates/manifest.mjs +3 -0
  8. package/web-ui/app.js +14 -3
  9. package/web-ui/modules/app.computed.main-tabs.mjs +39 -30
  10. package/web-ui/modules/app.methods.claude-config.mjs +111 -9
  11. package/web-ui/modules/app.methods.index.mjs +2 -0
  12. package/web-ui/modules/app.methods.openclaw-editing.mjs +48 -0
  13. package/web-ui/modules/app.methods.openclaw-persist.mjs +13 -7
  14. package/web-ui/modules/app.methods.providers.mjs +36 -10
  15. package/web-ui/modules/app.methods.runtime.mjs +76 -1
  16. package/web-ui/modules/app.methods.startup-claude.mjs +7 -0
  17. package/web-ui/modules/app.methods.tool-config-permissions.mjs +87 -0
  18. package/web-ui/modules/config-mode.computed.mjs +3 -3
  19. package/web-ui/modules/i18n/locales/en.mjs +1140 -0
  20. package/web-ui/modules/i18n/locales/ja.mjs +1130 -0
  21. package/web-ui/modules/i18n/locales/vi.mjs +239 -0
  22. package/web-ui/modules/i18n/locales/zh.mjs +1143 -0
  23. package/web-ui/modules/i18n.dict.mjs +9 -3195
  24. package/web-ui/modules/i18n.mjs +65 -16
  25. package/web-ui/partials/index/layout-header.html +16 -46
  26. package/web-ui/partials/index/modal-openclaw-config.html +135 -71
  27. package/web-ui/partials/index/modal-webhook.html +8 -8
  28. package/web-ui/partials/index/modals-basic.html +56 -16
  29. package/web-ui/partials/index/panel-config-claude.html +51 -21
  30. package/web-ui/partials/index/panel-config-codex.html +34 -5
  31. package/web-ui/partials/index/panel-config-openclaw.html +70 -64
  32. package/web-ui/partials/index/panel-dashboard.html +62 -77
  33. package/web-ui/partials/index/panel-settings.html +28 -7
  34. package/web-ui/partials/index/panel-trash.html +14 -14
  35. package/web-ui/res/web-ui-render.precompiled.js +1783 -1386
  36. package/web-ui/styles/controls-forms.css +99 -0
  37. package/web-ui/styles/dashboard.css +46 -14
  38. package/web-ui/styles/layout-shell.css +45 -0
  39. package/web-ui/styles/navigation-panels.css +3 -3
  40. package/web-ui/styles/openclaw-structured.css +383 -33
  41. package/web-ui/styles/responsive.css +68 -0
  42. package/web-ui/styles/sessions-usage.css +105 -9
  43. package/web-ui/styles/settings-panel.css +4 -0
@@ -3,6 +3,81 @@ import {
3
3
  formatLatency
4
4
  } from '../logic.mjs';
5
5
 
6
+ const UI_MESSAGE_KEY_BY_TEXT = Object.freeze({
7
+ '操作成功': 'toast.operationSuccess',
8
+ '操作失败': 'toast.operationFailed',
9
+ '添加失败': 'toast.addFailed',
10
+ '更新失败': 'toast.updateFailed',
11
+ '删除失败': 'toast.deleteFailed',
12
+ '已删除': 'toast.deleted',
13
+ '已复制': 'toast.copied',
14
+ '复制失败': 'toast.copyFailed',
15
+ '剪贴板为空': 'toast.clipboardEmpty',
16
+ '无法读取剪贴板': 'toast.clipboardReadFailed',
17
+ '已粘贴': 'toast.pasted',
18
+ '未检测到改动': 'toast.noChanges',
19
+ '配置已应用': 'toast.configApplied',
20
+ '应用配置失败': 'toast.applyConfigFailed',
21
+ '应用失败': 'toast.applyFailed',
22
+ '配置已加载': 'toast.configLoaded',
23
+ '配置就绪': 'toast.configReady',
24
+ '加载配置失败': 'toast.loadConfigFailed',
25
+ '读取配置失败': 'toast.readConfigFailed',
26
+ '读取配置超时': 'toast.readConfigTimeout',
27
+ '备份失败': 'toast.backupFailed',
28
+ '备份成功,开始下载': 'toast.backupReadyDownload',
29
+ '导入失败': 'toast.importFailed',
30
+ '导入成功': 'toast.importSuccess',
31
+ '导入 skill 失败': 'toast.importSkillFailed',
32
+ '导出失败': 'toast.exportFailed',
33
+ '保存失败': 'toast.saveFailed',
34
+ '加载文件失败': 'toast.loadFileFailed',
35
+ '请填写名称': 'toast.nameRequired',
36
+ '请输入名称': 'toast.nameRequired',
37
+ '名称已存在': 'toast.nameExists',
38
+ '至少保留一项': 'toast.keepOneItem',
39
+ '请输入模型': 'toast.modelRequired',
40
+ '请选择提供商和模型': 'toast.providerModelRequired',
41
+ '请先配置 API Key': 'toast.apiKeyRequired',
42
+ '配置已存在': 'toast.configExists',
43
+ '不支持此操作': 'toast.unsupportedOperation',
44
+ '参数无效': 'toast.invalidParams',
45
+ '不可分享': 'toast.notShareable',
46
+ '已移入回收站': 'toast.movedToTrash',
47
+ '生成命令失败': 'toast.commandGenerationFailed',
48
+ '没有可复制内容': 'toast.nothingToCopy',
49
+ '没有可导出内容': 'toast.nothingToExport',
50
+ '会话已恢复': 'toast.sessionRestored',
51
+ '恢复失败': 'toast.restoreFailed',
52
+ '已彻底删除': 'toast.purged',
53
+ '彻底删除失败': 'toast.purgeFailed',
54
+ '回收站已清空': 'toast.trashCleared',
55
+ '清空回收站失败': 'toast.trashClearFailed',
56
+ '加载回收站失败': 'toast.trashLoadFailed',
57
+ '加载回收站数量失败': 'toast.trashCountLoadFailed',
58
+ '任务计划已更新': 'toast.taskPlanUpdated',
59
+ '任务计划生成失败': 'toast.taskPlanFailed',
60
+ '计划存在问题,请先修复再执行': 'toast.taskPlanHasIssues',
61
+ '已发出取消请求': 'toast.cancelRequested',
62
+ '取消任务失败': 'toast.cancelTaskFailed'
63
+ });
64
+
65
+ const UI_MESSAGE_PREFIX_ENTRIES = Object.freeze(
66
+ Object.entries(UI_MESSAGE_KEY_BY_TEXT).sort((a, b) => b[0].length - a[0].length)
67
+ );
68
+
69
+ function translateUiMessage(context, text) {
70
+ if (!context || typeof context.t !== 'function' || typeof text !== 'string') return text;
71
+ const exactKey = UI_MESSAGE_KEY_BY_TEXT[text];
72
+ if (exactKey) return context.t(exactKey);
73
+ const prefixEntry = UI_MESSAGE_PREFIX_ENTRIES.find(([sourceText]) => {
74
+ return text.length > sourceText.length && text.startsWith(sourceText);
75
+ });
76
+ if (!prefixEntry) return text;
77
+ const [sourceText, key] = prefixEntry;
78
+ return `${context.t(key)}${text.slice(sourceText.length)}`;
79
+ }
80
+
6
81
  function clearProgressResetTimer(context, timerKey) {
7
82
  if (!context || !timerKey || !context[timerKey]) {
8
83
  return;
@@ -334,7 +409,7 @@ export function createRuntimeMethods(options = {}) {
334
409
  if (this._messageTimer) {
335
410
  clearTimeout(this._messageTimer);
336
411
  }
337
- this.message = text;
412
+ this.message = translateUiMessage(this, text);
338
413
  this.messageType = type || 'info';
339
414
  this._messageTimer = setTimeout(() => {
340
415
  this.message = '';
@@ -120,6 +120,12 @@ export function createStartupClaudeMethods(options = {}) {
120
120
  : String(defaultModelAutoCompactTokenLimit);
121
121
  }
122
122
  }
123
+ if (statusRes.toolConfigPermissions && typeof statusRes.toolConfigPermissions === 'object') {
124
+ this.toolConfigPermissions = {
125
+ codex: statusRes.toolConfigPermissions.codex === true,
126
+ claude: statusRes.toolConfigPermissions.claude === true
127
+ };
128
+ }
123
129
  this.providersList = listRes.providers;
124
130
  if (typeof this.loadLocalBridgeExcluded === 'function') { this.loadLocalBridgeExcluded(); }
125
131
  if (typeof this.loadClaudeLocalBridgeStatus === 'function') { this.loadClaudeLocalBridgeStatus(); }
@@ -529,6 +535,7 @@ export function createStartupClaudeMethods(options = {}) {
529
535
  },
530
536
 
531
537
  openClaudeConfigModal() {
538
+ this.showAddClaudeConfigKey = false;
532
539
  this.showClaudeConfigModal = true;
533
540
  },
534
541
 
@@ -0,0 +1,87 @@
1
+ export function createToolConfigPermissionMethods(options = {}) {
2
+ const { api } = options;
3
+
4
+ function normalizeTarget(value) {
5
+ const target = typeof value === 'string' ? value.trim().toLowerCase() : '';
6
+ return target === 'codex' || target === 'claude' ? target : '';
7
+ }
8
+
9
+ function normalizePermissions(value) {
10
+ const source = value && typeof value === 'object' && !Array.isArray(value) ? value : {};
11
+ return {
12
+ codex: source.codex === true,
13
+ claude: source.claude === true
14
+ };
15
+ }
16
+
17
+ return {
18
+ isToolConfigWriteAllowed(target) {
19
+ const normalizedTarget = normalizeTarget(target);
20
+ if (!normalizedTarget) return false;
21
+ return normalizePermissions(this.toolConfigPermissions)[normalizedTarget] === true;
22
+ },
23
+
24
+ toolConfigPermissionStatusLabel(target) {
25
+ return this.isToolConfigWriteAllowed(target)
26
+ ? this.t('toolConfig.allow')
27
+ : this.t('toolConfig.viewOnly');
28
+ },
29
+
30
+ async setToolConfigPermission(target, allowWrite) {
31
+ const normalizedTarget = normalizeTarget(target);
32
+ if (!normalizedTarget || this.toolConfigPermissionSaving[normalizedTarget]) return;
33
+
34
+ const nextAllowWrite = allowWrite === true;
35
+ const previous = normalizePermissions(this.toolConfigPermissions);
36
+ if (previous[normalizedTarget] === nextAllowWrite) return;
37
+
38
+ if (nextAllowWrite) {
39
+ const confirmed = await this.requestConfirmDialog({
40
+ title: this.t('toolConfig.confirmTitle'),
41
+ message: this.t(`toolConfig.${normalizedTarget}.confirmMessage`),
42
+ confirmText: this.t('toolConfig.confirmAllow'),
43
+ cancelText: this.t('confirm.cancel'),
44
+ danger: true
45
+ });
46
+ if (!confirmed) {
47
+ this.toolConfigPermissions = { ...previous };
48
+ return;
49
+ }
50
+ }
51
+
52
+ this.toolConfigPermissionSaving = {
53
+ ...this.toolConfigPermissionSaving,
54
+ [normalizedTarget]: true
55
+ };
56
+ try {
57
+ const res = await api('set-tool-config-permission', {
58
+ target: normalizedTarget,
59
+ allowWrite: nextAllowWrite
60
+ });
61
+ if (res && res.error) {
62
+ this.toolConfigPermissions = { ...previous };
63
+ this.showMessage(res.error, 'error');
64
+ return;
65
+ }
66
+ this.toolConfigPermissions = normalizePermissions(res && res.permissions);
67
+ this.showMessage(
68
+ nextAllowWrite
69
+ ? this.t('toolConfig.allowToast')
70
+ : this.t('toolConfig.viewOnlyToast'),
71
+ 'success'
72
+ );
73
+ try {
74
+ await this.loadAll({ preserveLoading: true });
75
+ } catch (_) {}
76
+ } catch (_) {
77
+ this.toolConfigPermissions = { ...previous };
78
+ this.showMessage(this.t('toolConfig.saveFailed'), 'error');
79
+ } finally {
80
+ this.toolConfigPermissionSaving = {
81
+ ...this.toolConfigPermissionSaving,
82
+ [normalizedTarget]: false
83
+ };
84
+ }
85
+ }
86
+ };
87
+ }
@@ -35,16 +35,16 @@ export function createConfigModeComputed() {
35
35
  return this.activeProviderModeMeta.modelPlaceholder;
36
36
  },
37
37
  activeProviderConfigChipLabel() {
38
- return this.activeProviderModeMeta.statusConfigLabel;
38
+ return this.t('field.provider');
39
39
  },
40
40
  activeProviderModelChipLabel() {
41
- return this.activeProviderModeMeta.statusModelLabel;
41
+ return this.t('field.model');
42
42
  },
43
43
  activeProviderBridgeHint() {
44
44
  if (!this.isProviderConfigMode || this.isCodexConfigMode) {
45
45
  return '';
46
46
  }
47
- return `${this.activeProviderModeLabel} 当前复用 Codex Provider / Model 管理链路。`;
47
+ return this.t('config.providerBridgeHint', { label: this.activeProviderModeLabel });
48
48
  },
49
49
  inspectorMainTabLabel() {
50
50
  if (this.mainTab === 'dashboard') return '概览';