pi-web-ui 0.115.0 → 0.117.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/CHANGELOG.md +65 -2
- package/bin/device-hub-cli.mjs +26 -3
- package/bin/pi-web-ui.mjs +159 -71
- package/dist/server/agent-service-daemon.js +136 -8
- package/dist/server/agent-service.js +594 -159
- package/dist/server/canvas/canvas-workspace.js +18 -86
- package/dist/server/client-state.js +52 -8
- package/dist/server/compaction-markers.js +43 -24
- package/dist/server/dangling-tools.js +172 -16
- package/dist/server/device-center/bot-execution.js +77 -2
- package/dist/server/device-center/collab-service.js +61 -12
- package/dist/server/device-center/collab-tool.js +482 -21
- package/dist/server/device-center/connector.js +107 -37
- package/dist/server/device-center/delivery-authority.js +98 -0
- package/dist/server/device-center/delivery-subject.js +30 -0
- package/dist/server/device-center/device-integration.js +453 -183
- package/dist/server/device-center/execution-guides.js +17 -7
- package/dist/server/device-center/execution-instructions.js +2 -1
- package/dist/server/device-center/execution-settings.js +138 -25
- package/dist/server/device-center/executor.js +51 -6
- package/dist/server/device-center/file-sync.js +14 -13
- package/dist/server/device-center/group-context-message.js +3 -1
- package/dist/server/device-center/group-context.js +73 -3
- package/dist/server/device-center/hub-conversations.js +71 -6
- package/dist/server/device-center/hub-deliveries.js +120 -15
- package/dist/server/device-center/hub-integration.js +655 -334
- package/dist/server/device-center/hub-locks.js +320 -0
- package/dist/server/device-center/hub-page.js +16 -35
- package/dist/server/device-center/hub-setup.js +23 -1
- package/dist/server/device-center/hub-transaction-log.js +197 -0
- package/dist/server/device-center/hub-webhooks.js +165 -0
- package/dist/server/device-center/hub.js +1531 -305
- package/dist/server/device-center/integration-verification.js +113 -0
- package/dist/server/device-center/local-hub.js +8 -3
- package/dist/server/device-center/local-publication.js +423 -0
- package/dist/server/device-center/local-verification-job.js +97 -0
- package/dist/server/device-center/local-verification.js +274 -0
- package/dist/server/device-center/local.js +181 -13
- package/dist/server/device-center/main.js +4 -1
- package/dist/server/device-center/partition-log.js +330 -0
- package/dist/server/device-center/publication-journal.js +312 -0
- package/dist/server/device-center/publish-intent.js +379 -0
- package/dist/server/device-center/relay.js +134 -24
- package/dist/server/device-center/runtime.js +475 -42
- package/dist/server/device-center/store.js +366 -89
- package/dist/server/device-center/task-outcome.js +81 -0
- package/dist/server/device-center/task-recovery.js +603 -178
- package/dist/server/device-center/task-scheduler.js +48 -3
- package/dist/server/device-center/task-settlement.js +353 -0
- package/dist/server/device-center/task-workspace.js +443 -0
- package/dist/server/device-center/transfers.js +41 -15
- package/dist/server/device-center/verification-limits.js +10 -0
- package/dist/server/device-center/work-contract.js +995 -0
- package/dist/server/dispatch-domain-handlers.js +29 -3
- package/dist/server/dsh/dsh-agent-service.js +9 -2
- package/dist/server/engine-probe.js +112 -1
- package/dist/server/global-loader.js +119 -19
- package/dist/server/index.js +159 -17
- package/dist/server/managed.js +2 -0
- package/dist/server/model-admin.js +48 -6
- package/dist/server/model-enrich.js +10 -1
- package/dist/server/patch-node-pty.js +3 -2
- package/dist/server/patch-remote-catalog.js +3 -2
- package/dist/server/plugins.js +64 -7
- package/dist/server/preset-fields.js +17 -1
- package/dist/server/preset-share.js +1 -0
- package/dist/server/prompt-composer.js +39 -0
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/quick-ask-settings.js +28 -0
- package/dist/server/quick-ask.js +164 -0
- package/dist/server/reasoning-registry.js +207 -0
- package/dist/server/resolve-global-sdk.js +61 -11
- package/dist/server/scheduler-tasks.js +35 -8
- package/dist/server/session-list-scan.js +223 -0
- package/dist/server/session-open.js +93 -0
- package/dist/server/session-parser.js +4 -0
- package/dist/server/session-scan.js +90 -38
- package/dist/server/settings-service.js +9 -1
- package/dist/server/soft-cap.js +5 -0
- package/dist/server/startup-banner.js +35 -0
- package/dist/server/subagents.js +2 -1
- package/dist/server/tool-manager.js +17 -9
- package/dist/server/transcript-prepare.js +73 -0
- package/dist/server/unauthorized-page.js +319 -0
- package/dist/server/universal/drivers/claude-code.js +98 -34
- package/dist/server/universal/universal-session.js +4 -0
- package/dist/server/workspace-handle.js +428 -0
- package/docs/architecture-plugins.md +959 -0
- package/docs/device-center.md +34 -20
- package/package.json +4 -4
- package/plugin-sdk/README.md +16 -8
- package/plugin-sdk/client.d.ts +27 -0
- package/plugin-sdk/client.mjs +82 -0
- package/plugin-sdk/index.d.ts +10 -0
- package/plugin-sdk/index.mjs +4 -683
- package/plugin-sdk/package.json +15 -4
- package/plugin-sdk/testing.d.ts +10 -0
- package/plugin-sdk/testing.mjs +566 -0
- package/themes/flow-cristallo.css +168 -0
- package/themes/flow-ink.css +169 -0
- package/themes/flow-obsidian.css +169 -0
- package/themes/flow-zurich.css +169 -0
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/{BgTasksModal-BYzPgmoq.js → BgTasksModal-BjNRIUIc.js} +1 -1
- package/web/dist/assets/{BgTasksModal-ni0VTmAQ.js → BgTasksModal-C0zuU8FE.js} +1 -1
- package/web/dist/assets/{CanvasStudio-DNmDNBod.js → CanvasStudio-BWvdmJ0M.js} +3 -3
- package/web/dist/assets/{CanvasStudio-BCUeEf25.js → CanvasStudio-VQFjmTGq.js} +3 -3
- package/web/dist/assets/DeviceCenter-DI9_0aBB.js +3 -0
- package/web/dist/assets/DeviceCenter-DsNtXqzY.js +3 -0
- package/web/dist/assets/DeviceExecutionSettings-BLP1Su5G.js +1 -0
- package/web/dist/assets/DeviceGroups-2Pvk0Cds.js +1 -0
- package/web/dist/assets/DeviceGroups-CP7CcyPD.js +1 -0
- package/web/dist/assets/{Dropdown-CGXD0DfT.js → Dropdown-CQtstPGv.js} +1 -1
- package/web/dist/assets/FilePreview-BMB2tNyT.js +2 -0
- package/web/dist/assets/FilePreview-RGFQUbJo.js +2 -0
- package/web/dist/assets/{GlobalSearchModal-mevF-ySi.js → GlobalSearchModal-BM5wxiqU.js} +1 -1
- package/web/dist/assets/{GlobalSearchModal-qL99FN_F.js → GlobalSearchModal-DGv_WINq.js} +1 -1
- package/web/dist/assets/GroupConversation-B7SnuXj1.js +61 -0
- package/web/dist/assets/GroupConversation-Dda69q-2.js +61 -0
- package/web/dist/assets/{HintTip-LHwkS2jV.js → HintTip-ChTW8o1m.js} +1 -1
- package/web/dist/assets/ModelConfigModal-C-0Z4hUZ.js +2 -0
- package/web/dist/assets/ModelConfigModal-yqeadyab.js +2 -0
- package/web/dist/assets/{PiSetupModal-DE5-gEtI.js → PiSetupModal-BX5rUuoI.js} +1 -1
- package/web/dist/assets/{ProviderOAuthControls-6UMARucA.js → ProviderOAuthControls-DY4SCfXg.js} +1 -1
- package/web/dist/assets/SCMPanel-C4KbQvvK.js +2 -0
- package/web/dist/assets/SCMPanel-DPAyY2sW.js +2 -0
- package/web/dist/assets/SettingsModal-DxZp6D_g.js +32 -0
- package/web/dist/assets/SettingsModal-WhQzaOPt.js +32 -0
- package/web/dist/assets/{TerminalPanel-CTp_BZ4S.js → TerminalPanel-D4By_RVc.js} +2 -2
- package/web/dist/assets/{TerminalPanel-CkYxC-Gh.js → TerminalPanel-lZw8-i3j.js} +2 -2
- package/web/dist/assets/{TuiOverlayModal-1cRLP8IF.js → TuiOverlayModal-C3pAVuC8.js} +1 -1
- package/web/dist/assets/{TuiOverlayModal-2xlptqWX.js → TuiOverlayModal-D7_rEXcJ.js} +1 -1
- package/web/dist/assets/app-globals-KqOVtmp1.js +123 -0
- package/web/dist/assets/{canvas-client-Bye9nSFO.js → canvas-client-BY6ojmle.js} +1 -1
- package/web/dist/assets/{desktop-kjBoE3Nu.js → desktop-CV6KKp9R.js} +1 -1
- package/web/dist/assets/index-BawF7ZP5.js +397 -0
- package/web/dist/assets/index-BoGCoq5X.js +397 -0
- package/web/dist/assets/index-CVW9FoY2.css +1 -0
- package/web/dist/assets/{plugin-host-C8mNgghx.js → plugin-host-Dn8Dd6SC.js} +1 -1
- package/web/dist/assets/{remote-ssh-client-CeP3CLUW.js → remote-ssh-client-Dzi-eEyE.js} +1 -1
- package/web/dist/assets/{theme-BXGpyTMh.js → theme-D_bihpdN.js} +1 -1
- package/web/dist/index.html +11 -11
- package/web/dist/sw.js +1 -1
- package/dist/server/patch-turn-end-boundary.js +0 -77
- package/web/dist/assets/DeviceCenter-BcBhRgL6.js +0 -3
- package/web/dist/assets/DeviceCenter-CmL5FZmt.js +0 -3
- package/web/dist/assets/DeviceGroups-CLdpdnI7.js +0 -1
- package/web/dist/assets/DeviceGroups-CgBaDPrD.js +0 -1
- package/web/dist/assets/FilePreview-B8iqnBjy.js +0 -2
- package/web/dist/assets/FilePreview-BqviZKCN.js +0 -2
- package/web/dist/assets/GroupConversation-B88Yy-lt.js +0 -3
- package/web/dist/assets/GroupConversation-BwP5NVOE.js +0 -3
- package/web/dist/assets/ModelConfigModal-Do3Fe3jH.js +0 -2
- package/web/dist/assets/SCMPanel-Hi6QqC1Q.js +0 -2
- package/web/dist/assets/SCMPanel-ezY_ZtCu.js +0 -2
- package/web/dist/assets/SettingsModal-6HgeEsJ8.js +0 -20
- package/web/dist/assets/SettingsModal-CF-7MwqS.js +0 -20
- package/web/dist/assets/app-globals-DZNa9v8u.js +0 -325
- package/web/dist/assets/index-CsFs_HMb.css +0 -1
- package/web/dist/assets/index-DHeeHS_l.js +0 -85
- package/web/dist/assets/index-DTZch8uz.js +0 -85
package/CHANGELOG.md
CHANGED
|
@@ -10,7 +10,67 @@
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.117.0] — 2026-11-06
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **随手问**:新增独立问答小窗,支持选中文字解释、连续追问、停止、重试和清空话题;可单独配置模型、思考强度、系统提示和解释模板,不读取主对话或调用工具。
|
|
18
|
+
- **群组交付闭环(内测)**:增加任务契约、上下文清单、隔离工作区和代码产物,将验证、独立验收、合入与发布恢复串联;发布结果未知时保留待核查状态。
|
|
19
|
+
- **群组与子代理详情**:黑板支持分区浏览编辑,群任务提供流水线状态和干预弹窗,子代理详情集中展示任务、运行状态、输出与工作树信息。
|
|
20
|
+
- **历史会话与导航**:左栏增加项目及对话过滤、键盘导航和页面内拖拽排序;历史会话可继续加载超过 200 条,并记住展开数量。
|
|
21
|
+
- **自动压缩附加指令**:可为自动压缩摘要配置补充要求,随预设保存和分享;留空沿用默认摘要。
|
|
22
|
+
- **主题与 Hub 维护入口**:新增 flow-cristallo、flow-ink、flow-obsidian、flow-zurich 四套主题;设备中心可更新 Hub 服务配置并重启,应用本机已安装版本。
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **群任务可靠性**:以事务日志统一任务状态及终态收口,修复重连、重复结果和旧执行影响后续任务的问题;旧版未确认结果通过幂等确认或持久隔离处理,避免升级后反复断线。
|
|
27
|
+
- **交付恢复**:持久记录发布意图及结果,增加结果回查、取消隔离和 owner 恢复门禁;无法确认旧执行已停止时保留隔离。
|
|
28
|
+
- **Docker 与定时任务**:修复容器启动路径、随包资源和数据目录权限;修复下次触发时间过期、执行重叠及长任务影响其他排期,后台任务超时后中止对应会话。
|
|
29
|
+
- **问卷与 Claude Code**:修复重连或会话过户后的问卷答复失效、重复弹出,以及部分工具事件遗漏或重复展示;选择官方模型时不再注入应用内第三方服务凭据。
|
|
30
|
+
- **插件 SDK**:拆分服务端、浏览器和测试入口,修复浏览器加载 Node 依赖导致插件视图空白;已有插件可运行 pi-web-ui plugin upgrade-sdk 更新。
|
|
31
|
+
- **历史加载与分发卫生**:修复历史预览切换完整会话时重复挂载与闪烁、浏览历史挤占运行名额,以及清理过期客户端时丢失最近项目的问题;脱敏公开文档中的主机地址,排除 dist 根目录临时文件及已删除源码的旧编译文件进入 npm 包。
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- 优化大会话扫描、历史打开与列表加载,减少对其他客户端操作的阻塞;最近项目上限由 30 提升至 100,会话重命名失焦即可保存。
|
|
36
|
+
- 左栏项目在页面打开期间保持位置稳定,拖拽顺序仅对本次页面有效;刷新后按最近使用重排。
|
|
37
|
+
- 插件 SDK 升级至 0.3.0,脚手架与 SDK 升级工具同步适配入口拆分;SFTP 插件及页面选择扩展的文档示例完成脱敏并递增版本。
|
|
38
|
+
- 随手问收起后保留当前页面的内存上下文,刷新后清空;群组工作区与进程监督用于协作隔离,不提供操作系统安全沙盒。
|
|
39
|
+
|
|
40
|
+
### i18n
|
|
41
|
+
|
|
42
|
+
- 前端新增 key(49):`newChatAction`、`newChatInCurrentProjectTip`、`deviceSetupUpdate`、`deviceSetupUpdating`、`deviceSetupUpdateSuccess`、`deviceHubUpgradeAction`、`deviceHubUpgrading`、`deviceHubConfirmUpgrade`、`deviceHubUpgradeSuccess`、`lpShowMore`、`lpCollapsedHistory`、`lpBadgeFork`、`lpBadgeScheduler`、`lpChannelWechat`、`lpChannelFeishu`、`lpChannelDingtalk`、`lpOpenOnDesktopTip`、`lpFilterPlaceholder`、`lpFilterNoMatch`、`lpFilterClear`、`lpProjectsTree`、`lpDragToReorder`、`quickAskSettingsTitle`、`quickAskSettingsDesc`、`quickAskEnabled`、`quickAskEnabledHint`、`quickAskModel`、`quickAskFollowModel`、`quickAskThinking`、`quickAskSystemPrompt`、`quickAskSystemPromptHint`、`quickAskExplainPrompt`、`quickAskExplainPromptHint`、`quickAskResetExplainPrompt`、`quickAskOpen`、`quickAskTitle`、`quickAskPlaceholder`、`quickAskSend`、`quickAskNewTopic`、`quickAskEmpty`、`quickAskStop`、`quickAskStopped`、`quickAskClose`、`quickAskLoading`、`quickAskError`、`quickAskRetry`、`quickAskInputLabel`、`explainSelection`、`selectionExplainEmpty`
|
|
43
|
+
- 前端删除 key(1):`waitingQuestionShort`
|
|
44
|
+
|
|
45
|
+
## [0.116.0] — 2026-11-05
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
|
|
49
|
+
- **群组出站 Webhook 支持**:设备中心群组新增 Webhook 外部通知支持,可订阅群消息(`message`)、任务完成(`task_completed`)、任务失败(`task_failed`)与投递事件;支持配置 HMAC-SHA256 签名密钥(`X-Pi-Signature`),并提供连通性测试与 5 秒隔离超时保护。
|
|
50
|
+
- **对话图片高清灯箱(Image Lightbox)**:点击聊天消息中的图片可一键唤起独立灯箱浮层,支持原图缩放、平移浏览、自适应居中与下载,大幅提升大图细节审阅体验。
|
|
51
|
+
- **代码块快捷运行到终端**:在助手生成的 Shell/可执行代码块右上角新增「在终端运行」按钮,点击可直接发送至内置交互终端执行,简化复制执行链路。
|
|
52
|
+
- **会话时间分组与未读标记**:左侧栏历史会话按今天、昨天、过去一周及更早进行时间聚类;后台完成任务的会话提供醒目的未读徽标与状态追踪,多任务并行不迷路。
|
|
53
|
+
- **LX-Music 音乐插件全面重构**:升级流媒体代理与 User API 脚本虚拟机,支持载入外部音源脚本、高品质音频代理试听、排行榜单检索与播放控制。
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
- **禁止服务端热路径同步子进程**(#830):全量清理服务端热路径上的 `spawnSync`/`execSync` 调用,解决 Windows 全局 npm 根目录探测阻塞事件循环的问题,新增严格的门禁回归守卫。
|
|
58
|
+
- **并发通信与连带生命周期修复**(#828、#829、#832、#833、#834):修复组件终端通信更新、worktree 状态同步、中断时连带停止子代理、排队消息防丢以及设备中心协作去重展示。
|
|
59
|
+
- **未授权访问与启动引导优化**:新增格式化启动横幅与未授权访问友好说明页,提升多宿主反代与外网访问配置体验。
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
|
|
63
|
+
- 设备中心协作策略配置升级:支持细粒度调整饿死防范时间、任务调度深度、工作区文件同步字节上限与资源锁默认 TTL。
|
|
64
|
+
|
|
13
65
|
<!-- auto-i18n:start -->
|
|
66
|
+
|
|
67
|
+
### i18n
|
|
68
|
+
|
|
69
|
+
- 前端新增 key(76):`runInTerminal`、`executedInTerminal`、`engineUninstall`、`engineUninstalling`、`engineUninstallConfirm`、`engineUninstallTip`、`engineActiveNoUninstall`、`scheduledTaskBadge`、`schedulerViewTip`、`waitingQuestionShort`、`tabRunning`、`completedUnreadBadge`、`completedUnreadTooltip`、`tabProjects`、`deviceGroups`、`createGroup`、`timeGroupToday`、`timeGroupYesterday`、`timeGroupPastWeek`、`timeGroupEarlier`、`questionQueuedOffline`、`thinkingConfigTitle`、`thinkingConfigBtn`、`thinkingCustomized`、`thinkingQuickApply`、`thinkingResetDefault`、`thinkingFixedNotice`、`thinkingFormatLabel`、`thinkingRawBodyLabel`、`thinkingCustomBudgetBtn`、`thinkingCustomBudgetPlaceholder`、`thinkingCustomBudgetTitle`、`tpl.sk.clarify`、`tpl.sk.clarify.desc`、`tpl.sk.clarify.prompt`、`tpl.sk.toplan`、`tpl.sk.toplan.desc`、`tpl.sk.toplan.prompt`、`loadingSessions`、`noSessionsYet`、`deviceExecSchedulingTitle`、`deviceExecStarvationMs`、`deviceExecStarvationMsHint`、`deviceExecMaxSkips`、`deviceExecMaxSkipsHint`、`deviceExecDispatchTitle`、`deviceExecMaxDepth`、`deviceExecMaxDepthHint`、`deviceExecMaxBudget`、`deviceExecMaxBudgetHint`、`deviceExecAllowBotMentions`、`deviceExecAllowBotMentionsHint`、`deviceExecContextTitle`、`deviceExecContextBytes`、`deviceExecContextBytesHint`、`deviceExecRetention`、`deviceExecRetentionHint`、`deviceExecFileSyncTitle`、`deviceExecFileSyncBytes`、`deviceExecFileSyncBytesHint`、`deviceExecFileSyncFiles`、`deviceExecFileSyncFilesHint`、`deviceExecFileSyncStagedBytes`、`deviceExecFileSyncStagedBytesHint`、`deviceExecLocksTitle`、`deviceExecLockTtl`、`deviceExecLockTtlHint`、`deviceExecBlackboardBytes`、`deviceExecBlackboardBytesHint`、`deviceExecResetDefaults`、`deviceExecResetDefaultsTip`、`promptTok_plugin_dev`、`promptTok_plugin_dev_desc`、`settingsDeviceCollab`、`settingsDeviceCollabHint`、`sandboxNewShort`
|
|
70
|
+
- 前端删除 key(81):`ephemeralBadge`、`thinkingUnsupported`、`manageProjects`、`elsewherePseudoTip`、`subagentBadgeCount`、`subagentsStreamingTip`、`subagentsQuestionTip`、`subagentsErrorTip`、`subagentsCountTip`、`convErrorBadge`、`tuiTip`、`forkedSessionBadge`、`forkedSessionTip`、`dismissFinishedOnly`、`forkBadge`、`forkBadgeTip`、`tpl.newTitle`、`tpl.editTitle`、`tpl.fieldTitle`、`tpl.sk.setup`、`tpl.sk.setup.desc`、`tpl.sk.setup.prompt`、`tpl.sk.ask`、`tpl.sk.ask.desc`、`tpl.sk.ask.prompt`、`tpl.sk.grilldocs`、`tpl.sk.grilldocs.desc`、`tpl.sk.grilldocs.prompt`、`tpl.sk.tospec`、`tpl.sk.tospec.desc`、`tpl.sk.tospec.prompt`、`tpl.sk.totickets`、`tpl.sk.wayfinder`、`tpl.sk.wayfinder.desc`、`tpl.sk.wayfinder.prompt`、`tpl.sk.arch`、`tpl.sk.arch.desc`、`tpl.sk.arch.prompt`、`tpl.sk.triage`、`tpl.sk.triage.desc`、`tpl.sk.triage.prompt`、`tpl.sk.wizard`、`tpl.sk.wizard.desc`、`tpl.sk.wizard.prompt`、`tpl.sk.grillme`、`tpl.sk.grillme.desc`、`tpl.sk.grillme.prompt`、`tpl.sk.handoff`、`tpl.sk.handoff.desc`、`tpl.sk.handoff.prompt`、`tpl.sk.questionnaire`、`tpl.sk.questionnaire.desc`、`tpl.sk.questionnaire.prompt`、`tpl.sk.teach`、`tpl.sk.teach.desc`、`tpl.sk.teach.prompt`、`tpl.sk.ww`、`tpl.sk.ww.desc`、`tpl.sk.ww.prompt`、`tpl.sk.wfa`、`tpl.sk.wfa.desc`、`tpl.sk.wfa.prompt`、`tpl.sk.codesign`、`tpl.sk.codesign.desc`、`tpl.sk.codesign.prompt`、`tpl.sk.domain`、`tpl.sk.domain.desc`、`tpl.sk.domain.prompt`、`tpl.sk.grilling`、`tpl.sk.grilling.desc`、`tpl.sk.grilling.prompt`、`tpl.sk.tdd`、`tpl.sk.tdd.desc`、`tpl.sk.tdd.prompt`、`deviceSetupNext`、`deviceSetupNextHint`、`deviceSetupManage`、`deviceHubOverview`、`deviceHubSettings`、`deviceHubGroups`、`sandboxNewBtn`
|
|
71
|
+
- 前端中文变更(13):`historySessions`、`openHistory`、`tpl.sk.implement`、`tpl.sk.implement.desc`、`tpl.sk.implement.prompt`、`tpl.sk.codeview.desc`、`tpl.sk.codeview.prompt`、`tpl.sk.prototype.prompt`、`tpl.sk.research.prompt`、`tpl.sk.debug.prompt`、`tpl.sk.merge.prompt`、`deviceExecMaxActive`、`deviceExecMaxWaiting`
|
|
72
|
+
- 前端英文变更(12):`tpl.sk.implement`、`tpl.sk.implement.desc`、`tpl.sk.implement.prompt`、`tpl.sk.codeview.desc`、`tpl.sk.codeview.prompt`、`tpl.sk.debug`、`tpl.sk.debug.desc`、`tpl.sk.debug.prompt`、`tpl.sk.merge.desc`、`tpl.sk.merge.prompt`、`deviceExecMaxActive`、`deviceExecMaxWaiting`
|
|
73
|
+
|
|
14
74
|
<!-- auto-i18n:end -->
|
|
15
75
|
|
|
16
76
|
## [0.115.0] — 2026-11-02
|
|
@@ -34,6 +94,7 @@
|
|
|
34
94
|
- 设备中心后台同步:无随包清单的旧插件首次升级不再清理旧文件(残留文件不会被加载,但也不会被删)。
|
|
35
95
|
|
|
36
96
|
<!-- auto-i18n:start -->
|
|
97
|
+
|
|
37
98
|
### i18n
|
|
38
99
|
|
|
39
100
|
- 前端新增 key(55):`leftPanelGroups`、`questionAutoSubmitLast`、`questionPickSubmits`、`localBotToolHighPrivilege`、`localBotToolUnsupportedPlatform`、`deviceExecTitle`、`deviceExecSubtitle`、`deviceExecRefresh`、`deviceExecRunning`、`deviceExecQueued`、`deviceExecBlocked`、`deviceExecQuotaTitle`、`deviceExecMaxActive`、`deviceExecMaxActiveHint`、`deviceExecMaxWaiting`、`deviceExecMaxWaitingHint`、`deviceExecReset`、`deviceExecSave`、`deviceExecSaving`、`deviceExecSavedNotice`、`deviceExecBlockedTitle`、`deviceExecBlockedDesc`、`deviceExecActiveTasks`、`deviceExecNoActive`、`deviceExecWaitingQueue`、`deviceExecNoWaiting`、`deviceExecPosition`、`deviceExecReason`、`deviceExecQueuedTime`、`deviceExecActions`、`deviceExecCancel`、`deviceExecCancelling`、`deviceExecTaskCancelled`、`deviceExecReasonMaxConcurrency`、`deviceExecReasonBotBusy`、`deviceExecReasonWorkspaceConflict`、`deviceExecReasonWorkspaceBlocked`、`deviceExecReasonFairness`、`skillsMaxFileBytes`、`skillsMaxFileBytesTip`、`skillsFullTextMaxBytes`、`skillsFullTextMaxBytesTip`、`worktreeViewTitle`、`worktreeEntryTip`、`worktreeBackToChat`、`worktreeRefresh`、`worktreeViewHint`、`worktreeEmpty`、`worktreeDetached`、`worktreeCurrent`、`worktreeMain`、`worktreeHasChanges`、`worktreeClean`、`worktreeSwitch`、`worktreeManage`
|
|
@@ -41,6 +102,7 @@
|
|
|
41
102
|
- 前端中文变更(2):`dismissFinishedOnly`、`dismissForceAll`
|
|
42
103
|
- 前端英文变更(2):`dismissFinishedOnly`、`dismissForceAll`
|
|
43
104
|
- 服务端文案变更(1):`subagents.spawn.started`
|
|
105
|
+
|
|
44
106
|
<!-- auto-i18n:end -->
|
|
45
107
|
|
|
46
108
|
## [0.114.3] — 2026-10-31
|
|
@@ -1603,7 +1665,7 @@ when?, children?}`,也收 `topbar` / `settings` 这类简写别名);宿主
|
|
|
1603
1665
|
|
|
1604
1666
|
### Added
|
|
1605
1667
|
|
|
1606
|
-
- **page-picker 扩展:在 pi-web-ui 页面上点一下图标就能绑定服务地址**——远程/局域网部署时地址是 `http://
|
|
1668
|
+
- **page-picker 扩展:在 pi-web-ui 页面上点一下图标就能绑定服务地址**——远程/局域网部署时地址是 `http://203.0.113.10:8787` 这种、端口也不固定,原来只能去选项页手打地址再点「授权该地址」。现在点扩展图标会**先认当前页**:页面上有宿主动作桥 `__piWebUiHost` 即认定,老版本则退一步探一次同源 `/api/health`(`{ok, piVersion}` 才算数,所以任何「所有路径都回 200」的站点都不会被误认);认出是 pi-web-ui 就在页面底部弹浮条问「要不要把它设为拾取服务地址」,点一下即可(地址/端口/子路径全部按当前页面算,`?token=`、hash、尾斜杠都会归一掉),已经是当前地址时只说明现状不再多问,浮条上另有「在本页拾取元素」(开发 pi-web-ui 自己时用得上)。缺那一个 origin 的授权时,浮条会提示并给一个「打开设置页授权」按钮 —— `chrome.permissions.request` 必须在扩展自己的页面里点(网页上的按钮给不了浏览器要的手势),那个页面带 `?bind=` 预填地址、一键授权 + 绑定。**普通页面点图标的行为一点没变**(仍是进入拾取模式),也**绝不静默改地址**(改前一定在页面上问一次)。回归:`detectPiWebUi`/`bindView` 单测 + service worker 分流单测 + `?bind=` 面板单测(真 options.html)+ E2E(真 pi-web-ui 页 / 真夹具页各自认定 + 浮条绑定后照常投递)。
|
|
1607
1669
|
|
|
1608
1670
|
## [0.81.0] — 2026-09-12
|
|
1609
1671
|
|
|
@@ -2189,7 +2251,8 @@ when?, children?}`,也收 `topbar` / `settings` 这类简写别名);宿主
|
|
|
2189
2251
|
[0.90.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.90.1
|
|
2190
2252
|
[0.90.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.90.0
|
|
2191
2253
|
[0.89.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.89.0
|
|
2192
|
-
[Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.
|
|
2254
|
+
[Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.117.0...main
|
|
2255
|
+
[0.117.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.117.0
|
|
2193
2256
|
[0.88.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.88.0
|
|
2194
2257
|
[0.87.2]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.2
|
|
2195
2258
|
[0.87.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.1
|
package/bin/device-hub-cli.mjs
CHANGED
|
@@ -18,11 +18,12 @@ import { setTimeout as delay, setImmediate as yieldImmediate } from "node:timers
|
|
|
18
18
|
import { join, resolve } from "node:path";
|
|
19
19
|
import { fileURLToPath } from "node:url";
|
|
20
20
|
|
|
21
|
-
export const HUB_HELP = `Usage: pi-web-ui hub [install|start|stop|restart|status|uninstall] [options]
|
|
21
|
+
export const HUB_HELP = `Usage: pi-web-ui hub [install|start|stop|restart|status|uninstall|update] [options]
|
|
22
22
|
Without a command, run in the foreground (Ctrl+C to stop).
|
|
23
23
|
Options: --host HOST --port PORT --public-url URL --data-dir PATH
|
|
24
24
|
--allow-registration[=true|false] --help
|
|
25
25
|
install saves configuration, enables login autostart and starts the Hub.
|
|
26
|
+
update updates the service definition with current paths and restarts the Hub.
|
|
26
27
|
Other lifecycle commands use the saved configuration; status accepts --json.
|
|
27
28
|
Close registration after the first account: hub restart --allow-registration=false
|
|
28
29
|
Only that saved setting changes; all other settings are retained.
|
|
@@ -40,7 +41,7 @@ const optionalEnv = ["DEVICE_DOMAIN", "PATH_ACCESS", "PORTAL_PORTS"];
|
|
|
40
41
|
export function parseHubArgs(argv, env = process.env) {
|
|
41
42
|
const args = [...argv];
|
|
42
43
|
const command = args[0] && !args[0].startsWith("-") ? args.shift() : "foreground";
|
|
43
|
-
if (!["foreground", "install", "start", "stop", "restart", "status", "uninstall"].includes(command))
|
|
44
|
+
if (!["foreground", "install", "start", "stop", "restart", "status", "uninstall", "update"].includes(command))
|
|
44
45
|
throw new Error(`Unknown Hub command: ${command}`);
|
|
45
46
|
const values = {};
|
|
46
47
|
if (command === "status" && args.length === 1 && args[0] === "--json") return { command, json: true };
|
|
@@ -138,6 +139,10 @@ export function hubServicePlan({
|
|
|
138
139
|
start: [["--user", "start", UNIT]],
|
|
139
140
|
stop: [["--user", "stop", UNIT]],
|
|
140
141
|
restart: [["--user", "restart", UNIT]],
|
|
142
|
+
update: [
|
|
143
|
+
["--user", "daemon-reload"],
|
|
144
|
+
["--user", "restart", UNIT],
|
|
145
|
+
],
|
|
141
146
|
status: [["--user", "show", UNIT, "--property=ActiveState,SubState,UnitFileState"]],
|
|
142
147
|
uninstall: [["--user", "disable", "--now", UNIT]],
|
|
143
148
|
},
|
|
@@ -159,6 +164,10 @@ export function hubServicePlan({
|
|
|
159
164
|
["bootout", target],
|
|
160
165
|
["bootstrap", `gui/${uid}`, file],
|
|
161
166
|
],
|
|
167
|
+
update: [
|
|
168
|
+
["bootout", target],
|
|
169
|
+
["bootstrap", `gui/${uid}`, file],
|
|
170
|
+
],
|
|
162
171
|
status: [["print", target]],
|
|
163
172
|
uninstall: [["bootout", target]],
|
|
164
173
|
},
|
|
@@ -184,6 +193,11 @@ export function hubServicePlan({
|
|
|
184
193
|
["/End", "/TN", TASK],
|
|
185
194
|
["/Run", "/TN", TASK],
|
|
186
195
|
],
|
|
196
|
+
update: [
|
|
197
|
+
["/End", "/TN", TASK],
|
|
198
|
+
["/Create", "/TN", TASK, "/XML", join(root, "task.xml"), "/F"],
|
|
199
|
+
["/Run", "/TN", TASK],
|
|
200
|
+
],
|
|
187
201
|
status: [["/Query", "/TN", TASK, "/V", "/FO", "LIST"]],
|
|
188
202
|
uninstall: [
|
|
189
203
|
["/End", "/TN", TASK],
|
|
@@ -499,6 +513,15 @@ export async function runHubCli(
|
|
|
499
513
|
);
|
|
500
514
|
} else if (!existsSync(plan.config))
|
|
501
515
|
throw new Error("Hub service is not installed. Run pi-web-ui hub install first.");
|
|
516
|
+
if (command === "update") {
|
|
517
|
+
const settings = JSON.parse(readFileSync(plan.config, "utf8"));
|
|
518
|
+
validateSettings(settings);
|
|
519
|
+
mkdirSync(resolve(plan.file, ".."), { recursive: true });
|
|
520
|
+
atomicWrite(
|
|
521
|
+
plan.file,
|
|
522
|
+
process.platform === "win32" ? Buffer.from(`\uFEFF${plan.content}`, "utf16le") : plan.content,
|
|
523
|
+
);
|
|
524
|
+
}
|
|
502
525
|
signal?.throwIfAborted();
|
|
503
526
|
if (parsed.registration !== undefined) {
|
|
504
527
|
const settings = JSON.parse(readFileSync(plan.config, "utf8"));
|
|
@@ -531,7 +554,7 @@ export async function runHubCli(
|
|
|
531
554
|
if (plan.manager === "systemctl") run(plan.manager, ["--user", "daemon-reload"]);
|
|
532
555
|
unlinkSync(plan.config);
|
|
533
556
|
}
|
|
534
|
-
if (["install", "start", "restart"].includes(command)) {
|
|
557
|
+
if (["install", "start", "restart", "update"].includes(command)) {
|
|
535
558
|
const settings = JSON.parse(readFileSync(plan.config, "utf8"));
|
|
536
559
|
await waitForHub(settings, signal);
|
|
537
560
|
}
|
package/bin/pi-web-ui.mjs
CHANGED
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
readdirSync,
|
|
52
52
|
renameSync,
|
|
53
53
|
rmSync,
|
|
54
|
+
statSync,
|
|
54
55
|
writeFileSync,
|
|
55
56
|
} from "node:fs";
|
|
56
57
|
import { homedir, networkInterfaces, tmpdir, userInfo } from "node:os";
|
|
@@ -443,6 +444,24 @@ function openBrowserWhenUp(url) {
|
|
|
443
444
|
attempt();
|
|
444
445
|
}
|
|
445
446
|
|
|
447
|
+
function loadStoredFileToken(dataDir) {
|
|
448
|
+
try {
|
|
449
|
+
const raw = readFileSync(join(dataDir, "server-config.json"), "utf8");
|
|
450
|
+
const parsed = JSON.parse(raw);
|
|
451
|
+
if (typeof parsed?.token === "string" && parsed.token.trim()) return parsed.token.trim();
|
|
452
|
+
} catch {
|
|
453
|
+
/* ignore */
|
|
454
|
+
}
|
|
455
|
+
return "";
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function resolveCliAuthToken(opts) {
|
|
459
|
+
const envToken = (process.env.PI_WEB_TOKEN || "").trim();
|
|
460
|
+
if (envToken) return envToken;
|
|
461
|
+
const dataDir = resolve(opts?.dataDir ?? process.env.PI_WEB_DATA_DIR ?? join(homedir(), ".pi-web"));
|
|
462
|
+
return loadStoredFileToken(dataDir);
|
|
463
|
+
}
|
|
464
|
+
|
|
446
465
|
async function startForeground(opts) {
|
|
447
466
|
if (opts.port) process.env.PI_WEB_PORT = opts.port;
|
|
448
467
|
if (opts.cwd) process.env.PI_WEB_CWD = resolve(opts.cwd);
|
|
@@ -458,7 +477,9 @@ async function startForeground(opts) {
|
|
|
458
477
|
}
|
|
459
478
|
if (opts.host) process.env.PI_WEB_HOST = opts.host;
|
|
460
479
|
if (opts.agentDir) process.env.PI_CODING_AGENT_DIR = resolve(opts.agentDir);
|
|
461
|
-
const
|
|
480
|
+
const token = resolveCliAuthToken(opts);
|
|
481
|
+
const tokenQuery = token ? `?token=${encodeURIComponent(token)}` : "";
|
|
482
|
+
const url = `http://localhost:${effectivePort(opts)}${tokenQuery}`;
|
|
462
483
|
if (HAS_SDK_HOOK) await import(pathToFileURL(SDK_HOOK).href);
|
|
463
484
|
try {
|
|
464
485
|
await import(pathToFileURL(SERVER_ENTRY).href);
|
|
@@ -3129,9 +3150,14 @@ async function installCatalogCmd(opts) {
|
|
|
3129
3150
|
/** 脚手架模板:minimal(零权限)| ui-slot | agent-tool | renderer(view:false)。 */
|
|
3130
3151
|
const PLUGIN_TEMPLATES = ["minimal", "ui-slot", "agent-tool", "renderer"];
|
|
3131
3152
|
|
|
3132
|
-
/** 随包发布的 plugin-sdk
|
|
3133
|
-
|
|
3134
|
-
|
|
3153
|
+
/** 随包发布的 plugin-sdk 服务端文件:包含总入口、浏览器入口、工具函数与测试 harness。 */
|
|
3154
|
+
const PLUGIN_SDK_FILES = ["index.mjs", "client.mjs", "client-utils.mjs", "testing.mjs"];
|
|
3155
|
+
|
|
3156
|
+
/** 拷进 client/sdk/ 的浏览器 SDK 文件清单(绝不含 testing.mjs 或任何 node 依赖)。 */
|
|
3157
|
+
const PLUGIN_SDK_CLIENT_FILES = ["client.mjs", "client-utils.mjs"];
|
|
3158
|
+
|
|
3159
|
+
/** 浏览器端 client/sdk/index.mjs 的兼容入口内容(保证已有客户端无需修改)。 */
|
|
3160
|
+
const CLIENT_SDK_INDEX_COMPAT = `export * from "./client.mjs";\n`;
|
|
3135
3161
|
|
|
3136
3162
|
/** 包内 plugin-sdk 文件清单(随包发布,见 package.json files);缺任一 = 包不完整,按「无 SDK」处理。 */
|
|
3137
3163
|
function pluginSdkSources() {
|
|
@@ -3145,9 +3171,27 @@ function pluginSdkSources() {
|
|
|
3145
3171
|
return files;
|
|
3146
3172
|
}
|
|
3147
3173
|
|
|
3148
|
-
function
|
|
3174
|
+
function copyServerSdkInto(dir, sources) {
|
|
3149
3175
|
mkdirSync(dir, { recursive: true });
|
|
3150
|
-
|
|
3176
|
+
const map = new Map(sources.map((s) => [s.name, s.src]));
|
|
3177
|
+
for (const name of PLUGIN_SDK_FILES) {
|
|
3178
|
+
const src = map.get(name);
|
|
3179
|
+
if (src && existsSync(src)) copyFileSync(src, join(dir, name));
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3183
|
+
function copyClientSdkInto(dir, sources) {
|
|
3184
|
+
mkdirSync(dir, { recursive: true });
|
|
3185
|
+
const map = new Map(sources.map((s) => [s.name, s.src]));
|
|
3186
|
+
for (const name of PLUGIN_SDK_CLIENT_FILES) {
|
|
3187
|
+
const src = map.get(name);
|
|
3188
|
+
if (src && existsSync(src)) copyFileSync(src, join(dir, name));
|
|
3189
|
+
}
|
|
3190
|
+
// 浏览器端兼容入口:export * from "./client.mjs";
|
|
3191
|
+
writeFileSync(join(dir, "index.mjs"), CLIENT_SDK_INDEX_COMPAT);
|
|
3192
|
+
// 禁止 testing.mjs 或任何 Node 依赖进 client/sdk/,若有旧残留则清理
|
|
3193
|
+
const testFile = join(dir, "testing.mjs");
|
|
3194
|
+
if (existsSync(testFile)) rmSync(testFile, { force: true });
|
|
3151
3195
|
}
|
|
3152
3196
|
|
|
3153
3197
|
/** 各模板的 manifest.description(一句话说明骨架来源)。 */
|
|
@@ -3164,7 +3208,7 @@ function scaffoldDescription(template) {
|
|
|
3164
3208
|
}
|
|
3165
3209
|
}
|
|
3166
3210
|
|
|
3167
|
-
/** 模板的客户端是否 import SDK:**除 renderer 外都 import `./sdk/
|
|
3211
|
+
/** 模板的客户端是否 import SDK:**除 renderer 外都 import `./sdk/client.mjs`**(renderer 渲染器走裸 ESM)。
|
|
3168
3212
|
* 决定 `client/sdk/` 要不要拷、README 怎么写;拷完还用 import-check 复验(模板以后改了也不漏)。 */
|
|
3169
3213
|
function templateClientUsesSdk(template) {
|
|
3170
3214
|
return template !== "renderer";
|
|
@@ -3175,7 +3219,7 @@ function templateClientUsesSdk(template) {
|
|
|
3175
3219
|
function buildPluginScaffold(id, template, useSdk, withTest = false) {
|
|
3176
3220
|
const sdkServer = useSdk ? `import { definePlugin } from "./sdk/index.mjs";\n\n` : "";
|
|
3177
3221
|
// 客户端 import 必须落在 client/ 内:宿主只暴露 /plugins/<id>/client/*(见 import-check)。
|
|
3178
|
-
const sdkClient = useSdk ? `import { defineView, onUiAction } from "./sdk/
|
|
3222
|
+
const sdkClient = useSdk ? `import { defineView, onUiAction } from "./sdk/client.mjs";\n\n` : "";
|
|
3179
3223
|
const wrapServer = (body) =>
|
|
3180
3224
|
useSdk ? `${sdkServer}export default definePlugin({\n${body}\n});\n` : `export default {\n${body}\n};\n`;
|
|
3181
3225
|
const wrapClient = (body) =>
|
|
@@ -3358,13 +3402,13 @@ function buildPluginScaffold(id, template, useSdk, withTest = false) {
|
|
|
3358
3402
|
`- \`index.mjs\` —— 服务端入口(\`export default { activate(host) }\`)\n` +
|
|
3359
3403
|
`- \`client/entry.mjs\` —— 客户端视图${template === "renderer" ? "(渲染器:`{ renderers }`)" : "(`{ mount }`)"}\n` +
|
|
3360
3404
|
(useSdk
|
|
3361
|
-
? `- \`sdk
|
|
3405
|
+
? `- \`sdk/\` —— 服务端 plugin-sdk 拷贝(\`index.mjs\`、\`client.mjs\`、\`client-utils.mjs\`、\`testing.mjs\`;\`index.mjs\` 为服务端总入口)\n`
|
|
3362
3406
|
: "") +
|
|
3363
3407
|
(useSdk && templateClientUsesSdk(template)
|
|
3364
|
-
? `- \`client/sdk/\` ——
|
|
3408
|
+
? `- \`client/sdk/\` —— 客户端 plugin-sdk 拷贝(仅 \`client.mjs\`、\`client-utils.mjs\` 及兼容入口 \`index.mjs\`):宿主只暴露 \`/plugins/<id>/client/*\`,客户端依赖必须落在 \`client/\` 内(新模板使用 \`import "./sdk/client.mjs"\`)\n`
|
|
3365
3409
|
: "") +
|
|
3366
3410
|
(withTest && useSdk
|
|
3367
|
-
? "- `index.test.mjs` —— 最小单测(`node --test index.test.mjs
|
|
3411
|
+
? "- `index.test.mjs` —— 最小单测(`node --test index.test.mjs`,从 `./sdk/testing.mjs` 导入 createMockHost harness)\n"
|
|
3368
3412
|
: "") +
|
|
3369
3413
|
`\n` +
|
|
3370
3414
|
`## 下一步\n` +
|
|
@@ -3397,7 +3441,7 @@ function buildPluginScaffold(id, template, useSdk, withTest = false) {
|
|
|
3397
3441
|
`import { describe, it } from "node:test";\n` +
|
|
3398
3442
|
`import assert from "node:assert/strict";\n` +
|
|
3399
3443
|
`import plugin from "./index.mjs";\n` +
|
|
3400
|
-
`import { createMockHost } from "./sdk/
|
|
3444
|
+
`import { createMockHost } from "./sdk/testing.mjs";\n` +
|
|
3401
3445
|
`\n` +
|
|
3402
3446
|
`describe("${id} activate", () => {\n` +
|
|
3403
3447
|
`\tit("激活不抛错,且调了 host 方法", async () => {\n` +
|
|
@@ -3479,50 +3523,48 @@ function validateScaffoldManifest(manifest, dirName) {
|
|
|
3479
3523
|
return warnings;
|
|
3480
3524
|
}
|
|
3481
3525
|
|
|
3482
|
-
/**
|
|
3483
|
-
function installedSdkVersion(
|
|
3526
|
+
/** 已装插件目录或文件里解析 SDK_VERSION(新单源在 client.mjs,兼容旧版在 index.mjs;老拷贝无此常量 → null)。 */
|
|
3527
|
+
function installedSdkVersion(dirOrFile) {
|
|
3484
3528
|
try {
|
|
3485
|
-
const
|
|
3486
|
-
const
|
|
3487
|
-
|
|
3529
|
+
const isDir = statSync(dirOrFile).isDirectory();
|
|
3530
|
+
const dir = isDir ? dirOrFile : dirname(dirOrFile);
|
|
3531
|
+
for (const name of ["client.mjs", "index.mjs"]) {
|
|
3532
|
+
const file = join(dir, name);
|
|
3533
|
+
if (existsSync(file)) {
|
|
3534
|
+
const src = readFileSync(file, "utf8");
|
|
3535
|
+
const m = src.match(/SDK_VERSION\s*=\s*["']([^"']+)["']/);
|
|
3536
|
+
if (m) return m[1];
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
return null;
|
|
3488
3540
|
} catch {
|
|
3489
3541
|
return null;
|
|
3490
3542
|
}
|
|
3491
3543
|
}
|
|
3492
3544
|
|
|
3493
|
-
/** 包内 SDK
|
|
3545
|
+
/** 包内 SDK 版本(新单源:plugin-sdk/client.mjs 的 `export const SDK_VERSION`,兼容旧版 index.mjs)。 */
|
|
3494
3546
|
function packageSdkVersion() {
|
|
3495
3547
|
const sources = pluginSdkSources();
|
|
3496
|
-
|
|
3497
|
-
if (!sdkSrc)
|
|
3498
|
-
fail(
|
|
3499
|
-
ZH
|
|
3500
|
-
? `包内无 plugin-sdk(找不到 plugin-sdk/index.mjs),无法刷新`
|
|
3501
|
-
: `No plugin-sdk in package (plugin-sdk/index.mjs not found), cannot refresh`,
|
|
3502
|
-
);
|
|
3503
|
-
let src;
|
|
3504
|
-
try {
|
|
3505
|
-
src = readFileSync(sdkSrc, "utf8");
|
|
3506
|
-
} catch {
|
|
3548
|
+
if (!sources) {
|
|
3507
3549
|
fail(
|
|
3508
|
-
ZH
|
|
3509
|
-
? `包内 plugin-sdk/index.mjs 不可读,无法刷新`
|
|
3510
|
-
: `plugin-sdk/index.mjs in package is unreadable, cannot refresh`,
|
|
3550
|
+
ZH ? `包内无完整 plugin-sdk(缺少必要 SDK 文件),无法刷新` : `No complete plugin-sdk in package, cannot refresh`,
|
|
3511
3551
|
);
|
|
3512
3552
|
}
|
|
3513
|
-
const
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
}
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3553
|
+
const clientSrc = sources.find((f) => f.name === "client.mjs")?.src;
|
|
3554
|
+
const indexSrc = sources.find((f) => f.name === "index.mjs")?.src;
|
|
3555
|
+
for (const candidate of [clientSrc, indexSrc]) {
|
|
3556
|
+
if (!candidate || !existsSync(candidate)) continue;
|
|
3557
|
+
try {
|
|
3558
|
+
const src = readFileSync(candidate, "utf8");
|
|
3559
|
+
const m = src.match(/export const SDK_VERSION\s*=\s*["']([^"']+)["']/);
|
|
3560
|
+
if (m) return { version: m[1], file: candidate, sources };
|
|
3561
|
+
} catch {}
|
|
3562
|
+
}
|
|
3563
|
+
fail(
|
|
3564
|
+
ZH
|
|
3565
|
+
? `包内 plugin-sdk 无 SDK_VERSION 导出,无法刷新(请升级 pi-web-ui)`
|
|
3566
|
+
: `plugin-sdk in package has no SDK_VERSION export, cannot refresh (please upgrade pi-web-ui)`,
|
|
3567
|
+
);
|
|
3526
3568
|
}
|
|
3527
3569
|
|
|
3528
3570
|
/** 静态 import 自检问题的双语文案(create / upgrade-sdk 共用)。 */
|
|
@@ -3581,43 +3623,88 @@ async function pluginUpgradeSdkCmd(argv) {
|
|
|
3581
3623
|
const broken = [];
|
|
3582
3624
|
for (const id of targets) {
|
|
3583
3625
|
const pluginDir = join(parentDir, id);
|
|
3584
|
-
|
|
3585
|
-
|
|
3626
|
+
const serverSdkDir = join(pluginDir, "sdk");
|
|
3627
|
+
const clientSdkDir = join(pluginDir, "client", "sdk");
|
|
3628
|
+
const hasServerSdk = existsSync(serverSdkDir);
|
|
3629
|
+
const hasClientSdk = existsSync(clientSdkDir);
|
|
3630
|
+
|
|
3631
|
+
// 客户端侧缺失但代码确实 import ./sdk/ → 补建(修好 issue #546 之前生成的插件)。
|
|
3632
|
+
let wantsClientSdk = false;
|
|
3633
|
+
if (!hasClientSdk) {
|
|
3634
|
+
wantsClientSdk =
|
|
3635
|
+
importCheck?.scanPluginImports(pluginDir).some((r) => r.client && r.target.startsWith("client/sdk/")) ?? false;
|
|
3636
|
+
}
|
|
3637
|
+
|
|
3638
|
+
if (!hasServerSdk && !hasClientSdk && !wantsClientSdk) {
|
|
3586
3639
|
skipped++;
|
|
3587
3640
|
console.log(ZH ? `- ${id}:无 sdk/ 拷贝,跳过` : `- ${id}: no sdk/ copy, skipping`);
|
|
3588
3641
|
continue;
|
|
3589
3642
|
}
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
}
|
|
3643
|
+
|
|
3644
|
+
// 分别检测服务/客户端版本与缺文件
|
|
3645
|
+
let serverStale = false;
|
|
3646
|
+
if (hasServerSdk) {
|
|
3647
|
+
const missingFiles = PLUGIN_SDK_FILES.some((name) => !existsSync(join(serverSdkDir, name)));
|
|
3648
|
+
const ver = installedSdkVersion(serverSdkDir);
|
|
3649
|
+
serverStale = missingFiles || ver !== latest;
|
|
3598
3650
|
}
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3651
|
+
|
|
3652
|
+
let clientStale = false;
|
|
3653
|
+
if (wantsClientSdk) {
|
|
3654
|
+
clientStale = true;
|
|
3655
|
+
healed.push(id);
|
|
3656
|
+
} else if (hasClientSdk) {
|
|
3657
|
+
const missingFiles = PLUGIN_SDK_CLIENT_FILES.some((name) => !existsSync(join(clientSdkDir, name)));
|
|
3658
|
+
const ver = installedSdkVersion(clientSdkDir);
|
|
3659
|
+
const compatFile = join(clientSdkDir, "index.mjs");
|
|
3660
|
+
const compatOk =
|
|
3661
|
+
existsSync(compatFile) && readFileSync(compatFile, "utf8").trim() === CLIENT_SDK_INDEX_COMPAT.trim();
|
|
3662
|
+
const hasTestingResidual = existsSync(join(clientSdkDir, "testing.mjs"));
|
|
3663
|
+
clientStale = missingFiles || ver !== latest || !compatOk || hasTestingResidual;
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3666
|
+
if (!serverStale && !clientStale) {
|
|
3603
3667
|
fresh++;
|
|
3604
3668
|
console.log(ZH ? `✔ ${id}:已是最新(SDK ${latest})` : `✔ ${id}: already up to date (SDK ${latest})`);
|
|
3605
3669
|
continue;
|
|
3606
3670
|
}
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
(
|
|
3611
|
-
|
|
3612
|
-
|
|
3671
|
+
|
|
3672
|
+
const cur =
|
|
3673
|
+
(hasServerSdk ? installedSdkVersion(serverSdkDir) : null) ??
|
|
3674
|
+
(hasClientSdk ? installedSdkVersion(clientSdkDir) : null);
|
|
3675
|
+
|
|
3676
|
+
const updatedDirs = [];
|
|
3677
|
+
if (hasServerSdk) {
|
|
3678
|
+
copyServerSdkInto(serverSdkDir, sources);
|
|
3679
|
+
updatedDirs.push(serverSdkDir);
|
|
3680
|
+
}
|
|
3681
|
+
if (hasClientSdk || wantsClientSdk) {
|
|
3682
|
+
copyClientSdkInto(clientSdkDir, sources);
|
|
3683
|
+
updatedDirs.push(clientSdkDir);
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
const bad = [];
|
|
3687
|
+
for (const d of updatedDirs) {
|
|
3688
|
+
const isClientDir = d === clientSdkDir;
|
|
3689
|
+
const checkFiles = isClientDir ? ["index.mjs", "client.mjs"] : ["index.mjs", "client.mjs", "testing.mjs"];
|
|
3690
|
+
for (const f of checkFiles) {
|
|
3691
|
+
const full = join(d, f);
|
|
3692
|
+
if (existsSync(full)) {
|
|
3693
|
+
const r = spawnSync(NODE, ["--check", full], { stdio: "ignore" });
|
|
3694
|
+
if (r.status !== 0) bad.push(full);
|
|
3695
|
+
}
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3698
|
+
|
|
3699
|
+
if (bad.length > 0) {
|
|
3613
3700
|
broken.push(
|
|
3614
3701
|
ZH
|
|
3615
3702
|
? `${bad.join("、")} 未通过 node --check(磁盘/权限异常?请手动检查)`
|
|
3616
3703
|
: `${bad.join(", ")} failed node --check (disk/permission issue? please check manually)`,
|
|
3617
3704
|
);
|
|
3618
|
-
else {
|
|
3705
|
+
} else {
|
|
3619
3706
|
upgraded++;
|
|
3620
|
-
const where =
|
|
3707
|
+
const where = updatedDirs.map((d) => (d === serverSdkDir ? "sdk/" : "client/sdk/")).join(" + ");
|
|
3621
3708
|
console.log(
|
|
3622
3709
|
ZH
|
|
3623
3710
|
? `✔ ${id}:SDK ${cur ?? "未知旧版"} → ${latest}(${where})`
|
|
@@ -3680,15 +3767,16 @@ async function pluginCreateCmd(argv) {
|
|
|
3680
3767
|
const useSdk = Boolean(sdkSources);
|
|
3681
3768
|
const wantTest = opts.withTest === true;
|
|
3682
3769
|
const files = buildPluginScaffold(id, template, useSdk, wantTest && useSdk);
|
|
3683
|
-
if (useSdk)
|
|
3770
|
+
if (useSdk) copyServerSdkInto(join(target, "sdk"), sdkSources);
|
|
3684
3771
|
for (const [rel, content] of Object.entries(files)) writeFileSync(join(target, rel), content);
|
|
3685
3772
|
// 客户端侧的相对依赖必须落在 client/ 内(宿主只暴露 /plugins/<id>/client/*):生成文件里
|
|
3686
3773
|
// 引到 client/ 内的 SDK 就把 SDK 也拷进 client/sdk/(renderer 模板客户端不用 SDK,不白拷)。
|
|
3687
3774
|
const importCheck = await loadImportCheck();
|
|
3688
|
-
if (useSdk
|
|
3775
|
+
if (useSdk) {
|
|
3689
3776
|
// 模板按约定先拷(renderer 除外),再用扫描复验一遍 —— 模板以后加了客户端 SDK 引用也不会漏。
|
|
3690
|
-
const scanned =
|
|
3691
|
-
|
|
3777
|
+
const scanned =
|
|
3778
|
+
importCheck?.scanPluginImports(target).some((r) => r.client && r.target.startsWith("client/sdk/")) ?? false;
|
|
3779
|
+
if (templateClientUsesSdk(template) || scanned) copyClientSdkInto(join(target, "client", "sdk"), sdkSources);
|
|
3692
3780
|
}
|
|
3693
3781
|
// 生成后校验:manifest 基础必填 + 生成文件的 node 语法检查 + 静态 import 自检。
|
|
3694
3782
|
let manifest;
|