dsh-plugin-agentdeck 0.1.0 → 0.2.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/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,93 @@ window.__ModuleLoader__.load({
27
26
  nav: 'AgentDeck',
28
27
  title: 'AgentDeck Mobile Remote',
29
28
  subtitle:
30
- 'Control DeepSeek Harness from your iPhone or Android via native ACP — end-to-end encrypted, with push notifications, file & terminal inspection.',
31
- setupTitle: '1. One-Click Setup & Autostart',
32
- setupDesc:
33
- 'Installs the interactive ACP adapter, syncs model & provider config, registers dsh in AgentDeck, installs agentdeckd, and enables login autostart.',
34
- itemAcp: 'Interactive ACP Adapter',
35
- itemModels: 'ACP Model & Provider',
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 this code private — it grants full access to your host.',
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: 'Custom Relay',
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
+ btnWorking: 'Working…',
50
+ awakeTitle: 'Prevent Automatic Sleep',
51
+ awakeActive: 'Active',
52
+ awakeInactive: 'Inactive',
53
+ awakeNever: 'Off',
54
+ awakePlugged: 'On Power',
55
+ awakeActiveMode: 'Active 1h',
56
+ awakeAlways: 'Always',
57
+ awakeHintNever: 'Let the OS sleep normally.',
58
+ awakeHintPlugged: 'Stay awake while plugged into external power.',
59
+ awakeHintActive: 'Stay awake for 1 hour after the last mobile interaction.',
60
+ awakeHintAlways: 'Always stay awake while the remote service runs.',
61
+ modelTitle: 'Mobile Default Model',
62
+ modelDefault: 'DeepSeek Harness default',
63
+ btnSyncModel: 'Sync current',
79
64
  downloadTitle: 'Get AgentDeck',
80
- linkAppStore: 'App Store (iOS)',
65
+ linkAppStore: 'App Store',
81
66
  linkGooglePlay: 'Google Play',
82
67
  linkApk: 'Android APK',
83
68
  linkWebsite: 'Website',
84
- loading: 'Checking local environment…',
85
- loadError: 'Operation failed',
86
- stepInstalled: 'Installed',
87
- stepSkipped: 'Already ready',
88
- stepUpdated: 'Updated',
89
- stepUnchanged: 'No changes needed',
90
- stepStarted: 'Started with autostart',
69
+ loading: 'Loading…',
91
70
  isZh: '0',
92
71
  },
93
72
  zh: {
94
73
  nav: 'AgentDeck 手机远控',
95
74
  title: 'AgentDeck 手机远控',
96
75
  subtitle:
97
- '通过原生 ACP 协议在 iPhone / Android 手机上远程控制 DeepSeek Harness:端到端加密、推送通知、浏览文件与终端。',
98
- setupTitle: '1. 一键配置并开启自启动',
99
- setupDesc:
100
- '自动完成:安装交互式 ACP 适配器、同步模型与服务商配置、写入 custom_agents.json、安装 agentdeckd 并注册开机自启动。',
101
- itemAcp: '交互式 ACP 适配器',
102
- itemModels: 'ACP 模型与服务商',
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、设置开机自启,并在此生成配对二维码。',
76
+ '打开手机上的 AgentDeck 扫码即可远程控制 DeepSeek Harness,端到端加密。',
77
+ provisioning: '正在自动配置远程控制并启动服务…',
78
+ provisioningHint:
79
+ '首次安装会自动准备 ACP 适配器与本地守护服务并注册开机自启,完成后二维码会自动出现。',
80
+ errorTitle: '自动初始化失败',
81
+ btnRetry: '重试',
141
82
  qrHint:
142
83
  '打开手机上的 AgentDeck App 扫描此二维码即可配对。请勿泄露二维码——它代表本机远程访问权限。',
143
84
  pairingIdLabel: '配对 ID',
144
- customRelayLabel: '自定义 Relay',
145
- downloadTitle: '获取 AgentDeck',
146
- linkAppStore: 'App Store (iOS)',
85
+ customRelayLabel: 'Relay',
86
+ stoppedBanner: '远程服务当前已停止,开启下方服务开关后手机即可连接。',
87
+ serviceTitle: '远程服务与开机自启',
88
+ serviceDescRunning: '已在后台运行并开启登录自启。',
89
+ serviceDescStopped: '已停止,手机端暂时无法连接。',
90
+ statusRunning: '运行中',
91
+ statusStopped: '已停止',
92
+ btnStart: '开启',
93
+ btnStop: '停止',
94
+ btnRestart: '重启',
95
+ btnWorking: '处理中…',
96
+ awakeTitle: '防自动休眠',
97
+ awakeActive: '生效中',
98
+ awakeInactive: '未激活',
99
+ awakeNever: '关闭',
100
+ awakePlugged: '插电常亮',
101
+ awakeActiveMode: '活跃 1 小时',
102
+ awakeAlways: '始终常亮',
103
+ awakeHintNever: '跟随系统默认休眠策略。',
104
+ awakeHintPlugged: '接通外接电源时防止电脑自动休眠。',
105
+ awakeHintActive: '最近 1 小时有手机远控交互时保持唤醒。',
106
+ awakeHintAlways: '远程服务运行期间始终防止自动休眠。',
107
+ modelTitle: '手机端默认模型',
108
+ modelDefault: '使用 DSH 默认模型',
109
+ btnSyncModel: '同步当前模型',
110
+ downloadTitle: '下载 AgentDeck',
111
+ linkAppStore: 'App Store',
147
112
  linkGooglePlay: 'Google Play',
148
113
  linkApk: 'Android APK',
149
114
  linkWebsite: '官网',
150
- loading: '正在检测本机环境…',
151
- loadError: '操作失败',
152
- stepInstalled: '已安装',
153
- stepSkipped: '已就绪',
154
- stepUpdated: '已更新',
155
- stepUnchanged: '无需变更',
156
- stepStarted: '已启动并开启自启',
115
+ loading: '加载中…',
157
116
  isZh: '1',
158
117
  },
159
118
  };
@@ -168,12 +127,6 @@ window.__ModuleLoader__.load({
168
127
  font-size: 13px;
169
128
  line-height: 1.5;
170
129
  }
171
- .adk-hero {
172
- display: flex;
173
- align-items: flex-start;
174
- justify-content: space-between;
175
- gap: 12px;
176
- }
177
130
  .adk-title {
178
131
  margin: 0 0 4px;
179
132
  font-size: 16px;
@@ -192,43 +145,135 @@ window.__ModuleLoader__.load({
192
145
  padding: 16px;
193
146
  display: flex;
194
147
  flex-direction: column;
195
- gap: 12px;
148
+ gap: 14px;
149
+ }
150
+ .adk-desc {
151
+ margin: 0;
152
+ font-size: 12.5px;
153
+ color: var(--dsw-alias-label-tertiary, #6b7280);
154
+ }
155
+ .adk-text-err {
156
+ color: #ef4444;
196
157
  }
197
- .adk-card-head {
158
+ .adk-qr-layout {
198
159
  display: flex;
160
+ gap: 16px;
199
161
  align-items: center;
200
- justify-content: space-between;
201
- gap: 10px;
202
162
  flex-wrap: wrap;
203
163
  }
204
- .adk-card-title {
205
- margin: 0;
206
- font-size: 14px;
207
- font-weight: 600;
164
+ .adk-qr-frame {
165
+ width: 168px;
166
+ height: 168px;
167
+ padding: 8px;
168
+ box-sizing: border-box;
169
+ border-radius: 12px;
170
+ background: #ffffff;
171
+ border: 1px solid rgba(0, 0, 0, 0.08);
172
+ flex-shrink: 0;
173
+ display: flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ }
177
+ .adk-qr-frame img {
178
+ width: 100%;
179
+ height: 100%;
180
+ display: block;
181
+ }
182
+ .adk-qr-info {
183
+ flex: 1;
184
+ min-width: 210px;
185
+ display: flex;
186
+ flex-direction: column;
187
+ gap: 8px;
188
+ }
189
+ .adk-meta-line {
190
+ font-size: 12px;
191
+ color: var(--dsw-alias-label-tertiary, #6b7280);
192
+ }
193
+ .adk-meta-line code {
194
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
208
195
  color: var(--dsw-alias-label-primary, #111827);
196
+ background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.1));
197
+ padding: 1px 5px;
198
+ border-radius: 4px;
209
199
  }
210
- .adk-card-desc {
211
- margin: 0;
200
+ .adk-provisioning {
201
+ display: flex;
202
+ flex-direction: column;
203
+ gap: 6px;
204
+ padding: 6px 0;
205
+ }
206
+ .adk-provisioning-title {
207
+ display: flex;
208
+ align-items: center;
209
+ gap: 8px;
210
+ font-size: 13.5px;
211
+ font-weight: 500;
212
+ }
213
+ .adk-spinner {
214
+ width: 14px;
215
+ height: 14px;
216
+ border-radius: 999px;
217
+ border: 2px solid var(--dsw-alias-border-l3, rgba(127, 127, 127, 0.3));
218
+ border-top-color: var(--dsw-alias-button-primary-fill, #2563eb);
219
+ animation: adk-spin 0.8s linear infinite;
220
+ flex-shrink: 0;
221
+ }
222
+ @keyframes adk-spin {
223
+ to { transform: rotate(360deg); }
224
+ }
225
+ .adk-banner {
226
+ border-radius: var(--dsw-radius-md, 8px);
227
+ padding: 10px 12px;
212
228
  font-size: 12.5px;
213
- color: var(--dsw-alias-label-tertiary, #6b7280);
229
+ line-height: 1.5;
230
+ display: flex;
231
+ align-items: center;
232
+ justify-content: space-between;
233
+ gap: 10px;
234
+ flex-wrap: wrap;
235
+ }
236
+ .adk-banner-err {
237
+ background: rgba(239, 68, 68, 0.12);
238
+ border: 1px solid rgba(239, 68, 68, 0.32);
239
+ color: #ef4444;
240
+ }
241
+ .adk-banner-warn {
242
+ background: rgba(245, 158, 11, 0.12);
243
+ border: 1px solid rgba(245, 158, 11, 0.3);
244
+ color: #d97706;
214
245
  }
215
- .adk-list {
246
+ .adk-rows {
216
247
  display: flex;
217
248
  flex-direction: column;
218
- border-top: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.15));
219
249
  }
220
250
  .adk-row {
221
251
  display: flex;
222
- align-items: flex-start;
252
+ align-items: center;
223
253
  justify-content: space-between;
224
254
  gap: 12px;
225
- padding: 10px 0;
255
+ padding: 12px 0;
226
256
  border-bottom: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.15));
257
+ flex-wrap: wrap;
258
+ }
259
+ .adk-row:first-child {
260
+ padding-top: 2px;
227
261
  }
228
262
  .adk-row:last-child {
229
263
  border-bottom: none;
230
264
  padding-bottom: 2px;
231
265
  }
266
+ .adk-row-col {
267
+ flex-direction: column;
268
+ align-items: stretch;
269
+ gap: 8px;
270
+ }
271
+ .adk-row-head {
272
+ display: flex;
273
+ align-items: center;
274
+ justify-content: space-between;
275
+ gap: 8px;
276
+ }
232
277
  .adk-row-main {
233
278
  display: flex;
234
279
  flex-direction: column;
@@ -237,65 +282,43 @@ window.__ModuleLoader__.load({
237
282
  flex: 1;
238
283
  }
239
284
  .adk-row-label {
285
+ display: flex;
286
+ align-items: center;
287
+ gap: 8px;
240
288
  font-weight: 500;
241
289
  color: var(--dsw-alias-label-primary, #111827);
242
290
  }
243
- .adk-row-detail {
244
- font-size: 12px;
245
- color: var(--dsw-alias-label-tertiary, #6b7280);
246
- word-break: break-all;
247
- }
248
291
  .adk-badge {
249
292
  display: inline-flex;
250
293
  align-items: center;
251
- gap: 5px;
252
- padding: 2px 8px;
294
+ padding: 1px 8px;
253
295
  border-radius: 999px;
254
296
  font-size: 11.5px;
255
297
  font-weight: 500;
256
298
  white-space: nowrap;
257
- flex-shrink: 0;
258
299
  }
259
300
  .adk-badge-ok {
260
301
  background: rgba(16, 185, 129, 0.14);
261
302
  color: #10b981;
262
303
  }
263
- .adk-badge-warn {
264
- background: rgba(245, 158, 11, 0.16);
265
- color: #d97706;
266
- }
267
304
  .adk-badge-muted {
268
305
  background: rgba(127, 127, 127, 0.14);
269
306
  color: var(--dsw-alias-label-secondary, #6b7280);
270
307
  }
271
- .adk-checkbox-row {
272
- display: flex;
273
- align-items: center;
274
- gap: 8px;
275
- font-size: 12.5px;
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;
283
- }
284
308
  .adk-actions {
285
309
  display: flex;
286
310
  align-items: center;
287
- gap: 8px;
288
- flex-wrap: wrap;
311
+ gap: 6px;
312
+ flex-shrink: 0;
289
313
  }
290
314
  .adk-btn {
291
315
  display: inline-flex;
292
316
  align-items: center;
293
317
  justify-content: center;
294
- gap: 6px;
295
- height: 32px;
296
- padding: 0 14px;
318
+ height: 28px;
319
+ padding: 0 12px;
297
320
  border-radius: var(--dsw-radius-md, 8px);
298
- font-size: 13px;
321
+ font-size: 12px;
299
322
  font-weight: 500;
300
323
  font-family: inherit;
301
324
  cursor: pointer;
@@ -321,81 +344,45 @@ window.__ModuleLoader__.load({
321
344
  .adk-btn-secondary:hover:not(:disabled) {
322
345
  background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.1));
323
346
  }
324
- .adk-btn-sm {
347
+ .adk-seg {
348
+ display: inline-flex;
349
+ flex-wrap: wrap;
350
+ gap: 6px;
351
+ }
352
+ .adk-seg-btn {
325
353
  height: 28px;
326
354
  padding: 0 10px;
327
- font-size: 12px;
328
- }
329
- .adk-banner {
330
355
  border-radius: var(--dsw-radius-md, 8px);
331
- padding: 10px 12px;
332
- font-size: 12.5px;
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;
356
+ border: 1px solid var(--dsw-alias-border-l3, rgba(127, 127, 127, 0.25));
357
+ background: transparent;
349
358
  color: var(--dsw-alias-label-secondary, #4b5563);
359
+ font-family: inherit;
360
+ font-size: 12px;
361
+ font-weight: 500;
362
+ cursor: pointer;
363
+ transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
350
364
  }
351
- .adk-qr-layout {
352
- display: flex;
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;
365
+ .adk-seg-btn:hover:not(:disabled) {
366
+ background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.1));
374
367
  }
375
- .adk-qr-info {
376
- flex: 1;
377
- min-width: 220px;
378
- display: flex;
379
- flex-direction: column;
380
- gap: 8px;
368
+ .adk-seg-btn-active {
369
+ background: var(--dsw-alias-button-primary-fill, #2563eb);
370
+ border-color: var(--dsw-alias-button-primary-fill, #2563eb);
371
+ color: var(--dsw-alias-label-primary-foreground, #ffffff);
381
372
  }
382
- .adk-meta-line {
383
- font-size: 12px;
384
- color: var(--dsw-alias-label-tertiary, #6b7280);
373
+ .adk-seg-btn-active:hover:not(:disabled) {
374
+ background: var(--dsw-alias-button-primary-hover, #1d4ed8);
385
375
  }
386
- .adk-meta-line code {
387
- font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
388
- color: var(--dsw-alias-label-primary, #111827);
389
- background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.1));
390
- padding: 1px 5px;
391
- border-radius: 4px;
376
+ .adk-seg-btn:disabled {
377
+ opacity: 0.55;
378
+ cursor: not-allowed;
392
379
  }
393
380
  .adk-links {
394
381
  display: flex;
395
382
  align-items: center;
396
383
  gap: 8px;
397
384
  flex-wrap: wrap;
398
- padding-top: 8px;
385
+ padding-top: 10px;
399
386
  border-top: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.15));
400
387
  }
401
388
  .adk-links-label {
@@ -468,32 +455,19 @@ window.__ModuleLoader__.load({
468
455
  const isZh = t('isZh') === '1';
469
456
 
470
457
  const [status, setStatus] = useState(null);
471
- const [loading, setLoading] = useState(true);
472
458
  const [error, setError] = useState(null);
473
459
  const [busy, setBusy] = useState(false);
474
- const [daemonBusy, setDaemonBusy] = useState(false);
475
- const [syncModels, setSyncModels] = useState(false);
476
- const [setupFeedback, setSetupFeedback] = useState(null);
477
460
 
478
461
  const loadStatus = useCallback(async () => {
479
- setLoading(true);
480
- setError(null);
481
462
  try {
482
- const res = await fetch('/api/agentdeck/status', {
463
+ const res = await fetch('api/agentdeck/status', {
483
464
  cache: 'no-store',
484
465
  });
485
466
  const data = await res.json();
486
- if (!res.ok) {
487
- throw new Error(data?.error || `HTTP ${res.status}`);
488
- }
467
+ if (!res.ok) throw new Error(data?.error || `HTTP ${res.status}`);
489
468
  setStatus(data);
490
- setSyncModels((prev) =>
491
- prev ? true : !data?.models?.acp?.defaultModel,
492
- );
493
469
  } catch (err) {
494
470
  setError(err instanceof Error ? err.message : String(err));
495
- } finally {
496
- setLoading(false);
497
471
  }
498
472
  }, []);
499
473
 
@@ -501,88 +475,84 @@ window.__ModuleLoader__.load({
501
475
  loadStatus();
502
476
  }, [loadStatus]);
503
477
 
504
- const onSetup = useCallback(async () => {
478
+ // Automatically poll while first-time background provisioning is running
479
+ const isProvisioning = status?.provisioning?.state === 'running';
480
+ useEffect(() => {
481
+ if (!isProvisioning) return undefined;
482
+ const timer = setTimeout(() => {
483
+ loadStatus();
484
+ }, 1500);
485
+ return () => clearTimeout(timer);
486
+ }, [isProvisioning, status, loadStatus]);
487
+
488
+ const postAction = useCallback(async (url, body) => {
505
489
  setBusy(true);
506
490
  setError(null);
507
- setSetupFeedback(null);
508
491
  try {
509
- const res = await fetch('/api/agentdeck/setup', {
492
+ const res = await fetch(url, {
510
493
  method: 'POST',
511
494
  headers: { 'content-type': 'application/json' },
512
- body: JSON.stringify({ syncModels }),
495
+ body: JSON.stringify(body),
513
496
  });
514
497
  const data = await res.json();
498
+ if (data?.status) setStatus(data.status);
515
499
  if (!res.ok || !data?.ok) {
516
500
  throw new Error(data?.error || `HTTP ${res.status}`);
517
501
  }
518
- if (data.status) setStatus(data.status);
519
- setSetupFeedback({ steps: data.steps || [] });
520
502
  } catch (err) {
521
503
  setError(err instanceof Error ? err.message : String(err));
522
504
  } finally {
523
505
  setBusy(false);
524
506
  }
525
- }, [syncModels]);
526
-
527
- const onDaemonAction = useCallback(async (action) => {
528
- setDaemonBusy(true);
529
- setError(null);
530
- try {
531
- const res = await fetch('/api/agentdeck/daemon', {
532
- method: 'POST',
533
- headers: { 'content-type': 'application/json' },
534
- body: JSON.stringify({ action }),
535
- });
536
- const data = await res.json();
537
- if (!res.ok || !data?.ok) {
538
- throw new Error(data?.error || `HTTP ${res.status}`);
539
- }
540
- if (data.status) setStatus(data.status);
541
- } catch (err) {
542
- setError(err instanceof Error ? err.message : String(err));
543
- } finally {
544
- setDaemonBusy(false);
545
- }
546
507
  }, []);
547
508
 
548
- const stepStatusLabel = (s) => {
549
- if (s === 'installed') return t('stepInstalled');
550
- if (s === 'skipped') return t('stepSkipped');
551
- if (s === 'updated') return t('stepUpdated');
552
- if (s === 'started') return t('stepStarted');
553
- return t('stepUnchanged');
554
- };
509
+ const awakeMode = status?.daemon?.awake?.mode || 'never';
510
+ const awakeOptions = [
511
+ { id: 'never', label: t('awakeNever'), hint: t('awakeHintNever') },
512
+ { id: 'plugged', label: t('awakePlugged'), hint: t('awakeHintPlugged') },
513
+ { id: 'active', label: t('awakeActiveMode'), hint: t('awakeHintActive') },
514
+ { id: 'always', label: t('awakeAlways'), hint: t('awakeHintAlways') },
515
+ ];
516
+ const currentAwakeHint =
517
+ awakeOptions.find((o) => o.id === awakeMode)?.hint || '';
555
518
 
556
- const acpModelText = formatModel(status?.models?.acp?.defaultModel);
557
- const sourceModelText = formatModel(status?.models?.source?.defaultModel);
558
519
  const qrDataUrl = status?.daemon?.qrSvg
559
520
  ? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(status.daemon.qrSvg)}`
560
521
  : null;
561
- const anyBusy = busy || daemonBusy;
522
+ const acpModelText = formatModel(status?.models?.acp?.defaultModel);
523
+ const sourceModelText = formatModel(status?.models?.source?.defaultModel);
524
+ const provisionError = status?.provisioning?.error || null;
525
+ const anyBusy = busy || isProvisioning;
562
526
 
563
527
  return h(
564
528
  'div',
565
529
  { className: 'adk-root' },
566
530
  h(
567
531
  'div',
568
- { className: 'adk-hero' },
569
- h(
570
- 'div',
571
- null,
572
- h('h2', { className: 'adk-title' }, t('title')),
573
- h('p', { className: 'adk-subtitle' }, t('subtitle')),
574
- ),
532
+ null,
533
+ h('h2', { className: 'adk-title' }, t('title')),
534
+ h('p', { className: 'adk-subtitle' }, t('subtitle')),
575
535
  ),
576
536
 
577
- loading && !status
537
+ !status && !error
578
538
  ? h('div', { className: 'adk-card' }, t('loading'))
579
539
  : null,
580
540
 
581
- error
541
+ error || provisionError
582
542
  ? h(
583
543
  'div',
584
544
  { className: 'adk-banner adk-banner-err' },
585
- `${t('loadError')}: ${error}`,
545
+ h('span', null, `${t('errorTitle')}: ${error || provisionError}`),
546
+ h(
547
+ 'button',
548
+ {
549
+ type: 'button',
550
+ className: 'adk-btn adk-btn-primary',
551
+ disabled: anyBusy,
552
+ onClick: () => postAction('api/agentdeck/setup', {}),
553
+ },
554
+ t('btnRetry'),
555
+ ),
586
556
  )
587
557
  : null,
588
558
 
@@ -590,332 +560,79 @@ window.__ModuleLoader__.load({
590
560
  ? h(
591
561
  React.Fragment,
592
562
  null,
593
- // Card 1: One-click setup + autostart
563
+ // Card 1: Pairing QR Code (zero-click ready)
594
564
  h(
595
565
  'section',
596
566
  { 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
812
- h(
813
- 'section',
814
- { className: 'adk-card' },
815
- h(
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
567
+ isProvisioning && !qrDataUrl
833
568
  ? h(
834
569
  'div',
835
- { className: 'adk-qr-layout' },
570
+ { className: 'adk-provisioning' },
836
571
  h(
837
572
  'div',
838
- { className: 'adk-qr-frame' },
839
- h('img', {
840
- src: qrDataUrl,
841
- alt: 'AgentDeck pairing QR code',
842
- }),
573
+ { className: 'adk-provisioning-title' },
574
+ h('span', { className: 'adk-spinner' }),
575
+ h('span', null, t('provisioning')),
843
576
  ),
844
- h(
845
- 'div',
846
- { className: 'adk-qr-info' },
847
- h('p', { className: 'adk-card-desc' }, t('qrHint')),
848
- h(
849
- 'div',
850
- { className: 'adk-meta-line' },
851
- `${t('pairingIdLabel')}: `,
852
- h('code', null, status.daemon.maskedPairingId),
853
- ),
854
- status.daemon.hasCustomRelay
577
+ h('p', { className: 'adk-desc' }, t('provisioningHint')),
578
+ )
579
+ : qrDataUrl
580
+ ? h(
581
+ React.Fragment,
582
+ null,
583
+ !status.daemon?.running
855
584
  ? h(
856
585
  'div',
857
- { className: 'adk-meta-line' },
858
- `${t('customRelayLabel')}: `,
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'),
586
+ { className: 'adk-banner adk-banner-warn' },
587
+ t('stoppedBanner'),
867
588
  )
868
589
  : null,
869
590
  h(
870
591
  'div',
871
- { className: 'adk-actions' },
872
- !status.daemon.running
873
- ? h(
874
- 'button',
875
- {
876
- type: 'button',
877
- className: 'adk-btn adk-btn-primary adk-btn-sm',
878
- disabled: anyBusy,
879
- onClick: () => onDaemonAction('start'),
880
- },
881
- daemonBusy
882
- ? t('btnWorking')
883
- : t('btnDaemonStart'),
884
- )
885
- : status.daemon.binaryPath
592
+ { className: 'adk-qr-layout' },
593
+ h(
594
+ 'div',
595
+ { className: 'adk-qr-frame' },
596
+ h('img', {
597
+ src: qrDataUrl,
598
+ alt: 'AgentDeck pairing QR code',
599
+ }),
600
+ ),
601
+ h(
602
+ 'div',
603
+ { className: 'adk-qr-info' },
604
+ h('p', { className: 'adk-desc' }, t('qrHint')),
605
+ h(
606
+ 'div',
607
+ { className: 'adk-meta-line' },
608
+ `${t('pairingIdLabel')}: `,
609
+ h('code', null, status.daemon.maskedPairingId),
610
+ ),
611
+ status.daemon.hasCustomRelay
886
612
  ? h(
887
- React.Fragment,
888
- null,
889
- h(
890
- 'button',
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
- ),
613
+ 'div',
614
+ { className: 'adk-meta-line' },
615
+ `${t('customRelayLabel')}: `,
616
+ h('code', null, status.daemon.relayUrl),
913
617
  )
914
618
  : null,
619
+ ),
620
+ ),
621
+ )
622
+ : h(
623
+ 'div',
624
+ { className: 'adk-actions' },
625
+ h(
626
+ 'button',
627
+ {
628
+ type: 'button',
629
+ className: 'adk-btn adk-btn-primary',
630
+ disabled: anyBusy,
631
+ onClick: () => postAction('api/agentdeck/setup', {}),
632
+ },
633
+ t('btnRetry'),
915
634
  ),
916
635
  ),
917
- )
918
- : h('p', { className: 'adk-card-desc' }, t('daemonAutoHint')),
919
636
 
920
637
  h(
921
638
  'div',
@@ -967,6 +684,181 @@ window.__ModuleLoader__.load({
967
684
  ),
968
685
  ),
969
686
  ),
687
+
688
+ // Card 2: Essential Settings Only (Service, Keep Awake, Mobile Model)
689
+ h(
690
+ 'section',
691
+ { className: 'adk-card' },
692
+ h(
693
+ 'div',
694
+ { className: 'adk-rows' },
695
+ // 1. Remote Service & Autostart
696
+ h(
697
+ 'div',
698
+ { className: 'adk-row' },
699
+ h(
700
+ 'div',
701
+ { className: 'adk-row-main' },
702
+ h(
703
+ 'div',
704
+ { className: 'adk-row-label' },
705
+ h('span', null, t('serviceTitle')),
706
+ h(
707
+ 'span',
708
+ {
709
+ className: `adk-badge ${status.daemon?.running ? 'adk-badge-ok' : 'adk-badge-muted'}`,
710
+ },
711
+ status.daemon?.running
712
+ ? t('statusRunning')
713
+ : t('statusStopped'),
714
+ ),
715
+ ),
716
+ h(
717
+ 'p',
718
+ { className: 'adk-desc' },
719
+ status.daemon?.running
720
+ ? t('serviceDescRunning')
721
+ : t('serviceDescStopped'),
722
+ ),
723
+ ),
724
+ h(
725
+ 'div',
726
+ { className: 'adk-actions' },
727
+ status.daemon?.running
728
+ ? status.daemon?.binaryPath
729
+ ? h(
730
+ React.Fragment,
731
+ null,
732
+ h(
733
+ 'button',
734
+ {
735
+ type: 'button',
736
+ className: 'adk-btn adk-btn-secondary',
737
+ disabled: anyBusy,
738
+ onClick: () =>
739
+ postAction('api/agentdeck/daemon', {
740
+ action: 'restart',
741
+ }),
742
+ },
743
+ busy ? t('btnWorking') : t('btnRestart'),
744
+ ),
745
+ h(
746
+ 'button',
747
+ {
748
+ type: 'button',
749
+ className: 'adk-btn adk-btn-secondary',
750
+ disabled: anyBusy,
751
+ onClick: () =>
752
+ postAction('api/agentdeck/daemon', {
753
+ action: 'stop',
754
+ }),
755
+ },
756
+ t('btnStop'),
757
+ ),
758
+ )
759
+ : null
760
+ : h(
761
+ 'button',
762
+ {
763
+ type: 'button',
764
+ className: 'adk-btn adk-btn-primary',
765
+ disabled: anyBusy,
766
+ onClick: () =>
767
+ postAction('api/agentdeck/daemon', {
768
+ action: 'start',
769
+ }),
770
+ },
771
+ busy ? t('btnWorking') : t('btnStart'),
772
+ ),
773
+ ),
774
+ ),
775
+
776
+ // 2. Keep Awake
777
+ h(
778
+ 'div',
779
+ { className: 'adk-row adk-row-col' },
780
+ h(
781
+ 'div',
782
+ { className: 'adk-row-head' },
783
+ h('span', { className: 'adk-row-label' }, t('awakeTitle')),
784
+ status.daemon?.running
785
+ ? h(
786
+ 'span',
787
+ {
788
+ className: `adk-badge ${status.daemon?.awake?.active ? 'adk-badge-ok' : 'adk-badge-muted'}`,
789
+ },
790
+ status.daemon?.awake?.active
791
+ ? t('awakeActive')
792
+ : t('awakeInactive'),
793
+ )
794
+ : null,
795
+ ),
796
+ h(
797
+ 'div',
798
+ {
799
+ className: 'adk-seg',
800
+ role: 'radiogroup',
801
+ 'aria-label': t('awakeTitle'),
802
+ },
803
+ ...awakeOptions.map((opt) =>
804
+ h(
805
+ 'button',
806
+ {
807
+ key: opt.id,
808
+ type: 'button',
809
+ role: 'radio',
810
+ 'aria-checked': awakeMode === opt.id,
811
+ disabled: anyBusy,
812
+ className: `adk-seg-btn ${awakeMode === opt.id ? 'adk-seg-btn-active' : ''}`,
813
+ onClick: () =>
814
+ postAction('api/agentdeck/awake', {
815
+ mode: opt.id,
816
+ }),
817
+ },
818
+ opt.label,
819
+ ),
820
+ ),
821
+ ),
822
+ h('p', { className: 'adk-desc' }, currentAwakeHint),
823
+ status.daemon?.awake?.error
824
+ ? h(
825
+ 'p',
826
+ { className: 'adk-desc adk-text-err' },
827
+ status.daemon.awake.error,
828
+ )
829
+ : null,
830
+ ),
831
+
832
+ // 3. Mobile Default Model
833
+ h(
834
+ 'div',
835
+ { className: 'adk-row' },
836
+ h(
837
+ 'div',
838
+ { className: 'adk-row-main' },
839
+ h('span', { className: 'adk-row-label' }, t('modelTitle')),
840
+ h(
841
+ 'p',
842
+ { className: 'adk-desc' },
843
+ acpModelText || t('modelDefault'),
844
+ ),
845
+ ),
846
+ sourceModelText && status.models?.mismatch
847
+ ? h(
848
+ 'button',
849
+ {
850
+ type: 'button',
851
+ className: 'adk-btn adk-btn-secondary',
852
+ disabled: anyBusy,
853
+ onClick: () =>
854
+ postAction('api/agentdeck/sync-models', {}),
855
+ },
856
+ `${t('btnSyncModel')} (${sourceModelText})`,
857
+ )
858
+ : null,
859
+ ),
860
+ ),
861
+ ),
970
862
  )
971
863
  : null,
972
864
  );