fix(web): make the web console work end-to-end

- Pair through the public POST /api/v1/pair and persist the device scopes;
  keep the allow-listed next deep link. Rename the manual field to pairing code.
- Authenticate the WebSocket with the raw device token (strip Bearer) and
  recover from a 401 by clearing the connection once.
- Fix chat payloads: setModel/setThinking, attention/diff responses, subagent
  dispatch items, queue ids/mode, task output and WS resume since.
- Render exactly one assistant message per turn: one-to-one snapshot/history
  merge plus a stale-delta guard after message_end (fixes PONGONG).
- Fix dialogs (content above the overlay), unknown-session deep links
  (error + retry, no silent fallback), device list/revoke, status identity and
  live pairing code, reconnect banner and Playwright selectors.
This commit is contained in:
yuez committed 2026-10-21 20:42:19 +08:00
1 parent 5572ac0d84
commit 0ef019f58d
57 files changed
+3549 -684

No files matched your search

+23 -17
View File
@@ -4,18 +4,12 @@
"chat.abortTitle": "中止当前执行",
"chat.accept": "接受",
"chat.acceptAll": "全部接受",
"chat.accepted": "已接受变更:{path}",
"chat.acceptedAll": "已接受全部 {n} 个文件",
"chat.addAttachment": "添加附件",
"chat.allowOnce": "允许一次",
"chat.allowedOnce": "已允许一次:rm -rf build/",
"chat.always": "始终允许",
"chat.alwaysAllowed": "已记住该工具授权",
"chat.attachNote": "附件会随下一条消息发送给 pi2(原型仅为交互演示)。",
"chat.attachTitle": "添加附件",
"chat.attachmentAdded": "已添加附件 {name}",
"chat.attachmentFailed": "附件读取失败:{name}",
"chat.attentionQuestion": "子代理请求确认:允许执行 ",
"chat.attentionResolvedOther": "该请求已由其他客户端处理",
"chat.attentionTimedOut": "请求超时,已自动拒绝",
"chat.attentionTimeout": "超时后自动拒绝 · 剩余 ",
@@ -46,7 +40,6 @@
"chat.dispatchTitle": "派发子代理",
"chat.dispatched": "已派发子代理 {name}",
"chat.dropHint": "拖放图片 / 文件到此处,或点击选择",
"chat.dropNote": "演示用:仅本地 mock,不会真正上传",
"chat.duration": "耗时",
"chat.emptyText": "在输入框里开始对话吧",
"chat.emptyTitle": "还没有消息",
@@ -57,7 +50,6 @@
"chat.loadOlder": "加载更早的消息",
"chat.loading": "加载中…",
"chat.loadingOlder": "正在加载更早的消息…",
"chat.mockReply": "收到,我来处理。",
"chat.model": "模型",
"chat.modelLabel": "模型 model",
"chat.modelSwitched": "已切换模型:{model}",
@@ -67,7 +59,6 @@
"chat.nameRequired": "名称不能为空",
"chat.newSession": "新 session",
"chat.newSessionCreated": "已创建新 session",
"chat.newSessionDemo": "新建 session 演示:已创建 session 01a16a2f",
"chat.newSessionFailed": "新建 session 失败:{error}",
"chat.noChanges": "没有变更",
"chat.noMatch": "没有匹配的 session",
@@ -86,12 +77,7 @@
"chat.parentSession": "父会话",
"chat.pending": "{n} 待处理",
"chat.preview": "只读预览",
"chat.previewCompleted": "完成。结论已通过 report 回传给父会话,可继续下一步。",
"chat.previewDormant": "进程已休眠,可重新唤醒继续该任务。",
"chat.previewFailed": "执行失败:无法收敛复现步骤,已把错误详情回传给父会话。",
"chat.previewInterrupted": "被中断:收到父会话的中止信号,已停止当前工具调用。",
"chat.previewNote": "只读预览 · 子代理对话不会写入父会话",
"chat.previewReply": "收到。我会在 {model} 上以 thinking={thinking} 执行,并把结论回传给父会话。",
"chat.previewRunning": "正在执行…",
"chat.previewSubagent": "预览子代理",
"chat.progress": "进度 {done}/{total}",
@@ -120,8 +106,7 @@
"chat.source": "来源:{name}",
"chat.status": "状态",
"chat.steer": "Steer",
"chat.steerOff": "已取消 steer",
"chat.steerOn": "已设为 steer 插入",
"chat.steerMode": "转向模式:{mode}",
"chat.steerPlaceholder": "发送 steer 指令给该子代理…",
"chat.steerRequired": "请输入 steer 指令",
"chat.steerSent": "已发送 steer 指令:{text}",
@@ -137,6 +122,7 @@
"chat.tabTasks": "任务",
"chat.tabTodo": "待办",
"chat.task": "任务",
"chat.taskExitCode": "退出码",
"chat.taskLabel": "任务 task *",
"chat.taskOutput": "任务输出 · {id}",
"chat.taskPlaceholder": "描述要交给子代理的任务(必填)",
@@ -201,7 +187,7 @@
"connect.emptyText": "填写地址,或扫码配对 pi2 服务器后即可开始。",
"connect.emptyTitle": "连接 pi2 服务器",
"connect.endpoint": "地址",
"connect.failed": "连接失败,请检查地址与 Token",
"connect.failed": "连接失败,请检查地址与配对码",
"connect.host": "Host",
"connect.hostPlaceholder": "192.168.2.10 或 http://…:4321",
"connect.hostRequired": "请输入服务器地址",
@@ -213,6 +199,13 @@
"connect.name": "名称",
"connect.noAutoDetect": "摄像头已开启。当前浏览器不支持自动识别,请粘贴配对链接。",
"connect.notPairQr": "这不是 pi2 配对二维码,请换一个",
"connect.os": "系统",
"connect.pairCode": "配对码",
"connect.pairCodeHint": "pi2 服务器上显示的 8 位配对码。",
"connect.pairCodeInvalid": "配对码必须是 8 位字母或数字(A–Z、0–9)",
"connect.pairCodePlaceholder": "ABCD1234",
"connect.pairCodeRejected": "配对码错误或已过期,请在服务器上生成新的配对码。",
"connect.pairCodeRequired": "请输入 8 位配对码",
"connect.pairFailed": "配对失败,请检查配对码或链接",
"connect.pairHint": "扫描 pi2 服务器显示的配对二维码,识别后需二次确认。",
"connect.pairingLink": "配对链接",
@@ -231,6 +224,10 @@
"connect.scanTitle": "扫码配对",
"connect.scanWarning": "连接后该设备可读写会话并派发子代理。",
"connect.scannedNote": "扫码配对",
"connect.scope.apply": "写入",
"connect.scope.read": "读取",
"connect.scope.steer": "操作",
"connect.scopeHint": "此设备获得的权限:{scope}",
"connect.scopes": "权限",
"connect.secureNote": "摄像头需要 HTTPS(或 localhost);Token 仅保存在此浏览器。",
"connect.secureRequired": "摄像头需要 HTTPS(或 localhost)安全环境,请改用下方配对链接。",
@@ -246,6 +243,7 @@
"connect.tokenHint": "Token 只保存在此浏览器",
"connect.tokenPlaceholder": "配对令牌(pkt_…)",
"connect.tokenRequired": "请输入配对 Token",
"connect.uptime": "运行时长",
"connect.version": "版本",
"errors.attentionResolved": "该请求已被处理",
"errors.badRequest": "请求无效",
@@ -272,10 +270,12 @@
"nav.chat": "对话",
"nav.status": "状态",
"nav.workspaces": "工作空间",
"shell.connectionLost": "与 pi2 的连接已断开,请重新配对后继续。",
"shell.dark": "暗",
"shell.language": "语言",
"shell.light": "亮",
"shell.navLabel": "控制台",
"shell.reconnecting": "连接中断,正在重连…",
"shell.serverChip": "服务器:{name},查看状态",
"shell.switchLanguage": "切换到{lang}",
"shell.system": "自动",
@@ -308,11 +308,14 @@
"status.created": "创建",
"status.deviceCount": "{n} 台",
"status.devices": "已配对设备",
"status.devicesError": "加载已配对设备失败",
"status.disconnected": "已断开",
"status.disk": "磁盘",
"status.fail": "失败",
"status.health": "健康检查",
"status.healthError": "加载健康检查失败",
"status.healthy": "健康",
"status.infoError": "加载服务器信息失败",
"status.instances": "实例数",
"status.kernel": "内核",
"status.lastActive": "最后活跃",
@@ -326,6 +329,7 @@
"status.modelSearchAria": "搜索模型或 provider",
"status.modelSearchPlaceholder": "搜索模型或 provider…",
"status.models": "模型与 Provider",
"status.modelsError": "加载模型列表失败",
"status.network": "Network",
"status.networkAddress": "Network 地址",
"status.noDevicesText": "在手机端扫码配对后,设备会显示在这里。",
@@ -350,6 +354,7 @@
"status.reasoning": "推理",
"status.resourceWarn": "内存占用接近软上限,新的实例可能被延迟启动。",
"status.resources": "资源占用",
"status.resourcesError": "加载资源使用情况失败",
"status.revoke": "撤销",
"status.revokeText": "将撤销「{name}」的访问权限,手机端下次请求将失效。",
"status.revokeTitle": "撤销设备",
@@ -363,6 +368,7 @@
"status.subagentConcurrency": "子代理并发",
"status.taskCount": "{n} 个",
"status.tasks": "后台任务",
"status.tasksError": "加载后台任务失败",
"status.title": "服务器状态",
"status.tokenScopes": "Token 权限",
"status.uptime": "已运行时长",