dsh-plugin-agentdeck 0.1.0 → 0.2.1
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/README.md +31 -54
- package/lib/client.js +562 -586
- package/lib/index.js +201 -21
- package/lib/setup.js +682 -7
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +6 -3
package/lib/client.js
CHANGED
|
@@ -19,7 +19,6 @@ window.__ModuleLoader__.load({
|
|
|
19
19
|
apk: 'https://github.com/mantou132/AgentDeck/releases/latest',
|
|
20
20
|
websiteEn: 'https://agentdeck.xianqiao.wang',
|
|
21
21
|
websiteZh: 'https://agentdeck.xianqiao.wang/zh',
|
|
22
|
-
pluginRepo: 'https://github.com/mantou132/dsh-plugin-agentdeck',
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
const DICTIONARIES = {
|
|
@@ -27,133 +26,99 @@ window.__ModuleLoader__.load({
|
|
|
27
26
|
nav: 'AgentDeck',
|
|
28
27
|
title: 'AgentDeck Mobile Remote',
|
|
29
28
|
subtitle:
|
|
30
|
-
'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
itemCustomAgents: 'AgentDeck custom_agents.json',
|
|
37
|
-
itemDaemon: 'agentdeckd Daemon & Autostart',
|
|
38
|
-
statusReady: 'Ready',
|
|
39
|
-
statusMissing: 'Not configured',
|
|
40
|
-
statusNeedsFix: 'Needs sync',
|
|
41
|
-
statusNotInstalled: 'Not installed',
|
|
42
|
-
statusStopped: 'Stopped',
|
|
43
|
-
acpNotInstalledHint:
|
|
44
|
-
'Will install @openma/deepseek-harness-acp into the acp profile.',
|
|
45
|
-
modelNone: 'Using DSH default model',
|
|
46
|
-
modelAcpLabel: 'acp profile:',
|
|
47
|
-
modelSourceLabel: 'Current profile:',
|
|
48
|
-
modelPinWarning:
|
|
49
|
-
'Non-DeepSeek provider needs acp-plugin provider pin — click Setup to fix.',
|
|
50
|
-
daemonNotInstalledHint:
|
|
51
|
-
'Will install agentdeckd and register OS autostart automatically.',
|
|
52
|
-
daemonStoppedHint:
|
|
53
|
-
'Installed, but not running. Click Setup or Start to launch and enable autostart.',
|
|
54
|
-
syncModelsToggle: 'Sync model & provider from current profile',
|
|
55
|
-
dshNotFound:
|
|
56
|
-
'Could not locate the `dsh` binary. Install dsh CLI or add it to PATH.',
|
|
57
|
-
btnSetup: 'One-Click Setup & Start',
|
|
58
|
-
btnResync: 'Re-sync & Repair',
|
|
59
|
-
btnSettingUp: 'Installing & configuring…',
|
|
60
|
-
btnRefresh: 'Refresh',
|
|
61
|
-
btnDaemonStart: 'Start & Enable Autostart',
|
|
62
|
-
btnDaemonRestart: 'Restart',
|
|
63
|
-
btnDaemonStop: 'Stop & Disable Autostart',
|
|
64
|
-
btnWorking: 'Working…',
|
|
65
|
-
setupSuccess:
|
|
66
|
-
'All set! Open AgentDeck on your phone and scan the QR code below.',
|
|
67
|
-
pairTitle: '2. Pair with AgentDeck App',
|
|
68
|
-
daemonRunning: 'Running',
|
|
69
|
-
daemonStopped: 'Stopped',
|
|
70
|
-
daemonMissing: 'Not installed',
|
|
71
|
-
daemonStartHint:
|
|
72
|
-
'Pairing ID is ready, but agentdeckd is stopped. Click Start to bring your host online and re-enable autostart.',
|
|
73
|
-
daemonAutoHint:
|
|
74
|
-
'Click "One-Click Setup & Start" above to automatically install agentdeckd, enable autostart, and generate your pairing QR code.',
|
|
29
|
+
'Scan with AgentDeck on iPhone or Android to control DeepSeek Harness remotely — end-to-end encrypted.',
|
|
30
|
+
provisioning: 'Setting up remote control & starting agentdeckd…',
|
|
31
|
+
provisioningHint:
|
|
32
|
+
'First-time setup installs the ACP adapter and local daemon automatically. Your QR code will appear here in a few seconds.',
|
|
33
|
+
errorTitle: 'Automatic setup failed',
|
|
34
|
+
btnRetry: 'Retry Setup',
|
|
75
35
|
qrHint:
|
|
76
|
-
'Open AgentDeck on your phone and scan this QR code to pair. Keep
|
|
36
|
+
'Open AgentDeck on your phone and scan this QR code to pair. Keep it private — it grants full access to this machine.',
|
|
77
37
|
pairingIdLabel: 'Pairing ID',
|
|
78
|
-
customRelayLabel: '
|
|
38
|
+
customRelayLabel: 'Relay',
|
|
39
|
+
stoppedBanner:
|
|
40
|
+
'Remote service is currently stopped. Start it below to connect from your phone.',
|
|
41
|
+
serviceTitle: 'Remote Service & Autostart',
|
|
42
|
+
serviceDescRunning: 'Running in background and starts on login.',
|
|
43
|
+
serviceDescStopped: 'Stopped — mobile devices cannot connect.',
|
|
44
|
+
statusRunning: 'Running',
|
|
45
|
+
statusStopped: 'Stopped',
|
|
46
|
+
btnStart: 'Start',
|
|
47
|
+
btnStop: 'Stop',
|
|
48
|
+
btnRestart: 'Restart',
|
|
49
|
+
btnUpdate: 'Update',
|
|
50
|
+
btnUpdating: 'Updating…',
|
|
51
|
+
btnWorking: 'Working…',
|
|
52
|
+
updateAvailable: 'Update available:',
|
|
53
|
+
awakeTitle: 'Prevent Automatic Sleep',
|
|
54
|
+
awakeActive: 'Active',
|
|
55
|
+
awakeInactive: 'Inactive',
|
|
56
|
+
awakeNever: 'Off',
|
|
57
|
+
awakePlugged: 'On Power',
|
|
58
|
+
awakeActiveMode: 'Active 1h',
|
|
59
|
+
awakeAlways: 'Always',
|
|
60
|
+
awakeHintNever: 'Let the OS sleep normally.',
|
|
61
|
+
awakeHintPlugged: 'Stay awake while plugged into external power.',
|
|
62
|
+
awakeHintActive: 'Stay awake for 1 hour after the last mobile interaction.',
|
|
63
|
+
awakeHintAlways: 'Always stay awake while the remote service runs.',
|
|
64
|
+
modelTitle: 'Mobile Default Model',
|
|
65
|
+
modelDefault: 'DeepSeek Harness default',
|
|
66
|
+
btnSyncModel: 'Sync current',
|
|
79
67
|
downloadTitle: 'Get AgentDeck',
|
|
80
|
-
linkAppStore: 'App Store
|
|
68
|
+
linkAppStore: 'App Store',
|
|
81
69
|
linkGooglePlay: 'Google Play',
|
|
82
70
|
linkApk: 'Android APK',
|
|
83
71
|
linkWebsite: 'Website',
|
|
84
|
-
loading: '
|
|
85
|
-
loadError: 'Operation failed',
|
|
86
|
-
stepInstalled: 'Installed',
|
|
87
|
-
stepSkipped: 'Already ready',
|
|
88
|
-
stepUpdated: 'Updated',
|
|
89
|
-
stepUnchanged: 'No changes needed',
|
|
90
|
-
stepStarted: 'Started with autostart',
|
|
72
|
+
loading: 'Loading…',
|
|
91
73
|
isZh: '0',
|
|
92
74
|
},
|
|
93
75
|
zh: {
|
|
94
76
|
nav: 'AgentDeck 手机远控',
|
|
95
77
|
title: 'AgentDeck 手机远控',
|
|
96
78
|
subtitle:
|
|
97
|
-
'
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
'
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
itemCustomAgents: 'AgentDeck custom_agents.json',
|
|
104
|
-
itemDaemon: 'agentdeckd 守护服务与自启',
|
|
105
|
-
statusReady: '已就绪',
|
|
106
|
-
statusMissing: '未配置',
|
|
107
|
-
statusNeedsFix: '待修复',
|
|
108
|
-
statusNotInstalled: '未安装',
|
|
109
|
-
statusStopped: '未运行',
|
|
110
|
-
acpNotInstalledHint:
|
|
111
|
-
'点击一键配置将自动为 acp profile 安装 @openma/deepseek-harness-acp。',
|
|
112
|
-
modelNone: '使用 DSH 默认模型',
|
|
113
|
-
modelAcpLabel: 'acp 配置:',
|
|
114
|
-
modelSourceLabel: '当前界面:',
|
|
115
|
-
modelPinWarning:
|
|
116
|
-
'第三方服务商需要同步 acp-plugin 的 provider 配置,点击一键配置即可自动修复。',
|
|
117
|
-
daemonNotInstalledHint:
|
|
118
|
-
'点击一键配置将自动安装 agentdeckd 并注册系统开机自启。',
|
|
119
|
-
daemonStoppedHint:
|
|
120
|
-
'已安装但未运行,点击一键配置或下方「启动并开启自启」即可上线。',
|
|
121
|
-
syncModelsToggle: '将当前界面的模型与服务商配置同步到 acp profile',
|
|
122
|
-
dshNotFound:
|
|
123
|
-
'未检测到 `dsh` 可执行文件,请先安装 DeepSeek Harness CLI 或加入 PATH。',
|
|
124
|
-
btnSetup: '一键配置并启动',
|
|
125
|
-
btnResync: '重新同步 / 修复',
|
|
126
|
-
btnSettingUp: '正在安装与配置…',
|
|
127
|
-
btnRefresh: '刷新状态',
|
|
128
|
-
btnDaemonStart: '启动并开启自启',
|
|
129
|
-
btnDaemonRestart: '重启',
|
|
130
|
-
btnDaemonStop: '停止并取消自启',
|
|
131
|
-
btnWorking: '处理中…',
|
|
132
|
-
setupSuccess: '全部配置并启动完成!打开手机上的 AgentDeck 扫描下方二维码即可连接。',
|
|
133
|
-
pairTitle: '2. 手机扫码配对',
|
|
134
|
-
daemonRunning: '运行中',
|
|
135
|
-
daemonStopped: '已停止',
|
|
136
|
-
daemonMissing: '未安装',
|
|
137
|
-
daemonStartHint:
|
|
138
|
-
'已生成配对信息,但 agentdeckd 当前未运行。点击「启动并开启自启」即可上线。',
|
|
139
|
-
daemonAutoHint:
|
|
140
|
-
'点击上方「一键配置并启动」,插件会自动安装 agentdeckd、设置开机自启,并在此生成配对二维码。',
|
|
79
|
+
'打开手机上的 AgentDeck 扫码即可远程控制 DeepSeek Harness,端到端加密。',
|
|
80
|
+
provisioning: '正在自动配置远程控制并启动服务…',
|
|
81
|
+
provisioningHint:
|
|
82
|
+
'首次安装会自动准备 ACP 适配器与本地守护服务并注册开机自启,完成后二维码会自动出现。',
|
|
83
|
+
errorTitle: '自动初始化失败',
|
|
84
|
+
btnRetry: '重试',
|
|
141
85
|
qrHint:
|
|
142
86
|
'打开手机上的 AgentDeck App 扫描此二维码即可配对。请勿泄露二维码——它代表本机远程访问权限。',
|
|
143
87
|
pairingIdLabel: '配对 ID',
|
|
144
|
-
customRelayLabel: '
|
|
145
|
-
|
|
146
|
-
|
|
88
|
+
customRelayLabel: 'Relay',
|
|
89
|
+
stoppedBanner: '远程服务当前已停止,开启下方服务开关后手机即可连接。',
|
|
90
|
+
serviceTitle: '远程服务与开机自启',
|
|
91
|
+
serviceDescRunning: '已在后台运行并开启登录自启。',
|
|
92
|
+
serviceDescStopped: '已停止,手机端暂时无法连接。',
|
|
93
|
+
statusRunning: '运行中',
|
|
94
|
+
statusStopped: '已停止',
|
|
95
|
+
btnStart: '开启',
|
|
96
|
+
btnStop: '停止',
|
|
97
|
+
btnRestart: '重启',
|
|
98
|
+
btnUpdate: '更新',
|
|
99
|
+
btnUpdating: '更新中…',
|
|
100
|
+
btnWorking: '处理中…',
|
|
101
|
+
updateAvailable: '有新版本:',
|
|
102
|
+
awakeTitle: '防自动休眠',
|
|
103
|
+
awakeActive: '生效中',
|
|
104
|
+
awakeInactive: '未激活',
|
|
105
|
+
awakeNever: '关闭',
|
|
106
|
+
awakePlugged: '插电常亮',
|
|
107
|
+
awakeActiveMode: '活跃 1 小时',
|
|
108
|
+
awakeAlways: '始终常亮',
|
|
109
|
+
awakeHintNever: '跟随系统默认休眠策略。',
|
|
110
|
+
awakeHintPlugged: '接通外接电源时防止电脑自动休眠。',
|
|
111
|
+
awakeHintActive: '最近 1 小时有手机远控交互时保持唤醒。',
|
|
112
|
+
awakeHintAlways: '远程服务运行期间始终防止自动休眠。',
|
|
113
|
+
modelTitle: '手机端默认模型',
|
|
114
|
+
modelDefault: '使用 DSH 默认模型',
|
|
115
|
+
btnSyncModel: '同步当前模型',
|
|
116
|
+
downloadTitle: '下载 AgentDeck',
|
|
117
|
+
linkAppStore: 'App Store',
|
|
147
118
|
linkGooglePlay: 'Google Play',
|
|
148
119
|
linkApk: 'Android APK',
|
|
149
120
|
linkWebsite: '官网',
|
|
150
|
-
loading: '
|
|
151
|
-
loadError: '操作失败',
|
|
152
|
-
stepInstalled: '已安装',
|
|
153
|
-
stepSkipped: '已就绪',
|
|
154
|
-
stepUpdated: '已更新',
|
|
155
|
-
stepUnchanged: '无需变更',
|
|
156
|
-
stepStarted: '已启动并开启自启',
|
|
121
|
+
loading: '加载中…',
|
|
157
122
|
isZh: '1',
|
|
158
123
|
},
|
|
159
124
|
};
|
|
@@ -168,12 +133,6 @@ window.__ModuleLoader__.load({
|
|
|
168
133
|
font-size: 13px;
|
|
169
134
|
line-height: 1.5;
|
|
170
135
|
}
|
|
171
|
-
.adk-hero {
|
|
172
|
-
display: flex;
|
|
173
|
-
align-items: flex-start;
|
|
174
|
-
justify-content: space-between;
|
|
175
|
-
gap: 12px;
|
|
176
|
-
}
|
|
177
136
|
.adk-title {
|
|
178
137
|
margin: 0 0 4px;
|
|
179
138
|
font-size: 16px;
|
|
@@ -192,43 +151,135 @@ window.__ModuleLoader__.load({
|
|
|
192
151
|
padding: 16px;
|
|
193
152
|
display: flex;
|
|
194
153
|
flex-direction: column;
|
|
195
|
-
gap:
|
|
154
|
+
gap: 14px;
|
|
155
|
+
}
|
|
156
|
+
.adk-desc {
|
|
157
|
+
margin: 0;
|
|
158
|
+
font-size: 12.5px;
|
|
159
|
+
color: var(--dsw-alias-label-tertiary, #6b7280);
|
|
196
160
|
}
|
|
197
|
-
.adk-
|
|
161
|
+
.adk-text-err {
|
|
162
|
+
color: #ef4444;
|
|
163
|
+
}
|
|
164
|
+
.adk-qr-layout {
|
|
198
165
|
display: flex;
|
|
166
|
+
gap: 16px;
|
|
199
167
|
align-items: center;
|
|
200
|
-
justify-content: space-between;
|
|
201
|
-
gap: 10px;
|
|
202
168
|
flex-wrap: wrap;
|
|
203
169
|
}
|
|
204
|
-
.adk-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
170
|
+
.adk-qr-frame {
|
|
171
|
+
width: 168px;
|
|
172
|
+
height: 168px;
|
|
173
|
+
padding: 8px;
|
|
174
|
+
box-sizing: border-box;
|
|
175
|
+
border-radius: 12px;
|
|
176
|
+
background: #ffffff;
|
|
177
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
178
|
+
flex-shrink: 0;
|
|
179
|
+
display: flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
justify-content: center;
|
|
182
|
+
}
|
|
183
|
+
.adk-qr-frame img {
|
|
184
|
+
width: 100%;
|
|
185
|
+
height: 100%;
|
|
186
|
+
display: block;
|
|
187
|
+
}
|
|
188
|
+
.adk-qr-info {
|
|
189
|
+
flex: 1;
|
|
190
|
+
min-width: 210px;
|
|
191
|
+
display: flex;
|
|
192
|
+
flex-direction: column;
|
|
193
|
+
gap: 8px;
|
|
194
|
+
}
|
|
195
|
+
.adk-meta-line {
|
|
196
|
+
font-size: 12px;
|
|
197
|
+
color: var(--dsw-alias-label-tertiary, #6b7280);
|
|
198
|
+
}
|
|
199
|
+
.adk-meta-line code {
|
|
200
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
208
201
|
color: var(--dsw-alias-label-primary, #111827);
|
|
202
|
+
background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.1));
|
|
203
|
+
padding: 1px 5px;
|
|
204
|
+
border-radius: 4px;
|
|
209
205
|
}
|
|
210
|
-
.adk-
|
|
211
|
-
|
|
206
|
+
.adk-provisioning {
|
|
207
|
+
display: flex;
|
|
208
|
+
flex-direction: column;
|
|
209
|
+
gap: 6px;
|
|
210
|
+
padding: 6px 0;
|
|
211
|
+
}
|
|
212
|
+
.adk-provisioning-title {
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
gap: 8px;
|
|
216
|
+
font-size: 13.5px;
|
|
217
|
+
font-weight: 500;
|
|
218
|
+
}
|
|
219
|
+
.adk-spinner {
|
|
220
|
+
width: 14px;
|
|
221
|
+
height: 14px;
|
|
222
|
+
border-radius: 999px;
|
|
223
|
+
border: 2px solid var(--dsw-alias-border-l3, rgba(127, 127, 127, 0.3));
|
|
224
|
+
border-top-color: var(--dsw-alias-button-primary-fill, #2563eb);
|
|
225
|
+
animation: adk-spin 0.8s linear infinite;
|
|
226
|
+
flex-shrink: 0;
|
|
227
|
+
}
|
|
228
|
+
@keyframes adk-spin {
|
|
229
|
+
to { transform: rotate(360deg); }
|
|
230
|
+
}
|
|
231
|
+
.adk-banner {
|
|
232
|
+
border-radius: var(--dsw-radius-md, 8px);
|
|
233
|
+
padding: 10px 12px;
|
|
212
234
|
font-size: 12.5px;
|
|
213
|
-
|
|
235
|
+
line-height: 1.5;
|
|
236
|
+
display: flex;
|
|
237
|
+
align-items: center;
|
|
238
|
+
justify-content: space-between;
|
|
239
|
+
gap: 10px;
|
|
240
|
+
flex-wrap: wrap;
|
|
241
|
+
}
|
|
242
|
+
.adk-banner-err {
|
|
243
|
+
background: rgba(239, 68, 68, 0.12);
|
|
244
|
+
border: 1px solid rgba(239, 68, 68, 0.32);
|
|
245
|
+
color: #ef4444;
|
|
246
|
+
}
|
|
247
|
+
.adk-banner-warn {
|
|
248
|
+
background: rgba(245, 158, 11, 0.12);
|
|
249
|
+
border: 1px solid rgba(245, 158, 11, 0.3);
|
|
250
|
+
color: #d97706;
|
|
214
251
|
}
|
|
215
|
-
.adk-
|
|
252
|
+
.adk-rows {
|
|
216
253
|
display: flex;
|
|
217
254
|
flex-direction: column;
|
|
218
|
-
border-top: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.15));
|
|
219
255
|
}
|
|
220
256
|
.adk-row {
|
|
221
257
|
display: flex;
|
|
222
|
-
align-items:
|
|
258
|
+
align-items: center;
|
|
223
259
|
justify-content: space-between;
|
|
224
260
|
gap: 12px;
|
|
225
|
-
padding:
|
|
261
|
+
padding: 12px 0;
|
|
226
262
|
border-bottom: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.15));
|
|
263
|
+
flex-wrap: wrap;
|
|
264
|
+
}
|
|
265
|
+
.adk-row:first-child {
|
|
266
|
+
padding-top: 2px;
|
|
227
267
|
}
|
|
228
268
|
.adk-row:last-child {
|
|
229
269
|
border-bottom: none;
|
|
230
270
|
padding-bottom: 2px;
|
|
231
271
|
}
|
|
272
|
+
.adk-row-col {
|
|
273
|
+
flex-direction: column;
|
|
274
|
+
align-items: stretch;
|
|
275
|
+
gap: 8px;
|
|
276
|
+
}
|
|
277
|
+
.adk-row-head {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
justify-content: space-between;
|
|
281
|
+
gap: 8px;
|
|
282
|
+
}
|
|
232
283
|
.adk-row-main {
|
|
233
284
|
display: flex;
|
|
234
285
|
flex-direction: column;
|
|
@@ -237,65 +288,49 @@ window.__ModuleLoader__.load({
|
|
|
237
288
|
flex: 1;
|
|
238
289
|
}
|
|
239
290
|
.adk-row-label {
|
|
291
|
+
display: flex;
|
|
292
|
+
align-items: center;
|
|
293
|
+
gap: 8px;
|
|
240
294
|
font-weight: 500;
|
|
241
295
|
color: var(--dsw-alias-label-primary, #111827);
|
|
242
296
|
}
|
|
243
|
-
.adk-row-detail {
|
|
244
|
-
font-size: 12px;
|
|
245
|
-
color: var(--dsw-alias-label-tertiary, #6b7280);
|
|
246
|
-
word-break: break-all;
|
|
247
|
-
}
|
|
248
297
|
.adk-badge {
|
|
249
298
|
display: inline-flex;
|
|
250
299
|
align-items: center;
|
|
251
|
-
|
|
252
|
-
padding: 2px 8px;
|
|
300
|
+
padding: 1px 8px;
|
|
253
301
|
border-radius: 999px;
|
|
254
302
|
font-size: 11.5px;
|
|
255
303
|
font-weight: 500;
|
|
256
304
|
white-space: nowrap;
|
|
257
|
-
flex-shrink: 0;
|
|
258
305
|
}
|
|
259
306
|
.adk-badge-ok {
|
|
260
307
|
background: rgba(16, 185, 129, 0.14);
|
|
261
308
|
color: #10b981;
|
|
262
309
|
}
|
|
263
|
-
.adk-badge-warn {
|
|
264
|
-
background: rgba(245, 158, 11, 0.16);
|
|
265
|
-
color: #d97706;
|
|
266
|
-
}
|
|
267
310
|
.adk-badge-muted {
|
|
268
311
|
background: rgba(127, 127, 127, 0.14);
|
|
269
312
|
color: var(--dsw-alias-label-secondary, #6b7280);
|
|
270
313
|
}
|
|
271
|
-
.adk-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
color: var(--dsw-alias-label-secondary, #4b5563);
|
|
277
|
-
cursor: pointer;
|
|
278
|
-
user-select: none;
|
|
279
|
-
}
|
|
280
|
-
.adk-checkbox-row input {
|
|
281
|
-
margin: 0;
|
|
282
|
-
cursor: pointer;
|
|
314
|
+
.adk-version {
|
|
315
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
316
|
+
font-size: 11.5px;
|
|
317
|
+
font-weight: 400;
|
|
318
|
+
color: var(--dsw-alias-label-tertiary, #6b7280);
|
|
283
319
|
}
|
|
284
320
|
.adk-actions {
|
|
285
321
|
display: flex;
|
|
286
322
|
align-items: center;
|
|
287
|
-
gap:
|
|
288
|
-
flex-
|
|
323
|
+
gap: 6px;
|
|
324
|
+
flex-shrink: 0;
|
|
289
325
|
}
|
|
290
326
|
.adk-btn {
|
|
291
327
|
display: inline-flex;
|
|
292
328
|
align-items: center;
|
|
293
329
|
justify-content: center;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
padding: 0 14px;
|
|
330
|
+
height: 28px;
|
|
331
|
+
padding: 0 12px;
|
|
297
332
|
border-radius: var(--dsw-radius-md, 8px);
|
|
298
|
-
font-size:
|
|
333
|
+
font-size: 12px;
|
|
299
334
|
font-weight: 500;
|
|
300
335
|
font-family: inherit;
|
|
301
336
|
cursor: pointer;
|
|
@@ -321,81 +356,45 @@ window.__ModuleLoader__.load({
|
|
|
321
356
|
.adk-btn-secondary:hover:not(:disabled) {
|
|
322
357
|
background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.1));
|
|
323
358
|
}
|
|
324
|
-
.adk-
|
|
359
|
+
.adk-seg {
|
|
360
|
+
display: inline-flex;
|
|
361
|
+
flex-wrap: wrap;
|
|
362
|
+
gap: 6px;
|
|
363
|
+
}
|
|
364
|
+
.adk-seg-btn {
|
|
325
365
|
height: 28px;
|
|
326
366
|
padding: 0 10px;
|
|
327
|
-
font-size: 12px;
|
|
328
|
-
}
|
|
329
|
-
.adk-banner {
|
|
330
367
|
border-radius: var(--dsw-radius-md, 8px);
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
line-height: 1.5;
|
|
334
|
-
}
|
|
335
|
-
.adk-banner-ok {
|
|
336
|
-
background: rgba(16, 185, 129, 0.12);
|
|
337
|
-
border: 1px solid rgba(16, 185, 129, 0.3);
|
|
338
|
-
color: var(--dsw-alias-label-primary, #065f46);
|
|
339
|
-
}
|
|
340
|
-
.adk-banner-err {
|
|
341
|
-
background: rgba(239, 68, 68, 0.12);
|
|
342
|
-
border: 1px solid rgba(239, 68, 68, 0.32);
|
|
343
|
-
color: #ef4444;
|
|
344
|
-
}
|
|
345
|
-
.adk-steps {
|
|
346
|
-
margin: 6px 0 0;
|
|
347
|
-
padding-left: 16px;
|
|
348
|
-
font-size: 12px;
|
|
368
|
+
border: 1px solid var(--dsw-alias-border-l3, rgba(127, 127, 127, 0.25));
|
|
369
|
+
background: transparent;
|
|
349
370
|
color: var(--dsw-alias-label-secondary, #4b5563);
|
|
371
|
+
font-family: inherit;
|
|
372
|
+
font-size: 12px;
|
|
373
|
+
font-weight: 500;
|
|
374
|
+
cursor: pointer;
|
|
375
|
+
transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
|
|
350
376
|
}
|
|
351
|
-
.adk-
|
|
352
|
-
|
|
353
|
-
gap: 16px;
|
|
354
|
-
align-items: flex-start;
|
|
355
|
-
flex-wrap: wrap;
|
|
356
|
-
}
|
|
357
|
-
.adk-qr-frame {
|
|
358
|
-
width: 168px;
|
|
359
|
-
height: 168px;
|
|
360
|
-
padding: 8px;
|
|
361
|
-
box-sizing: border-box;
|
|
362
|
-
border-radius: 12px;
|
|
363
|
-
background: #ffffff;
|
|
364
|
-
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
365
|
-
flex-shrink: 0;
|
|
366
|
-
display: flex;
|
|
367
|
-
align-items: center;
|
|
368
|
-
justify-content: center;
|
|
369
|
-
}
|
|
370
|
-
.adk-qr-frame img {
|
|
371
|
-
width: 100%;
|
|
372
|
-
height: 100%;
|
|
373
|
-
display: block;
|
|
377
|
+
.adk-seg-btn:hover:not(:disabled) {
|
|
378
|
+
background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.1));
|
|
374
379
|
}
|
|
375
|
-
.adk-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
flex-direction: column;
|
|
380
|
-
gap: 8px;
|
|
380
|
+
.adk-seg-btn-active {
|
|
381
|
+
background: var(--dsw-alias-button-primary-fill, #2563eb);
|
|
382
|
+
border-color: var(--dsw-alias-button-primary-fill, #2563eb);
|
|
383
|
+
color: var(--dsw-alias-label-primary-foreground, #ffffff);
|
|
381
384
|
}
|
|
382
|
-
.adk-
|
|
383
|
-
|
|
384
|
-
color: var(--dsw-alias-label-tertiary, #6b7280);
|
|
385
|
+
.adk-seg-btn-active:hover:not(:disabled) {
|
|
386
|
+
background: var(--dsw-alias-button-primary-hover, #1d4ed8);
|
|
385
387
|
}
|
|
386
|
-
.adk-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.1));
|
|
390
|
-
padding: 1px 5px;
|
|
391
|
-
border-radius: 4px;
|
|
388
|
+
.adk-seg-btn:disabled {
|
|
389
|
+
opacity: 0.55;
|
|
390
|
+
cursor: not-allowed;
|
|
392
391
|
}
|
|
393
392
|
.adk-links {
|
|
394
393
|
display: flex;
|
|
395
394
|
align-items: center;
|
|
396
395
|
gap: 8px;
|
|
397
396
|
flex-wrap: wrap;
|
|
398
|
-
padding-top:
|
|
397
|
+
padding-top: 10px;
|
|
399
398
|
border-top: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.15));
|
|
400
399
|
}
|
|
401
400
|
.adk-links-label {
|
|
@@ -468,32 +467,35 @@ window.__ModuleLoader__.load({
|
|
|
468
467
|
const isZh = t('isZh') === '1';
|
|
469
468
|
|
|
470
469
|
const [status, setStatus] = useState(null);
|
|
471
|
-
const [
|
|
470
|
+
const [updateInfo, setUpdateInfo] = useState(null);
|
|
472
471
|
const [error, setError] = useState(null);
|
|
473
472
|
const [busy, setBusy] = useState(false);
|
|
474
|
-
const [
|
|
475
|
-
const [syncModels, setSyncModels] = useState(false);
|
|
476
|
-
const [setupFeedback, setSetupFeedback] = useState(null);
|
|
473
|
+
const [upgrading, setUpgrading] = useState(false);
|
|
477
474
|
|
|
478
475
|
const loadStatus = useCallback(async () => {
|
|
479
|
-
setLoading(true);
|
|
480
|
-
setError(null);
|
|
481
476
|
try {
|
|
482
|
-
const res = await fetch('
|
|
477
|
+
const res = await fetch('api/agentdeck/status', {
|
|
483
478
|
cache: 'no-store',
|
|
484
479
|
});
|
|
485
480
|
const data = await res.json();
|
|
486
|
-
if (!res.ok) {
|
|
487
|
-
throw new Error(data?.error || `HTTP ${res.status}`);
|
|
488
|
-
}
|
|
481
|
+
if (!res.ok) throw new Error(data?.error || `HTTP ${res.status}`);
|
|
489
482
|
setStatus(data);
|
|
490
|
-
setSyncModels((prev) =>
|
|
491
|
-
prev ? true : !data?.models?.acp?.defaultModel,
|
|
492
|
-
);
|
|
493
483
|
} catch (err) {
|
|
494
484
|
setError(err instanceof Error ? err.message : String(err));
|
|
495
|
-
}
|
|
496
|
-
|
|
485
|
+
}
|
|
486
|
+
}, []);
|
|
487
|
+
|
|
488
|
+
const checkUpdate = useCallback(async ({ force = false } = {}) => {
|
|
489
|
+
try {
|
|
490
|
+
const url = force
|
|
491
|
+
? 'api/agentdeck/update-check?force=1'
|
|
492
|
+
: 'api/agentdeck/update-check';
|
|
493
|
+
const res = await fetch(url, { cache: 'no-store' });
|
|
494
|
+
if (!res.ok) return;
|
|
495
|
+
const data = await res.json();
|
|
496
|
+
if (data?.ok) setUpdateInfo(data);
|
|
497
|
+
} catch {
|
|
498
|
+
// Ignore offline / network errors during passive update check
|
|
497
499
|
}
|
|
498
500
|
}, []);
|
|
499
501
|
|
|
@@ -501,88 +503,114 @@ window.__ModuleLoader__.load({
|
|
|
501
503
|
loadStatus();
|
|
502
504
|
}, [loadStatus]);
|
|
503
505
|
|
|
504
|
-
const
|
|
506
|
+
const daemonVersion = status?.daemon?.version || null;
|
|
507
|
+
useEffect(() => {
|
|
508
|
+
if (!daemonVersion) return;
|
|
509
|
+
checkUpdate();
|
|
510
|
+
}, [daemonVersion, checkUpdate]);
|
|
511
|
+
|
|
512
|
+
// Automatically poll while first-time background provisioning is running
|
|
513
|
+
const isProvisioning = status?.provisioning?.state === 'running';
|
|
514
|
+
useEffect(() => {
|
|
515
|
+
if (!isProvisioning) return undefined;
|
|
516
|
+
const timer = setTimeout(() => {
|
|
517
|
+
loadStatus();
|
|
518
|
+
}, 1500);
|
|
519
|
+
return () => clearTimeout(timer);
|
|
520
|
+
}, [isProvisioning, status, loadStatus]);
|
|
521
|
+
|
|
522
|
+
const postAction = useCallback(async (url, body) => {
|
|
505
523
|
setBusy(true);
|
|
506
524
|
setError(null);
|
|
507
|
-
setSetupFeedback(null);
|
|
508
525
|
try {
|
|
509
|
-
const res = await fetch(
|
|
526
|
+
const res = await fetch(url, {
|
|
510
527
|
method: 'POST',
|
|
511
528
|
headers: { 'content-type': 'application/json' },
|
|
512
|
-
body: JSON.stringify(
|
|
529
|
+
body: JSON.stringify(body),
|
|
513
530
|
});
|
|
514
531
|
const data = await res.json();
|
|
532
|
+
if (data?.status) setStatus(data.status);
|
|
515
533
|
if (!res.ok || !data?.ok) {
|
|
516
534
|
throw new Error(data?.error || `HTTP ${res.status}`);
|
|
517
535
|
}
|
|
518
|
-
|
|
519
|
-
setSetupFeedback({ steps: data.steps || [] });
|
|
536
|
+
return true;
|
|
520
537
|
} catch (err) {
|
|
521
538
|
setError(err instanceof Error ? err.message : String(err));
|
|
539
|
+
return false;
|
|
522
540
|
} finally {
|
|
523
541
|
setBusy(false);
|
|
524
542
|
}
|
|
525
|
-
}, [
|
|
543
|
+
}, []);
|
|
526
544
|
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
setError(null);
|
|
545
|
+
const handleUpgrade = useCallback(async () => {
|
|
546
|
+
setUpgrading(true);
|
|
530
547
|
try {
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
headers: { 'content-type': 'application/json' },
|
|
534
|
-
body: JSON.stringify({ action }),
|
|
548
|
+
const ok = await postAction('api/agentdeck/daemon', {
|
|
549
|
+
action: 'upgrade',
|
|
535
550
|
});
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
throw new Error(data?.error || `HTTP ${res.status}`);
|
|
551
|
+
if (ok) {
|
|
552
|
+
await checkUpdate({ force: true });
|
|
539
553
|
}
|
|
540
|
-
if (data.status) setStatus(data.status);
|
|
541
|
-
} catch (err) {
|
|
542
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
543
554
|
} finally {
|
|
544
|
-
|
|
555
|
+
setUpgrading(false);
|
|
545
556
|
}
|
|
546
|
-
}, []);
|
|
557
|
+
}, [postAction, checkUpdate]);
|
|
547
558
|
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
559
|
+
const awakeMode = status?.daemon?.awake?.mode || 'never';
|
|
560
|
+
const awakeOptions = [
|
|
561
|
+
{ id: 'never', label: t('awakeNever'), hint: t('awakeHintNever') },
|
|
562
|
+
{ id: 'plugged', label: t('awakePlugged'), hint: t('awakeHintPlugged') },
|
|
563
|
+
{ id: 'active', label: t('awakeActiveMode'), hint: t('awakeHintActive') },
|
|
564
|
+
{ id: 'always', label: t('awakeAlways'), hint: t('awakeHintAlways') },
|
|
565
|
+
];
|
|
566
|
+
const currentAwakeHint =
|
|
567
|
+
awakeOptions.find((o) => o.id === awakeMode)?.hint || '';
|
|
555
568
|
|
|
556
|
-
const acpModelText = formatModel(status?.models?.acp?.defaultModel);
|
|
557
|
-
const sourceModelText = formatModel(status?.models?.source?.defaultModel);
|
|
558
569
|
const qrDataUrl = status?.daemon?.qrSvg
|
|
559
570
|
? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(status.daemon.qrSvg)}`
|
|
560
571
|
: null;
|
|
561
|
-
const
|
|
572
|
+
const acpModelText = formatModel(status?.models?.acp?.defaultModel);
|
|
573
|
+
const sourceModelText = formatModel(status?.models?.source?.defaultModel);
|
|
574
|
+
const provisionError = status?.provisioning?.error || null;
|
|
575
|
+
const anyBusy = busy || upgrading || isProvisioning;
|
|
576
|
+
const latestVersion = updateInfo?.latestVersion || null;
|
|
577
|
+
const hasDaemonUpdate = Boolean(
|
|
578
|
+
updateInfo?.updateAvailable &&
|
|
579
|
+
latestVersion &&
|
|
580
|
+
daemonVersion &&
|
|
581
|
+
latestVersion !== daemonVersion,
|
|
582
|
+
);
|
|
583
|
+
const canAutoUpdate = Boolean(status?.daemon?.canUpdate);
|
|
562
584
|
|
|
563
585
|
return h(
|
|
564
586
|
'div',
|
|
565
587
|
{ className: 'adk-root' },
|
|
566
588
|
h(
|
|
567
589
|
'div',
|
|
568
|
-
|
|
569
|
-
h(
|
|
570
|
-
|
|
571
|
-
null,
|
|
572
|
-
h('h2', { className: 'adk-title' }, t('title')),
|
|
573
|
-
h('p', { className: 'adk-subtitle' }, t('subtitle')),
|
|
574
|
-
),
|
|
590
|
+
null,
|
|
591
|
+
h('h2', { className: 'adk-title' }, t('title')),
|
|
592
|
+
h('p', { className: 'adk-subtitle' }, t('subtitle')),
|
|
575
593
|
),
|
|
576
594
|
|
|
577
|
-
|
|
595
|
+
!status && !error
|
|
578
596
|
? h('div', { className: 'adk-card' }, t('loading'))
|
|
579
597
|
: null,
|
|
580
598
|
|
|
581
|
-
error
|
|
599
|
+
error || provisionError
|
|
582
600
|
? h(
|
|
583
601
|
'div',
|
|
584
602
|
{ className: 'adk-banner adk-banner-err' },
|
|
585
|
-
`${t('
|
|
603
|
+
h('span', null, `${t('errorTitle')}: ${error || provisionError}`),
|
|
604
|
+
h(
|
|
605
|
+
'button',
|
|
606
|
+
{
|
|
607
|
+
type: 'button',
|
|
608
|
+
className: 'adk-btn adk-btn-primary',
|
|
609
|
+
disabled: anyBusy,
|
|
610
|
+
onClick: () => postAction('api/agentdeck/setup', {}),
|
|
611
|
+
},
|
|
612
|
+
t('btnRetry'),
|
|
613
|
+
),
|
|
586
614
|
)
|
|
587
615
|
: null,
|
|
588
616
|
|
|
@@ -590,332 +618,79 @@ window.__ModuleLoader__.load({
|
|
|
590
618
|
? h(
|
|
591
619
|
React.Fragment,
|
|
592
620
|
null,
|
|
593
|
-
// Card 1:
|
|
594
|
-
h(
|
|
595
|
-
'section',
|
|
596
|
-
{ className: 'adk-card' },
|
|
597
|
-
h(
|
|
598
|
-
'div',
|
|
599
|
-
{ className: 'adk-card-head' },
|
|
600
|
-
h('h3', { className: 'adk-card-title' }, t('setupTitle')),
|
|
601
|
-
h(
|
|
602
|
-
'span',
|
|
603
|
-
{
|
|
604
|
-
className: `adk-badge ${status.ready ? 'adk-badge-ok' : 'adk-badge-warn'}`,
|
|
605
|
-
},
|
|
606
|
-
status.ready ? t('statusReady') : t('statusMissing'),
|
|
607
|
-
),
|
|
608
|
-
),
|
|
609
|
-
h('p', { className: 'adk-card-desc' }, t('setupDesc')),
|
|
610
|
-
h(
|
|
611
|
-
'div',
|
|
612
|
-
{ className: 'adk-list' },
|
|
613
|
-
// Row 1: ACP adapter
|
|
614
|
-
h(
|
|
615
|
-
'div',
|
|
616
|
-
{ className: 'adk-row' },
|
|
617
|
-
h(
|
|
618
|
-
'div',
|
|
619
|
-
{ className: 'adk-row-main' },
|
|
620
|
-
h('span', { className: 'adk-row-label' }, t('itemAcp')),
|
|
621
|
-
h(
|
|
622
|
-
'span',
|
|
623
|
-
{ className: 'adk-row-detail' },
|
|
624
|
-
status.acpPlugin?.installed
|
|
625
|
-
? `${status.acpPlugin.packageName}@${status.acpPlugin.version}`
|
|
626
|
-
: t('acpNotInstalledHint'),
|
|
627
|
-
),
|
|
628
|
-
),
|
|
629
|
-
h(
|
|
630
|
-
'span',
|
|
631
|
-
{
|
|
632
|
-
className: `adk-badge ${status.acpPlugin?.installed ? 'adk-badge-ok' : 'adk-badge-warn'}`,
|
|
633
|
-
},
|
|
634
|
-
status.acpPlugin?.installed
|
|
635
|
-
? t('statusReady')
|
|
636
|
-
: t('statusNotInstalled'),
|
|
637
|
-
),
|
|
638
|
-
),
|
|
639
|
-
// Row 2: Model & provider
|
|
640
|
-
h(
|
|
641
|
-
'div',
|
|
642
|
-
{ className: 'adk-row' },
|
|
643
|
-
h(
|
|
644
|
-
'div',
|
|
645
|
-
{ className: 'adk-row-main' },
|
|
646
|
-
h('span', { className: 'adk-row-label' }, t('itemModels')),
|
|
647
|
-
h(
|
|
648
|
-
'span',
|
|
649
|
-
{ className: 'adk-row-detail' },
|
|
650
|
-
`${t('modelAcpLabel')} ${acpModelText || t('modelNone')}`,
|
|
651
|
-
),
|
|
652
|
-
sourceModelText
|
|
653
|
-
? h(
|
|
654
|
-
'span',
|
|
655
|
-
{ className: 'adk-row-detail' },
|
|
656
|
-
`${t('modelSourceLabel')} ${sourceModelText}`,
|
|
657
|
-
)
|
|
658
|
-
: null,
|
|
659
|
-
status.models?.acpNeedsProviderPin
|
|
660
|
-
? h(
|
|
661
|
-
'span',
|
|
662
|
-
{
|
|
663
|
-
className: 'adk-row-detail',
|
|
664
|
-
style: { color: '#d97706' },
|
|
665
|
-
},
|
|
666
|
-
t('modelPinWarning'),
|
|
667
|
-
)
|
|
668
|
-
: null,
|
|
669
|
-
),
|
|
670
|
-
h(
|
|
671
|
-
'span',
|
|
672
|
-
{
|
|
673
|
-
className: `adk-badge ${status.models?.acpNeedsProviderPin ? 'adk-badge-warn' : 'adk-badge-ok'}`,
|
|
674
|
-
},
|
|
675
|
-
status.models?.acpNeedsProviderPin
|
|
676
|
-
? t('statusNeedsFix')
|
|
677
|
-
: t('statusReady'),
|
|
678
|
-
),
|
|
679
|
-
),
|
|
680
|
-
// Row 3: custom_agents.json
|
|
681
|
-
h(
|
|
682
|
-
'div',
|
|
683
|
-
{ className: 'adk-row' },
|
|
684
|
-
h(
|
|
685
|
-
'div',
|
|
686
|
-
{ className: 'adk-row-main' },
|
|
687
|
-
h(
|
|
688
|
-
'span',
|
|
689
|
-
{ className: 'adk-row-label' },
|
|
690
|
-
t('itemCustomAgents'),
|
|
691
|
-
),
|
|
692
|
-
h(
|
|
693
|
-
'span',
|
|
694
|
-
{ className: 'adk-row-detail' },
|
|
695
|
-
status.customAgent?.configured
|
|
696
|
-
? `${status.customAgent.entry.command} ${(status.customAgent.entry.args || []).join(' ')}`
|
|
697
|
-
: status.dshCommand || t('dshNotFound'),
|
|
698
|
-
),
|
|
699
|
-
),
|
|
700
|
-
h(
|
|
701
|
-
'span',
|
|
702
|
-
{
|
|
703
|
-
className: `adk-badge ${status.customAgent?.configured ? 'adk-badge-ok' : 'adk-badge-warn'}`,
|
|
704
|
-
},
|
|
705
|
-
status.customAgent?.configured
|
|
706
|
-
? t('statusReady')
|
|
707
|
-
: t('statusMissing'),
|
|
708
|
-
),
|
|
709
|
-
),
|
|
710
|
-
// Row 4: agentdeckd daemon & autostart
|
|
711
|
-
h(
|
|
712
|
-
'div',
|
|
713
|
-
{ className: 'adk-row' },
|
|
714
|
-
h(
|
|
715
|
-
'div',
|
|
716
|
-
{ className: 'adk-row-main' },
|
|
717
|
-
h('span', { className: 'adk-row-label' }, t('itemDaemon')),
|
|
718
|
-
h(
|
|
719
|
-
'span',
|
|
720
|
-
{ className: 'adk-row-detail' },
|
|
721
|
-
status.daemon?.running
|
|
722
|
-
? `${status.daemon.binaryPath || 'agentdeckd'} (PID ${status.daemon.pid})`
|
|
723
|
-
: status.daemon?.installed
|
|
724
|
-
? t('daemonStoppedHint')
|
|
725
|
-
: t('daemonNotInstalledHint'),
|
|
726
|
-
),
|
|
727
|
-
),
|
|
728
|
-
h(
|
|
729
|
-
'span',
|
|
730
|
-
{
|
|
731
|
-
className: `adk-badge ${status.daemon?.running ? 'adk-badge-ok' : status.daemon?.installed ? 'adk-badge-warn' : 'adk-badge-muted'}`,
|
|
732
|
-
},
|
|
733
|
-
status.daemon?.running
|
|
734
|
-
? t('daemonRunning')
|
|
735
|
-
: status.daemon?.installed
|
|
736
|
-
? t('statusStopped')
|
|
737
|
-
: t('statusNotInstalled'),
|
|
738
|
-
),
|
|
739
|
-
),
|
|
740
|
-
),
|
|
741
|
-
|
|
742
|
-
sourceModelText
|
|
743
|
-
? h(
|
|
744
|
-
'label',
|
|
745
|
-
{ className: 'adk-checkbox-row' },
|
|
746
|
-
h('input', {
|
|
747
|
-
type: 'checkbox',
|
|
748
|
-
checked: syncModels,
|
|
749
|
-
disabled: anyBusy,
|
|
750
|
-
onChange: (e) => setSyncModels(e.target.checked),
|
|
751
|
-
}),
|
|
752
|
-
h(
|
|
753
|
-
'span',
|
|
754
|
-
null,
|
|
755
|
-
`${t('syncModelsToggle')} (${sourceModelText})`,
|
|
756
|
-
),
|
|
757
|
-
)
|
|
758
|
-
: null,
|
|
759
|
-
|
|
760
|
-
h(
|
|
761
|
-
'div',
|
|
762
|
-
{ className: 'adk-actions' },
|
|
763
|
-
h(
|
|
764
|
-
'button',
|
|
765
|
-
{
|
|
766
|
-
type: 'button',
|
|
767
|
-
className: 'adk-btn adk-btn-primary',
|
|
768
|
-
disabled: anyBusy || !status.dshCommand,
|
|
769
|
-
onClick: onSetup,
|
|
770
|
-
},
|
|
771
|
-
busy
|
|
772
|
-
? t('btnSettingUp')
|
|
773
|
-
: status.ready
|
|
774
|
-
? t('btnResync')
|
|
775
|
-
: t('btnSetup'),
|
|
776
|
-
),
|
|
777
|
-
h(
|
|
778
|
-
'button',
|
|
779
|
-
{
|
|
780
|
-
type: 'button',
|
|
781
|
-
className: 'adk-btn adk-btn-secondary',
|
|
782
|
-
disabled: anyBusy || loading,
|
|
783
|
-
onClick: loadStatus,
|
|
784
|
-
},
|
|
785
|
-
t('btnRefresh'),
|
|
786
|
-
),
|
|
787
|
-
),
|
|
788
|
-
|
|
789
|
-
setupFeedback
|
|
790
|
-
? h(
|
|
791
|
-
'div',
|
|
792
|
-
{ className: 'adk-banner adk-banner-ok' },
|
|
793
|
-
h('div', null, t('setupSuccess')),
|
|
794
|
-
setupFeedback.steps?.length
|
|
795
|
-
? h(
|
|
796
|
-
'ul',
|
|
797
|
-
{ className: 'adk-steps' },
|
|
798
|
-
...setupFeedback.steps.map((step) =>
|
|
799
|
-
h(
|
|
800
|
-
'li',
|
|
801
|
-
{ key: step.id },
|
|
802
|
-
`${step.id}: ${stepStatusLabel(step.status)}${step.detail ? ` (${step.detail})` : ''}`,
|
|
803
|
-
),
|
|
804
|
-
),
|
|
805
|
-
)
|
|
806
|
-
: null,
|
|
807
|
-
)
|
|
808
|
-
: null,
|
|
809
|
-
),
|
|
810
|
-
|
|
811
|
-
// Card 2: Pairing QR & daemon controls
|
|
621
|
+
// Card 1: Pairing QR Code (zero-click ready)
|
|
812
622
|
h(
|
|
813
623
|
'section',
|
|
814
624
|
{ className: 'adk-card' },
|
|
815
|
-
|
|
816
|
-
'div',
|
|
817
|
-
{ className: 'adk-card-head' },
|
|
818
|
-
h('h3', { className: 'adk-card-title' }, t('pairTitle')),
|
|
819
|
-
h(
|
|
820
|
-
'span',
|
|
821
|
-
{
|
|
822
|
-
className: `adk-badge ${status.daemon?.running ? 'adk-badge-ok' : status.daemon?.installed ? 'adk-badge-warn' : 'adk-badge-muted'}`,
|
|
823
|
-
},
|
|
824
|
-
status.daemon?.running
|
|
825
|
-
? `${t('daemonRunning')} (PID ${status.daemon.pid})`
|
|
826
|
-
: status.daemon?.installed
|
|
827
|
-
? t('daemonStopped')
|
|
828
|
-
: t('daemonMissing'),
|
|
829
|
-
),
|
|
830
|
-
),
|
|
831
|
-
|
|
832
|
-
qrDataUrl
|
|
625
|
+
isProvisioning && !qrDataUrl
|
|
833
626
|
? h(
|
|
834
627
|
'div',
|
|
835
|
-
{ className: 'adk-
|
|
628
|
+
{ className: 'adk-provisioning' },
|
|
836
629
|
h(
|
|
837
630
|
'div',
|
|
838
|
-
{ className: 'adk-
|
|
839
|
-
h('
|
|
840
|
-
|
|
841
|
-
alt: 'AgentDeck pairing QR code',
|
|
842
|
-
}),
|
|
631
|
+
{ className: 'adk-provisioning-title' },
|
|
632
|
+
h('span', { className: 'adk-spinner' }),
|
|
633
|
+
h('span', null, t('provisioning')),
|
|
843
634
|
),
|
|
844
|
-
h(
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
`${t('pairingIdLabel')}: `,
|
|
852
|
-
h('code', null, status.daemon.maskedPairingId),
|
|
853
|
-
),
|
|
854
|
-
status.daemon.hasCustomRelay
|
|
635
|
+
h('p', { className: 'adk-desc' }, t('provisioningHint')),
|
|
636
|
+
)
|
|
637
|
+
: qrDataUrl
|
|
638
|
+
? h(
|
|
639
|
+
React.Fragment,
|
|
640
|
+
null,
|
|
641
|
+
!status.daemon?.running
|
|
855
642
|
? h(
|
|
856
643
|
'div',
|
|
857
|
-
{ className: 'adk-
|
|
858
|
-
|
|
859
|
-
h('code', null, status.daemon.relayUrl),
|
|
860
|
-
)
|
|
861
|
-
: null,
|
|
862
|
-
!status.daemon.running
|
|
863
|
-
? h(
|
|
864
|
-
'p',
|
|
865
|
-
{ className: 'adk-card-desc' },
|
|
866
|
-
t('daemonStartHint'),
|
|
644
|
+
{ className: 'adk-banner adk-banner-warn' },
|
|
645
|
+
t('stoppedBanner'),
|
|
867
646
|
)
|
|
868
647
|
: null,
|
|
869
648
|
h(
|
|
870
649
|
'div',
|
|
871
|
-
{ className: 'adk-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
650
|
+
{ className: 'adk-qr-layout' },
|
|
651
|
+
h(
|
|
652
|
+
'div',
|
|
653
|
+
{ className: 'adk-qr-frame' },
|
|
654
|
+
h('img', {
|
|
655
|
+
src: qrDataUrl,
|
|
656
|
+
alt: 'AgentDeck pairing QR code',
|
|
657
|
+
}),
|
|
658
|
+
),
|
|
659
|
+
h(
|
|
660
|
+
'div',
|
|
661
|
+
{ className: 'adk-qr-info' },
|
|
662
|
+
h('p', { className: 'adk-desc' }, t('qrHint')),
|
|
663
|
+
h(
|
|
664
|
+
'div',
|
|
665
|
+
{ className: 'adk-meta-line' },
|
|
666
|
+
`${t('pairingIdLabel')}: `,
|
|
667
|
+
h('code', null, status.daemon.maskedPairingId),
|
|
668
|
+
),
|
|
669
|
+
status.daemon.hasCustomRelay
|
|
886
670
|
? h(
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
{
|
|
892
|
-
type: 'button',
|
|
893
|
-
className:
|
|
894
|
-
'adk-btn adk-btn-secondary adk-btn-sm',
|
|
895
|
-
disabled: anyBusy,
|
|
896
|
-
onClick: () => onDaemonAction('restart'),
|
|
897
|
-
},
|
|
898
|
-
daemonBusy
|
|
899
|
-
? t('btnWorking')
|
|
900
|
-
: t('btnDaemonRestart'),
|
|
901
|
-
),
|
|
902
|
-
h(
|
|
903
|
-
'button',
|
|
904
|
-
{
|
|
905
|
-
type: 'button',
|
|
906
|
-
className:
|
|
907
|
-
'adk-btn adk-btn-secondary adk-btn-sm',
|
|
908
|
-
disabled: anyBusy,
|
|
909
|
-
onClick: () => onDaemonAction('stop'),
|
|
910
|
-
},
|
|
911
|
-
t('btnDaemonStop'),
|
|
912
|
-
),
|
|
671
|
+
'div',
|
|
672
|
+
{ className: 'adk-meta-line' },
|
|
673
|
+
`${t('customRelayLabel')}: `,
|
|
674
|
+
h('code', null, status.daemon.relayUrl),
|
|
913
675
|
)
|
|
914
676
|
: null,
|
|
677
|
+
),
|
|
678
|
+
),
|
|
679
|
+
)
|
|
680
|
+
: h(
|
|
681
|
+
'div',
|
|
682
|
+
{ className: 'adk-actions' },
|
|
683
|
+
h(
|
|
684
|
+
'button',
|
|
685
|
+
{
|
|
686
|
+
type: 'button',
|
|
687
|
+
className: 'adk-btn adk-btn-primary',
|
|
688
|
+
disabled: anyBusy,
|
|
689
|
+
onClick: () => postAction('api/agentdeck/setup', {}),
|
|
690
|
+
},
|
|
691
|
+
t('btnRetry'),
|
|
915
692
|
),
|
|
916
693
|
),
|
|
917
|
-
)
|
|
918
|
-
: h('p', { className: 'adk-card-desc' }, t('daemonAutoHint')),
|
|
919
694
|
|
|
920
695
|
h(
|
|
921
696
|
'div',
|
|
@@ -967,6 +742,207 @@ window.__ModuleLoader__.load({
|
|
|
967
742
|
),
|
|
968
743
|
),
|
|
969
744
|
),
|
|
745
|
+
|
|
746
|
+
// Card 2: Essential Settings Only (Service, Keep Awake, Mobile Model)
|
|
747
|
+
h(
|
|
748
|
+
'section',
|
|
749
|
+
{ className: 'adk-card' },
|
|
750
|
+
h(
|
|
751
|
+
'div',
|
|
752
|
+
{ className: 'adk-rows' },
|
|
753
|
+
// 1. Remote Service & Autostart
|
|
754
|
+
h(
|
|
755
|
+
'div',
|
|
756
|
+
{ className: 'adk-row' },
|
|
757
|
+
h(
|
|
758
|
+
'div',
|
|
759
|
+
{ className: 'adk-row-main' },
|
|
760
|
+
h(
|
|
761
|
+
'div',
|
|
762
|
+
{ className: 'adk-row-label' },
|
|
763
|
+
h('span', null, t('serviceTitle')),
|
|
764
|
+
h(
|
|
765
|
+
'span',
|
|
766
|
+
{
|
|
767
|
+
className: `adk-badge ${status.daemon?.running ? 'adk-badge-ok' : 'adk-badge-muted'}`,
|
|
768
|
+
},
|
|
769
|
+
status.daemon?.running
|
|
770
|
+
? t('statusRunning')
|
|
771
|
+
: t('statusStopped'),
|
|
772
|
+
),
|
|
773
|
+
daemonVersion
|
|
774
|
+
? h(
|
|
775
|
+
'span',
|
|
776
|
+
{ className: 'adk-version' },
|
|
777
|
+
`v${daemonVersion}`,
|
|
778
|
+
)
|
|
779
|
+
: null,
|
|
780
|
+
),
|
|
781
|
+
h(
|
|
782
|
+
'p',
|
|
783
|
+
{ className: 'adk-desc' },
|
|
784
|
+
status.daemon?.running
|
|
785
|
+
? t('serviceDescRunning')
|
|
786
|
+
: t('serviceDescStopped'),
|
|
787
|
+
hasDaemonUpdate && !canAutoUpdate
|
|
788
|
+
? ` · ${t('updateAvailable')} v${latestVersion}`
|
|
789
|
+
: null,
|
|
790
|
+
),
|
|
791
|
+
),
|
|
792
|
+
h(
|
|
793
|
+
'div',
|
|
794
|
+
{ className: 'adk-actions' },
|
|
795
|
+
hasDaemonUpdate && canAutoUpdate
|
|
796
|
+
? h(
|
|
797
|
+
'button',
|
|
798
|
+
{
|
|
799
|
+
type: 'button',
|
|
800
|
+
className: `adk-btn ${status.daemon?.running ? 'adk-btn-primary' : 'adk-btn-secondary'}`,
|
|
801
|
+
disabled: anyBusy,
|
|
802
|
+
onClick: handleUpgrade,
|
|
803
|
+
},
|
|
804
|
+
upgrading
|
|
805
|
+
? t('btnUpdating')
|
|
806
|
+
: `${t('btnUpdate')} v${latestVersion}`,
|
|
807
|
+
)
|
|
808
|
+
: null,
|
|
809
|
+
status.daemon?.running
|
|
810
|
+
? status.daemon?.binaryPath
|
|
811
|
+
? h(
|
|
812
|
+
React.Fragment,
|
|
813
|
+
null,
|
|
814
|
+
h(
|
|
815
|
+
'button',
|
|
816
|
+
{
|
|
817
|
+
type: 'button',
|
|
818
|
+
className: 'adk-btn adk-btn-secondary',
|
|
819
|
+
disabled: anyBusy,
|
|
820
|
+
onClick: () =>
|
|
821
|
+
postAction('api/agentdeck/daemon', {
|
|
822
|
+
action: 'restart',
|
|
823
|
+
}),
|
|
824
|
+
},
|
|
825
|
+
busy && !upgrading
|
|
826
|
+
? t('btnWorking')
|
|
827
|
+
: t('btnRestart'),
|
|
828
|
+
),
|
|
829
|
+
h(
|
|
830
|
+
'button',
|
|
831
|
+
{
|
|
832
|
+
type: 'button',
|
|
833
|
+
className: 'adk-btn adk-btn-secondary',
|
|
834
|
+
disabled: anyBusy,
|
|
835
|
+
onClick: () =>
|
|
836
|
+
postAction('api/agentdeck/daemon', {
|
|
837
|
+
action: 'stop',
|
|
838
|
+
}),
|
|
839
|
+
},
|
|
840
|
+
t('btnStop'),
|
|
841
|
+
),
|
|
842
|
+
)
|
|
843
|
+
: null
|
|
844
|
+
: h(
|
|
845
|
+
'button',
|
|
846
|
+
{
|
|
847
|
+
type: 'button',
|
|
848
|
+
className: 'adk-btn adk-btn-primary',
|
|
849
|
+
disabled: anyBusy,
|
|
850
|
+
onClick: () =>
|
|
851
|
+
postAction('api/agentdeck/daemon', {
|
|
852
|
+
action: 'start',
|
|
853
|
+
}),
|
|
854
|
+
},
|
|
855
|
+
busy && !upgrading ? t('btnWorking') : t('btnStart'),
|
|
856
|
+
),
|
|
857
|
+
),
|
|
858
|
+
),
|
|
859
|
+
|
|
860
|
+
// 2. Keep Awake
|
|
861
|
+
h(
|
|
862
|
+
'div',
|
|
863
|
+
{ className: 'adk-row adk-row-col' },
|
|
864
|
+
h(
|
|
865
|
+
'div',
|
|
866
|
+
{ className: 'adk-row-head' },
|
|
867
|
+
h('span', { className: 'adk-row-label' }, t('awakeTitle')),
|
|
868
|
+
status.daemon?.running
|
|
869
|
+
? h(
|
|
870
|
+
'span',
|
|
871
|
+
{
|
|
872
|
+
className: `adk-badge ${status.daemon?.awake?.active ? 'adk-badge-ok' : 'adk-badge-muted'}`,
|
|
873
|
+
},
|
|
874
|
+
status.daemon?.awake?.active
|
|
875
|
+
? t('awakeActive')
|
|
876
|
+
: t('awakeInactive'),
|
|
877
|
+
)
|
|
878
|
+
: null,
|
|
879
|
+
),
|
|
880
|
+
h(
|
|
881
|
+
'div',
|
|
882
|
+
{
|
|
883
|
+
className: 'adk-seg',
|
|
884
|
+
role: 'radiogroup',
|
|
885
|
+
'aria-label': t('awakeTitle'),
|
|
886
|
+
},
|
|
887
|
+
...awakeOptions.map((opt) =>
|
|
888
|
+
h(
|
|
889
|
+
'button',
|
|
890
|
+
{
|
|
891
|
+
key: opt.id,
|
|
892
|
+
type: 'button',
|
|
893
|
+
role: 'radio',
|
|
894
|
+
'aria-checked': awakeMode === opt.id,
|
|
895
|
+
disabled: anyBusy,
|
|
896
|
+
className: `adk-seg-btn ${awakeMode === opt.id ? 'adk-seg-btn-active' : ''}`,
|
|
897
|
+
onClick: () =>
|
|
898
|
+
postAction('api/agentdeck/awake', {
|
|
899
|
+
mode: opt.id,
|
|
900
|
+
}),
|
|
901
|
+
},
|
|
902
|
+
opt.label,
|
|
903
|
+
),
|
|
904
|
+
),
|
|
905
|
+
),
|
|
906
|
+
h('p', { className: 'adk-desc' }, currentAwakeHint),
|
|
907
|
+
status.daemon?.awake?.error
|
|
908
|
+
? h(
|
|
909
|
+
'p',
|
|
910
|
+
{ className: 'adk-desc adk-text-err' },
|
|
911
|
+
status.daemon.awake.error,
|
|
912
|
+
)
|
|
913
|
+
: null,
|
|
914
|
+
),
|
|
915
|
+
|
|
916
|
+
// 3. Mobile Default Model
|
|
917
|
+
h(
|
|
918
|
+
'div',
|
|
919
|
+
{ className: 'adk-row' },
|
|
920
|
+
h(
|
|
921
|
+
'div',
|
|
922
|
+
{ className: 'adk-row-main' },
|
|
923
|
+
h('span', { className: 'adk-row-label' }, t('modelTitle')),
|
|
924
|
+
h(
|
|
925
|
+
'p',
|
|
926
|
+
{ className: 'adk-desc' },
|
|
927
|
+
acpModelText || t('modelDefault'),
|
|
928
|
+
),
|
|
929
|
+
),
|
|
930
|
+
sourceModelText && status.models?.mismatch
|
|
931
|
+
? h(
|
|
932
|
+
'button',
|
|
933
|
+
{
|
|
934
|
+
type: 'button',
|
|
935
|
+
className: 'adk-btn adk-btn-secondary',
|
|
936
|
+
disabled: anyBusy,
|
|
937
|
+
onClick: () =>
|
|
938
|
+
postAction('api/agentdeck/sync-models', {}),
|
|
939
|
+
},
|
|
940
|
+
`${t('btnSyncModel')} (${sourceModelText})`,
|
|
941
|
+
)
|
|
942
|
+
: null,
|
|
943
|
+
),
|
|
944
|
+
),
|
|
945
|
+
),
|
|
970
946
|
)
|
|
971
947
|
: null,
|
|
972
948
|
);
|