@evomap/evolver 1.80.7 → 1.80.8

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 (75) hide show
  1. package/README.zh-CN.md +18 -11
  2. package/assets/gep/candidates.jsonl +3 -2
  3. package/index.js +22 -1
  4. package/package.json +1 -1
  5. package/src/config.js +5 -0
  6. package/src/evolve/guards.js +1 -1
  7. package/src/evolve/pipeline/collect.js +1 -1
  8. package/src/evolve/pipeline/dispatch.js +1 -1
  9. package/src/evolve/pipeline/enrich.js +1 -1
  10. package/src/evolve/pipeline/hub.js +1 -1
  11. package/src/evolve/pipeline/select.js +1 -1
  12. package/src/evolve/pipeline/signals.js +1 -1
  13. package/src/evolve/utils.js +1 -1
  14. package/src/evolve.js +1 -1
  15. package/src/gep/.integrity +0 -0
  16. package/src/gep/a2aProtocol.js +1 -1
  17. package/src/gep/assetStore.js +59 -5
  18. package/src/gep/candidateEval.js +1 -1
  19. package/src/gep/candidates.js +1 -1
  20. package/src/gep/contentHash.js +1 -1
  21. package/src/gep/crypto.js +1 -1
  22. package/src/gep/curriculum.js +1 -1
  23. package/src/gep/deviceId.js +1 -1
  24. package/src/gep/envFingerprint.js +1 -1
  25. package/src/gep/epigenetics.js +1 -0
  26. package/src/gep/explore.js +1 -1
  27. package/src/gep/hash.js +1 -0
  28. package/src/gep/hubReview.js +1 -1
  29. package/src/gep/hubSearch.js +1 -1
  30. package/src/gep/hubVerify.js +1 -1
  31. package/src/gep/integrityCheck.js +1 -1
  32. package/src/gep/learningSignals.js +1 -1
  33. package/src/gep/memoryGraph.js +1 -1
  34. package/src/gep/memoryGraphAdapter.js +1 -1
  35. package/src/gep/mutation.js +1 -1
  36. package/src/gep/narrativeMemory.js +1 -1
  37. package/src/gep/personality.js +1 -1
  38. package/src/gep/policyCheck.js +1 -1
  39. package/src/gep/prompt.js +1 -1
  40. package/src/gep/reflection.js +1 -1
  41. package/src/gep/selector.js +1 -1
  42. package/src/gep/shield.js +1 -1
  43. package/src/gep/skillDistiller.js +1 -1
  44. package/src/gep/solidify.js +1 -1
  45. package/src/gep/strategy.js +1 -1
  46. package/src/gep/taskReceiver.js +7 -2
  47. package/src/webui/client/clientJs/assets.js +111 -0
  48. package/src/webui/client/clientJs/bootstrap.js +92 -0
  49. package/src/webui/client/clientJs/common.js +77 -0
  50. package/src/webui/client/clientJs/i18n.js +366 -0
  51. package/src/webui/client/clientJs/index.js +35 -0
  52. package/src/webui/client/clientJs/interactions.js +351 -0
  53. package/src/webui/client/clientJs/overview.js +152 -0
  54. package/src/webui/client/clientJs/personality.js +285 -0
  55. package/src/webui/client/clientJs/pipelines.js +330 -0
  56. package/src/webui/client/indexHtml.js +221 -0
  57. package/src/webui/client/static.js +23 -0
  58. package/src/webui/client/stylesCss.js +639 -0
  59. package/src/webui/client/vendor/README.md +15 -0
  60. package/src/webui/client/vendor/echarts.min.js +45 -0
  61. package/src/webui/index.js +14 -0
  62. package/src/webui/observer/assets.js +146 -0
  63. package/src/webui/observer/index.js +37 -0
  64. package/src/webui/observer/interactions.js +120 -0
  65. package/src/webui/observer/jsonl.js +75 -0
  66. package/src/webui/observer/paths.js +46 -0
  67. package/src/webui/observer/personality.js +43 -0
  68. package/src/webui/observer/pipelineEvents.js +58 -0
  69. package/src/webui/observer/redact.js +63 -0
  70. package/src/webui/observer/runs.js +356 -0
  71. package/src/webui/observer/safety.js +57 -0
  72. package/src/webui/observer/skills.js +70 -0
  73. package/src/webui/observer/status.js +71 -0
  74. package/src/webui/server/http.js +138 -0
  75. package/src/webui/server/routes.js +41 -0
@@ -0,0 +1,366 @@
1
+ 'use strict';
2
+
3
+ // Bilingual (en + zh) string registry + tiny runtime helpers.
4
+ //
5
+ // Design choices (KISS):
6
+ // - One flat dict keyed by stable IDs; every value has both `en` and `zh`.
7
+ // - `t(key)` falls back to the key itself so a missing translation is
8
+ // visible (and harmless) rather than rendering "undefined".
9
+ // - Status / action enum tokens use dedicated tables so backend-emitted
10
+ // identifiers (e.g. "review_pending", "asset_publish") render localized
11
+ // labels but still pass through unknown values unchanged.
12
+ // - DOM-side static text is annotated with data-i18n attributes; one pass
13
+ // over the document on locale change updates everything in place.
14
+ //
15
+ // This module ships as a single string that's concatenated into the
16
+ // browser bundle alongside the other clientJs modules.
17
+
18
+ exports.i18nJs = `
19
+ const I18N_LOCALES = ['en', 'zh'];
20
+ const I18N_DEFAULT = 'en';
21
+ const I18N_STORAGE_KEY = 'evolver-locale';
22
+
23
+ const I18N_DICT = {
24
+ // ---- Chrome ----
25
+ 'brand.eyebrow': { en: 'local agent', zh: '本地智能体' },
26
+ 'sidebar.footer': { en: 'evolves with you', zh: '与你共同进化' },
27
+ 'topbar.eyebrow': { en: 'EvoMap Evolver · Web UI Observability', zh: 'EvoMap Evolver · Web UI 观测台' },
28
+ 'btn.refresh': { en: 'Refresh', zh: '刷新' },
29
+ 'btn.refresh.title': { en: 'Refresh all data', zh: '刷新所有数据' },
30
+ 'btn.theme.title': { en: 'Toggle light / dark theme', zh: '切换浅色 / 深色主题' },
31
+ 'btn.locale.title': { en: 'Switch language (EN / 中)', zh: '切换语言(EN / 中)' },
32
+
33
+ // ---- Nav ----
34
+ 'nav.overview': { en: 'Overview', zh: '总览' },
35
+ 'nav.pipelines': { en: 'Pipelines', zh: '流水线' },
36
+ 'nav.assets': { en: 'Assets', zh: '资产' },
37
+ 'nav.interactions': { en: 'Interactions', zh: '交互' },
38
+ 'nav.personality': { en: 'Personality', zh: '人格' },
39
+
40
+ // ---- Common ----
41
+ 'common.loading': { en: 'Loading...', zh: '加载中...' },
42
+ 'common.none': { en: 'none', zh: '无' },
43
+ 'common.yes': { en: 'yes', zh: '是' },
44
+ 'common.no': { en: 'no', zh: '否' },
45
+ 'common.available': { en: 'available', zh: '可用' },
46
+ 'common.notAvailable': { en: 'not available', zh: '不可用' },
47
+ 'common.running': { en: 'running', zh: '运行中' },
48
+ 'common.notRunning': { en: 'not running', zh: '未运行' },
49
+ 'common.idle': { en: 'idle', zh: '空闲' },
50
+ 'common.dash': { en: '-', zh: '-' },
51
+ 'common.failedPrefix': { en: 'Failed: ', zh: '失败:' },
52
+
53
+ // ---- Overview · Status card ----
54
+ 'overview.card.status': { en: 'Status', zh: '状态' },
55
+ 'overview.card.safety': { en: 'Safety', zh: '安全' },
56
+ 'overview.card.interactions': { en: 'Interactions', zh: '交互' },
57
+ 'overview.card.genesByCategory': { en: 'Genes by Category', zh: '按类别的 Gene' },
58
+ 'overview.card.capsulesByOutcome': { en: 'Capsules by Outcome', zh: '按结果的 Capsule' },
59
+ 'overview.card.assetCalls': { en: 'Asset Calls', zh: '资产调用' },
60
+ 'overview.card.latestRun': { en: 'Latest Pipeline Run', zh: '最近一次流水线运行' },
61
+ 'overview.card.skills': { en: 'Skills', zh: '技能' },
62
+
63
+ 'overview.status.mode': { en: 'Mode', zh: '模式' },
64
+ 'overview.status.proxy': { en: 'Proxy', zh: '代理' },
65
+ 'overview.status.heartbeat': { en: 'Heartbeat', zh: '心跳' },
66
+ 'overview.status.lastRun': { en: 'Last run', zh: '最近运行' },
67
+ 'overview.status.lastActivity': { en: 'Last activity', zh: '最近活动' },
68
+
69
+ 'overview.safety.safeMode': { en: 'Safe mode', zh: '安全模式' },
70
+ 'overview.safety.reviewRequired': { en: 'Review required', zh: '需要审核' },
71
+ 'overview.safety.autobuy': { en: 'Autobuy', zh: '自动购买' },
72
+ 'overview.safety.autoPublish': { en: 'Auto publish', zh: '自动发布' },
73
+ 'overview.safety.validator': { en: 'Validator', zh: '校验器' },
74
+ 'overview.safety.traceLevel': { en: 'Trace level', zh: '追踪等级' },
75
+ 'overview.safety.noWarnings': { en: 'No unsafe automation flags detected.', zh: '未检测到不安全的自动化设置。' },
76
+
77
+ 'overview.interactions.proxy': { en: 'Proxy', zh: '代理' },
78
+ 'overview.interactions.mailbox': { en: 'Mailbox messages', zh: '收件箱消息' },
79
+ 'overview.interactions.taskMetrics': { en: 'Task metrics', zh: '任务指标' },
80
+ 'overview.interactions.sessions': { en: 'Sessions', zh: '会话' },
81
+
82
+ 'overview.run.id': { en: 'Run ID', zh: '运行 ID' },
83
+ 'overview.run.status': { en: 'Status', zh: '状态' },
84
+ 'overview.run.selectedGene': { en: 'Selected Gene', zh: '所选 Gene' },
85
+ 'overview.run.validation': { en: 'Validation', zh: '校验' },
86
+ 'overview.run.updated': { en: 'Updated', zh: '更新时间' },
87
+ 'overview.run.requiresConfirmation': { en: 'Requires confirmation', zh: '需要确认' },
88
+ 'overview.run.empty': { en: 'No runs recorded yet.', zh: '暂无运行记录。' },
89
+
90
+ 'overview.skills.empty': { en: 'No local skills installed yet.', zh: '本地暂未安装任何技能。' },
91
+ 'overview.skills.hint': { en: 'Use <code>evolver fetch --skill=&lt;id&gt;</code> to install one from the Hub.', zh: '使用 <code>evolver fetch --skill=&lt;id&gt;</code> 从 Hub 安装一个技能。' },
92
+ 'overview.skills.files': { en: 'files', zh: '个文件' },
93
+ 'overview.skills.noDoc': { en: 'no doc', zh: '无文档' },
94
+
95
+ 'overview.validation.pass': { en: 'pass', zh: '通过' },
96
+ 'overview.validation.fail': { en: 'fail', zh: '未通过' },
97
+ 'overview.validation.pendingReview': { en: 'pending review', zh: '待审核' },
98
+ 'overview.validation.inProgress': { en: 'in progress', zh: '进行中' },
99
+ 'overview.validation.notRun': { en: 'not run', zh: '未运行' },
100
+
101
+ // ---- Pipelines tab ----
102
+ 'pipelines.card.runs': { en: 'Pipeline Runs', zh: '流水线运行列表' },
103
+ 'pipelines.card.runTrace': { en: 'Run Trace', zh: '运行追踪' },
104
+ 'pipelines.card.scoreTrend': { en: 'Score Trend', zh: '评分趋势' },
105
+ 'pipelines.col.runId': { en: 'Run ID', zh: '运行 ID' },
106
+ 'pipelines.col.status': { en: 'Status', zh: '状态' },
107
+ 'pipelines.col.gene': { en: 'Gene', zh: 'Gene' },
108
+ 'pipelines.col.score': { en: 'Score', zh: '评分' },
109
+ 'pipelines.col.updated': { en: 'Updated', zh: '更新时间' },
110
+ 'pipelines.runs.empty': { en: 'No runs recorded yet.', zh: '暂无运行记录。' },
111
+ 'pipelines.runs.selectHint': { en: 'Select a run to inspect its trace.', zh: '选择一条运行以查看追踪详情。' },
112
+ 'pipelines.runs.loadingTrace': { en: 'Loading trace...', zh: '加载追踪中...' },
113
+ 'pipelines.runs.failedToLoad': { en: 'Failed to load run: ', zh: '加载运行失败:' },
114
+ 'pipelines.timeline': { en: 'Pipeline Timeline', zh: '流水线时间线' },
115
+ 'pipelines.runGraph': { en: 'Run Graph', zh: '运行图谱' },
116
+
117
+ 'pipelines.detail.triggerSignals': { en: 'Trigger signals', zh: '触发信号' },
118
+ 'pipelines.detail.triggerSignals.desc': { en: 'Environment snapshot detected at run start (used to pick a matching Gene). Not errors.', zh: '运行启动时捕获的环境快照(用于挑选合适的 Gene),不代表错误。' },
119
+ 'pipelines.detail.selector': { en: 'Selector reasoning', zh: '选择器推理' },
120
+ 'pipelines.detail.selector.selected': { en: 'Selected', zh: '已选' },
121
+ 'pipelines.detail.selector.path': { en: 'Path', zh: '路径' },
122
+ 'pipelines.detail.selector.memoryUsed': { en: 'Memory used', zh: '使用的记忆' },
123
+
124
+ 'pipelines.detail.mutation': { en: 'Mutation', zh: '变异' },
125
+ 'pipelines.detail.mutation.id': { en: 'ID', zh: 'ID' },
126
+ 'pipelines.detail.mutation.category': { en: 'Category', zh: '类别' },
127
+ 'pipelines.detail.mutation.targetType': { en: 'Target type', zh: '目标类型' },
128
+ 'pipelines.detail.mutation.strategySteps': { en: 'Strategy steps', zh: '策略步骤数' },
129
+ 'pipelines.detail.mutation.triggerSignals': { en: 'Trigger signals', zh: '触发信号' },
130
+
131
+ 'pipelines.detail.validation.title': { en: 'Validation result', zh: '校验结果' },
132
+ 'pipelines.detail.validation.score': { en: 'Score', zh: '评分' },
133
+ 'pipelines.detail.validation.dimensions': { en: 'Dimensions:', zh: '维度:' },
134
+ 'pipelines.detail.validation.observed': { en: 'Observed signals after run:', zh: '运行后观察到的信号:' },
135
+ 'pipelines.detail.validation.predictive': { en: 'Predictive measurements', zh: '预测度量' },
136
+ 'pipelines.detail.validation.validatedAt': { en: 'Validated at ', zh: '校验于 ' },
137
+ 'pipelines.detail.validation.noDimensions': { en: 'no dimensions recorded', zh: '未记录维度' },
138
+ 'pipelines.detail.validation.hint.reviewPending': { en: 'Run is awaiting review confirmation — local validation has not run yet.', zh: '该运行等待审核确认——尚未执行本地校验。' },
139
+ 'pipelines.detail.validation.hint.running': { en: 'Validation will appear here once the solidify phase emits an outcome event.', zh: 'solidify 阶段输出结果事件后,校验信息将显示于此。' },
140
+ 'pipelines.detail.validation.hint.none': { en: 'No validation outcome recorded for this run.', zh: '本次运行没有校验结果记录。' },
141
+
142
+ 'pipelines.dim.stable_no_error': { en: 'Stable (no errors)', zh: '稳定(无错误)' },
143
+ 'pipelines.dim.heuristic_delta': { en: 'Heuristic delta', zh: '启发式增量' },
144
+ 'pipelines.dim.predictive': { en: 'Predictive match', zh: '预测匹配' },
145
+ 'pipelines.dim.failed': { en: 'Failed', zh: '失败' },
146
+ 'pipelines.dim.unstable': { en: 'Unstable', zh: '不稳定' },
147
+
148
+ 'pipelines.detail.blastRadius': { en: 'Blast radius', zh: '影响范围' },
149
+ 'pipelines.detail.blastRadius.files': { en: 'Files', zh: '文件数' },
150
+ 'pipelines.detail.blastRadius.lines': { en: 'Lines', zh: '行数' },
151
+ 'pipelines.detail.blastRadius.risk': { en: 'Risk', zh: '风险等级' },
152
+
153
+ 'pipelines.detail.personalityState': { en: 'Personality at run', zh: '运行时人格' },
154
+ 'pipelines.detail.initialUserPrompt': { en: 'Initial user prompt', zh: '初始用户提示' },
155
+
156
+ 'pipelines.chart.scoreTrend.empty': { en: 'No scored runs yet — runs only get a score after solidify produces an outcome event.', zh: '暂无评分运行——只有 solidify 输出结果事件后,运行才会获得评分。' },
157
+ 'pipelines.chart.scoreTrend.passLine': { en: 'pass ≥0.7', zh: '通过 ≥0.7' },
158
+
159
+ // ---- Assets tab ----
160
+ 'assets.tab.genes': { en: 'Genes', zh: 'Genes' },
161
+ 'assets.tab.capsules': { en: 'Capsules', zh: 'Capsules' },
162
+ 'assets.tab.events': { en: 'Events', zh: 'Events' },
163
+ 'assets.tab.candidates': { en: 'Candidates', zh: '候选项' },
164
+ 'assets.tab.calls': { en: 'Asset Calls', zh: '资产调用' },
165
+
166
+ 'assets.col.id': { en: 'ID', zh: 'ID' },
167
+ 'assets.col.category': { en: 'Category', zh: '类别' },
168
+ 'assets.col.signals': { en: 'Signals', zh: '信号' },
169
+ 'assets.col.strategy': { en: 'Strategy', zh: '策略' },
170
+ 'assets.col.validation': { en: 'Validation', zh: '校验' },
171
+ 'assets.col.gene': { en: 'Gene', zh: 'Gene' },
172
+ 'assets.col.outcome': { en: 'Outcome', zh: '结果' },
173
+ 'assets.col.confidence': { en: 'Confidence', zh: '置信度' },
174
+ 'assets.col.blast': { en: 'Blast', zh: '影响' },
175
+ 'assets.col.source': { en: 'Source', zh: '来源' },
176
+ 'assets.col.assetId': { en: 'Asset ID', zh: '资产 ID' },
177
+ 'assets.col.score': { en: 'Score', zh: '评分' },
178
+ 'assets.col.time': { en: 'Time', zh: '时间' },
179
+ 'assets.col.action': { en: 'Action', zh: '动作' },
180
+ 'assets.col.asset': { en: 'Asset', zh: '资产' },
181
+ 'assets.col.run': { en: 'Run', zh: '运行' },
182
+
183
+ 'assets.records': { en: 'record(s)', zh: '条记录' },
184
+ 'assets.steps': { en: 'steps', zh: '步' },
185
+ 'assets.cmds': { en: 'cmd(s)', zh: '条命令' },
186
+ 'assets.events.signals': { en: 'signals: ', zh: '信号:' },
187
+ 'assets.events.genes': { en: 'genes_used: ', zh: '使用的 Gene:' },
188
+ 'assets.events.outcome': { en: 'outcome: ', zh: '结果:' },
189
+
190
+ 'assets.empty.capsules': { en: 'No capsules yet. Capsules are created after a successful solidify.', zh: '暂无 Capsule。solidify 成功后才会生成 Capsule。' },
191
+ 'assets.empty.events': { en: 'No solidified events yet. Run <code>evolver solidify</code> to produce events.', zh: '暂无 solidified 事件。运行 <code>evolver solidify</code> 即可生成事件。' },
192
+ 'assets.empty.candidates': { en: 'No candidates collected yet.', zh: '暂未收集到候选项。' },
193
+ 'assets.empty.calls': { en: 'No asset calls recorded.', zh: '暂无资产调用记录。' },
194
+
195
+ // ---- Interactions tab ----
196
+ 'interactions.card.hubByAction': { en: 'Hub A2A by Action', zh: '按动作划分的 Hub A2A' },
197
+ 'interactions.card.activity30d': { en: 'Activity (last 30 days)', zh: '活动(近 30 天)' },
198
+ 'interactions.card.mailboxByType': { en: 'Mailbox by Type', zh: '按类型划分的收件箱' },
199
+ 'interactions.card.hubActivity': { en: 'Hub Activity', zh: 'Hub 活动' },
200
+ 'interactions.card.hubActivity.desc': { en: 'Unified timeline of every Hub interaction — connection lifecycle (hello/heartbeat/fetch), asset calls (search/reuse/publish) and ATP credit flows.', zh: '所有 Hub 交互的统一时间线 —— 连接生命周期(hello/heartbeat/fetch)、资产调用(search/reuse/publish)和 ATP 积分流动。' },
201
+ 'interactions.card.agent': { en: 'Agent Interactions', zh: '智能体交互' },
202
+ 'interactions.card.agent.desc': { en: 'Mailbox messages, sessions and DMs (read-only, redacted).', zh: '收件箱消息、会话和私信(只读,已脱敏)。' },
203
+ 'interactions.card.proxySnapshots': { en: 'Proxy Snapshots', zh: '代理快照' },
204
+
205
+ 'interactions.stat.heartbeatHealth': { en: 'Heartbeat health', zh: '心跳健康度' },
206
+ 'interactions.stat.assetHitRate': { en: 'Asset hit rate', zh: '资产命中率' },
207
+ 'interactions.stat.events24h': { en: 'Events (24h)', zh: '事件数(24 小时)' },
208
+ 'interactions.stat.latency': { en: 'Latency p50/p95', zh: '延迟 p50/p95' },
209
+ 'interactions.stat.lastHelloOk': { en: 'Last hello OK', zh: '上次 hello 成功' },
210
+ 'interactions.stat.lastHeartbeatOk': { en: 'Last heartbeat OK', zh: '上次心跳成功' },
211
+
212
+ 'interactions.filter.layer': { en: 'Layer', zh: '层级' },
213
+ 'interactions.filter.all': { en: 'All', zh: '全部' },
214
+ 'interactions.filter.lifecycle': { en: 'Lifecycle', zh: '生命周期' },
215
+ 'interactions.filter.asset': { en: 'Asset', zh: '资产' },
216
+ 'interactions.filter.atp': { en: 'ATP', zh: 'ATP' },
217
+ 'interactions.filter.hideHeartbeats': { en: 'Hide heartbeats', zh: '隐藏心跳' },
218
+
219
+ 'interactions.col.time': { en: 'Time', zh: '时间' },
220
+ 'interactions.col.layer': { en: 'Layer', zh: '层级' },
221
+ 'interactions.col.kind': { en: 'Kind', zh: '类型' },
222
+ 'interactions.col.outcome': { en: 'Outcome', zh: '结果' },
223
+ 'interactions.col.status': { en: 'Status', zh: '状态码' },
224
+ 'interactions.col.latency': { en: 'Latency', zh: '延迟' },
225
+ 'interactions.col.detail': { en: 'Detail', zh: '详情' },
226
+
227
+ 'interactions.empty.filtered': { en: 'No events match the current filters.', zh: '当前过滤条件下无匹配事件。' },
228
+ 'interactions.empty.proxyRunning': { en: 'Proxy is running but no Hub events recorded yet — the next heartbeat tick will populate this table.', zh: '代理正在运行但尚未记录 Hub 事件——下一次心跳会填充此表。' },
229
+ 'interactions.empty.noProxy': { en: 'No Hub activity recorded yet. Hello/heartbeat/ATP events are produced by the proxy daemon — start it with <code>evolver run</code> (or <code>evolver fetch &lt;asset&gt;</code> to log a one-shot fetch).', zh: '尚未记录任何 Hub 活动。hello/heartbeat/ATP 事件由代理守护进程生成——使用 <code>evolver run</code> 启动它(或用 <code>evolver fetch &lt;asset&gt;</code> 触发一次抓取)。' },
230
+ 'interactions.empty.noAgent': { en: 'No agent interactions yet.', zh: '暂无智能体交互记录。' },
231
+ 'interactions.empty.proxyNotRunning': { en: 'Proxy not running. Start <code>evolver run</code> to enable live snapshots.', zh: '代理未运行。运行 <code>evolver run</code> 以启用实时快照。' },
232
+ 'interactions.snapshot.items': { en: 'items', zh: '项' },
233
+ 'interactions.snapshot.fields': { en: 'fields', zh: '字段' },
234
+ 'interactions.snapshot.unavailable': { en: 'unavailable', zh: '不可用' },
235
+
236
+ // ---- Personality tab ----
237
+ 'personality.card.traits': { en: 'Personality Traits', zh: '人格特质' },
238
+ 'personality.card.detail': { en: 'Personality Detail', zh: '人格详情' },
239
+ 'personality.card.memoryGraph': { en: 'Memory Graph (last 100 events)', zh: '记忆图谱(最近 100 条事件)' },
240
+ 'personality.empty.chart': { en: 'No personality data yet.', zh: '暂无人格数据。' },
241
+ 'personality.empty.detail': { en: 'No personality data recorded yet.', zh: '暂未记录人格数据。' },
242
+ 'personality.empty.graph': { en: 'No memory graph events yet.', zh: '暂无记忆图谱事件。' },
243
+ 'personality.tooltip.kind': { en: 'Kind', zh: '类型' },
244
+ 'personality.tooltip.time': { en: 'Time', zh: '时间' },
245
+ 'personality.tooltip.eventId': { en: 'Event ID', zh: '事件 ID' },
246
+ 'personality.tooltip.gene': { en: 'Gene', zh: 'Gene' },
247
+ 'personality.tooltip.signals': { en: 'Signals', zh: '信号' },
248
+ 'personality.tooltip.outcome': { en: 'Outcome', zh: '结果' },
249
+ 'personality.tooltip.score': { en: 'Score', zh: '评分' },
250
+ 'personality.tooltip.mutation': { en: 'Mutation', zh: '变异' },
251
+ 'personality.tooltip.geneId': { en: 'Gene ID', zh: 'Gene ID' },
252
+ 'personality.tooltip.category': { en: 'Category', zh: '类别' },
253
+ 'personality.tooltip.signal': { en: 'Signal', zh: '信号' },
254
+ 'personality.tooltip.status': { en: 'Status', zh: '状态' },
255
+ 'personality.tooltip.lastScore': { en: 'Last score', zh: '上次评分' },
256
+ 'personality.tooltip.referenced': { en: 'Referenced', zh: '被引用' },
257
+ 'personality.tooltip.referencedTimes': { en: 'times', zh: '次' },
258
+ 'personality.cat.event': { en: 'Event', zh: '事件' },
259
+ 'personality.cat.gene': { en: 'Gene', zh: 'Gene' },
260
+ 'personality.cat.signal': { en: 'Signal', zh: '信号' },
261
+ 'personality.cat.outcome': { en: 'Outcome', zh: '结果' },
262
+ 'personality.cat.mutation': { en: 'Mutation', zh: '变异' },
263
+ 'personality.cat.asset': { en: 'Asset', zh: '资产' },
264
+ 'personality.cat.run': { en: 'Run', zh: '运行' },
265
+ };
266
+
267
+ // Status / outcome enum tokens — keep raw key as fallback so unknown
268
+ // statuses still render rather than disappearing.
269
+ const I18N_STATUS = {
270
+ success: { en: 'success', zh: '成功' },
271
+ completed: { en: 'completed', zh: '已完成' },
272
+ running: { en: 'running', zh: '运行中' },
273
+ pending: { en: 'pending', zh: '待处理' },
274
+ failed: { en: 'failed', zh: '失败' },
275
+ blocked: { en: 'blocked', zh: '已阻塞' },
276
+ review_pending: { en: 'review pending', zh: '待审核' },
277
+ abandoned: { en: 'abandoned', zh: '已废弃' },
278
+ selected: { en: 'selected', zh: '已选择' },
279
+ skipped: { en: 'skipped', zh: '已跳过' },
280
+ unknown: { en: 'unknown', zh: '未知' },
281
+ ok: { en: 'ok', zh: '正常' },
282
+ recovered: { en: 'recovered', zh: '已恢复' },
283
+ miss: { en: 'miss', zh: '未命中' },
284
+ };
285
+
286
+ // Hub event "kind" tokens (asset action / lifecycle kind / ATP order kind)
287
+ const I18N_ACTION = {
288
+ // Asset actions
289
+ asset_publish: { en: 'asset_publish', zh: '发布资产' },
290
+ asset_reuse: { en: 'asset_reuse', zh: '复用资产' },
291
+ asset_reference: { en: 'asset_reference', zh: '引用资产' },
292
+ hub_search_hit: { en: 'hub_search_hit', zh: 'Hub 命中' },
293
+ hub_search_miss: { en: 'hub_search_miss', zh: 'Hub 未命中' },
294
+ hub_search_skip: { en: 'hub_search_skip', zh: 'Hub 跳过' },
295
+ // Lifecycle kinds
296
+ hello: { en: 'hello', zh: '握手' },
297
+ heartbeat: { en: 'heartbeat', zh: '心跳' },
298
+ fetch: { en: 'fetch', zh: '抓取' },
299
+ // Layers (used in pill labels)
300
+ lifecycle: { en: 'lifecycle', zh: '生命周期' },
301
+ asset: { en: 'asset', zh: '资产' },
302
+ atp: { en: 'atp', zh: 'ATP' },
303
+ };
304
+
305
+ function getLocale() {
306
+ try {
307
+ const v = localStorage.getItem(I18N_STORAGE_KEY);
308
+ if (v && I18N_LOCALES.indexOf(v) !== -1) return v;
309
+ } catch (_) {}
310
+ return I18N_DEFAULT;
311
+ }
312
+
313
+ function setLocale(loc) {
314
+ if (I18N_LOCALES.indexOf(loc) === -1) return;
315
+ try { localStorage.setItem(I18N_STORAGE_KEY, loc); } catch (_) {}
316
+ document.documentElement.setAttribute('data-locale', loc);
317
+ document.documentElement.lang = loc === 'zh' ? 'zh-CN' : 'en';
318
+ }
319
+
320
+ function t(key, fallback) {
321
+ const entry = I18N_DICT[key];
322
+ if (!entry) return fallback != null ? fallback : key;
323
+ return entry[getLocale()] || entry.en || key;
324
+ }
325
+
326
+ function tStatus(token) {
327
+ if (!token) return '-';
328
+ const entry = I18N_STATUS[token];
329
+ if (!entry) return token;
330
+ return entry[getLocale()] || entry.en || token;
331
+ }
332
+
333
+ function tAction(token) {
334
+ if (!token) return '-';
335
+ const entry = I18N_ACTION[token];
336
+ if (!entry) return token;
337
+ return entry[getLocale()] || entry.en || token;
338
+ }
339
+
340
+ // Apply data-i18n attributes to the live DOM.
341
+ // data-i18n="key" → set textContent
342
+ // data-i18n-html="key" → set innerHTML (use sparingly; only
343
+ // for strings in the dict that
344
+ // intentionally contain markup like
345
+ // <code>)
346
+ // data-i18n-attr-<name>="key" → set attribute (e.g. title)
347
+ function applyI18nDom(root) {
348
+ const scope = root || document;
349
+ scope.querySelectorAll('[data-i18n]').forEach((el) => {
350
+ const key = el.getAttribute('data-i18n');
351
+ el.textContent = t(key);
352
+ });
353
+ scope.querySelectorAll('[data-i18n-html]').forEach((el) => {
354
+ const key = el.getAttribute('data-i18n-html');
355
+ el.innerHTML = t(key);
356
+ });
357
+ scope.querySelectorAll('*').forEach((el) => {
358
+ for (const attr of el.attributes) {
359
+ if (attr.name.indexOf('data-i18n-attr-') === 0) {
360
+ const targetAttr = attr.name.slice('data-i18n-attr-'.length);
361
+ el.setAttribute(targetAttr, t(attr.value));
362
+ }
363
+ }
364
+ });
365
+ }
366
+ `;
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ const { i18nJs } = require('./i18n');
4
+ const { commonJs } = require('./common');
5
+ const { overviewJs } = require('./overview');
6
+ const { pipelinesJs } = require('./pipelines');
7
+ const { assetsJs } = require('./assets');
8
+ const { interactionsJs } = require('./interactions');
9
+ const { personalityJs } = require('./personality');
10
+ const { bootstrapJs } = require('./bootstrap');
11
+
12
+ const SECTION_HEADERS = {
13
+ i18n: '// ---- i18n (locale registry + runtime) ----',
14
+ overview: '// ---- Overview ----',
15
+ pipelines: '// ---- Pipelines ----',
16
+ assets: '// ---- Assets ----',
17
+ interactions: '// ---- Interactions (Hub Activity unified timeline + Agent) ----',
18
+ personality: '// ---- Personality ----',
19
+ bootstrap: '// ---- Tabs ----',
20
+ };
21
+
22
+ function getClientJs() {
23
+ return [
24
+ SECTION_HEADERS.i18n, i18nJs,
25
+ commonJs,
26
+ SECTION_HEADERS.overview, overviewJs,
27
+ SECTION_HEADERS.pipelines, pipelinesJs,
28
+ SECTION_HEADERS.assets, assetsJs,
29
+ SECTION_HEADERS.interactions, interactionsJs,
30
+ SECTION_HEADERS.personality, personalityJs,
31
+ SECTION_HEADERS.bootstrap, bootstrapJs,
32
+ ].join('\n');
33
+ }
34
+
35
+ module.exports = { getClientJs };