dsh-rayrun-bots 0.1.1-alpha → 0.1.1-alpha.2
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 +111 -255
- package/client.js +570 -146
- package/cloud-host/README.md +7 -1
- package/cloud-host/lib/host.mjs +13 -0
- package/cloud-host/lib/proposal.mjs +13 -6
- package/index.js +79 -10
- package/lib/cloud-host-runtime.js +19 -3
- package/lib/computer-update.js +322 -0
- package/lib/dependency.js +19 -0
- package/lib/errors.js +3 -0
- package/lib/rayrun-detached-runtime.js +128 -6
- package/lib/sessions.js +147 -9
- package/lib/update-check.js +117 -0
- package/locale/en.json +73 -25
- package/locale/zh.json +73 -25
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -20,6 +20,7 @@ window.__ModuleLoader__.load({
|
|
|
20
20
|
const { useEffect, useRef, useState } = React
|
|
21
21
|
const PREVIEW = new URLSearchParams(window.location.search)
|
|
22
22
|
const FIRST_RUN_PREVIEW = PREVIEW.get('first-run') === '1'
|
|
23
|
+
const DEMO_PREVIEW = PREVIEW.get('preview') === '1'
|
|
23
24
|
const LOW_BALANCE_PREVIEW = PREVIEW.get('low-balance') === '1'
|
|
24
25
|
const COMPUTER_PREVIEW = ['live', 'reconnecting', 'sleeping', 'unreachable'].includes(PREVIEW.get('computer'))
|
|
25
26
|
? PREVIEW.get('computer')
|
|
@@ -28,14 +29,18 @@ window.__ModuleLoader__.load({
|
|
|
28
29
|
const EN = {
|
|
29
30
|
"meta": {
|
|
30
31
|
"title": "Rayrun Bot",
|
|
31
|
-
"description": "Adds a Bots entry and the v0.1 three-column shell: chat list, conversation with approval cards, details, setup and settings.
|
|
32
|
+
"description": "Adds a Bots entry and the v0.1 three-column shell: chat list, conversation with approval cards, details, setup and settings. Real bots and sessions run on your own Rayrun cloud computer. Sample data is available only in the explicit ?preview=1 demo."
|
|
32
33
|
},
|
|
33
34
|
"panel": {
|
|
34
35
|
"label": "Bots"
|
|
35
36
|
},
|
|
36
37
|
"brand": "Rayrun Bot",
|
|
37
38
|
"preview": {
|
|
38
|
-
"badge": "Preview"
|
|
39
|
+
"badge": "Preview",
|
|
40
|
+
"demoBadge": "Demo",
|
|
41
|
+
"sample": "Sample",
|
|
42
|
+
"demoBanner": "Demo data. Nothing here is real.",
|
|
43
|
+
"demoSnippet": "Sample conversation"
|
|
39
44
|
},
|
|
40
45
|
"chat": {
|
|
41
46
|
"working": "Working…",
|
|
@@ -48,15 +53,18 @@ window.__ModuleLoader__.load({
|
|
|
48
53
|
"sendFailed": "Could not send. Try again.",
|
|
49
54
|
"runtimeUnavailable": "The cloud runtime is unavailable. Install dsh-rayrun-computer and reload DSH.",
|
|
50
55
|
"connectRayrun": "Connect Rayrun in setup before sending.",
|
|
51
|
-
"noComputer": "No cloud computer yet. Create one in setup first.",
|
|
52
56
|
"machineBusy": "The cloud computer is busy. Try again shortly.",
|
|
53
57
|
"balanceLow": "The Rayrun balance is low. Add credit before sending.",
|
|
54
58
|
"queueFull": "Too many messages are queued. Wait for a reply.",
|
|
55
59
|
"messageInvalid": "That message can't be sent: it is empty, too long, or invalid.",
|
|
56
60
|
"historyFailed": "Could not load this conversation. Reload the page to retry.",
|
|
57
|
-
"turnTimeout": "The cloud turn
|
|
61
|
+
"turnTimeout": "The page stopped waiting, but the cloud turn may still be running. Refresh to check the result.",
|
|
58
62
|
"turnInterrupted": "The previous turn was interrupted. Send it again.",
|
|
59
|
-
"errorTitle": "Turn failed"
|
|
63
|
+
"errorTitle": "Turn failed",
|
|
64
|
+
"machineStopped": "Your cloud computer is stopped or unavailable. Open it from Details or the cloud-computer plugin, then send again.",
|
|
65
|
+
"imageUnsupported": "This cloud computer image is missing or does not start a DSH worker, so no task was started. Use an image such as deepseek-harness@1.",
|
|
66
|
+
"imageOutdated": "This cloud computer's image is too old for the cloud bot host. Update the computer in Settings → Bot, then send again.",
|
|
67
|
+
"workerNoReply": "The cloud worker ended without writing reply.md. Check its session for the provider error; a missing DeepSeek credential (MISSING_CREDENTIAL) prevents a reply. Add a model credential or recreate the computer with one."
|
|
60
68
|
},
|
|
61
69
|
"list": {
|
|
62
70
|
"search": "Search",
|
|
@@ -105,7 +113,18 @@ window.__ModuleLoader__.load({
|
|
|
105
113
|
"waitingSide": "Waiting to execute",
|
|
106
114
|
"failedSide": "Execution failed",
|
|
107
115
|
"continue": "Continue bot",
|
|
108
|
-
"continuePrompt": "Continue from the approval result above. Do not repeat the approved action; ask before another controlled action."
|
|
116
|
+
"continuePrompt": "Continue from the approval result above. Do not repeat the approved action; ask before another controlled action.",
|
|
117
|
+
"riskStart": "Starts your computer and spends machine time.",
|
|
118
|
+
"riskResume": "Resumes your computer and spends machine time.",
|
|
119
|
+
"riskStop": "Stops your computer. Running work stops.",
|
|
120
|
+
"riskPause": "Pauses your computer. Running work pauses.",
|
|
121
|
+
"riskUnknown": "Approves a controlled action on your computer.",
|
|
122
|
+
"parseError": "The bot's approval request could not be parsed. No action was requested.",
|
|
123
|
+
"expiredRunning": "This background request expired, but your cloud computer may still be running.",
|
|
124
|
+
"stopComputer": "Stop computer",
|
|
125
|
+
"stopConfirm": "Stop the cloud computer? Running work will stop.",
|
|
126
|
+
"stopConfirmAction": "Stop",
|
|
127
|
+
"cancel": "Cancel"
|
|
109
128
|
},
|
|
110
129
|
"draft": {
|
|
111
130
|
"send": "Send",
|
|
@@ -161,7 +180,6 @@ window.__ModuleLoader__.load({
|
|
|
161
180
|
"reconnecting": "reconnecting…",
|
|
162
181
|
"unreachable": "Couldn't reach the computer.",
|
|
163
182
|
"sleeping": "sleeping",
|
|
164
|
-
"takeOver": "Take over",
|
|
165
183
|
"open": "Open",
|
|
166
184
|
"view": "View",
|
|
167
185
|
"onComputer": "On the computer · {where}",
|
|
@@ -177,26 +195,32 @@ window.__ModuleLoader__.load({
|
|
|
177
195
|
"stopTimeout": "The computer is still stopping.",
|
|
178
196
|
"stopFailed": "Could not stop the computer: {message}",
|
|
179
197
|
"connectFirst": "Connect Rayrun first (Settings → Set up).",
|
|
180
|
-
"popupBlocked": "
|
|
198
|
+
"popupBlocked": "Pop-ups are blocked. Open the desktop from the link below.",
|
|
181
199
|
"starting": "Starting the computer…",
|
|
182
200
|
"startTimeout": "The computer did not start in time.",
|
|
183
201
|
"noDesktop": "This computer has no remote desktop.",
|
|
184
202
|
"openFailed": "Could not open the computer: {message}",
|
|
185
203
|
"opened": "Computer opened in a new tab.",
|
|
204
|
+
"openDesktop": "Open desktop",
|
|
186
205
|
"passwordTitle": "Desktop password",
|
|
187
206
|
"passwordBody": "Use this password on the desktop page.",
|
|
188
207
|
"passwordEmpty": "No desktop password found.",
|
|
189
208
|
"copy": "Copy",
|
|
190
209
|
"copied": "Copied",
|
|
191
210
|
"copyFailed": "Copy failed. Select the password manually.",
|
|
192
|
-
"close": "Close"
|
|
211
|
+
"close": "Close",
|
|
212
|
+
"hostManaged": "Managed by host",
|
|
213
|
+
"burnLine": "Running now · {rate}/h · {hours} machine-hours to date",
|
|
214
|
+
"image": "Image · {image}",
|
|
215
|
+
"imageUnread": "Image could not be read. Detached turns will not start until it is known."
|
|
193
216
|
},
|
|
194
217
|
"notice": {
|
|
195
218
|
"recovering": "The bot host is restarting. This conversation resumes on its own.",
|
|
196
219
|
"reconnecting": "Computer reconnecting… retrying in 5s",
|
|
197
220
|
"sleeping": "Computer is sleeping. Open it in the cloud-computer plugin to wake it.",
|
|
198
|
-
"attach": "Attachments
|
|
199
|
-
"preview": "In-memory preview. Nothing on this page is saved, and approvals are not sent to a worker."
|
|
221
|
+
"attach": "Attachments are not available yet.",
|
|
222
|
+
"preview": "In-memory preview. Nothing on this page is saved, and approvals are not sent to a worker.",
|
|
223
|
+
"cloud": "Bots run on your own Rayrun cloud computer. Approval decisions stay on your local host."
|
|
200
224
|
},
|
|
201
225
|
"composer": {
|
|
202
226
|
"placeholder": "Message {name}…",
|
|
@@ -205,8 +229,8 @@ window.__ModuleLoader__.load({
|
|
|
205
229
|
},
|
|
206
230
|
"usage": {
|
|
207
231
|
"balanceLine": "Balance {balance} · {hours} machine-hours",
|
|
208
|
-
"weekLine": "This week {spend}
|
|
209
|
-
"liveLine": "Live from your Rayrun account
|
|
232
|
+
"weekLine": "This week {spend}",
|
|
233
|
+
"liveLine": "Live from your Rayrun account",
|
|
210
234
|
"sampleBalance": "¥41.20",
|
|
211
235
|
"sampleHours": "38.4",
|
|
212
236
|
"sampleSpend": "¥6.80"
|
|
@@ -279,21 +303,22 @@ window.__ModuleLoader__.load({
|
|
|
279
303
|
"computerLoadFailed": "Could not read your Rayrun computers: {message}",
|
|
280
304
|
"computerName": "Computer name",
|
|
281
305
|
"computerKeyPlaceholder": "Paste a DeepSeek API key (optional)",
|
|
282
|
-
"computerKeyHint": "
|
|
306
|
+
"computerKeyHint": "New computers need a DeepSeek credential for cloud DSH turns. Leave this blank only if this computer or your Rayrun defaults already provide one.",
|
|
283
307
|
"computerCreate": "Create cloud computer",
|
|
284
308
|
"computerCreating": "Creating… about 15 seconds",
|
|
285
309
|
"computerCreated": "Created · {name}",
|
|
286
310
|
"computerCreateFailed": "Could not create the computer: {message}",
|
|
287
311
|
"computerCost": "Creates a billable machine on your Rayrun account. Bots never destroys it.",
|
|
288
312
|
"botTitle": "First bot",
|
|
289
|
-
"botBody": "Give it a name and one job. It is
|
|
313
|
+
"botBody": "Give it a name and one job. It is saved to your local roster and runs on your cloud computer.",
|
|
314
|
+
"open": "Set up Rayrun Bot",
|
|
315
|
+
"imageUnsupported": "This image runs a shell oneshot and will not start a DSH worker. Use deepseek-harness@1 or another image that starts DSH headless."
|
|
290
316
|
},
|
|
291
317
|
"settings": {
|
|
292
318
|
"title": "Settings",
|
|
293
319
|
"sub": "Account, usage, and the few settings this plugin owns.",
|
|
294
320
|
"account": "Account",
|
|
295
321
|
"usage": "Usage",
|
|
296
|
-
"notifications": "Notifications",
|
|
297
322
|
"appearance": "Appearance",
|
|
298
323
|
"rayrunAccount": "Rayrun account",
|
|
299
324
|
"rayrunHint": "Token stays in the DSH vault · host side only",
|
|
@@ -307,7 +332,7 @@ window.__ModuleLoader__.load({
|
|
|
307
332
|
"hostDepVersion": "Cloud-computer plugin {version} is not supported (need {required}).",
|
|
308
333
|
"retry": "Retry",
|
|
309
334
|
"plugin": "Cloud-computer plugin",
|
|
310
|
-
"pluginHint": "dsh-rayrun-computer
|
|
335
|
+
"pluginHint": "dsh-rayrun-computer v{version}",
|
|
311
336
|
"pluginOk": "OK",
|
|
312
337
|
"pluginMissing": "Missing",
|
|
313
338
|
"pluginIncompatible": "Incompatible",
|
|
@@ -316,19 +341,39 @@ window.__ModuleLoader__.load({
|
|
|
316
341
|
"usageLine": "Balance {balance} · {hours} machine-hours · {machines} machines",
|
|
317
342
|
"usageConnect": "Connect Rayrun to see usage.",
|
|
318
343
|
"usageFailed": "Could not read usage: {message}",
|
|
319
|
-
"idle": "Idle stop",
|
|
320
|
-
"idleHint": "Stop the computer when idle. Never destroy it.",
|
|
321
|
-
"idle15": "15 minutes",
|
|
322
|
-
"idle30": "30 minutes",
|
|
323
|
-
"idleOff": "Off",
|
|
324
344
|
"lowBalance": "Low-balance reminder",
|
|
325
345
|
"lowBalanceHint": "Show a notice when the balance drops below this.",
|
|
326
|
-
"notify": "Notifications",
|
|
327
|
-
"notifyHint": "Notify when a bot finishes or needs you.",
|
|
328
346
|
"language": "Language",
|
|
329
347
|
"languageHint": "Chinese is primary; English is available.",
|
|
330
348
|
"langEn": "English",
|
|
331
|
-
"langZh": "简体中文"
|
|
349
|
+
"langZh": "简体中文",
|
|
350
|
+
"updates": "Updates",
|
|
351
|
+
"updatesHint": "Check the npm registry for a newer dsh-rayrun-bots build. Nothing is downloaded or installed and no token is sent.",
|
|
352
|
+
"checkUpdates": "Check for updates",
|
|
353
|
+
"checkingUpdates": "Checking npm…",
|
|
354
|
+
"updateAvailable": "{latest} is available (you have {current}).",
|
|
355
|
+
"upToDate": "You are on the newest {channel} build (v{current}).",
|
|
356
|
+
"updateCheckFailed": "Could not check npm: {message}",
|
|
357
|
+
"updateCommandHint": "Run this in a terminal, then restart DSH. The cloud-computer plugin stays installed:",
|
|
358
|
+
"copyUpdateCommand": "Copy command",
|
|
359
|
+
"updateCopied": "Command copied",
|
|
360
|
+
"updateCopyFailed": "Copy failed. Select the command manually.",
|
|
361
|
+
"updateRestart": "This is a notice only; nothing is downloaded or installed automatically.",
|
|
362
|
+
"computer": "Bot's computer",
|
|
363
|
+
"computerHint": "Updates the computer all bots share. Files and sign-ins are kept; installed apps and packages are removed. After a successful update, the old computer and its workspace are destroyed. All bots update together.",
|
|
364
|
+
"computerCurrent": "Current · {name} · {image}",
|
|
365
|
+
"computerUpdate": "Update",
|
|
366
|
+
"computerUpdateHint": "Creates a new computer and copies the preserved paths. After a successful update, the old computer and its workspace are destroyed (irreversible).",
|
|
367
|
+
"computerTarget": "New image: {image}. Bots keeps the DeepSeek credential already bound to this computer, or uses the account's model credential.",
|
|
368
|
+
"computerNoMachine": "No cloud computer found.",
|
|
369
|
+
"computerNotConnected": "Connect Rayrun to manage the bot computer.",
|
|
370
|
+
"computerBillable": "This creates a billable computer on your Rayrun account. On success the old computer is destroyed and cannot be recovered.",
|
|
371
|
+
"computerConfirm": "Update computer (billable)",
|
|
372
|
+
"computerCancel": "Cancel",
|
|
373
|
+
"computerUpdating": "Updating… creating the new computer and copying data. Do not close this page.",
|
|
374
|
+
"computerUpdated": "Computer updated to {image}. The previous computer {name} was destroyed.",
|
|
375
|
+
"computerUpdateFailed": "Could not update the computer: {message}",
|
|
376
|
+
"computerUpdatedKept": "Computer updated to {image}. The previous computer {name} could not be destroyed and is stopped; clean it up manually."
|
|
332
377
|
},
|
|
333
378
|
"sample": {
|
|
334
379
|
"user": {
|
|
@@ -404,19 +449,27 @@ window.__ModuleLoader__.load({
|
|
|
404
449
|
"error": {
|
|
405
450
|
"hostDown": "The bot host is not responding.",
|
|
406
451
|
"botCreate": "Could not save the bot: {message}"
|
|
452
|
+
},
|
|
453
|
+
"user": {
|
|
454
|
+
"you": "You",
|
|
455
|
+
"youInitials": "Y"
|
|
407
456
|
}
|
|
408
457
|
}
|
|
409
458
|
const ZH = {
|
|
410
459
|
"meta": {
|
|
411
460
|
"title": "Rayrun Bot",
|
|
412
|
-
"description": "在侧边栏加入 Bots 入口和 v0.1
|
|
461
|
+
"description": "在侧边栏加入 Bots 入口和 v0.1 三栏界面:会话列表、带审批卡的对话、详情面板、初始化与设置。真实 bot 和会话运行在你自己的 Rayrun 云电脑上;示例数据只出现在显式的 ?preview=1 演示中。"
|
|
413
462
|
},
|
|
414
463
|
"panel": {
|
|
415
464
|
"label": "Bots"
|
|
416
465
|
},
|
|
417
466
|
"brand": "Rayrun Bot",
|
|
418
467
|
"preview": {
|
|
419
|
-
"badge": "预览"
|
|
468
|
+
"badge": "预览",
|
|
469
|
+
"demoBadge": "演示",
|
|
470
|
+
"sample": "示例",
|
|
471
|
+
"demoBanner": "演示数据,内容不是真的。",
|
|
472
|
+
"demoSnippet": "示例对话"
|
|
420
473
|
},
|
|
421
474
|
"chat": {
|
|
422
475
|
"working": "正在处理…",
|
|
@@ -429,15 +482,18 @@ window.__ModuleLoader__.load({
|
|
|
429
482
|
"sendFailed": "发送失败,请重试。",
|
|
430
483
|
"runtimeUnavailable": "云端 runtime 不可用。请安装 dsh-rayrun-computer 并重启 DSH。",
|
|
431
484
|
"connectRayrun": "请先在设置里连接 Rayrun。",
|
|
432
|
-
"noComputer": "还没有云电脑。请先在设置里创建一台。",
|
|
433
485
|
"machineBusy": "云电脑正忙,请稍后再试。",
|
|
434
486
|
"balanceLow": "Rayrun 余额偏低,请先充值。",
|
|
435
487
|
"queueFull": "排队消息太多,请等回复后再发送。",
|
|
436
488
|
"messageInvalid": "这条消息无法发送:为空、过长或格式无效。",
|
|
437
489
|
"historyFailed": "无法加载这段对话。刷新页面后重试。",
|
|
438
|
-
"turnTimeout": "
|
|
490
|
+
"turnTimeout": "页面已停止等待,但云端回合可能仍在运行。刷新页面查看结果。",
|
|
439
491
|
"turnInterrupted": "上一回合被中断了。请重新发送。",
|
|
440
|
-
"errorTitle": "回合失败"
|
|
492
|
+
"errorTitle": "回合失败",
|
|
493
|
+
"machineStopped": "云电脑已停止或不可用。请在详情面板或云电脑插件里打开它,再重新发送。",
|
|
494
|
+
"imageUnsupported": "这台云电脑的镜像读不到,或者不会启动 DSH worker,因此没有创建任务。请使用 deepseek-harness@1 之类的镜像。",
|
|
495
|
+
"imageOutdated": "这台云电脑的镜像太旧,无法运行云端 bot host。请在设置 → Bot 更新电脑后重试。",
|
|
496
|
+
"workerNoReply": "云端 worker 结束了,但没有写 reply.md。请检查 worker session 的 provider 错误;缺少 DeepSeek 凭据(MISSING_CREDENTIAL)会导致无法回复。请添加模型凭据,或用带凭据的电脑重建。"
|
|
441
497
|
},
|
|
442
498
|
"list": {
|
|
443
499
|
"search": "搜索",
|
|
@@ -486,7 +542,18 @@ window.__ModuleLoader__.load({
|
|
|
486
542
|
"waitingSide": "等待执行",
|
|
487
543
|
"failedSide": "执行失败",
|
|
488
544
|
"continue": "让 bot 继续",
|
|
489
|
-
"continuePrompt": "根据上面的审批结果继续。不要重复已批准的动作;下一个受控动作前先询问。"
|
|
545
|
+
"continuePrompt": "根据上面的审批结果继续。不要重复已批准的动作;下一个受控动作前先询问。",
|
|
546
|
+
"riskStart": "启动你的电脑;运行期间消耗机时。",
|
|
547
|
+
"riskResume": "恢复你的电脑;运行期间消耗机时。",
|
|
548
|
+
"riskStop": "停止你的电脑;正在运行的工作会停止。",
|
|
549
|
+
"riskPause": "暂停你的电脑;正在运行的工作会暂停。",
|
|
550
|
+
"riskUnknown": "批准在你的电脑上执行一个受控动作。",
|
|
551
|
+
"parseError": "bot 的审批请求无法解析,未执行任何动作。",
|
|
552
|
+
"expiredRunning": "这个后台请求已过期,但云电脑可能仍在运行。",
|
|
553
|
+
"stopComputer": "停止电脑",
|
|
554
|
+
"stopConfirm": "停止云电脑?正在运行的工作会停止。",
|
|
555
|
+
"stopConfirmAction": "停止",
|
|
556
|
+
"cancel": "取消"
|
|
490
557
|
},
|
|
491
558
|
"draft": {
|
|
492
559
|
"send": "发送",
|
|
@@ -542,7 +609,6 @@ window.__ModuleLoader__.load({
|
|
|
542
609
|
"reconnecting": "正在重连…",
|
|
543
610
|
"unreachable": "连不上电脑。",
|
|
544
611
|
"sleeping": "休眠",
|
|
545
|
-
"takeOver": "接管",
|
|
546
612
|
"open": "打开",
|
|
547
613
|
"view": "查看",
|
|
548
614
|
"onComputer": "电脑上 · {where}",
|
|
@@ -558,26 +624,32 @@ window.__ModuleLoader__.load({
|
|
|
558
624
|
"stopTimeout": "云电脑仍在停止中。",
|
|
559
625
|
"stopFailed": "停止云电脑失败:{message}",
|
|
560
626
|
"connectFirst": "先连接 Rayrun(设置 → 首次设置)。",
|
|
561
|
-
"popupBlocked": "
|
|
627
|
+
"popupBlocked": "弹窗被拦截了。用下面的链接打开桌面。",
|
|
562
628
|
"starting": "正在启动云电脑…",
|
|
563
629
|
"startTimeout": "云电脑没有在预期时间内启动。",
|
|
564
630
|
"noDesktop": "这台云电脑没有远程桌面。",
|
|
565
631
|
"openFailed": "打开云电脑失败:{message}",
|
|
566
632
|
"opened": "云电脑已在新标签打开。",
|
|
633
|
+
"openDesktop": "打开桌面",
|
|
567
634
|
"passwordTitle": "桌面密码",
|
|
568
635
|
"passwordBody": "在桌面页面输入这个密码。",
|
|
569
636
|
"passwordEmpty": "没有读到桌面密码。",
|
|
570
637
|
"copy": "复制",
|
|
571
638
|
"copied": "已复制",
|
|
572
639
|
"copyFailed": "复制失败,请手动选中密码。",
|
|
573
|
-
"close": "关闭"
|
|
640
|
+
"close": "关闭",
|
|
641
|
+
"hostManaged": "由 host 管理",
|
|
642
|
+
"burnLine": "正在运行 · {rate}/小时 · 累计 {hours} 机时",
|
|
643
|
+
"image": "镜像 · {image}",
|
|
644
|
+
"imageUnread": "读不到这台云电脑的镜像。在能核对镜像之前,detached 回合不会启动。"
|
|
574
645
|
},
|
|
575
646
|
"notice": {
|
|
576
647
|
"recovering": "Bot host 正在重启,这个会话会自动恢复。",
|
|
577
648
|
"reconnecting": "电脑正在重连… 5 秒后重试",
|
|
578
649
|
"sleeping": "电脑正在休眠。打开云电脑插件即可唤醒。",
|
|
579
|
-
"attach": "
|
|
580
|
-
"preview": "这是页内预览。内容不会保存,审批也不会发给 worker。"
|
|
650
|
+
"attach": "暂时还不能添加附件。",
|
|
651
|
+
"preview": "这是页内预览。内容不会保存,审批也不会发给 worker。",
|
|
652
|
+
"cloud": "Bot 运行在你自己的 Rayrun 云电脑上;审批决定留在本地 host。"
|
|
581
653
|
},
|
|
582
654
|
"composer": {
|
|
583
655
|
"placeholder": "给 {name} 发消息…",
|
|
@@ -586,8 +658,8 @@ window.__ModuleLoader__.load({
|
|
|
586
658
|
},
|
|
587
659
|
"usage": {
|
|
588
660
|
"balanceLine": "余额 {balance} · {hours} 机时",
|
|
589
|
-
"weekLine": "本周 {spend}
|
|
590
|
-
"liveLine": "来自你的 Rayrun 账号
|
|
661
|
+
"weekLine": "本周 {spend}",
|
|
662
|
+
"liveLine": "来自你的 Rayrun 账号",
|
|
591
663
|
"sampleBalance": "¥41.20",
|
|
592
664
|
"sampleHours": "38.4",
|
|
593
665
|
"sampleSpend": "¥6.80"
|
|
@@ -660,21 +732,22 @@ window.__ModuleLoader__.load({
|
|
|
660
732
|
"computerLoadFailed": "读取 Rayrun 云电脑失败:{message}",
|
|
661
733
|
"computerName": "云电脑名称",
|
|
662
734
|
"computerKeyPlaceholder": "粘贴 DeepSeek API key(可选)",
|
|
663
|
-
"computerKeyHint": "
|
|
735
|
+
"computerKeyHint": "新电脑需要 DeepSeek 凭据才能运行云端 DSH 回合。只有当这台电脑或你的 Rayrun 默认配置已提供凭据时才留空。",
|
|
664
736
|
"computerCreate": "创建云电脑",
|
|
665
737
|
"computerCreating": "创建中…约 15 秒",
|
|
666
738
|
"computerCreated": "已创建 · {name}",
|
|
667
739
|
"computerCreateFailed": "创建云电脑失败:{message}",
|
|
668
740
|
"computerCost": "会在你的 Rayrun 账号上创建一台计费机器。Bots 永不销毁它。",
|
|
669
741
|
"botTitle": "第一个 Bot",
|
|
670
|
-
"botBody": "
|
|
742
|
+
"botBody": "给它一个名字和一项职责。它会保存到本地名册,并在你的云电脑上运行。",
|
|
743
|
+
"open": "首次设置",
|
|
744
|
+
"imageUnsupported": "这个镜像的 oneshot 是 shell 命令,不会启动 DSH worker。请使用 deepseek-harness@1 或其他会启动 DSH headless 的镜像。"
|
|
671
745
|
},
|
|
672
746
|
"settings": {
|
|
673
747
|
"title": "设置",
|
|
674
748
|
"sub": "账号、用量,以及这个插件自己的少量设置。",
|
|
675
749
|
"account": "账号",
|
|
676
750
|
"usage": "用量",
|
|
677
|
-
"notifications": "通知",
|
|
678
751
|
"appearance": "外观",
|
|
679
752
|
"rayrunAccount": "Rayrun 账号",
|
|
680
753
|
"rayrunHint": "token 存在 DSH 凭证库 · 只在 Host 侧",
|
|
@@ -688,7 +761,7 @@ window.__ModuleLoader__.load({
|
|
|
688
761
|
"hostDepVersion": "云电脑插件 {version} 不受支持(需要 {required})。",
|
|
689
762
|
"retry": "重试",
|
|
690
763
|
"plugin": "云电脑插件",
|
|
691
|
-
"pluginHint": "dsh-rayrun-computer
|
|
764
|
+
"pluginHint": "dsh-rayrun-computer v{version}",
|
|
692
765
|
"pluginOk": "正常",
|
|
693
766
|
"pluginMissing": "缺失",
|
|
694
767
|
"pluginIncompatible": "不兼容",
|
|
@@ -697,19 +770,39 @@ window.__ModuleLoader__.load({
|
|
|
697
770
|
"usageLine": "余额 {balance} · {hours} 机时 · {machines} 台云电脑",
|
|
698
771
|
"usageConnect": "连接 Rayrun 后显示用量。",
|
|
699
772
|
"usageFailed": "读取用量失败:{message}",
|
|
700
|
-
"idle": "空闲停机",
|
|
701
|
-
"idleHint": "空闲时停止电脑,绝不销毁。",
|
|
702
|
-
"idle15": "15 分钟",
|
|
703
|
-
"idle30": "30 分钟",
|
|
704
|
-
"idleOff": "关闭",
|
|
705
773
|
"lowBalance": "低余额提醒",
|
|
706
774
|
"lowBalanceHint": "余额低于该值时显示提示。",
|
|
707
|
-
"notify": "通知",
|
|
708
|
-
"notifyHint": "Bot 完成或等你处理时通知。",
|
|
709
775
|
"language": "语言",
|
|
710
776
|
"languageHint": "以简体中文为主,可切换 English。",
|
|
711
777
|
"langEn": "English",
|
|
712
|
-
"langZh": "简体中文"
|
|
778
|
+
"langZh": "简体中文",
|
|
779
|
+
"updates": "更新",
|
|
780
|
+
"updatesHint": "从 npm registry 检查更新的 dsh-rayrun-bots 构建。不会下载或安装,也不会发送 token。",
|
|
781
|
+
"checkUpdates": "检查更新",
|
|
782
|
+
"checkingUpdates": "正在检查 npm…",
|
|
783
|
+
"updateAvailable": "有新版本 {latest}(当前 {current})。",
|
|
784
|
+
"upToDate": "已是最新的 {channel} 构建(v{current})。",
|
|
785
|
+
"updateCheckFailed": "无法检查 npm:{message}",
|
|
786
|
+
"updateCommandHint": "在终端执行下面的命令,然后重启 DSH;云电脑插件保持已安装:",
|
|
787
|
+
"copyUpdateCommand": "复制命令",
|
|
788
|
+
"updateCopied": "命令已复制",
|
|
789
|
+
"updateCopyFailed": "复制失败,请手动选中命令。",
|
|
790
|
+
"updateRestart": "这里只做提示;页面不会自动下载或安装。",
|
|
791
|
+
"computer": "Bot 的电脑",
|
|
792
|
+
"computerHint": "更新你的 Bot 共用的电脑。你的文件和登录信息会保留,但已安装的应用和软件包会被移除;更新成功后,旧电脑及其 workspace 会被销毁。所有 Bot 会一起更新。",
|
|
793
|
+
"computerCurrent": "当前 · {name} · {image}",
|
|
794
|
+
"computerUpdate": "更新",
|
|
795
|
+
"computerUpdateHint": "创建一台新电脑并复制保留的路径。更新成功后,旧电脑及其 workspace 会被销毁(不可恢复)。",
|
|
796
|
+
"computerTarget": "新镜像:{image}。会自动沿用这台电脑已绑定的 DeepSeek 凭据,或使用账号里的模型凭据。",
|
|
797
|
+
"computerNoMachine": "没有找到云电脑。",
|
|
798
|
+
"computerNotConnected": "连接 Rayrun 后才能管理 Bot 的电脑。",
|
|
799
|
+
"computerBillable": "这会在你的 Rayrun 账号上创建一台计费电脑。更新成功后旧电脑会被销毁,无法恢复。",
|
|
800
|
+
"computerConfirm": "更新电脑(计费)",
|
|
801
|
+
"computerCancel": "取消",
|
|
802
|
+
"computerUpdating": "正在更新… 正在创建新电脑并复制数据。请不要关闭页面。",
|
|
803
|
+
"computerUpdated": "电脑已更新到 {image}。旧电脑 {name} 已销毁。",
|
|
804
|
+
"computerUpdateFailed": "更新电脑失败:{message}",
|
|
805
|
+
"computerUpdatedKept": "电脑已更新到 {image}。旧电脑 {name} 未能销毁,已停止;请手动清理。"
|
|
713
806
|
},
|
|
714
807
|
"sample": {
|
|
715
808
|
"user": {
|
|
@@ -785,15 +878,25 @@ window.__ModuleLoader__.load({
|
|
|
785
878
|
"error": {
|
|
786
879
|
"hostDown": "Bot host 没有响应。",
|
|
787
880
|
"botCreate": "无法保存 Bot:{message}"
|
|
881
|
+
},
|
|
882
|
+
"user": {
|
|
883
|
+
"you": "你",
|
|
884
|
+
"youInitials": "你"
|
|
788
885
|
}
|
|
789
886
|
}
|
|
790
887
|
|
|
791
888
|
const PANEL_ID = 'rayrun-bots'
|
|
792
889
|
const SAMPLE_COMPUTER = 'dsh-workspace'
|
|
793
890
|
const DEFAULT_COMPUTER = 'rayrun-bot'
|
|
891
|
+
const DETACHED_IMAGE = 'deepseek-harness@1'
|
|
892
|
+
const CLOUD_HOST_IMAGE = 'dsh-bot@1'
|
|
893
|
+
const SHELL_ONESHOT_IMAGES = new Set(['dsh-bot@1', 'dsh-bot-devcheck@1'])
|
|
794
894
|
const SESSION_POLL_MS = 1000
|
|
795
895
|
const SESSION_POLL_LIMIT_MS = 16 * 60 * 1000
|
|
896
|
+
const APPROVAL_PARSE_ERROR = '[[rayrun-approval-parse-error]]'
|
|
796
897
|
const pickMachine = (machines) => machines.find((item) => item.name === DEFAULT_COMPUTER)
|
|
898
|
+
|| machines.find((item) => item.status === 'Running' && item.remote_desktop && item.desktop_url)
|
|
899
|
+
|| machines.find((item) => item.status === 'Running')
|
|
797
900
|
|| machines.find((item) => item.remote_desktop && item.desktop_url)
|
|
798
901
|
|| machines[0]
|
|
799
902
|
const machineStatus = (status) => status === 'Running' ? 'live'
|
|
@@ -850,6 +953,8 @@ window.__ModuleLoader__.load({
|
|
|
850
953
|
.rb-list-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; gap: 8px; }
|
|
851
954
|
.rb-brand { display: flex; align-items: center; gap: 8px; color: #0e2050; font-weight: 650; font-size: 13px; min-width: 0; }
|
|
852
955
|
.rb-preview-pill { padding: 1px 7px; border: 1px solid #d8e3f5; border-radius: 999px; background: #eef4ff; color: #1d4ed8; font-size: 10.5px; font-weight: 600; line-height: 1.7; letter-spacing: .02em; }
|
|
956
|
+
.rb-demo-banner { margin: 0 10px 8px; padding: 7px 10px; border: 1px solid #f1d9b5; border-radius: 8px; background: #fff8ec; color: #92400e; font-size: 11.5px; line-height: 1.45; }
|
|
957
|
+
.rb-sample-chip { padding: 0 5px; border: 1px solid #d8e3f5; border-radius: 999px; background: #eef4ff; color: #1d4ed8; font-size: 9.5px; font-weight: 600; line-height: 1.6; letter-spacing: .02em; }
|
|
853
958
|
.rb-mark { flex: none; }
|
|
854
959
|
.rb-tools { display: flex; gap: 4px; }
|
|
855
960
|
.rb-icon { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: #5b6472; display: grid; place-items: center; padding: 0; }
|
|
@@ -885,7 +990,7 @@ window.__ModuleLoader__.load({
|
|
|
885
990
|
.rb-frame button.rb-textbtn.rb-textbtn-low { color: #b45309; }
|
|
886
991
|
.rb-textbtn .rb-dot { margin-right: 4px; vertical-align: middle; }
|
|
887
992
|
.rb-empty-list { color: #8a93a3; font-size: 12px; padding: 8px 10px; }
|
|
888
|
-
.rb-firstrun { padding: 10px; }
|
|
993
|
+
.rb-firstrun { padding: 10px; display: grid; gap: 8px; }
|
|
889
994
|
.rb-main { background: #fff; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
|
|
890
995
|
.rb-thread { flex: 1; overflow: auto; padding: 26px 34px 12px; display: flex; flex-direction: column; gap: 20px; }
|
|
891
996
|
.rb-thread > * { max-width: 760px; width: 100%; align-self: center; }
|
|
@@ -1012,6 +1117,21 @@ window.__ModuleLoader__.load({
|
|
|
1012
1117
|
.rb-srow .rb-l { display: grid; gap: 1px; font-size: 13px; }
|
|
1013
1118
|
.rb-srow .rb-l small { color: #8a93a3; font-size: 11px; }
|
|
1014
1119
|
.rb-srow select, .rb-srow input { background: #fff; border: 1px solid #e4e8f0; border-radius: 8px; color: #0f172a; font-size: 12.5px; padding: 5px 8px; }
|
|
1120
|
+
.rb-update-row { align-items: flex-start; }
|
|
1121
|
+
.rb-computer-card { display: grid; gap: 8px; margin: 14px 0; padding: 14px 16px; border: 1px solid #e4e8f0; border-radius: 12px; background: #fff; }
|
|
1122
|
+
.rb-computer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
|
1123
|
+
.rb-computer-title { color: #0e2050; font-size: 13px; font-weight: 650; }
|
|
1124
|
+
.rb-computer-desc { max-width: 560px; margin-top: 3px; color: #5b6472; font-size: 11.5px; line-height: 1.5; }
|
|
1125
|
+
.rb-computer-meta { color: #8a93a3; font-size: 11px; }
|
|
1126
|
+
.rb-computer-error { color: #b42318; }
|
|
1127
|
+
.rb-computer-form { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid #eef1f6; }
|
|
1128
|
+
.rb-computer-form .rb-line { flex-wrap: wrap; }
|
|
1129
|
+
.rb-computer-form select { max-width: 100%; padding: 5px 8px; border: 1px solid #e4e8f0; border-radius: 8px; background: #fff; color: #0f172a; font-size: 12.5px; }
|
|
1130
|
+
.rb-update-col { display: grid; gap: 6px; justify-items: end; min-width: 0; max-width: 60%; }
|
|
1131
|
+
.rb-update-msg { display: grid; gap: 4px; justify-items: end; color: #5b6472; font-size: 11.5px; text-align: right; }
|
|
1132
|
+
.rb-update-error { color: #b42318; }
|
|
1133
|
+
.rb-update-cmd { max-width: 100%; padding: 7px 9px; border: 1px solid #e4e8f0; border-radius: 8px; background: #f7f9fc; }
|
|
1134
|
+
.rb-update-cmd code { display: block; white-space: pre-wrap; word-break: break-all; user-select: all; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10.5px; color: #0e2050; }
|
|
1015
1135
|
.rb-status { display: flex; align-items: center; gap: 6px; color: #5b6472; font-size: 11.5px; border: 0; background: transparent; padding: 0; }
|
|
1016
1136
|
.rb-status .rb-retry { padding: 2px 8px; font-size: 11px; }
|
|
1017
1137
|
.rb-center-empty { margin: auto; max-width: 420px; text-align: center; display: grid; gap: 8px; justify-items: center; padding: 48px 24px; }
|
|
@@ -1024,6 +1144,7 @@ window.__ModuleLoader__.load({
|
|
|
1024
1144
|
.rb-thread-welcome .rb-thread-empty { padding: 0; }
|
|
1025
1145
|
.rb-working-row { display: flex; align-items: center; gap: 8px; color: #5b6472; font-size: 13px; }
|
|
1026
1146
|
.rb-error-row { max-width: 760px; width: 100%; align-self: center; display: grid; gap: 3px; margin: 2px 0; padding: 9px 12px; border: 1px solid #f3d1d1; border-radius: 10px; background: #fff5f5; color: #9b1c1c; font-size: 12.5px; }
|
|
1147
|
+
.rb-error-detail { font-size: 11px; opacity: .85; overflow-wrap: anywhere; }
|
|
1027
1148
|
.rb-error-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10.5px; opacity: .75; }
|
|
1028
1149
|
.rb-error-text { line-height: 1.5; }
|
|
1029
1150
|
.rb-mini { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #eef1f6; }
|
|
@@ -1138,12 +1259,13 @@ window.__ModuleLoader__.load({
|
|
|
1138
1259
|
}
|
|
1139
1260
|
|
|
1140
1261
|
/** Map one host roster entry to the client's bot shape; its session comes from the host. */
|
|
1141
|
-
function realBot(bot, routines = []) {
|
|
1262
|
+
function realBot(bot, routines = [], computer = null) {
|
|
1142
1263
|
return {
|
|
1143
1264
|
id: bot.id,
|
|
1144
1265
|
name: bot.name,
|
|
1145
1266
|
job: bot.label,
|
|
1146
1267
|
source: 'real',
|
|
1268
|
+
computer,
|
|
1147
1269
|
attention: null,
|
|
1148
1270
|
time: '',
|
|
1149
1271
|
snippetKey: 'empty.snippet',
|
|
@@ -1191,6 +1313,7 @@ window.__ModuleLoader__.load({
|
|
|
1191
1313
|
origin: approval.origin,
|
|
1192
1314
|
target: machine,
|
|
1193
1315
|
risk: Array.isArray(approval.risk) ? approval.risk : [],
|
|
1316
|
+
kind: typeof kind === 'string' ? kind : null,
|
|
1194
1317
|
execution,
|
|
1195
1318
|
...(expiresMin === undefined ? {} : { expiresMin }),
|
|
1196
1319
|
}
|
|
@@ -1252,7 +1375,10 @@ window.__ModuleLoader__.load({
|
|
|
1252
1375
|
E_DEP_MISSING: 'chat.runtimeUnavailable',
|
|
1253
1376
|
E_RUNTIME_UNAVAILABLE: 'chat.runtimeUnavailable',
|
|
1254
1377
|
E_TOKEN_REQUIRED: 'chat.connectRayrun',
|
|
1255
|
-
E_MACHINE_STOPPED: 'chat.
|
|
1378
|
+
E_MACHINE_STOPPED: 'chat.machineStopped',
|
|
1379
|
+
E_IMAGE_UNSUPPORTED: 'chat.imageUnsupported',
|
|
1380
|
+
E_GUESTD_OUTDATED: 'chat.imageOutdated',
|
|
1381
|
+
E_WORKER_NO_REPLY: 'chat.workerNoReply',
|
|
1256
1382
|
E_MACHINE_BUSY: 'chat.machineBusy',
|
|
1257
1383
|
E_BALANCE_LOW: 'chat.balanceLow',
|
|
1258
1384
|
E_QUEUE_FULL: 'chat.queueFull',
|
|
@@ -1280,13 +1406,24 @@ window.__ModuleLoader__.load({
|
|
|
1280
1406
|
if (message.role === 'user') {
|
|
1281
1407
|
return { ...entry, kind: 'user', ...(message.origin === 'routine' ? { origin: 'routine' } : {}) }
|
|
1282
1408
|
}
|
|
1283
|
-
if (message.role === 'bot')
|
|
1284
|
-
|
|
1409
|
+
if (message.role === 'bot') {
|
|
1410
|
+
const marker = typeof message.text === 'string' ? message.text.indexOf(APPROVAL_PARSE_ERROR) : -1
|
|
1411
|
+
if (marker !== -1) {
|
|
1412
|
+
const text = message.text.slice(0, marker).trim()
|
|
1413
|
+
return { ...entry, kind: 'bot', text: text ? `${text}\n\n${t('approval.parseError')}` : t('approval.parseError') }
|
|
1414
|
+
}
|
|
1415
|
+
return { ...entry, kind: 'bot' }
|
|
1416
|
+
}
|
|
1417
|
+
const error = {
|
|
1285
1418
|
...entry,
|
|
1286
1419
|
kind: 'error',
|
|
1287
1420
|
code: message.code || 'E_INTERNAL',
|
|
1288
1421
|
text: sessionErrorText(t, message.code, message.text),
|
|
1289
1422
|
}
|
|
1423
|
+
if (message.code === 'E_WORKER_NO_REPLY' && typeof message.text === 'string' && message.text.trim()) {
|
|
1424
|
+
error.detail = message.text
|
|
1425
|
+
}
|
|
1426
|
+
return error
|
|
1290
1427
|
}
|
|
1291
1428
|
|
|
1292
1429
|
function snippetOf(text) {
|
|
@@ -1319,6 +1456,7 @@ window.__ModuleLoader__.load({
|
|
|
1319
1456
|
return {
|
|
1320
1457
|
...bot,
|
|
1321
1458
|
session,
|
|
1459
|
+
computer: session?.computer ?? bot.computer,
|
|
1322
1460
|
sessionCursor: Number.isInteger(session?.lastSeq) ? session.lastSeq : bot.sessionCursor,
|
|
1323
1461
|
historyLoaded: true,
|
|
1324
1462
|
working: sessionWorking(session),
|
|
@@ -1525,10 +1663,27 @@ window.__ModuleLoader__.load({
|
|
|
1525
1663
|
]
|
|
1526
1664
|
}
|
|
1527
1665
|
|
|
1666
|
+
function demoBots() {
|
|
1667
|
+
return seedBots().map((bot) => ({
|
|
1668
|
+
...bot,
|
|
1669
|
+
sample: true,
|
|
1670
|
+
attention: null,
|
|
1671
|
+
snippet: undefined,
|
|
1672
|
+
snippetKey: 'preview.demoSnippet',
|
|
1673
|
+
time: '',
|
|
1674
|
+
timeKey: undefined,
|
|
1675
|
+
approvals: {},
|
|
1676
|
+
receipts: [],
|
|
1677
|
+
routines: [],
|
|
1678
|
+
messages: bot.messages.filter((entry) => entry.kind !== 'approval' && entry.kind !== 'computer'),
|
|
1679
|
+
}))
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1528
1682
|
function createState() {
|
|
1529
1683
|
return {
|
|
1530
1684
|
screen: 'chat',
|
|
1531
|
-
selectedId: 'nora',
|
|
1685
|
+
selectedId: DEMO_PREVIEW && !FIRST_RUN_PREVIEW ? 'nora' : null,
|
|
1686
|
+
demo: DEMO_PREVIEW && !FIRST_RUN_PREVIEW,
|
|
1532
1687
|
tab: 'activity',
|
|
1533
1688
|
computer: COMPUTER_PREVIEW,
|
|
1534
1689
|
realOverview: null,
|
|
@@ -1545,12 +1700,10 @@ window.__ModuleLoader__.load({
|
|
|
1545
1700
|
forceList: false,
|
|
1546
1701
|
forceDetail: false,
|
|
1547
1702
|
settings: {
|
|
1548
|
-
idle: '15',
|
|
1549
1703
|
lowBalance: '10',
|
|
1550
|
-
notifications: true,
|
|
1551
1704
|
lang: null,
|
|
1552
1705
|
},
|
|
1553
|
-
bots: FIRST_RUN_PREVIEW ? [] :
|
|
1706
|
+
bots: FIRST_RUN_PREVIEW ? [] : DEMO_PREVIEW ? demoBots() : [],
|
|
1554
1707
|
}
|
|
1555
1708
|
}
|
|
1556
1709
|
|
|
@@ -1799,12 +1952,6 @@ window.__ModuleLoader__.load({
|
|
|
1799
1952
|
)
|
|
1800
1953
|
}
|
|
1801
1954
|
|
|
1802
|
-
function idleLabel(t, idle) {
|
|
1803
|
-
if (idle === '30') return t('settings.idle30')
|
|
1804
|
-
if (idle === '0') return t('settings.idleOff')
|
|
1805
|
-
return t('settings.idle15')
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
1955
|
function BotsApp({ ctx }) {
|
|
1809
1956
|
const [state, setState] = useState(createState)
|
|
1810
1957
|
const [host, setHost] = useState({ status: 'checking' })
|
|
@@ -1885,7 +2032,13 @@ window.__ModuleLoader__.load({
|
|
|
1885
2032
|
if (!response.ok) throw new Error(`health ${response.status}`)
|
|
1886
2033
|
const body = await response.json()
|
|
1887
2034
|
if (!body || body.ok !== true || body.plugin !== 'rayrun-bots') throw new Error('bad health envelope')
|
|
1888
|
-
setHost({
|
|
2035
|
+
setHost({
|
|
2036
|
+
status: 'loaded',
|
|
2037
|
+
version: String(body.version ?? ''),
|
|
2038
|
+
ready: body.ready === true,
|
|
2039
|
+
dependency: body.dependency ?? null,
|
|
2040
|
+
runtime: body.runtime ?? null,
|
|
2041
|
+
})
|
|
1889
2042
|
} catch (error) {
|
|
1890
2043
|
if (error?.name === 'AbortError') return
|
|
1891
2044
|
setHost({ status: 'down' })
|
|
@@ -1902,13 +2055,15 @@ window.__ModuleLoader__.load({
|
|
|
1902
2055
|
try {
|
|
1903
2056
|
const body = await hostRpc('bots.list')
|
|
1904
2057
|
const bots = Array.isArray(body.bots) ? body.bots : []
|
|
1905
|
-
if (cancelled
|
|
2058
|
+
if (cancelled) return
|
|
1906
2059
|
setState((current) => {
|
|
1907
|
-
|
|
2060
|
+
if (DEMO_PREVIEW) return current
|
|
2061
|
+
if (bots.length === 0) return { ...current, bots: [], selectedId: null, demo: false }
|
|
2062
|
+
const roster = bots.map((bot) => realBot(bot, body.routines?.[bot.id], body.computers?.[bot.id]))
|
|
1908
2063
|
const selectedId = roster.some((bot) => bot.id === current.selectedId)
|
|
1909
2064
|
? current.selectedId
|
|
1910
2065
|
: roster[0].id
|
|
1911
|
-
return { ...current, bots: roster, selectedId }
|
|
2066
|
+
return { ...current, bots: roster, selectedId, demo: false }
|
|
1912
2067
|
})
|
|
1913
2068
|
} catch {
|
|
1914
2069
|
// Keep the preview; the Settings host row reports the failure.
|
|
@@ -1942,6 +2097,7 @@ window.__ModuleLoader__.load({
|
|
|
1942
2097
|
}
|
|
1943
2098
|
}, [state.screen])
|
|
1944
2099
|
|
|
2100
|
+
const cloudHost = host.runtime?.name === 'rayrun-cloud-host'
|
|
1945
2101
|
const realConfigured = state.realOverview?.connection?.configured === true
|
|
1946
2102
|
const realBalanceCents = Number(state.realOverview?.balance?.balance_cents)
|
|
1947
2103
|
const realBalance = Number.isFinite(realBalanceCents) ? realBalanceCents / 100 : NaN
|
|
@@ -1981,7 +2137,7 @@ window.__ModuleLoader__.load({
|
|
|
1981
2137
|
const tick = async () => {
|
|
1982
2138
|
if (record.cancelled) return
|
|
1983
2139
|
if (Date.now() - record.startedAt > SESSION_POLL_LIMIT_MS) {
|
|
1984
|
-
updateBot(botId, (bot) => appendSessionError(bot, t('chat.turnTimeout'), '
|
|
2140
|
+
updateBot(botId, (bot) => appendSessionError(bot, t('chat.turnTimeout'), 'E_TURN_POLL_TIMEOUT'))
|
|
1985
2141
|
setState((current) => ({ ...current, live: t('chat.turnTimeout') }))
|
|
1986
2142
|
stop()
|
|
1987
2143
|
return
|
|
@@ -2294,26 +2450,49 @@ window.__ModuleLoader__.load({
|
|
|
2294
2450
|
}
|
|
2295
2451
|
}
|
|
2296
2452
|
|
|
2453
|
+
const machineIn = (machines, bot) => {
|
|
2454
|
+
const name = bot?.computer
|
|
2455
|
+
if (!name) return null
|
|
2456
|
+
return machines.find((item) => item.name === name || item.id === name) ?? null
|
|
2457
|
+
}
|
|
2458
|
+
const machineFor = (bot) => machineIn(
|
|
2459
|
+
Array.isArray(state.realOverview?.machines) ? state.realOverview.machines : [],
|
|
2460
|
+
bot,
|
|
2461
|
+
)
|
|
2462
|
+
|
|
2463
|
+
const desktopLink = (value) => {
|
|
2464
|
+
try {
|
|
2465
|
+
const url = new URL(String(value ?? ''))
|
|
2466
|
+
return url.protocol === 'https:' || url.protocol === 'http:' ? url.href : ''
|
|
2467
|
+
} catch {
|
|
2468
|
+
return ''
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2297
2472
|
const openComputer = async () => {
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2473
|
+
let win = null
|
|
2474
|
+
try {
|
|
2475
|
+
win = window.open('', '_blank')
|
|
2476
|
+
} catch {
|
|
2477
|
+
win = null
|
|
2478
|
+
}
|
|
2479
|
+
if (win) win.opener = null
|
|
2480
|
+
const closeWindow = () => {
|
|
2481
|
+
if (win && !win.closed) win.close()
|
|
2302
2482
|
}
|
|
2303
|
-
win.opener = null
|
|
2304
2483
|
try {
|
|
2305
2484
|
const overview = await rayRpc('overview')
|
|
2306
2485
|
if (overview.connection?.configured !== true) {
|
|
2307
|
-
|
|
2486
|
+
closeWindow()
|
|
2308
2487
|
flash(t('computer.connectFirst'))
|
|
2309
2488
|
return
|
|
2310
2489
|
}
|
|
2311
2490
|
const machines = Array.isArray(overview.machines) ? overview.machines : []
|
|
2312
|
-
const selectedMachine =
|
|
2491
|
+
const selectedMachine = machineIn(machines, selected)
|
|
2313
2492
|
patch({ realOverview: overview, realMachine: selectedMachine || null, realError: '' })
|
|
2314
2493
|
let machine = selectedMachine
|
|
2315
2494
|
if (!machine) {
|
|
2316
|
-
|
|
2495
|
+
closeWindow()
|
|
2317
2496
|
flash(t('computer.noMachine'))
|
|
2318
2497
|
return
|
|
2319
2498
|
}
|
|
@@ -2330,25 +2509,27 @@ window.__ModuleLoader__.load({
|
|
|
2330
2509
|
}
|
|
2331
2510
|
}
|
|
2332
2511
|
if (machine?.status !== 'Running') {
|
|
2333
|
-
|
|
2512
|
+
closeWindow()
|
|
2334
2513
|
flash(t('computer.startTimeout'))
|
|
2335
2514
|
return
|
|
2336
2515
|
}
|
|
2337
2516
|
patch({ realMachine: machine })
|
|
2338
2517
|
await rayRpc('machine.desktopRepair', { id: machine.id }).catch(() => {})
|
|
2339
|
-
|
|
2340
|
-
|
|
2518
|
+
const url = desktopLink(machine.desktop_url)
|
|
2519
|
+
if (!url) {
|
|
2520
|
+
closeWindow()
|
|
2341
2521
|
flash(t('computer.noDesktop'))
|
|
2342
2522
|
return
|
|
2343
2523
|
}
|
|
2344
2524
|
const password = await rayRpc('machine.password', { id: machine.id })
|
|
2345
2525
|
const result = password.result ?? {}
|
|
2346
2526
|
const secret = [result.stdout, result.stderr].filter(Boolean).join('\n').trim()
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2527
|
+
const opened = Boolean(win) && !win.closed
|
|
2528
|
+
if (opened) win.location = url
|
|
2529
|
+
setDesktop({ url, password: secret, copied: false, blocked: !opened })
|
|
2530
|
+
flash(opened ? t('computer.opened') : t('computer.popupBlocked'))
|
|
2350
2531
|
} catch (error) {
|
|
2351
|
-
|
|
2532
|
+
closeWindow()
|
|
2352
2533
|
const detail = String(error?.message ?? error)
|
|
2353
2534
|
flash(/token_required|unauthorized/i.test(detail)
|
|
2354
2535
|
? t('computer.connectFirst')
|
|
@@ -2357,7 +2538,7 @@ window.__ModuleLoader__.load({
|
|
|
2357
2538
|
}
|
|
2358
2539
|
|
|
2359
2540
|
const stopComputer = async () => {
|
|
2360
|
-
const machine =
|
|
2541
|
+
const machine = machineFor(selected)
|
|
2361
2542
|
if (!machine?.id) {
|
|
2362
2543
|
flash(t('computer.noMachineShort'))
|
|
2363
2544
|
return
|
|
@@ -2411,6 +2592,8 @@ window.__ModuleLoader__.load({
|
|
|
2411
2592
|
onContinue: () => send(t('approval.continuePrompt')),
|
|
2412
2593
|
onView: () => flash(t('computer.desktopLater')),
|
|
2413
2594
|
onAttach: () => flash(t('notice.attach')),
|
|
2595
|
+
machine: machineFor(selected),
|
|
2596
|
+
onStop: stopComputer,
|
|
2414
2597
|
onCreate: createBot,
|
|
2415
2598
|
onScreen: openScreen,
|
|
2416
2599
|
onSetupStep: (setupStep) => patch({ setupStep }),
|
|
@@ -2446,7 +2629,7 @@ window.__ModuleLoader__.load({
|
|
|
2446
2629
|
'div',
|
|
2447
2630
|
{ className: 'rb-frame', ref: frameRef, id: 'rayrun-bots-root' },
|
|
2448
2631
|
h('style', null, CSS),
|
|
2449
|
-
h('p', { className: 'rb-sr' }, t('notice.preview')),
|
|
2632
|
+
h('p', { className: 'rb-sr' }, state.demo ? t('notice.preview') : t('notice.cloud')),
|
|
2450
2633
|
h('div', { className: 'rb-sr', 'aria-live': 'polite' }, state.live),
|
|
2451
2634
|
h(
|
|
2452
2635
|
'div',
|
|
@@ -2477,13 +2660,13 @@ window.__ModuleLoader__.load({
|
|
|
2477
2660
|
tab: state.tab,
|
|
2478
2661
|
onTab: (tab) => patch({ tab }),
|
|
2479
2662
|
computer: state.computer,
|
|
2480
|
-
|
|
2663
|
+
cloudHost,
|
|
2664
|
+
machine: machineFor(selected),
|
|
2481
2665
|
configured: realConfigured,
|
|
2482
2666
|
overview: state.realOverview,
|
|
2483
2667
|
usageError: state.realError,
|
|
2484
2668
|
usagePreview: LOW_BALANCE_PREVIEW,
|
|
2485
2669
|
low,
|
|
2486
|
-
idle: idleLabel(t, state.settings.idle),
|
|
2487
2670
|
onToggleRoutine: (index) => toggleRoutine(selected, index),
|
|
2488
2671
|
onCreateRoutine: (draft) => createRoutine(selected, draft),
|
|
2489
2672
|
onRemoveRoutine: (index) => removeRoutine(selected, index),
|
|
@@ -2495,11 +2678,18 @@ window.__ModuleLoader__.load({
|
|
|
2495
2678
|
'div',
|
|
2496
2679
|
{ className: 'rb-desktop-toast', role: 'status' },
|
|
2497
2680
|
h('h3', null, t('computer.passwordTitle')),
|
|
2498
|
-
h('p', null, t('computer.passwordBody')),
|
|
2681
|
+
h('p', null, desktop.blocked ? t('computer.popupBlocked') : t('computer.passwordBody')),
|
|
2499
2682
|
h('code', null, desktop.password || t('computer.passwordEmpty')),
|
|
2500
2683
|
h(
|
|
2501
2684
|
'div',
|
|
2502
2685
|
{ className: 'rb-line' },
|
|
2686
|
+
desktop.url ? h('a', {
|
|
2687
|
+
className: 'rb-btn',
|
|
2688
|
+
href: desktop.url,
|
|
2689
|
+
target: '_blank',
|
|
2690
|
+
rel: 'noopener noreferrer',
|
|
2691
|
+
style: { textDecoration: 'none' },
|
|
2692
|
+
}, t('computer.openDesktop')) : null,
|
|
2503
2693
|
h('button', {
|
|
2504
2694
|
type: 'button',
|
|
2505
2695
|
className: 'rb-btn',
|
|
@@ -2520,14 +2710,16 @@ window.__ModuleLoader__.load({
|
|
|
2520
2710
|
}
|
|
2521
2711
|
|
|
2522
2712
|
function ChatList({ t, state, rows, selected, searchRef, low, connected, balance, onSearchToggle, onSearch, onSelect, onNew, onSettings, onSetup }) {
|
|
2523
|
-
const userName = t('sample.user.name')
|
|
2713
|
+
const userName = state.demo ? t('sample.user.name') : t('user.you')
|
|
2714
|
+
const userInitials = state.demo ? t('sample.user.initials') : t('user.youInitials')
|
|
2715
|
+
const setupLabel = !connected || state.bots.length === 0 ? t('setup.open') : t('sample.user.foot', { balance })
|
|
2524
2716
|
return h(
|
|
2525
2717
|
'aside',
|
|
2526
2718
|
{ className: 'rb-list', 'aria-label': t('panel.label') },
|
|
2527
2719
|
h(
|
|
2528
2720
|
'div',
|
|
2529
2721
|
{ className: 'rb-list-top' },
|
|
2530
|
-
h('div', { className: 'rb-brand' }, h(Mark), h('span', null, t('brand')), h('span', { className: 'rb-preview-pill' }, t('preview.
|
|
2722
|
+
h('div', { className: 'rb-brand' }, h(Mark), h('span', null, t('brand')), state.demo ? h('span', { className: 'rb-preview-pill' }, t('preview.demoBadge')) : null),
|
|
2531
2723
|
h(
|
|
2532
2724
|
'div',
|
|
2533
2725
|
{ className: 'rb-tools' },
|
|
@@ -2535,6 +2727,7 @@ window.__ModuleLoader__.load({
|
|
|
2535
2727
|
h('button', { type: 'button', className: 'rb-icon', title: t('list.newBot'), 'aria-label': t('list.newBot'), onClick: onNew }, '+'),
|
|
2536
2728
|
),
|
|
2537
2729
|
),
|
|
2730
|
+
state.demo ? h('div', { className: 'rb-demo-banner', role: 'status' }, t('preview.demoBanner')) : null,
|
|
2538
2731
|
state.searchOpen ? h(
|
|
2539
2732
|
'div',
|
|
2540
2733
|
{ className: 'rb-search' },
|
|
@@ -2550,7 +2743,7 @@ window.__ModuleLoader__.load({
|
|
|
2550
2743
|
'div',
|
|
2551
2744
|
{ className: 'rb-current' },
|
|
2552
2745
|
h(Avatar, { size: 'big', name: botName(selected, t) }),
|
|
2553
|
-
h('div', { className: 'rb-name' }, botName(selected, t)),
|
|
2746
|
+
h('div', { className: 'rb-name' }, botName(selected, t), state.demo ? h('span', { className: 'rb-sample-chip' }, t('preview.sample')) : null),
|
|
2554
2747
|
h('div', { className: 'rb-label' }, attentionText(selected, t) ? `${botJob(selected, t)} · ${attentionText(selected, t)}` : botJob(selected, t)),
|
|
2555
2748
|
) : h(
|
|
2556
2749
|
'div',
|
|
@@ -2582,6 +2775,7 @@ window.__ModuleLoader__.load({
|
|
|
2582
2775
|
'div',
|
|
2583
2776
|
{ className: 'rb-nm' },
|
|
2584
2777
|
name,
|
|
2778
|
+
bot.sample ? h('span', { className: 'rb-sample-chip' }, t('preview.sample')) : null,
|
|
2585
2779
|
bot.attention ? h('span', { className: `rb-dot rb-${bot.attention}`, title: attention }) : null,
|
|
2586
2780
|
),
|
|
2587
2781
|
h('div', { className: 'rb-sn' }, snippet),
|
|
@@ -2593,6 +2787,7 @@ window.__ModuleLoader__.load({
|
|
|
2593
2787
|
'div',
|
|
2594
2788
|
{ className: 'rb-firstrun' },
|
|
2595
2789
|
h('button', { type: 'button', className: 'rb-btn rb-primary', onClick: onNew }, t('newBot.create')),
|
|
2790
|
+
h('button', { type: 'button', className: 'rb-btn rb-ghost', onClick: onSetup }, t('setup.open')),
|
|
2596
2791
|
)
|
|
2597
2792
|
: state.search.trim()
|
|
2598
2793
|
? h('div', { className: 'rb-empty-list' }, t('list.empty'))
|
|
@@ -2601,7 +2796,7 @@ window.__ModuleLoader__.load({
|
|
|
2601
2796
|
h(
|
|
2602
2797
|
'div',
|
|
2603
2798
|
{ className: 'rb-foot' },
|
|
2604
|
-
h(Avatar, { size: 'sm', name: userName, text:
|
|
2799
|
+
h(Avatar, { size: 'sm', name: userName, text: userInitials }),
|
|
2605
2800
|
h(
|
|
2606
2801
|
'div',
|
|
2607
2802
|
{ className: 'rb-who' },
|
|
@@ -2616,7 +2811,7 @@ window.__ModuleLoader__.load({
|
|
|
2616
2811
|
title: t('setup.title'),
|
|
2617
2812
|
},
|
|
2618
2813
|
low ? h('span', { className: 'rb-dot rb-needs', 'aria-hidden': 'true' }) : null,
|
|
2619
|
-
|
|
2814
|
+
setupLabel,
|
|
2620
2815
|
low ? h('span', { className: 'rb-sr' }, t('cost.lowShort')) : null),
|
|
2621
2816
|
),
|
|
2622
2817
|
),
|
|
@@ -2625,12 +2820,17 @@ window.__ModuleLoader__.load({
|
|
|
2625
2820
|
)
|
|
2626
2821
|
}
|
|
2627
2822
|
|
|
2628
|
-
function ApprovalCard({ t, approval, onDecide, onContinue }) {
|
|
2823
|
+
function ApprovalCard({ t, approval, machine, onStop, onDecide, onContinue }) {
|
|
2629
2824
|
const pending = approval.state === 'pending'
|
|
2630
2825
|
const expired = approval.state === 'expired'
|
|
2631
2826
|
const real = approval.real === true
|
|
2632
2827
|
const executionFailed = approval.state === 'execution-failed'
|
|
2633
2828
|
const waiting = approval.state === 'approved-waiting'
|
|
2829
|
+
const expiredRunning = expired && approval.origin === 'background' && machine?.status === 'Running'
|
|
2830
|
+
const [confirmStop, setConfirmStop] = useState(false)
|
|
2831
|
+
useEffect(() => {
|
|
2832
|
+
if (!expiredRunning) setConfirmStop(false)
|
|
2833
|
+
}, [expiredRunning])
|
|
2634
2834
|
const title = approval.title || fieldText(approval, t, 'titleKey')
|
|
2635
2835
|
const meta = approval.meta || fieldText(approval, t, 'metaKey')
|
|
2636
2836
|
const origin = approval.origin === 'background'
|
|
@@ -2639,6 +2839,17 @@ window.__ModuleLoader__.load({
|
|
|
2639
2839
|
? t('approval.originChat')
|
|
2640
2840
|
: ''
|
|
2641
2841
|
const target = approval.targetKey ? t(approval.targetKey) : approval.target || ''
|
|
2842
|
+
const actionRiskKey = !real
|
|
2843
|
+
? null
|
|
2844
|
+
: approval.kind === 'rayrun.machine.start'
|
|
2845
|
+
? 'approval.riskStart'
|
|
2846
|
+
: approval.kind === 'rayrun.machine.resume'
|
|
2847
|
+
? 'approval.riskResume'
|
|
2848
|
+
: approval.kind === 'rayrun.machine.stop'
|
|
2849
|
+
? 'approval.riskStop'
|
|
2850
|
+
: approval.kind === 'rayrun.machine.pause'
|
|
2851
|
+
? 'approval.riskPause'
|
|
2852
|
+
: 'approval.riskUnknown'
|
|
2642
2853
|
const risks = Array.isArray(approval.risk)
|
|
2643
2854
|
? approval.risk
|
|
2644
2855
|
.map((risk) => risk === 'outside'
|
|
@@ -2648,7 +2859,7 @@ window.__ModuleLoader__.load({
|
|
|
2648
2859
|
: risk === 'cost' ? t('approval.riskCost') : null)
|
|
2649
2860
|
.filter(Boolean)
|
|
2650
2861
|
: []
|
|
2651
|
-
const riskLine = risks.length ? risks.join(' · ') : t('approval.warning')
|
|
2862
|
+
const riskLine = actionRiskKey ? t(actionRiskKey) : risks.length ? risks.join(' · ') : t('approval.warning')
|
|
2652
2863
|
let side = t('approval.waits')
|
|
2653
2864
|
if (pending && Number.isFinite(approval.expiresMin)) side = t('approval.expires', { n: approval.expiresMin })
|
|
2654
2865
|
if (approval.state === 'allowed') side = t(real ? 'approval.allowedSide' : 'approval.snippetAllowed')
|
|
@@ -2681,13 +2892,35 @@ window.__ModuleLoader__.load({
|
|
|
2681
2892
|
target ? h('span', { className: 'rb-chip rb-chip-target' }, target) : null,
|
|
2682
2893
|
) : null,
|
|
2683
2894
|
pending ? h('div', { className: 'rb-warnline' }, riskLine) : expired ? null : h('div', { className: 'rb-result' }, resultText),
|
|
2895
|
+
expiredRunning ? h(
|
|
2896
|
+
'div',
|
|
2897
|
+
{ className: 'rb-result' },
|
|
2898
|
+
t('approval.expiredRunning'),
|
|
2899
|
+
onStop ? h(
|
|
2900
|
+
'div',
|
|
2901
|
+
{ className: 'rb-line' },
|
|
2902
|
+
confirmStop ? h('span', null, t('approval.stopConfirm')) : null,
|
|
2903
|
+
h('button', {
|
|
2904
|
+
type: 'button',
|
|
2905
|
+
className: confirmStop ? 'rb-btn' : 'rb-btn rb-ghost',
|
|
2906
|
+
onClick: () => {
|
|
2907
|
+
if (!confirmStop) setConfirmStop(true)
|
|
2908
|
+
else {
|
|
2909
|
+
setConfirmStop(false)
|
|
2910
|
+
onStop()
|
|
2911
|
+
}
|
|
2912
|
+
},
|
|
2913
|
+
}, confirmStop ? t('approval.stopConfirmAction') : t('approval.stopComputer')),
|
|
2914
|
+
confirmStop ? h('button', { type: 'button', className: 'rb-btn rb-ghost', onClick: () => setConfirmStop(false) }, t('approval.cancel')) : null,
|
|
2915
|
+
) : null,
|
|
2916
|
+
) : null,
|
|
2684
2917
|
h('div', { className: 'rb-meta' }, meta),
|
|
2685
2918
|
pending ? h(
|
|
2686
2919
|
'div',
|
|
2687
2920
|
{ className: 'rb-actions' },
|
|
2688
2921
|
h('button', { type: 'button', className: 'rb-btn rb-ghost', onClick: () => onDecide(approval.id, 'denied') }, t('approval.deny')),
|
|
2689
2922
|
h('button', { type: 'button', className: 'rb-btn rb-primary', onClick: () => onDecide(approval.id, 'allowed') }, t('approval.allowOnce')),
|
|
2690
|
-
) : real &&
|
|
2923
|
+
) : real && (approval.state === 'allowed' || approval.state === 'denied' || approval.state === 'execution-failed') ? h(
|
|
2691
2924
|
'div',
|
|
2692
2925
|
{ className: 'rb-actions' },
|
|
2693
2926
|
h('button', { type: 'button', className: 'rb-btn rb-primary', onClick: () => onContinue(approval.id) }, t('approval.continue')),
|
|
@@ -2719,7 +2952,7 @@ window.__ModuleLoader__.load({
|
|
|
2719
2952
|
)
|
|
2720
2953
|
}
|
|
2721
2954
|
|
|
2722
|
-
function Conversation({ t, state, bot, composerRef, onComposer, onSend, onDecide, onContinue, onView, onAttach, showListButton, showDetailButton, onToggleList, onToggleDetail }) {
|
|
2955
|
+
function Conversation({ t, state, bot, composerRef, onComposer, onSend, onDecide, onContinue, onView, onAttach, machine, onStop, showListButton, showDetailButton, onToggleList, onToggleDetail }) {
|
|
2723
2956
|
const name = botName(bot, t)
|
|
2724
2957
|
const job = botJob(bot, t)
|
|
2725
2958
|
const threadRef = useRef(null)
|
|
@@ -2745,8 +2978,9 @@ window.__ModuleLoader__.load({
|
|
|
2745
2978
|
return h(
|
|
2746
2979
|
'div',
|
|
2747
2980
|
{ key: entry.id, className: 'rb-error-row', role: 'alert' },
|
|
2748
|
-
h('div', { className: 'rb-error-code' }, entry.code || t('chat.errorTitle')),
|
|
2749
2981
|
h('div', { className: 'rb-error-text' }, entry.text),
|
|
2982
|
+
entry.detail ? h('div', { className: 'rb-error-detail' }, entry.detail) : null,
|
|
2983
|
+
h('div', { className: 'rb-error-code' }, entry.code || t('chat.errorTitle')),
|
|
2750
2984
|
)
|
|
2751
2985
|
}
|
|
2752
2986
|
if (entry.kind === 'day') return h('div', { key: entry.id, className: 'rb-day' }, textOf(entry, t))
|
|
@@ -2774,7 +3008,7 @@ window.__ModuleLoader__.load({
|
|
|
2774
3008
|
if (entry.kind === 'approval') {
|
|
2775
3009
|
const approval = bot.approvals[entry.approvalId]
|
|
2776
3010
|
if (!approval) return null
|
|
2777
|
-
return h(ApprovalCard, { key: entry.id, t, approval, onDecide, onContinue })
|
|
3011
|
+
return h(ApprovalCard, { key: entry.id, t, approval, machine, onStop, onDecide, onContinue })
|
|
2778
3012
|
}
|
|
2779
3013
|
return h(
|
|
2780
3014
|
'div',
|
|
@@ -2829,7 +3063,7 @@ window.__ModuleLoader__.load({
|
|
|
2829
3063
|
)
|
|
2830
3064
|
}
|
|
2831
3065
|
|
|
2832
|
-
function Details({ t, catalog, bot, tab, onTab, computer, machine, configured, overview, usageError, usagePreview, low,
|
|
3066
|
+
function Details({ t, catalog, bot, tab, onTab, computer, cloudHost, machine, configured, overview, usageError, usagePreview, low, onToggleRoutine, onCreateRoutine, onRemoveRoutine, onComputer, onStop }) {
|
|
2833
3067
|
const name = botName(bot, t)
|
|
2834
3068
|
const job = botJob(bot, t)
|
|
2835
3069
|
const [routineOpen, setRoutineOpen] = useState(false)
|
|
@@ -2839,6 +3073,8 @@ window.__ModuleLoader__.load({
|
|
|
2839
3073
|
const [routineBusy, setRoutineBusy] = useState(false)
|
|
2840
3074
|
const [routineError, setRoutineError] = useState('')
|
|
2841
3075
|
const canEditRoutines = bot.source === 'real'
|
|
3076
|
+
const showLibrary = bot.source !== 'real'
|
|
3077
|
+
const showRecent = bot.source !== 'real'
|
|
2842
3078
|
const submitRoutine = async () => {
|
|
2843
3079
|
const title = routineTitle.trim()
|
|
2844
3080
|
const prompt = routinePrompt.trim()
|
|
@@ -2866,7 +3102,8 @@ window.__ModuleLoader__.load({
|
|
|
2866
3102
|
['older', 'library.older'],
|
|
2867
3103
|
]
|
|
2868
3104
|
const computerStatus = computer || (machine ? machineStatus(machine.status) : 'offline')
|
|
2869
|
-
const computerName = machine?.name ?? (computer ? t('sample.computerName') : '—')
|
|
3105
|
+
const computerName = machine?.name ?? bot.computer ?? (computer ? t('sample.computerName') : '—')
|
|
3106
|
+
const hostManaged = Boolean(bot.computer && !machine && configured)
|
|
2870
3107
|
return h(
|
|
2871
3108
|
'aside',
|
|
2872
3109
|
{ className: 'rb-detail', 'aria-label': name },
|
|
@@ -2877,16 +3114,16 @@ window.__ModuleLoader__.load({
|
|
|
2877
3114
|
h('div', { className: 'rb-name' }, name),
|
|
2878
3115
|
h('div', { className: 'rb-sub' }, t('details.jobComputer', { job, computer: computerName })),
|
|
2879
3116
|
),
|
|
2880
|
-
h(
|
|
3117
|
+
showLibrary ? h(
|
|
2881
3118
|
'div',
|
|
2882
3119
|
{ className: 'rb-tabs', role: 'tablist' },
|
|
2883
3120
|
h('button', { type: 'button', className: tab === 'activity' ? 'rb-tab rb-active' : 'rb-tab', role: 'tab', 'aria-selected': tab === 'activity' ? 'true' : 'false', onClick: () => onTab('activity') }, t('details.activity')),
|
|
2884
3121
|
h('button', { type: 'button', className: tab === 'library' ? 'rb-tab rb-active' : 'rb-tab', role: 'tab', 'aria-selected': tab === 'library' ? 'true' : 'false', onClick: () => onTab('library') }, t('details.library')),
|
|
2885
|
-
),
|
|
2886
|
-
tab
|
|
3122
|
+
) : null,
|
|
3123
|
+
tab !== 'library' || !showLibrary ? h(
|
|
2887
3124
|
'div',
|
|
2888
3125
|
{ className: 'rb-sections' },
|
|
2889
|
-
h(
|
|
3126
|
+
showRecent ? h(
|
|
2890
3127
|
'section',
|
|
2891
3128
|
{ className: 'rb-sec' },
|
|
2892
3129
|
h('h3', null, t('details.recent'), count(bot.receipts.length)),
|
|
@@ -2896,7 +3133,7 @@ window.__ModuleLoader__.load({
|
|
|
2896
3133
|
h('div', { className: 'rb-t' }, h('span', null, t(receipt.titleKey)), h('span', { className: 'rb-ok' }, t(receipt.stateKey))),
|
|
2897
3134
|
h('div', { className: 'rb-s' }, t(receipt.metaKey)),
|
|
2898
3135
|
)) : h(EmptyBlock, { name: 'recent', title: t('details.recentEmpty'), hint: t('details.recentEmptyHint') }),
|
|
2899
|
-
),
|
|
3136
|
+
) : null,
|
|
2900
3137
|
h(
|
|
2901
3138
|
'section',
|
|
2902
3139
|
{ className: 'rb-sec' },
|
|
@@ -3005,8 +3242,20 @@ window.__ModuleLoader__.load({
|
|
|
3005
3242
|
),
|
|
3006
3243
|
) : null,
|
|
3007
3244
|
),
|
|
3008
|
-
h(ComputerBlock, {
|
|
3009
|
-
|
|
3245
|
+
h(ComputerBlock, {
|
|
3246
|
+
t,
|
|
3247
|
+
status: computerStatus,
|
|
3248
|
+
name: computerName,
|
|
3249
|
+
machine,
|
|
3250
|
+
image: computerImageOf(machine, bot),
|
|
3251
|
+
configured,
|
|
3252
|
+
available: Boolean(machine),
|
|
3253
|
+
managed: hostManaged,
|
|
3254
|
+
cloudHost,
|
|
3255
|
+
onComputer,
|
|
3256
|
+
onStop,
|
|
3257
|
+
}),
|
|
3258
|
+
h(UsageBlock, { t, catalog, low, overview, configured, error: usageError, preview: usagePreview }),
|
|
3010
3259
|
) : h(
|
|
3011
3260
|
'div',
|
|
3012
3261
|
{ className: 'rb-sections' },
|
|
@@ -3029,17 +3278,31 @@ window.__ModuleLoader__.load({
|
|
|
3029
3278
|
)
|
|
3030
3279
|
}
|
|
3031
3280
|
|
|
3032
|
-
function
|
|
3281
|
+
function computerImageOf(machine, bot) {
|
|
3282
|
+
const live = typeof machine?.agent === 'string' ? machine.agent.trim() : ''
|
|
3283
|
+
const stored = typeof bot?.session?.image === 'string' ? bot.session.image.trim() : ''
|
|
3284
|
+
return live || stored
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
function ComputerBlock({ t, status, name, machine, image, configured, available, managed, cloudHost, onComputer, onStop }) {
|
|
3033
3288
|
const [confirming, setConfirming] = useState(false)
|
|
3034
3289
|
useEffect(() => {
|
|
3035
3290
|
if (status !== 'live') setConfirming(false)
|
|
3036
3291
|
}, [status])
|
|
3037
|
-
const canStop = status === 'live' && Boolean(onStop)
|
|
3292
|
+
const canStop = status === 'live' && available && Boolean(onStop)
|
|
3293
|
+
const rateCents = Number(machine?.pricing?.vm_cents_per_hour)
|
|
3294
|
+
const rate = Number.isFinite(rateCents)
|
|
3295
|
+
? `${machine?.pricing?.currency === 'USD' ? '$' : '¥'}${(rateCents / 100).toFixed(2)}`
|
|
3296
|
+
: ''
|
|
3297
|
+
const hours = Number(machine?.usage?.vm_hours)
|
|
3298
|
+
const burnLine = status === 'live' && rate
|
|
3299
|
+
? t('computer.burnLine', { rate, hours: Number.isFinite(hours) ? hours.toFixed(1) : '—' })
|
|
3300
|
+
: ''
|
|
3038
3301
|
const label = status === 'live' ? t('computer.live')
|
|
3039
3302
|
: status === 'sleeping' ? t('computer.sleeping')
|
|
3040
3303
|
: status === 'unreachable' ? t('computer.unreachable')
|
|
3041
3304
|
: status === 'reconnecting' ? t('computer.reconnecting')
|
|
3042
|
-
: configured ? t('computer.noMachineShort')
|
|
3305
|
+
: configured ? (managed ? t('computer.hostManaged') : t('computer.noMachineShort'))
|
|
3043
3306
|
: t('setup.notConnected')
|
|
3044
3307
|
const dot = status === 'live' ? 'rb-working'
|
|
3045
3308
|
: status === 'unreachable' ? 'rb-danger'
|
|
@@ -3065,14 +3328,19 @@ window.__ModuleLoader__.load({
|
|
|
3065
3328
|
h('span', { className: `rb-dot ${dot}`.trim(), 'aria-hidden': 'true' }),
|
|
3066
3329
|
label,
|
|
3067
3330
|
),
|
|
3331
|
+
burnLine ? h('div', { className: 'rb-s' }, burnLine) : null,
|
|
3332
|
+
image ? h('div', { className: 'rb-s' }, t('computer.image', { image })) : null,
|
|
3333
|
+
!image && machine ? h('div', { className: 'rb-s' }, t('computer.imageUnread')) : null,
|
|
3334
|
+
image && !cloudHost && SHELL_ONESHOT_IMAGES.has(image)
|
|
3335
|
+
? h('p', { className: 'rb-say', role: 'status', style: { color: '#b45309' } }, t('setup.imageUnsupported'))
|
|
3336
|
+
: null,
|
|
3068
3337
|
),
|
|
3069
3338
|
h('div', { className: 'rb-thumb', 'aria-hidden': 'true' }),
|
|
3070
3339
|
),
|
|
3071
3340
|
h(
|
|
3072
3341
|
'div',
|
|
3073
3342
|
{ className: 'rb-comp-acts' },
|
|
3074
|
-
h('button', { type: 'button', className: 'rb-btn', onClick: onComputer }, t('computer.open')),
|
|
3075
|
-
h('button', { type: 'button', className: 'rb-btn', onClick: onComputer }, t('computer.takeOver')),
|
|
3343
|
+
h('button', { type: 'button', className: 'rb-btn', disabled: !available, onClick: onComputer }, t('computer.open')),
|
|
3076
3344
|
canStop ? h('button', { type: 'button', className: 'rb-btn', onClick: () => setConfirming(true) }, t('computer.stop')) : null,
|
|
3077
3345
|
),
|
|
3078
3346
|
canStop && confirming ? h(
|
|
@@ -3097,7 +3365,7 @@ window.__ModuleLoader__.load({
|
|
|
3097
3365
|
)
|
|
3098
3366
|
}
|
|
3099
3367
|
|
|
3100
|
-
function UsageBlock({ t, catalog,
|
|
3368
|
+
function UsageBlock({ t, catalog, low, overview, configured, error, preview }) {
|
|
3101
3369
|
if (configured) {
|
|
3102
3370
|
const balance = balanceText(overview?.balance)
|
|
3103
3371
|
const hours = Number(overview?.usage?.vm_hours)
|
|
@@ -3109,7 +3377,7 @@ window.__ModuleLoader__.load({
|
|
|
3109
3377
|
'div',
|
|
3110
3378
|
{ className: 'rb-usage', 'data-low': low ? 'true' : 'false' },
|
|
3111
3379
|
h('span', { className: low ? 'rb-usage-low' : '' }, lineParts(lookup(catalog, 'usage.balanceLine'), { balance, hours: Number.isFinite(hours) ? hours.toFixed(1) : '—' }, new Set(['balance']))),
|
|
3112
|
-
h('span', null, t('usage.liveLine'
|
|
3380
|
+
h('span', null, t('usage.liveLine')),
|
|
3113
3381
|
low ? h('span', { className: 'rb-low' }, t('cost.low')) : null,
|
|
3114
3382
|
),
|
|
3115
3383
|
)
|
|
@@ -3126,7 +3394,7 @@ window.__ModuleLoader__.load({
|
|
|
3126
3394
|
'div',
|
|
3127
3395
|
{ className: 'rb-usage', 'data-low': low ? 'true' : 'false' },
|
|
3128
3396
|
h('span', { className: low ? 'rb-usage-low' : '' }, lineParts(lookup(catalog, 'usage.balanceLine'), { balance, hours }, new Set(['balance']))),
|
|
3129
|
-
h('span', null, lineParts(lookup(catalog, 'usage.weekLine'), { spend
|
|
3397
|
+
h('span', null, lineParts(lookup(catalog, 'usage.weekLine'), { spend }, new Set(['spend']))),
|
|
3130
3398
|
low ? h('span', { className: 'rb-low' }, t('cost.low')) : null,
|
|
3131
3399
|
),
|
|
3132
3400
|
)
|
|
@@ -3207,6 +3475,7 @@ window.__ModuleLoader__.load({
|
|
|
3207
3475
|
lang: ctx.lang,
|
|
3208
3476
|
state,
|
|
3209
3477
|
host: ctx.host,
|
|
3478
|
+
machineName: ctx.machine?.name ?? null,
|
|
3210
3479
|
onRetryHost: ctx.onRetryHost,
|
|
3211
3480
|
onTab: ctx.onSettingsTab,
|
|
3212
3481
|
onChange: ctx.onSettings,
|
|
@@ -3221,7 +3490,7 @@ window.__ModuleLoader__.load({
|
|
|
3221
3490
|
return h(
|
|
3222
3491
|
'main',
|
|
3223
3492
|
{ className: 'rb-main', 'data-screen': 'chat' },
|
|
3224
|
-
h('div', { className: 'rb-center-empty' }, h('h2', null, t('empty.heading')), h('p', null, t('empty.body')), h('button', { type: 'button', className: 'rb-btn rb-primary', onClick: () => ctx.onScreen('newbot') }, t('newBot.create'))),
|
|
3493
|
+
h('div', { className: 'rb-center-empty' }, h('h2', null, t('empty.heading')), h('p', null, t('empty.body')), h('button', { type: 'button', className: 'rb-btn rb-primary', onClick: () => ctx.onScreen('newbot') }, t('newBot.create')), h('button', { type: 'button', className: 'rb-btn rb-ghost', onClick: () => { ctx.onSetupStep(0); ctx.onScreen('setup') } }, t('setup.open'))),
|
|
3225
3494
|
)
|
|
3226
3495
|
}
|
|
3227
3496
|
return h(Conversation, {
|
|
@@ -3235,6 +3504,8 @@ window.__ModuleLoader__.load({
|
|
|
3235
3504
|
onContinue: ctx.onContinue,
|
|
3236
3505
|
onView: ctx.onView,
|
|
3237
3506
|
onAttach: ctx.onAttach,
|
|
3507
|
+
machine: ctx.machine,
|
|
3508
|
+
onStop: ctx.onStop,
|
|
3238
3509
|
showListButton: width < 900,
|
|
3239
3510
|
showDetailButton: width < 1120,
|
|
3240
3511
|
onToggleList: ctx.onToggleList,
|
|
@@ -3310,6 +3581,7 @@ window.__ModuleLoader__.load({
|
|
|
3310
3581
|
['key', 'setup.steps.key'],
|
|
3311
3582
|
['bot', 'setup.steps.bot'],
|
|
3312
3583
|
]
|
|
3584
|
+
const cloudHost = host.runtime?.name === 'rayrun-cloud-host'
|
|
3313
3585
|
const dependency = host.status === 'loaded' ? host.dependency : null
|
|
3314
3586
|
const dependencyLine = dependency?.status === 'ok'
|
|
3315
3587
|
? t('setup.dependencyOk', { version: dependency.version ?? '?' })
|
|
@@ -3319,6 +3591,9 @@ window.__ModuleLoader__.load({
|
|
|
3319
3591
|
? t('setup.dependencyIncompatible', { version: dependency.version ?? '?', required: dependency.required ?? '' })
|
|
3320
3592
|
: t('setup.dependencyStatus')
|
|
3321
3593
|
const configured = connection?.connection?.configured === true
|
|
3594
|
+
const machineImage = String(machine?.agent ?? '').trim()
|
|
3595
|
+
const machineImageUnsupported = Boolean(machine && !cloudHost && SHELL_ONESHOT_IMAGES.has(machineImage))
|
|
3596
|
+
const machineImageUnread = Boolean(machine && !machineImage)
|
|
3322
3597
|
const canContinue = step === 0
|
|
3323
3598
|
? dependency?.status === 'ok'
|
|
3324
3599
|
: step === 1
|
|
@@ -3394,9 +3669,15 @@ window.__ModuleLoader__.load({
|
|
|
3394
3669
|
return
|
|
3395
3670
|
}
|
|
3396
3671
|
const defaults = overview.defaults ?? {}
|
|
3672
|
+
const configuredAgent = String(defaults.agent ?? '').trim()
|
|
3673
|
+
const agent = cloudHost
|
|
3674
|
+
? CLOUD_HOST_IMAGE
|
|
3675
|
+
: SHELL_ONESHOT_IMAGES.has(configuredAgent) || !configuredAgent
|
|
3676
|
+
? DETACHED_IMAGE
|
|
3677
|
+
: configuredAgent
|
|
3397
3678
|
const result = await rayRpc('machine.create', {
|
|
3398
3679
|
name,
|
|
3399
|
-
agent
|
|
3680
|
+
agent,
|
|
3400
3681
|
cpu_cores: Number(defaults.cpu_cores) || 2,
|
|
3401
3682
|
memory_mb: Math.max(2048, Number(defaults.memory_mb) || 2048),
|
|
3402
3683
|
remote_desktop: true,
|
|
@@ -3523,6 +3804,8 @@ window.__ModuleLoader__.load({
|
|
|
3523
3804
|
null,
|
|
3524
3805
|
h('p', { className: 'rb-say' }, t('setup.computerExisting', { name: machine.name ?? machine.id ?? '—' })),
|
|
3525
3806
|
h('p', { className: 'rb-faint' }, t('setup.computerExistingHint')),
|
|
3807
|
+
machineImageUnsupported ? h('p', { className: 'rb-say', role: 'status', style: { color: '#b45309' } }, t('setup.imageUnsupported')) : null,
|
|
3808
|
+
machineImageUnread ? h('p', { className: 'rb-say', role: 'status', style: { color: '#b45309' } }, t('computer.imageUnread')) : null,
|
|
3526
3809
|
) : null,
|
|
3527
3810
|
!machineLoading && !machine && !configured ? h('p', { className: 'rb-say', role: 'status' }, t('setup.computerNeedsRayrun')) : null,
|
|
3528
3811
|
!machineLoading && !machine && configured ? h(
|
|
@@ -3592,11 +3875,21 @@ window.__ModuleLoader__.load({
|
|
|
3592
3875
|
)
|
|
3593
3876
|
}
|
|
3594
3877
|
|
|
3595
|
-
function SettingsScreen({ t, lang, state, host, onRetryHost, onTab, onChange, onClose, onSetup }) {
|
|
3878
|
+
function SettingsScreen({ t, lang, state, host, machineName, onRetryHost, onTab, onChange, onClose, onSetup }) {
|
|
3596
3879
|
const shownLang = state.settings.lang || lang || 'zh'
|
|
3880
|
+
const cloudHost = host.runtime?.name === 'rayrun-cloud-host'
|
|
3881
|
+
const targetImage = cloudHost ? CLOUD_HOST_IMAGE : DETACHED_IMAGE
|
|
3597
3882
|
const [usage, setUsage] = useState(null)
|
|
3598
3883
|
const [usageLoading, setUsageLoading] = useState(true)
|
|
3599
3884
|
const [usageError, setUsageError] = useState('')
|
|
3885
|
+
const [computerOpen, setComputerOpen] = useState(false)
|
|
3886
|
+
const [computerBusy, setComputerBusy] = useState(false)
|
|
3887
|
+
const [computerError, setComputerError] = useState('')
|
|
3888
|
+
const [computerResult, setComputerResult] = useState(null)
|
|
3889
|
+
const [update, setUpdate] = useState(null)
|
|
3890
|
+
const [updateBusy, setUpdateBusy] = useState(false)
|
|
3891
|
+
const [updateError, setUpdateError] = useState('')
|
|
3892
|
+
const [updateCopy, setUpdateCopy] = useState('')
|
|
3600
3893
|
useEffect(() => {
|
|
3601
3894
|
let cancelled = false
|
|
3602
3895
|
void (async () => {
|
|
@@ -3626,6 +3919,60 @@ window.__ModuleLoader__.load({
|
|
|
3626
3919
|
machines: Array.isArray(usage.machines) ? usage.machines.length : 0,
|
|
3627
3920
|
})
|
|
3628
3921
|
: t('settings.usageConnect')
|
|
3922
|
+
const checkUpdates = async () => {
|
|
3923
|
+
if (updateBusy) return
|
|
3924
|
+
setUpdateBusy(true)
|
|
3925
|
+
setUpdateError('')
|
|
3926
|
+
setUpdateCopy('')
|
|
3927
|
+
try {
|
|
3928
|
+
setUpdate(await hostRpc('update.check'))
|
|
3929
|
+
} catch (error) {
|
|
3930
|
+
setUpdate(null)
|
|
3931
|
+
setUpdateError(String(error?.message ?? error))
|
|
3932
|
+
} finally {
|
|
3933
|
+
setUpdateBusy(false)
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
const copyUpdateCommand = async () => {
|
|
3937
|
+
if (!update?.command) return
|
|
3938
|
+
try {
|
|
3939
|
+
await navigator.clipboard.writeText(update.command)
|
|
3940
|
+
setUpdateCopy('copied')
|
|
3941
|
+
} catch {
|
|
3942
|
+
setUpdateCopy('failed')
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
const machines = Array.isArray(usage?.machines)
|
|
3946
|
+
? usage.machines.filter((machine) => machine?.status !== 'Terminated')
|
|
3947
|
+
: []
|
|
3948
|
+
const currentMachine = (machineName
|
|
3949
|
+
? machines.find((machine) => machine.name === machineName || machine.id === machineName)
|
|
3950
|
+
: null) || pickMachine(machines) || null
|
|
3951
|
+
const openComputer = () => {
|
|
3952
|
+
setComputerOpen(true)
|
|
3953
|
+
setComputerError('')
|
|
3954
|
+
setComputerResult(null)
|
|
3955
|
+
}
|
|
3956
|
+
const submitComputerUpdate = async () => {
|
|
3957
|
+
if (computerBusy || !currentMachine) return
|
|
3958
|
+
setComputerBusy(true)
|
|
3959
|
+
setComputerError('')
|
|
3960
|
+
setComputerResult(null)
|
|
3961
|
+
try {
|
|
3962
|
+
const body = await hostRpc('computer.update', {
|
|
3963
|
+
machine: currentMachine.name || currentMachine.id,
|
|
3964
|
+
confirmed: true,
|
|
3965
|
+
})
|
|
3966
|
+
setComputerResult(body)
|
|
3967
|
+
setComputerOpen(false)
|
|
3968
|
+
const overview = await rayRpc('overview').catch(() => null)
|
|
3969
|
+
if (overview) setUsage(overview)
|
|
3970
|
+
} catch (error) {
|
|
3971
|
+
setComputerError(String(error?.message ?? error))
|
|
3972
|
+
} finally {
|
|
3973
|
+
setComputerBusy(false)
|
|
3974
|
+
}
|
|
3975
|
+
}
|
|
3629
3976
|
const scrollTo = (id) => {
|
|
3630
3977
|
onTab(id)
|
|
3631
3978
|
const reduce = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
@@ -3648,7 +3995,7 @@ window.__ModuleLoader__.load({
|
|
|
3648
3995
|
h(
|
|
3649
3996
|
'div',
|
|
3650
3997
|
{ className: 'rb-snav' },
|
|
3651
|
-
['account', 'usage', '
|
|
3998
|
+
['account', 'usage', 'computer', 'updates', 'appearance'].map((id) => h(
|
|
3652
3999
|
'button',
|
|
3653
4000
|
{
|
|
3654
4001
|
type: 'button',
|
|
@@ -3679,7 +4026,7 @@ window.__ModuleLoader__.load({
|
|
|
3679
4026
|
h(
|
|
3680
4027
|
'div',
|
|
3681
4028
|
{ className: 'rb-srow' },
|
|
3682
|
-
h('div', { className: 'rb-l' }, t('settings.plugin'), h('small', null, t('settings.pluginHint'))),
|
|
4029
|
+
h('div', { className: 'rb-l' }, t('settings.plugin'), h('small', null, t('settings.pluginHint', { version: host.dependency?.version ?? '—' }))),
|
|
3683
4030
|
h(
|
|
3684
4031
|
'span',
|
|
3685
4032
|
{ className: 'rb-status' },
|
|
@@ -3712,22 +4059,6 @@ window.__ModuleLoader__.load({
|
|
|
3712
4059
|
usageLine,
|
|
3713
4060
|
),
|
|
3714
4061
|
),
|
|
3715
|
-
h(
|
|
3716
|
-
'div',
|
|
3717
|
-
{ className: 'rb-srow' },
|
|
3718
|
-
h('div', { className: 'rb-l' }, t('settings.idle'), h('small', null, t('settings.idleHint'))),
|
|
3719
|
-
h(
|
|
3720
|
-
'select',
|
|
3721
|
-
{
|
|
3722
|
-
value: state.settings.idle,
|
|
3723
|
-
'aria-label': t('settings.idle'),
|
|
3724
|
-
onChange: (event) => onChange({ idle: event.target.value }),
|
|
3725
|
-
},
|
|
3726
|
-
h('option', { value: '15' }, t('settings.idle15')),
|
|
3727
|
-
h('option', { value: '30' }, t('settings.idle30')),
|
|
3728
|
-
h('option', { value: '0' }, t('settings.idleOff')),
|
|
3729
|
-
),
|
|
3730
|
-
),
|
|
3731
4062
|
h(
|
|
3732
4063
|
'div',
|
|
3733
4064
|
{ className: 'rb-srow' },
|
|
@@ -3740,15 +4071,108 @@ window.__ModuleLoader__.load({
|
|
|
3740
4071
|
onChange: (event) => onChange({ lowBalance: event.target.value.replace(/[^\d.]/g, '').slice(0, 8) }),
|
|
3741
4072
|
}),
|
|
3742
4073
|
),
|
|
4074
|
+
h(
|
|
4075
|
+
'section',
|
|
4076
|
+
{ id: 'rb-settings-computer', className: 'rb-computer-card' },
|
|
4077
|
+
h(
|
|
4078
|
+
'div',
|
|
4079
|
+
{ className: 'rb-computer-head' },
|
|
4080
|
+
h(
|
|
4081
|
+
'div',
|
|
4082
|
+
null,
|
|
4083
|
+
h('div', { className: 'rb-computer-title' }, t('settings.computer')),
|
|
4084
|
+
h('div', { className: 'rb-computer-desc' }, t('settings.computerHint')),
|
|
4085
|
+
),
|
|
4086
|
+
h('button', {
|
|
4087
|
+
type: 'button',
|
|
4088
|
+
className: 'rb-btn',
|
|
4089
|
+
disabled: computerBusy || !usageConfigured || !currentMachine,
|
|
4090
|
+
onClick: openComputer,
|
|
4091
|
+
}, t('settings.computerUpdate')),
|
|
4092
|
+
),
|
|
4093
|
+
usageLoading
|
|
4094
|
+
? h('div', { className: 'rb-computer-meta' }, t('settings.hostChecking'))
|
|
4095
|
+
: !usageConfigured
|
|
4096
|
+
? h('div', { className: 'rb-computer-meta' }, t('settings.computerNotConnected'))
|
|
4097
|
+
: !currentMachine
|
|
4098
|
+
? h('div', { className: 'rb-computer-meta' }, t('settings.computerNoMachine'))
|
|
4099
|
+
: h('div', { className: 'rb-computer-meta' }, t('settings.computerCurrent', {
|
|
4100
|
+
name: currentMachine.name ?? currentMachine.id,
|
|
4101
|
+
image: currentMachine.agent || '—',
|
|
4102
|
+
})),
|
|
4103
|
+
computerResult ? h('div', { className: 'rb-computer-meta' }, t(
|
|
4104
|
+
computerResult.previous?.destroyed ? 'settings.computerUpdated' : 'settings.computerUpdatedKept',
|
|
4105
|
+
{
|
|
4106
|
+
image: computerResult.machine?.image ?? targetImage,
|
|
4107
|
+
name: computerResult.previous?.name ?? '—',
|
|
4108
|
+
},
|
|
4109
|
+
)) : null,
|
|
4110
|
+
computerError ? h('div', { className: 'rb-computer-meta rb-computer-error', role: 'alert' }, t('settings.computerUpdateFailed', { message: computerError })) : null,
|
|
4111
|
+
computerOpen && currentMachine ? h(
|
|
4112
|
+
'div',
|
|
4113
|
+
{ className: 'rb-computer-form' },
|
|
4114
|
+
h('div', { className: 'rb-faint' }, t('settings.computerTarget', { image: targetImage })),
|
|
4115
|
+
h('div', { className: 'rb-faint' }, t('settings.computerBillable')),
|
|
4116
|
+
h('div', { className: 'rb-faint' }, t('settings.computerUpdateHint')),
|
|
4117
|
+
h(
|
|
4118
|
+
'div',
|
|
4119
|
+
{ className: 'rb-line' },
|
|
4120
|
+
h('button', {
|
|
4121
|
+
type: 'button',
|
|
4122
|
+
className: 'rb-btn rb-ghost',
|
|
4123
|
+
disabled: computerBusy,
|
|
4124
|
+
onClick: () => {
|
|
4125
|
+
setComputerOpen(false)
|
|
4126
|
+
setComputerError('')
|
|
4127
|
+
},
|
|
4128
|
+
}, t('settings.computerCancel')),
|
|
4129
|
+
h('button', {
|
|
4130
|
+
type: 'button',
|
|
4131
|
+
className: 'rb-btn rb-primary',
|
|
4132
|
+
disabled: computerBusy,
|
|
4133
|
+
onClick: submitComputerUpdate,
|
|
4134
|
+
}, computerBusy ? t('settings.computerUpdating') : t('settings.computerConfirm')),
|
|
4135
|
+
),
|
|
4136
|
+
computerBusy ? h('div', { className: 'rb-faint' }, t('settings.computerUpdating')) : null,
|
|
4137
|
+
) : null,
|
|
4138
|
+
),
|
|
3743
4139
|
h(
|
|
3744
4140
|
'div',
|
|
3745
|
-
{ id: 'rb-settings-
|
|
3746
|
-
h('div', { className: 'rb-l' }, t('settings.
|
|
3747
|
-
h(
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
4141
|
+
{ id: 'rb-settings-updates', className: 'rb-srow rb-update-row' },
|
|
4142
|
+
h('div', { className: 'rb-l' }, t('settings.updates'), h('small', null, t('settings.updatesHint'))),
|
|
4143
|
+
h(
|
|
4144
|
+
'div',
|
|
4145
|
+
{ className: 'rb-update-col' },
|
|
4146
|
+
h('button', {
|
|
4147
|
+
type: 'button',
|
|
4148
|
+
className: 'rb-btn',
|
|
4149
|
+
disabled: updateBusy,
|
|
4150
|
+
onClick: checkUpdates,
|
|
4151
|
+
}, updateBusy ? t('settings.checkingUpdates') : t('settings.checkUpdates')),
|
|
4152
|
+
updateError ? h('div', { className: 'rb-update-msg rb-update-error', role: 'alert' }, t('settings.updateCheckFailed', { message: updateError })) : null,
|
|
4153
|
+
update && !updateError ? h(
|
|
4154
|
+
'div',
|
|
4155
|
+
{ className: 'rb-update-msg' },
|
|
4156
|
+
update.updateAvailable ? h(
|
|
4157
|
+
'div',
|
|
4158
|
+
null,
|
|
4159
|
+
h('div', null, t('settings.updateAvailable', { latest: update.latest, current: update.current })),
|
|
4160
|
+
h('div', { className: 'rb-faint' }, t('settings.updateCommandHint')),
|
|
4161
|
+
h('div', { className: 'rb-update-cmd' }, h('code', null, update.command || '')),
|
|
4162
|
+
h(
|
|
4163
|
+
'div',
|
|
4164
|
+
{ className: 'rb-line' },
|
|
4165
|
+
h('button', {
|
|
4166
|
+
type: 'button',
|
|
4167
|
+
className: 'rb-btn rb-ghost',
|
|
4168
|
+
onClick: copyUpdateCommand,
|
|
4169
|
+
}, updateCopy === 'copied' ? t('settings.updateCopied') : t('settings.copyUpdateCommand')),
|
|
4170
|
+
updateCopy === 'failed' ? h('span', { className: 'rb-faint' }, t('settings.updateCopyFailed')) : null,
|
|
4171
|
+
),
|
|
4172
|
+
h('div', { className: 'rb-faint' }, t('settings.updateRestart')),
|
|
4173
|
+
) : h('div', null, t('settings.upToDate', { channel: update.channel, current: update.current })),
|
|
4174
|
+
) : null,
|
|
4175
|
+
),
|
|
3752
4176
|
),
|
|
3753
4177
|
h(
|
|
3754
4178
|
'div',
|