codexmate 0.1.31 → 0.1.33

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 (92) hide show
  1. package/README.md +8 -3
  2. package/README.vi.md +8 -3
  3. package/README.zh.md +8 -3
  4. package/cli/agents-files.js +18 -4
  5. package/cli/claude-proxy.js +2 -2
  6. package/cli/plugin-config.js +64 -0
  7. package/cli/prompt-history.js +19 -4
  8. package/cli/system-prompt-files.js +7 -2
  9. package/cli.js +200 -214
  10. package/lib/cli-config-engine.js +15 -4
  11. package/lib/cli-file-utils.js +6 -1
  12. package/lib/config-change-fs.js +132 -0
  13. package/lib/config-changes.js +293 -0
  14. package/lib/handoff-mcp.js +18 -2
  15. package/lib/local-feature-store.js +39 -0
  16. package/lib/session-bookmarks.js +72 -0
  17. package/lib/session-context-health.js +102 -0
  18. package/lib/session-context-records.js +153 -0
  19. package/lib/session-diagnostics.js +75 -0
  20. package/lib/session-feature-settings.js +21 -0
  21. package/lib/session-features.js +63 -0
  22. package/lib/session-handoff-draft.js +43 -0
  23. package/lib/session-projects.js +76 -0
  24. package/lib/session-search-index.js +188 -0
  25. package/lib/thread-handoff.js +8 -0
  26. package/lib/web-server.js +216 -0
  27. package/lib/web-startup-auth.js +5 -1
  28. package/package.json +1 -1
  29. package/plugins/prompt-templates/computed.mjs +3 -3
  30. package/plugins/prompt-templates/invocation.mjs +73 -0
  31. package/plugins/prompt-templates/methods.mjs +48 -3
  32. package/plugins/prompt-templates/overview.mjs +2 -0
  33. package/web-ui/app.js +32 -1
  34. package/web-ui/index.html +2 -0
  35. package/web-ui/logic.context-health.mjs +144 -0
  36. package/web-ui/logic.context-window.mjs +15 -0
  37. package/web-ui/modules/api.mjs +72 -39
  38. package/web-ui/modules/app.computed.prompts.mjs +11 -0
  39. package/web-ui/modules/app.methods.agents.mjs +25 -3
  40. package/web-ui/modules/app.methods.claude-config.mjs +2 -0
  41. package/web-ui/modules/app.methods.codex-config.mjs +9 -0
  42. package/web-ui/modules/app.methods.config-changes.mjs +124 -0
  43. package/web-ui/modules/app.methods.index.mjs +4 -0
  44. package/web-ui/modules/app.methods.kilocode-config.mjs +2 -0
  45. package/web-ui/modules/app.methods.openclaw-persist.mjs +2 -0
  46. package/web-ui/modules/app.methods.opencode-config.mjs +2 -0
  47. package/web-ui/modules/app.methods.pi-config.mjs +12 -3
  48. package/web-ui/modules/app.methods.provider-cache.mjs +9 -3
  49. package/web-ui/modules/app.methods.providers.mjs +6 -0
  50. package/web-ui/modules/app.methods.startup-claude.mjs +8 -47
  51. package/web-ui/modules/app.methods.system-prompt.mjs +17 -2
  52. package/web-ui/modules/config-change-actions.mjs +9 -0
  53. package/web-ui/modules/context-health.methods.mjs +70 -0
  54. package/web-ui/modules/i18n/locales/en.mjs +164 -4
  55. package/web-ui/modules/i18n/locales/ja.mjs +164 -4
  56. package/web-ui/modules/i18n/locales/vi.mjs +164 -4
  57. package/web-ui/modules/i18n/locales/zh-tw.mjs +164 -4
  58. package/web-ui/modules/i18n/locales/zh.mjs +164 -4
  59. package/web-ui/modules/plugins.methods.mjs +2 -0
  60. package/web-ui/modules/prompt-ecosystem.methods.mjs +136 -0
  61. package/web-ui/modules/request-deadline.mjs +33 -0
  62. package/web-ui/modules/session-features.mjs +279 -0
  63. package/web-ui/modules/thread-handoff.mjs +1 -1
  64. package/web-ui/partials/index/config-changes.html +25 -0
  65. package/web-ui/partials/index/context-health.html +45 -0
  66. package/web-ui/partials/index/context-window-reference.html +17 -0
  67. package/web-ui/partials/index/layout-header.html +7 -30
  68. package/web-ui/partials/index/modal-openclaw-config.html +0 -2
  69. package/web-ui/partials/index/modal-prompt-invocation.html +17 -0
  70. package/web-ui/partials/index/modal-skills.html +0 -1
  71. package/web-ui/partials/index/modals-basic.html +0 -8
  72. package/web-ui/partials/index/modals-pi-provider.html +0 -1
  73. package/web-ui/partials/index/panel-config-codex.html +0 -3
  74. package/web-ui/partials/index/panel-config-openclaw.html +16 -13
  75. package/web-ui/partials/index/panel-dashboard.html +0 -2
  76. package/web-ui/partials/index/panel-plugins.html +37 -10
  77. package/web-ui/partials/index/panel-prompts.html +18 -3
  78. package/web-ui/partials/index/panel-sessions.html +23 -11
  79. package/web-ui/partials/index/panel-settings.html +1 -12
  80. package/web-ui/partials/index/panel-trash.html +0 -1
  81. package/web-ui/partials/index/session-diagnostics.html +29 -0
  82. package/web-ui/partials/index/session-features.html +107 -0
  83. package/web-ui/partials/index/thread-handoff.html +6 -3
  84. package/web-ui/res/web-ui-render.precompiled.js +1863 -271
  85. package/web-ui/styles/config-changes.css +30 -0
  86. package/web-ui/styles/context-health.css +107 -0
  87. package/web-ui/styles/openclaw-structured.css +205 -189
  88. package/web-ui/styles/prompts-editor.css +23 -0
  89. package/web-ui/styles/session-features.css +148 -0
  90. package/web-ui/styles/sessions-preview.css +21 -0
  91. package/web-ui/styles/sub-tabs.css +181 -0
  92. package/web-ui/styles.css +5 -1
@@ -1,4 +1,168 @@
1
1
  const zhTw = Object.freeze({
2
+ "features.searchScope": "檢索範圍",
3
+ "features.moreFilters": "更多篩選",
4
+ "features.bookmarkHint": "點擊訊息旁的收藏圖示,保留有用的片段。",
5
+ "features.localCheck": "本機設定",
6
+ "features.providerCheck": "目前 Codex 路由",
7
+ "features.technicalDetails": "技術詳情",
8
+ "features.windowReference": "模型視窗參考",
9
+ "features.windowSettings": "設定模型視窗",
10
+ "features.rebuildIndex": "重建索引",
11
+ "features.title": "會話工具",
12
+ "features.bookmarks": "收藏",
13
+ "features.bookmark": "收藏訊息",
14
+ "features.unbookmark": "取消收藏",
15
+ "features.search": "搜尋",
16
+ "features.tag": "篩選標籤",
17
+ "features.tags": "標籤(逗號分隔)",
18
+ "features.projectPath": "專案絕對路徑",
19
+ "features.loading": "正在讀取…",
20
+ "features.empty": "目前範圍沒有結果",
21
+ "features.source": "查看原文",
22
+ "features.edit": "編輯備註",
23
+ "features.note": "備註",
24
+ "features.save": "儲存",
25
+ "features.cancel": "取消",
26
+ "features.close": "關閉",
27
+ "features.selectMessage": "選擇交接訊息",
28
+ "features.index": "全文索引",
29
+ "features.refreshIndex": "更新索引",
30
+ "features.indexStatus": "已索引 {count} 個會話;本輪 {processed}/{total}",
31
+ "features.indexScope": "僅涵蓋已發現候選;沿用上方來源、專案與角色篩選。新訊息需更新索引。",
32
+ "features.indexFailures": "{count} 項讀取失敗;結果未涵蓋這些記錄",
33
+ "features.coverage": "已查 {scanned}/{total} 個已索引會話",
34
+ "features.partial": "結果未完整涵蓋目前範圍;最多顯示 100 條命中",
35
+ "features.context": "前後文",
36
+ "features.generateDraft": "產生交接草稿({count} 條)",
37
+ "features.draftReview": "草稿未傳送;先核對證據,再填寫或修改後續步驟。",
38
+ "features.unverified": "待確認內容({count} 條)",
39
+ "features.projects": "專案工作台",
40
+ "features.projectHistory": "顯示候選範圍內的歷史記錄,不代表目前檔案或測試狀態。",
41
+ "features.readAt": "讀取時間:{time}",
42
+ "features.unassigned": "未歸屬專案",
43
+ "features.prompts": "提示詞檔案(唯讀)",
44
+ "features.handoffs": "會話交接",
45
+ "features.projectMapping": "關聯遷移前後的路徑",
46
+ "features.saveMapping": "儲存對應;空路徑解除對應",
47
+ "features.contextWindow": "模型視窗(正整數;留空使用記錄)",
48
+ "features.model": "模型",
49
+ "features.chooseModel": "選擇比較模型",
50
+ "features.contextEstimate": "歷史文字 / 模型視窗(估算):{percent}% / {window};不是實際請求用量",
51
+ "features.dismiss": "關閉本會話提醒",
52
+ "features.diagnostics": "統一故障診斷",
53
+ "features.diagnosticScope": "預設僅檢查本機。勾選後才探測目前 Codex 路由或啟動選定 MCP;不修設定,不呼叫寫入工具。",
54
+ "features.remoteProbe": "探測目前 Codex 路由(連網)",
55
+ "features.check": "開始檢查",
56
+ "features.exportJson": "匯出遮蔽機密的 JSON",
57
+ "features.exportMarkdown": "匯出遮蔽機密的 Markdown",
58
+ "features.status.idle": "未開始",
59
+ "features.status.running": "正在執行",
60
+ "features.status.success": "完成",
61
+ "features.status.partial": "部分失敗或未涵蓋",
62
+ "features.status.failed": "失敗",
63
+ "features.status.cancelled": "已取消",
64
+ "features.status.pending": "等待執行",
65
+ "features.status.not_checked": "未檢查",
66
+ "features.status.passed": "通過",
67
+ "features.status.timeout": "逾時",
68
+ "features.evidence.passed": "工具日誌通過",
69
+ "features.evidence.failed": "工具日誌失敗",
70
+ "features.evidence.unverified": "待確認",
71
+ "features.windowSource.manual": "使用者填寫",
72
+ "features.windowSource.record": "會話記錄",
73
+ "features.windowStatus.unknown": "視窗未知;先選擇模型或填寫視窗",
74
+ "features.windowStatus.invalid": "視窗必須是正整數",
75
+ "features.windowStatus.warning": "文字體量達到視窗的 80%;可準備交接",
76
+ "features.windowStatus.high": "文字體量達到視窗的 95%;核對交接需求",
77
+ "features.error.bookmark-excerpt-too-large": "記錄超過儲存容量;先匯出或縮小範圍",
78
+ "features.error.bookmark-input-invalid": "輸入無效;檢查視窗、標籤、路徑或選取訊息",
79
+ "features.error.bookmark-not-found": "原訊息不存在、已變更或無法唯一定位;摘錄仍保留",
80
+ "features.error.bookmark-source-unavailable": "原訊息不存在、已變更或無法唯一定位;摘錄仍保留",
81
+ "features.error.context-window-invalid": "輸入無效;檢查視窗、標籤、路徑或選取訊息",
82
+ "features.error.diagnostic-busy": "已有操作正在執行;等待完成或取消",
83
+ "features.error.diagnostic-input-invalid": "輸入無效;檢查視窗、標籤、路徑或選取訊息",
84
+ "features.error.diagnostic-timeout": "讀取或寫入失敗;檢查檔案與索引後重新整理",
85
+ "features.error.feature-action-invalid": "輸入無效;檢查視窗、標籤、路徑或選取訊息",
86
+ "features.error.feature-read-failed": "讀取或寫入失敗;檢查檔案與索引後重新整理",
87
+ "features.error.feature-store-conflict": "記錄被其他操作修改;重新整理後重試",
88
+ "features.error.feature-store-full": "記錄超過儲存容量;先匯出或縮小範圍",
89
+ "features.error.feature-store-invalid": "輸入無效;檢查視窗、標籤、路徑或選取訊息",
90
+ "features.error.handoff-selection-invalid": "輸入無效;檢查視窗、標籤、路徑或選取訊息",
91
+ "features.error.index-busy": "已有操作正在執行;等待完成或取消",
92
+ "features.error.index-cancelled": "讀取或寫入失敗;檢查檔案與索引後重新整理",
93
+ "features.error.index-input-invalid": "輸入無效;檢查視窗、標籤、路徑或選取訊息",
94
+ "features.error.index-query-empty": "輸入無效;檢查視窗、標籤、路徑或選取訊息",
95
+ "features.error.index-refresh-failed": "讀取或寫入失敗;檢查檔案與索引後重新整理",
96
+ "features.error.index-shard-unavailable": "讀取或寫入失敗;檢查檔案與索引後重新整理",
97
+ "features.error.index-source-changed": "讀取或寫入失敗;檢查檔案與索引後重新整理",
98
+ "features.error.index-source-invalid": "輸入無效;檢查視窗、標籤、路徑或選取訊息",
99
+ "features.error.project-mapping-invalid": "輸入無效;檢查視窗、標籤、路徑或選取訊息",
100
+ "changes.preview": "配置變更預覽",
101
+ "changes.hint": "對比規範化字段;密鑰已隱藏。確認後寫入以下文件。",
102
+ "changes.files": "受影響文件",
103
+ "changes.last": "最近一次配置變更",
104
+ "changes.undo": "撤銷最近一次",
105
+ "changes.undoConfirm": "恢復以下文件的原內容;本次新建文件將刪除。外部修改後拒絕撤銷。\n{paths}",
106
+ "changes.apply": "確認寫入",
107
+ "changes.saving": "正在寫入…",
108
+ "changes.cancelled": "已取消配置變更",
109
+ "changes.busy": "已有配置變更正在執行",
110
+ "changes.failed": "配置變更失敗,請檢查文件與輸入。",
111
+ "changes.undone": "已撤銷最近一次配置變更",
112
+ "changes.refreshFailed": "撤銷已完成,界面刷新失敗,請重新加載。",
113
+ "changes.restoreFailed": "以下路徑恢復失敗,請核對備份:{paths}",
114
+ "changes.hidden": "內容無法安全解析,已隱藏;原始文件仍將按預覽提交。",
115
+ "changes.maskedOnly": "文件字節已變化;差異僅涉及隱藏字段或格式。",
116
+ "changes.operation.create": "新建",
117
+ "changes.operation.modify": "修改",
118
+ "changes.operation.delete": "刪除",
119
+ "changes.error.config-change-conflict": "文件在讀取或預覽後已變更;重新加載配置後再預覽。",
120
+ "changes.error.config-change-expired": "預覽或撤銷記錄已失效,請重新加載。",
121
+ "changes.error.config-change-busy": "已有配置變更正在執行。",
122
+ "changes.error.config-change-invalid": "無法預覽配置,請檢查文件、格式與必填字段。",
123
+ "changes.error.config-change-unsupported": "該操作不支持配置預覽。",
124
+ "changes.error.config-change-too-large": "配置變更超過預覽容量。",
125
+ "changes.error.config-change-write-failed": "配置寫入失敗,已嘗試恢復原內容。",
126
+ "changes.error.config-change-undo-failed": "撤銷失敗,已保留當前配置。",
127
+ "changes.error.config-change-history-invalid": "無法讀取變更記錄,請核對備份文件。",
128
+ "changes.error.tool-config-write-disabled": "先開啟對應工具的配置寫入權限。",
129
+ "settings.templateConfirm.title": "配置寫入預覽",
130
+ "settings.templateConfirm.meta": "統一預覽六種工具的配置變更",
131
+ "settings.templateConfirm.toggle": "寫入前顯示變更預覽",
132
+ "settings.templateConfirm.hint": "關閉後直接寫入;保留衝突檢查與最近一次撤銷。",
133
+ 'contextHealth.title': "上下文健檢",
134
+ 'contextHealth.loading': "掃描完整會話…",
135
+ 'contextHealth.composition': "上下文組成比例",
136
+ 'contextHealth.estimateHint': "依保存的可讀文字估算;不等於實際請求用量",
137
+ 'contextHealth.nodes': "訊息節點",
138
+ 'contextHealth.topFive': "佔用最多的 Top 5",
139
+ 'contextHealth.jump': "定位此訊息",
140
+ 'contextHealth.empty': "沒有可統計的文字訊息",
141
+ 'contextHealth.hotspots': "膨脹熱點",
142
+ 'contextHealth.message': "定位訊息節點",
143
+ 'contextHealth.category.system': "系統與規則",
144
+ 'contextHealth.category.user': "使用者指令",
145
+ 'contextHealth.category.assistant': "模型文字與思考",
146
+ 'contextHealth.category.tools': "工具輸出與日誌",
147
+ 'contextHealth.category.code': "程式碼與 Diff",
148
+ 'contextHealth.level.healthy': "健康 < 32k",
149
+ 'contextHealth.level.heavy': "偏重 32k–64k",
150
+ 'contextHealth.level.bloated': "膨脹 > 64k",
151
+ 'contextHealth.reason.dominant_message': "單條超過 15%",
152
+ 'contextHealth.reason.repeated_file_read': "重複讀取檔案",
153
+ 'contextHealth.reason.long_error_log': "過長錯誤日誌",
154
+ 'ecosystem.rollbackConfirm': "回復將取代目前設定與未儲存內容;寫入前保留目前版本備份。",
155
+ 'ecosystem.variablesTitle': "填寫範本變數",
156
+ 'ecosystem.variablesHint': "填寫後僅用於本次呼叫;git_diff 請貼上差異文字,不執行命令。",
157
+ 'ecosystem.variablesRequired': "請填寫全部變數。",
158
+ 'ecosystem.useTemplate': "使用範本",
159
+ 'ecosystem.share': "分享範本",
160
+ 'ecosystem.rollback': "回復至此版本",
161
+ 'ecosystem.historyCompare': "歷史版本 → 目前內容",
162
+ 'ecosystem.before': "歷史版本",
163
+ 'ecosystem.current': "目前內容",
164
+ 'ecosystem.storageFail': "外掛設定儲存失敗。",
165
+ 'ecosystem.cacheFail': "範本設定已儲存;瀏覽器快取更新失敗。",
2
166
  'workflow.tagline': "選好任務,背景接著做。",
3
167
  'workflow.options': "輸入參數",
4
168
  'workflow.title': "自動工作流程",
@@ -1297,10 +1461,6 @@ const zhTw = Object.freeze({
1297
1461
  'settings.webhook.enableToggle': '啟用 Webhook',
1298
1462
  'settings.webhook.urlLabel': 'Webhook URL',
1299
1463
  'settings.webhook.eventsLabel': '事件',
1300
- 'settings.templateConfirm.title': '設定模板二次確認',
1301
- 'settings.templateConfirm.meta': '降低誤寫入風險',
1302
- 'settings.templateConfirm.toggle': '應用模板前先預覽差異(兩步:確認 → 應用)',
1303
- 'settings.templateConfirm.hint': '開啟後:先展示差異預覽,再確認寫入。',
1304
1464
 
1305
1465
  'settings.timeline.style.title': '時間線樣式',
1306
1466
  'settings.timeline.style.meta': '選擇會話預覽中的時間線導航樣式',
@@ -1,4 +1,168 @@
1
1
  const zh = Object.freeze({
2
+ "features.searchScope": "检索范围",
3
+ "features.moreFilters": "更多筛选",
4
+ "features.bookmarkHint": "点击消息旁的收藏图标,保留有用的片段。",
5
+ "features.localCheck": "本地配置",
6
+ "features.providerCheck": "当前 Codex 路由",
7
+ "features.technicalDetails": "技术详情",
8
+ "features.windowReference": "模型窗口参考",
9
+ "features.windowSettings": "设置模型窗口",
10
+ "features.rebuildIndex": "重建索引",
11
+ "features.title": "会话工具",
12
+ "features.bookmarks": "收藏",
13
+ "features.bookmark": "收藏消息",
14
+ "features.unbookmark": "取消收藏",
15
+ "features.search": "搜索",
16
+ "features.tag": "筛选标签",
17
+ "features.tags": "标签(逗号分隔)",
18
+ "features.projectPath": "项目绝对路径",
19
+ "features.loading": "正在读取…",
20
+ "features.empty": "当前范围没有结果",
21
+ "features.source": "查看原文",
22
+ "features.edit": "编辑备注",
23
+ "features.note": "备注",
24
+ "features.save": "保存",
25
+ "features.cancel": "取消",
26
+ "features.close": "关闭",
27
+ "features.selectMessage": "选择交接消息",
28
+ "features.index": "全文索引",
29
+ "features.refreshIndex": "更新索引",
30
+ "features.indexStatus": "已索引 {count} 条会话;本轮 {processed}/{total}",
31
+ "features.indexScope": "仅覆盖已发现候选;沿用上方来源、项目与角色筛选。新消息需更新索引。",
32
+ "features.indexFailures": "{count} 项读取失败;结果未覆盖这些记录",
33
+ "features.coverage": "已查 {scanned}/{total} 条已索引会话",
34
+ "features.partial": "结果未完整覆盖当前范围;最多展示 100 条命中",
35
+ "features.context": "前后文",
36
+ "features.generateDraft": "生成交接草稿({count} 条)",
37
+ "features.draftReview": "草稿未发送;先核对证据,再填写或修改后续步骤。",
38
+ "features.unverified": "待确认内容({count} 条)",
39
+ "features.projects": "项目工作台",
40
+ "features.projectHistory": "展示候选范围内的历史记录,不代表当前文件或测试状态。",
41
+ "features.readAt": "读取时间:{time}",
42
+ "features.unassigned": "未归属项目",
43
+ "features.prompts": "提示词文件(只读)",
44
+ "features.handoffs": "会话交接",
45
+ "features.projectMapping": "关联迁移前后的路径",
46
+ "features.saveMapping": "保存映射;空路径解除映射",
47
+ "features.contextWindow": "模型窗口(正整数;留空使用记录)",
48
+ "features.model": "模型",
49
+ "features.chooseModel": "选择比较模型",
50
+ "features.contextEstimate": "历史文本 / 模型窗口(估算):{percent}% / {window};不是实际请求占用",
51
+ "features.dismiss": "关闭本会话提醒",
52
+ "features.diagnostics": "统一故障诊断",
53
+ "features.diagnosticScope": "默认只检查本地。勾选后才探测当前 Codex 路由或启动选中的 MCP;不修配置,不调用写工具。",
54
+ "features.remoteProbe": "探测当前 Codex 路由(联网)",
55
+ "features.check": "开始检查",
56
+ "features.exportJson": "导出脱敏 JSON",
57
+ "features.exportMarkdown": "导出脱敏 Markdown",
58
+ "features.status.idle": "未开始",
59
+ "features.status.running": "正在执行",
60
+ "features.status.success": "完成",
61
+ "features.status.partial": "部分失败或未覆盖",
62
+ "features.status.failed": "失败",
63
+ "features.status.cancelled": "已取消",
64
+ "features.status.pending": "等待执行",
65
+ "features.status.not_checked": "未检查",
66
+ "features.status.passed": "通过",
67
+ "features.status.timeout": "超时",
68
+ "features.evidence.passed": "工具日志通过",
69
+ "features.evidence.failed": "工具日志失败",
70
+ "features.evidence.unverified": "待确认",
71
+ "features.windowSource.manual": "用户填写",
72
+ "features.windowSource.record": "会话记录",
73
+ "features.windowStatus.unknown": "窗口未知;先选择模型或填写窗口",
74
+ "features.windowStatus.invalid": "窗口必须是正整数",
75
+ "features.windowStatus.warning": "文本体量达到窗口的 80%;可准备交接",
76
+ "features.windowStatus.high": "文本体量达到窗口的 95%;核对交接需求",
77
+ "features.error.bookmark-excerpt-too-large": "记录超过存储容量;先导出或缩小范围",
78
+ "features.error.bookmark-input-invalid": "输入无效;检查窗口、标签、路径或选中的消息",
79
+ "features.error.bookmark-not-found": "原消息不存在、已变更或无法唯一定位;摘录仍保留",
80
+ "features.error.bookmark-source-unavailable": "原消息不存在、已变更或无法唯一定位;摘录仍保留",
81
+ "features.error.context-window-invalid": "输入无效;检查窗口、标签、路径或选中的消息",
82
+ "features.error.diagnostic-busy": "已有操作正在执行;等待完成或取消",
83
+ "features.error.diagnostic-input-invalid": "输入无效;检查窗口、标签、路径或选中的消息",
84
+ "features.error.diagnostic-timeout": "读取或写入失败;检查文件与索引后刷新",
85
+ "features.error.feature-action-invalid": "输入无效;检查窗口、标签、路径或选中的消息",
86
+ "features.error.feature-read-failed": "读取或写入失败;检查文件与索引后刷新",
87
+ "features.error.feature-store-conflict": "记录被其他操作修改;刷新后重试",
88
+ "features.error.feature-store-full": "记录超过存储容量;先导出或缩小范围",
89
+ "features.error.feature-store-invalid": "输入无效;检查窗口、标签、路径或选中的消息",
90
+ "features.error.handoff-selection-invalid": "输入无效;检查窗口、标签、路径或选中的消息",
91
+ "features.error.index-busy": "已有操作正在执行;等待完成或取消",
92
+ "features.error.index-cancelled": "读取或写入失败;检查文件与索引后刷新",
93
+ "features.error.index-input-invalid": "输入无效;检查窗口、标签、路径或选中的消息",
94
+ "features.error.index-query-empty": "输入无效;检查窗口、标签、路径或选中的消息",
95
+ "features.error.index-refresh-failed": "读取或写入失败;检查文件与索引后刷新",
96
+ "features.error.index-shard-unavailable": "读取或写入失败;检查文件与索引后刷新",
97
+ "features.error.index-source-changed": "读取或写入失败;检查文件与索引后刷新",
98
+ "features.error.index-source-invalid": "输入无效;检查窗口、标签、路径或选中的消息",
99
+ "features.error.project-mapping-invalid": "输入无效;检查窗口、标签、路径或选中的消息",
100
+ "changes.preview": "配置变更预览",
101
+ "changes.hint": "对比规范化字段;密钥已隐藏。确认后写入以下文件。",
102
+ "changes.files": "受影响文件",
103
+ "changes.last": "最近一次配置变更",
104
+ "changes.undo": "撤销最近一次",
105
+ "changes.undoConfirm": "恢复以下文件的原内容;本次新建文件将删除。外部修改后拒绝撤销。\n{paths}",
106
+ "changes.apply": "确认写入",
107
+ "changes.saving": "正在写入…",
108
+ "changes.cancelled": "已取消配置变更",
109
+ "changes.busy": "已有配置变更正在执行",
110
+ "changes.failed": "配置变更失败,请检查文件与输入。",
111
+ "changes.undone": "已撤销最近一次配置变更",
112
+ "changes.refreshFailed": "撤销已完成,界面刷新失败,请重新加载。",
113
+ "changes.restoreFailed": "以下路径恢复失败,请核对备份:{paths}",
114
+ "changes.hidden": "内容无法安全解析,已隐藏;原始文件仍将按预览提交。",
115
+ "changes.maskedOnly": "文件字节已变化;差异仅涉及隐藏字段或格式。",
116
+ "changes.operation.create": "新建",
117
+ "changes.operation.modify": "修改",
118
+ "changes.operation.delete": "删除",
119
+ "changes.error.config-change-conflict": "文件在读取或预览后已变更;重新加载配置后再预览。",
120
+ "changes.error.config-change-expired": "预览或撤销记录已失效,请重新加载。",
121
+ "changes.error.config-change-busy": "已有配置变更正在执行。",
122
+ "changes.error.config-change-invalid": "无法预览配置,请检查文件、格式与必填字段。",
123
+ "changes.error.config-change-unsupported": "该操作不支持配置预览。",
124
+ "changes.error.config-change-too-large": "配置变更超过预览容量。",
125
+ "changes.error.config-change-write-failed": "配置写入失败,已尝试恢复原内容。",
126
+ "changes.error.config-change-undo-failed": "撤销失败,已保留当前配置。",
127
+ "changes.error.config-change-history-invalid": "无法读取变更记录,请核对备份文件。",
128
+ "changes.error.tool-config-write-disabled": "先开启对应工具的配置写入权限。",
129
+ "settings.templateConfirm.title": "配置写入预览",
130
+ "settings.templateConfirm.meta": "统一预览六种工具的配置变更",
131
+ "settings.templateConfirm.toggle": "写入前显示变更预览",
132
+ "settings.templateConfirm.hint": "关闭后直接写入;保留冲突检查与最近一次撤销。",
133
+ 'contextHealth.title': "上下文体检",
134
+ 'contextHealth.loading': "扫描完整会话…",
135
+ 'contextHealth.composition': "上下文构成比例",
136
+ 'contextHealth.estimateHint': "按保存的可读文本估算;不等同实际请求用量",
137
+ 'contextHealth.nodes': "消息节点",
138
+ 'contextHealth.topFive': "占用最多的 Top 5",
139
+ 'contextHealth.jump': "定位此消息",
140
+ 'contextHealth.empty': "没有可统计的文本消息",
141
+ 'contextHealth.hotspots': "膨胀热点",
142
+ 'contextHealth.message': "定位消息节点",
143
+ 'contextHealth.category.system': "系统与规则",
144
+ 'contextHealth.category.user': "用户指令",
145
+ 'contextHealth.category.assistant': "模型文本与思考",
146
+ 'contextHealth.category.tools': "工具输出与日志",
147
+ 'contextHealth.category.code': "代码片段与 Diff",
148
+ 'contextHealth.level.healthy': "健康 < 32k",
149
+ 'contextHealth.level.heavy': "偏重 32k–64k",
150
+ 'contextHealth.level.bloated': "膨胀 > 64k",
151
+ 'contextHealth.reason.dominant_message': "单条超过 15%",
152
+ 'contextHealth.reason.repeated_file_read': "重复读取文件",
153
+ 'contextHealth.reason.long_error_log': "超长错误日志",
154
+ 'ecosystem.rollbackConfirm': "回滚将替换当前配置与未保存内容;写入前保留当前版本备份。",
155
+ 'ecosystem.variablesTitle': "填写模板变量",
156
+ 'ecosystem.variablesHint': "填写后仅用于本次调用;git_diff 请粘贴差异文本,不执行命令。",
157
+ 'ecosystem.variablesRequired': "请填写全部变量。",
158
+ 'ecosystem.useTemplate': "使用模板",
159
+ 'ecosystem.share': "分享模板",
160
+ 'ecosystem.rollback': "回滚到此版本",
161
+ 'ecosystem.historyCompare': "历史版本 → 当前内容",
162
+ 'ecosystem.before': "历史版本",
163
+ 'ecosystem.current': "当前内容",
164
+ 'ecosystem.storageFail': "插件配置保存失败。",
165
+ 'ecosystem.cacheFail': "模板配置已保存;浏览器缓存更新失败。",
2
166
  'workflow.tagline': "选好任务,后台接着做。",
3
167
  'workflow.options': "输入参数",
4
168
  'workflow.title': "自动工作流",
@@ -1297,10 +1461,6 @@ const zh = Object.freeze({
1297
1461
  'settings.webhook.enableToggle': '启用 Webhook',
1298
1462
  'settings.webhook.urlLabel': 'Webhook URL',
1299
1463
  'settings.webhook.eventsLabel': '事件',
1300
- 'settings.templateConfirm.title': '配置模板二次确认',
1301
- 'settings.templateConfirm.meta': '降低误写入风险',
1302
- 'settings.templateConfirm.toggle': '应用模板前先预览差异(两步:确认 → 应用)',
1303
- 'settings.templateConfirm.hint': '开启后:先展示差异预览,再确认写入。',
1304
1464
 
1305
1465
  'settings.timeline.style.title': '时间线样式',
1306
1466
  'settings.timeline.style.meta': '选择会话预览中的时间线导航样式',
@@ -1,9 +1,11 @@
1
1
  import { createPromptTemplatesMethods } from '../../plugins/prompt-templates/methods.mjs';
2
2
  import { createTextToolsMethods } from '../../plugins/text-tools/methods.mjs';
3
+ import { createPromptInvocationMethods } from '../../plugins/prompt-templates/invocation.mjs';
3
4
 
4
5
  export function createPluginsMethods() {
5
6
  return {
6
7
  ...createPromptTemplatesMethods(),
8
+ ...createPromptInvocationMethods(),
7
9
  ...createTextToolsMethods()
8
10
  };
9
11
  }
@@ -0,0 +1,136 @@
1
+ import { normalizePromptTemplateDraft } from '../../plugins/prompt-templates/methods.mjs';
2
+ import { persistPromptTemplatesToStorage } from '../../plugins/prompt-templates/storage.mjs';
3
+
4
+ export function createPromptEcosystemMethods({ api }) {
5
+ return {
6
+ promptHistoryTarget(kind) {
7
+ if (kind === 'sys') return {
8
+ key: `${this.sysPromptScope}:${this.sysPromptMode}:${this.sysHistoryPreviewId}`,
9
+ busy: this.sysPromptLoading || this.sysPromptSaving || this.sysPromptDiffVisible,
10
+ id: this.sysHistoryPreviewId, content: this.sysHistoryPreviewContent,
11
+ action: 'apply-system-prompt', saving: 'sysPromptSaving',
12
+ params: { scope: this.sysPromptScope, mode: this.sysPromptMode, baseHash: this.sysPromptHash },
13
+ load: 'loadSystemPrompt', history: 'loadSysHistory', bucket: this.sysHistoryBucket
14
+ };
15
+ const context = this.agentsContext || 'codex';
16
+ const action = { codex: 'apply-agents-file', opencode: 'apply-opencode-agents-file', 'claude-project': 'apply-claude-md-file' }[context];
17
+ if (!action) return null;
18
+ return {
19
+ key: `${context}:${this.projectClaudeMdPath || ''}:${this.promptHistoryPreviewId}`,
20
+ busy: this.agentsLoading || this.agentsSaving || this.agentsDiffVisible,
21
+ id: this.promptHistoryPreviewId, content: this.promptHistoryPreviewContent,
22
+ action, saving: 'agentsSaving',
23
+ params: { baseContent: this.agentsOriginalContent, lineEnding: this.agentsLineEnding,
24
+ ...(context === 'claude-project' ? { baseDir: this.projectClaudeMdPath } : {}) },
25
+ load: 'loadPromptsContent', history: 'loadPromptHistory', bucket: this.promptHistoryBucket
26
+ };
27
+ },
28
+ async rollbackPromptHistory(kind = 'agents') {
29
+ const target = this.promptHistoryTarget(kind);
30
+ if (!target || target.busy || !target.id) return false;
31
+ const confirmed = await this.requestConfirmDialog({ title: this.t('ecosystem.rollback'),
32
+ message: this.t('ecosystem.rollbackConfirm'), confirmText: this.t('ecosystem.rollback'),
33
+ cancelText: this.t('common.cancel'), danger: true });
34
+ const latest = this.promptHistoryTarget(kind);
35
+ if (!confirmed || !latest || latest.busy || latest.key !== target.key
36
+ || latest.params.baseContent !== target.params.baseContent || latest.params.baseHash !== target.params.baseHash) return false;
37
+ this[target.saving] = true;
38
+ try {
39
+ const result = await api(target.action, { ...target.params, content: target.content });
40
+ if (result.error) throw new Error(result.error);
41
+ await this[target.load]();
42
+ await this[target.history](target.bucket);
43
+ this.showMessage(this.t('toast.history.restored'), 'success');
44
+ return true;
45
+ } catch (error) { this.showMessage(error.message || this.t('toast.save.fail'), 'error'); return false; }
46
+ finally { this[target.saving] = false; }
47
+ },
48
+ async loadPluginConfig() {
49
+ try {
50
+ const result = await api('get-plugin-config', {});
51
+ if (result.error) throw new Error(result.error);
52
+ this.pluginConfigHash = result.hash;
53
+ this.pluginHistoryBucket = result.historyBucket;
54
+ this.pluginConfigLoaded = true;
55
+ if (result.exists) {
56
+ const builtins = this.promptTemplatesListRaw.filter((item) => item.isBuiltin === true);
57
+ this.promptTemplatesListRaw = [...builtins, ...result.templates];
58
+ if (!persistPromptTemplatesToStorage(this.promptTemplatesListRaw, localStorage)) {
59
+ this.showMessage(this.t('ecosystem.cacheFail'), 'error');
60
+ }
61
+ }
62
+ return true;
63
+ } catch (error) { this.showMessage(error.message || this.t('toast.load.fail'), 'error'); return false; }
64
+ },
65
+ async persistPluginTemplates(list) {
66
+ if (this.pluginConfigSaving) return false;
67
+ if (!this.pluginConfigLoaded && !await this.loadPluginConfig()) return false;
68
+ this.pluginConfigSaving = true;
69
+ try {
70
+ const result = await api('apply-plugin-config', { baseHash: this.pluginConfigHash,
71
+ templates: list.map(normalizePromptTemplateDraft),
72
+ legacyTemplates: this.promptTemplatesListRaw.map(normalizePromptTemplateDraft) });
73
+ if (result.error) throw new Error(result.error);
74
+ this.pluginConfigHash = result.hash;
75
+ this.pluginHistoryBucket = result.historyBucket;
76
+ return true;
77
+ } catch (error) { this.showMessage(error.message || this.t('ecosystem.storageFail'), 'error'); return false; }
78
+ finally { this.pluginConfigSaving = false; }
79
+ },
80
+ async openPluginHistory() {
81
+ if (this.pluginHistoryLoading || this.pluginConfigSaving) return;
82
+ if (!this.pluginConfigLoaded && !await this.loadPluginConfig()) return;
83
+ this.pluginHistoryVisible = true;
84
+ this.pluginHistorySelectedId = '';
85
+ this.pluginHistoryError = '';
86
+ this.pluginHistoryLoading = true;
87
+ try {
88
+ const result = await api('list-prompt-history', { bucket: this.pluginHistoryBucket });
89
+ if (result.error) throw new Error(result.error);
90
+ this.pluginHistoryItems = Array.isArray(result) ? result : [];
91
+ } catch (error) { this.pluginHistoryError = error.message; }
92
+ finally { this.pluginHistoryLoading = false; }
93
+ },
94
+ async viewPluginHistory(item) {
95
+ if (this.pluginHistoryLoading || this.pluginConfigSaving) return;
96
+ this.pluginHistoryLoading = true;
97
+ this.pluginHistorySelectedId = '';
98
+ this.pluginHistoryError = '';
99
+ try {
100
+ const result = await api('get-prompt-history', { bucket: this.pluginHistoryBucket, id: item.id });
101
+ if (result.error) throw new Error(result.error);
102
+ if (!this.pluginHistoryVisible) return;
103
+ this.pluginHistoryContent = result.content;
104
+ this.pluginHistorySelectedId = item.id;
105
+ } catch (error) { this.pluginHistoryError = error.message; }
106
+ finally { this.pluginHistoryLoading = false; }
107
+ },
108
+ async rollbackPluginConfig() {
109
+ if (!this.pluginHistorySelectedId || this.pluginHistoryLoading || this.pluginConfigSaving) return false;
110
+ const id = this.pluginHistorySelectedId;
111
+ const content = this.pluginHistoryContent;
112
+ const hash = this.pluginConfigHash;
113
+ const confirmed = await this.requestConfirmDialog({ title: this.t('ecosystem.rollback'),
114
+ message: this.t('ecosystem.rollbackConfirm'), confirmText: this.t('ecosystem.rollback'),
115
+ cancelText: this.t('common.cancel'), danger: true });
116
+ if (!confirmed || id !== this.pluginHistorySelectedId || hash !== this.pluginConfigHash || this.pluginConfigSaving) return false;
117
+ try {
118
+ const parsed = JSON.parse(content);
119
+ if (parsed.version !== 1 || !Array.isArray(parsed.templates)) throw new Error(this.t('toast.import.invalidJson'));
120
+ if (!await this.persistPluginTemplates(parsed.templates)) return false;
121
+ const builtins = this.promptTemplatesListRaw.filter((item) => item.isBuiltin === true);
122
+ this.promptTemplatesListRaw = [...builtins, ...parsed.templates];
123
+ if (!persistPromptTemplatesToStorage(this.promptTemplatesListRaw, localStorage)) {
124
+ this.showMessage(this.t('ecosystem.cacheFail'), 'error');
125
+ }
126
+ this.promptTemplateDraftRaw = null;
127
+ this.promptTemplateSelectedId = '';
128
+ const first = this.promptTemplatesList[0];
129
+ if (first) this.selectPromptTemplate(first.id);
130
+ this.promptComposerSelectedTemplateId = first?.id || '';
131
+ await this.openPluginHistory();
132
+ return true;
133
+ } catch (error) { this.pluginHistoryError = error.message; return false; }
134
+ }
135
+ };
136
+ }
@@ -0,0 +1,33 @@
1
+ export async function withRequestDeadline(run, options = {}) {
2
+ const { timeoutMs, signal } = options;
3
+ if (timeoutMs !== undefined && (!Number.isFinite(timeoutMs) || timeoutMs < 0)) {
4
+ throw new TypeError('timeoutMs must be a non-negative finite number');
5
+ }
6
+ if (signal && signal.aborted) throw signal.reason || new Error('请求已取消');
7
+ if (timeoutMs === undefined && !signal) return await run();
8
+
9
+ const controller = new AbortController();
10
+ let timer = null;
11
+ let rejectCanceled;
12
+ const canceled = new Promise((_resolve, reject) => { rejectCanceled = reject; });
13
+ const cancel = (reason) => {
14
+ controller.abort(reason);
15
+ rejectCanceled(reason);
16
+ };
17
+ const onAbort = () => cancel(signal.reason || new Error('请求已取消'));
18
+ if (signal) signal.addEventListener('abort', onAbort, { once: true });
19
+ try {
20
+ const request = run(controller.signal);
21
+ if (timeoutMs !== undefined) {
22
+ timer = setTimeout(() => {
23
+ const error = new Error('timeout');
24
+ error.name = 'TimeoutError';
25
+ cancel(error);
26
+ }, timeoutMs);
27
+ }
28
+ return await Promise.race([request, canceled]);
29
+ } finally {
30
+ if (timer !== null) clearTimeout(timer);
31
+ if (signal) signal.removeEventListener('abort', onAbort);
32
+ }
33
+ }