dsh-reverse-engine 0.0.0-stage → 0.1.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.
package/client.js ADDED
@@ -0,0 +1,1509 @@
1
+ window.__ModuleLoader__.load({
2
+ id: 'dsh-reverse-engine',
3
+ factory(require) {
4
+ 'use strict'
5
+ const React = require('react')
6
+ const h = React.createElement
7
+ const { useState, useEffect, useCallback, useMemo, useRef } = React
8
+
9
+ const NS = 'reverseEngine'
10
+ const PANEL_ID = 'reverse-engine'
11
+ const API = '/api/rea'
12
+ const POLL_MS = 5000
13
+ const TOAST_MS = 4200
14
+
15
+ const ZH = {
16
+ 'sidebar.label': '逆向工程',
17
+ 'app.title': 'REA 逆向工程',
18
+ 'app.subtitle': '本地分析二进制、应用与运行时行为',
19
+ 'tab.overview': '概览',
20
+ 'tab.tools': '工具',
21
+ 'tab.clients': '客户端',
22
+ 'tab.workflows': '工作流',
23
+ 'tab.settings': '设置',
24
+ 'tab.logs': '日志',
25
+ 'status.ready': '运行中',
26
+ 'status.starting': '启动中',
27
+ 'status.stopped': '已停止',
28
+ 'status.error': '异常',
29
+ 'status.loading': '读取中…',
30
+ 'status.offline': '无法连接 Host',
31
+ 'action.refresh': '刷新',
32
+ 'action.restart': '重启引擎',
33
+ 'action.start': '启动引擎',
34
+ 'action.stop': '停止引擎',
35
+ 'action.copy': '复制',
36
+ 'action.copied': '已复制',
37
+ 'action.run': '执行',
38
+ 'action.running': '执行中…',
39
+ 'action.cancel': '取消',
40
+ 'action.confirm': '确认',
41
+ 'action.close': '关闭',
42
+ 'action.save': '保存',
43
+ 'action.saving': '保存中…',
44
+ 'action.install': '安装',
45
+ 'action.check': '检查',
46
+ 'action.preview': '预览变更',
47
+ 'action.register': '注册',
48
+ 'action.refreshStatus': '重新检测',
49
+ 'action.generate': '生成工作流',
50
+ 'action.fill': '填入示例',
51
+ 'action.clear': '清空',
52
+ 'overview.engine': '引擎',
53
+ 'overview.tools': '工具',
54
+ 'overview.families': '工具族',
55
+ 'overview.node': 'Node.js',
56
+ 'overview.rea': 'REA',
57
+ 'overview.clients': 'Agent 客户端',
58
+ 'overview.skill': '技能',
59
+ 'overview.runtime': '运行时',
60
+ 'overview.dataDir': '数据目录',
61
+ 'overview.mcp': 'MCP 启动命令',
62
+ 'overview.notices': '需要关注',
63
+ 'overview.activity': '最近调用',
64
+ 'overview.activityEmpty': '还没有调用记录。',
65
+ 'overview.logs': '引擎日志',
66
+ 'overview.logsEmpty': '暂无日志。',
67
+ 'overview.providers': '分析引擎',
68
+ 'overview.providersHint': 'Ghidra、IDA、Hopper、Kuna 由用户自行安装配置;插件只读取就绪状态。',
69
+ 'overview.providerEmpty': '点击「检查」读取当前分析引擎就绪情况。',
70
+ 'overview.selected': '当前选择',
71
+ 'overview.installRuntime': '安装 REA 运行时',
72
+ 'overview.installHint': '当前没有找到 rea-agents 包。安装会把固定版本下载到插件数据目录。',
73
+ 'overview.installRunning': '正在安装 REA 运行时…',
74
+ 'overview.installDone': '运行时安装完成。',
75
+ 'overview.installFailed': '运行时安装失败',
76
+ 'overview.skillInstalled': '已安装 v{version}',
77
+ 'overview.skillMissing': '未安装',
78
+ 'overview.skillStale': '需要刷新',
79
+ 'overview.exposure': '工具暴露',
80
+ 'overview.tokens': '约 {tokens} tokens 的 schema',
81
+ 'tools.title': '工具目录',
82
+ 'tools.count': '{count} 个操作',
83
+ 'tools.search': '搜索工具名或描述…',
84
+ 'tools.allFamilies': '全部工具族',
85
+ 'tools.empty': '没有匹配的工具。换一个关键词,或选择其他工具族。',
86
+ 'tools.noSelection': '从左侧选择一个工具,查看参数并执行。',
87
+ 'tools.schema': '输入参数',
88
+ 'tools.args': '参数(JSON)',
89
+ 'tools.argsError': '参数必须是有效的 JSON 对象',
90
+ 'tools.result': '执行结果',
91
+ 'tools.resultEmpty': '执行结果会显示在这里。',
92
+ 'tools.copyCall': '复制 rea_call 示例',
93
+ 'tools.copyCli': '复制 CLI 命令',
94
+ 'tools.family': '工具族',
95
+ 'tools.readOnly': '只读',
96
+ 'tools.destructive': '可能修改目标',
97
+ 'tools.loading': '正在加载工具目录…',
98
+ 'tools.longHint': '原生分析首次导入可能需要数分钟(Ghidra 默认最长 330 秒),请耐心等待。',
99
+ 'clients.title': 'Agent 客户端',
100
+ 'clients.hint': '把同一个本地 REA 引擎注册到其他厂商的 Agent。所有写入都会先预览,再由 REA 备份并合并配置。',
101
+ 'clients.detected': '检测到 {count} 个',
102
+ 'clients.registered': '已注册 {count} 个',
103
+ 'clients.notDetected': '未检测到',
104
+ 'clients.missing': '未注册',
105
+ 'clients.registeredState': '已注册',
106
+ 'clients.stale': '需要刷新',
107
+ 'clients.invalid': '配置失效',
108
+ 'clients.builtin': '本插件已提供',
109
+ 'clients.builtinHint': 'DeepSeek Harness 由本插件直接注册工具,无需再添加 mcp__rea__ 注册。',
110
+ 'clients.registerDetected': '为已检测到的客户端注册',
111
+ 'clients.registerDetectedHint': '运行 rea setup --all-detected,会依次预览并写入每个检测到的客户端。',
112
+ 'clients.skill': 'REA 技能',
113
+ 'clients.skillHint': '把 reverse-engineer-anything 工作流安装到 ~/.agents/skills,供本机所有 Agent 读取。',
114
+ 'clients.skillRefresh': '安装 / 刷新技能',
115
+ 'clients.plan': '变更计划',
116
+ 'clients.planEmpty': '没有返回计划。',
117
+ 'clients.confirmTitle': '确认写入客户端配置?',
118
+ 'clients.confirmBody': '将运行 rea setup --client {client}。REA 会先备份现有配置,再合并 REA 条目;不会覆盖其他设置。',
119
+ 'clients.working': '正在处理配置…',
120
+ 'clients.noDetected': '当前没有检测到其他已安装的客户端。安装对应 CLI 后重新检测。',
121
+ 'clients.configPath': '配置文件',
122
+ 'clients.search': '搜索客户端…',
123
+ 'workflows.title': '引导式工作流',
124
+ 'workflows.hint': 'REA 内置的调查流程。生成后可复制到会话里,按步骤驱动工具。',
125
+ 'workflows.args': '参数(JSON)',
126
+ 'workflows.result': '工作流内容',
127
+ 'workflows.empty': '选择一个工作流并生成内容。',
128
+ 'workflows.argumentsTitle': '参数',
129
+ 'settings.title': '设置',
130
+ 'settings.runtime': '运行时路径',
131
+ 'settings.reaPath': 'rea-agents 包路径',
132
+ 'settings.reaPathHint': '留空自动查找:插件依赖、数据目录运行时、全局 npm 安装。',
133
+ 'settings.nodePath': 'Node.js 可执行文件',
134
+ 'settings.nodePathHint': 'REA 需要 Node.js 22.23.4+ / 24.22.1+ / 26.12.1+;DSH 桌面内置的 Node 版本可能不满足。',
135
+ 'settings.exposure': '工具暴露',
136
+ 'settings.exposureCore': '核心工具(推荐)',
137
+ 'settings.exposureCoreHint': '直接注册 11 个核心工具;其余通过 rea_tools / rea_call 访问。',
138
+ 'settings.exposureFamilies': '按工具族',
139
+ 'settings.exposureFamiliesHint': '只注册所选工具族中的全部工具。',
140
+ 'settings.exposureAll': '全部 274 个工具',
141
+ 'settings.exposureAllHint': '全部 schema 会进入每次请求,消耗大量上下文;仅在明确需要时使用。',
142
+ 'settings.families': '工具族',
143
+ 'settings.timeouts': '超时',
144
+ 'settings.callTimeout': '单次工具调用(毫秒)',
145
+ 'settings.startupTimeout': '启动与目录读取(毫秒)',
146
+ 'settings.connectOnStart': '加载插件时自动启动引擎',
147
+ 'settings.http': 'HTTP MCP 端点',
148
+ 'settings.httpHint': '给无法启动 stdio 子进程的 Agent 使用。端点无认证,默认只监听 127.0.0.1,一次只服务一个客户端。',
149
+ 'settings.httpEnable': '启用 HTTP 端点',
150
+ 'settings.httpHost': '监听地址',
151
+ 'settings.httpPort': '端口(0 表示随机)',
152
+ 'settings.httpUrl': '端点 URL',
153
+ 'settings.env': '分析引擎环境变量',
154
+ 'settings.envHint': '每行 KEY=VALUE,例如 GHIDRA_INSTALL_DIR=D:\\ghidra。只接受 REA_*、GHIDRA_INSTALL_DIR、HOPPER_LAUNCHER_PATH、JAVA_HOME 等白名单变量。',
155
+ 'settings.saved': '设置已保存。',
156
+ 'settings.restartNeeded': '运行时或暴露范围变化后,工具会重新注册。',
157
+ 'settings.nodeWarning': '当前 Node.js 不满足 REA 要求:{reason}',
158
+ 'logs.title': '日志',
159
+ 'logs.activity': '调用记录',
160
+ 'logs.events': '引擎事件',
161
+ 'logs.stderr': 'stderr',
162
+ 'logs.empty': '暂无日志。',
163
+ 'logs.copy': '复制日志',
164
+ 'error.title': '操作失败',
165
+ 'error.retry': '重试',
166
+ 'time.seconds': '{value} 秒',
167
+ 'time.minutes': '{value} 分 {rest} 秒',
168
+ }
169
+
170
+ const EN = {
171
+ 'sidebar.label': 'Reverse engineering',
172
+ 'app.title': 'REA reverse engineering',
173
+ 'app.subtitle': 'Analyze binaries, applications, and runtime behavior locally',
174
+ 'tab.overview': 'Overview',
175
+ 'tab.tools': 'Tools',
176
+ 'tab.clients': 'Clients',
177
+ 'tab.workflows': 'Workflows',
178
+ 'tab.settings': 'Settings',
179
+ 'tab.logs': 'Logs',
180
+ 'status.ready': 'Running',
181
+ 'status.starting': 'Starting',
182
+ 'status.stopped': 'Stopped',
183
+ 'status.error': 'Error',
184
+ 'status.loading': 'Loading…',
185
+ 'status.offline': 'Host unreachable',
186
+ 'action.refresh': 'Refresh',
187
+ 'action.restart': 'Restart engine',
188
+ 'action.start': 'Start engine',
189
+ 'action.stop': 'Stop engine',
190
+ 'action.copy': 'Copy',
191
+ 'action.copied': 'Copied',
192
+ 'action.run': 'Run',
193
+ 'action.running': 'Running…',
194
+ 'action.cancel': 'Cancel',
195
+ 'action.confirm': 'Confirm',
196
+ 'action.close': 'Close',
197
+ 'action.save': 'Save',
198
+ 'action.saving': 'Saving…',
199
+ 'action.install': 'Install',
200
+ 'action.check': 'Check',
201
+ 'action.preview': 'Preview changes',
202
+ 'action.register': 'Register',
203
+ 'action.refreshStatus': 'Detect again',
204
+ 'action.generate': 'Generate workflow',
205
+ 'action.fill': 'Fill example',
206
+ 'action.clear': 'Clear',
207
+ 'overview.engine': 'Engine',
208
+ 'overview.tools': 'Tools',
209
+ 'overview.families': 'Families',
210
+ 'overview.node': 'Node.js',
211
+ 'overview.rea': 'REA',
212
+ 'overview.clients': 'Agent clients',
213
+ 'overview.skill': 'Skill',
214
+ 'overview.runtime': 'Runtime',
215
+ 'overview.dataDir': 'Data directory',
216
+ 'overview.mcp': 'MCP launch command',
217
+ 'overview.notices': 'Needs attention',
218
+ 'overview.activity': 'Recent calls',
219
+ 'overview.activityEmpty': 'No tool calls yet.',
220
+ 'overview.logs': 'Engine log',
221
+ 'overview.logsEmpty': 'No log lines yet.',
222
+ 'overview.providers': 'Analysis providers',
223
+ 'overview.providersHint': 'Ghidra, IDA, Hopper, and Kuna are installed and configured by the user; the plugin only reports readiness.',
224
+ 'overview.providerEmpty': 'Select Check to read the current provider readiness.',
225
+ 'overview.selected': 'Selected',
226
+ 'overview.installRuntime': 'Install REA runtime',
227
+ 'overview.installHint': 'The rea-agents package was not found. Installing downloads the pinned release into the plugin data directory.',
228
+ 'overview.installRunning': 'Installing the REA runtime…',
229
+ 'overview.installDone': 'Runtime installed.',
230
+ 'overview.installFailed': 'Runtime installation failed',
231
+ 'overview.skillInstalled': 'Installed v{version}',
232
+ 'overview.skillMissing': 'Not installed',
233
+ 'overview.skillStale': 'Refresh needed',
234
+ 'overview.exposure': 'Tool exposure',
235
+ 'overview.tokens': 'about {tokens} tokens of schema',
236
+ 'tools.title': 'Tool catalog',
237
+ 'tools.count': '{count} operations',
238
+ 'tools.search': 'Search tool names or descriptions…',
239
+ 'tools.allFamilies': 'All families',
240
+ 'tools.empty': 'No tool matched. Try another word or family.',
241
+ 'tools.noSelection': 'Select a tool on the left to inspect its arguments and run it.',
242
+ 'tools.schema': 'Input schema',
243
+ 'tools.args': 'Arguments (JSON)',
244
+ 'tools.argsError': 'Arguments must be a valid JSON object',
245
+ 'tools.result': 'Result',
246
+ 'tools.resultEmpty': 'Run the tool to see its result here.',
247
+ 'tools.copyCall': 'Copy rea_call example',
248
+ 'tools.copyCli': 'Copy CLI command',
249
+ 'tools.family': 'Family',
250
+ 'tools.readOnly': 'Read-only',
251
+ 'tools.destructive': 'May modify the target',
252
+ 'tools.loading': 'Loading the tool catalog…',
253
+ 'tools.longHint': 'A cold native import can take minutes (Ghidra allows up to 330 seconds by default). Wait for the result.',
254
+ 'clients.title': 'Agent clients',
255
+ 'clients.hint': 'Register the same local REA engine with agents from other vendors. Every write is previewed first, and REA backs up and merges the configuration.',
256
+ 'clients.detected': '{count} detected',
257
+ 'clients.registered': '{count} registered',
258
+ 'clients.notDetected': 'Not detected',
259
+ 'clients.missing': 'Not registered',
260
+ 'clients.registeredState': 'Registered',
261
+ 'clients.stale': 'Needs refresh',
262
+ 'clients.invalid': 'Invalid',
263
+ 'clients.builtin': 'Provided by this plugin',
264
+ 'clients.builtinHint': 'DeepSeek Harness gets its tools from this plugin directly; an extra mcp__rea__ registration is unnecessary.',
265
+ 'clients.registerDetected': 'Register every detected client',
266
+ 'clients.registerDetectedHint': 'Runs rea setup --all-detected and previews each detected client in turn.',
267
+ 'clients.skill': 'REA skill',
268
+ 'clients.skillHint': 'Install the reverse-engineer-anything workflow under ~/.agents/skills for every agent on this machine.',
269
+ 'clients.skillRefresh': 'Install / refresh skill',
270
+ 'clients.plan': 'Change plan',
271
+ 'clients.planEmpty': 'No plan was returned.',
272
+ 'clients.confirmTitle': 'Write this client configuration?',
273
+ 'clients.confirmBody': 'rea setup --client {client} will run. REA backs up the existing file and merges only its own entry; other settings are preserved.',
274
+ 'clients.working': 'Updating client configuration…',
275
+ 'clients.noDetected': 'No other installed client was detected. Install its CLI, then detect again.',
276
+ 'clients.configPath': 'Config file',
277
+ 'clients.search': 'Search clients…',
278
+ 'workflows.title': 'Guided workflows',
279
+ 'workflows.hint': 'REA ships investigation recipes. Generate one and paste it into a session to drive the tools step by step.',
280
+ 'workflows.args': 'Arguments (JSON)',
281
+ 'workflows.result': 'Workflow content',
282
+ 'workflows.empty': 'Select a workflow and generate it.',
283
+ 'workflows.argumentsTitle': 'Arguments',
284
+ 'settings.title': 'Settings',
285
+ 'settings.runtime': 'Runtime paths',
286
+ 'settings.reaPath': 'rea-agents package path',
287
+ 'settings.reaPathHint': 'Leave empty to resolve the plugin dependency, the data-directory runtime, then a global npm install.',
288
+ 'settings.nodePath': 'Node.js executable',
289
+ 'settings.nodePathHint': 'REA needs Node.js 22.23.4+ / 24.22.1+ / 26.12.1+. The Node.js inside DSH Desktop may be too old.',
290
+ 'settings.exposure': 'Tool exposure',
291
+ 'settings.exposureCore': 'Core tools (recommended)',
292
+ 'settings.exposureCoreHint': 'Register 11 core tools directly; reach the rest through rea_tools / rea_call.',
293
+ 'settings.exposureFamilies': 'Selected families',
294
+ 'settings.exposureFamiliesHint': 'Register every tool in the chosen families.',
295
+ 'settings.exposureAll': 'All 274 tools',
296
+ 'settings.exposureAllHint': 'Every schema enters every request and costs a lot of context. Use only when required.',
297
+ 'settings.families': 'Families',
298
+ 'settings.timeouts': 'Timeouts',
299
+ 'settings.callTimeout': 'Tool call (ms)',
300
+ 'settings.startupTimeout': 'Startup and catalog (ms)',
301
+ 'settings.connectOnStart': 'Start the engine when the plugin loads',
302
+ 'settings.http': 'HTTP MCP endpoint',
303
+ 'settings.httpHint': 'For agents that cannot spawn a stdio child. The endpoint has no authentication, listens on 127.0.0.1 by default, and serves one client at a time.',
304
+ 'settings.httpEnable': 'Enable the HTTP endpoint',
305
+ 'settings.httpHost': 'Listen address',
306
+ 'settings.httpPort': 'Port (0 picks an ephemeral one)',
307
+ 'settings.httpUrl': 'Endpoint URL',
308
+ 'settings.env': 'Analysis provider environment',
309
+ 'settings.envHint': 'One KEY=VALUE per line, for example GHIDRA_INSTALL_DIR=D:\\ghidra. Only allow-listed REA_*, GHIDRA_INSTALL_DIR, HOPPER_LAUNCHER_PATH, JAVA_HOME, and provider path variables are accepted.',
310
+ 'settings.saved': 'Settings saved.',
311
+ 'settings.restartNeeded': 'Changing the runtime or exposure re-registers the agent tools.',
312
+ 'settings.nodeWarning': 'The detected Node.js does not satisfy REA: {reason}',
313
+ 'logs.title': 'Logs',
314
+ 'logs.activity': 'Tool calls',
315
+ 'logs.events': 'Engine events',
316
+ 'logs.stderr': 'stderr',
317
+ 'logs.empty': 'No log lines yet.',
318
+ 'logs.copy': 'Copy logs',
319
+ 'error.title': 'Operation failed',
320
+ 'error.retry': 'Retry',
321
+ 'time.seconds': '{value}s',
322
+ 'time.minutes': '{value}m {rest}s',
323
+ }
324
+
325
+ const CSS = `
326
+ .re-page { min-height: 100%; padding: var(--dsh-frame-top-clearance, 48px) 32px 56px; box-sizing: border-box; color: var(--dsw-alias-label-primary); }
327
+ .re-inner { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; container-type: inline-size; }
328
+ .re-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
329
+ .re-titlebar { display: flex; align-items: center; gap: 12px; min-width: 0; }
330
+ .re-logo { width: 40px; height: 40px; flex: none; border-radius: 11px; background: var(--dsw-alias-bg-layer-2); border: 1px solid var(--dsw-alias-border-l2); display: flex; align-items: center; justify-content: center; color: var(--dsw-alias-brand-primary); }
331
+ .re-title { margin: 0; font-size: 19px; line-height: 26px; font-weight: 600; }
332
+ .re-subtitle { margin: 2px 0 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }
333
+ .re-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
334
+ .re-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--dsw-alias-border-l1); overflow-x: auto; scrollbar-width: none; }
335
+ .re-tabs::-webkit-scrollbar { display: none; }
336
+ .re-tab { appearance: none; border: 0; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 18px; padding: 9px 12px 10px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
337
+ .re-tab:hover { color: var(--dsw-alias-label-primary); }
338
+ .re-tab[aria-selected="true"] { color: var(--dsw-alias-label-primary); border-bottom-color: var(--dsw-alias-brand-primary); font-weight: 600; }
339
+ .re-tab-count { font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: 999px; background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-tertiary); }
340
+ .re-card { background: var(--dsw-alias-bg-layer-1); border: 0.5px solid var(--dsw-alias-border-l2); border-radius: 12px; overflow: hidden; }
341
+ .re-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 17px; border-bottom: 1px solid var(--dsw-alias-border-l1); flex-wrap: wrap; }
342
+ .re-card-title { margin: 0; font-size: 14px; font-weight: 600; }
343
+ .re-card-sub { margin: 2px 0 0; font-size: 12px; color: var(--dsw-alias-label-tertiary); }
344
+ .re-card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
345
+ .re-card-body { padding: 16px 17px; }
346
+ .re-btn { appearance: none; border: 0.5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); border-radius: 8px; padding: 7px 13px; font-size: 13px; line-height: 18px; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
347
+ .re-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }
348
+ .re-btn:disabled { opacity: .55; cursor: not-allowed; }
349
+ .re-btn-primary { background: var(--dsw-alias-button-primary-fill); border-color: transparent; color: var(--dsw-alias-label-on-color); font-weight: 500; }
350
+ .re-btn-primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover); }
351
+ .re-btn-danger { color: var(--dsw-alias-state-error-primary); }
352
+ .re-btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
353
+ .re-btn-ghost { background: transparent; border-color: transparent; color: var(--dsw-alias-label-secondary); }
354
+ .re-btn-ghost:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }
355
+ .re-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 9px; font-size: 12px; line-height: 16px; border: 0.5px solid var(--dsw-alias-border-l2); color: var(--dsw-alias-label-secondary); background: var(--dsw-alias-bg-layer-2); white-space: nowrap; }
356
+ .re-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-state-idle-primary); flex: none; }
357
+ .re-chip[data-tone="success"] { color: var(--dsw-alias-state-success-primary); border-color: var(--dsw-alias-state-success-primary); }
358
+ .re-chip[data-tone="success"] .re-chip-dot { background: var(--dsw-alias-state-success-primary); }
359
+ .re-chip[data-tone="error"] { color: var(--dsw-alias-state-error-primary); border-color: var(--dsw-alias-state-error-primary); }
360
+ .re-chip[data-tone="error"] .re-chip-dot { background: var(--dsw-alias-state-error-primary); }
361
+ .re-chip[data-tone="warn"] { color: var(--dsw-alias-state-warn-primary); border-color: var(--dsw-alias-state-warn-primary); }
362
+ .re-chip[data-tone="warn"] .re-chip-dot { background: var(--dsw-alias-state-warn-primary); }
363
+ .re-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
364
+ .re-metric { border: 0.5px solid var(--dsw-alias-border-l1); border-radius: 10px; padding: 11px 13px; background: var(--dsw-alias-bg-layer-2); min-width: 0; }
365
+ .re-metric-label { font-size: 12px; line-height: 16px; color: var(--dsw-alias-label-tertiary); }
366
+ .re-metric-value { margin-top: 4px; font-size: 17px; line-height: 24px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
367
+ .re-metric-note { margin-top: 2px; font-size: 11px; line-height: 15px; color: var(--dsw-alias-label-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
368
+ .re-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; }
369
+ .re-kv-item { min-width: 0; }
370
+ .re-kv-label { font-size: 12px; line-height: 16px; color: var(--dsw-alias-label-tertiary); }
371
+ .re-kv-value { margin-top: 3px; font-size: 13px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
372
+ .re-hint { margin: 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }
373
+ .re-error { margin: 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-error-primary); }
374
+ .re-banner { border: 1px solid var(--dsw-alias-state-warn-primary); color: var(--dsw-alias-state-warn-primary); background: var(--dsw-alias-bg-layer-2); border-radius: 9px; padding: 8px 12px; font-size: 12px; line-height: 18px; }
375
+ .re-banner[data-level="error"] { border-color: var(--dsw-alias-state-error-primary); color: var(--dsw-alias-state-error-primary); }
376
+ .re-banner[data-level="info"] { border-color: var(--dsw-alias-border-l2); color: var(--dsw-alias-label-secondary); }
377
+ .re-notices { display: flex; flex-direction: column; gap: 8px; }
378
+ .re-input, .re-select, .re-textarea { width: 100%; box-sizing: border-box; border-radius: 8px; border: 0.5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font-size: 13px; font-family: inherit; outline: none; padding: 7px 10px; }
379
+ .re-input, .re-select { height: 34px; }
380
+ .re-textarea { min-height: 120px; resize: vertical; line-height: 19px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
381
+ .re-input:focus, .re-select:focus, .re-textarea:focus { border-color: var(--dsw-alias-brand-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-brand-primary) 25%, transparent); }
382
+ .re-field { display: flex; flex-direction: column; gap: 5px; }
383
+ .re-label { font-size: 12px; line-height: 16px; color: var(--dsw-alias-label-secondary); }
384
+ .re-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
385
+ .re-form-wide { grid-column: 1 / -1; }
386
+ .re-radio-row { display: flex; flex-direction: column; gap: 8px; }
387
+ .re-radio { display: flex; gap: 9px; align-items: flex-start; border: 0.5px solid var(--dsw-alias-border-l1); border-radius: 9px; padding: 10px 12px; cursor: pointer; background: var(--dsw-alias-bg-layer-2); }
388
+ .re-radio[data-checked="true"] { border-color: var(--dsw-alias-brand-primary); }
389
+ .re-radio input { margin-top: 3px; accent-color: var(--dsw-alias-brand-primary); }
390
+ .re-radio-title { font-size: 13px; font-weight: 500; }
391
+ .re-radio-hint { margin-top: 2px; font-size: 12px; line-height: 17px; color: var(--dsw-alias-label-tertiary); }
392
+ .re-checks { display: flex; flex-wrap: wrap; gap: 6px; }
393
+ .re-check { display: inline-flex; align-items: center; gap: 6px; border: 0.5px solid var(--dsw-alias-border-l2); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; background: var(--dsw-alias-bg-layer-2); }
394
+ .re-check[data-checked="true"] { border-color: var(--dsw-alias-brand-primary); color: var(--dsw-alias-brand-primary); }
395
+ .re-check input { accent-color: var(--dsw-alias-brand-primary); }
396
+ .re-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
397
+ .re-toolbar .re-input { max-width: 340px; }
398
+ .re-split { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 14px; align-items: start; }
399
+ .re-list { border: 0.5px solid var(--dsw-alias-border-l2); border-radius: 11px; background: var(--dsw-alias-bg-layer-1); overflow: hidden; display: flex; flex-direction: column; max-height: 620px; }
400
+ .re-list-head { padding: 10px 12px; border-bottom: 1px solid var(--dsw-alias-border-l1); display: flex; flex-direction: column; gap: 8px; background: var(--dsw-alias-bg-layer-2); }
401
+ .re-list-scroll { overflow-y: auto; min-height: 160px; }
402
+ .re-row { width: 100%; appearance: none; border: 0; border-bottom: 0.5px solid var(--dsw-alias-border-l1); background: transparent; text-align: left; padding: 9px 12px; cursor: pointer; font: inherit; color: inherit; display: block; }
403
+ .re-row:hover { background: var(--dsw-alias-interactive-bg-hover); }
404
+ .re-row[aria-current="true"] { background: color-mix(in srgb, var(--dsw-alias-brand-primary) 12%, transparent); }
405
+ .re-row-name { font-size: 13px; line-height: 18px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
406
+ .re-row-desc { margin-top: 2px; font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
407
+ .re-family { font-size: 10px; line-height: 15px; padding: 0 5px; border-radius: 5px; background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-tertiary); border: 0.5px solid var(--dsw-alias-border-l1); flex: none; }
408
+ .re-empty { padding: 26px; text-align: center; color: var(--dsw-alias-label-tertiary); font-size: 13px; }
409
+ .re-pre { margin: 0; padding: 11px 13px; border-radius: 9px; border: 0.5px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 18px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 460px; overflow: auto; }
410
+ .re-pre-short { max-height: 260px; }
411
+ .re-stack { display: flex; flex-direction: column; gap: 12px; }
412
+ .re-details { border: 0.5px solid var(--dsw-alias-border-l1); border-radius: 9px; padding: 8px 12px; background: var(--dsw-alias-bg-layer-2); }
413
+ .re-details summary { cursor: pointer; font-size: 12px; color: var(--dsw-alias-label-secondary); }
414
+ .re-table { width: 100%; border-collapse: collapse; font-size: 12px; }
415
+ .re-table th { text-align: left; font-weight: 500; color: var(--dsw-alias-label-tertiary); padding: 7px 10px; border-bottom: 1px solid var(--dsw-alias-border-l1); white-space: nowrap; }
416
+ .re-table td { padding: 7px 10px; border-bottom: 0.5px solid var(--dsw-alias-border-l1); vertical-align: top; }
417
+ .re-table tr:last-child td { border-bottom: 0; }
418
+ .re-client { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 11px 14px; border-bottom: 0.5px solid var(--dsw-alias-border-l1); align-items: center; }
419
+ .re-client:last-child { border-bottom: 0; }
420
+ .re-client-name { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
421
+ .re-client-id { font-size: 11px; color: var(--dsw-alias-label-tertiary); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
422
+ .re-client-path { margin-top: 2px; font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
423
+ .re-client-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
424
+ .re-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--dsw-alias-border-l3); border-top-color: var(--dsw-alias-brand-primary); animation: re-rotate .8s linear infinite; display: inline-block; }
425
+ @keyframes re-rotate { to { transform: rotate(360deg) } }
426
+ .re-overlay { position: fixed; inset: 0; background: var(--dsw-alias-bg-mask-1, rgba(0,0,0,.45)); backdrop-filter: var(--dsw-mask-blur, blur(2px)); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 70; }
427
+ .re-dialog { width: 100%; max-width: 640px; max-height: 82vh; display: flex; flex-direction: column; background: var(--dsw-alias-bg-layer-1); border: 0.5px solid var(--dsw-alias-border-l2); border-radius: 13px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
428
+ .re-dialog-head { padding: 16px 18px 10px; }
429
+ .re-dialog-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
430
+ .re-dialog-body { padding: 0 18px; overflow: auto; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }
431
+ .re-dialog-actions { padding: 14px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; }
432
+ .re-toast { position: fixed; right: 22px; bottom: 22px; z-index: 80; max-width: 380px; border-radius: 9px; padding: 9px 13px; font-size: 13px; line-height: 18px; background: var(--dsw-alias-bg-layer-1); border: 0.5px solid var(--dsw-alias-border-l2); color: var(--dsw-alias-label-primary); box-shadow: 0 8px 26px rgba(0,0,0,.28); }
433
+ .re-toast[data-tone="error"] { border-color: var(--dsw-alias-state-error-primary); color: var(--dsw-alias-state-error-primary); }
434
+ .re-toast[data-tone="success"] { border-color: var(--dsw-alias-state-success-primary); }
435
+ .re-toast[data-tone="warn"] { border-color: var(--dsw-alias-state-warn-primary); color: var(--dsw-alias-state-warn-primary); }
436
+ .re-log { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; line-height: 17px; }
437
+ .re-log-row { display: grid; grid-template-columns: 76px 62px minmax(0, 1fr); gap: 8px; padding: 3px 0; border-bottom: 0.5px solid var(--dsw-alias-border-l1); }
438
+ .re-log-time { color: var(--dsw-alias-label-caption); white-space: nowrap; overflow: hidden; }
439
+ .re-log-level[data-level="error"] { color: var(--dsw-alias-state-error-primary); }
440
+ .re-log-level[data-level="warn"] { color: var(--dsw-alias-state-warn-primary); }
441
+ .re-log-level { color: var(--dsw-alias-label-tertiary); }
442
+ .re-log-msg { min-width: 0; overflow-wrap: anywhere; color: var(--dsw-alias-label-secondary); }
443
+ .re-footer { display: flex; justify-content: space-between; gap: 12px; color: var(--dsw-alias-label-caption); font-size: 11px; line-height: 16px; flex-wrap: wrap; }
444
+ .re-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
445
+ .re-skeleton { height: 180px; border-radius: 12px; background: var(--dsw-alias-bg-layer-2); animation: re-pulse 1.4s ease-in-out infinite; }
446
+ @keyframes re-pulse { 0%,100% { opacity: .55 } 50% { opacity: 1 } }
447
+ @media (max-width: 900px) { .re-split { grid-template-columns: 1fr; } .re-list { max-height: 380px; } }
448
+ @media (max-width: 640px) {
449
+ .re-page { padding: var(--dsh-frame-top-clearance, 44px) 14px 44px; }
450
+ .re-client { grid-template-columns: 1fr; }
451
+ .re-client-actions { justify-content: flex-start; }
452
+ .re-toolbar .re-input { max-width: none; flex: 1 1 180px; }
453
+ }
454
+ `
455
+
456
+ function translate(dict, key, params) {
457
+ let value = dict[key] ?? key
458
+ if (params) {
459
+ for (const name of Object.keys(params)) value = value.split('{' + name + '}').join(String(params[name]))
460
+ }
461
+ return value
462
+ }
463
+
464
+ function api(path, options) {
465
+ return fetch(API + path, {
466
+ method: options?.method ?? 'GET',
467
+ headers: options?.body ? { 'content-type': 'application/json' } : undefined,
468
+ body: options?.body ? JSON.stringify(options.body) : undefined,
469
+ cache: 'no-store',
470
+ }).then(async response => {
471
+ let data = null
472
+ try {
473
+ data = await response.json()
474
+ } catch {
475
+ data = null
476
+ }
477
+ if (!response.ok || !data || data.ok === false) {
478
+ const message = data?.error?.message || 'HTTP ' + response.status
479
+ const error = new Error(message)
480
+ error.code = data?.error?.code || 'http-' + response.status
481
+ throw error
482
+ }
483
+ return data
484
+ })
485
+ }
486
+
487
+ function formatTime(value) {
488
+ if (!value) return '—'
489
+ try {
490
+ return new Date(value).toLocaleTimeString()
491
+ } catch {
492
+ return String(value)
493
+ }
494
+ }
495
+
496
+ function formatDuration(ms) {
497
+ if (typeof ms !== 'number' || !Number.isFinite(ms)) return '—'
498
+ if (ms < 1000) return ms + ' ms'
499
+ const seconds = Math.round(ms / 100) / 10
500
+ return seconds + ' s'
501
+ }
502
+
503
+ function formatNumber(value) {
504
+ return typeof value === 'number' ? value.toLocaleString() : '—'
505
+ }
506
+
507
+ function copyText(value) {
508
+ if (navigator.clipboard?.writeText) return navigator.clipboard.writeText(String(value))
509
+ const area = document.createElement('textarea')
510
+ area.value = String(value)
511
+ area.style.position = 'fixed'
512
+ area.style.opacity = '0'
513
+ document.body.appendChild(area)
514
+ area.select()
515
+ try {
516
+ document.execCommand('copy')
517
+ } finally {
518
+ document.body.removeChild(area)
519
+ }
520
+ return Promise.resolve()
521
+ }
522
+
523
+ function sampleValue(schema, depth) {
524
+ if (!schema || typeof schema !== 'object' || depth > 3) return null
525
+ if (Array.isArray(schema.anyOf) && schema.anyOf.length) return sampleValue(schema.anyOf[0], depth)
526
+ if (Array.isArray(schema.oneOf) && schema.oneOf.length) return sampleValue(schema.oneOf[0], depth)
527
+ if (Array.isArray(schema.enum) && schema.enum.length) return schema.enum[0]
528
+ if (schema.type === 'object' || schema.properties) {
529
+ const value = {}
530
+ const properties = schema.properties ?? {}
531
+ const required = new Set(Array.isArray(schema.required) ? schema.required : [])
532
+ let count = 0
533
+ for (const key of Object.keys(properties)) {
534
+ if (!required.has(key) && count >= 8) continue
535
+ value[key] = sampleValue(properties[key], depth + 1)
536
+ count += 1
537
+ if (count >= 14) break
538
+ }
539
+ return value
540
+ }
541
+ if (schema.type === 'array') return []
542
+ if (schema.type === 'integer' || schema.type === 'number') return 0
543
+ if (schema.type === 'boolean') return false
544
+ if (schema.type === 'null') return null
545
+ if (typeof schema.default !== 'undefined') return schema.default
546
+ return ''
547
+ }
548
+
549
+ function timeAgo(value) {
550
+ if (!value) return '—'
551
+ const delta = Date.now() - new Date(value).getTime()
552
+ if (!Number.isFinite(delta)) return '—'
553
+ if (delta < 60_000) return Math.max(0, Math.round(delta / 1000)) + 's'
554
+ if (delta < 3_600_000) return Math.round(delta / 60_000) + 'm'
555
+ return Math.round(delta / 3_600_000) + 'h'
556
+ }
557
+
558
+ function Icon(props) {
559
+ const name = props.name
560
+ const paths = {
561
+ refresh: h('path', { d: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7' }),
562
+ play: h('path', { d: 'M8 5.5v13l10-6.5z' }),
563
+ stop: h('rect', { x: 6, y: 6, width: 12, height: 12, rx: 2 }),
564
+ copy: h('path', { d: 'M9 9h9v11H9zM6 15H5V4h11v1' }),
565
+ check: h('path', { d: 'M5 12.5 9.5 17 19 6.5' }),
566
+ search: h('path', { d: 'M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM16.5 16.5 21 21' }),
567
+ warning: h('path', { d: 'M12 4 3 20h18zM12 9v5M12 17.2v.3' }),
568
+ external: h('path', { d: 'M14 4h6v6M20 4l-8 8M18 14v5H5V6h5' }),
569
+ chevron: h('path', { d: 'm9 6 6 6-6 6' }),
570
+ terminal: h('path', { d: 'M4 5h16v14H4zM7 9l3 3-3 3M12 15h5' }),
571
+ chip: h('path', { d: 'M8 8h8v8H8zM12 3v2M12 19v2M3 12h2M19 12h2' }),
572
+ }
573
+ return h('svg', {
574
+ width: props.size ?? 16,
575
+ height: props.size ?? 16,
576
+ viewBox: '0 0 24 24',
577
+ fill: 'none',
578
+ stroke: 'currentColor',
579
+ strokeWidth: 1.7,
580
+ strokeLinecap: 'round',
581
+ strokeLinejoin: 'round',
582
+ 'aria-hidden': 'true',
583
+ style: { display: 'block', flex: 'none' },
584
+ }, paths[name] ?? paths.chip)
585
+ }
586
+
587
+ function Chip(props) {
588
+ return h('span', { className: 're-chip', 'data-tone': props.tone },
589
+ props.dot === false ? null : h('span', { className: 're-chip-dot', 'aria-hidden': 'true' }),
590
+ props.children)
591
+ }
592
+
593
+ function Card(props) {
594
+ return h('section', { className: 're-card' },
595
+ props.title !== undefined || props.actions
596
+ ? h('div', { className: 're-card-head' },
597
+ h('div', null,
598
+ props.title !== undefined ? h('h2', { className: 're-card-title' }, props.title) : null,
599
+ props.subtitle ? h('p', { className: 're-card-sub' }, props.subtitle) : null),
600
+ props.actions ? h('div', { className: 're-card-actions' }, props.actions) : null)
601
+ : null,
602
+ h('div', { className: props.bodyClass ?? 're-card-body' }, props.children))
603
+ }
604
+
605
+ function Button(props) {
606
+ return h('button', {
607
+ type: props.type ?? 'button',
608
+ className: 're-btn' + (props.variant === 'primary' ? ' re-btn-primary' : props.variant === 'danger' ? ' re-btn-danger' : props.variant === 'ghost' ? ' re-btn-ghost' : '') + (props.small ? ' re-btn-sm' : ''),
609
+ disabled: props.disabled,
610
+ onClick: props.onClick,
611
+ title: props.title,
612
+ }, props.busy ? h('span', { className: 're-spin', 'aria-hidden': 'true' }) : props.icon ? h(Icon, { name: props.icon }) : null, props.children)
613
+ }
614
+
615
+ function Field(props) {
616
+ return h('div', { className: 're-field' + (props.wide ? ' re-form-wide' : '') },
617
+ h('label', { className: 're-label', htmlFor: props.id }, props.label),
618
+ props.children,
619
+ props.hint ? h('p', { className: 're-hint' }, props.hint) : null)
620
+ }
621
+
622
+ function ConfirmDialog(props) {
623
+ const confirmRef = useRef(null)
624
+ useEffect(() => {
625
+ confirmRef.current?.focus()
626
+ const onKey = event => {
627
+ if (event.key === 'Escape') props.onCancel()
628
+ }
629
+ document.addEventListener('keydown', onKey)
630
+ return () => document.removeEventListener('keydown', onKey)
631
+ }, [props.onCancel])
632
+ return h('div', { className: 're-overlay', role: 'presentation', onMouseDown: event => { if (event.target === event.currentTarget && !props.busy) props.onCancel() } },
633
+ h('div', { className: 're-dialog', role: 'dialog', 'aria-modal': 'true', 'aria-labelledby': 're-confirm-title' },
634
+ h('div', { className: 're-dialog-head' }, h('h2', { className: 're-dialog-title', id: 're-confirm-title' }, props.title)),
635
+ h('div', { className: 're-dialog-body' }, props.children),
636
+ h('div', { className: 're-dialog-actions' },
637
+ h(Button, { onClick: props.onCancel, disabled: props.busy }, props.cancelLabel ?? '取消'),
638
+ h(Button, { variant: 'primary', onClick: props.onConfirm, disabled: props.busy, busy: props.busy }, props.confirmLabel ?? '确认'))))
639
+ }
640
+
641
+ function Notice(props) {
642
+ return h('div', { className: 're-banner', 'data-level': props.level, role: props.level === 'error' ? 'alert' : 'status' }, props.children)
643
+ }
644
+
645
+ function ToolRow(props) {
646
+ return h('button', {
647
+ type: 'button',
648
+ className: 're-row',
649
+ 'aria-current': props.active ? 'true' : undefined,
650
+ onClick: props.onClick,
651
+ },
652
+ h('span', { className: 're-row-name' },
653
+ h('span', { style: { overflow: 'hidden', textOverflow: 'ellipsis' } }, props.tool.name),
654
+ h('span', { className: 're-family' }, props.tool.family)),
655
+ h('span', { className: 're-row-desc' }, props.tool.title || props.tool.description))
656
+ }
657
+
658
+ function Overview(props) {
659
+ const { t, state, onAction, onRefresh, onInstall, busy, toast } = props
660
+ const engine = state?.engine
661
+ const runtime = state?.runtime
662
+ const [providers, setProviders] = useState(null)
663
+ const [providerBusy, setProviderBusy] = useState(false)
664
+ const loadProviders = useCallback(async () => {
665
+ setProviderBusy(true)
666
+ try {
667
+ setProviders(await api('/providers'))
668
+ } catch (error) {
669
+ toast(error.message, 'error')
670
+ } finally {
671
+ setProviderBusy(false)
672
+ }
673
+ }, [toast])
674
+
675
+ const engineTone = engine?.status === 'ready' ? 'success' : engine?.status === 'error' ? 'error' : engine?.status === 'starting' ? 'warn' : 'idle'
676
+ const skill = state?.clients?.skill
677
+ const skillTarget = state?.installSkill?.target
678
+ const skillInstalled = Boolean(skill?.installed_version) || state?.installSkill?.installed
679
+ const clients = state?.clients
680
+ const notices = state?.notices ?? []
681
+ const install = state?.install
682
+ const mcpCommand = state?.mcp ? state.mcp.command + ' "' + state.mcp.args.join('" "') + '"' : null
683
+ const exposureLabel = state?.settings?.toolExposure === 'all' ? t('settings.exposureAll') : state?.settings?.toolExposure === 'families' ? t('settings.exposureFamilies') : t('settings.exposureCore')
684
+
685
+ return h('div', { className: 're-stack' },
686
+ notices.length
687
+ ? h('div', { className: 're-notices' }, notices.map((notice, index) => h(Notice, { key: index, level: notice.level }, notice.message)))
688
+ : null,
689
+ h(Card, { title: t('overview.runtime'), actions: h('div', { className: 're-card-actions' },
690
+ h(Button, { small: true, icon: 'refresh', onClick: () => onRefresh(), disabled: busy }, t('action.refresh')),
691
+ !runtime?.rea
692
+ ? h(Button, { small: true, variant: 'primary', onClick: () => onInstall(), disabled: Boolean(busy) || install?.running, busy: install?.running }, t('overview.installRuntime'))
693
+ : null,
694
+ engine?.status === 'ready'
695
+ ? h(Button, { small: true, icon: 'refresh', onClick: () => onAction('restart'), disabled: busy, busy: busy === 'restart' }, t('action.restart'))
696
+ : h(Button, { small: true, variant: 'primary', icon: 'play', onClick: () => onAction('start'), disabled: busy, busy: busy === 'start' }, t('action.start')))
697
+ },
698
+ h('div', { className: 're-metrics' },
699
+ h('div', { className: 're-metric' },
700
+ h('div', { className: 're-metric-label' }, t('overview.engine')),
701
+ h('div', { className: 're-metric-value' }, h(Chip, { tone: engineTone }, engine?.status === 'ready' ? t('status.ready') : engine?.status === 'starting' ? t('status.starting') : engine?.status === 'error' ? t('status.error') : t('status.stopped'))),
702
+ h('div', { className: 're-metric-note' }, engine?.server ? 'rea ' + engine.server.version : '—')),
703
+ h('div', { className: 're-metric' },
704
+ h('div', { className: 're-metric-label' }, t('overview.tools')),
705
+ h('div', { className: 're-metric-value' }, formatNumber(state?.catalog?.tools ?? 0)),
706
+ h('div', { className: 're-metric-note' }, t('overview.families') + ': ' + (state?.catalog?.families?.length ?? 0))),
707
+ h('div', { className: 're-metric' },
708
+ h('div', { className: 're-metric-label' }, t('overview.node')),
709
+ h('div', { className: 're-metric-value' }, runtime?.node?.version ?? '—'),
710
+ h('div', { className: 're-metric-note' }, runtime?.node?.path ?? '—')),
711
+ h('div', { className: 're-metric' },
712
+ h('div', { className: 're-metric-label' }, t('overview.clients')),
713
+ h('div', { className: 're-metric-value' }, clients?.registered != null ? clients.registered + ' / ' + clients.total : '—'),
714
+ h('div', { className: 're-metric-note' }, t('clients.registered', { count: clients?.registered ?? 0 }))),
715
+ h('div', { className: 're-metric' },
716
+ h('div', { className: 're-metric-label' }, t('overview.skill')),
717
+ h('div', { className: 're-metric-value' }, skillInstalled ? h(Chip, { tone: skill?.state === 'stale' ? 'warn' : 'success' }, skill?.state === 'stale' ? t('overview.skillStale') : t('overview.skillInstalled', { version: skill?.installed_version ?? '?' })) : h(Chip, { tone: 'warn' }, t('overview.skillMissing'))),
718
+ h('div', { className: 're-metric-note' }, skill?.issues?.[0]?.path ?? skillTarget ?? '—')),
719
+ h('div', { className: 're-metric' },
720
+ h('div', { className: 're-metric-label' }, t('overview.exposure')),
721
+ h('div', { className: 're-metric-value', style: { fontSize: '14px' } }, exposureLabel),
722
+ h('div', { className: 're-metric-note' }, state?.catalog?.exposedSchemaBytes ? t('overview.tokens', { tokens: Math.round(state.catalog.exposedSchemaBytes / 4).toLocaleString() }) : '—'))),
723
+ h('div', { style: { height: '14px' } }),
724
+ h('div', { className: 're-kv' },
725
+ h('div', { className: 're-kv-item' },
726
+ h('div', { className: 're-kv-label' }, t('overview.rea')),
727
+ h('div', { className: 're-kv-value', title: runtime?.rea?.path }, runtime?.rea ? runtime.rea.version + ' · ' + runtime.rea.source : '—')),
728
+ h('div', { className: 're-kv-item' },
729
+ h('div', { className: 're-kv-label' }, t('overview.dataDir')),
730
+ h('div', { className: 're-kv-value re-mono', title: state?.settings?.dataDirectory }, state?.settings?.dataDirectory ?? '—')),
731
+ h('div', { className: 're-kv-item', style: { gridColumn: '1 / -1' } },
732
+ h('div', { className: 're-kv-label' }, t('overview.mcp')),
733
+ h('div', { className: 're-kv-value re-mono', title: mcpCommand ?? '' }, mcpCommand ?? '—')),
734
+ runtime?.errors?.length
735
+ ? h('div', { className: 're-kv-item', style: { gridColumn: '1 / -1' } },
736
+ h('div', { className: 're-kv-label' }, t('error.title')),
737
+ runtime.errors.map((error, index) => h('p', { key: index, className: 're-error' }, error.message)))
738
+ : null)),
739
+ install?.running
740
+ ? h(Card, { title: t('overview.installRunning') },
741
+ h('pre', { className: 're-pre re-pre-short' }, (install.log ?? []).join('\n') || t('status.loading')))
742
+ : null,
743
+ h(Card, {
744
+ title: t('overview.providers'),
745
+ subtitle: t('overview.providersHint'),
746
+ actions: h(Button, { small: true, icon: 'search', onClick: loadProviders, disabled: providerBusy, busy: providerBusy }, t('action.check')),
747
+ },
748
+ providers
749
+ ? h('div', { className: 're-stack' },
750
+ h('div', { className: 're-checks' },
751
+ (providers.candidates ?? []).map(candidate => h(Chip, {
752
+ key: candidate.id,
753
+ tone: candidate.selected ? 'success' : candidate.status === 'available' ? 'success' : candidate.code === 'unsupported_host' ? 'idle' : 'warn',
754
+ }, candidate.name + (candidate.selected ? ' · ' + t('overview.selected') : '')))),
755
+ h('div', null, (providers.candidates ?? []).map(candidate => h('div', { key: candidate.id, style: { marginTop: '6px' } },
756
+ h('div', { className: 're-kv-label' }, candidate.name + ' · ' + (candidate.status ?? '?') + (candidate.code ? ' · ' + candidate.code : '')),
757
+ h('div', { className: 're-hint' }, candidate.reason ?? candidate.remediation ?? '')))))
758
+ : h('p', { className: 're-hint' }, t('overview.providerEmpty'))),
759
+ h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))', gap: '14px' } },
760
+ h(Card, { title: t('overview.activity') },
761
+ (state?.activity ?? []).length
762
+ ? h('div', null, state.activity.map((entry, index) => h('div', { key: index, className: 're-client', style: { gridTemplateColumns: '1fr auto' } },
763
+ h('div', null,
764
+ h('div', { className: 're-client-name' }, h('span', { className: 're-mono' }, entry.tool), h(Chip, { tone: entry.ok ? 'success' : 'error', dot: false }, entry.ok ? 'ok' : 'error'))),
765
+ h('div', { className: 're-client-id' }, timeAgo(entry.at) + ' · ' + formatDuration(entry.durationMs)))))
766
+ : h('p', { className: 're-empty' }, t('overview.activityEmpty'))),
767
+ h(Card, { title: t('overview.logs') },
768
+ (state?.logs ?? []).length
769
+ ? h('div', { className: 're-log' }, state.logs.slice(-18).map((entry, index) => h('div', { key: index, className: 're-log-row' },
770
+ h('span', { className: 're-log-time' }, formatTime(entry.at)),
771
+ h('span', { className: 're-log-level', 'data-level': entry.level }, entry.level),
772
+ h('span', { className: 're-log-msg' }, entry.message + (entry.tool ? ' · ' + entry.tool : '')))))
773
+ : h('p', { className: 're-empty' }, t('overview.logsEmpty')))),
774
+ h('div', { className: 're-footer' },
775
+ h('span', null, 'dsh-reverse-engine · REA ' + (runtime?.rea?.version ?? '?')),
776
+ h('span', null, runtime?.requirement ?? '')))
777
+ }
778
+
779
+ function ToolsTab(props) {
780
+ const { t, toast, state } = props
781
+ const [catalog, setCatalog] = useState(null)
782
+ const [loading, setLoading] = useState(true)
783
+ const [query, setQuery] = useState('')
784
+ const [family, setFamily] = useState('all')
785
+ const [selected, setSelected] = useState(null)
786
+ const [tool, setTool] = useState(null)
787
+ const [args, setArgs] = useState('{}')
788
+ const [result, setResult] = useState(null)
789
+ const [running, setRunning] = useState(false)
790
+ const [resultTab, setResultTab] = useState('result')
791
+
792
+ useEffect(() => {
793
+ let cancelled = false
794
+ api('/tools?limit=500').then(data => {
795
+ if (cancelled) return
796
+ setCatalog(data)
797
+ const preferred = data.tools.find(item => item.name === 'binary_session') ?? data.tools[0]
798
+ if (preferred) setSelected(preferred.name)
799
+ }).catch(error => toast(error.message, 'error')).finally(() => { if (!cancelled) setLoading(false) })
800
+ return () => { cancelled = true }
801
+ }, [toast])
802
+
803
+ useEffect(() => {
804
+ if (!selected) return
805
+ let cancelled = false
806
+ api('/tool?name=' + encodeURIComponent(selected)).then(data => {
807
+ if (cancelled) return
808
+ setTool(data.tool)
809
+ const sample = sampleValue(data.tool.inputSchema, 0)
810
+ setArgs(JSON.stringify(sample && typeof sample === 'object' && Object.keys(sample).length ? sample : {}, null, 2))
811
+ setResult(null)
812
+ }).catch(error => toast(error.message, 'error'))
813
+ return () => { cancelled = true }
814
+ }, [selected, toast])
815
+
816
+ const families = catalog?.families ?? []
817
+ const filtered = useMemo(() => {
818
+ const words = query.toLowerCase().split(/\s+/).filter(Boolean)
819
+ return (catalog?.tools ?? []).filter(item => {
820
+ if (family !== 'all' && item.family !== family) return false
821
+ if (!words.length) return true
822
+ const haystack = (item.name + ' ' + (item.title ?? '') + ' ' + (item.description ?? '')).toLowerCase()
823
+ return words.every(word => haystack.includes(word))
824
+ })
825
+ }, [catalog, query, family])
826
+
827
+ const run = useCallback(async () => {
828
+ if (!tool) return
829
+ let parsed
830
+ try {
831
+ parsed = args.trim() ? JSON.parse(args) : {}
832
+ } catch {
833
+ toast(t('tools.argsError'), 'error')
834
+ return
835
+ }
836
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
837
+ toast(t('tools.argsError'), 'error')
838
+ return
839
+ }
840
+ setRunning(true)
841
+ setResult(null)
842
+ setResultTab('result')
843
+ try {
844
+ const data = await api('/call', { method: 'POST', body: { tool: tool.name, arguments: parsed } })
845
+ setResult({ ok: true, data })
846
+ } catch (error) {
847
+ setResult({ ok: false, error })
848
+ } finally {
849
+ setRunning(false)
850
+ }
851
+ }, [args, tool, toast, t])
852
+
853
+ const resultText = result
854
+ ? result.ok
855
+ ? (result.data.structuredContent != null
856
+ ? JSON.stringify(result.data.structuredContent, null, 2)
857
+ : (result.data.text || JSON.stringify(result.data, null, 2)))
858
+ : JSON.stringify({ ok: false, error: { code: result.error.code, message: result.error.message } }, null, 2)
859
+ : ''
860
+
861
+ const cliCommand = tool ? tool.name.replace(/_/g, '-') : ''
862
+
863
+ return h('div', { className: 're-split' },
864
+ h('div', { className: 're-list' },
865
+ h('div', { className: 're-list-head' },
866
+ h('input', { className: 're-input', placeholder: t('tools.search'), value: query, onChange: event => setQuery(event.target.value), 'aria-label': t('tools.search') }),
867
+ h('select', { className: 're-select', value: family, onChange: event => setFamily(event.target.value), 'aria-label': t('tools.family') },
868
+ h('option', { value: 'all' }, t('tools.allFamilies') + ' (' + (catalog?.total ?? 0) + ')'),
869
+ families.map(item => h('option', { key: item.id, value: item.id }, item.id + ' (' + item.count + ')'))),
870
+ h('p', { className: 're-hint' }, t('tools.count', { count: filtered.length }))),
871
+ h('div', { className: 're-list-scroll' },
872
+ loading
873
+ ? h('p', { className: 're-empty' }, t('tools.loading'))
874
+ : filtered.length
875
+ ? filtered.map(item => h(ToolRow, { key: item.name, tool: item, active: item.name === selected, onClick: () => setSelected(item.name) }))
876
+ : h('p', { className: 're-empty' }, t('tools.empty')))),
877
+ h('div', { className: 're-stack' },
878
+ !tool
879
+ ? h(Card, null, h('p', { className: 're-empty' }, t('tools.noSelection')))
880
+ : h(Card, {
881
+ title: tool.name,
882
+ subtitle: (tool.title ? tool.title + ' · ' : '') + tool.family,
883
+ actions: h('div', { className: 're-card-actions' },
884
+ h(Button, { small: true, icon: 'copy', onClick: () => copyText('rea_call({"tool":"' + tool.name + '","arguments":' + args + '})').then(() => toast(t('action.copied'), 'success')) }, t('tools.copyCall')),
885
+ h(Button, { small: true, icon: 'terminal', onClick: () => copyText('rea ' + cliCommand).then(() => toast(t('action.copied'), 'success')) }, t('tools.copyCli'))),
886
+ },
887
+ h('p', { className: 're-hint', style: { marginBottom: '10px' } }, tool.description),
888
+ h('div', { className: 're-checks', style: { marginBottom: '12px' } },
889
+ tool.annotations?.readOnlyHint ? h(Chip, { tone: 'success', dot: false }, t('tools.readOnly')) : null,
890
+ tool.annotations?.destructiveHint ? h(Chip, { tone: 'warn', dot: false }, t('tools.destructive')) : null),
891
+ h('details', { className: 're-details' },
892
+ h('summary', null, t('tools.schema')),
893
+ h('pre', { className: 're-pre re-pre-short', style: { marginTop: '8px' } }, JSON.stringify(tool.inputSchema, null, 2))),
894
+ h('div', { style: { height: '12px' } }),
895
+ h(Field, { label: t('tools.args') },
896
+ h('textarea', { className: 're-textarea', value: args, onChange: event => setArgs(event.target.value), spellCheck: false })),
897
+ h('div', { className: 're-toolbar', style: { marginTop: '10px' } },
898
+ h(Button, { variant: 'primary', icon: 'play', onClick: run, busy: running, disabled: running }, running ? t('action.running') : t('action.run')),
899
+ h(Button, { onClick: () => {
900
+ const sample = sampleValue(tool.inputSchema, 0)
901
+ setArgs(JSON.stringify(sample && typeof sample === 'object' ? sample : {}, null, 2))
902
+ } }, t('action.fill')),
903
+ h(Button, { variant: 'ghost', onClick: () => setArgs('{}') }, t('action.clear')),
904
+ h('span', { className: 're-hint' }, t('tools.longHint')))),
905
+ result
906
+ ? h(Card, {
907
+ title: t('tools.result'),
908
+ actions: h('div', { className: 're-card-actions' },
909
+ h(Chip, { tone: result.ok ? 'success' : 'error', dot: false }, result.ok ? 'ok · ' + formatDuration(result.data.durationMs) : 'error'),
910
+ h(Button, { small: true, icon: 'copy', onClick: () => copyText(resultText).then(() => toast(t('action.copied'), 'success')) }, t('action.copy'))),
911
+ },
912
+ h('pre', { className: 're-pre' }, resultText || t('tools.resultEmpty')))
913
+ : h(Card, { title: t('tools.result') }, h('p', { className: 're-empty' }, t('tools.resultEmpty')))))
914
+ }
915
+
916
+ function ClientRow(props) {
917
+ const { t, client, onPreview, onRegister, busy } = props
918
+ const tone = client.state === 'registered' ? 'success' : client.state === 'stale' || client.state === 'invalid' ? 'warn' : client.state === 'missing' ? 'warn' : 'idle'
919
+ const label = client.state === 'registered' ? t('clients.registeredState') : client.state === 'stale' ? t('clients.stale') : client.state === 'invalid' ? t('clients.invalid') : client.state === 'missing' ? t('clients.missing') : t('clients.notDetected')
920
+ return h('div', { className: 're-client' },
921
+ h('div', { style: { minWidth: 0 } },
922
+ h('div', { className: 're-client-name' },
923
+ h('span', null, client.label),
924
+ h('span', { className: 're-client-id' }, client.id),
925
+ h(Chip, { tone, dot: false }, label),
926
+ client.builtin ? h(Chip, { tone: 'success', dot: false }, t('clients.builtin')) : null),
927
+ client.configPath ? h('div', { className: 're-client-path', title: client.configPath }, client.configPath) : null,
928
+ client.builtin ? h('div', { className: 're-hint' }, t('clients.builtinHint')) : null),
929
+ h('div', { className: 're-client-actions' },
930
+ client.builtin
931
+ ? null
932
+ : h(Button, { small: true, onClick: () => onPreview(client), disabled: busy }, t('action.preview')),
933
+ client.builtin
934
+ ? null
935
+ : h(Button, { small: true, variant: 'primary', onClick: () => onRegister(client), disabled: busy, busy: busy === client.id }, t('action.register'))))
936
+ }
937
+
938
+ function ClientsTab(props) {
939
+ const { t, toast } = props
940
+ const [data, setData] = useState(null)
941
+ const [loading, setLoading] = useState(true)
942
+ const [query, setQuery] = useState('')
943
+ const [busy, setBusy] = useState(null)
944
+ const [plan, setPlan] = useState(null)
945
+ const [confirm, setConfirm] = useState(null)
946
+
947
+ const load = useCallback(async (refresh) => {
948
+ setLoading(true)
949
+ try {
950
+ setData(await api('/clients' + (refresh ? '?refresh=1' : '')))
951
+ } catch (error) {
952
+ toast(error.message, 'error')
953
+ } finally {
954
+ setLoading(false)
955
+ }
956
+ }, [toast])
957
+
958
+ useEffect(() => { load(false) }, [load])
959
+
960
+ const filtered = useMemo(() => {
961
+ const words = query.toLowerCase().split(/\s+/).filter(Boolean)
962
+ return (data?.clients ?? []).filter(client => {
963
+ if (!words.length) return true
964
+ const haystack = (client.label + ' ' + client.id + ' ' + client.state).toLowerCase()
965
+ return words.every(word => haystack.includes(word))
966
+ })
967
+ }, [data, query])
968
+
969
+ const detected = (data?.clients ?? []).filter(client => client.detected && !client.builtin)
970
+ const registered = (data?.clients ?? []).filter(client => client.state === 'registered')
971
+
972
+ const preview = useCallback(async client => {
973
+ setBusy('preview:' + client.id)
974
+ try {
975
+ const result = await api('/clients', { method: 'POST', body: { action: 'preview', client: client.id } })
976
+ setPlan({ client, plan: result.plan })
977
+ } catch (error) {
978
+ toast(error.message, 'error')
979
+ } finally {
980
+ setBusy(null)
981
+ }
982
+ }, [toast])
983
+
984
+ const register = useCallback(async client => {
985
+ setBusy(client.id)
986
+ try {
987
+ await api('/clients', { method: 'POST', body: { action: 'register', client: client.id } })
988
+ toast(t('clients.registeredState') + ' · ' + client.label, 'success')
989
+ setPlan(null)
990
+ setConfirm(null)
991
+ await load(true)
992
+ } catch (error) {
993
+ toast(error.message, 'error')
994
+ } finally {
995
+ setBusy(null)
996
+ }
997
+ }, [toast, t, load])
998
+
999
+ const registerDetected = useCallback(async () => {
1000
+ setBusy('detected')
1001
+ try {
1002
+ await api('/clients', { method: 'POST', body: { action: 'register-detected' } })
1003
+ toast(t('clients.registerDetected'), 'success')
1004
+ await load(true)
1005
+ } catch (error) {
1006
+ toast(error.message, 'error')
1007
+ } finally {
1008
+ setBusy(null)
1009
+ }
1010
+ }, [toast, t, load])
1011
+
1012
+ const installSkill = useCallback(async () => {
1013
+ setBusy('skill')
1014
+ try {
1015
+ await api('/skill', { method: 'POST', body: { action: 'install' } })
1016
+ toast(t('clients.skillRefresh'), 'success')
1017
+ await load(true)
1018
+ } catch (error) {
1019
+ toast(error.message, 'error')
1020
+ } finally {
1021
+ setBusy(null)
1022
+ }
1023
+ }, [toast, t, load])
1024
+
1025
+ return h('div', { className: 're-stack' },
1026
+ h(Card, {
1027
+ title: t('clients.skill'),
1028
+ subtitle: t('clients.skillHint'),
1029
+ actions: h(Button, { small: true, icon: 'refresh', onClick: installSkill, busy: busy === 'skill', disabled: Boolean(busy) }, t('clients.skillRefresh')),
1030
+ },
1031
+ h('div', { className: 're-kv' },
1032
+ h('div', { className: 're-kv-item' },
1033
+ h('div', { className: 're-kv-label' }, t('overview.skill')),
1034
+ h('div', { className: 're-kv-value' }, data?.skill ? (data.skill.state + ' · v' + (data.skill.installed_version ?? '?')) : '—')),
1035
+ h('div', { className: 're-kv-item' },
1036
+ h('div', { className: 're-kv-label' }, t('overview.dataDir')),
1037
+ h('div', { className: 're-kv-value re-mono' }, data?.skill?.issues?.[0]?.path ?? '—')))),
1038
+ h(Card, {
1039
+ title: t('clients.title'),
1040
+ subtitle: t('clients.hint'),
1041
+ actions: h('div', { className: 're-card-actions' },
1042
+ h(Button, { small: true, icon: 'refresh', onClick: () => load(true), busy: loading, disabled: Boolean(busy) }, t('action.refreshStatus')),
1043
+ h(Button, { small: true, variant: 'primary', onClick: registerDetected, busy: busy === 'detected', disabled: Boolean(busy) || detected.length === 0 }, t('clients.registerDetected'))),
1044
+ },
1045
+ h('div', { className: 're-toolbar', style: { marginBottom: '10px' } },
1046
+ h('input', { className: 're-input', placeholder: t('clients.search'), value: query, onChange: event => setQuery(event.target.value), 'aria-label': t('clients.search') }),
1047
+ h(Chip, { tone: 'success', dot: false }, t('clients.registered', { count: registered.length })),
1048
+ h(Chip, { tone: 'idle', dot: false }, t('clients.detected', { count: detected.length }))),
1049
+ h('p', { className: 're-hint', style: { marginBottom: '8px' } }, t('clients.registerDetectedHint')),
1050
+ loading && !data
1051
+ ? h('p', { className: 're-empty' }, t('status.loading'))
1052
+ : filtered.length
1053
+ ? h('div', null, filtered.map(client => h(ClientRow, { key: client.id, t, client, busy, onPreview: preview, onRegister: client2 => setConfirm(client2) })))
1054
+ : h('p', { className: 're-empty' }, t('clients.noDetected'))),
1055
+ plan
1056
+ ? h(ConfirmDialog, {
1057
+ title: t('clients.plan') + ' · ' + plan.client.label,
1058
+ cancelLabel: t('action.close'),
1059
+ confirmLabel: t('action.register'),
1060
+ busy: busy === plan.client.id,
1061
+ onCancel: () => setPlan(null),
1062
+ onConfirm: () => register(plan.client),
1063
+ }, h('pre', { className: 're-pre' }, JSON.stringify(plan.plan, null, 2)))
1064
+ : null,
1065
+ confirm
1066
+ ? h(ConfirmDialog, {
1067
+ title: t('clients.confirmTitle'),
1068
+ cancelLabel: t('action.cancel'),
1069
+ confirmLabel: t('action.confirm'),
1070
+ busy: busy === confirm.id,
1071
+ onCancel: () => setConfirm(null),
1072
+ onConfirm: () => register(confirm),
1073
+ }, h('p', null, t('clients.confirmBody', { client: confirm.label })), h('p', { className: 're-hint' }, confirm.configPath ?? ''))
1074
+ : null)
1075
+ }
1076
+
1077
+ function WorkflowsTab(props) {
1078
+ const { t, toast } = props
1079
+ const [prompts, setPrompts] = useState(null)
1080
+ const [selected, setSelected] = useState(null)
1081
+ const [args, setArgs] = useState('{}')
1082
+ const [output, setOutput] = useState(null)
1083
+ const [busy, setBusy] = useState(false)
1084
+
1085
+ useEffect(() => {
1086
+ api('/prompts').then(data => {
1087
+ setPrompts(data.prompts)
1088
+ if (data.prompts?.[0]) setSelected(data.prompts[0].name)
1089
+ }).catch(error => toast(error.message, 'error'))
1090
+ }, [toast])
1091
+
1092
+ const current = (prompts ?? []).find(prompt => prompt.name === selected)
1093
+ const generate = useCallback(async () => {
1094
+ if (!current) return
1095
+ let parsed
1096
+ try {
1097
+ parsed = args.trim() ? JSON.parse(args) : {}
1098
+ } catch {
1099
+ toast(t('tools.argsError'), 'error')
1100
+ return
1101
+ }
1102
+ setBusy(true)
1103
+ try {
1104
+ const data = await api('/prompt', { method: 'POST', body: { name: current.name, arguments: parsed } })
1105
+ setOutput(data)
1106
+ } catch (error) {
1107
+ toast(error.message, 'error')
1108
+ } finally {
1109
+ setBusy(false)
1110
+ }
1111
+ }, [args, current, toast, t])
1112
+
1113
+ return h('div', { className: 're-split' },
1114
+ h('div', { className: 're-list' },
1115
+ h('div', { className: 're-list-head' }, h('p', { className: 're-hint' }, t('workflows.hint'))),
1116
+ h('div', { className: 're-list-scroll' },
1117
+ (prompts ?? []).map(prompt => h('button', {
1118
+ key: prompt.name,
1119
+ type: 'button',
1120
+ className: 're-row',
1121
+ 'aria-current': prompt.name === selected ? 'true' : undefined,
1122
+ onClick: () => { setSelected(prompt.name); setOutput(null) },
1123
+ },
1124
+ h('span', { className: 're-row-name' }, prompt.name),
1125
+ h('span', { className: 're-row-desc' }, prompt.title || prompt.description))))),
1126
+ h('div', { className: 're-stack' },
1127
+ !current
1128
+ ? h(Card, null, h('p', { className: 're-empty' }, t('workflows.empty')))
1129
+ : h(Card, { title: current.title || current.name, subtitle: current.description },
1130
+ current.arguments?.length
1131
+ ? h('div', { style: { marginBottom: '12px' } },
1132
+ h('p', { className: 're-label' }, t('workflows.argumentsTitle')),
1133
+ h('div', { className: 're-checks' }, current.arguments.map(argument => h(Chip, { key: argument.name, tone: 'idle', dot: false }, argument.name + (argument.required ? ' *' : '')))))
1134
+ : null,
1135
+ h(Field, { label: t('workflows.args') },
1136
+ h('textarea', { className: 're-textarea', value: args, onChange: event => setArgs(event.target.value), spellCheck: false })),
1137
+ h('div', { className: 're-toolbar', style: { marginTop: '10px' } },
1138
+ h(Button, { variant: 'primary', icon: 'play', onClick: generate, busy, disabled: busy }, t('action.generate')))),
1139
+ output
1140
+ ? h(Card, {
1141
+ title: t('workflows.result'),
1142
+ actions: h(Button, { small: true, icon: 'copy', onClick: () => copyText(output.text).then(() => toast(t('action.copied'), 'success')) }, t('action.copy')),
1143
+ },
1144
+ h('pre', { className: 're-pre' }, output.text))
1145
+ : h(Card, { title: t('workflows.result') }, h('p', { className: 're-empty' }, t('workflows.empty')))))
1146
+ }
1147
+
1148
+ function SettingsTab(props) {
1149
+ const { t, state, toast, onSaved } = props
1150
+ const [form, setForm] = useState(null)
1151
+ const [saving, setSaving] = useState(false)
1152
+ const [families, setFamilies] = useState([])
1153
+ const [envText, setEnvText] = useState('')
1154
+
1155
+ useEffect(() => {
1156
+ if (!state?.settings) return
1157
+ setForm({
1158
+ reaPackagePath: state.settings.reaPackagePath ?? '',
1159
+ nodePath: state.settings.nodePath ?? '',
1160
+ toolExposure: state.settings.toolExposure ?? 'core',
1161
+ toolFamilies: state.settings.toolFamilies ?? [],
1162
+ toolCallTimeoutMs: state.settings.toolCallTimeoutMs ?? 450000,
1163
+ startupTimeoutMs: state.settings.startupTimeoutMs ?? 120000,
1164
+ connectOnStart: state.settings.connectOnStart !== false,
1165
+ httpEnabled: state.settings.httpEnabled === true,
1166
+ httpHost: state.settings.httpHost ?? '127.0.0.1',
1167
+ httpPort: state.settings.httpPort ?? 0,
1168
+ })
1169
+ setEnvText(Object.entries(state.settings.env ?? {}).map(([key, value]) => key + '=' + value).join('\n'))
1170
+ setFamilies(state.catalog?.families ?? [])
1171
+ }, [state])
1172
+
1173
+ if (!form) return h('p', { className: 're-empty' }, t('status.loading'))
1174
+
1175
+ const update = (key, value) => setForm(current => ({ ...current, [key]: value }))
1176
+ const save = async () => {
1177
+ const env = {}
1178
+ for (const line of envText.split(/\r?\n/)) {
1179
+ const trimmed = line.trim()
1180
+ if (!trimmed || trimmed.startsWith('#')) continue
1181
+ const index = trimmed.indexOf('=')
1182
+ if (index <= 0) continue
1183
+ env[trimmed.slice(0, index).trim()] = trimmed.slice(index + 1).trim()
1184
+ }
1185
+ setSaving(true)
1186
+ try {
1187
+ await api('/settings', { method: 'POST', body: { settings: { ...form, env } } })
1188
+ toast(t('settings.saved'), 'success')
1189
+ onSaved?.()
1190
+ } catch (error) {
1191
+ toast(error.message, 'error')
1192
+ } finally {
1193
+ setSaving(false)
1194
+ }
1195
+ }
1196
+
1197
+ const runtime = state?.runtime
1198
+ const runtimeCard = h(Card, { title: t('settings.runtime'), subtitle: t('settings.restartNeeded') },
1199
+ h('div', { className: 're-form' },
1200
+ h(Field, { label: t('settings.reaPath'), hint: t('settings.reaPathHint'), wide: true },
1201
+ h('input', { className: 're-input re-mono', value: form.reaPackagePath, onChange: event => update('reaPackagePath', event.target.value), placeholder: runtime?.rea?.path ?? '' })),
1202
+ h(Field, { label: t('settings.nodePath'), hint: t('settings.nodePathHint'), wide: true },
1203
+ h('input', { className: 're-input re-mono', value: form.nodePath, onChange: event => update('nodePath', event.target.value), placeholder: runtime?.node?.path ?? '' })),
1204
+ runtime?.node && runtime.node.supported === false
1205
+ ? h('p', { className: 're-error re-form-wide' }, t('settings.nodeWarning', { reason: runtime.node.reason ?? '' }))
1206
+ : null))
1207
+
1208
+ const exposureOptions = [
1209
+ ['core', t('settings.exposureCore'), t('settings.exposureCoreHint')],
1210
+ ['families', t('settings.exposureFamilies'), t('settings.exposureFamiliesHint')],
1211
+ ['all', t('settings.exposureAll'), t('settings.exposureAllHint')],
1212
+ ]
1213
+ const familyChecks = form.toolExposure === 'families'
1214
+ ? h('div', { style: { marginTop: '12px' } },
1215
+ h('p', { className: 're-label', style: { marginBottom: '6px' } }, t('settings.families')),
1216
+ h('div', { className: 're-checks' }, families.map(item =>
1217
+ h('label', { key: item.id, className: 're-check', 'data-checked': form.toolFamilies.includes(item.id) },
1218
+ h('input', {
1219
+ type: 'checkbox',
1220
+ checked: form.toolFamilies.includes(item.id),
1221
+ onChange: event => {
1222
+ const next = new Set(form.toolFamilies)
1223
+ if (event.target.checked) next.add(item.id)
1224
+ else next.delete(item.id)
1225
+ update('toolFamilies', [...next])
1226
+ },
1227
+ }),
1228
+ item.id + ' (' + item.count + ')'))))
1229
+ : null
1230
+ const exposureCard = h(Card, { title: t('settings.exposure') },
1231
+ h('div', { className: 're-radio-row' }, exposureOptions.map(([value, label, hint]) =>
1232
+ h('label', { key: value, className: 're-radio', 'data-checked': form.toolExposure === value },
1233
+ h('input', { type: 'radio', name: 'exposure', checked: form.toolExposure === value, onChange: () => update('toolExposure', value) }),
1234
+ h('span', null,
1235
+ h('span', { className: 're-radio-title' }, label),
1236
+ h('span', { className: 're-radio-hint' }, hint))))),
1237
+ familyChecks)
1238
+
1239
+ const timeoutsCard = h(Card, { title: t('settings.timeouts') },
1240
+ h('div', { className: 're-form' },
1241
+ h(Field, { label: t('settings.callTimeout') },
1242
+ h('input', { className: 're-input', type: 'number', min: 5000, max: 3600000, step: 1000, value: form.toolCallTimeoutMs, onChange: event => update('toolCallTimeoutMs', Number(event.target.value)) })),
1243
+ h(Field, { label: t('settings.startupTimeout') },
1244
+ h('input', { className: 're-input', type: 'number', min: 10000, max: 600000, step: 1000, value: form.startupTimeoutMs, onChange: event => update('startupTimeoutMs', Number(event.target.value)) })),
1245
+ h('label', { className: 're-check re-form-wide', 'data-checked': form.connectOnStart },
1246
+ h('input', { type: 'checkbox', checked: form.connectOnStart, onChange: event => update('connectOnStart', event.target.checked) }),
1247
+ t('settings.connectOnStart'))))
1248
+
1249
+ const httpUrlField = state?.http?.url
1250
+ ? h(Field, { label: t('settings.httpUrl'), wide: true },
1251
+ h('div', { className: 're-toolbar' },
1252
+ h('input', { className: 're-input re-mono', readOnly: true, value: state.http.url }),
1253
+ h(Button, { small: true, icon: 'copy', onClick: () => copyText(state.http.url).then(() => toast(t('action.copied'), 'success')) }, t('action.copy'))))
1254
+ : null
1255
+ const httpCard = h(Card, { title: t('settings.http'), subtitle: t('settings.httpHint') },
1256
+ h('div', { className: 're-form' },
1257
+ h('label', { className: 're-check re-form-wide', 'data-checked': form.httpEnabled },
1258
+ h('input', { type: 'checkbox', checked: form.httpEnabled, onChange: event => update('httpEnabled', event.target.checked) }),
1259
+ t('settings.httpEnable')),
1260
+ h(Field, { label: t('settings.httpHost') },
1261
+ h('input', { className: 're-input', value: form.httpHost, onChange: event => update('httpHost', event.target.value) })),
1262
+ h(Field, { label: t('settings.httpPort') },
1263
+ h('input', { className: 're-input', type: 'number', min: 0, max: 65535, value: form.httpPort, onChange: event => update('httpPort', Number(event.target.value)) })),
1264
+ httpUrlField))
1265
+
1266
+ const envCard = h(Card, { title: t('settings.env'), subtitle: t('settings.envHint') },
1267
+ h('textarea', { className: 're-textarea', value: envText, onChange: event => setEnvText(event.target.value), spellCheck: false, placeholder: 'GHIDRA_INSTALL_DIR=D:\\ghidra' }))
1268
+
1269
+ const saveRow = h('div', { className: 're-toolbar' },
1270
+ h(Button, { variant: 'primary', onClick: save, busy: saving, disabled: saving }, saving ? t('action.saving') : t('action.save')))
1271
+
1272
+ return h('div', { className: 're-stack' }, runtimeCard, exposureCard, timeoutsCard, httpCard, envCard, saveRow)
1273
+ }
1274
+
1275
+ function LogsTab(props) {
1276
+ const { t, toast } = props
1277
+ const [data, setData] = useState(null)
1278
+ const [loading, setLoading] = useState(false)
1279
+ const load = useCallback(async () => {
1280
+ setLoading(true)
1281
+ try {
1282
+ setData(await api('/logs'))
1283
+ } catch (error) {
1284
+ toast(error.message, 'error')
1285
+ } finally {
1286
+ setLoading(false)
1287
+ }
1288
+ }, [toast])
1289
+ useEffect(() => { load() }, [load])
1290
+ const all = [
1291
+ ...(data?.logs ?? []).map(entry => entry.at + ' ' + entry.level.toUpperCase() + ' ' + entry.message + (entry.tool ? ' · ' + entry.tool : '')),
1292
+ ...(data?.stderr ?? []).map(entry => entry.at + ' stderr ' + entry.line),
1293
+ ]
1294
+ const activityRows = (data?.activity ?? []).map((entry, index) => h('tr', { key: 'activity-' + index },
1295
+ h('td', { className: 're-mono' }, formatTime(entry.at)),
1296
+ h('td', { className: 're-mono' }, entry.tool),
1297
+ h('td', null, entry.ok ? 'ok' : (entry.error ?? 'error')),
1298
+ h('td', { className: 're-mono' }, formatDuration(entry.durationMs))))
1299
+ const eventRows = (data?.logs ?? []).map((entry, index) => h('div', { key: 'event-' + index, className: 're-log-row' },
1300
+ h('span', { className: 're-log-time' }, formatTime(entry.at)),
1301
+ h('span', { className: 're-log-level', 'data-level': entry.level }, entry.level),
1302
+ h('span', { className: 're-log-msg' }, entry.message + (entry.tool ? ' · ' + entry.tool : '') + (entry.status ? ' · ' + entry.status : ''))))
1303
+ const stderrLines = (data?.stderr ?? []).map(entry => entry.line)
1304
+ const activityBlock = h('div', null,
1305
+ h('p', { className: 're-label' }, t('logs.activity')),
1306
+ activityRows.length
1307
+ ? h('table', { className: 're-table' },
1308
+ h('thead', null, h('tr', null,
1309
+ h('th', null, 'time'), h('th', null, 'tool'), h('th', null, 'status'), h('th', null, 'duration'))),
1310
+ h('tbody', null, activityRows))
1311
+ : h('p', { className: 're-hint' }, t('logs.empty')))
1312
+ const eventsBlock = h('div', null,
1313
+ h('p', { className: 're-label' }, t('logs.events')),
1314
+ eventRows.length ? h('div', { className: 're-log' }, eventRows) : h('p', { className: 're-hint' }, t('logs.empty')))
1315
+ const stderrBlock = h('div', null,
1316
+ h('p', { className: 're-label' }, t('logs.stderr')),
1317
+ stderrLines.length ? h('pre', { className: 're-pre re-pre-short' }, stderrLines.join('\n')) : h('p', { className: 're-hint' }, t('logs.empty')))
1318
+ return h('div', { className: 're-stack' },
1319
+ h(Card, {
1320
+ title: t('logs.title'),
1321
+ actions: h('div', { className: 're-card-actions' },
1322
+ h(Button, { small: true, icon: 'refresh', onClick: load, busy: loading }, t('action.refresh')),
1323
+ h(Button, { small: true, icon: 'copy', onClick: () => copyText(all.join('\n')).then(() => toast(t('action.copied'), 'success')) }, t('logs.copy'))),
1324
+ },
1325
+ h('div', { className: 're-stack' }, activityBlock, eventsBlock, stderrBlock)))
1326
+ }
1327
+
1328
+
1329
+ function App(props) {
1330
+ const { t, toast } = props
1331
+ const [state, setState] = useState(null)
1332
+ const [error, setError] = useState(null)
1333
+ const [tab, setTab] = useState('overview')
1334
+ const [busy, setBusy] = useState(null)
1335
+
1336
+ const load = useCallback(async (quiet) => {
1337
+ try {
1338
+ const data = await api('/state')
1339
+ setState(data)
1340
+ setError(null)
1341
+ } catch (err) {
1342
+ if (!quiet) setError(err)
1343
+ }
1344
+ }, [])
1345
+
1346
+ useEffect(() => {
1347
+ load(false)
1348
+ const id = setInterval(() => {
1349
+ if (typeof document !== 'undefined' && document.hidden) return
1350
+ load(true)
1351
+ }, POLL_MS)
1352
+ return () => clearInterval(id)
1353
+ }, [load])
1354
+
1355
+ const action = useCallback(async name => {
1356
+ setBusy(name)
1357
+ try {
1358
+ const result = await api('/engine', { method: 'POST', body: { action: name } })
1359
+ setState(result)
1360
+ toast(name === 'restart' ? t('action.restart') : name === 'start' ? t('action.start') : t('action.stop'), 'success')
1361
+ } catch (err) {
1362
+ toast(err.message, 'error')
1363
+ } finally {
1364
+ setBusy(null)
1365
+ }
1366
+ }, [t, toast])
1367
+
1368
+ const installRuntime = useCallback(async () => {
1369
+ try {
1370
+ await api('/install', { method: 'POST', body: {} })
1371
+ toast(t('overview.installRunning'), 'success')
1372
+ await load(true)
1373
+ } catch (err) {
1374
+ toast(err.message, 'error')
1375
+ }
1376
+ }, [t, toast, load])
1377
+
1378
+ const engine = state?.engine
1379
+ const engineTone = engine?.status === 'ready' ? 'success' : engine?.status === 'error' ? 'error' : engine?.status === 'starting' ? 'warn' : 'idle'
1380
+ const tabs = [
1381
+ ['overview', t('tab.overview'), null],
1382
+ ['tools', t('tab.tools'), state?.catalog?.tools ?? null],
1383
+ ['clients', t('tab.clients'), state?.clients?.registered ?? null],
1384
+ ['workflows', t('tab.workflows'), state?.catalog?.prompts ?? null],
1385
+ ['settings', t('tab.settings'), null],
1386
+ ['logs', t('tab.logs'), null],
1387
+ ]
1388
+
1389
+ return h('div', { className: 're-page' },
1390
+ h('style', null, CSS),
1391
+ h('div', { className: 're-inner' },
1392
+ h('header', { className: 're-header' },
1393
+ h('div', { className: 're-titlebar' },
1394
+ h('span', { className: 're-logo' }, h(LogoIcon)),
1395
+ h('div', null,
1396
+ h('h1', { className: 're-title' }, t('app.title')),
1397
+ h('p', { className: 're-subtitle' }, t('app.subtitle')))),
1398
+ h('div', { className: 're-header-actions' },
1399
+ h(Chip, { tone: engineTone }, engine?.status === 'ready' ? t('status.ready') : engine?.status === 'starting' ? t('status.starting') : engine?.status === 'error' ? t('status.error') : t('status.stopped')),
1400
+ h(Button, { small: true, icon: 'refresh', onClick: () => load(false), busy: busy === 'refresh' }, t('action.refresh')))),
1401
+ h('nav', { className: 're-tabs', role: 'tablist' },
1402
+ tabs.map(([id, label, count]) => h('button', {
1403
+ key: id,
1404
+ type: 'button',
1405
+ role: 'tab',
1406
+ className: 're-tab',
1407
+ 'aria-selected': tab === id,
1408
+ onClick: () => setTab(id),
1409
+ }, label, count != null ? h('span', { className: 're-tab-count' }, count) : null))),
1410
+ error
1411
+ ? h(Notice, { level: 'error' }, t('status.offline') + ': ' + error.message)
1412
+ : null,
1413
+ !state && !error
1414
+ ? h('div', { className: 're-skeleton' })
1415
+ : null,
1416
+ state && tab === 'overview' ? h(Overview, { t, state, busy, onAction: action, onRefresh: () => load(false), onInstall: installRuntime, toast }) : null,
1417
+ state && tab === 'tools' ? h(ToolsTab, { t, state, toast }) : null,
1418
+ state && tab === 'clients' ? h(ClientsTab, { t, toast }) : null,
1419
+ state && tab === 'workflows' ? h(WorkflowsTab, { t, toast }) : null,
1420
+ state && tab === 'settings' ? h(SettingsTab, { t, state, toast, onSaved: () => load(false) }) : null,
1421
+ state && tab === 'logs' ? h(LogsTab, { t, toast }) : null),
1422
+ h(Toast, { t }))
1423
+ }
1424
+
1425
+ const ToastContext = { show: null }
1426
+
1427
+ function Toast(props) {
1428
+ const [toast, setToast] = useState(null)
1429
+ const timer = useRef(null)
1430
+ useEffect(() => {
1431
+ ToastContext.show = (message, tone) => {
1432
+ setToast({ message, tone, id: Date.now() })
1433
+ if (timer.current) clearTimeout(timer.current)
1434
+ timer.current = setTimeout(() => setToast(null), TOAST_MS)
1435
+ }
1436
+ return () => {
1437
+ ToastContext.show = null
1438
+ if (timer.current) clearTimeout(timer.current)
1439
+ }
1440
+ }, [])
1441
+ if (!toast) return null
1442
+ return h('div', { className: 're-toast', 'data-tone': toast.tone, role: 'status' }, toast.message)
1443
+ }
1444
+
1445
+ function toast(message, tone) {
1446
+ if (ToastContext.show) ToastContext.show(message, tone)
1447
+ }
1448
+
1449
+ function LogoIcon() {
1450
+ return h('svg', { width: 22, height: 22, viewBox: '0 0 36 36', 'aria-hidden': 'true', style: { display: 'block' } },
1451
+ h('circle', { cx: 15, cy: 14.6, r: 8.6, fill: 'none', stroke: 'currentColor', strokeWidth: 2.6 }),
1452
+ h('path', { d: 'M21.4 21 28.3 27.9', stroke: 'currentColor', strokeWidth: 3.1, strokeLinecap: 'round' }),
1453
+ h('path', { d: 'M10.9 14.1h8.2M15 9.9v8.4', stroke: '#159a8e', strokeWidth: 1.6, strokeLinecap: 'round', opacity: 0.85 }),
1454
+ h('circle', { cx: 10.9, cy: 14.1, r: 1.7, fill: '#159a8e' }),
1455
+ h('circle', { cx: 19.1, cy: 14.1, r: 1.7, fill: '#159a8e' }),
1456
+ h('circle', { cx: 15, cy: 9.9, r: 1.7, fill: '#159a8e' }))
1457
+ }
1458
+
1459
+ function SidebarIcon() {
1460
+ return h('svg', {
1461
+ width: 18,
1462
+ height: 18,
1463
+ viewBox: '0 0 24 24',
1464
+ fill: 'none',
1465
+ stroke: 'currentColor',
1466
+ strokeWidth: 1.7,
1467
+ strokeLinecap: 'round',
1468
+ strokeLinejoin: 'round',
1469
+ 'aria-hidden': 'true',
1470
+ style: { display: 'block' },
1471
+ },
1472
+ h('circle', { key: 'lens', cx: 10.5, cy: 10.5, r: 6.2 }),
1473
+ h('path', { key: 'handle', d: 'm15.2 15.2 4.6 4.6' }),
1474
+ h('path', { key: 'nodes', d: 'M8 10.5h5M10.5 8v5' }),
1475
+ h('circle', { key: 'n1', cx: 8, cy: 10.5, r: 1, fill: 'currentColor', stroke: 'none' }),
1476
+ h('circle', { key: 'n2', cx: 13, cy: 10.5, r: 1, fill: 'currentColor', stroke: 'none' }),
1477
+ h('circle', { key: 'n3', cx: 10.5, cy: 8, r: 1, fill: 'currentColor', stroke: 'none' }))
1478
+ }
1479
+
1480
+ return {
1481
+ inject: ['slots', 'locale'],
1482
+ __test: { App, Overview, ToolsTab, ClientsTab, WorkflowsTab, SettingsTab, LogsTab, sampleValue, ZH, EN },
1483
+ apply(ctx) {
1484
+ ctx.effect(function () {
1485
+ return ctx.locale.register(NS, { zh: ZH, en: EN })
1486
+ }, 'dsh-reverse-engine: dictionaries')
1487
+ const t = typeof ctx.locale.bind === 'function'
1488
+ ? ctx.locale.bind(NS)
1489
+ : (key, params) => translate(ZH, key, params)
1490
+ ctx.slots.inject('main', function () {
1491
+ return ctx.slots.register({ name: 'main', key: PANEL_ID, locale: NS }, function ReverseEnginePanel() {
1492
+ return h(App, { t, toast })
1493
+ })
1494
+ })
1495
+ ctx.slots.inject('sidebar.panellist', function () {
1496
+ return ctx.slots.register({
1497
+ name: 'sidebar.panellist',
1498
+ id: PANEL_ID,
1499
+ order: 12,
1500
+ locale: NS,
1501
+ label: function () {
1502
+ return t('sidebar.label')
1503
+ },
1504
+ }, SidebarIcon)
1505
+ })
1506
+ },
1507
+ }
1508
+ },
1509
+ })