dsh-agent-control-center 0.1.0 → 0.3.0

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 (56) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +217 -83
  3. package/README.zh.md +159 -58
  4. package/client.js +7660 -2005
  5. package/cordis.patch.yml +5 -0
  6. package/docs/01-CONTRACT.md +3 -2
  7. package/docs/05-ACCEPTANCE-EVIDENCE.md +81 -0
  8. package/docs/06-UX-OPTIMIZATION.md +57 -0
  9. package/docs/07-GUIDE.md +327 -0
  10. package/docs/08-COMPATIBILITY.md +202 -0
  11. package/docs/09-ARCHITECTURE.md +333 -0
  12. package/docs/ROADMAP.md +448 -0
  13. package/index.js +67 -2
  14. package/lib/core/cache.js +277 -0
  15. package/lib/core/compat.js +877 -0
  16. package/lib/core/errors.js +14 -1
  17. package/lib/core/http.js +22 -0
  18. package/lib/core/index.js +53 -2
  19. package/lib/core/paths.js +6 -0
  20. package/lib/core/registry.js +21 -5
  21. package/lib/core/util.js +4 -1
  22. package/lib/modules/a-agents.js +104 -4
  23. package/lib/modules/b-tools.js +169 -26
  24. package/lib/modules/f-diagnostics.js +109 -17
  25. package/lib/modules/g-templates.js +18 -0
  26. package/lib/modules/i-recovery.js +84 -23
  27. package/lib/modules/j-instruction.js +624 -0
  28. package/lib/modules/k-export.js +540 -0
  29. package/package.json +1 -1
  30. package/scripts/release.mjs +81 -0
  31. package/scripts/verify.mjs +12 -0
  32. package/src/client/app.js +684 -118
  33. package/src/client/i18n/agents.js +96 -0
  34. package/src/client/i18n/common.js +36 -0
  35. package/src/client/i18n/diagnostics.js +52 -0
  36. package/src/client/i18n/export.js +174 -0
  37. package/src/client/i18n/instruction.js +236 -0
  38. package/src/client/i18n/meta.js +72 -0
  39. package/src/client/i18n/overview.js +38 -0
  40. package/src/client/i18n/recovery.js +66 -0
  41. package/src/client/i18n/sessions.js +64 -0
  42. package/src/client/i18n/templates.js +88 -0
  43. package/src/client/i18n/tools.js +96 -0
  44. package/src/client/i18n/usage.js +42 -0
  45. package/src/client/kernel.js +327 -40
  46. package/src/client/pages/agents.js +637 -354
  47. package/src/client/pages/diagnostics.js +526 -177
  48. package/src/client/pages/export.js +664 -0
  49. package/src/client/pages/instruction.js +648 -0
  50. package/src/client/pages/meta.js +553 -193
  51. package/src/client/pages/overview.js +255 -34
  52. package/src/client/pages/recovery.js +332 -131
  53. package/src/client/pages/sessions.js +470 -307
  54. package/src/client/pages/templates.js +691 -381
  55. package/src/client/pages/tools.js +559 -206
  56. package/src/client/pages/usage.js +235 -57
@@ -97,6 +97,50 @@ ACC.addI18n({
97
97
  'templates.form.variablesNote': '变量由内容中的 {{name}} 占位符自动推导',
98
98
  'templates.form.invalid': '请补全必填项',
99
99
  'templates.readonlyUser': '用户模板可在自有目录中修改',
100
+ 'templates.copied': '已复制',
101
+ 'templates.copyFailed': '复制失败(浏览器未授权剪贴板)',
102
+ 'templates.copy': '复制',
103
+ 'templates.copyContent': '复制内容',
104
+ 'templates.diffClipped': '差异过长,仅显示前 {shown} / {total} 行',
105
+ 'templates.varAutoHint': '由宿主自动填充,不需要手填',
106
+ 'templates.varPlaceholder': '填入替换值',
107
+ 'templates.varRequired': '必填:留空会导致渲染缺变量',
108
+ 'templates.varRequiredCount': '还有 {count} 个变量没有填写,填写后才能渲染与应用。',
109
+ 'templates.varMissingHint': '内容里用到但未在模板变量中声明',
110
+ 'templates.varsTitle': '变量',
111
+ 'templates.viewLabel': '源码 / 渲染视图',
112
+ 'templates.renderedEmpty': '尚未渲染',
113
+ 'templates.renderedEmptyHint': '填好变量后点「渲染」即可查看替换结果。',
114
+ 'templates.previewTitle': '模板内容',
115
+ 'templates.collapse': '收起',
116
+ 'templates.collapseHint': '收起预览(Esc)',
117
+ 'templates.conflictTitle': '写入冲突(409)',
118
+ 'templates.conflictHint': '目标文件在你预览之后被其它进程修改了。重新预览会基于最新内容重算差异;应用时不会覆盖未经确认的改动。',
119
+ 'templates.writable': '可写入',
120
+ 'templates.backup': '备份',
121
+ 'templates.applySafety': '应用会先备份当前文件;若文件在此期间被修改则返回冲突而不会覆盖。',
122
+ 'templates.selectHint': '点击上方模板查看源码 / 渲染双视图与变量表单。',
123
+ 'templates.clearFilters': '清空筛选',
124
+ 'templates.openPreview': '查看模板',
125
+ 'templates.exportHint': '导出只包含该模板自身内容,不含任何凭据或宿主机密信息。',
126
+ 'templates.downloaded': '已开始下载',
127
+ 'templates.refreshList': '刷新模板列表',
128
+ 'templates.deleting': '正在删除…',
129
+ 'templates.deleteCta': '永久删除该模板',
130
+ 'templates.deleteScope': '只从插件自有模板目录删除;已按此模板写入的 AGENTS.md 不会被回滚。',
131
+ 'templates.importParseFailed': '导入内容不是合法 JSON',
132
+ 'templates.importDocument': '模板 JSON 文档',
133
+ 'templates.importOverwriteHint': '同 ID 的已有用户模板会被覆盖;内置模板不受影响。',
134
+ 'templates.saveEdit': '保存修改',
135
+ 'templates.saveCreate': '创建模板',
136
+ 'templates.form.idInvalid': 'ID 只能包含字母、数字、点、下划线和连字符(2–64 位)',
137
+ 'templates.form.required': '必填',
138
+ 'templates.confirmApplyTo': '写入 {path}(会先备份)',
139
+ 'templates.selectTitle': '还没有选中模板',
140
+ 'templates.selectBrowseAll': '显示全部分类',
141
+ 'templates.createFirst': '从空白创建第一个模板',
142
+ 'templates.problemGeneric': '部分模板读取失败,原始说明见折叠区。',
143
+ 'templates.rawHostText': '宿主原始文本(英文界面下默认收起)',
100
144
  },
101
145
  en: {
102
146
  'nav.templates': 'Templates',
@@ -196,5 +240,49 @@ ACC.addI18n({
196
240
  'templates.form.variablesNote': 'Variables are derived from the {{name}} placeholders in the content',
197
241
  'templates.form.invalid': 'Fill in the required fields',
198
242
  'templates.readonlyUser': 'User templates can be edited in the plugin\'s own directory',
243
+ 'templates.copied': 'Copied',
244
+ 'templates.copyFailed': 'Copy failed (clipboard not permitted)',
245
+ 'templates.copy': 'Copy',
246
+ 'templates.copyContent': 'Copy content',
247
+ 'templates.diffClipped': 'Diff is long: showing the first {shown} of {total} lines',
248
+ 'templates.varAutoHint': 'Filled in by the host; nothing to type',
249
+ 'templates.varPlaceholder': 'Replacement value',
250
+ 'templates.varRequired': 'Required: leaving it empty renders a missing variable',
251
+ 'templates.varRequiredCount': '{count} variables are still empty; fill them in to render and apply.',
252
+ 'templates.varMissingHint': 'Used by the content but not declared in the template variables',
253
+ 'templates.varsTitle': 'Variables',
254
+ 'templates.viewLabel': 'Source / rendered view',
255
+ 'templates.renderedEmpty': 'Not rendered yet',
256
+ 'templates.renderedEmptyHint': 'Fill in the variables, then press Render to see the substituted text.',
257
+ 'templates.previewTitle': 'Template content',
258
+ 'templates.collapse': 'Collapse',
259
+ 'templates.collapseHint': 'Collapse the preview (Esc)',
260
+ 'templates.conflictTitle': 'Write conflict (409)',
261
+ 'templates.conflictHint': 'The target file changed after your preview. Previewing again recomputes the diff from the latest content; applying never overwrites an unconfirmed change.',
262
+ 'templates.writable': 'Writable',
263
+ 'templates.backup': 'Backup',
264
+ 'templates.applySafety': 'Applying backs up the current file first; if the file changed in between, the write returns a conflict instead of overwriting.',
265
+ 'templates.selectHint': 'Pick a template above to see the source/rendered views and its variable form.',
266
+ 'templates.clearFilters': 'Clear filters',
267
+ 'templates.openPreview': 'Open template',
268
+ 'templates.exportHint': 'The export contains this template only — no credentials or host secrets.',
269
+ 'templates.downloaded': 'Download started',
270
+ 'templates.refreshList': 'Refresh the template list',
271
+ 'templates.deleting': 'Deleting…',
272
+ 'templates.deleteCta': 'Delete this template permanently',
273
+ 'templates.deleteScope': 'Only removed from the plugin-owned template directory; an AGENTS.md already written from it is not rolled back.',
274
+ 'templates.importParseFailed': 'The imported text is not valid JSON',
275
+ 'templates.importDocument': 'Template JSON document',
276
+ 'templates.importOverwriteHint': 'An existing user template with the same ID is overwritten; built-in templates are unaffected.',
277
+ 'templates.saveEdit': 'Save changes',
278
+ 'templates.saveCreate': 'Create template',
279
+ 'templates.form.idInvalid': 'The ID may contain letters, digits, dots, underscores and hyphens (2–64)',
280
+ 'templates.form.required': 'Required',
281
+ 'templates.confirmApplyTo': 'Write to {path} (backs up first)',
282
+ 'templates.selectTitle': 'No template selected yet',
283
+ 'templates.selectBrowseAll': 'Show all categories',
284
+ 'templates.createFirst': 'Create the first template from scratch',
285
+ 'templates.problemGeneric': 'Some templates could not be read; the original text is folded below.',
286
+ 'templates.rawHostText': 'Raw host text (collapsed in the English UI)',
199
287
  },
200
288
  })
@@ -112,6 +112,54 @@ ACC.addI18n({
112
112
  'tools.outputSchema': '输出 JSON Schema',
113
113
  'tools.schemaUnavailable': '当前注册表没有该名称,schema 不可用',
114
114
  'tools.schemaTruncated': 'Schema 已截断(详见字节数)',
115
+ 'tools.clusterShare': '占窗口内失败调用的 {percent}%({count} 次)',
116
+ 'tools.clusterShareLabel': '占比',
117
+ 'tools.errorsTotal': '窗口内失败 {count} 次',
118
+ 'tools.copy': '复制',
119
+ 'tools.copied': '已复制',
120
+ 'tools.copyFailed': '复制失败(浏览器未授权剪贴板)',
121
+ 'tools.copySamples': '复制全部样本',
122
+ 'tools.copySchema': '复制 Schema',
123
+ 'tools.closeDetail': '收起详情',
124
+ 'tools.closeDetailHint': '收起详情(Esc)',
125
+ 'tools.expandDetail': '展开详情',
126
+ 'tools.collapseDetail': '收起详情',
127
+ 'tools.sectionStatus': '状态与来源',
128
+ 'tools.sectionDefinition': '定义与静态检查',
129
+ 'tools.sectionVisibility': '可见性明细',
130
+ 'tools.sectionHistory': '历史调用',
131
+ 'tools.historyNoErrorState': '历史事件不含错误状态字段,无法细分错误类型;本页只按「配对成功/失败」统计。',
132
+ 'tools.redactionNote': '失败样本已由宿主脱敏:只保留时间、工具名与错误摘要,不含参数或输出正文。',
133
+ 'tools.registrySummary': '注册表摘要',
134
+ 'tools.registryBadge': '全局注册 {count}',
135
+ 'tools.liveAgentBadge': '活跃 Agent {count}',
136
+ 'tools.resultsCount': '显示 {shown} / 共 {total}',
137
+ 'tools.layersSummary': '已注册 {registered} · 对 Agent 可见 {visible} · 历史调用 {called}',
138
+ 'tools.clearFilters': '清空筛选',
139
+ 'tools.historyUnavailableShort': '历史统计不可用',
140
+ 'tools.registeredShort': '已注册',
141
+ 'tools.visibleShort': '可见',
142
+ 'tools.calledShort': '调用过',
143
+ 'tools.rawHostText': '宿主原始文本(英文界面下默认收起)',
144
+ 'tools.aboutTitle': '关于三层状态与本页口径',
145
+ 'tools.aboutSummary': '状态定义、不探活说明与宿主附注',
146
+ 'tools.hostNotesFold': '宿主附注已收起到折叠区。',
147
+ 'tools.basisGeneric': '可见性依据由宿主提供,已收起到折叠区。',
148
+ 'tools.definitionUnavailable': '当前注册表没有该名称,定义不可读(仅存在于历史事件)。',
149
+ 'tools.historyUnavailableReason': '历史统计不可用。',
150
+ 'tools.errorStateReason': '历史事件不含错误状态字段。',
151
+ 'tools.sampleFolded': '错误摘要为宿主原文,已收起',
152
+ 'tools.refreshList': '刷新工具清单',
153
+ 'tools.copySamplesAria': '复制全部失败样本',
154
+ 'tools.issue.description_missing': 'description 为空',
155
+ 'tools.issue.parameters_missing': 'parameters 不是 JSON Schema 对象',
156
+ 'tools.issue.parameters_type_invalid': 'parameters.type 不是 object',
157
+ 'tools.issue.properties_invalid': 'parameters.properties 不是对象',
158
+ 'tools.issue.parameters_not_serializable': 'parameters 无法 JSON 序列化',
159
+ 'tools.issue.execute_missing': '定义缺少 execute 函数',
160
+ 'tools.issue.output_missing': '定义缺少 output 声明',
161
+ 'tools.issue.output_schema_missing': 'output.schema 缺失',
162
+ 'tools.issue.output_render_missing': 'output.render 缺失',
115
163
  },
116
164
  en: {
117
165
  'nav.tools': 'Tools',
@@ -226,5 +274,53 @@ ACC.addI18n({
226
274
  'tools.outputSchema': 'Output JSON Schema',
227
275
  'tools.schemaUnavailable': 'The registry has no such name, so the schema is unavailable',
228
276
  'tools.schemaTruncated': 'Schema truncated (see byte count)',
277
+ 'tools.clusterShare': '{percent}% of the failed calls in this window ({count})',
278
+ 'tools.clusterShareLabel': 'Share',
279
+ 'tools.errorsTotal': '{count} failed calls in this window',
280
+ 'tools.copy': 'Copy',
281
+ 'tools.copied': 'Copied',
282
+ 'tools.copyFailed': 'Copy failed (clipboard not permitted)',
283
+ 'tools.copySamples': 'Copy all samples',
284
+ 'tools.copySchema': 'Copy schema',
285
+ 'tools.closeDetail': 'Collapse details',
286
+ 'tools.closeDetailHint': 'Collapse details (Esc)',
287
+ 'tools.expandDetail': 'Expand details',
288
+ 'tools.collapseDetail': 'Collapse details',
289
+ 'tools.sectionStatus': 'Status and source',
290
+ 'tools.sectionDefinition': 'Definition and static checks',
291
+ 'tools.sectionVisibility': 'Visibility details',
292
+ 'tools.sectionHistory': 'Call history',
293
+ 'tools.historyNoErrorState': 'History events carry no error-state field, so error kinds cannot be split; this page only pairs success and failure.',
294
+ 'tools.redactionNote': 'Failure samples are redacted by the host: only time, tool name and error summary are kept — no arguments or output.',
295
+ 'tools.registrySummary': 'Registry summary',
296
+ 'tools.registryBadge': 'Global registrations {count}',
297
+ 'tools.liveAgentBadge': 'Live Agents {count}',
298
+ 'tools.resultsCount': 'Showing {shown} of {total}',
299
+ 'tools.layersSummary': 'Registered {registered} · visible to Agent {visible} · called in history {called}',
300
+ 'tools.clearFilters': 'Clear filters',
301
+ 'tools.historyUnavailableShort': 'Call history unavailable',
302
+ 'tools.registeredShort': 'registered',
303
+ 'tools.visibleShort': 'visible',
304
+ 'tools.calledShort': 'called',
305
+ 'tools.rawHostText': 'Raw host text (collapsed in the English UI)',
306
+ 'tools.aboutTitle': 'About the three status layers',
307
+ 'tools.aboutSummary': 'status definitions, no-probe note and host notes',
308
+ 'tools.hostNotesFold': 'Host notes are folded below.',
309
+ 'tools.basisGeneric': 'The visibility basis is provided by the host; it is folded below.',
310
+ 'tools.definitionUnavailable': 'The registry has no such name, so the definition is unreadable (it only appears in history).',
311
+ 'tools.historyUnavailableReason': 'Call history unavailable.',
312
+ 'tools.errorStateReason': 'History events carry no error-state field.',
313
+ 'tools.sampleFolded': 'The error summary is host text; it is folded below',
314
+ 'tools.refreshList': 'Refresh the tool list',
315
+ 'tools.copySamplesAria': 'Copy every failure sample',
316
+ 'tools.issue.description_missing': 'description is empty',
317
+ 'tools.issue.parameters_missing': 'parameters is not a JSON Schema object',
318
+ 'tools.issue.parameters_type_invalid': 'parameters.type is not object',
319
+ 'tools.issue.properties_invalid': 'parameters.properties is not an object',
320
+ 'tools.issue.parameters_not_serializable': 'parameters cannot be serialized to JSON',
321
+ 'tools.issue.execute_missing': 'the definition has no execute function',
322
+ 'tools.issue.output_missing': 'the definition has no output declaration',
323
+ 'tools.issue.output_schema_missing': 'output.schema is missing',
324
+ 'tools.issue.output_render_missing': 'output.render is missing',
229
325
  },
230
326
  })
@@ -2,6 +2,7 @@ ACC.addI18n({
2
2
  zh: {
3
3
  'nav.usage': '使用统计',
4
4
  'usage.title': '使用统计',
5
+ 'usage.cardTitle': '用量概览',
5
6
  'usage.description': '从会话事件里的真实 token 用量聚合:本地日 → provider → model,重启与重复回放都不会重复计数。',
6
7
 
7
8
  'usage.switch': '统计开关',
@@ -73,10 +74,31 @@ ACC.addI18n({
73
74
 
74
75
  'usage.unknownProvider': '未知路由',
75
76
  'usage.unknownTag': 'unknown(未识别)',
77
+ 'usage.datePrev': '前一天',
78
+ 'usage.dateNext': '后一天',
79
+ 'usage.dateToday': '回到今天',
80
+ 'usage.dateEdge': '已经到可选范围边界',
81
+ 'usage.dateHint': '只列出有用量记录的日期,按月份分组',
82
+ 'usage.share': '占比',
83
+ 'usage.tzNote': '按本地日({tz})归集',
84
+ 'usage.windowTotals': '窗口合计 {tokens} tokens · {calls} 次调用 · 有数据 {days} 天',
85
+ 'usage.dailyAria': '近 {days} 天每日 tokens 分布',
86
+ 'usage.dailyPoint': '{date}:{tokens} tokens · {calls} 次调用',
87
+ 'usage.dailyEmpty': '{date}:该日没有用量记录',
88
+ 'usage.dayNoData': '{date} 没有用量记录',
89
+ 'usage.dayNoDataHint': '换一个日期,或先在宿主里跑一次会话产生用量;下方 30 天窗口不受影响。',
90
+ 'usage.caliberSummary': '计费输入 = 未缓存输入 + 缓存读 + 缓存写;tokens 按本地日归集。',
91
+ 'usage.caliberToggle': '展开完整口径说明',
92
+ 'usage.consistencyWarn': '台账中有 {count} 个非法日期键已被忽略(可能是手工改坏或版本不匹配)。',
93
+ 'usage.toggleFailed': '切换统计开关失败',
94
+ 'usage.sinceReasonGeneric': '宿主无法回放历史事件,统计从可回放的时间点开始。',
95
+ 'usage.rawHostText': '宿主原始文本(英文界面下默认收起)',
96
+ 'usage.refreshUsage': '刷新用量统计',
76
97
  },
77
98
  en: {
78
99
  'nav.usage': 'Usage',
79
100
  'usage.title': 'Usage',
101
+ 'usage.cardTitle': 'Usage overview',
80
102
  'usage.description': 'Real token usage aggregated from session events: local day → provider → model, with no double counting across restarts or repeated replays.',
81
103
 
82
104
  'usage.switch': 'Collection switch',
@@ -148,5 +170,25 @@ ACC.addI18n({
148
170
 
149
171
  'usage.unknownProvider': 'Unknown route',
150
172
  'usage.unknownTag': 'unknown (unresolved)',
173
+ 'usage.datePrev': 'Previous day',
174
+ 'usage.dateNext': 'Next day',
175
+ 'usage.dateToday': 'Back to today',
176
+ 'usage.dateEdge': 'Already at the edge of the selectable range',
177
+ 'usage.dateHint': 'Only days with records are listed, grouped by month',
178
+ 'usage.share': 'Share',
179
+ 'usage.tzNote': 'Grouped by local day ({tz})',
180
+ 'usage.windowTotals': 'Window total {tokens} tokens · {calls} calls · {days} days with data',
181
+ 'usage.dailyAria': 'Daily token distribution over the last {days} days',
182
+ 'usage.dailyPoint': '{date}: {tokens} tokens · {calls} calls',
183
+ 'usage.dailyEmpty': '{date}: no usage recorded that day',
184
+ 'usage.dayNoData': 'No usage recorded on {date}',
185
+ 'usage.dayNoDataHint': 'Pick another day, or run a session in the host to produce usage. The 30-day window below is unaffected.',
186
+ 'usage.caliberSummary': 'Billed input = uncached input + cache read + cache write; tokens are grouped by local day.',
187
+ 'usage.caliberToggle': 'Show the full accounting definition',
188
+ 'usage.consistencyWarn': '{count} invalid day keys in the ledger were ignored (hand-edited or written by another version).',
189
+ 'usage.toggleFailed': 'Failed to switch usage collection',
190
+ 'usage.sinceReasonGeneric': 'The host cannot replay historical events, so statistics start at the first replayable point.',
191
+ 'usage.rawHostText': 'Raw host text (collapsed in the English UI)',
192
+ 'usage.refreshUsage': 'Refresh usage statistics',
151
193
  },
152
194
  })