pi-web-ui 0.119.0 → 0.120.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 +79 -0
- package/bin/hub-upgrade.mjs +33 -15
- package/bin/lib/atomic-file.mjs +90 -0
- package/dist/server/agent-service-daemon.js +44 -10
- package/dist/server/agent-service.js +803 -106
- package/dist/server/atomic-file.js +130 -5
- package/dist/server/bash-timeout.js +15 -0
- package/dist/server/bash-tool.js +68 -4
- package/dist/server/bg-servers.js +19 -13
- package/dist/server/canvas/canvas-dispatch.js +12 -1
- package/dist/server/client-state.js +56 -14
- package/dist/server/conversation-tool.js +3 -2
- package/dist/server/delegate-task.js +8 -8
- package/dist/server/device-center/group-router-runtime.js +2 -0
- package/dist/server/device-center/hub-upgrade.js +5 -10
- package/dist/server/dispatch-domain-handlers.js +96 -22
- package/dist/server/dispatch-plugin-handlers.js +10 -0
- package/dist/server/dsh/dsh-agent-service.js +9 -9
- package/dist/server/durable/durable-agent-service.js +1 -1
- package/dist/server/files-service.js +41 -19
- package/dist/server/fs-copy.js +93 -0
- package/dist/server/goal-review-gate.js +2 -2
- package/dist/server/index.js +15 -0
- package/dist/server/job-runner.js +345 -0
- package/dist/server/marker-service.js +42 -26
- package/dist/server/model-session.js +16 -0
- package/dist/server/phone-tool.js +167 -0
- package/dist/server/plan-mode.js +2 -2
- package/dist/server/plugin-api-catalog.js +1 -1
- package/dist/server/plugin-bundled.js +35 -28
- package/dist/server/plugin-installer.js +15 -0
- package/dist/server/plugin-manifest-validate.js +10 -0
- package/dist/server/plugin-materialize.js +161 -0
- package/dist/server/plugin-paths.js +60 -0
- package/dist/server/plugin-removal.js +16 -3
- package/dist/server/plugin-schedule.js +8 -7
- package/dist/server/plugin-secrets.js +7 -3
- package/dist/server/plugin-updater.js +2 -4
- package/dist/server/plugins.js +74 -38
- package/dist/server/preset-fields.js +9 -9
- package/dist/server/process-utils.js +11 -0
- package/dist/server/project-scripts.js +38 -0
- package/dist/server/prompt-composer.js +40 -21
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/quick-ask.js +3 -0
- package/dist/server/remote-ssh-service.js +39 -0
- package/dist/server/scm-commitmsg.js +2 -1
- package/dist/server/serialize.js +8 -0
- package/dist/server/session-list-index.js +246 -0
- package/dist/server/session-list-scan.js +5 -0
- package/dist/server/session-parser.js +16 -0
- package/dist/server/settings-service.js +39 -6
- package/dist/server/subagent-budget.js +68 -0
- package/dist/server/subagent-evidence.js +297 -0
- package/dist/server/subagent-helpers.js +12 -0
- package/dist/server/subagent-ledger.js +401 -0
- package/dist/server/subagent-notify.js +6 -2
- package/dist/server/subagent-security-gate.js +2 -2
- package/dist/server/subagent-settle.js +71 -0
- package/dist/server/subagents.js +497 -79
- package/dist/server/tabs.js +8 -1
- package/dist/server/terminals.js +0 -1
- package/dist/server/tool-manager.js +90 -16
- package/dist/server/tool-prompts.js +5 -1
- package/dist/server/universal/universal-service.js +1 -1
- package/dist/server/universal/universal-session.js +45 -7
- package/dist/server/vision-bridge.js +2 -0
- package/dist/server/workspace-handle.js +119 -17
- package/dist/server/workspace-queue.js +37 -0
- package/docs/README.md +25 -23
- package/docs/architecture-plugins.md +23 -3
- package/docs/device-center.md +1 -1
- package/package.json +15 -3
- package/plugins/catalog.json +13 -2
- package/themes/bases/flow-base.css +7 -16
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/BgTasksModal-BdOJ19Hj.js +1 -0
- package/web/dist/assets/BgTasksModal-SAH2XCkY.js +1 -0
- package/web/dist/assets/{CanvasStudio-2ydYbnpW.js → CanvasStudio-BB_Iq7pl.js} +3 -3
- package/web/dist/assets/{CanvasStudio-DizWvRjn.js → CanvasStudio-DU6O3N4u.js} +3 -3
- package/web/dist/assets/DeviceCenter-By1zVTSY.js +3 -0
- package/web/dist/assets/DeviceCenter-Cnm0Tjrx.js +3 -0
- package/web/dist/assets/{DeviceExecutionSettings-B7R9ONaq.js → DeviceExecutionSettings-qJzbI0Cf.js} +1 -1
- package/web/dist/assets/{DeviceGroups-DFU4cv5b.js → DeviceGroups-DPrQxW6B.js} +1 -1
- package/web/dist/assets/{DeviceGroups-DoaQcxKj.js → DeviceGroups-DoucyUjI.js} +1 -1
- package/web/dist/assets/{Dropdown-Btjt6Dzh.js → Dropdown-kj_NIj6e.js} +1 -1
- package/web/dist/assets/FilePreview-Bub8Y9uq.js +2 -0
- package/web/dist/assets/FilePreview-CC76Z6an.js +2 -0
- package/web/dist/assets/GlobalSearchModal-01nkgw4X.js +1 -0
- package/web/dist/assets/GlobalSearchModal-CiT6wBmR.js +1 -0
- package/web/dist/assets/{GroupConversation-DwZZrMuE.js → GroupConversation-1-lsPO1f.js} +3 -3
- package/web/dist/assets/{GroupConversation-KOi8sa5b.js → GroupConversation-HeiyW_O_.js} +3 -3
- package/web/dist/assets/{GroupWorkItems-FqAL74bC.js → GroupWorkItems-BYJv2XFj.js} +1 -1
- package/web/dist/assets/{HintTip-BOwPzBGR.js → HintTip-DFhoclDw.js} +1 -1
- package/web/dist/assets/{ModelConfigModal-DLIfWKdB.js → ModelConfigModal-D2Ro-jUZ.js} +2 -2
- package/web/dist/assets/{ModelConfigModal-B140kWrs.js → ModelConfigModal-DPc9R1pq.js} +2 -2
- package/web/dist/assets/{NativeCliPanel-BwiLazSq.js → NativeCliPanel-B108d697.js} +3 -3
- package/web/dist/assets/{NativeCliPanel-U0F_EfAU.js → NativeCliPanel-DupvGwQM.js} +3 -3
- package/web/dist/assets/{PiSetupModal-Dc7EQ4L3.js → PiSetupModal-D0HitBfd.js} +1 -1
- package/web/dist/assets/{ProviderOAuthControls-C3opmPhu.js → ProviderOAuthControls-BLKUEDde.js} +1 -1
- package/web/dist/assets/{SCMPanel-BBxQfmq9.js → SCMPanel-DDbWrUHR.js} +1 -1
- package/web/dist/assets/{SCMPanel-D2t97Vvr.js → SCMPanel-DluNcd2-.js} +1 -1
- package/web/dist/assets/SettingsModal-Cy5lRC97.css +1 -0
- package/web/dist/assets/SettingsModal-DQu18366.js +33 -0
- package/web/dist/assets/SettingsModal-Dm_haPme.js +33 -0
- package/web/dist/assets/{TermXterm-B6nCtO2b.js → TermXterm-SYc-MUk2.js} +1 -1
- package/web/dist/assets/{TerminalPanel-BWB3iSeN.js → TerminalPanel-CgA_lhVT.js} +1 -1
- package/web/dist/assets/{TerminalPanel-CAV2SosY.js → TerminalPanel-vdSIOPjD.js} +1 -1
- package/web/dist/assets/{TuiOverlayModal-B0jBPOMc.js → TuiOverlayModal-Cy1jYYIw.js} +1 -1
- package/web/dist/assets/{TuiOverlayModal-DGd6fzU6.js → TuiOverlayModal-kXY_4hV8.js} +1 -1
- package/web/dist/assets/{app-globals-CR8Ls9nE.js → app-globals-CBEscsYP.js} +9 -9
- package/web/dist/assets/{canvas-client-B0lkqTtF.js → canvas-client-Clsypfs6.js} +1 -1
- package/web/dist/assets/{desktop-BME3DkyE.js → desktop-C6D9a8HZ.js} +1 -1
- package/web/dist/assets/index-BD29OL9L.js +404 -0
- package/web/dist/assets/index-BlCxbqqr.js +404 -0
- package/web/dist/assets/index-DB55rbKC.css +1 -0
- package/web/dist/assets/{plugin-host-CVgcdBOk.js → plugin-host-VWBcq-LQ.js} +1 -1
- package/web/dist/assets/remote-ssh-client-C2eab5Kw.js +1 -0
- package/web/dist/assets/theme-CpQk_Agp.js +1 -0
- package/web/dist/index.html +10 -10
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/BgTasksModal-CVHW1lRA.js +0 -1
- package/web/dist/assets/BgTasksModal-t5hxW1H6.js +0 -1
- package/web/dist/assets/DeviceCenter-CPaZNBJE.js +0 -3
- package/web/dist/assets/DeviceCenter-DsVakAYR.js +0 -3
- package/web/dist/assets/FilePreview-QGQfD2lV.js +0 -2
- package/web/dist/assets/FilePreview-qez9walH.js +0 -2
- package/web/dist/assets/GlobalSearchModal-B-cnTDJ5.js +0 -1
- package/web/dist/assets/GlobalSearchModal-BvbafjdU.js +0 -1
- package/web/dist/assets/SettingsModal-BqPQNUwF.js +0 -34
- package/web/dist/assets/SettingsModal-l7eeV-Rq.js +0 -34
- package/web/dist/assets/index-BBAQNi6v.js +0 -404
- package/web/dist/assets/index-BYW9d61A.js +0 -404
- package/web/dist/assets/index-BYWs88H2.css +0 -1
- package/web/dist/assets/remote-ssh-client-DEpvwgqG.js +0 -1
- package/web/dist/assets/theme-DVa7Z5Zu.js +0 -1
|
@@ -165,11 +165,30 @@ HTTP MCP 卡片的 OAuth 登录通过 `mcp_oauth_start {reqId,name,scope}` 发
|
|
|
165
165
|
|
|
166
166
|
下载、排队和 `host.chat` 请求持有启动时的代次。重置后的迟到回执、结束事件和异步设置验证不得覆盖新会话状态;迟到的旧运行按真实 `runId` 中止。运行中不能切换的通道必须明确提示先停止,不能回报重置成功。历史记录保留,中止失败须告知用户。回归见 `tests/unit/channel-plugins.test.ts` 和各通道的行为、重置测试。
|
|
167
167
|
|
|
168
|
+
### 插件目录:代码是纯缓存,状态独立存放(`plugin-paths.ts`★ / `plugin-materialize.ts`★)
|
|
169
|
+
|
|
170
|
+
插件在数据目录里拆成两个互不干扰的根:
|
|
171
|
+
|
|
172
|
+
| 路径 | 内容 | 可丢弃? |
|
|
173
|
+
| ----------------------------- | ----------------------------------------------------- | ----------------------------------------------- |
|
|
174
|
+
| `<dataDir>/plugins/<id>/` | 代码本体(manifest / index.mjs / client / 依赖) | **可以**:随包插件可重放,`node_modules` 可重装 |
|
|
175
|
+
| `<dataDir>/plugin-data/<id>/` | 状态:`storage.json`、`secrets.bin`、`schedules.json` | **不可以**:用户配置、渠道授权、定时任务进度 |
|
|
176
|
+
|
|
177
|
+
- 状态路径只走 `pluginStateDir()` / `pluginStateFile()`;老布局(状态住在代码目录)在扫描/激活时由
|
|
178
|
+
`migratePluginState()` 幂等搬过去,两边都有时以状态目录为准(绝不拿旧副本覆盖新状态)。
|
|
179
|
+
- 代码目录的物化由 `materializePlugin()` 负责,并留一份回执 `.pi-materialized.json`:
|
|
180
|
+
**存在 ≠ 已准备** —— 回执登记的每个文件都还在才算装好;目录在但缺回执/缺文件 = 半残,下次启动就地补齐。
|
|
181
|
+
新装走 staging + rename 原子落盘,复制后验收(`manifest.json` 在 + 文件数 > 0)失败就报错,绝不签收空目录。
|
|
182
|
+
- 复制黑名单(`.git` / `node_modules` / `whisper-cache`)**只允许**在 `server/fs-copy.ts` 里按
|
|
183
|
+
**相对路径**判定。历史事故:三处各自拿 `cpSync` 的绝对路径去匹配 `node_modules`,而 npm -g 安装时
|
|
184
|
+
包目录本身就在 `…/node_modules/pi-web-ui` 下,整棵树被过滤成空副本还被当成已安装(issue #856)。
|
|
185
|
+
- 卸载会同时删掉状态目录(重装不闯回旧设置);回滚只回滚代码,状态不回滚。
|
|
186
|
+
|
|
168
187
|
### 宿主设施(plugin-facilities.ts)
|
|
169
188
|
|
|
170
189
|
| 设施 | 说明 |
|
|
171
190
|
| ------------ | -------------------------------------------------------------------- |
|
|
172
|
-
| `storage` | `<
|
|
191
|
+
| `storage` | `<dataDir>/plugin-data/<id>/storage.json` 原子 KV |
|
|
173
192
|
| `secrets` | AES-256-GCM 加密机密,密钥 `<dataDir>/secrets.key`,拷机 fail closed |
|
|
174
193
|
| `ensureDeps` | npm 自动补装单飞 |
|
|
175
194
|
|
|
@@ -294,6 +313,7 @@ HTTP MCP 卡片的 OAuth 登录通过 `mcp_oauth_start {reqId,name,scope}` 发
|
|
|
294
313
|
- `engines`(对象,如 `{"pi-web-ui": ">=1.2.0"}`):引擎约束,不满足即拒绝激活;范围支持 `>=`/`^`/精确,非法 range 放行(语义见 `tests/unit/plugin-extensions.test.ts` 的 satisfiesEngines)
|
|
295
314
|
- `peerPlugins`(字符串数组):对等依赖的其它插件 id,缺失只警告不断活
|
|
296
315
|
- `requires`(对象,P2-8 硬依赖):`{ hostApi?, families?, plugins? }`,任一条不满足即拒绝激活+教学式错误——`hostApi` 是宿主 API 下限(超前请升级)、`families` 须是已知族且须同时在自家 `permissions` 里声明、`plugins` 须已安装且激活成功。`ensureLoaded` 按依赖拓扑排序激活(环直接拒),提供方被删/失败后消费方一并反激活+留占位(级联一轮收敛,reload 重算刷新)
|
|
316
|
+
- `agentToolsDefaultOn`(布尔,缺省 `false` 即默认关):插件 AI 工具是否默认进入对话。不写就是默认关(新用户出厂`disabledPluginTools`里自带,需手动打开;只影响新用户与恢复默认,存量配置不动);设为 `true` 即 opt-in 默认开。新增插件工具必须同步加入出厂名单,否则守卫测试会红(见 `tests/unit/plugin-tools-default-off.test.ts`)
|
|
297
317
|
|
|
298
318
|
## 插件 AI 工具的可见性与开关
|
|
299
319
|
|
|
@@ -358,7 +378,7 @@ App 按 chat.plugins 动态 import 各插件的 client bundle(`/* @vite-ignore
|
|
|
358
378
|
|
|
359
379
|
`syncPluginViews(plugins, epoch)` 统一同步注册表:清单消失/被禁用即卸载视图(调 cleanup)、epoch 变化清 failed 重拉 bundle。
|
|
360
380
|
|
|
361
|
-
设置面板 ⚙ 有「界面插件」开关区(`set_settings.disabledPlugins`,持久化 client-state、纯 UI 隐藏不触发 runtime reload —— 被禁用的插件不算「界面布局」里的条目,它的贡献与 `arrange` 整份丢弃)+ **每行「更新/卸载」按钮**(更新需 CLI install 记录的来源 `.pi-source.json` → `UiPluginInfo.source`;两个操作都走**服务端后台作业** `plugin_job`,见下「插件市场」,不占用户终端、不关设置面板)+「界面布局」页(内置条目与插件条目的隐藏 / 排序 / 恢复,见「UI 扩展点(slot 框架)」)+「已授权目录」段(见「目录授权与跨目录 fs」)。
|
|
381
|
+
设置面板 ⚙ 有「界面插件」开关区(`set_settings.disabledPlugins`,持久化 client-state、纯 UI 隐藏不触发 runtime reload —— 被禁用的插件不算「界面布局」里的条目,它的贡献与 `arrange` 整份丢弃)+ **安装即启用**(`plugin_job` 的 `install` 作业成功后,服务端把该 id 从 `disabledPlugins` 摘掉再重推列表:出厂默认设置把一批可选插件写在禁用清单里,不同步启用就会出现「装好了但界面上找不到」;`update` / `uninstall` 不动这条状态,用户显式禁用过的插件升级后保持禁用——逻辑单源 `enablePluginAfterInstall()` @ `server/plugin-installer.ts`,写入点 `AgentService.enableInstalledPlugin()`)+ **每行「更新/卸载」按钮**(更新需 CLI install 记录的来源 `.pi-source.json` → `UiPluginInfo.source`;两个操作都走**服务端后台作业** `plugin_job`,见下「插件市场」,不占用户终端、不关设置面板)+「界面布局」页(内置条目与插件条目的隐藏 / 排序 / 恢复,见「UI 扩展点(slot 框架)」)+「已授权目录」段(见「目录授权与跨目录 fs」)。
|
|
362
382
|
|
|
363
383
|
## 常驻播放器:红果短剧
|
|
364
384
|
|
|
@@ -669,7 +689,7 @@ CLI `install --catalog <url>`(同步列表 + 逐条安装/更新,已安装
|
|
|
669
689
|
| 消息 hover 工具条 | `Message.tsx` 跳过 `hidden` 的条目 | 全被隐藏 → 整条容器都不画(不留空壳) |
|
|
670
690
|
| 左右停靠栏(`sidebar.left` / `sidebar.right`) | `SideDock.tsx`:`align` 读作竖轴(start=靠上 / center=居中 / end=靠下),三段各画一颗**内容高**的贴边药丸(空段不画底、也不吃点击),弹性格子把停靠栏撑满整列 | 勾掉 / ↑↓ / 对齐三者都生效;折叠按钮**只在悬浮模式**出现(流内收起省不下宽度),收起后只剩一个展开小按钮。回归 `side-dock-align-ui-test.mjs` |
|
|
671
691
|
| 右栏 tab | `RightPanel.tsx` 按 slot 顺序渲染(含内置「文件」tab 的位置,不再固定第一) | 勾掉(含内置「文件」tab)/ ↑↓ 都生效 |
|
|
672
|
-
|
|
|
692
|
+
| 左栏分区(最近项目 / 群组;运行的对话与历史已并入项目树) | `LeftPanel.tsx` 按 `web/src/left-sections.ts` 的计划渲染:顺序与显隐走宿主 `leftpanel.sections` 的条目(`host:lp-projects` / `host:lp-groups`,布局页可勾选 / 调序;插件 arrange 可隐藏,不能挪走)。`host:lp-running` / `host:lp-history` 两个条目仍在注册表里(`leftpanel.running` / `leftpanel.history` 行内插槽与插件 arrange 兼容用),但 `sectionNodes` 的 `convs` / `sessions` 恒为 `null` —— 运行中与历史会话都在「最近项目」树内按时间分组渲染,所以这两条不再进布局页(`HIDDEN_FROM_LAYOUT_ITEM_IDS`)。 | 勾掉 → 整区不渲染、不占权重;上下调序生效(分隔条按可见分区重新配对)。项目区块头的「项目 / 群组」tab 与群组分区的显隐同源:勾掉群组分区,该 tab 一并消失,记忆的模式回落 `projects`。 |
|
|
673
693
|
| 文件预览头栏 | `FilePreview.tsx` 的 `.fp-head-actions`:宿主 9 项+插件按 slot 顺序交错 | 勾掉 / ↑↓ 都生效(markdown/html/编辑/换行/缩放仍受文件类型条件约束) |
|
|
674
694
|
| 目标条 | `GoalBar.tsx`:编辑行(设目标/提炼/锁定/收起)/ 选项行(审查模型/轮次)/ 活跃行(清除)/ 收起 pill 四簇分别按 slot 排序,插件跟随同行 | 勾掉 / ↑↓ 都生效(pill 全藏且无插件条目时整条不占位) |
|
|
675
695
|
| SCM 面板 | `SCMPanel.tsx`:头栏(视图 tab/刷新+插件)与分支行(分支/切换/推送/拉取/提交输入/提交/全部提交)分别按 slot 排序 | 勾掉 / ↑↓ 都生效(分支名展示是纯信息不进槽位;底部「去终端」按钮只跟显隐) |
|
package/docs/device-center.md
CHANGED
|
@@ -98,7 +98,7 @@ pi-web-ui hub
|
|
|
98
98
|
|
|
99
99
|
### 单端口路径与旧版独立来源兼容
|
|
100
100
|
|
|
101
|
-
默认设备入口与 Hub 共用端口,例如 `http://203.0.113.10:50001/device/<设备ID>/`;自定义别名仍指向同一入口。不再按设备消耗额外端口。设备页面由 Hub 强制施加 CSP sandbox,并且不启用 `allow-same-origin`。随机能力路径只允许访问对应设备,不能作为 Hub
|
|
101
|
+
默认设备入口与 Hub 共用端口,例如 `http://203.0.113.10:50001/device/<设备ID>/`;自定义别名仍指向同一入口。不再按设备消耗额外端口。设备页面由 Hub 强制施加 CSP sandbox,并且不启用 `allow-same-origin`。随机能力路径只允许访问对应设备,不能作为 Hub 账号凭据使用;撤销设备会废止其访问权限。隔离页面的浏览器存储不可用时使用页面内存回退;同一原因导致 `navigator.serviceWorker` 在沙箱内不可读时降级为 `undefined`,通知改走页面内 `Notification`,不阻塞首屏。主题选择(`pi-theme`)通过受限消息桥保存在 Hub 入口页的浏览器存储中,按账号与设备隔离,并在首屏渲染前恢复;刷新、重新打开或能力凭据轮换不重置主题。消息桥只接受当前隔离 iframe 的主题读写,不能指定其他存储键,也不会持久化设备页面的令牌。主题仍属于当前浏览器,不跨浏览器或设备同步;其他本地偏好仍随页面刷新重置。旧版 Hub 未提供该桥时,页面等待至多 500ms 后继续启动。
|
|
102
102
|
|
|
103
103
|
以下为旧版独立来源的兼容配置:
|
|
104
104
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-web-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.120.0",
|
|
4
4
|
"description": "Just open your browser to get all your work done — browser cockpit for AI coding agents (chat, code, files, terminal, Git in one tab)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -69,18 +69,27 @@
|
|
|
69
69
|
"dev:web": "vite --config web/vite.config.ts",
|
|
70
70
|
"build": "npm run build:web && npm run build:server && npm run build:dsh-runtime && npm run build:mermaid-vendor && npm run build:runtrace-vendor",
|
|
71
71
|
"build:web": "vite build --config web/vite.config.ts",
|
|
72
|
-
"build:server": "node scripts/build-server.mjs",
|
|
72
|
+
"build:server": "node scripts/build-server.mjs && node scripts/gen-bin-atomic-file.mjs",
|
|
73
73
|
"build:dsh-runtime": "node scripts/copy-dsh-runtime.mjs",
|
|
74
74
|
"build:mermaid-vendor": "node scripts/build-mermaid-vendor.mjs",
|
|
75
75
|
"build:extension": "node plugins/page-picker/extension/build.mjs",
|
|
76
76
|
"pack:extension": "node plugins/page-picker/extension/pack.mjs",
|
|
77
77
|
"build:runtrace-vendor": "node scripts/build-runtrace-vendor.mjs",
|
|
78
|
+
"apk": "npm --prefix mobile run apk",
|
|
79
|
+
"apk:all": "npm --prefix mobile run apk:all",
|
|
80
|
+
"apk:all:runtime": "npm --prefix mobile run apk:all:runtime",
|
|
81
|
+
"release:local": "node scripts/release-local.mjs",
|
|
78
82
|
"typecheck": "tsc -p tsconfig.server.json --noEmit && tsc -p web/tsconfig.json --noEmit && tsc -p tsconfig.tests.json --noEmit && tsc -p desktop/tsconfig.json --noEmit && tsc -p plugins/page-picker/extension/tsconfig.json --noEmit",
|
|
79
83
|
"test": "vitest run",
|
|
80
84
|
"test:unit": "vitest run",
|
|
85
|
+
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
86
|
+
"test:all": "vitest run && npm run test:integration",
|
|
87
|
+
"test:changed": "vitest run --changed",
|
|
81
88
|
"test:smoke": "node tests/run-smoke.mjs",
|
|
82
89
|
"test:smoke:core": "node tests/run-smoke.mjs --core",
|
|
83
90
|
"check:protocol": "node scripts/check-protocol-sync.mjs",
|
|
91
|
+
"ci:local": "node scripts/ci-local.mjs",
|
|
92
|
+
"hooks:install": "node scripts/install-git-hooks.mjs",
|
|
84
93
|
"i18n:diff": "node scripts/i18n-diff.mjs",
|
|
85
94
|
"i18n:check": "node scripts/i18n-diff.mjs --check-packs",
|
|
86
95
|
"i18n:sync": "node scripts/sync-locales.mjs",
|
|
@@ -100,13 +109,15 @@
|
|
|
100
109
|
"lint": "oxlint server/ web/src/ extensions/ scripts/ bin/ desktop/",
|
|
101
110
|
"lint:fix": "oxlint --fix server/ web/src/ extensions/ scripts/ bin/ desktop/",
|
|
102
111
|
"audit:themes": "node scripts/theme-audit.mjs --out .theme-audit/current",
|
|
103
|
-
"audit:diff": "node scripts/theme-diff.mjs .theme-audit/baseline .theme-audit/current"
|
|
112
|
+
"audit:diff": "node scripts/theme-diff.mjs .theme-audit/baseline .theme-audit/current",
|
|
113
|
+
"gen:atomic": "node scripts/gen-bin-atomic-file.mjs"
|
|
104
114
|
},
|
|
105
115
|
"dependencies": {
|
|
106
116
|
"@deepseek-ai/dsh-sdk-jsonrpc-server": "^0.2.1-rc.2",
|
|
107
117
|
"@deepseek-ai/dsh-sdk-protocol": "^0.2.1-rc.2",
|
|
108
118
|
"@earendil-works/pi-mcp": "^1.4.0",
|
|
109
119
|
"compression": "^1.8.2",
|
|
120
|
+
"electron-chrome-extensions": "4.10.0",
|
|
110
121
|
"electron-updater": "^6.8.9",
|
|
111
122
|
"express": "^5.2.1",
|
|
112
123
|
"node-pty": "^1.1.0",
|
|
@@ -133,6 +144,7 @@
|
|
|
133
144
|
}
|
|
134
145
|
},
|
|
135
146
|
"devDependencies": {
|
|
147
|
+
"@types/chrome": "^0.3.7",
|
|
136
148
|
"@types/compression": "^1.8.1",
|
|
137
149
|
"@types/express": "^5.0.6",
|
|
138
150
|
"@types/node": "^26.6.1",
|
package/plugins/catalog.json
CHANGED
|
@@ -446,12 +446,23 @@
|
|
|
446
446
|
"id": "quota-watch",
|
|
447
447
|
"name": "额度看板",
|
|
448
448
|
"nameEn": "Quota Watch",
|
|
449
|
-
"version": "0.
|
|
449
|
+
"version": "0.5.0",
|
|
450
450
|
"icon": "📊",
|
|
451
451
|
"iconSvg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 3v18h18\"/><rect x=\"7\" y=\"7\" width=\"3\" height=\"9\" rx=\"1\"/><rect x=\"13\" y=\"11\" width=\"3\" height=\"5\" rx=\"1\"/></svg>",
|
|
452
|
-
"description": "底栏只显示当前模型对应那家的额度,点它,宿主弹出跟随位置的小卡片:自动读取本机已登录的
|
|
452
|
+
"description": "底栏只显示当前模型对应那家的额度,点它,宿主弹出跟随位置的小卡片:自动读取本机已登录的 Claude Code、Codex、OpenCode(Go 订阅剩余额度)登录态,DeepSeek 填一次 Key 即可;卡片里是剩余百分比、重置倒计时与账户余额,刷新按钮外圈就是自动刷新进度、旁边实时显示数据有多旧,点刷新底栏与卡片同一帧更新,AI 也能用工具直接查。只查当前供应商,别家订阅不出网、不打扰。凭据只在本机读取,不外传、不写盘。",
|
|
453
453
|
"descriptionEn": "The bottom bar shows only the quota of the provider behind your current model; click it and the host pops a small card right next to it: local Antigravity, Claude Code and Codex logins are read automatically (DeepSeek needs one API key), with remaining percentage, reset countdowns and balance — the refresh button doubles as an auto-refresh progress ring, the data's age is shown live, and one click updates the bar and the card in the same frame. The AI can query it too. Only that provider is queried; other subscriptions are left alone. Credentials stay on this machine; nothing is uploaded or persisted.",
|
|
454
454
|
"source": "xing-shuyin/pi-web-ui/plugins/quota-watch",
|
|
455
455
|
"homepage": "https://github.com/xing-shuyin/pi-web-ui/tree/main/plugins/quota-watch"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"id": "frp-manager",
|
|
459
|
+
"name": "内网穿透",
|
|
460
|
+
"nameEn": "FRP Manager",
|
|
461
|
+
"icon": "🚇",
|
|
462
|
+
"iconSvg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 17V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v10\"/><path d=\"M2 17h20\"/><circle cx=\"8.5\" cy=\"17.5\" r=\"1.5\"/><circle cx=\"15.5\" cy=\"17.5\" r=\"1.5\"/><path d=\"M9 6v3M15 6v3\"/></svg>",
|
|
463
|
+
"description": "frp 内网穿透一站式管理:自动下载 frpc/frps、本机穿透列表增删改查、TOML 可视化配置、启停与日志、本地 frps 联调、远端公网 frps 一键部署脚本。",
|
|
464
|
+
"descriptionEn": "One-stop frp management: auto-download frpc/frps, local proxy list CRUD, visual TOML config, start/stop/logs, local frps for debugging, one-click remote frps deploy script.",
|
|
465
|
+
"source": "xing-shuyin/pi-web-ui/plugins/frp-manager",
|
|
466
|
+
"homepage": "https://github.com/xing-shuyin/pi-web-ui/tree/main/plugins/frp-manager"
|
|
456
467
|
}
|
|
457
468
|
]
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
margin: 0;
|
|
270
270
|
padding: 0 8px;
|
|
271
271
|
background: color-mix(in srgb, var(--text) 5%, transparent);
|
|
272
|
-
border: 1px solid
|
|
272
|
+
border: 1px solid transparent;
|
|
273
273
|
border-radius: 999px;
|
|
274
274
|
font-family: var(--mono, monospace);
|
|
275
275
|
font-size: 11px;
|
|
@@ -279,8 +279,11 @@
|
|
|
279
279
|
box-shadow:
|
|
280
280
|
inset 0 0.5px 0.5px color-mix(in srgb, var(--text) 22%, transparent),
|
|
281
281
|
0 2px 5px color-mix(in srgb, var(--flow-shadow) 35%, transparent);
|
|
282
|
-
backdrop-filter
|
|
283
|
-
|
|
282
|
+
/* 不给胶囊上 backdrop-filter:带它的元素各自一个合成表面,胶囊是行内重复项,
|
|
283
|
+
一个回合几十上百颗 = 几十上百个合成层(300 颗实测 310 层 vs 11 层)。
|
|
284
|
+
何况 --bg-image: none 的纯色底上,模糊均匀色不产生任何毛玻璃信息。 */
|
|
285
|
+
backdrop-filter: none;
|
|
286
|
+
-webkit-backdrop-filter: none;
|
|
284
287
|
transition:
|
|
285
288
|
background 0.15s cubic-bezier(0.16, 1, 0.3, 1),
|
|
286
289
|
border-color 0.15s cubic-bezier(0.16, 1, 0.3, 1),
|
|
@@ -294,7 +297,6 @@
|
|
|
294
297
|
.toolcall:hover,
|
|
295
298
|
.thinking:hover {
|
|
296
299
|
background: var(--border);
|
|
297
|
-
border-color: color-mix(in srgb, var(--text) 22%, transparent);
|
|
298
300
|
box-shadow:
|
|
299
301
|
inset 0 1px 1px color-mix(in srgb, var(--text) 35%, transparent),
|
|
300
302
|
0 4px 10px color-mix(in srgb, var(--flow-shadow) 45%, transparent);
|
|
@@ -307,29 +309,18 @@
|
|
|
307
309
|
}
|
|
308
310
|
|
|
309
311
|
.toolcall.run {
|
|
310
|
-
border-color: rgba(245, 158, 11, 0.45);
|
|
311
312
|
box-shadow:
|
|
312
313
|
inset 0 0.5px 0.5px color-mix(in srgb, var(--text) 25%, transparent),
|
|
313
314
|
0 0 10px rgba(245, 158, 11, 0.25);
|
|
314
315
|
}
|
|
315
|
-
.toolcall.ok {
|
|
316
|
-
border-color: rgba(52, 211, 153, 0.25);
|
|
317
|
-
}
|
|
318
316
|
.toolcall.err {
|
|
319
|
-
|
|
317
|
+
background: color-mix(in srgb, var(--red) 12%, transparent);
|
|
320
318
|
box-shadow:
|
|
321
319
|
inset 0 0.5px 0.5px color-mix(in srgb, var(--text) 25%, transparent),
|
|
322
320
|
0 0 10px rgba(239, 68, 68, 0.25);
|
|
323
321
|
}
|
|
324
322
|
|
|
325
|
-
.thinking {
|
|
326
|
-
border-color: rgba(192, 132, 252, 0.25);
|
|
327
|
-
}
|
|
328
|
-
.thinking:hover {
|
|
329
|
-
border-color: rgba(192, 132, 252, 0.45);
|
|
330
|
-
}
|
|
331
323
|
.thinking.run {
|
|
332
|
-
border-color: rgba(192, 132, 252, 0.5);
|
|
333
324
|
box-shadow:
|
|
334
325
|
inset 0 0.5px 0.5px color-mix(in srgb, var(--text) 25%, transparent),
|
|
335
326
|
0 0 10px rgba(192, 132, 252, 0.25);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
["index-
|
|
1
|
+
["index-BlCxbqqr.js","BgTasksModal-SAH2XCkY.js","CanvasStudio-DU6O3N4u.js","DeviceCenter-By1zVTSY.js","DeviceExecutionSettings-qJzbI0Cf.js","DeviceGroups-DPrQxW6B.js","Dropdown-kj_NIj6e.js","FilePreview-CC76Z6an.js","GlobalSearchModal-CiT6wBmR.js","GroupConversation-HeiyW_O_.js","GroupWorkItems-BYJv2XFj.js","HintTip-DFhoclDw.js","ModelConfigModal-D2Ro-jUZ.js","NativeCliPanel-B108d697.js","PiSetupModal-D0HitBfd.js","ProviderOAuthControls-BLKUEDde.js","SCMPanel-DluNcd2-.js","SettingsModal-Dm_haPme.js","TermXterm-SYc-MUk2.js","TerminalPanel-vdSIOPjD.js","TuiOverlayModal-Cy1jYYIw.js","app-globals-CBEscsYP.js","canvas-client-Clsypfs6.js","composer-bridge-CImnjDHq.js","desktop-C6D9a8HZ.js","es-DWMIuDU2.js","group-view-state-CGCzYF8k.js","markdown-BggnuQ4H.js","math-1uRJCsA9.js","plugin-host-VWBcq-LQ.js","react-CR5VJ85Q.js","remote-ssh-client-C2eab5Kw.js","rolldown-runtime-hePW80VL.js","shortcut-stack-hhrDyRBn.js","theme-CpQk_Agp.js","uuid-BzDIGCwP.js","xterm-Cf5xxe4g.js","KaTeX_AMS-Regular-BQhdFMY1.woff2","KaTeX_AMS-Regular-DMm9YOAa.woff","KaTeX_AMS-Regular-DRggAlZN.ttf","KaTeX_Caligraphic-Bold-ATXxdsX0.ttf","KaTeX_Caligraphic-Bold-BEiXGLvX.woff","KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2","KaTeX_Caligraphic-Regular-CTRA-rTL.woff","KaTeX_Caligraphic-Regular-Di6jR-x-.woff2","KaTeX_Caligraphic-Regular-wX97UBjC.ttf","KaTeX_Fraktur-Bold-BdnERNNW.ttf","KaTeX_Fraktur-Bold-BsDP51OF.woff","KaTeX_Fraktur-Bold-CL6g_b3V.woff2","KaTeX_Fraktur-Regular-CB_wures.ttf","KaTeX_Fraktur-Regular-CTYiF6lA.woff2","KaTeX_Fraktur-Regular-Dxdc4cR9.woff","KaTeX_Main-Bold-Cx986IdX.woff2","KaTeX_Main-Bold-Jm3AIy58.woff","KaTeX_Main-Bold-waoOVXN0.ttf","KaTeX_Main-BoldItalic-DxDJ3AOS.woff2","KaTeX_Main-BoldItalic-DzxPMmG6.ttf","KaTeX_Main-BoldItalic-SpSLRI95.woff","KaTeX_Main-Italic-3WenGoN9.ttf","KaTeX_Main-Italic-BMLOBm91.woff","KaTeX_Main-Italic-NWA7e6Wa.woff2","KaTeX_Main-Regular-B22Nviop.woff2","KaTeX_Main-Regular-Dr94JaBh.woff","KaTeX_Main-Regular-ypZvNtVU.ttf","KaTeX_Math-BoldItalic-B3XSjfu4.ttf","KaTeX_Math-BoldItalic-CZnvNsCZ.woff2","KaTeX_Math-BoldItalic-iY-2wyZ7.woff","KaTeX_Math-Italic-DA0__PXp.woff","KaTeX_Math-Italic-flOr_0UB.ttf","KaTeX_Math-Italic-t53AETM-.woff2","KaTeX_SansSerif-Bold-CFMepnvq.ttf","KaTeX_SansSerif-Bold-D1sUS0GD.woff2","KaTeX_SansSerif-Bold-DbIhKOiC.woff","KaTeX_SansSerif-Italic-C3H0VqGB.woff2","KaTeX_SansSerif-Italic-DN2j7dab.woff","KaTeX_SansSerif-Italic-YYjJ1zSn.ttf","KaTeX_SansSerif-Regular-BNo7hRIc.ttf","KaTeX_SansSerif-Regular-CS6fqUqJ.woff","KaTeX_SansSerif-Regular-DDBCnlJ7.woff2","KaTeX_Script-Regular-C5JkGWo-.ttf","KaTeX_Script-Regular-D3wIWfF6.woff2","KaTeX_Script-Regular-D5yQViql.woff","KaTeX_Size1-Regular-C195tn64.woff","KaTeX_Size1-Regular-Dbsnue_I.ttf","KaTeX_Size1-Regular-mCD8mA8B.woff2","KaTeX_Size2-Regular-B7gKUWhC.ttf","KaTeX_Size2-Regular-Dy4dx90m.woff2","KaTeX_Size2-Regular-oD1tc_U0.woff","KaTeX_Size3-Regular-CTq5MqoE.woff","KaTeX_Size3-Regular-DgpXs0kz.ttf","KaTeX_Size4-Regular-BF-4gkZK.woff","KaTeX_Size4-Regular-DWFBv043.ttf","KaTeX_Size4-Regular-Dl5lxZxV.woff2","KaTeX_Typewriter-Regular-C0xS9mPB.woff","KaTeX_Typewriter-Regular-CO6r4hn1.woff2","KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf","SettingsModal-Cy5lRC97.css","index-DB55rbKC.css","markdown-C8LL_u4z.css","math-BorAY7qD.css","xterm-B1njb2Cr.css"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Bt as t,Cn as n,Tn as r,Ut as i,hn as a,nn as o,t as s,yt as c}from"./app-globals-CBEscsYP.js";import{i as l,t as u}from"./react-CR5VJ85Q.js";import{Ft as d,Gt as f,Ht as p,z as m}from"./index-BD29OL9L.js";var h=e(l(),1),g=u();function _(e,t){let n=Math.max(0,Date.now()-e),r=Math.floor(n/6e4);if(r<1)return t(`bgTaskJustNow`);if(r<60)return t(`bgTaskMinutes`,{n:r});let i=Math.floor(r/60);return i<24?t(`bgTaskHours`,{n:i}):t(`bgTaskDays`,{n:Math.floor(i/24)})}function v({servers:e,projectScripts:l,onClose:u,plugins:v=[],epoch:y=0,send:b,onUiAction:x,autoCleanupMin:S=0}){let C=r(),{locale:w}=n();(0,h.useEffect)(()=>{s({type:`list_bg_servers`}),s({type:`project_scripts`})},[]);let T=(0,h.useMemo)(()=>e.filter(e=>(e.kind??(e.taskId?`plugin`:`port`))===`job`),[e]),E=(0,h.useMemo)(()=>{let e=new Set;for(let t of T){let n=/npm run ([A-Za-z0-9 _.:-]+)/.exec(t.command??``);n&&e.add(n[1])}return e},[T]),D=(0,h.useMemo)(()=>Object.entries(l?.scripts??{}),[l]),O=(0,h.useMemo)(()=>(p(f(v),{locale:w,t:e=>C(e)})[`tasks.panel`]??[]).filter(e=>!e.hidden&&e.source!==`host`&&e.kind!==`divider`),[v,w,C]),[k,A]=(0,h.useState)(new Set),j=e=>{let t=e.taskId??String(e.port);A(e=>new Set(e).add(t));let n=e.kind??(e.taskId?`plugin`:`port`);s(n===`plugin`||n===`job`?{type:`kill_background_server`,taskId:e.taskId}:{type:`kill_background_server`,port:e.port}),s({type:`list_bg_servers`}),setTimeout(()=>s({type:`list_bg_servers`}),1500),setTimeout(()=>s({type:`list_bg_servers`}),4e3),setTimeout(()=>{A(e=>{let n=new Set(e);return n.delete(t),n})},8e3)};return(0,g.jsxs)(d,{className:`bg-task-modal bg-task-modal-a`,onClose:u,showCloseButton:!1,children:[(0,g.jsxs)(`div`,{className:`bg-task-head`,children:[(0,g.jsxs)(`div`,{className:`bg-task-title`,children:[(0,g.jsx)(c,{"aria-hidden":!0}),(0,g.jsx)(`span`,{children:C(`bgTasks`)}),e.length>0&&(0,g.jsxs)(`em`,{className:`bg-task-count`,children:[e.length,` 运行`]})]}),(0,g.jsxs)(`div`,{className:`bg-task-head-actions`,children:[(0,g.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:C(`bgTaskRefresh`),onClick:()=>{s({type:`list_bg_servers`}),s({type:`project_scripts`})},children:(0,g.jsx)(i,{})}),(0,g.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:C(`close`),onClick:u,children:(0,g.jsx)(a,{})})]})]}),(0,g.jsxs)(`div`,{className:`bg-task-body`,children:[e.length===0&&D.length===0?(0,g.jsxs)(`div`,{className:`bg-task-empty`,children:[(0,g.jsx)(c,{}),(0,g.jsx)(`span`,{children:C(`bgTasksEmpty`)}),(0,g.jsx)(`small`,{children:C(`bgTasksDesc`)})]}):null,e.length>0&&(0,g.jsx)(`div`,{className:`bg-task-running`,children:e.map(e=>{let t=e.kind??(e.taskId?`plugin`:`port`),n=t===`plugin`,r=t===`job`,a=e.taskId??String(e.port),o=n?e.plugin:r?e.name||C(`bgTaskJobKind`):`:${e.port}`,c=[e.name&&!r?e.name:null,n&&e.status?e.status:null,C(`bgTaskSince`)+` `+_(e.since,C),!n&&e.pid?`${C(`bgTaskPid`)} ${e.pid}`:null].filter(Boolean).join(` · `);return(0,g.jsxs)(`div`,{className:`bg-task-run-card`,title:e.command||void 0,children:[(0,g.jsx)(`span`,{className:`bg-task-dot`,"aria-hidden":!0}),(0,g.jsxs)(`div`,{className:`bg-task-run-main`,children:[(0,g.jsx)(`div`,{className:`bg-task-run-name`,children:o}),(0,g.jsx)(`div`,{className:`bg-task-run-sub`,children:c})]}),(0,g.jsxs)(`div`,{className:`bg-task-run-actions`,children:[t===`port`&&(0,g.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn ${e.keep?`active`:``}`,title:e.keep?C(`bgTaskKeepOn`):C(`bgTaskKeep`),"aria-pressed":!!e.keep,onClick:()=>s({type:`set_bg_keep`,port:e.port??0,keep:!e.keep}),children:`📌`}),r&&(0,g.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:C(`bgTaskRestart`),onClick:()=>s({type:`restart_bg_job`,taskId:e.taskId??``}),children:(0,g.jsx)(i,{})}),(0,g.jsx)(`button`,{type:`button`,className:`btn bg-task-btn danger sm`,disabled:k.has(e.taskId??String(e.port)),onClick:()=>j(e),children:k.has(e.taskId??String(e.port))?C(`bgTaskStopping`):C(`bgTaskStop`)})]})]},a)})}),D.length>0&&(0,g.jsxs)(`div`,{className:`bg-task-scripts`,children:[(0,g.jsxs)(`div`,{className:`bg-task-kicker`,children:[(0,g.jsx)(`span`,{children:C(`bgTaskQuickStart`)}),l?.cwd?(0,g.jsx)(`span`,{className:`bg-task-cwd mono`,title:l.cwd,children:l.cwd}):null]}),(0,g.jsx)(`div`,{className:`bg-task-script-list`,children:D.map(([e,n])=>{let r=E.has(e);return(0,g.jsxs)(`div`,{className:`bg-task-script-row`,title:n,children:[(0,g.jsxs)(`div`,{className:`bg-task-script-cmd mono`,children:[(0,g.jsx)(`span`,{className:`bg-task-npm`,children:`npm run `}),(0,g.jsx)(`span`,{className:`bg-task-script-name`,children:e})]}),(0,g.jsx)(`button`,{type:`button`,className:`btn bg-task-btn sm ${r?``:`primary`}`,disabled:r,onClick:()=>s({type:`start_bg_script`,script:e}),children:r?C(`bgTaskRunning`):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(t,{"aria-hidden":!0}),` `,C(`bgTaskStart`)]})})]},e)})})]}),O.map(e=>{let t=v.find(t=>t.id===e.source.slice(7));return e.kind===`view`?t?(0,g.jsx)(`div`,{className:`bg-task-plugin-panel`,children:(0,g.jsx)(m,{plugin:t,epoch:y,send:b??(()=>{})})},e.id):null:(0,g.jsx)(`button`,{type:`button`,className:`btn`,title:e.hint??e.label,onClick:()=>x?.(e),children:e.label},e.id)})]}),(0,g.jsxs)(`div`,{className:`bg-task-foot`,children:[(0,g.jsxs)(`label`,{className:`bg-task-cleanup`,title:C(`bgTaskCleanupHint`),children:[(0,g.jsx)(`span`,{children:C(`bgTaskCleanup`)}),(0,g.jsxs)(`select`,{className:`bg-task-select`,value:String(S),onChange:e=>s({type:`set_settings`,bgAutoCleanupMin:Number(e.target.value)}),children:[(0,g.jsx)(`option`,{value:`0`,children:C(`bgTaskCleanupOff`)}),[15,30,60,120].map(e=>(0,g.jsx)(`option`,{value:String(e),children:C(`bgTaskCleanupMinutes`,{n:e})},e))]})]}),(0,g.jsx)(`span`,{className:`sp`}),(0,g.jsxs)(`button`,{type:`button`,className:`btn bg-task-btn ghost danger sm`,disabled:e.length===0,title:C(`bgTaskStopAll`),onClick:()=>s({type:`kill_background_servers`}),children:[(0,g.jsx)(o,{"aria-hidden":!0}),` `,C(`bgTaskStopAll`)]})]})]})}export{v as BgTasksModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Bt as t,Cn as n,Tn as r,Ut as i,hn as a,nn as o,t as s,yt as c}from"./app-globals-CBEscsYP.js";import{i as l,t as u}from"./react-CR5VJ85Q.js";import{Ft as d,Gt as f,Ht as p,z as m}from"./index-BlCxbqqr.js";var h=e(l(),1),g=u();function _(e,t){let n=Math.max(0,Date.now()-e),r=Math.floor(n/6e4);if(r<1)return t(`bgTaskJustNow`);if(r<60)return t(`bgTaskMinutes`,{n:r});let i=Math.floor(r/60);return i<24?t(`bgTaskHours`,{n:i}):t(`bgTaskDays`,{n:Math.floor(i/24)})}function v({servers:e,projectScripts:l,onClose:u,plugins:v=[],epoch:y=0,send:b,onUiAction:x,autoCleanupMin:S=0}){let C=r(),{locale:w}=n();(0,h.useEffect)(()=>{s({type:`list_bg_servers`}),s({type:`project_scripts`})},[]);let T=(0,h.useMemo)(()=>e.filter(e=>(e.kind??(e.taskId?`plugin`:`port`))===`job`),[e]),E=(0,h.useMemo)(()=>{let e=new Set;for(let t of T){let n=/npm run ([A-Za-z0-9 _.:-]+)/.exec(t.command??``);n&&e.add(n[1])}return e},[T]),D=(0,h.useMemo)(()=>Object.entries(l?.scripts??{}),[l]),O=(0,h.useMemo)(()=>(p(f(v),{locale:w,t:e=>C(e)})[`tasks.panel`]??[]).filter(e=>!e.hidden&&e.source!==`host`&&e.kind!==`divider`),[v,w,C]),[k,A]=(0,h.useState)(new Set),j=e=>{let t=e.taskId??String(e.port);A(e=>new Set(e).add(t));let n=e.kind??(e.taskId?`plugin`:`port`);s(n===`plugin`||n===`job`?{type:`kill_background_server`,taskId:e.taskId}:{type:`kill_background_server`,port:e.port}),s({type:`list_bg_servers`}),setTimeout(()=>s({type:`list_bg_servers`}),1500),setTimeout(()=>s({type:`list_bg_servers`}),4e3),setTimeout(()=>{A(e=>{let n=new Set(e);return n.delete(t),n})},8e3)};return(0,g.jsxs)(d,{className:`bg-task-modal bg-task-modal-a`,onClose:u,showCloseButton:!1,children:[(0,g.jsxs)(`div`,{className:`bg-task-head`,children:[(0,g.jsxs)(`div`,{className:`bg-task-title`,children:[(0,g.jsx)(c,{"aria-hidden":!0}),(0,g.jsx)(`span`,{children:C(`bgTasks`)}),e.length>0&&(0,g.jsxs)(`em`,{className:`bg-task-count`,children:[e.length,` 运行`]})]}),(0,g.jsxs)(`div`,{className:`bg-task-head-actions`,children:[(0,g.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:C(`bgTaskRefresh`),onClick:()=>{s({type:`list_bg_servers`}),s({type:`project_scripts`})},children:(0,g.jsx)(i,{})}),(0,g.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:C(`close`),onClick:u,children:(0,g.jsx)(a,{})})]})]}),(0,g.jsxs)(`div`,{className:`bg-task-body`,children:[e.length===0&&D.length===0?(0,g.jsxs)(`div`,{className:`bg-task-empty`,children:[(0,g.jsx)(c,{}),(0,g.jsx)(`span`,{children:C(`bgTasksEmpty`)}),(0,g.jsx)(`small`,{children:C(`bgTasksDesc`)})]}):null,e.length>0&&(0,g.jsx)(`div`,{className:`bg-task-running`,children:e.map(e=>{let t=e.kind??(e.taskId?`plugin`:`port`),n=t===`plugin`,r=t===`job`,a=e.taskId??String(e.port),o=n?e.plugin:r?e.name||C(`bgTaskJobKind`):`:${e.port}`,c=[e.name&&!r?e.name:null,n&&e.status?e.status:null,C(`bgTaskSince`)+` `+_(e.since,C),!n&&e.pid?`${C(`bgTaskPid`)} ${e.pid}`:null].filter(Boolean).join(` · `);return(0,g.jsxs)(`div`,{className:`bg-task-run-card`,title:e.command||void 0,children:[(0,g.jsx)(`span`,{className:`bg-task-dot`,"aria-hidden":!0}),(0,g.jsxs)(`div`,{className:`bg-task-run-main`,children:[(0,g.jsx)(`div`,{className:`bg-task-run-name`,children:o}),(0,g.jsx)(`div`,{className:`bg-task-run-sub`,children:c})]}),(0,g.jsxs)(`div`,{className:`bg-task-run-actions`,children:[t===`port`&&(0,g.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn ${e.keep?`active`:``}`,title:e.keep?C(`bgTaskKeepOn`):C(`bgTaskKeep`),"aria-pressed":!!e.keep,onClick:()=>s({type:`set_bg_keep`,port:e.port??0,keep:!e.keep}),children:`📌`}),r&&(0,g.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:C(`bgTaskRestart`),onClick:()=>s({type:`restart_bg_job`,taskId:e.taskId??``}),children:(0,g.jsx)(i,{})}),(0,g.jsx)(`button`,{type:`button`,className:`btn bg-task-btn danger sm`,disabled:k.has(e.taskId??String(e.port)),onClick:()=>j(e),children:k.has(e.taskId??String(e.port))?C(`bgTaskStopping`):C(`bgTaskStop`)})]})]},a)})}),D.length>0&&(0,g.jsxs)(`div`,{className:`bg-task-scripts`,children:[(0,g.jsxs)(`div`,{className:`bg-task-kicker`,children:[(0,g.jsx)(`span`,{children:C(`bgTaskQuickStart`)}),l?.cwd?(0,g.jsx)(`span`,{className:`bg-task-cwd mono`,title:l.cwd,children:l.cwd}):null]}),(0,g.jsx)(`div`,{className:`bg-task-script-list`,children:D.map(([e,n])=>{let r=E.has(e);return(0,g.jsxs)(`div`,{className:`bg-task-script-row`,title:n,children:[(0,g.jsxs)(`div`,{className:`bg-task-script-cmd mono`,children:[(0,g.jsx)(`span`,{className:`bg-task-npm`,children:`npm run `}),(0,g.jsx)(`span`,{className:`bg-task-script-name`,children:e})]}),(0,g.jsx)(`button`,{type:`button`,className:`btn bg-task-btn sm ${r?``:`primary`}`,disabled:r,onClick:()=>s({type:`start_bg_script`,script:e}),children:r?C(`bgTaskRunning`):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(t,{"aria-hidden":!0}),` `,C(`bgTaskStart`)]})})]},e)})})]}),O.map(e=>{let t=v.find(t=>t.id===e.source.slice(7));return e.kind===`view`?t?(0,g.jsx)(`div`,{className:`bg-task-plugin-panel`,children:(0,g.jsx)(m,{plugin:t,epoch:y,send:b??(()=>{})})},e.id):null:(0,g.jsx)(`button`,{type:`button`,className:`btn`,title:e.hint??e.label,onClick:()=>x?.(e),children:e.label},e.id)})]}),(0,g.jsxs)(`div`,{className:`bg-task-foot`,children:[(0,g.jsxs)(`label`,{className:`bg-task-cleanup`,title:C(`bgTaskCleanupHint`),children:[(0,g.jsx)(`span`,{children:C(`bgTaskCleanup`)}),(0,g.jsxs)(`select`,{className:`bg-task-select`,value:String(S),onChange:e=>s({type:`set_settings`,bgAutoCleanupMin:Number(e.target.value)}),children:[(0,g.jsx)(`option`,{value:`0`,children:C(`bgTaskCleanupOff`)}),[15,30,60,120].map(e=>(0,g.jsx)(`option`,{value:String(e),children:C(`bgTaskCleanupMinutes`,{n:e})},e))]})]}),(0,g.jsx)(`span`,{className:`sp`}),(0,g.jsxs)(`button`,{type:`button`,className:`btn bg-task-btn ghost danger sm`,disabled:e.length===0,title:C(`bgTaskStopAll`),onClick:()=>s({type:`kill_background_servers`}),children:[(0,g.jsx)(o,{"aria-hidden":!0}),` `,C(`bgTaskStopAll`)]})]})]})}export{v as BgTasksModal};
|