From f3311339e5025d8d8ee85a6712ee150dec649ab6 Mon Sep 17 00:00:00 2001 From: spudding <1115683088@qq.com> Date: Thu, 24 Sep 2026 16:14:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(electron-shell):=20=E8=A1=A5=E5=BD=95?= =?UTF-8?q?=E5=A3=B3=E5=AD=90=E6=BA=90=E7=A0=81=EF=BC=88=E6=8E=92=E9=99=A4?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=8E=AF=E5=A2=83=E4=B8=8E=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E4=BA=A7=E7=89=A9=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desktop/electron-shell/.env.example | 23 + desktop/electron-shell/.gitignore | 11 + desktop/electron-shell/README.md | 256 + desktop/electron-shell/electron/app.js | 157 + .../electron-shell/electron/chrome-manager.js | 279 ++ desktop/electron-shell/electron/config.js | 204 + desktop/electron-shell/electron/cpclient.js | 133 + desktop/electron-shell/electron/creds-sync.js | 119 + desktop/electron-shell/electron/crypto.js | 120 + desktop/electron-shell/electron/db.js | 42 + .../electron-shell/electron/electron-main.js | 170 + desktop/electron-shell/electron/env-sync.js | 277 ++ desktop/electron-shell/electron/hub.js | 39 + .../electron-shell/electron/last-fields.js | 72 + desktop/electron-shell/electron/licensing.js | 308 ++ desktop/electron-shell/electron/logger.js | 68 + desktop/electron-shell/electron/main.js | 22 + desktop/electron-shell/electron/meta.js | 72 + .../electron-shell/electron/platform-auth.js | 249 + .../electron-shell/electron/platform-creds.js | 111 + .../electron-shell/electron/plugin-configs.js | 73 + .../electron-shell/electron/plugin-sync.js | 375 ++ desktop/electron-shell/electron/preload.js | 14 + desktop/electron-shell/electron/registry.js | 119 + .../electron-shell/electron/run-history.js | 205 + desktop/electron-shell/electron/runner.js | 356 ++ desktop/electron-shell/electron/scheduler.js | 157 + desktop/electron-shell/electron/server.js | 923 ++++ desktop/electron-shell/electron/session.js | 148 + .../electron-shell/electron/shell-updater.js | 313 ++ desktop/electron-shell/electron/state.js | 55 + desktop/electron-shell/electron/tasks.js | 483 ++ .../frontend/docs/design-preview-v2.html | 745 +++ .../frontend/docs/design-preview.html | 603 +++ desktop/electron-shell/frontend/index.html | 12 + .../electron-shell/frontend/package-lock.json | 1576 +++++++ desktop/electron-shell/frontend/package.json | 23 + desktop/electron-shell/frontend/src/App.vue | 903 ++++ desktop/electron-shell/frontend/src/api.js | 172 + .../src/components/ChangePasswordDialog.vue | 76 + .../frontend/src/components/HomePage.vue | 242 + .../frontend/src/components/LogPanel.vue | 173 + .../frontend/src/components/LoginPage.vue | 653 +++ .../src/components/PlatformAccounts.vue | 163 + .../frontend/src/components/PluginPage.vue | 685 +++ .../frontend/src/components/ScenesPage.vue | 124 + .../frontend/src/components/SchedulePage.vue | 628 +++ desktop/electron-shell/frontend/src/main.js | 97 + desktop/electron-shell/frontend/src/store.js | 125 + desktop/electron-shell/frontend/src/style.css | 429 ++ .../electron-shell/frontend/vite.config.js | 20 + desktop/electron-shell/package-lock.json | 4168 +++++++++++++++++ desktop/electron-shell/package.json | 58 + .../scripts/build-python-env.ps1 | 191 + .../electron-shell/scripts/copy-renderer.ps1 | 15 + .../test-plugins/dummy_env_probe/__init__.py | 24 + 56 files changed, 17858 insertions(+) create mode 100644 desktop/electron-shell/.env.example create mode 100644 desktop/electron-shell/.gitignore create mode 100644 desktop/electron-shell/README.md create mode 100644 desktop/electron-shell/electron/app.js create mode 100644 desktop/electron-shell/electron/chrome-manager.js create mode 100644 desktop/electron-shell/electron/config.js create mode 100644 desktop/electron-shell/electron/cpclient.js create mode 100644 desktop/electron-shell/electron/creds-sync.js create mode 100644 desktop/electron-shell/electron/crypto.js create mode 100644 desktop/electron-shell/electron/db.js create mode 100644 desktop/electron-shell/electron/electron-main.js create mode 100644 desktop/electron-shell/electron/env-sync.js create mode 100644 desktop/electron-shell/electron/hub.js create mode 100644 desktop/electron-shell/electron/last-fields.js create mode 100644 desktop/electron-shell/electron/licensing.js create mode 100644 desktop/electron-shell/electron/logger.js create mode 100644 desktop/electron-shell/electron/main.js create mode 100644 desktop/electron-shell/electron/meta.js create mode 100644 desktop/electron-shell/electron/platform-auth.js create mode 100644 desktop/electron-shell/electron/platform-creds.js create mode 100644 desktop/electron-shell/electron/plugin-configs.js create mode 100644 desktop/electron-shell/electron/plugin-sync.js create mode 100644 desktop/electron-shell/electron/preload.js create mode 100644 desktop/electron-shell/electron/registry.js create mode 100644 desktop/electron-shell/electron/run-history.js create mode 100644 desktop/electron-shell/electron/runner.js create mode 100644 desktop/electron-shell/electron/scheduler.js create mode 100644 desktop/electron-shell/electron/server.js create mode 100644 desktop/electron-shell/electron/session.js create mode 100644 desktop/electron-shell/electron/shell-updater.js create mode 100644 desktop/electron-shell/electron/state.js create mode 100644 desktop/electron-shell/electron/tasks.js create mode 100644 desktop/electron-shell/frontend/docs/design-preview-v2.html create mode 100644 desktop/electron-shell/frontend/docs/design-preview.html create mode 100644 desktop/electron-shell/frontend/index.html create mode 100644 desktop/electron-shell/frontend/package-lock.json create mode 100644 desktop/electron-shell/frontend/package.json create mode 100644 desktop/electron-shell/frontend/src/App.vue create mode 100644 desktop/electron-shell/frontend/src/api.js create mode 100644 desktop/electron-shell/frontend/src/components/ChangePasswordDialog.vue create mode 100644 desktop/electron-shell/frontend/src/components/HomePage.vue create mode 100644 desktop/electron-shell/frontend/src/components/LogPanel.vue create mode 100644 desktop/electron-shell/frontend/src/components/LoginPage.vue create mode 100644 desktop/electron-shell/frontend/src/components/PlatformAccounts.vue create mode 100644 desktop/electron-shell/frontend/src/components/PluginPage.vue create mode 100644 desktop/electron-shell/frontend/src/components/ScenesPage.vue create mode 100644 desktop/electron-shell/frontend/src/components/SchedulePage.vue create mode 100644 desktop/electron-shell/frontend/src/main.js create mode 100644 desktop/electron-shell/frontend/src/store.js create mode 100644 desktop/electron-shell/frontend/src/style.css create mode 100644 desktop/electron-shell/frontend/vite.config.js create mode 100644 desktop/electron-shell/package-lock.json create mode 100644 desktop/electron-shell/package.json create mode 100644 desktop/electron-shell/scripts/build-python-env.ps1 create mode 100644 desktop/electron-shell/scripts/copy-renderer.ps1 create mode 100644 desktop/electron-shell/scripts/test-plugins/dummy_env_probe/__init__.py diff --git a/desktop/electron-shell/.env.example b/desktop/electron-shell/.env.example new file mode 100644 index 0000000..e49b8f0 --- /dev/null +++ b/desktop/electron-shell/.env.example @@ -0,0 +1,23 @@ +# 37du Electron 壳:开发环境配置(拷贝为 .env 并修改) +# ============================================================= +# 服务端地址(中心机控制面) +CONTROLPLANE_URL=http://117.72.191.188:8800 + +# 内部凭证(与中心机 controlplane/.env 的 CONTROLPLANE_TOKEN 保持一致;非空时发 X-API-Token) +CONTROLPLANE_TOKEN= + +# 插件执行子进程的 Python 解释器(解析优先级:本变量 > 环境包 python-env/current.json > 系统 python) +# 开发推荐显式指定项目 .venv;正式打包后不设即可自动使用随包/下发的环境包 +# PYTHON_EXE=D:\work\code\37duAutomation\.venv\Scripts\python.exe + +# 环境包目录的显式覆盖(默认:打包态 exe 同级 python-env/;dev electron-shell/python-env/) +# SHELL_PYTHON_ENV_ROOT=D:\work\code\37duAutomation\desktop\electron-shell\python-env + +# 插件执行超时(秒,浏览器类默认 30min) +RUN_TIMEOUT=1800 + +# 插件进程作业级内存上限(MB,环境包模式经 job_guard/Job Object 生效,默认 2048) +# RUN_MAX_MEM_MB=2048 + +# 调试:1 开启完整 JSON 调试日志 +# DEBUG=1 diff --git a/desktop/electron-shell/.gitignore b/desktop/electron-shell/.gitignore new file mode 100644 index 0000000..c5fd9a9 --- /dev/null +++ b/desktop/electron-shell/.gitignore @@ -0,0 +1,11 @@ +node_modules/ +dist-app/ +renderer/dist/ +*.log +_cp_sessions.json +.env + +# 便携 Python 环境包产物(体积大,构建/下载生成,不入库) +build/ +dist-env/ +python-env/ diff --git a/desktop/electron-shell/README.md b/desktop/electron-shell/README.md new file mode 100644 index 0000000..6b625cc --- /dev/null +++ b/desktop/electron-shell/README.md @@ -0,0 +1,256 @@ +# 37du 执行机客户端(Node/Electron 版) + +替代旧 Python `desktop/webhost/` 底座的新一代执行机客户端。**换壳不换插件**: +- 壳与底座:Electron + Node.js(主进程纯 Node,可无 Electron 运行) +- 插件执行机制:**保持 Python**,Node 壳负责生命周期/调度/权限,以子进程跑 `plugin_runner.py`(协议逐字节兼容) +- 服务端契约:以 [docs/桌面端/Node版客户端开发交接文档.md](../../docs/桌面端/Node版客户端开发交接文档.md) §5 为准,向后兼容,不改服务端公开接口 + +## 目录结构 + +``` +desktop/electron-shell/ +├── package.json # 依赖 ws(WS 服务) / adm-zip(插件包解压);devDeps electron +├── .env # 本模块配置(CONTROLPLANE_URL/TOKEN、PYTHON_EXE、RUN_TIMEOUT) +├── .env.example # 配置样例 +├── frontend/ # 壳自有的 Vue3 前端源码(从 webhost/frontend 复制独立演进,老版本不受影响) +│ └── src/ # - style.css:设计令牌(token 层)+ [data-skin] 皮肤机制,默认 cream 奶油风 +│ # - main.js:皮肤应用(localStorage['37du.skin'])+ 涂鸦装饰层(localStorage['37du.doodles']) +│ # - components/LoginPage.vue:登录页(浅天蓝强调 + 手写标题字体) +├── renderer/dist/ # 前端构建产物(npm run copy-renderer 从 frontend/ 构建,自包含) +├── scripts/ +│ ├── copy-renderer.ps1 # 构建 frontend/ → renderer/dist +│ └── build-python-env.ps1 # 构建便携 Python 环境包(python-env-.zip + 本地安装) +├── python-env/ # 便携 Python 环境包(build-python-env 产物;dev 联调用) +│ └── current.json # 指向当前版本目录(客户端自动探测) +└── electron/ # 主进程(CommonJS,纯 Node 可跑) + ├── main.js # 入口:--cli 无 Electron 运行 / electron . 窗口模式 + ├── config.js # .env 加载 + 路径常量(对齐 Python config.py) + ├── logger.js # 日志(INFO 屏蔽大 JSON,DEBUG=1 全开) + ├── state.js # 运行会话/白名单/平台表(对齐 state.py) + ├── hub.js # 事件枢纽 → WS /ws 广播(对齐 hub.py) + ├── session.js # cp_session cookie 会话 + 落盘 + 云令牌(对齐 session.py) + ├── cpclient.js # 中心机 REST 客户端(_cp_call 等价) + ├── crypto.js # Ed25519 验签 / RSA-OAEP / sha256 / 版本比较 + ├── licensing.js # 授权票据/管控清单/公钥缓存 + 验签 + 运行上报 + 设备上报 + ├── registry.js # 插件元数据注册表(plugin.json 驱动) + ├── plugin-sync.js # 插件自下载/更新/清理(download-ticket + sha256 + 原子安装) + ├── runner.js # 插件执行:spawn python plugin_runner + 整树强杀 + 事件转发 + ├── run-history.js # 运行历史:run_history.jsonl 索引 + run_history/.jsonl 日志 + ├── last-fields.js # 上次执行参数回填(按账号+插件,password 字段不落盘) + ├── scheduler.js # 设备级单活(active.json)+ 平台命名空间并发闸 + ├── tasks.js # 5 段 cron 定时任务 + 中心机备份/恢复 + ├── platform-auth.js # HR/OA 登录/登出/在线校验(登录走 Python 子进程) + ├── meta.js # /api/meta 聚合 + ├── creds-sync.js # 敏感凭证下发(RSA 密钥对 + OAEP 解密 + 密文缓存) + ├── shell-updater.js # 壳子自更新(检查/下载/静默升级) + ├── chrome-manager.js # Chrome 检测/下载/静默安装 + ├── server.js # 本地 HTTP/WS 兼容层(127.0.0.1:8799) + ├── app.js # 启动组装 + ├── env-sync.js # 环境包(便携 Python)检查/下载/解压/切换/回滚 + ├── electron-main.js # Electron 窗口/托盘/单实例/自启(已移除默认英文菜单) + └── preload.js # contextBridge(渲染层主通道走 HTTP) +``` + +## 运行 + +```powershell +# 1. 安装依赖 +cd desktop/electron-shell +npm install + +# 2. 构建前端静态资源(源码在 frontend/,产物 → renderer/dist;旧 webhost 前端不受影响) +npm run copy-renderer + +# 3a. 无窗口 CLI 模式(调试/无人值守) +node electron/main.js --cli + +# 3b. Electron 窗口模式 +npm run electron +``` + +## 配置(.env) + +| 变量 | 说明 | +|---|---| +| `CONTROLPLANE_URL` | 中心机控制面地址(如 `http://117.72.191.188:8800`) | +| `CONTROLPLANE_TOKEN` | 内部凭证(与 controlplane/.env 一致;非空时发 X-API-Token) | +| `PYTHON_EXE` | 插件执行子进程的 Python 解释器。**解析优先级**:显式 `PYTHON_EXE` > 环境包 `python-env/current.json` 指向的 `python.exe` > 系统 `python`(不设即可用环境包) | +| `SHELL_PYTHON_ENV_ROOT` | 环境包目录的显式覆盖(默认:打包态 exe 同级 `python-env/`,dev `electron-shell/python-env/`) | +| `RUN_TIMEOUT` | 插件执行超时秒数(默认 1800) | +| `RUN_MAX_MEM_MB` | 插件进程作业级内存上限(默认 2048,环境包模式经 job_guard 生效) | +| `DEBUG=1` | 开启完整 JSON 调试日志 | + +## 便携 Python 环境包(python-env) + +正式打包的客户端**开箱即用**:不依赖用户机器上安装的任何 Python。环境包 = 便携解释器 +(embeddable 3.11.9)+ 全部插件依赖(与 .venv 验证版本钉死)+ webhost 运行时子集 +(`plugin_runner` / `plugins` / `shared` / `core.auth`)。 + +```powershell +# 构建(本地联调会同时安装到 electron-shell/python-env/) +powershell -NoProfile -ExecutionPolicy Bypass -File scripts\build-python-env.ps1 [-EnvVersion 1.0.0] +# 产物:dist-env/python-env-.zip + .sha256 +``` + +- **加载**:`config.pythonEnvRoot()` 读 `python-env/current.json` → 版本目录;插件执行走 + `python-exe -u webhost/backend/core/job_guard.py --mem --timeout -- python -u plugin_runner.py ...` + —— Job Object 整树托管 + 内存上限(对齐旧 Python 底座 winjob 能力);stdin/stdout/stderr + 逐字节透传,执行协议不变。 +- **下发**:中心机 `agent_cli file push --category python-env --version ` 登记后, + 客户端启动/每 30 分钟检查 `/api/file-sources/python-env`,有新版自动下载 → sha256 → + 解压 `python-env//` → 切 `current.json` → 保留上一版供回滚。 +- **本地 API**:`GET /api/env/status`(版本/云端/进度)、`POST /api/env/sync`(手动检查更新)、 + `POST /api/env/rollback`(回滚上一版);`/api/meta` 增加 `env.version` 字段。 + +## 跨端共享数据(%LOCALAPPDATA%\37duAutomation) + +与旧 Python 底座/影刀版**同路径同格式**(换壳不破坏数据): + +| 文件/目录 | 用途 | +|---|---| +| `license.json` / `control.json` / `keys/pub.pem` | 离线授权票据/管控清单/公钥(Ed25519 验签) | +| `active.json` | 设备级单活运行状态 | +| `schedules.json` | 定时任务配置(按账号隔离);每条含 `last_status/last_duration/last_error` 最近一次结论。触发语义:**错过不补跑**(壳子停机/离线期间到点的任务直接跳过,要补就人工运行一次);触发失败(授权被拒/插件缺失)跳过本次到点,等下一个 cron 点再试 | +| `run_history.jsonl` + `run_history/.jsonl` | 运行历史:索引(结论,最近 300~350 条)+ 每次运行独立日志文件 | +| `last_run_fields.json` | 上次执行参数(按账号+插件,用于表单回填;`password` 类型字段不写入) | +| `plugin_configs/` | 插件个性化配置(账号密码等) | +| `.sessions/` | HR/OA 平台登录 cookies(三方共享) | +| `creds/id_rsa.pem` + `creds/cache.json` | RSA 私钥 + 加密凭证缓存 | +| `offline_reports.jsonl` | 离线上报暂存(重连补报) | +| `plugin_allow.json` | 插件权限清单缓存(离线兜底) | +| `plugin_rollback/` | 插件回滚备份:升级前自动保留上一版(`@/`,每插件仅最新一版),坏包可在运行台一键回滚 | +| `window-state.json` | 主窗口位置/尺寸(重启还原;显示器变更后自动避让屏幕外) | + +## 插件安全基线 + +- **插件 UI 加固**:`/pui//` 响应带 Content-Security-Policy(仅同源资源,阻断外联脚本/图片与外域跳转);壳内嵌 iframe 带 `sandbox="allow-scripts allow-same-origin allow-forms"`(禁止 top 跳转与弹窗) +- **版本兼容校验**:插件 `plugin.json` 可声明 `minRuntimeVersion`(要求的最小壳运行时版本);安装时校验,不满足拒绝安装并提示先升级客户端 +- **回滚**:升级前自动备份上一版到 `plugin_rollback/`,设备空闲时可在运行台回滚(回滚后再次同步可回到最新版) +- WS 心跳:30s ping 巡检,僵尸/半开连接自动 terminate + +## 插件执行协议(★ 与旧底座逐字节兼容) + +``` + -u --plugin --run [--allowed a,b] + stdin : 单行 JSON fields(UTF-8) + stdout : JSON 事件行 {ev: log|progress|result} + stderr : 诊断通道(转发为 ERROR 日志) +``` + +- 设备级单活:整机同时只跑一个插件(active.json 门闩) +- 平台命名空间并发闸:同平台(hr/oa)任务串行,保护共享 cookies +- 超时强杀:`taskkill /pid /T /F` 整树终止(含浏览器孙进程) +- 授权门禁:启动前验签本地授权票据 + 下架/禁用/强制更新校验 + +## 本地 HTTP 兼容层(127.0.0.1:8799) + +路由与返回结构与旧底座 `backend/apis/*` 一致:`/api/meta`、`/api/admin/*`、`/api/runs*`、 +`/api/schedules*`、`/api/plugins/sync`、`/api/plugin-config/{pid}`、`/pui/{pid}`、`/api/shell/*`、 +`/api/chrome/*`、`/api/platforms/*`、钉钉登录链路(`/api/auth/dingtalk`、`/auth/done`)、 +WS `/ws`(登录会话鉴权,广播 log/progress/run_done)。 + +新增(向后兼容,均为追加): +- `GET /api/runs?limit=N` —— 运行历史列表(按当前账号,最新在前)。返回 `{runs:[{run_id, plugin_id, name, + version, trigger, schedule_id, status, ok, error, summary, started, finished, duration_sec}]}`, + **不含 logs**(列表页不解析历史日志,避免大文件拖慢);`trigger` 为 `manual` / `schedule`。 +- `GET /api/runs/{id}` —— 运行详情。内存中已结束的运行会回落 `run_history`,因此重启后仍可回看日志。 +- `GET /api/plugins/{id}/last-fields` —— 上次执行参数回填,返回 `{fields, at}`。 + 写入时机为 `POST /api/runs`(发起执行时自动记忆);`fields` schema 中 `type/format` 为 `password` + 的键**永不落盘、永不下发**(插件字段可能含凭据)。 + +## 打包(electron-builder) + +```powershell +npm install # 含 electron + electron-builder(首次需放行 electron postinstall) +npm run pack # → dist-app/setup-37du-shell-.exe(NSIS 静默升级兼容) +``` + +打包后:插件根目录 = exe 同级 `plugins/`;壳子版本文件 = exe 同级 `shell.version` +(参与自更新的前提,与旧壳一致);`apply_update` 以 `/VERYSILENT /SUPPRESSMSGBOXES /NORESTART` +运行新安装包后退出,由 Inno `[Run]` 重启新版本。 + +## 验证记录(2026-09-23,线上控制面) + +- 登录/登出/改密、`/api/admin/me` 昵称补齐 ✓ +- `/api/meta` 授权票据驱动插件可见性(2 个授权插件 + 字段/UI 元数据)✓ +- 授权票据 Ed25519 离线验签 ✓;运行门禁 404/403 路径 ✓ +- 插件同步(清单 diff → 已有最新,无下载)✓;Chrome 检测(本机已装 154.x)✓ +- 定时任务 CRUD + 非法 cron 拒绝 + 删除 ✓;WS 鉴权握手 ✓ +- 执行协议三态自测:成功回传 / 异常回传(含 stderr Traceback 转发)/ 超时强杀 ✓ +- 奶油极简治愈风前端(frontend/ 自持源码):登录页浅天蓝强调 + 手写标题字体 + 可开关涂鸦装饰层 ✓ + +## 前端主题(token 层 + 可换肤) + +壳自带 `frontend/` 前端源码(从 webhost 复制后独立演进)。**样式与皮肤已分层**: + +- **token 层**:`frontend/src/style.css` 的 `:root` 是唯一色值来源(111 个 token,含 + `--primary-rgb` / `--ok-rgb` / `--text-rgb` 这类分量变量,供 `rgba()` 拼装)。 + 组件(`.vue`)里**不写任何字面色值**,只用 `var(--token)`;`password`/`#000` 掩码等 + 非主题色与 SVG `data:` URI 内的色值除外(后者无法用 `var()`)。 + 改动样式请先加 token 再引用,不要再写字面值。 +- **皮肤层**:`[data-skin="..."]` 块只重映射同名 token,组件代码零改动。 + - `cream`(默认):奶油极简治愈风,背景 `#F9F7F2` / 文本 `#222`·`#666` / 强调 `#7CC3E8`, + 卡片 16px、登录卡 22px、按钮输入 12–14px 大圆角,仅极柔和浅阴影。 + - `precision`:冷灰画布 + 压深天蓝(`#1E6FA8`)的"精密工作台"。**2026-09 已完成对比度审计**: + 正文/次级/弱化文字、按钮白字、磁贴图标、成功/警告/失败徽章等 19 组关键配对全部达到 + WCAG 阈值(正文 ≥4.5、徽章/图标 ≥3.0,实测 3.27~16.03);cream 的 5 处偏低(弱化文字、 + 粉彩徽章、淡红失败图标)是奶油风**刻意保留的柔和粉彩设计**,非缺陷。 + - 切换:`localStorage['37du.skin'] = 'cream' | 'precision'`(`main.js` 挂载前写入 + ``,避免首屏闪烁)。皮肤同时重映射 element-plus 的 `--el-color-primary*`, + 否则内置表单/表格会残留奶油浅蓝。 + - 磁贴类(场景图标/头像)前景色走 `--tile-fg`:cream 为白色(配深渐变), + precision 为深蓝(配淡色底)——**换肤时若把 `--grad-*` 改成淡色,必须同步改 `--tile-fg`**; + 2026-09 已把左栏场景图标/统计图标/场景卡图标/运行台 hero 头像统一到 `--tile-fg`, + 修掉 precision 下"白字落在淡色底上"的不可读问题(cream 取值同为白色,观感不变)。 +- **涂鸦装饰层**:手绘涂鸦 SVG fixed 浮于页面顶层,`pointer-events:none` 不拦截交互; + 登录页右上角 ✿ 按钮或 `localStorage['37du.doodles']='off'` 可整体关闭; + 它是奶油皮肤专属装饰,`precision` 皮肤下由 CSS 整体隐藏。 +- 标题可用圆润手写装饰字体(`--font-doodle`:Segoe Script → Comic Sans → 楷体),正文固定无衬线 Inter。 + +产品化界面(2026-09 三栏版,对齐 design-preview-v2 的信息架构): +- **三栏骨架**:左栏场景导轨 + 中栏内容区(总览/运行台/计划)+ 右栏活动流(<1240px 自动收起) + + 底部状态栏。三栏与状态栏为静态面板,不做悬停抬升;顶栏保留浏览器检测 CTA 与运行进度。 +- **左栏**:总览 / 计划 主导航 + 场景库(浅天蓝激活态,点击进运行台) +- **右栏活动流**:当前运行(运行中显示场景名/进度条/最近日志,空闲显示"当前空闲") + + 最近运行(最近 8 次,点击直达该场景运行台);运行态由 WS 事件驱动, + 定时任务触发的运行同样点亮(`store.running` 在 `run_start` 置位,日志归属本次运行) +- **状态栏**:授权状态(剩余天数/异常)/ 本地服务连接 / 本地地址 / 平台在线 N/M / + 壳子版本 + 检查更新;授权异常态标红提示 +- **运行台**:Hero 卡(大图标/版本徽章/平台登录态)+ 一键执行大按钮(执行中显示进度环) + + 结果横幅(成功/失败);下方标签页:有专属界面的插件默认「插件界面」内嵌 iframe, + 其余默认「参数配置」白卡,运行日志独立标签(LIVE 呼吸点 + 级别过滤,圆角交给卡片容器) +- **运行台 · 历史运行**:第三标签页列出本场景最近 30 次运行(手动/定时、成功/失败、时间/耗时), + 点击任一条**回看该次运行**:结果徽章 + 触发方式 + 摘要 + 该次完整日志(`GET /api/runs/{id}` + 落回 `run_history/` 的逐次日志文件);右栏「最近运行」、总览「最近动态」点击直达对应回看 +- 视图切换:`store.view` 取值 `overview`(总览)/ `run`(运行台)/ `plans`(计划) + +## 行为变更(2026-09,需知悉) + +| 项 | 变更 | 影响 | +|---|---|---| +| cron 星期编号 | `tasks.js cronDow` 原为 `(getDay()+6)%7`(周一=0),与 Python 底座 `tasks.py _cron_dow`(`(weekday()+1)%7`,周日=0,标准 cron)**差一天** | 已修正为 `dt.getDay()`。**存量排程会平移**:`0 8 * * 1-5`(工作日)原先实际在**周二~周六**触发,修正后按界面标注的**周一~周五**触发;`0`/`7`(周日)原先落在周一,修正后落在周日;`* * * * 6`(周六)原先无法命中周六 | +| 运行历史 | 新增 `run_history.jsonl` + `run_history/` | 首次运行自动创建,无需迁移;上限最近 300~350 条,超出按批裁剪并清理孤儿日志文件 | + +## 平台登录(HR/OA)按账号隔离 + +- 每个人的 HR/OA 账号密码由本人在「个人中心 → 平台账号」填写(AES-256-GCM 本机加密, + 存 `%LOCALAPPDATA%\37duAutomation\platform-creds\creds.json`),顶栏不再显示设备级平台徽章 +- 平台会话 cookies 按账号隔离:`.sessions/<账号>/hr_cookies.json`、`oa_cookies.json`; + Python 共享模块(hr_login / oa_login / seal_data_export / roster_export_api / org_export / + core.auth)通过 `PLATFORM_ACCOUNT` 环境变量解析各自的会话目录,未设置时沿用共享目录(兼容旧逻辑) +- 登录/登出:壳端 `platform-auth` 拉起 Python 登录子进程时注入 `PLATFORM_ACCOUNT` + 与账号的 `hr_login_username/password`(个人账号密码优先,未配置回退共享 .env) +- 插件执行:runner 子进程同样注入 `PLATFORM_ACCOUNT`,插件内数据导出按当前登录账号的身份执行; + 同平台并发闸键改为(账号, 平台) +- 接口:`GET /api/meta` 平台在线按当前账号返回;`GET /api/platforms/status` 返回当前账号 + 的平台在线/是否已配置个人账号/已存用户名;`PUT /api/platforms/creds` 保存个人账号密码 + +## 已知差异(相对旧 Python 底座) + +| 项 | 说明 | +|---|---| +| 进程内存上限 | 环境包模式已实现(job_guard + Job Object,`RUN_MAX_MEM_MB`);无环境包直拉 .venv 的 dev 链路未做(超时强杀已覆盖主要风险) | +| 定时任务错过触发 | 旧底座重启后逐点补跑错过的触发点;Node 版**错过不补跑**(停机/离线期间到点直接跳过,要补就人工运行一次) | +| 平台登录 | 登录自动化仍为 Python 子进程(DrissionPage 滑块);在线校验改为 Node 直接 HTTP 校验(复刻同逻辑,短缓存) | +| 渲染层 | 复用 webhost Vue3 前端产物(本地 HTTP 主通道);IPC 通道为后续演进预留(preload 已就位) | +| 云令牌持久化 | 旧底座仅内存;Node 版随 `_cp_sessions.json` 落盘,重启后 Bearer 仍可用 | diff --git a/desktop/electron-shell/electron/app.js b/desktop/electron-shell/electron/app.js new file mode 100644 index 0000000..3f6167e --- /dev/null +++ b/desktop/electron-shell/electron/app.js @@ -0,0 +1,157 @@ +// 应用组装层:启动初始化(单活复位/权限/授权/插件同步/壳子检查/定时任务/设备上报)+ 本地服务。 +"use strict"; + +const os = require("os"); +const fs = require("fs"); +const path = require("path"); +const crypto = require("crypto"); +const config = require("./config"); +const state = require("./state"); +const session = require("./session"); +const scheduler = require("./scheduler"); +const licensing = require("./licensing"); +const registry = require("./registry"); +const pluginSync = require("./plugin-sync"); +const tasks = require("./tasks"); +const shellUpdater = require("./shell-updater"); +const chromeManager = require("./chrome-manager"); +const envSync = require("./env-sync"); +const { makeLogger, setLogFile } = require("./logger"); + +const logger = makeLogger("app"); + +// 设备 ID:持久化 uuid(跨重启稳定,供 device/report) +function deviceId() { + const f = path.join(config.APP_DATA, "device_id"); + try { + if (fs.existsSync(f)) { + const v = fs.readFileSync(f, "utf-8").trim(); + if (v) return v; + } + const id = crypto.randomUUID(); + fs.mkdirSync(config.APP_DATA, { recursive: true }); + fs.writeFileSync(f, id, "utf-8"); + return id; + } catch (e) { + return "dev-" + crypto.randomBytes(8).toString("hex"); + } +} + +function localIp() { + try { + const ifs = os.networkInterfaces(); + for (const list of Object.values(ifs)) { + for (const it of list || []) { + if (it.family === "IPv4" && !it.internal) return it.address; + } + } + } catch (e) { + /* 忽略 */ + } + return ""; +} + +// 设备环境上报(心跳 + Chrome 环境):Node 版新增接入(旧 Python 底座无调用方) +async function reportDevice(account) { + const chrome = await chromeManager.detectLocal(); + await licensing.deviceReport(deviceId(), account, { + hostname: os.hostname(), + os: process.platform, + ip: localIp(), + chromeInstalled: chrome.installed, + chromeVersion: chrome.version, + chromeOk: chrome.installed, + }); +} + +async function init(options = {}) { + // 崩溃现场落盘(窗口模式无控制台时排查唯一窗口):Electron 运行时都落盘(含打包版), + // CLI 纯 Node 模式日志走 stdout 即可。不能依赖 ELECTRON_RENDERER_URL(本工程从不设置)。 + // ★ 日志放数据根 %LOCALAPPDATA%\37duAutomation\logs\(打包态 SHELL_ROOT 在 app.asar 内只读,不能写) + if (process.versions && process.versions.electron) { + setLogFile(path.join(config.APP_DATA, "logs", "shell.log")); + } + + scheduler.initActive(); + + // 账号:优先 .env,其次最近活跃本机会话 + const account = config.CONTROLPLANE_ACCOUNT || session.sessActiveAccount(); + if (config.CONTROLPLANE_URL) { + // 权限白名单(fail-closed) + try { + const allowed = await pluginSync.resolveAllowed(account); + state.setAllowed(allowed); + } catch (e) { + state.setAllowed(new Set()); + } + + // 敏感凭证中心化下发(在线拉取 RSA 解密 / 本地缓存兜底;失败不阻断启动) + try { + const creds = await require("./creds-sync").load(account); + if (creds && Object.keys(creds).length) { + config.applyCreds(creds); + logger.info(`中心机敏感凭证下发完成(${Object.keys(creds).length} 个键)`); + } + } catch (e) { + logger.warning(`加载中心机敏感凭证失败:${e.message}`); + } + + // 启动同步离线授权票据 + if (account) { + try { + await licensing.syncLicensing(account); + logger.info(`启动同步离线授权票据成功(账号 ${account})`); + } catch (e) { + logger.warning(`启动同步离线授权票据失败:${e.message}`); + } + } + + // 启动即检查插件更新(后台,不阻塞启动) + const accts = session.accountSet(); + if (accts.size > 0) { + const firstAcct = accts.values().next().value; + void pluginSync + .withSyncLock(async () => { + await pluginSync.syncPlugins(firstAcct); + const manifest = await pluginSync.cloudPluginManifest(firstAcct); + if (manifest !== null) state.setAllowed(new Set(manifest.map((p) => p.id))); + logger.info(`启动插件更新完成(账号 ${firstAcct})`); + }) + .catch((e) => logger.warning(`启动插件更新失败:${e.message}`)); + } + + // 环境包(便携 Python 运行时):启动即检查(异步不阻塞),缺失/有新版本自动下载; + // 插件执行/平台登录在环境包就绪前会报"环境包未就绪",由设置页提供状态与手动更新 + void envSync + .checkAndSync() + .then((r) => logger.info(`环境包检查:${r.ok ? `就绪 v${r.version || ""}` : `未就绪(${r.reason})`}`)) + .catch((e) => logger.warning(`环境包启动检查异常:${e.message}`)); + // 常驻周期检查(30 分钟,与壳子更新同频) + setInterval(() => { + void envSync.checkAndSync().catch((e) => logger.warning(`环境包周期检查异常:${e.message}`)); + }, 30 * 60 * 1000); + + // 壳子更新:启动检查 + 常驻周期检查 + shellUpdater.startCheck(); + shellUpdater.startPeriodicCheck(); + + // 定时任务:加载 + 后台触发 + 云端合并恢复 + tasks.init(); + + // 设备上报(Chrome 环境 + 心跳;失败静默) + void reportDevice(account) + .then(() => logger.info("设备环境上报完成")) + .catch(() => {}); + } else { + logger.info("未配置中心机地址(CONTROLPLANE_URL),进入离线本地模式"); + state.setAllowed(new Set()); + tasks.load(); + tasks.start(); + } + + logger.info(`插件根目录:${registry.pluginRoot()}`); + logger.info(`数据根目录:${config.APP_DATA}`); + return { deviceId: deviceId(), account }; +} + +module.exports = { init, deviceId }; diff --git a/desktop/electron-shell/electron/chrome-manager.js b/desktop/electron-shell/electron/chrome-manager.js new file mode 100644 index 0000000..d38f621 --- /dev/null +++ b/desktop/electron-shell/electron/chrome-manager.js @@ -0,0 +1,279 @@ +// 浏览器(Chrome)管理:检测本机是否已装 Chrome → 从中心机拿内网链接下载安装包 → 静默安装。 +// 对齐 Python chrome_manager.py 的状态结构与流程。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const { spawn, execFile } = require("child_process"); +const cp = require("./cpclient"); +const config = require("./config"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("chrome-manager"); + +const CHROME_CACHE = path.join(config.APP_DATA, "chrome"); +let _pendingPkg = null; + +const _STATE = { + installed: true, + version: "", + checking: false, + check_error: "", + cloud_available: true, + dl_status: "idle", + dl_received: 0, + dl_total: 0, + dl_pct: 0, + dl_error: "", + installing: false, +}; + +const VERSION_RE = /^\d+\.\d+\.\d+\.\d+$/; + +// 本机检测缓存:前端轮询 status 时避免每 2s 反复 spawn reg/powershell +let _localCache = { ts: 0, value: null }; +const LOCAL_CACHE_TTL = 30 * 1000; + +async function detectLocal(force = false) { + const now = Date.now(); + if (!force && _localCache.value && now - _localCache.ts < LOCAL_CACHE_TTL) { + return _localCache.value; + } + const exe = await findChromeExe(); + let value; + if (!exe) value = { installed: false, version: "" }; + else value = { installed: true, version: await readVersion(exe) }; + _localCache = { ts: now, value }; + return value; +} + +function execFileAsync(file, args, timeout = 8000) { + return new Promise((resolve) => { + execFile(file, args, { timeout, windowsHide: true }, (err, stdout, stderr) => { + if (err) resolve({ err, stdout: stdout || "", stderr: stderr || "" }); + else resolve({ err: null, stdout: stdout || "", stderr: stderr || "" }); + }); + }); +} + +// 注册表探测 Chrome.exe 路径(64/32 位) +async function findChromeExe() { + const roots = [ + ["HKLM", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe"], + ["HKLM", "SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe"], + ["HKCU", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe"], + ]; + for (const [hive, key] of roots) { + const r = await execFileAsync("reg", ["query", `${hive}\\${key}`, "/ve"]); + if (!r.err) { + // 输出形如: (默认) REG_SZ C:\...\chrome.exe + const m = /REG_SZ\s+(.+)$/m.exec(r.stdout); + if (m && fs.existsSync(m[1].trim())) return m[1].trim(); + } + } + // 目录扫描兜底 + const dirs = [ + path.join(process.env.PROGRAMFILES || "C:/Program Files", "Google", "Chrome", "Application"), + path.join(process.env["PROGRAMFILES(X86)"] || "C:/Program Files (x86)", "Google", "Chrome", "Application"), + path.join(config.APP_DATA, "..", "Google", "Chrome", "Application"), + ]; + for (const d of dirs) { + const p = path.join(d, "chrome.exe"); + if (fs.existsSync(p)) return p; + } + return null; +} + +async function readVersion(exe) { + const r = await execFileAsync( + "powershell", + ["-NoProfile", "-NonInteractive", "-Command", `(Get-Item -LiteralPath '${exe}').VersionInfo.ProductVersion`], + 8000 + ); + if (r.err) return ""; + const v = r.stdout.trim(); + return VERSION_RE.test(v) ? v : ""; +} + +async function cloudInfo() { + if (!config.CONTROLPLANE_URL) return null; + try { + const r = await cp.request("GET", "/api/file-sources/chrome", { headers: cp.machineHeaders(), timeout: 5 }); + if (!r.available) { + _STATE.cloud_available = false; + return null; + } + _STATE.cloud_available = true; + return r; + } catch (e) { + logger.info(`获取浏览器云端信息失败(离线跳过):${e.message}`); + _STATE.cloud_available = false; + return null; + } +} + +async function status() { + const local = await detectLocal(); + if (local.installed) { + _STATE.installed = true; + _STATE.version = local.version; + _STATE.check_error = ""; + } else { + _STATE.installed = false; + _STATE.version = ""; + } + const pkgOk = !!_pendingPkg && fs.existsSync(_pendingPkg); + return { + installed: !!_STATE.installed, + version: _STATE.version || "", + downloaded: !!pkgOk, + cloud_available: !!_STATE.cloud_available, + error: _STATE.check_error || "", + installing: !!_STATE.installing, + dl: { + status: _STATE.dl_status || "idle", + received: _STATE.dl_received || 0, + total: _STATE.dl_total || 0, + pct: _STATE.dl_pct || 0, + error: _STATE.dl_error || "", + }, + }; +} + +async function refresh() { + _STATE.checking = true; + try { + await detectLocal(); + await cloudInfo(); + } catch (e) { + logger.warning(`浏览器检测异常:${e.message}`); + } finally { + _STATE.checking = false; + } +} + +let _downloading = false; + +async function startDownload() { + if (_STATE.dl_status === "downloading") return; + if (_STATE.dl_status === "downloaded" && _pendingPkg && fs.existsSync(_pendingPkg)) return; + const info = await cloudInfo(); + if (!info || !info.url) return; + const url = String(info.url).trim(); + const expect = String(info.sha256 || "").toLowerCase(); + const filename = String(info.filename || "ChromeStandaloneSetup64.exe").trim(); + if (_downloading) return; + _downloading = true; + _STATE.dl_status = "downloading"; + _STATE.dl_received = 0; + _STATE.dl_total = 0; + _STATE.dl_pct = 0; + _STATE.dl_error = ""; + try { + await download(url, expect, filename); + } catch (e) { + logger.warning(`下载 Chrome 安装包失败:${e.message}`); + _STATE.dl_status = "failed"; + _STATE.dl_error = `安装包下载失败(${e.constructor.name})`; + cleanupPart(); + } finally { + _downloading = false; + } + logger.info(`开始下载 Chrome 安装包:${url}`); +} + +async function download(url, expect, filename) { + const crypto = require("crypto"); + const sha = crypto.createHash("sha256"); + const tmp = path.join(CHROME_CACHE, `${filename}.part`); + const pkg = path.join(CHROME_CACHE, filename); + fs.mkdirSync(CHROME_CACHE, { recursive: true }); + const out = fs.createWriteStream(tmp); + let received = 0; + let total = 0; + const ctrl = new AbortController(); + const timer = setTimeout(() => ctrl.abort(), 600 * 1000); + const res = await fetch(url, { signal: ctrl.signal, redirect: "follow" }); + if (!res.ok) throw new Error(`HTTP ${res.status}`); + total = parseInt(res.headers.get("content-length") || "0", 10); + const reader = res.body.getReader(); + for (;;) { + const { done, value } = await reader.read(); + if (done) break; + out.write(value); + sha.update(value); + received += value.length; + _STATE.dl_received = received; + _STATE.dl_total = total; + _STATE.dl_pct = total ? Math.floor((received * 100) / total) : 0; + } + clearTimeout(timer); + await new Promise((res2, rej2) => out.end((e) => (e ? rej2(e) : res2()))); + const digest = sha.digest("hex"); + if (expect && digest !== expect) { + logger.error("Chrome 安装包 sha256 校验失败"); + _STATE.dl_status = "failed"; + _STATE.dl_error = "安装包校验失败,请重试"; + cleanupPart(); + return; + } + try { + fs.renameSync(tmp, pkg); + } catch (e) { + _STATE.dl_status = "failed"; + _STATE.dl_error = "安装包保存失败"; + cleanupPart(); + return; + } + _pendingPkg = pkg; + _STATE.dl_status = "downloaded"; + _STATE.dl_pct = 100; + _STATE.dl_received = received; + _STATE.dl_total = total; + logger.info(`Chrome 安装包下载完成:${pkg}`); +} + +function cleanupPart() { + try { + for (const f of fs.readdirSync(CHROME_CACHE)) { + if (f.endsWith(".part")) fs.unlinkSync(path.join(CHROME_CACHE, f)); + } + } catch (e) { + /* 忽略 */ + } +} + +function install() { + if (!_pendingPkg || !fs.existsSync(_pendingPkg)) { + throw Object.assign(new Error("未找到已下载的 Chrome 安装包"), { status: 404 }); + } + _STATE.installing = true; + logger.info(`开始静默安装 Chrome:${_pendingPkg}`); + const child = spawn(_pendingPkg, ["/silent", "/install"], { + cwd: path.dirname(_pendingPkg), + windowsHide: true, + stdio: "ignore", + detached: true, + }); + child.unref(); + void pollInstall(); + return { ok: true, installing: true }; +} + +async function pollInstall() { + for (let i = 0; i < 60; i++) { + await new Promise((r) => setTimeout(r, 5000)); + const local = await detectLocal(); + if (local.installed) { + _STATE.installing = false; + _STATE.installed = true; + _STATE.version = local.version; + logger.info(`Chrome 安装完成:${_STATE.version}`); + return; + } + } + _STATE.installing = false; + logger.warning("等待 Chrome 安装完成超时"); +} + +module.exports = { status, refresh, startDownload, install, detectLocal }; diff --git a/desktop/electron-shell/electron/config.js b/desktop/electron-shell/electron/config.js new file mode 100644 index 0000000..e4e460d --- /dev/null +++ b/desktop/electron-shell/electron/config.js @@ -0,0 +1,204 @@ +// 37du Electron 壳:配置固化(.env 加载 + 路径 + 常量) +// 对齐 Python webhost backend/core/config.py 的语义与路径约定。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); + +// 打包态判定:Electron 运行时 + resources 下存在 app.asar(打包版独有,dev `electron .` 无 asar)。 +// 不能依赖 ELECTRON_RENDERER_URL(那是 electron-vite 等 dev-server 工具的变量,本工程从不设置)。 +const IS_FROZEN = + !!process.versions && + !!process.versions.electron && + !!process.resourcesPath && + !process.env.ELECTRON_RUN_AS_NODE && + fs.existsSync(path.join(process.resourcesPath, "app.asar")); + +// 本模块目录:desktop/electron-shell/electron → parents +const SHELL_ROOT = path.resolve(__dirname, ".."); + +// 仓库根:electron/../.. = 37duAutomation(dev 模式定位 plugins/ 与 webhost 参考实现) +const REPO_ROOT = path.resolve(SHELL_ROOT, "..", ".."); +const DESKTOP_ROOT = path.resolve(SHELL_ROOT, ".."); + +// ==================== 轻量 .env 加载(仅本模块目录,变量已存在则不覆盖) ==================== +function loadDotEnv() { + const envPath = path.join(SHELL_ROOT, ".env"); + if (!fs.existsSync(envPath)) return; + try { + const text = fs.readFileSync(envPath, "utf-8"); + for (const rawLine of text.split(/\r?\n/)) { + const line = rawLine.trim(); + if (!line || line.startsWith("#") || !line.includes("=")) continue; + const idx = line.indexOf("="); + const key = line.slice(0, idx).trim(); + const value = line.slice(idx + 1).trim(); + if (key && process.env[key] === undefined) process.env[key] = value; + } + } catch (e) { + // 读取失败静默(与 Python 实现一致) + } +} +loadDotEnv(); + +// ==================== 基础常量 ==================== +const PORT = 8799; + +// 数据根目录:与影刀版 / 旧 Python 底座共享 %LOCALAPPDATA%\37duAutomation(跨端契约) +function localAppData() { + return process.env.LOCALAPPDATA || process.env.APPDATA || require("os").homedir(); +} +const APP_DATA = path.join(localAppData(), "37duAutomation"); + +// 插件本地配置目录:per-plugin JSON 持久化 +const PLUGIN_CONFIG_DIR = path.join(APP_DATA, "plugin_configs"); + +// 插件源码/安装根:dev = 仓库根 plugins/;打包 = exe 同级 plugins/ +function pluginRoot() { + if (process.env.SHELL_PLUGIN_ROOT) return process.env.SHELL_PLUGIN_ROOT; + if (IS_FROZEN) { + return path.join(path.dirname(process.execPath), "plugins"); + } + return path.join(REPO_ROOT, "plugins"); +} + +// 运行时版本:打包态读 exe 同级 shell.version(发版文件);开发/CLI 回退 package.json 版本。 +// 插件 plugin.json 可声明 minRuntimeVersion 做版本兼容校验(不满足则拒绝安装)。 +function runtimeVersion() { + try { + if (!process.env.ELECTRON_RUN_AS_NODE && process.resourcesPath) { + const vf = path.join(path.dirname(process.execPath), "shell.version"); + if (fs.existsSync(vf)) { + const v = fs.readFileSync(vf, "utf-8").trim(); + if (v) return v; + } + } + const pkg = JSON.parse(fs.readFileSync(path.join(SHELL_ROOT, "package.json"), "utf-8")); + return String(pkg.version || "").trim(); + } catch (e) { + return ""; + } +} + +// ==================== 控制面配置 ==================== +const CONTROLPLANE_URL = (process.env.CONTROLPLANE_URL || "").replace(/\/+$/, ""); +const CONTROLPLANE_ACCOUNT = process.env.CONTROLPLANE_ACCOUNT || ""; +const CONTROLPLANE_TOKEN = process.env.CONTROLPLANE_TOKEN || ""; + +// ==================== 插件执行子进程配置 ==================== +// Python 解释器:优先 env,默认 python(PATH 中的 venv/系统 Python) +const PYTHON_EXE = process.env.PYTHON_EXE || "python"; +const RUN_TIMEOUT = parseInt(process.env.RUN_TIMEOUT || "1800", 10); +const RUN_MAX_MEM_MB = parseInt(process.env.RUN_MAX_MEM_MB || "2048", 10); + +// ==================== 便携 Python 环境包(python-env) ==================== +// 版本化目录(python-env//)+ current.json 指向当前版本,保留上一版供回滚。 +// 目录位置:打包态 = exe 同级 python-env/;开发态 = electron-shell/python-env/(可本地构建联调)。 +function envRootDir() { + if (process.env.SHELL_PYTHON_ENV_ROOT) return path.resolve(process.env.SHELL_PYTHON_ENV_ROOT); + if (IS_FROZEN) return path.join(path.dirname(process.execPath), "python-env"); + return path.join(SHELL_ROOT, "python-env"); +} + +// 当前环境包目录(current.json → 版本目录);无环境包返回 "" +function pythonEnvRoot() { + const dir = envRootDir(); + try { + const raw = fs.readFileSync(path.join(dir, "current.json"), "utf-8").replace(/^\uFEFF/, ""); + const cur = JSON.parse(raw); + const ver = String((cur || {}).version || "").trim(); + if (ver && fs.existsSync(path.join(dir, ver, "python.exe"))) return path.join(dir, ver); + } catch (e) { + /* 尚无环境包 */ + } + return ""; +} + +// 环境包解析的 Python 解释器:显式 PYTHON_EXE 优先,其次环境包,最后系统 python +function pythonExe() { + if (process.env.PYTHON_EXE) return process.env.PYTHON_EXE; + const envRoot = pythonEnvRoot(); + if (envRoot) return path.join(envRoot, "python.exe"); + return "python"; +} + +// 运行时根(webhost 包所在目录):环境包模式 = 环境包根;否则 = desktop/(dev,webhost 在仓库内) +function runtimeRoot() { + const envRoot = pythonEnvRoot(); + if (envRoot) return envRoot; + return DESKTOP_ROOT; +} + +// 插件执行入口:环境包模式 = 环境包内 plugin_runner.py;打包态 = exe 同级;dev = 仓库 webhost +function runnerScript() { + if (process.env.SHELL_RUNNER_SCRIPT) return process.env.SHELL_RUNNER_SCRIPT; + const envRoot = pythonEnvRoot(); + if (envRoot) return path.join(envRoot, "webhost", "backend", "core", "plugin_runner.py"); + if (IS_FROZEN) { + return path.join(path.dirname(process.execPath), "plugin_runner.py"); + } + return path.join(DESKTOP_ROOT, "webhost", "backend", "core", "plugin_runner.py"); +} + +// Job Object 守护(环境包模式启用内存上限 + 整树托管):无环境包返回 "" +function jobGuardScript() { + const envRoot = pythonEnvRoot(); + if (envRoot) return path.join(envRoot, "webhost", "backend", "core", "job_guard.py"); + return ""; +} + +// 前端静态资源:壳自带 renderer/dist(可单独拷贝);dev 兜底复用 webhost 构建产物 +function frontendDist() { + const own = path.join(SHELL_ROOT, "renderer", "dist"); + if (fs.existsSync(path.join(own, "index.html"))) return own; + const legacy = path.join(DESKTOP_ROOT, "webhost", "frontend", "dist"); + if (fs.existsSync(path.join(legacy, "index.html"))) return legacy; + return own; +} + +// 平台登录子进程:spawn python (webhost.backend.shared.hr_login/oa_login) +function sharedModule(moduleName) { + return path.join(DESKTOP_ROOT, "webhost", "backend", "shared", `${moduleName}.py`); +} + +// 敏感凭证中心化下发:进程级覆盖存储(唯一来源:中心机下发 / 本地加密缓存) +const _CREDS_OVERRIDE = {}; + +function applyCreds(values) { + if (values && typeof values === "object") { + Object.assign(_CREDS_OVERRIDE, values); + } +} + +function getCred(name) { + if (_CREDS_OVERRIDE[name] !== undefined) return _CREDS_OVERRIDE[name]; + return process.env[name] !== undefined ? process.env[name] : ""; +} + +module.exports = { + SHELL_ROOT, + REPO_ROOT, + DESKTOP_ROOT, + PORT, + APP_DATA, + PLUGIN_CONFIG_DIR, + CONTROLPLANE_URL, + CONTROLPLANE_ACCOUNT, + CONTROLPLANE_TOKEN, + PYTHON_EXE, + RUN_TIMEOUT, + RUN_MAX_MEM_MB, + IS_FROZEN, + pluginRoot, + runnerScript, + frontendDist, + sharedModule, + runtimeVersion, + applyCreds, + getCred, + envRootDir, + pythonEnvRoot, + pythonExe, + runtimeRoot, + jobGuardScript, +}; diff --git a/desktop/electron-shell/electron/cpclient.js b/desktop/electron-shell/electron/cpclient.js new file mode 100644 index 0000000..cc4657f --- /dev/null +++ b/desktop/electron-shell/electron/cpclient.js @@ -0,0 +1,133 @@ +// 中心机 REST 客户端:_cp_call 等价(头规则一致、超时、错误透传 detail)。 +"use strict"; + +const { makeLogger } = require("./logger"); +const config = require("./config"); + +const logger = makeLogger("cpclient"); + +class HttpError extends Error { + constructor(status, detail) { + super(typeof detail === "string" && detail ? detail : `中心机 ${status}`); + this.status = status; + this.detail = detail; + } +} + +function baseUrl() { + if (!config.CONTROLPLANE_URL) { + const err = new Error("统一后端未配置(CONTROLPLANE_URL)"); + err.status = 503; + throw err; + } + return config.CONTROLPLANE_URL; +} + +// 机器凭证头(X-API-Token) +function machineHeaders() { + const h = {}; + if (config.CONTROLPLANE_TOKEN) h["X-API-Token"] = config.CONTROLPLANE_TOKEN; + return h; +} + +// params: {a: 1} → query string +function qs(params) { + if (!params) return ""; + const parts = Object.entries(params) + .filter(([, v]) => v !== undefined && v !== null) + .map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`); + return parts.length ? `?${parts.join("&")}` : ""; +} + +async function request(method, urlPath, opts = {}) { + const { headers = {}, json, params, body, timeout = 30, raw = false } = opts; + const url = `${baseUrl()}${urlPath}${qs(params)}`; + const h = { ...headers }; + let payload; + if (json !== undefined) { + h["Content-Type"] = "application/json"; + payload = JSON.stringify(json); + } else if (body !== undefined) { + payload = body; + } + const ctrl = new AbortController(); + const timer = setTimeout(() => ctrl.abort(), timeout * 1000); + let res; + try { + res = await fetch(url, { + method, + headers: h, + body: payload, + signal: ctrl.signal, + redirect: "follow", + }); + } catch (e) { + const err = new Error(`中心机不可达: ${e.message}`); + err.status = 502; + throw err; + } finally { + clearTimeout(timer); + } + const buf = Buffer.from(await res.arrayBuffer()); + if (res.status >= 400) { + let detail = buf.toString("utf-8").slice(0, 300); + try { + detail = JSON.parse(detail).detail || detail; + } catch (e) { + /* 非 JSON 错误体 */ + } + throw new HttpError(res.status, detail); + } + if (raw) { + return { status: res.status, headers: res.headers, body: buf }; + } + // JSON(二进制接口用 raw) + const text = buf.toString("utf-8"); + try { + return JSON.parse(text); + } catch (e) { + return { detail: text.slice(0, 300) }; + } +} + +// 流式下载(shell/chrome 大包,带进度回调):返回 {status, sha, contentLength} +async function streamDownload(urlPath, opts = {}) { + const { headers = {}, timeout = 600, onProgress, onData } = opts; + const url = `${baseUrl()}${urlPath}`; + const ctrl = new AbortController(); + const timer = setTimeout(() => ctrl.abort(), timeout * 1000); + let res; + try { + res = await fetch(url, { headers, signal: ctrl.signal, redirect: "follow" }); + } catch (e) { + clearTimeout(timer); + const err = new Error(`下载失败: ${e.message}`); + err.status = 502; + throw err; + } + const crypto = require("crypto"); + const sha = crypto.createHash("sha256"); + const total = parseInt(res.headers.get("content-length") || "0", 10); + let received = 0; + const reader = res.body.getReader(); + try { + for (;;) { + const { done, value } = await reader.read(); + if (done) break; + sha.update(value); + received += value.length; + if (onData) onData(value); + if (onProgress) onProgress(received, total); + } + } catch (e) { + throw new Error(`下载中断: ${e.message}`); + } finally { + clearTimeout(timer); + } + if (res.status >= 400) { + throw new HttpError(res.status, `下载失败 HTTP ${res.status}`); + } + return { status: res.status, sha256: sha.digest("hex"), contentLength: total, received }; +} + +module.exports = { HttpError, request, machineHeaders, qs, streamDownload, baseUrl }; diff --git a/desktop/electron-shell/electron/creds-sync.js b/desktop/electron-shell/electron/creds-sync.js new file mode 100644 index 0000000..518e27c --- /dev/null +++ b/desktop/electron-shell/electron/creds-sync.js @@ -0,0 +1,119 @@ +// 执行机敏感凭证下发与缓存:中心机在线拉取(RSA 解密) + 加密缓存(离线复用)。 +// 对齐 Python creds_sync.py:RSA-2048 密钥对 + OAEP-SHA256 解密 + cache.json 密文缓存。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const crypto = require("crypto"); +const cp = require("./cpclient"); +const config = require("./config"); +const session = require("./session"); +const { loadOrCreateRsaKey, rsaDecrypt } = require("./crypto"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("creds-sync"); + +// 与服务端 config_push._ALLOWED_KEYS 保持一致(双重保障:下发限定范围) +const ALLOWED_KEYS = new Set([ + "DINGTALK_APPKEY", + "DINGTALK_APPSECRET", + "DINGTALK_AGENT_ID", + "DINGTALK_CORP_ID", +]); + +const CREDS_DIR = path.join(config.APP_DATA, "creds"); +const PRIV_PATH = path.join(CREDS_DIR, "id_rsa.pem"); +const CACHE_FILE = path.join(CREDS_DIR, "cache.json"); + +let _priv = null; + +function privateKey() { + if (!_priv) _priv = loadOrCreateRsaKey(PRIV_PATH); + return _priv; +} + +function publicKeyPem() { + const key = privateKey(); + return crypto.createPublicKey(key).export({ type: "spki", format: "pem" }).toString(); +} + +function decrypt(cipherB64) { + return rsaDecrypt(privateKey(), cipherB64); +} + +function saveCache(encrypted) { + try { + fs.mkdirSync(CREDS_DIR, { recursive: true }); + fs.writeFileSync(CACHE_FILE, JSON.stringify(encrypted), "utf-8"); + } catch (e) { + logger.warning(`敏感凭证缓存写入失败: ${e.message}`); + } +} + +function loadCache() { + if (!fs.existsSync(CACHE_FILE)) return {}; + try { + const raw = JSON.parse(fs.readFileSync(CACHE_FILE, "utf-8")); + const out = {}; + for (const [k, b64] of Object.entries(raw || {})) { + if (!ALLOWED_KEYS.has(k)) continue; + try { + out[k] = decrypt(b64); + } catch (e) { + logger.warning(`敏感凭证缓存解密失败: ${k}`); + } + } + return out; + } catch (e) { + return {}; + } +} + +// 中心机在线拉取并解密敏感凭证;不可用返回 null(走缓存兜底) +async function sync(account) { + if (!config.CONTROLPLANE_URL || !account || !session.cloudToken(account)) return null; + try { + const headers = { + Authorization: `Bearer ${session.cloudToken(account)}`, + }; + if (config.CONTROLPLANE_TOKEN) headers["X-API-Token"] = config.CONTROLPLANE_TOKEN; + // 1. 上报本机 RSA 公钥(幂等 upsert;中心机用该公钥加密下发) + await cp.request("POST", "/api/admin/creds/register", { + headers, + json: { account, pubkey_pem: publicKeyPem() }, + timeout: 10, + }); + // 2. 拉取加密后的敏感凭证 + const r = await cp.request("GET", "/api/admin/creds", { headers, timeout: 10 }); + const encrypted = r.creds || {}; + if (Object.keys(encrypted).length === 0) return {}; + // 3. 本机私钥逐个解密 + const out = {}; + for (const [k, b64] of Object.entries(encrypted)) { + if (!ALLOWED_KEYS.has(k)) continue; + try { + out[k] = decrypt(b64); + } catch (e) { + logger.warning(`敏感凭证解密失败: ${k}`); + } + } + // 4. 密文原样落盘缓存(离线复用) + saveCache(encrypted); + return out; + } catch (e) { + logger.warning(`中心机敏感凭证拉取失败(用本地缓存): ${e.message}`); + return null; + } +} + +async function load(account = "") { + account = account || config.CONTROLPLANE_ACCOUNT; + if (!account) account = session.sessActiveAccount(); + const synced = await sync(account); + if (synced !== null) return synced; + const cached = loadCache(); + if (Object.keys(cached).length) logger.info("使用本地敏感凭证缓存(中心机不可达或无云令牌)"); + return cached; +} + +module.exports = { load, sync, publicKeyPem, decrypt, ALLOWED_KEYS, PRIV_PATH }; diff --git a/desktop/electron-shell/electron/crypto.js b/desktop/electron-shell/electron/crypto.js new file mode 100644 index 0000000..5a6414e --- /dev/null +++ b/desktop/electron-shell/electron/crypto.js @@ -0,0 +1,120 @@ +// 密码学与通用工具:Ed25519 验签 / RSA-OAEP 解密 / sha256 / base64url / 版本比较。 +"use strict"; + +const crypto = require("crypto"); +const fs = require("fs"); +const path = require("path"); + +// ==================== base64url(无填充解码,对齐 Python urlsafe_b64decode) ==================== +function b64urlDecode(s) { + // JS 中 -len % 4 为负数(Python 为正补数),显式换算补位数 + const pad = (4 - (s.length % 4)) % 4; + return Buffer.from(s + "=".repeat(pad), "base64url"); +} + +// ==================== Ed25519 票据验签 ==================== +// 票据格式:base64url(canonical_json).base64url(64B 签名);验签返回 payload 对象。 +function verifyBlob(blob, publicKeyPem) { + if (typeof blob !== "string" || !blob.includes(".")) throw new Error("bad blob"); + const idx = blob.lastIndexOf("."); + const b64 = blob.slice(0, idx); + const sig64 = blob.slice(idx + 1); + const canon = b64urlDecode(b64); + const sig = b64urlDecode(sig64); + if (sig.length !== 64) throw new Error("bad signature len"); + const key = crypto.createPublicKey(publicKeyPem); + const ok = crypto.verify(null, canon, key, sig); + if (!ok) throw new Error("signature verification failed"); + return JSON.parse(canon.toString("utf-8")); +} + +// ==================== RSA-2048 密钥对(creds 下发) ==================== +// 私钥 PKCS8 PEM 落盘 %LOCALAPPDATA%\37duAutomation\creds\id_rsa.pem;公钥上报中心机。 +function loadOrCreateRsaKey(privPath) { + if (fs.existsSync(privPath)) { + try { + const pem = fs.readFileSync(privPath, "utf-8"); + return crypto.createPrivateKey(pem); + } catch (e) { + // 损坏则重新生成 + } + } + const { privateKey, publicKey } = crypto.generateKeyPairSync("rsa", { + modulusLength: 2048, + publicExponent: 0x10001, + publicKeyEncoding: { type: "spki", format: "pem" }, + privateKeyEncoding: { type: "pkcs8", format: "pem" }, + }); + fs.mkdirSync(path.dirname(privPath), { recursive: true }); + fs.writeFileSync(privPath, privateKey, { encoding: "utf-8", mode: 0o600 }); + return privateKey; +} + +// OAEP-SHA256 解密 base64 密文 → 明文(与服务端 rsa_encrypt 对称) +function rsaDecrypt(privateKey, cipherB64) { + const ct = Buffer.from(cipherB64, "base64"); + const pt = crypto.privateDecrypt( + { key: privateKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING, oaepHash: "sha256" }, + ct + ); + return pt.toString("utf-8"); +} + +// ==================== 通用工具 ==================== +function sha256Hex(data) { + return crypto.createHash("sha256").update(data).digest("hex"); +} + +// 版本比较:数字段按 int,非数字段按 str 小写(对齐 Python licensing._version_lt) +function versionKey(s) { + return String(s) + .split(".") + .map((x) => (/^\d+$/.test(x) ? [1, parseInt(x, 10)] : [0, x.toLowerCase()])); +} +function versionLt(a, b) { + const ka = versionKey(a); + const kb = versionKey(b); + for (let i = 0; i < Math.max(ka.length, kb.length); i++) { + const x = ka[i] || [0, ""]; + const y = kb[i] || [0, ""]; + if (x[0] !== y[0]) return x[0] < y[0]; + if (x[0] === 1) { + if (x[1] !== y[1]) return x[1] < y[1]; + } else if (x[1] !== y[1]) return x[1] < y[1]; + } + return false; +} + +function deadlinePassed(deadline) { + if (!deadline) return false; + const t = Date.parse(String(deadline).replace("Z", "+00:00")); + if (Number.isNaN(t)) return false; + return Date.now() > t; +} + +function nowStr() { + const d = new Date(); + const p = (n) => String(n).padStart(2, "0"); + return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`; +} + +function newId() { + return Date.now().toString(16) + crypto.randomBytes(4).toString("hex"); +} + +function sleep(ms) { + return new Promise((r) => setTimeout(r, ms)); +} + +module.exports = { + b64urlDecode, + verifyBlob, + loadOrCreateRsaKey, + rsaDecrypt, + sha256Hex, + versionLt, + deadlinePassed, + nowStr, + newId, + sleep, +}; diff --git a/desktop/electron-shell/electron/db.js b/desktop/electron-shell/electron/db.js new file mode 100644 index 0000000..f888760 --- /dev/null +++ b/desktop/electron-shell/electron/db.js @@ -0,0 +1,42 @@ +// 壳子本地 SQLite(better-sqlite3):替代散落 JSON 承载新增数据。 +// 数据库:%LOCALAPPDATA%\37duAutomation\shell.db +// 说明: +// - 既有 JSON(license/active/schedules/run_history/creds 等)是和老客户端(Python webhost) +// 共享的契约文件,保持原样不动;**新增数据一律入 SQLite**,避免再堆 JSON。 +// - better-sqlite3 为原生模块:CLI 模式用系统 Node 的二进制;打包(electron-builder)时 +// 自动 rebuild 为 Electron ABI,产物无需额外处理。 +"use strict"; + +const path = require("path"); +const Database = require("better-sqlite3"); +const config = require("./config"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("db"); + +const DB_PATH = path.join(config.APP_DATA, "shell.db"); + +// 打开即建库建表(幂等);WAL 提升并发读性能,写仍同步 +const db = new Database(DB_PATH); +db.pragma("journal_mode = WAL"); + +function migrate() { + db.exec(` + -- 场景配置方案(多配置):同一场景多套命名参数,运行台/定时任务按需选用 + CREATE TABLE IF NOT EXISTS plugin_configs ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + account TEXT NOT NULL, + plugin_id TEXT NOT NULL, + name TEXT NOT NULL, + fields TEXT NOT NULL DEFAULT '{}', + at TEXT NOT NULL DEFAULT '', + UNIQUE(account, plugin_id, name) + ); + CREATE INDEX IF NOT EXISTS idx_pcfg_owner ON plugin_configs(account, plugin_id); + `); + logger.info(`SQLite 就绪:${DB_PATH}`); +} + +migrate(); + +module.exports = { db, DB_PATH }; diff --git a/desktop/electron-shell/electron/electron-main.js b/desktop/electron-shell/electron/electron-main.js new file mode 100644 index 0000000..4358caf --- /dev/null +++ b/desktop/electron-shell/electron/electron-main.js @@ -0,0 +1,170 @@ +// Electron 壳:窗口 / 托盘 / 单实例 / 自启。渲染层加载本地 8799 兼容层(复用 webhost 前端)。 +"use strict"; + +const fs = require("fs"); +const { app, BrowserWindow, Tray, Menu, nativeImage, dialog, screen } = require("electron"); +const path = require("path"); +const config = require("./config"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("electron-main"); + +// 移除 Electron 默认英文菜单栏(File Edit View Window Help):成品客户端菜单由页面自绘 +Menu.setApplicationMenu(null); + +const PORT = config.PORT; +const URL = `http://127.0.0.1:${PORT}`; + +// 窗口状态持久化:记住位置/尺寸,重启还原(防显示器变更后窗口跑到屏幕外) +const WINDOW_STATE_FILE = path.join(config.APP_DATA, "window-state.json"); + +function loadWindowState() { + try { + if (!fs.existsSync(WINDOW_STATE_FILE)) return null; + const s = JSON.parse(fs.readFileSync(WINDOW_STATE_FILE, "utf-8")); + if (!s || typeof s !== "object") return null; + const w = Math.max(1000, Math.min(4000, Number(s.width) || 1200)); + const h = Math.max(660, Math.min(4000, Number(s.height) || 780)); + const x = Number(s.x); + const y = Number(s.y); + if ( + !Number.isFinite(x) || + !Number.isFinite(y) || + !screen.getAllDisplays().some((d) => { + const a = d.workArea; + return x < a.x + a.width && x + w > a.x && y < a.y + a.height && y + h > a.y; + }) + ) { + return { width: w, height: h }; // 位置失效:只恢复尺寸 + } + return { width: w, height: h, x, y }; + } catch (e) { + return null; + } +} + +function saveWindowState(win) { + try { + const b = win.getBounds(); + fs.mkdirSync(config.APP_DATA, { recursive: true }); + fs.writeFileSync(WINDOW_STATE_FILE, JSON.stringify(b), "utf-8"); + } catch (e) { + /* 忽略:状态保存失败不影响运行 */ + } +} + +let mainWindow = null; +let tray = null; +let server = null; + +// 单实例锁:重复启动聚焦已有窗口 +if (!app.requestSingleInstanceLock()) { + app.quit(); +} else { + app.on("second-instance", () => { + if (mainWindow) { + if (mainWindow.isMinimized()) mainWindow.restore(); + mainWindow.focus(); + } + }); + + app.setAppUserModelId("37du.Host"); + + function createWindow() { + const st = loadWindowState() || {}; + mainWindow = new BrowserWindow({ + width: st.width || 1200, + height: st.height || 780, + x: st.x, + y: st.y, + minWidth: 1000, + minHeight: 660, + backgroundColor: "#eef2f9", + title: "37du 自动化工作台", + icon: trayIconImage(), + webPreferences: { + contextIsolation: true, + nodeIntegration: false, + sandbox: true, + preload: path.join(__dirname, "preload.js"), + }, + }); + mainWindow.loadURL(URL); + // 关闭时保存窗口状态;resize/move 防抖保存(异常退出也不丢太多) + let stateTimer = null; + const save = () => { + if (stateTimer) clearTimeout(stateTimer); + stateTimer = setTimeout(() => { + if (mainWindow && !mainWindow.isDestroyed()) saveWindowState(mainWindow); + }, 400); + if (stateTimer.unref) stateTimer.unref(); + }; + mainWindow.on("resize", save); + mainWindow.on("move", save); + mainWindow.on("close", () => { + if (mainWindow && !mainWindow.isDestroyed()) saveWindowState(mainWindow); + }); + mainWindow.on("closed", () => { + mainWindow = null; + }); + } + + function trayIconImage() { + // 16x16 蓝色圆点占位图标(正式打包时替换为 tools/icon.ico 生成的 png) + const svg = `37`; + return nativeImage.createFromDataURL(`data:image/svg+xml;base64,${Buffer.from(svg).toString("base64")}`); + } + + function createTray() { + tray = new Tray(trayIconImage()); + const ctx = Menu.buildFromTemplate([ + { label: "打开工作台", click: () => createWindow() }, + { type: "separator" }, + { + label: "开机自启", + type: "checkbox", + checked: app.getLoginItemSettings().openAtLogin, + click: (item) => { + app.setLoginItemSettings({ openAtLogin: item.checked }); + }, + }, + { type: "separator" }, + { label: "退出", click: () => app.quit() }, + ]); + tray.setToolTip("37du 自动化工作台"); + tray.setContextMenu(ctx); + tray.on("click", () => { + if (!mainWindow) createWindow(); + else mainWindow.show(); + }); + } + + app.whenReady().then(async () => { + try { + const { init } = require("./app"); + const { listen } = require("./server"); + await init(); + server = listen(() => { + createWindow(); + createTray(); + logger.info("Electron 壳就绪"); + }); + } catch (e) { + logger.error(`启动失败:${e.stack || e}`); + dialog.showErrorBox("37du 自动化工作台", `启动失败:${e.message}`); + app.quit(); + } + }); + + app.on("window-all-closed", () => { + app.quit(); // Windows:关闭窗口即退出(服务随主进程结束) + }); + + app.on("before-quit", () => { + try { + if (server) server.close(); + } catch (e) { + /* 忽略 */ + } + }); +} diff --git a/desktop/electron-shell/electron/env-sync.js b/desktop/electron-shell/electron/env-sync.js new file mode 100644 index 0000000..b581fd3 --- /dev/null +++ b/desktop/electron-shell/electron/env-sync.js @@ -0,0 +1,277 @@ +// 环境包同步(python-env):检查中心机 /api/file-sources/python-env → 下载 → sha256 → +// 解压到 python-env// → 更新 current.json → 清理(保留上一版供回滚)。 +// 与插件/壳子更新同一套"版本单点 + 校验 + 原子切换"模式;中心机无需改接口(category 为 +// 任意字符串,`agent_cli file push --category python-env` 即可发布)。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const crypto = require("crypto"); +const AdmZip = require("adm-zip"); +const cp = require("./cpclient"); +const config = require("./config"); +const { versionLt } = require("./crypto"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("env-sync"); + +const _STATE = { + installed: false, + version: "", + dir: "", + cloud_available: false, + cloud_version: "", + dl_status: "idle", // idle | downloading | downloaded | failed + dl_received: 0, + dl_total: 0, + dl_pct: 0, + dl_error: "", + checking: false, +}; + +function envDir() { + return config.envRootDir(); +} + +// 当前环境包版本(读 current.json;兼容 UTF-8 BOM) +function readCurrent() { + try { + const raw = fs.readFileSync(path.join(envDir(), "current.json"), "utf-8").replace(/^\uFEFF/, ""); + const cur = JSON.parse(raw); + return String((cur || {}).version || "").trim(); + } catch (e) { + return ""; + } +} + +// 中心机登记的云端环境包信息 +async function cloudInfo() { + if (!config.CONTROLPLANE_URL) return null; + try { + const r = await cp.request("GET", "/api/file-sources/python-env", { + headers: cp.machineHeaders(), + timeout: 8, + }); + _STATE.cloud_available = !!(r && r.available); + _STATE.cloud_version = r && r.available ? String(r.version || "") : ""; + return r && r.available ? r : null; + } catch (e) { + logger.warning(`获取环境包云端信息失败(离线跳过):${e.message}`); + _STATE.cloud_available = false; + _STATE.cloud_version = ""; + return null; + } +} + +// 状态(每次从磁盘实时计算安装态;云端信息来自最近一次 cloudInfo) +function status() { + const ver = readCurrent(); + const dir = ver ? path.join(envDir(), ver) : ""; + const installed = !!dir && fs.existsSync(path.join(dir, "python.exe")); + return { + installed, + version: installed ? ver : "", + dir: installed ? dir : "", + cloud_available: !!_STATE.cloud_available, + cloud_version: _STATE.cloud_version || "", + checking: !!_STATE.checking, + dl: { + status: _STATE.dl_status || "idle", + received: _STATE.dl_received || 0, + total: _STATE.dl_total || 0, + pct: _STATE.dl_pct || 0, + error: _STATE.dl_error || "", + }, + }; +} + +// 刷新状态(供启动后/同步后调用,等价于 status()) +function refreshStatus() { + return status(); +} + +function resetDl() { + _STATE.dl_status = "idle"; + _STATE.dl_received = 0; + _STATE.dl_total = 0; + _STATE.dl_pct = 0; + _STATE.dl_error = ""; +} + +// 下载 zip 到缓存目录(.part → sha256 → rename),返回落盘路径 +async function downloadZip(info) { + const url = String(info.url || "").trim(); + if (!url) throw new Error("环境包下载地址为空"); + const expect = String(info.sha256 || "").toLowerCase(); + const filename = String(info.filename || `python-env-${info.version}.zip`).trim(); + const cache = path.join(envDir(), "_cache"); + fs.mkdirSync(cache, { recursive: true }); + const part = path.join(cache, `${filename}.part`); + const zip = path.join(cache, filename); + const sha = crypto.createHash("sha256"); + const ctrl = new AbortController(); + const timer = setTimeout(() => ctrl.abort(), 900 * 1000); // 大包 15 分钟上限 + const res = await fetch(url, { signal: ctrl.signal, redirect: "follow" }); + if (!res.ok) throw new Error(`HTTP ${res.status}`); + const total = parseInt(res.headers.get("content-length") || "0", 10); + const out = fs.createWriteStream(part); + let received = 0; + try { + const reader = res.body.getReader(); + for (;;) { + const { done, value } = await reader.read(); + if (done) break; + out.write(value); + sha.update(value); + received += value.length; + _STATE.dl_received = received; + _STATE.dl_total = total; + _STATE.dl_pct = total ? Math.floor((received * 100) / total) : 0; + } + await new Promise((resolve, reject) => out.end((e) => (e ? reject(e) : resolve()))); + } finally { + clearTimeout(timer); + } + const digest = sha.digest("hex"); + if (expect && digest !== expect) { + try { fs.unlinkSync(part); } catch (e) { /* 忽略 */ } + throw new Error("环境包 sha256 校验失败"); + } + try { + fs.renameSync(part, zip); + } catch (e) { + try { fs.unlinkSync(part); } catch (e2) { /* 忽略 */ } + throw new Error("环境包保存失败"); + } + return zip; +} + +// 解压 zip → python-env//,防路径穿越;返回版本目录 +async function extractZip(zip, version) { + const target = path.join(envDir(), version); + const tmp = path.join(envDir(), `.${version}.tmp`); + const rm = (p) => { + try { fs.rmSync(p, { recursive: true, force: true }); } catch (e) { /* 忽略 */ } + }; + // 清理可能的残留临时目录 + rm(tmp); + rm(target); + fs.mkdirSync(tmp, { recursive: true }); + + const az = new AdmZip(zip); + const entries = az.getEntries(); + for (const en of entries) { + const name = en.entryName.replace(/\\/g, "/"); + if (name.startsWith("/") || name.split("/").includes("..")) { + throw new Error(`环境包含非法路径: ${name}`); + } + } + az.extractAllTo(tmp, true); + + // 冒烟校验:必须含 python.exe + webhost/backend/core/plugin_runner.py + if (!fs.existsSync(path.join(tmp, "python.exe"))) throw new Error("环境包缺少 python.exe"); + if (!fs.existsSync(path.join(tmp, "webhost", "backend", "core", "plugin_runner.py"))) { + throw new Error("环境包缺少 plugin_runner.py"); + } + // 原子切换(带重试:杀软可能短暂占用新解压文件导致 rename EPERM) + let lastErr = null; + for (let i = 0; i < 3; i++) { + try { + fs.renameSync(tmp, target); + return target; + } catch (e) { + lastErr = e; + await new Promise((r) => setTimeout(r, 500 * (i + 1))); + } + } + throw lastErr || new Error("环境包切换失败"); +} + +// 切换当前版本 + 清理旧版本(保留上一版供回滚) +function switchCurrent(version) { + const cur = readCurrent(); + fs.mkdirSync(envDir(), { recursive: true }); + fs.writeFileSync( + path.join(envDir(), "current.json"), + JSON.stringify({ version, updated_at: new Date().toISOString() }, null, 2), + "utf-8" + ); + // 清理:保留当前 + 上一版;其余删除(异常残留目录也清) + const keep = new Set([version, cur].filter(Boolean)); + try { + for (const name of fs.readdirSync(envDir())) { + if (name === "current.json" || name === "_cache") continue; + if (keep.has(name)) continue; + const p = path.join(envDir(), name); + try { fs.rmSync(p, { recursive: true, force: true }); } catch (e) { /* 忽略 */ } + } + } catch (e) { /* 忽略 */ } +} + +let _syncing = false; + +// 手动/启动同步:有更新的环境包则下载并切换;无则保持现状 +async function checkAndSync(force = false) { + if (_syncing) return { ok: false, reason: "busy" }; + _syncing = true; + _STATE.checking = true; + resetDl(); + try { + const info = await cloudInfo(); + if (!info) return { ok: false, reason: "no-cloud" }; + const cur = readCurrent(); + if (!force && cur && !versionLt(cur, info.version) && fs.existsSync(path.join(envDir(), cur, "python.exe"))) { + refreshStatus(); + return { ok: true, current: true, version: cur }; + } + _STATE.dl_status = "downloading"; + logger.info(`开始下载环境包 ${info.version}:${info.url}`); + const zip = await downloadZip(info); + _STATE.dl_status = "downloaded"; + _STATE.dl_pct = 100; + const dir = await extractZip(zip, info.version); + switchCurrent(info.version); + _STATE.dl_status = "idle"; + logger.info(`环境包 ${info.version} 安装完成:${dir}`); + refreshStatus(); + return { ok: true, current: false, version: info.version }; + } catch (e) { + logger.warning(`环境包同步失败:${e.message}`); + _STATE.dl_status = "failed"; + _STATE.dl_error = e.message; + return { ok: false, reason: "error", error: e.message }; + } finally { + _syncing = false; + _STATE.checking = false; + } +} + +// 回滚到上一版(current.json 前一个版本目录;无则报错) +function rollback() { + const cur = readCurrent(); + const versions = []; + try { + for (const name of fs.readdirSync(envDir())) { + if (name === "current.json" || name === "_cache") continue; + if (fs.existsSync(path.join(envDir(), name, "python.exe"))) versions.push(name); + } + } catch (e) { /* 忽略 */ } + const target = versions + .filter((v) => v !== cur) + .sort((a, b) => (versionLt(a, b) ? 1 : -1))[0]; + if (!target) return { ok: false, error: "无可回滚版本" }; + switchCurrent(target); + refreshStatus(); + return { ok: true, version: target }; +} + +module.exports = { + status, + refreshStatus, + checkAndSync, + rollback, + readCurrent, + envDir, + extractZip, + switchCurrent, +}; diff --git a/desktop/electron-shell/electron/hub.js b/desktop/electron-shell/electron/hub.js new file mode 100644 index 0000000..aca729e --- /dev/null +++ b/desktop/electron-shell/electron/hub.js @@ -0,0 +1,39 @@ +// 事件枢纽:插件运行线程产生的 日志/进度/完成 事件 → WS 广播给渲染层。 +// 对齐 Python webhost hub.py 语义(t/run_id/plugin_id/level/pct/ok/error)。 +"use strict"; + +const { EventEmitter } = require("events"); + +class Hub extends EventEmitter { + constructor() { + super(); + this._clients = new Set(); // ws 连接 + } + + // 由 server.js 在 WS 连接建立后注册 + addClient(ws) { + this._clients.add(ws); + ws.on("close", () => this._clients.delete(ws)); + ws.on("error", () => this._clients.delete(ws)); + } + + clientCount() { + return this._clients.size; + } + + publish(event) { + this.emit("event", event); + const payload = JSON.stringify(event); + for (const ws of this._clients) { + try { + if (ws.readyState === 1 /* OPEN */) ws.send(payload); + } catch (e) { + this._clients.delete(ws); + } + } + } +} + +const HUB = new Hub(); + +module.exports = { Hub, HUB }; diff --git a/desktop/electron-shell/electron/last-fields.js b/desktop/electron-shell/electron/last-fields.js new file mode 100644 index 0000000..767582b --- /dev/null +++ b/desktop/electron-shell/electron/last-fields.js @@ -0,0 +1,72 @@ +// 上次执行参数(per 账号 + per 插件):供场景执行台「恢复上次参数」使用,免去每次逐项重填。 +// 存储:%LOCALAPPDATA%\37duAutomation\last_run_fields.json(纯新增文件,不改既有契约) +// 安全:password 类型字段一律不落盘(插件 fields 可含密码),只保存非敏感项。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const config = require("./config"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("last-fields"); + +const STORE_PATH = path.join(config.APP_DATA, "last_run_fields.json"); +const MAX_FIELDS = 40; // 单插件最多记 40 项,防异常插件撑爆文件 + +function loadAll() { + if (!fs.existsSync(STORE_PATH)) return {}; + try { + const d = JSON.parse(fs.readFileSync(STORE_PATH, "utf-8")); + return d && typeof d === "object" && !Array.isArray(d) ? d : {}; + } catch (e) { + logger.warning(`上次参数读取失败:${e.message}`); + return {}; + } +} + +function saveAll(data) { + try { + fs.mkdirSync(config.APP_DATA, { recursive: true }); + const tmp = STORE_PATH + ".tmp"; + fs.writeFileSync(tmp, JSON.stringify(data, null, 2), "utf-8"); + fs.renameSync(tmp, STORE_PATH); // 原子替换 + } catch (e) { + logger.warning(`上次参数写入失败:${e.message}`); + } +} + +// 保存一次执行的参数快照;schema = 插件的 fields 元数据(用于剔除 password 等敏感项) +function remember(account, pluginId, fields, schema) { + if (!account || !pluginId || !fields || typeof fields !== "object") return; + const secret = new Set( + (Array.isArray(schema) ? schema : []) + .filter((f) => f && f.type === "password") + .map((f) => f.key) + ); + const keep = {}; + for (const [k, v] of Object.entries(fields)) { + if (secret.has(k)) continue; + if (Object.keys(keep).length >= MAX_FIELDS) break; + keep[k] = v; + } + const all = loadAll(); + if (!all[account] || typeof all[account] !== "object") all[account] = {}; + all[account][pluginId] = { + fields: keep, + at: new Date().toLocaleString("zh-CN", { hour12: false }), + }; + saveAll(all); +} + +// 读取上次参数;无记录返回 { fields: {}, at: "" } +function recall(account, pluginId) { + const all = loadAll(); + const rec = (all[account] || {})[pluginId] || null; + if (!rec || typeof rec !== "object") return { fields: {}, at: "" }; + return { + fields: rec.fields && typeof rec.fields === "object" ? rec.fields : {}, + at: rec.at || "", + }; +} + +module.exports = { STORE_PATH, MAX_FIELDS, remember, recall }; diff --git a/desktop/electron-shell/electron/licensing.js b/desktop/electron-shell/electron/licensing.js new file mode 100644 index 0000000..f03473e --- /dev/null +++ b/desktop/electron-shell/electron/licensing.js @@ -0,0 +1,308 @@ +// 部署端产品化能力层:离线授权/管控清单缓存、中心机公钥缓存、联网判定、验签、运行上报。 +// 对齐 Python webhost licensing.py 的路径与语义(跨端共享 %LOCALAPPDATA%\37duAutomation)。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const config = require("./config"); +const { verifyBlob, sha256Hex, versionLt, deadlinePassed, nowStr } = require("./crypto"); +const cp = require("./cpclient"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("licensing"); + +const KEYS_DIR = path.join(config.APP_DATA, "keys"); +const licensePath = path.join(config.APP_DATA, "license.json"); +const controlPath = path.join(config.APP_DATA, "control.json"); +const reportsPath = path.join(config.APP_DATA, "offline_reports.jsonl"); + +const ONLINE_TTL = 180 * 1000; +let _lastSync = 0; +const _CONTROLPLANE_URL = config.CONTROLPLANE_URL; + +function touchSync() { + _lastSync = Date.now(); +} +function isOnline() { + return Date.now() - _lastSync <= ONLINE_TTL; +} + +// ==================== 公钥缓存与验签 ==================== +function pubPemPath() { + return path.join(KEYS_DIR, "pub.pem"); +} + +function cachePublicKey(pemText) { + pemText = (pemText || "").trim(); + if (!pemText) return; + fs.mkdirSync(KEYS_DIR, { recursive: true }); + fs.writeFileSync(pubPemPath(), pemText, "ascii"); + touchSync(); +} + +function loadPublicKey() { + try { + return fs.readFileSync(pubPemPath(), "utf-8"); + } catch (e) { + return null; + } +} + +function verifyLicense() { + if (!fs.existsSync(licensePath)) throw new Error("无本地授权票据(license.json)"); + const pub = loadPublicKey(); + if (!pub) throw new Error("缺少中心机公钥,无法验签授权票据"); + const data = JSON.parse(fs.readFileSync(licensePath, "utf-8")); + return verifyBlob(data.ticket, pub); +} + +function emptyControl() { + return { revokedPlugins: [], disabledPlugins: [], forcedUpdates: [] }; +} + +function verifyControl() { + if (!fs.existsSync(controlPath)) return emptyControl(); + const pub = loadPublicKey(); + if (!pub) return emptyControl(); + try { + const data = JSON.parse(fs.readFileSync(controlPath, "utf-8")); + const payload = verifyBlob(data.ticket, pub); + return payload && typeof payload === "object" ? payload : {}; + } catch (e) { + return emptyControl(); + } +} + +// ==================== 授权周期(离线最多 7 天) ==================== +function licenseStatus() { + if (!fs.existsSync(licensePath)) return { status: "missing", payload: null }; + let lic; + try { + lic = verifyLicense(); + } catch (e) { + return { status: "invalid", payload: null }; + } + const exp = lic.expiresAt; + if (!exp || Date.now() > parseInt(exp, 10) * 1000) { + return { status: "expired", payload: lic }; + } + return { status: "ok", payload: lic }; +} + +// 授权票据概要:供状态栏 / 授权票据卡展示"剩余 N 天"(expiresAt 为 epoch 秒,中心机签发) +function licenseInfo() { + const st = licenseStatus(); + const exp = st.payload && st.payload.expiresAt ? parseInt(st.payload.expiresAt, 10) : 0; + return { + status: st.status, // missing | invalid | expired | ok + expire_ts: exp, + expire_at: exp ? new Date(exp * 1000).toLocaleString("zh-CN", { hour12: false }) : "", + days_left: exp ? Math.ceil((exp * 1000 - Date.now()) / 86400000) : null, + }; +} + +function ensureLicense(account) { + const st = licenseStatus(); + if (st.status === "ok" && (st.payload || {}).userId === account) { + return Promise.resolve({ ok: true, payload: st.payload }); + } + return syncLicensing(account) + .catch((e) => { + logger.warning(`授权票据联网刷新失败(离线或控制面不可达):${e.message}`); + }) + .then(() => { + const st2 = licenseStatus(); + return { + ok: st2.status === "ok" && (st2.payload || {}).userId === account, + payload: st2.payload, + }; + }); +} + +// ==================== 缓存写读 ==================== +function saveLicense(ticketJson) { + const text = typeof ticketJson === "object" + ? JSON.stringify(ticketJson) + : JSON.stringify({ ticket: ticketJson }); + fs.mkdirSync(config.APP_DATA, { recursive: true }); + fs.writeFileSync(licensePath, text, "utf-8"); + touchSync(); +} + +function saveControl(ticketJson) { + const text = typeof ticketJson === "object" + ? JSON.stringify(ticketJson) + : JSON.stringify({ ticket: ticketJson }); + fs.mkdirSync(config.APP_DATA, { recursive: true }); + fs.writeFileSync(controlPath, text, "utf-8"); + touchSync(); +} + +// ==================== 启动前校验链 ==================== +function installedVersion(pluginId) { + try { + const act = fs.readFileSync(path.join(config.APP_DATA, "active.json"), "utf-8"); + const d = JSON.parse(act); + return d.pluginId === pluginId ? d.version || "" : ""; + } catch (e) { + return ""; + } +} + +async function runCheckAllowed(pluginId, account, online) { + const lic = await ensureLicense(account); + if (!lic.ok) return "授权已过期(最长离线 7 天),请联网刷新后重试"; + + const control = verifyControl(); + if ((control.revokedPlugins || []).includes(pluginId)) return "插件已被下架(revoked),禁止运行"; + if ((control.disabledPlugins || []).includes(pluginId)) return "插件已被禁用(disabled),禁止运行"; + + const licPlugins = {}; + for (const p of (lic.payload || {}).plugins || []) licPlugins[p.pluginId] = p; + const grant = licPlugins[pluginId]; + if (!grant) return `账号 ${account} 无插件「${pluginId}」的授权`; + if (!grant.canRun) return `账号 ${account} 无「${pluginId}」的运行授权`; + + if (online) { + const forced = (control.forcedUpdates || []).find((f) => f.pluginId === pluginId); + if (forced) { + const minVer = forced.minVersion || ""; + const deadline = forced.deadline || ""; + if (minVer && deadline && deadlinePassed(deadline)) { + const installed = installedVersion(pluginId); + if (installed && versionLt(installed, minVer)) { + return `插件需强制升级到 v${minVer} 以上(deadline 已过),当前 v${installed} 已禁止启动,请先更新`; + } + } + } + } + return null; +} + +// ==================== 联网同步(公钥 + 授权票据 + 管控清单,逐资源容错) ==================== +async function syncLicensing(account) { + if (!config.CONTROLPLANE_URL || !account) return; + const headers = cp.machineHeaders(); + let gotAny = false; + try { + const r = await cp.request("GET", "/api/me/pubkey", { headers, timeout: 5 }); + cachePublicKey(r.pub || ""); + gotAny = true; + } catch (e) { + logger.warning(`中心机公钥拉取失败:${e.message}`); + } + try { + const r = await cp.request("GET", "/api/me/license", { headers, params: { account }, timeout: 5 }); + saveLicense(r); + gotAny = true; + } catch (e) { + logger.warning(`离线授权票据拉取失败:${e.message}`); + } + try { + const r = await cp.request("GET", "/api/me/control-list", { headers, timeout: 5 }); + saveControl(r); + gotAny = true; + } catch (e) { + logger.warning(`管控清单拉取失败:${e.message}`); + } + if (gotAny) await flushOfflineReports(); +} + +// ==================== 运行上报 ==================== +async function report(account, deviceId, pluginId, version, status, msg = "", durationSec = 0) { + const rec = { + account, device_id: deviceId, plugin_id: pluginId, version, + status, msg, duration_sec: parseInt(durationSec, 10) || 0, + at: nowStr(), + }; + if (!_CONTROLPLANE_URL) return; + try { + await pushReport(rec); + touchSync(); + return; + } catch (e) { + // 离线:暂存待补报 + } + try { + fs.mkdirSync(config.APP_DATA, { recursive: true }); + fs.appendFileSync(reportsPath, JSON.stringify(rec) + "\n", "utf-8"); + } catch (e) { + /* 忽略 */ + } +} + +async function pushReport(rec) { + const headers = cp.machineHeaders(); + await cp.request("POST", "/api/runtime/report", { headers, json: rec, timeout: 5 }); +} + +// 重连后补报此前暂存的离线记录;返回补报条数 +async function flushOfflineReports() { + if (!fs.existsSync(reportsPath)) return 0; + let sent = 0; + const pending = []; + const lines = fs.readFileSync(reportsPath, "utf-8").split(/\r?\n/).filter((l) => l.trim()); + for (const ln of lines) { + try { + const rec = JSON.parse(ln); + await pushReport(rec); + sent++; + } catch (e) { + pending.push(ln); + } + } + try { + if (pending.length === 0) fs.unlinkSync(reportsPath); + else fs.writeFileSync(reportsPath, pending.join("\n") + "\n", "utf-8"); + } catch (e) { + /* 忽略 */ + } + return sent; +} + +// 设备上报(心跳 + Chrome 环境):int 0/1 语义 +async function deviceReport(deviceId, account, info) { + if (!_CONTROLPLANE_URL) return false; + const payload = { + device_id: deviceId, + account: account || "", + hostname: (info && info.hostname) || "", + os: (info && info.os) || "windows", + ip: (info && info.ip) || "", + chrome_installed: (info && info.chromeInstalled) ? 1 : 0, + chrome_version: (info && info.chromeVersion) || "", + chrome_ok: (info && info.chromeOk) ? 1 : 0, + status: 1, + }; + try { + await cp.request("POST", "/api/device/report", { headers: cp.machineHeaders(), json: payload, timeout: 5 }); + touchSync(); + return true; + } catch (e) { + logger.warning(`设备上报失败:${e.message}`); + return false; + } +} + +module.exports = { + KEYS_DIR, + licensePath, + controlPath, + reportsPath, + touchSync, + isOnline, + cachePublicKey, + verifyLicense, + verifyControl, + licenseStatus, + licenseInfo, + ensureLicense, + saveLicense, + saveControl, + runCheckAllowed, + syncLicensing, + report, + flushOfflineReports, + deviceReport, + sha256Hex, +}; diff --git a/desktop/electron-shell/electron/logger.js b/desktop/electron-shell/electron/logger.js new file mode 100644 index 0000000..81c0363 --- /dev/null +++ b/desktop/electron-shell/electron/logger.js @@ -0,0 +1,68 @@ +// 日志:INFO 屏蔽大体积 JSON 调试日志;DEBUG 模式开启完整输出(AGENTS.md 规范)。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); + +const LEVELS = { DEBUG: 10, INFO: 20, WARNING: 30, ERROR: 40 }; +const DEBUG = process.env.DEBUG === "1" || process.env.DEBUG === "true"; +const MAX_LOG_BYTES = 10 * 1024 * 1024; // 单文件 10MB,超出轮转(保留 3 份) + +let _file = null; // { fd 简化:按行 append 即可 } + +function setLogFile(filePath) { + _file = filePath; + try { + fs.mkdirSync(path.dirname(filePath), { recursive: true }); + } catch (e) { + _file = null; + } +} + +// 按大小轮转:shell.log → shell.log.1 → .2 → .3(丢弃最旧) +function rotateIfNeeded() { + if (!_file) return; + try { + const st = fs.statSync(_file); + if (st.size < MAX_LOG_BYTES) return; + for (let i = 2; i >= 1; i--) { + const a = `${_file}.${i}`; + const b = `${_file}.${i + 1}`; + if (fs.existsSync(a)) fs.renameSync(a, b); + } + if (fs.existsSync(_file)) fs.renameSync(_file, `${_file}.1`); + } catch (e) { + /* 轮转失败忽略 */ + } +} + +function ts() { + const d = new Date(); + const p = (n) => String(n).padStart(2, "0"); + return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`; +} + +function write(level, name, msg) { + if (LEVELS[level] < LEVELS[DEBUG ? "DEBUG" : "INFO"]) return; + const line = `${ts()} ${level.padEnd(7)} ${name} ${msg}`; + console.log(line); + if (_file) { + try { + rotateIfNeeded(); + fs.appendFileSync(_file, line + "\n", "utf-8"); + } catch (e) { + /* 落盘失败静默 */ + } + } +} + +function makeLogger(name) { + return { + debug: (msg) => write("DEBUG", name, msg), + info: (msg) => write("INFO", name, msg), + warning: (msg) => write("WARNING", name, msg), + error: (msg) => write("ERROR", name, msg), + }; +} + +module.exports = { makeLogger, setLogFile, isDebug: DEBUG }; diff --git a/desktop/electron-shell/electron/main.js b/desktop/electron-shell/electron/main.js new file mode 100644 index 0000000..249b838 --- /dev/null +++ b/desktop/electron-shell/electron/main.js @@ -0,0 +1,22 @@ +// 入口:CLI 模式(node electron/main.js --cli,无 Electron)或 Electron 模式(electron .)。 +"use strict"; + +const isCli = process.argv.includes("--cli") || !process.versions || !process.versions.electron; + +if (isCli) { + const { init } = require("./app"); + const { listen } = require("./server"); + const { makeLogger } = require("./logger"); + const logger = makeLogger("main"); + + (async () => { + await init(); + listen(); + logger.info("CLI 模式运行中(Ctrl+C 退出)。Electron 窗口模式:npm run electron"); + })().catch((e) => { + logger.error(`启动失败:${e.stack || e}`); + process.exit(1); + }); +} else { + require("./electron-main"); +} diff --git a/desktop/electron-shell/electron/meta.js b/desktop/electron-shell/electron/meta.js new file mode 100644 index 0000000..309359a --- /dev/null +++ b/desktop/electron-shell/electron/meta.js @@ -0,0 +1,72 @@ +// 宿主插件元数据 / 平台权限解析(/api/meta 聚合)。 +// 对齐 Python core/meta.py:插件可见性 = 本地授权票据快照;平台白名单来自中心机。 +"use strict"; + +const cp = require("./cpclient"); +const config = require("./config"); +const licensing = require("./licensing"); +const registry = require("./registry"); +const platformAuth = require("./platform-auth"); +const state = require("./state"); +const envSync = require("./env-sync"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("meta"); + +// 调中心机获取账号可登录平台白名单;控制面不可达返回 null(调用方决定拒绝) +async function accountAllowedPlatforms(account) { + if (!config.CONTROLPLANE_URL) return null; + try { + const r = await cp.request("GET", "/api/platforms/allowed", { + headers: cp.machineHeaders(), + params: { account }, + timeout: 5, + }); + return new Set(r.allowed || []); + } catch (e) { + return null; + } +} + +// /api/meta 聚合响应 +async function buildMeta(account) { + let authExpired = false; + let plugins = []; + if (account) { + const lic = await licensing.ensureLicense(account); + if (lic.ok) { + const allowed = new Set((lic.payload || {}).plugins.map((p) => p.pluginId)); + for (const entry of registry.listLocalPlugins()) { + if (allowed.has(entry.id)) plugins.push(registry.pluginSchema(entry.id)); + } + } else { + authExpired = true; + } + } + const allowedPlats = account ? await accountAllowedPlatforms(account) : null; + const platforms = []; + for (const [pid, m] of Object.entries(state.PLATFORMS)) { + platforms.push({ + id: pid, + label: m.label, + online: await platformAuth.isOnline(pid, account), // 按当前账号的会话校验 + allowed: allowedPlats === null ? true : allowedPlats.has(pid), + }); + } + return { + appName: "37du 自动化工作台", + dingtalkScan: !!config.CONTROLPLANE_URL, + authExpired, + // 授权票据概要:常驻态进状态栏 / 票据卡(剩余天数),异常态才升级为横幅 + license: licensing.licenseInfo(), + platforms, + plugins, + // 环境包(便携 Python 运行时)概要:设置页/状态栏展示,空 = 未安装 + env: { + version: envSync.readCurrent() || "", + installed: !!envSync.readCurrent(), + }, + }; +} + +module.exports = { buildMeta, accountAllowedPlatforms }; diff --git a/desktop/electron-shell/electron/platform-auth.js b/desktop/electron-shell/electron/platform-auth.js new file mode 100644 index 0000000..c237578 --- /dev/null +++ b/desktop/electron-shell/electron/platform-auth.js @@ -0,0 +1,249 @@ +// 平台登录态(HR/OA):真实登录/登出/在线校验。 +// 保持 Python 子进程执行登录自动化(shared/hr_login、oa_login,DrissionPage 滑块), +// Node 壳只负责拉起子进程与解析结果。 +// ★ 按账号隔离:每个登录账号拥有独立的会话目录(.sessions/<账号>/)与独立 HR/OA 账号密码, +// 子进程通过 PLATFORM_ACCOUNT 环境变量 + hr_login_username/password 注入各自身份。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const { spawn } = require("child_process"); +const config = require("./config"); +const platformCreds = require("./platform-creds"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("platform-auth"); + +const LABELS = { hr: "HR 系统", oa: "OA 系统" }; +const COOKIE_FILES = { + hr: "hr_cookies.json", + oa: "oa_cookies.json", +}; +const BASE_SESSIONS_DIR = path.join(config.APP_DATA, ".sessions"); + +const _onlineCache = new Map(); // `${account}:${pid}` -> {ts, value} +const ONLINE_CACHE_TTL = 15 * 1000; + +function platforms() { + return Object.keys(LABELS).map((pid) => ({ id: pid, label: LABELS[pid] })); +} + +// 账号隔离的会话目录;无账号时回退共享目录(兼容旧数据) +function sessionDir(account) { + const base = account ? path.join(BASE_SESSIONS_DIR, String(account)) : BASE_SESSIONS_DIR; + try { + fs.mkdirSync(base, { recursive: true }); + } catch (e) { + /* 忽略 */ + } + return base; +} + +// spawn python 子进程执行 snippet,返回 stdout 最后一行 JSON(或文本) +function runPython(snippet, timeoutMs = 120000, extraEnv = {}) { + return new Promise((resolve, reject) => { + const args = ["-c", snippet]; + const child = spawn(config.pythonExe(), args, { + // webhost 包解析:环境包模式 cwd=环境包根(webhost/ 在其中);dev = desktop/(仓库内 webhost) + cwd: config.runtimeRoot(), + windowsHide: true, + env: { ...process.env, PYTHONIOENCODING: "utf-8", PYTHONUTF8: "1", ...extraEnv }, + stdio: ["ignore", "pipe", "pipe"], + }); + let out = ""; + let err = ""; + const timer = setTimeout(() => { + try { + treeKill(child.pid); + } catch (e) { + /* 忽略 */ + } + reject(new Error("平台登录子进程超时")); + }, timeoutMs); + child.stdout.on("data", (d) => (out += d.toString("utf-8"))); + child.stderr.on("data", (d) => (err += d.toString("utf-8"))); + child.on("error", (e) => { + clearTimeout(timer); + reject(new Error(`拉起 Python 子进程失败: ${e.message}`)); + }); + child.on("close", (code) => { + clearTimeout(timer); + if (code !== 0) { + reject(new Error(`平台子进程退出(${code}): ${err.slice(0, 300)}`)); + return; + } + resolve(out.trim()); + }); + }); +} + +function treeKill(pid) { + try { + if (process.platform === "win32") { + const killer = spawn("taskkill", ["/pid", String(pid), "/T", "/F"], { + windowsHide: true, + stdio: "ignore", + detached: true, + }); + killer.unref(); + } else { + try { + process.kill(-pid, "SIGKILL"); + } catch (e) { + process.kill(pid, "SIGKILL"); + } + } + } catch (e) { + /* 忽略 */ + } +} + +function extractJson(out) { + // 兼容模块 print("最终结果:", dict) 与纯 JSON 输出:取最后一个 JSON 对象 + const lines = out.split(/\r?\n/).filter((l) => l.trim()); + for (let i = lines.length - 1; i >= 0; i--) { + const line = lines[i]; + const idx = line.indexOf("{"); + if (idx >= 0) { + try { + return JSON.parse(line.slice(idx)); + } catch (e) { + /* 继续找 */ + } + } + } + return null; +} + +// 真实校验平台登录态(发起轻量 API 校验,非内存假状态);结果短缓存避免频繁请求平台。 +const VALIDATE = { + hr: { + url: "https://hr.37du.co/RedseaPlatform/PtUsers.mc?method=getCurUserInfo", + method: "POST", + }, + oa: { + url: "https://oa.37du.co/sys/notify/sys_notify_todo/sysNotifyTodo.do?method=sumTodoCount", + method: "GET", + }, +}; + +function loadCookies(pid, account) { + const file = path.join(sessionDir(account), COOKIE_FILES[pid]); + if (!fs.existsSync(file)) return []; + try { + const raw = JSON.parse(fs.readFileSync(file, "utf-8")); + return Array.isArray(raw) ? raw : []; + } catch (e) { + return []; + } +} + +async function isOnline(pid, account) { + const cacheKey = `${account || ""}:${pid}`; + const cached = _onlineCache.get(cacheKey); + if (cached && Date.now() - cached.ts < ONLINE_CACHE_TTL) return cached.value; + let value = false; + const def = VALIDATE[pid]; + if (!def) return false; + try { + const cookies = loadCookies(pid, account); + if (cookies.length === 0) { + value = false; + } else { + const pairs = []; + for (const c of cookies) { + if (c && c.name && c.value && (!c.domain || String(c.domain).includes("37du.co"))) { + pairs.push(`${c.name}=${c.value}`); + } + } + const ctrl = new AbortController(); + const timer = setTimeout(() => ctrl.abort(), 8000); + const resp = await fetch(def.url, { + method: def.method, + headers: { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36", + "Content-Type": "application/x-www-form-urlencoded", + ...(pairs.length ? { Cookie: pairs.join("; ") } : {}), + }, + body: def.method === "POST" ? "" : undefined, + signal: ctrl.signal, + redirect: "manual", + }); + clearTimeout(timer); + const text = await resp.text(); + value = resp.status === 200 && text.trim().startsWith("{") || text.trim().startsWith("["); + } + } catch (e) { + logger.warning(`平台 ${pid} 在线校验失败:${e.message}`); + value = false; + } + _onlineCache.set(cacheKey, { ts: Date.now(), value }); + return value; +} + +// 真实登录:cookies 有效则复用(不弹浏览器),失效则浏览器自动化登录。 +// account:当前登录账号;其个人 HR/OA 账号密码通过环境变量注入登录子进程。 +async function login(pid, account) { + if (!LABELS[pid]) throw Object.assign(new Error(`未知平台: ${pid}`), { status: 404 }); + const cacheKey = `${account || ""}:${pid}`; + _onlineCache.delete(cacheKey); + const extraEnv = { PLATFORM_ACCOUNT: account || "" }; + const credEnv = platformCreds.envFor(account, pid); + if (credEnv) { + Object.assign(extraEnv, credEnv); + logger.info(`平台 ${pid} 使用账号「${credEnv[`${pid}_login_username`]}」登录(账号 ${account})`); + } else { + logger.warning(`平台 ${pid} 登录:账号 ${account} 未配置个人平台账号密码,将回退共享配置`); + } + try { + const snippet = + pid === "hr" + ? `from webhost.backend.shared import hr_login; import json; print(json.dumps(hr_login.main({"force": False}), ensure_ascii=False))` + : `from webhost.backend.shared import oa_login; import json; print(json.dumps(oa_login.main(force=False), ensure_ascii=False))`; + const out = await runPython(snippet, 5 * 60 * 1000, extraEnv); + const result = extractJson(out) || {}; + const ok = !!result.success; + const online = ok ? await isOnline(pid, account) : false; + return { + id: pid, + label: LABELS[pid], + online, + message: result.message || (ok ? "登录成功" : "登录失败"), + }; + } catch (e) { + logger.error(`平台 ${pid} 登录失败(账号 ${account}):${e.message}`); + return { id: pid, label: LABELS[pid], online: false, message: `登录过程异常:${e.message}` }; + } +} + +// 登出平台:删除该账号的 cookies 文件,使该账号的平台登录态失效。 +function logout(pid, account) { + if (!LABELS[pid]) throw Object.assign(new Error(`未知平台: ${pid}`), { status: 404 }); + _onlineCache.delete(`${account || ""}:${pid}`); + const file = path.join(sessionDir(account), COOKIE_FILES[pid]); + try { + if (fs.existsSync(file)) fs.unlinkSync(file); + } catch (e) { + logger.warning(`清除平台 ${pid} cookies 失败(账号 ${account}):${e.message}`); + } + return { id: pid, label: LABELS[pid], online: false }; +} + +// 当前账号的平台状态(个人中心展示):在线态 + 是否已配置个人账号密码 + 已存用户名 +async function status(account) { + const creds = platformCreds.get(account) || {}; + const out = []; + for (const pid of Object.keys(LABELS)) { + const c = creds[pid] || {}; + out.push({ + id: pid, + label: LABELS[pid], + online: await isOnline(pid, account), + has_creds: !!(c.user && c.pass), + user: c.user || "", + }); + } + return out; +} + +module.exports = { platforms, sessionDir, isOnline, login, logout, status, BASE_SESSIONS_DIR }; diff --git a/desktop/electron-shell/electron/platform-creds.js b/desktop/electron-shell/electron/platform-creds.js new file mode 100644 index 0000000..05d9daa --- /dev/null +++ b/desktop/electron-shell/electron/platform-creds.js @@ -0,0 +1,111 @@ +// 平台账号凭据(HR/OA)按账号本机加密保存:AES-256-GCM,随机密钥落盘。 +// 每人在壳里「个人中心→平台账号」填写自己的 HR/OA 账号密码; +// 登录时注入 Python 登录模块环境变量(hr_login_username / hr_login_password 等)。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const crypto = require("crypto"); +const config = require("./config"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("platform-creds"); + +const DIR = path.join(config.APP_DATA, "platform-creds"); +const KEY_FILE = path.join(DIR, ".key"); +const DATA_FILE = path.join(DIR, "creds.json"); + +// 密文结构:{iv, tag, data}(base64) +function loadKey() { + try { + if (fs.existsSync(KEY_FILE)) return fs.readFileSync(KEY_FILE); + const key = crypto.randomBytes(32); + fs.mkdirSync(DIR, { recursive: true }); + fs.writeFileSync(KEY_FILE, key, { mode: 0o600 }); + return key; + } catch (e) { + logger.warning(`平台账号凭据密钥初始化失败: ${e.message}`); + return crypto.randomBytes(32); // 进程内可用;重启后不可解(仅兜底,几乎不会走到) + } +} + +function encrypt(obj) { + const key = loadKey(); + const iv = crypto.randomBytes(12); + const cipher = crypto.createCipheriv("aes-256-gcm", key, iv); + const data = Buffer.from(JSON.stringify(obj), "utf-8"); + const enc = Buffer.concat([cipher.update(data), cipher.final()]); + const tag = cipher.getAuthTag(); + return { iv: iv.toString("base64"), tag: tag.toString("base64"), data: enc.toString("base64") }; +} + +function decrypt(payload) { + const key = loadKey(); + const iv = Buffer.from(payload.iv, "base64"); + const tag = Buffer.from(payload.tag, "base64"); + const data = Buffer.from(payload.data, "base64"); + const decipher = crypto.createDecipheriv("aes-256-gcm", key, iv); + decipher.setAuthTag(tag); + return JSON.parse(Buffer.concat([decipher.update(data), decipher.final()]).toString("utf-8")); +} + +function loadAll() { + if (!fs.existsSync(DATA_FILE)) return {}; + try { + return decrypt(JSON.parse(fs.readFileSync(DATA_FILE, "utf-8"))); + } catch (e) { + logger.warning(`平台账号凭据读取失败: ${e.message}`); + return {}; + } +} + +function saveAll(all) { + try { + fs.mkdirSync(DIR, { recursive: true }); + fs.writeFileSync(DATA_FILE, JSON.stringify(encrypt(all)), "utf-8"); + } catch (e) { + logger.warning(`平台账号凭据保存失败: ${e.message}`); + } +} + +// account → {hr: {user, pass}, oa: {user, pass}} +function get(account) { + if (!account) return null; + return loadAll()[account] || null; +} + +// 保存当前账号某平台的凭据;pass 为空串表示保留原密码(仅更新用户名/不清除) +function upsert(account, pid, creds) { + if (!account) throw new Error("缺少账号"); + if (!creds) return false; + const all = loadAll(); + const entry = all[account] || {}; + const cur = entry[pid] || {}; + const user = typeof creds.user === "string" ? creds.user.trim() : ""; + let pass = typeof creds.pass === "string" ? creds.pass : ""; + if (user === "" && pass === "") { + // 清空该平台凭据 + delete entry[pid]; + } else { + if (user === "") user = cur.user || ""; // 未填用户名:沿用 + if (pass === "") pass = cur.pass || ""; // 未填密码:沿用 + entry[pid] = { user, pass }; + } + all[account] = entry; + saveAll(all); + return true; +} + +// 供登录注入环境变量:{hr_login_username, hr_login_password};未配置返回 null +function envFor(account, pid) { + const c = get(account); + if (!c) return null; + const p = c[pid]; + if (!p || !p.user) return null; + return { + [`${pid}_login_username`]: p.user, + [`${pid}_login_password`]: p.pass || "", + }; +} + +module.exports = { get, upsert, envFor, DIR }; diff --git a/desktop/electron-shell/electron/plugin-configs.js b/desktop/electron-shell/electron/plugin-configs.js new file mode 100644 index 0000000..b84bb40 --- /dev/null +++ b/desktop/electron-shell/electron/plugin-configs.js @@ -0,0 +1,73 @@ +// 场景配置方案(多配置)· SQLite 实现:同一场景可保存多套命名参数组合,运行台/定时任务按需选用。 +// 表:plugin_configs(shell.db),按账号 + 插件隔离,同名覆盖。 +// 安全:password 类型字段一律不落盘(与 last-fields.js 一致,仅保存非敏感项)。 +"use strict"; + +const { db } = require("./db"); + +const MAX_CONFIGS_PER_PLUGIN = 10; // 单插件最多 10 套方案,防异常堆满 + +// 过滤敏感字段:schema = 插件的 fields 元数据,password 类型不入库 +function sanitize(fields, schema) { + const secret = new Set( + (Array.isArray(schema) ? schema : []) + .filter((f) => f && f.type === "password") + .map((f) => f.key) + ); + const out = {}; + for (const [k, v] of Object.entries(fields || {})) { + if (secret.has(k)) continue; + out[k] = v; + } + return out; +} + +function rowToCfg(row) { + if (!row) return null; + let fields = {}; + try { fields = JSON.parse(row.fields || "{}"); } catch (_) { fields = {}; } + return { id: String(row.id), name: row.name, fields, at: row.at || "" }; +} + +function listConfigs(account, pluginId) { + const rows = db.prepare( + "SELECT id, name, fields, at FROM plugin_configs WHERE account = ? AND plugin_id = ? ORDER BY id" + ).all(account, pluginId); + return rows.map(rowToCfg); +} + +// 保存/覆盖:同名方案更新字段,否则新增;返回新/更新后的配置 +function saveConfig(account, pluginId, name, fields, schema) { + const trimmed = String(name || "").trim().slice(0, 20); + if (!trimmed) return null; + const keep = sanitize(fields, schema); + const at = new Date().toLocaleString("zh-CN", { hour12: false }); + const exists = db.prepare( + "SELECT id FROM plugin_configs WHERE account = ? AND plugin_id = ? AND name = ?" + ).get(account, pluginId, trimmed); + if (exists) { + db.prepare( + "UPDATE plugin_configs SET fields = ?, at = ? WHERE id = ?" + ).run(JSON.stringify(keep), at, exists.id); + return rowToCfg(db.prepare("SELECT id, name, fields, at FROM plugin_configs WHERE id = ?").get(exists.id)); + } + const count = db.prepare( + "SELECT COUNT(*) AS n FROM plugin_configs WHERE account = ? AND plugin_id = ?" + ).get(account, pluginId); + if (count.n >= MAX_CONFIGS_PER_PLUGIN) { + throw Object.assign(new Error(`每个场景最多保存 ${MAX_CONFIGS_PER_PLUGIN} 套配置`), { status: 400 }); + } + const r = db.prepare( + "INSERT INTO plugin_configs (account, plugin_id, name, fields, at) VALUES (?, ?, ?, ?, ?)" + ).run(account, pluginId, trimmed, JSON.stringify(keep), at); + return rowToCfg(db.prepare("SELECT id, name, fields, at FROM plugin_configs WHERE id = ?").get(r.lastInsertRowid)); +} + +function deleteConfig(account, pluginId, cfgId) { + const r = db.prepare( + "DELETE FROM plugin_configs WHERE account = ? AND plugin_id = ? AND id = ?" + ).run(account, pluginId, cfgId); + return r.changes > 0; +} + +module.exports = { MAX_CONFIGS_PER_PLUGIN, listConfigs, saveConfig, deleteConfig }; diff --git a/desktop/electron-shell/electron/plugin-sync.js b/desktop/electron-shell/electron/plugin-sync.js new file mode 100644 index 0000000..6f01ef2 --- /dev/null +++ b/desktop/electron-shell/electron/plugin-sync.js @@ -0,0 +1,375 @@ +// 插件按账号权限自下载 + 版本更新(执行机主动拉取;下载/校验/原子安装)。 +// 对齐 Python webhost plugin_sync.py:清单 diff → download-ticket → sha256 → 临时目录原子替换。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const os = require("os"); +const crypto = require("crypto"); +const AdmZip = require("adm-zip"); +const cp = require("./cpclient"); +const config = require("./config"); +const { sha256Hex, versionLt } = require("./crypto"); +const { makeLogger } = require("./logger"); +const { pluginRoot } = require("./registry"); + +const logger = makeLogger("plugin-sync"); + +const DL_TIMEOUT = 300; +const MAX_PKG_BYTES = 200 * 1024 * 1024; + +// 回滚存储:升级前把上一版整体拷贝到 APP_DATA/plugin_rollback/@/(只保留每插件最新一版)。 +// 放 APP_DATA 而非插件根,避免污染插件目录(pruneStale 遍历/版本目录混入)与 dev 仓库。 +const ROLLBACK_DIR = path.join(config.APP_DATA, "plugin_rollback"); + +// 升级前备份当前版本(仅已装插件),返回 "id@version";失败返回 null(不阻断升级) +function backupForRollback(pluginId) { + const target = path.join(pluginRoot(), pluginId); + const mf = path.join(target, "plugin.json"); + if (!fs.existsSync(mf)) return null; // 首次安装无需备份 + const ver = localVersion(pluginId) || "unknown"; + try { + fs.mkdirSync(ROLLBACK_DIR, { recursive: true }); + // 只保留最新一版回滚:先清掉该插件的旧备份 + for (const name of fs.readdirSync(ROLLBACK_DIR)) { + if (name.startsWith(pluginId + "@")) { + fs.rmSync(path.join(ROLLBACK_DIR, name), { recursive: true, force: true }); + } + } + fs.cpSync(target, path.join(ROLLBACK_DIR, `${pluginId}@${ver}`), { recursive: true }); + logger.info(`插件 ${pluginId}@${ver} 已备份(可回滚)`); + return `${pluginId}@${ver}`; + } catch (e) { + logger.warning(`插件 ${pluginId} 回滚备份失败:${e.message}`); + return null; + } +} + +// 某插件可回滚的版本列表(按版本降序) +function rollbackAvailable(pluginId) { + try { + if (!fs.existsSync(ROLLBACK_DIR)) return []; + return fs + .readdirSync(ROLLBACK_DIR) + .filter((n) => n.startsWith(pluginId + "@")) + .map((n) => n.slice(pluginId.length + 1)) + .sort((a, b) => (versionLt(a, b) ? 1 : -1)); + } catch (e) { + return []; + } +} + +// 全部可回滚插件的索引(供前端展示) +function rollbackIndex() { + try { + if (!fs.existsSync(ROLLBACK_DIR)) return []; + return fs + .readdirSync(ROLLBACK_DIR) + .filter((n) => n.includes("@")) + .map((n) => { + const idx = n.lastIndexOf("@"); + return { id: n.slice(0, idx), version: n.slice(idx + 1) }; + }); + } catch (e) { + return []; + } +} + +// 回滚到备份版本(取最新备份);失败抛错 +function rollbackPlugin(pluginId) { + const versions = rollbackAvailable(pluginId); + if (!versions.length) throw new Error("该插件无可用回滚版本"); + const ver = versions[0]; + const src = path.join(ROLLBACK_DIR, `${pluginId}@${ver}`); + const target = path.join(pluginRoot(), pluginId); + if (!fs.existsSync(src)) throw new Error("回滚备份缺失"); + fs.mkdirSync(pluginRoot(), { recursive: true }); + if (fs.existsSync(target)) fs.rmSync(target, { recursive: true, force: true }); + fs.cpSync(src, target, { recursive: true }); + logger.info(`插件 ${pluginId} 已回滚到 ${ver}`); + return `${pluginId}@${ver}`; +} + +// 同步串行锁:启动后台同步 / 登录后同步 / 手动刷新共用 +let _syncPromise = Promise.resolve(); +function withSyncLock(fn) { + const run = _syncPromise.then(fn, fn); + // 无论成功失败都继续链,保证后续同步不被前一次卡死 + _syncPromise = run.catch(() => {}); + return run; +} + +function localVersion(pluginId) { + const mf = path.join(pluginRoot(), pluginId, "plugin.json"); + if (!fs.existsSync(mf)) return ""; + try { + return String(JSON.parse(fs.readFileSync(mf, "utf-8")).version || ""); + } catch (e) { + return ""; + } +} + +// 中心机可用插件清单(id/name/version);不可达返回 null(离线用本地) +async function cloudPluginManifest(account) { + if (!config.CONTROLPLANE_URL || !account) return null; + try { + const r = await cp.request("GET", "/api/plugins", { + headers: cp.machineHeaders(), + params: { account }, + timeout: 5, + }); + return r.plugins || []; + } catch (e) { + logger.warning(`拉取插件清单失败(离线用本地插件):${e.message}`); + return null; + } +} + +async function dlTicket(pluginId, version, account) { + try { + return await cp.request( + "GET", + `/api/plugins/${encodeURIComponent(pluginId)}/versions/${encodeURIComponent(version)}/download-ticket`, + { headers: cp.machineHeaders(), params: { account }, timeout: 5 } + ); + } catch (e) { + logger.warning(`获取下载票据失败 ${pluginId}@${version}:${e.message}`); + return null; + } +} + +async function fetchPkg(ticket) { + try { + const r = await cp.request("GET", `/api/download/${encodeURIComponent(ticket)}`, { + headers: cp.machineHeaders(), + timeout: DL_TIMEOUT, + raw: true, + }); + return r.body; + } catch (e) { + logger.warning(`下载插件包失败:${e.message}`); + return null; + } +} + +// 版本兼容校验:manifest 声明 minRuntimeVersion 且当前运行时不满足 → 抛错(安装前调用) +function assertRuntimeCompat(pluginId, manifest) { + const need = String((manifest && manifest.minRuntimeVersion) || "").trim(); + const cur = config.runtimeVersion(); + if (need && cur && versionLt(cur, need)) { + throw new Error(`插件 ${pluginId} 要求运行时 >= ${need},当前运行时 ${cur}(请先升级客户端)`); + } +} + +// 解压安装:临时目录 → 校验非法路径 → 版本兼容校验 → 原子替换(升级前自动备份上一版) +function installPkg(pluginId, content) { + if (content.length > MAX_PKG_BYTES) { + logger.error(`插件包 ${pluginId} 超大小上限,拒绝安装`); + return false; + } + let zip; + try { + zip = new AdmZip(content); + } catch (e) { + logger.error(`插件包 ${pluginId} 不是合法 ZIP`); + return false; + } + const entries = zip.getEntries(); + const names = entries.map((en) => en.entryName); + if (!names.includes("plugin.json")) { + logger.error(`插件包 ${pluginId} 缺 plugin.json`); + return false; + } + for (const n of names) { + if (n.startsWith("/") || n.split("/").includes("..")) { + logger.error(`插件包 ${pluginId} 含非法路径:${n}`); + return false; + } + } + const tmp = fs.mkdtempSync(path.join(os.tmpdir(), `.pkg_${pluginId}_`)); + try { + zip.extractAllTo(tmp, true /* overwrite */); + } catch (e) { + logger.error(`解压插件包 ${pluginId} 失败:${e.message}`); + fs.rmSync(tmp, { recursive: true, force: true }); + return false; + } + // 版本兼容校验:新包 plugin.json 声明 minRuntimeVersion 且当前运行时不满足 → 拒绝安装(防坏包) + let mf; + try { + mf = JSON.parse(fs.readFileSync(path.join(tmp, "plugin.json"), "utf-8")); + } catch (e) { + logger.error(`插件包 ${pluginId} 的 plugin.json 解析失败:${e.message}`); + fs.rmSync(tmp, { recursive: true, force: true }); + return false; + } + try { + assertRuntimeCompat(pluginId, mf); + } catch (e) { + logger.error(`插件 ${pluginId} 拒绝安装:${e.message}`); + fs.rmSync(tmp, { recursive: true, force: true }); + return false; + } + const target = path.join(pluginRoot(), pluginId); + try { + fs.mkdirSync(pluginRoot(), { recursive: true }); + backupForRollback(pluginId); // 升级前保留上一版(首次安装自动跳过) + if (fs.existsSync(target)) fs.rmSync(target, { recursive: true, force: true }); + fs.renameSync(tmp, target); + } catch (e) { + logger.error(`安装插件 ${pluginId} 失败:${e.message}`); + fs.rmSync(tmp, { recursive: true, force: true }); + return false; + } + return true; +} + +function localPluginEntries() { + const root = pluginRoot(); + const out = []; + if (!fs.existsSync(root)) return out; + for (const name of fs.readdirSync(root)) { + if (name.startsWith("_") || name === "__pycache__") continue; + const full = path.join(root, name); + let stat; + try { + stat = fs.statSync(full); + } catch (e) { + continue; + } + if (stat.isDirectory() && (fs.existsSync(path.join(full, "__init__.py")) || fs.existsSync(path.join(full, "plugin.json")))) { + out.push(full); + } + } + return out; +} + +// 清理中心机已删除/收回授权的本地插件(仅云端清单可达时;设备忙则整轮跳过) +function pruneStale(keepIds) { + const scheduler = require("./scheduler"); + const root = pluginRoot(); + if (!fs.existsSync(root) || scheduler.isBusy()) return []; + const removed = []; + for (const entry of localPluginEntries()) { + const pid = path.basename(entry); + if (keepIds.has(pid)) continue; + try { + fs.rmSync(entry, { recursive: true, force: true }); + removed.push(pid); + logger.info(`插件 ${pid} 已在中心机删除/收回授权,本地目录同步移除`); + } catch (e) { + logger.warning(`清理本地插件 ${pid} 失败:${e.message}`); + } + } + return removed; +} + +// 按账号权限同步插件:首次下载 + 版本更新 + 清理已删除。离线/失败静默降级。 +async function syncPlugins(account) { + const result = { downloaded: [], updated: [], up_to_date: [], failed: [], removed: [] }; + if (!config.CONTROLPLANE_URL || !account) return result; + const manifest = await cloudPluginManifest(account); + if (manifest === null) return result; + result.removed = pruneStale(new Set(manifest.map((p) => p.id))); + for (const p of manifest) { + const pid = p.id; + const ver = p.version || p.latest_version || ""; + if (!pid || !ver) continue; + const local = localVersion(pid); + if (local === ver || (local && !versionLt(local, ver))) { + result.up_to_date.push(pid); + continue; + } + const tkt = await dlTicket(pid, ver, account); + if (!tkt) { + result.failed.push(pid); + continue; + } + const content = await fetchPkg(tkt.ticket || ""); + if (!content) { + result.failed.push(pid); + continue; + } + const expect = (tkt.sha256 || "").toLowerCase(); + if (expect && sha256Hex(content) !== expect) { + logger.error(`插件包 ${pid}@${ver} sha256 校验失败,拒绝安装`); + result.failed.push(pid); + continue; + } + if (installPkg(pid, content)) { + (local ? result.updated : result.downloaded).push(pid); + } else { + result.failed.push(pid); + } + } + logger.info( + `插件同步完成:下载=${result.downloaded.join(",")} 更新=${result.updated.join(",")} ` + + `最新=${result.up_to_date.join(",")} 清理=${result.removed.join(",")} 失败=${result.failed.join(",")}` + ); + return result; +} + +// 权限白名单:控制面拉取 + 本地缓存(fail-closed:无账号/离线无缓存 = 空集) +const ALLOW_CACHE = path.join(config.APP_DATA, "plugin_allow.json"); + +function saveAllowedCache(ids) { + try { + fs.mkdirSync(config.APP_DATA, { recursive: true }); + fs.writeFileSync(ALLOW_CACHE, JSON.stringify([...ids].sort()), "utf-8"); + } catch (e) { + logger.warning(`插件权限清单缓存写入失败: ${e.message}`); + } +} + +function loadAllowedCache() { + if (!fs.existsSync(ALLOW_CACHE)) return null; + try { + const raw = JSON.parse(fs.readFileSync(ALLOW_CACHE, "utf-8")); + return new Set((raw || []).map(String)); + } catch (e) { + return null; + } +} + +async function resolveAllowed(account) { + if (!config.CONTROLPLANE_URL) return new Set(); + if (!account) { + logger.info("未登录(无会话账号),插件零权限加载"); + return new Set(); + } + try { + const r = await cp.request("GET", "/api/plugins", { + headers: cp.machineHeaders(), + params: { account }, + timeout: 5, + }); + const allowed = new Set((r.plugins || []).map((p) => p.id)); + logger.info(`控制面权限清单(${account}):${[...allowed].sort().join(",") || "(空)"}`); + saveAllowedCache(allowed); + return allowed; + } catch (e) { + const cached = loadAllowedCache(); + if (cached !== null) { + logger.info(`权限清单拉取失败,用本地缓存(${account}):${e.message}`); + return cached; + } + logger.warning(`权限清单拉取失败且无缓存,插件零权限加载:${e.message}`); + return new Set(); + } +} + +module.exports = { + withSyncLock, + syncPlugins, + cloudPluginManifest, + localVersion, + resolveAllowed, + pluginRoot, + backupForRollback, + rollbackAvailable, + rollbackIndex, + rollbackPlugin, + installPkg, + assertRuntimeCompat, + ROLLBACK_DIR, +}; diff --git a/desktop/electron-shell/electron/preload.js b/desktop/electron-shell/electron/preload.js new file mode 100644 index 0000000..319cb50 --- /dev/null +++ b/desktop/electron-shell/electron/preload.js @@ -0,0 +1,14 @@ +// preload:contextBridge 白名单 IPC(渲染层主通道走 HTTP 兼容层,此处仅暴露只读环境信息)。 +"use strict"; + +const { contextBridge } = require("electron"); + +contextBridge.exposeInMainWorld("dshShell", { + platform: process.platform, + versions: { + electron: process.versions.electron, + node: process.versions.node, + chrome: process.versions.chrome, + }, + // 渲染层可通过 window.open 打开中心机控制面(外部 URL 需在渲染层显式触发) +}); diff --git a/desktop/electron-shell/electron/registry.js b/desktop/electron-shell/electron/registry.js new file mode 100644 index 0000000..35d3a86 --- /dev/null +++ b/desktop/electron-shell/electron/registry.js @@ -0,0 +1,119 @@ +// 插件注册表:读取 plugins//plugin.json 元数据(manifest 驱动,与 Python meta.py 语义一致)。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const config = require("./config"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("registry"); + +function pluginRoot() { + return config.pluginRoot(); +} + +// 本地已落盘插件条目(目录包含 __init__.py 或 plugin.json,后者兜底下载中断的残缺目录) +function listLocalPlugins() { + const root = pluginRoot(); + const out = []; + if (!fs.existsSync(root)) return out; + for (const name of fs.readdirSync(root)) { + if (name.startsWith("_") || name === "__pycache__") continue; + const full = path.join(root, name); + let stat; + try { + stat = fs.statSync(full); + } catch (e) { + continue; + } + if (stat.isDirectory()) { + if (fs.existsSync(path.join(full, "__init__.py")) || fs.existsSync(path.join(full, "plugin.json"))) { + out.push({ id: name, dir: full }); + } + } + } + return out; +} + +// 读取插件 manifest;缺文件/解析失败返回 null(不阻断) +function readManifest(pluginId) { + const mf = path.join(pluginRoot(), pluginId, "plugin.json"); + if (!fs.existsSync(mf)) return null; + try { + const data = JSON.parse(fs.readFileSync(mf, "utf-8")); + return data && typeof data === "object" ? data : null; + } catch (e) { + logger.warning(`插件 ${pluginId} plugin.json 解析失败:${e.message}`); + return null; + } +} + +// JSON-Schema(object.properties) → 前端表单 [{key,label,type,default,options,description}] +function fieldsFromSchema(schema) { + if (!schema || schema.type !== "object" || !schema.properties) return null; + const out = []; + for (const [key, prop] of Object.entries(schema.properties)) { + const item = { key, label: prop.title || key, default: prop.default ?? "" }; + const t = prop.type || "string"; + if (t === "integer" || t === "number") item.type = "int"; + else if (t === "string" && Array.isArray(prop.enum)) { + item.type = "select"; + item.options = prop.enum; + } else if (t === "string" && prop.format === "password") item.type = "password"; + else if (t === "array") { + item.type = "multiselect"; + if (prop.items && Array.isArray(prop.items.enum)) item.options = prop.items.enum; + } else item.type = "text"; + if (prop.description) item.description = prop.description; + out.push(item); + } + return out; +} + +// 组装插件元数据(manifest 驱动,与 Python meta._plugin_schema 一致) +function pluginSchema(pluginId) { + const manifest = readManifest(pluginId); + const base = { + id: pluginId, + name: pluginId, + version: "0", + description: "", + uses_month: false, + ui: false, + capabilities: [], + permissions: {}, + fields: [], + }; + if (!manifest) return base; + const fields = fieldsFromSchema(manifest.fields); + return { + id: manifest.id || pluginId, + name: manifest.name || pluginId, + version: manifest.version || "0", + description: manifest.description || "", + uses_month: !!manifest.uses_month, + ui: !!manifest.ui, + platform: manifest.platform || "", // hr / oa / ""(前端平台徽章 + 运行并发闸按(账号,平台)隔离) + min_runtime_version: manifest.minRuntimeVersion || "", // 版本兼容校验声明(安装时强校验,此处透传前端展示) + capabilities: manifest.capabilities || [], + permissions: manifest.permissions || {}, + fields: fields || [], + }; +} + +function find(pluginId) { + const dir = path.join(pluginRoot(), pluginId); + if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) throw new Error(`插件不存在: ${pluginId}`); + const manifest = readManifest(pluginId); + if (!manifest && !fs.existsSync(path.join(dir, "__init__.py"))) { + throw new Error(`插件不存在: ${pluginId}`); + } + return { id: pluginId, dir, manifest, ...pluginSchema(pluginId) }; +} + +function findByName(name) { + // 供 /api/runs 以插件名查找(与 PLUGINS.find 语义对齐) + return find(name); +} + +module.exports = { pluginRoot, listLocalPlugins, readManifest, fieldsFromSchema, pluginSchema, find }; diff --git a/desktop/electron-shell/electron/run-history.js b/desktop/electron-shell/electron/run-history.js new file mode 100644 index 0000000..351d279 --- /dev/null +++ b/desktop/electron-shell/electron/run-history.js @@ -0,0 +1,205 @@ +// 运行历史(壳子本地持久化):每次运行的结论 + 该次运行的日志,供「最近运行 / 点击回放」使用。 +// 存储:%LOCALAPPDATA%\37duAutomation\ +// run_history.jsonl 索引(只存结论,一行一次运行,无日志) +// run_history/.jsonl 该次运行的日志(一行一条) +// 分离存储的原因:列表接口只读索引(几百行、恒定体积),详情才读单个日志文件, +// 避免"列表要解析所有历史日志"这种随使用时长线性劣化的写法。 +// 职责划分:state.RUNS 内存态只服务"正在跑的那一次";本模块服务"跑过的那些次"。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const config = require("./config"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("run-history"); + +const HISTORY_PATH = path.join(config.APP_DATA, "run_history.jsonl"); +const RUNS_DIR = path.join(config.APP_DATA, "run_history"); + +// 上限:历史是"回顾"用的,不追求全量归档 +const MAX_RECORDS = 300; // 裁剪目标:每次裁剪后保留最近 300 次运行(实际条数在 300 ~ 350 之间浮动) +const PRUNE_SLACK = 50; // 超出裁剪目标这么多条才做一次整体裁剪(避免每次运行都重写整个索引) +const MAX_LOGS_PER_RUN = 400; // 单次运行最多保留 400 条日志 +const MAX_MSG_LEN = 1000; // 单条日志最大长度(防插件打印大体积 JSON 灌爆历史) +const MAX_LOG_BYTES_PER_RUN = 32 * 1024; // 单次运行日志总量上限,超出即停止记录(软截断) + +// run_id 形如 32 位 hex;做白名单校验,杜绝路径穿越 +function safeRunId(runId) { + const s = String(runId || ""); + return /^[A-Za-z0-9_-]{8,64}$/.test(s) ? s : ""; +} + +function logFilePath(runId) { + const id = safeRunId(runId); + return id ? path.join(RUNS_DIR, `${id}.jsonl`) : ""; +} + +// 截断超长日志(对齐"正常 INFO 级别屏蔽大体积 JSON"的日志规范精神) +function clip(msg) { + const s = String(msg === undefined || msg === null ? "" : msg); + return s.length > MAX_MSG_LEN ? s.slice(0, MAX_MSG_LEN) + "…(已截断)" : s; +} + +// 逐行读取 JSONL;单行损坏(例如写入中断)只跳过该行,不拖垮整个文件 +function readLines(file) { + if (!file || !fs.existsSync(file)) return []; + let text; + try { + text = fs.readFileSync(file, "utf-8"); + } catch (e) { + logger.warning(`运行历史读取失败(${path.basename(file)}):${e.message}`); + return []; + } + const out = []; + for (const line of text.split(/\r?\n/)) { + const s = line.trim(); + if (!s) continue; + try { + out.push(JSON.parse(s)); + } catch (e) { + /* 跳过损坏行 */ + } + } + return out; +} + +// 原子整体替换(临时文件 + rename),避免写一半留下半行 +function writeLines(file, records) { + try { + fs.mkdirSync(path.dirname(file), { recursive: true }); + const tmp = file + ".tmp"; + const body = records.length ? records.map((r) => JSON.stringify(r)).join("\n") + "\n" : ""; + fs.writeFileSync(tmp, body, "utf-8"); + fs.renameSync(tmp, file); + } catch (e) { + logger.warning(`运行历史写入失败(${path.basename(file)}):${e.message}`); + } +} + +function readIndex() { + return readLines(HISTORY_PATH).filter((r) => r && typeof r === "object" && r.run_id); +} + +// 写单次运行的日志文件(受条数与总字节双上限约束) +function writeRunLogs(runId, logs) { + const file = logFilePath(runId); + if (!file || !Array.isArray(logs) || !logs.length) return; + const kept = []; + let bytes = 0; + for (const l of logs.slice(-MAX_LOGS_PER_RUN)) { + const rec = { + t: l && l.t ? String(l.t) : "", + level: (l && l.level) || "INFO", + msg: clip(l && l.msg), + }; + bytes += rec.msg.length + 32; + if (bytes > MAX_LOG_BYTES_PER_RUN) { + kept.push({ t: "", level: "WARN", msg: "(日志过长,后续内容已省略,完整日志请查看运行日志面板)" }); + break; + } + kept.push(rec); + } + writeLines(file, kept); +} + +// 索引条数缓存:本模块是索引的唯一写入方,可安全缓存,避免每次追加都整文件读取 +let _count = -1; + +function indexCount() { + if (_count < 0) _count = readIndex().length; + return _count; +} + +// 裁剪索引到上限,并清理不再被引用的日志文件(避免目录无限膨胀) +function prune() { + const all = readIndex(); + _count = all.length; + if (all.length <= MAX_RECORDS) return; + const kept = all.slice(-MAX_RECORDS); + writeLines(HISTORY_PATH, kept); + _count = kept.length; + const alive = new Set(kept.map((r) => safeRunId(r.run_id)).filter(Boolean)); + let removed = 0; + try { + for (const name of fs.readdirSync(RUNS_DIR)) { + const id = name.replace(/\.jsonl$/, ""); + if (!name.endsWith(".jsonl") || alive.has(id)) continue; + fs.unlinkSync(path.join(RUNS_DIR, name)); + removed++; + } + } catch (e) { + /* 目录不存在或个别文件被占用:忽略,不影响主流程 */ + } + if (removed) logger.info(`运行历史已裁剪至最近 ${MAX_RECORDS} 次,清理日志文件 ${removed} 个`); +} + +// 追加一次已结束的运行(结论进索引,日志单独落文件) +function append(rec) { + if (!rec || !safeRunId(rec.run_id)) return; + writeRunLogs(rec.run_id, rec.logs); + const briefRec = { ...rec }; + delete briefRec.logs; + try { + fs.mkdirSync(config.APP_DATA, { recursive: true }); + fs.appendFileSync(HISTORY_PATH, JSON.stringify(briefRec) + "\n", "utf-8"); + } catch (e) { + logger.warning(`运行历史追加失败:${e.message}`); + return; + } + _count = indexCount() + 1; + // 留出 slack 再裁剪:否则一旦到达上限,之后每次运行都会重写整个索引 + if (_count > MAX_RECORDS + PRUNE_SLACK) prune(); +} + +// 列表视图:只给列表需要的字段(不含日志) +function brief(rec) { + return { + run_id: rec.run_id, + plugin_id: rec.plugin_id || "", + name: rec.name || rec.plugin_id || "", + version: rec.version || "", + trigger: rec.trigger || "manual", + schedule_id: rec.schedule_id || "", + status: rec.status || "", + ok: !!rec.ok, + error: rec.error || "", + started: rec.started || 0, + finished: rec.finished || 0, + duration_sec: rec.duration_sec || 0, + summary: rec.summary || "", + }; +} + +// 当前账号最近 limit 次运行(新的在前) +function list(account, limit) { + const n = Math.max(1, Math.min(100, parseInt(limit, 10) || 20)); + const mine = readIndex().filter((r) => r.account === account); + return mine.slice(-n).reverse().map(brief); +} + +// 单次运行详情(结论 + 日志);account 用于隔离,取不到返回 null +function get(runId, account) { + const id = safeRunId(runId); + if (!id) return null; + const all = readIndex(); + for (let i = all.length - 1; i >= 0; i--) { + if (all[i].run_id === id && all[i].account === account) { + return { ...brief(all[i]), logs: readLines(logFilePath(id)) }; + } + } + return null; +} + +module.exports = { + HISTORY_PATH, + RUNS_DIR, + MAX_RECORDS, + PRUNE_SLACK, + MAX_LOGS_PER_RUN, + MAX_MSG_LEN, + MAX_LOG_BYTES_PER_RUN, + append, + list, + get, +}; diff --git a/desktop/electron-shell/electron/runner.js b/desktop/electron-shell/electron/runner.js new file mode 100644 index 0000000..3a41bf0 --- /dev/null +++ b/desktop/electron-shell/electron/runner.js @@ -0,0 +1,356 @@ +// 插件执行核心:登记运行记录 + 进程级隔离执行插件 + 结束后上报。 +// 对齐 Python runner.py 完整执行链:spawn python plugin_runner(★ 逐字节协议) +// → stdin 单行 JSON fields → stdout JSON 事件行 → 超时整树强杀(taskkill /T /F)。 +"use strict"; + +const { spawn } = require("child_process"); +const readline = require("readline"); +const crypto = require("crypto"); +const config = require("./config"); +const state = require("./state"); +const scheduler = require("./scheduler"); +const licensing = require("./licensing"); +const runHistory = require("./run-history"); +const { HUB } = require("./hub"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("runner"); + +// 手动停止登记:run_id → 停止标记 +const _USER_STOPPED = new Set(); +// run_id → kill 函数(执行中,供整树强杀) +const _ACTIVE = new Map(); + +function isUserStopped(runId) { + return _USER_STOPPED.has(runId); +} + +function treeKill(pid) { + // Windows 整树强杀(含 DrissionPage 浏览器等孙进程);非 Windows 直接 kill 子进程组 + try { + if (process.platform === "win32") { + const killer = spawn("taskkill", ["/pid", String(pid), "/T", "/F"], { + windowsHide: true, + stdio: "ignore", + detached: true, + }); + killer.unref(); + } else { + try { + process.kill(-pid, "SIGKILL"); + } catch (e) { + process.kill(pid, "SIGKILL"); + } + } + } catch (e) { + logger.warning(`整树强杀失败 pid=${pid}: ${e.message}`); + } +} + +function terminateRun(runId) { + _USER_STOPPED.add(runId); + const kill = _ACTIVE.get(runId); + if (!kill) return false; // 尚未拉起执行子进程(排队中)或已结束 + try { + kill(); + } catch (e) { + /* 忽略 */ + } + return true; +} + +// 平台命名空间并发闸键:按(账号, 平台)隔离,保护该账号各自的平台登录态 cookies +function nsKey(account, platform) { + return `${account || "anon"}:${platform || "local"}`; +} + +// 发布日志事件,并同步累积到"这一次运行"的记录里(结束后随运行历史落盘,供点击回放) +function emitLog(runId, pluginId, level, msg) { + const text = String(msg === undefined || msg === null ? "" : msg); + state.appendRunLog(runId, { + t: new Date().toLocaleTimeString("zh-CN", { hour12: false }), + level: level || "INFO", + msg: text, + }); + HUB.publish({ t: "log", run_id: runId, plugin_id: pluginId, level: level || "INFO", msg: text }); +} + +// 结束一次运行:写终态 → 落盘运行历史 → 广播 run_done。 +// 所有结束路径(队列拒绝 / 队列异常 / 子进程收尾)共用,避免漏记历史。 +function finishRun(runId, plugin, status, error, summary) { + const ok = status === "done"; + const finished = Date.now() / 1000; + const run = state.RUNS.get(runId) || {}; + const durationSec = run.started ? Math.max(0, Math.round(finished - run.started)) : 0; + state.setRun(runId, { + status, + error: ok ? "" : error || "", + summary: summary || "", + finished, + duration_sec: durationSec, + }); + runHistory.append({ + run_id: runId, + account: run.account || "", + plugin_id: plugin.id, + name: run.name || plugin.name || plugin.id, + version: run.version || plugin.version || "0", + trigger: run.trigger || "manual", + schedule_id: run.schedule_id || "", + status, + ok, + error: ok ? "" : error || "", + summary: summary || "", + started: run.started || 0, + finished, + duration_sec: durationSec, + logs: Array.isArray(run.logs) ? run.logs : [], + }); + HUB.publish({ + t: "run_done", + run_id: runId, + plugin_id: plugin.id, + name: run.name || plugin.name || plugin.id, + trigger: run.trigger || "manual", + ok, + error: ok ? "" : error || "", + duration_sec: durationSec, + summary: summary || "", + }); +} + +// 提交一次插件运行(手动 POST /api/runs 与定时任务共用入口);立即返回 run_id。 +// opts: { trigger: "manual" | "schedule", schedule_id } —— 用于区分"谁触发的",落进运行历史 +function submitRun(account, plugin, fields, opts) { + const o = opts && typeof opts === "object" ? opts : {}; + const trigger = o.trigger === "schedule" ? "schedule" : "manual"; + const runId = crypto.randomBytes(16).toString("hex"); + state.registerRun(runId, { + status: "running", + account, + plugin_id: plugin.id, + name: plugin.name || plugin.id, + version: plugin.version || "0", + trigger, + schedule_id: o.schedule_id || "", + started: Date.now() / 1000, + result: null, + error: null, + logs: [], + }); + HUB.publish({ + t: "run_start", + run_id: runId, + plugin_id: plugin.id, + name: plugin.name || plugin.id, + trigger, + at: new Date().toLocaleTimeString("zh-CN", { hour12: false }), + }); + licensing.report(account, "", plugin.id, plugin.version || "0", "start"); + + void runQueued(plugin, fields, runId, account); + return runId; +} + +async function runQueued(plugin, fields, runId, account) { + try { + // 平台命名空间并发闸:按(账号, 平台)串行(保护各账号各自的平台登录态 cookies) + if (scheduler.nsLocked(nsKey(account, plugin.platform))) { + emitLog(runId, plugin.id, "INFO", `同平台任务执行中,排队等待(命名空间 ${nsKey(account, plugin.platform)})…`); + } + await scheduler.withNsLock(nsKey(account, plugin.platform), async () => { + const startFn = async () => { + if (isUserStopped(runId)) { + // 排队期间用户已点停止:不真正拉起插件 + throw new Error("用户已取消该排队任务"); + } + await startChild(plugin, fields, runId, account); + return runId; + }; + const r = await scheduler.requestStart(account, plugin.id, plugin.version || "0", startFn); + if (!r.ok) { + const err = isUserStopped(runId) ? "用户手动强制停止" : r.error; + if (isUserStopped(runId)) _USER_STOPPED.delete(runId); + finishRun(runId, plugin, "error", err, ""); + } + }); + } catch (e) { + logger.error(`运行队列异常:${e.message}`); + finishRun(runId, plugin, "error", `运行队列异常:${e.message}`, ""); + } +} + +// 拉起执行子进程:子进程 spawn 成功后立即 resolve(runId)(requestStart 随即标记 running); +// 执行结束(close)后异步落终态 + 上报 + 回空闲。 +function startChild(plugin, fields, runId, account) { + return new Promise((resolve, reject) => { + const timeout = config.RUN_TIMEOUT; + // 执行环境解析:便携环境包(python-env)优先 → 经 job_guard(Job Object 内存上限 + // + 整树托管)拉起 plugin_runner;无环境包(dev 直接 .venv)保持原直拉链路。 + // 两种模式协议逐字节一致(plugin_runner stdout JSON 事件行经 stdio 原样透传)。 + const python = config.pythonExe(); + const envRoot = config.pythonEnvRoot(); + const guard = config.jobGuardScript(); + const baseArgs = ["-u", config.runnerScript(), "--plugin", plugin.id, "--run", runId]; + if (state.ALLOWED !== null) { + baseArgs.push("--allowed", [...state.ALLOWED].sort().join(",")); + } + let cmd; + let cwd; + if (envRoot && guard) { + // 环境包模式:python -u job_guard.py --mem --timeout -- python -u plugin_runner.py ... + cmd = [ + python, "-u", guard, + "--mem", String(config.RUN_MAX_MEM_MB), + "--timeout", String(timeout), + "--", python, ...baseArgs, + ]; + cwd = envRoot; + } else { + cmd = [python, ...baseArgs]; + cwd = envRoot || config.REPO_ROOT; + } + let child; + try { + child = spawn(cmd[0], cmd.slice(1), { + cwd, + windowsHide: true, + env: { + ...process.env, + PYTHONIOENCODING: "utf-8", + PYTHONUTF8: "1", + PLATFORM_ACCOUNT: account || "", + // 环境包插件加载器据此定位插件根(dev 直拉模式传了也无害) + PLUGINS_ROOT: config.pluginRoot(), + }, + stdio: ["pipe", "pipe", "pipe"], + }); + } catch (e) { + reject(new Error(`拉起执行子进程失败: ${e.message}`)); + return; + } + + let resolved = false; + const killFn = () => treeKill(child.pid); + _ACTIVE.set(runId, killFn); + + const result = {}; + const publish = (ev) => { + const t = ev.ev; + if (t === "log") { + emitLog(runId, plugin.id, ev.level, ev.msg); + } else if (t === "progress") { + HUB.publish({ t: "progress", run_id: runId, plugin_id: plugin.id, pct: Math.max(0, Math.min(100, parseInt(ev.pct, 10) || 0)) }); + } else if (t === "result") { + Object.assign(result, ev); + } + }; + + const rlOut = readline.createInterface({ input: child.stdout }); + rlOut.on("line", (line) => { + const s = String(line).trim(); + if (!s) return; + try { + const ev = JSON.parse(s); + if (ev && typeof ev === "object" && ev.ev) publish(ev); + } catch (e) { + /* 非 JSON 行忽略 */ + } + }); + + const rlErr = readline.createInterface({ input: child.stderr }); + rlErr.on("line", (line) => { + const s = String(line).trim(); + if (s) { + emitLog(runId, plugin.id, "ERROR", s); + } + }); + + // 写 fields(单行 JSON,UTF-8)并关闭 stdin + try { + child.stdin.write(Buffer.from(JSON.stringify(fields || {}), "utf-8")); + child.stdin.end(); + } catch (e) { + /* 子进程可能已退出 */ + } + + let timedOut = false; + let finalized = false; + let timer = null; + + const finalize = (code, spawnErr) => { + if (finalized) return; + finalized = true; + if (timer) clearTimeout(timer); + _ACTIVE.delete(runId); + const hasResult = result && Object.keys(result).length > 0; + let status; + let error; + if (hasResult) { + status = result.ok ? "done" : "error"; + error = result.error || ""; + } else if (spawnErr) { + status = "error"; + error = spawnErr; + } else if (isUserStopped(runId)) { + status = "error"; + error = "用户手动强制停止"; + } else if (timedOut) { + status = "error"; + error = `插件执行超时(${timeout}s)已强制终止`; + } else { + status = "error"; + error = `执行进程异常退出(exit=${code})且未返回结果`; + } + state.setRun(runId, { result: hasResult ? result.result : null }); + finishRun( + runId, + plugin, + status, + status === "done" ? "" : error, + hasResult ? ((result.result || {}).summary || "") : "" + ); + _USER_STOPPED.delete(runId); + scheduler.markDone(plugin.id, runId); // 单活槽位回空闲并唤醒排队请求 + reportRun(plugin, runId); // 运行上报(联网实时/离线暂存补报) + }; + + child.once("spawn", () => { + resolved = true; + timer = setTimeout(() => { + timedOut = true; + logger.warning(`插件执行超时(${timeout}s)已强制终止:${plugin.id}`); + killFn(); + }, timeout * 1000); + resolve(runId); + }); + + child.on("error", (err) => { + if (!resolved) { + _ACTIVE.delete(runId); + reject(new Error(`拉起执行子进程失败: ${err.message}`)); + return; + } + finalize(null, `执行子进程异常: ${err.message}`); + }); + + child.on("close", (code) => { + finalize(code, null); + }); + }); +} + +function reportRun(plugin, runId) { + try { + const run = state.RUNS.get(runId) || {}; + const account = run.account || ""; + const status = run.status === "done" ? "done" : run.status === "running" ? "running" : "error"; + const msg = run.error || ""; + const duration = run.started ? Math.floor(Date.now() / 1000 - run.started) : 0; + licensing.report(account, "", plugin.id, run.version || "", status, msg, duration); + } catch (e) { + logger.warning(`运行上报失败:${e.message}`); + } +} + +module.exports = { submitRun, terminateRun, isUserStopped }; diff --git a/desktop/electron-shell/electron/scheduler.js b/desktop/electron-shell/electron/scheduler.js new file mode 100644 index 0000000..b6b1d49 --- /dev/null +++ b/desktop/electron-shell/electron/scheduler.js @@ -0,0 +1,157 @@ +// 设备级单活调度器:整机同一时刻只运行一个插件进程(对齐 Python scheduler.py)。 +// active.json 同路径同格式(跨端共享);switching/running 均视为忙;启动失败回滚空闲。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const config = require("./config"); +const { nowStr } = require("./crypto"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("scheduler"); + +const ACTIVE_PATH = path.join(config.APP_DATA, "active.json"); + +function readActive() { + try { + if (!fs.existsSync(ACTIVE_PATH)) return {}; + const d = JSON.parse(fs.readFileSync(ACTIVE_PATH, "utf-8")); + return d && typeof d === "object" ? d : {}; + } catch (e) { + return {}; + } +} + +function isBusy() { + const s = readActive().status; + return s === "running" || s === "switching"; +} + +function writeActive(fields) { + const d = { ...readActive(), ...fields }; + d.userId = d.userId ?? ""; + d.pluginId = d.pluginId ?? ""; + d.version = d.version ?? ""; + d.status = d.status ?? "idle"; + d.startedAt = d.startedAt ?? ""; + d.runId = d.runId ?? ""; + try { + fs.mkdirSync(config.APP_DATA, { recursive: true }); + const tmp = ACTIVE_PATH + ".tmp"; + fs.writeFileSync(tmp, JSON.stringify(d), "utf-8"); + fs.renameSync(tmp, ACTIVE_PATH); // 原子写 + } catch (e) { + logger.warning(`写 active.json 失败:${e.message}`); + } +} + +function initActive() { + fs.mkdirSync(config.APP_DATA, { recursive: true }); + if (!fs.existsSync(ACTIVE_PATH)) { + writeActive({ userId: "", pluginId: "", version: "", status: "idle", runId: "", startedAt: "" }); + } else { + const s = readActive().status; + if (s === "running" || s === "switching") { + logger.warning("检测到上次异常退出残留的运行状态(running/switching),复位为空闲"); + writeActive({ status: "idle", userId: "", pluginId: "", version: "", runId: "", startedAt: "" }); + } + } +} + +function current() { + return readActive(); +} + +function isActive(pluginId) { + const a = readActive(); + return a.status === "running" && a.pluginId === pluginId; +} + +// ==================== 设备级单活(Promise 门闩) ==================== +const _waiters = []; + +function _wake() { + const ws = _waiters.splice(0); + for (const r of ws) r(); +} + +async function waitIdle() { + while (isBusy()) { + await new Promise((resolve) => _waiters.push(resolve)); + } +} + +// 抢占链(原子门闩):把「检查空闲 → 写 switching → 拉起 → 写 running」这段临界区串行化, +// 保证同一时刻只有一个 requestStart 能进入启动段(不同平台命名空间并发提交时也不会双开进程)。 +let _claimChain = Promise.resolve(); + +// 阻塞等待设备空闲后启动:startFn 负责拉起子进程并返回 run_id(不可阻塞)。 +// 启动失败回滚"空闲"并唤醒等待者。 +function requestStart(user, pluginId, version, startFn) { + const run = _claimChain.then(async () => { + await waitIdle(); + writeActive({ status: "switching", startedAt: nowStr() }); + try { + const runId = await startFn(); + writeActive({ userId: user, pluginId, version, status: "running", runId, startedAt: nowStr() }); + return { ok: true, run_id: runId }; + } catch (e) { + writeActive({ status: "idle" }); + _wake(); + return { ok: false, error: `启动失败:${e.message}` }; + } + }); + // 无论成功失败都推进链,避免一次异常卡死后续排队请求 + _claimChain = run.then( + () => {}, + () => {} + ); + return run; +} + +// 运行结束:若 active 仍是该插件则回空闲并唤醒等待者(幂等) +function markDone(pluginId, runId) { + const a = readActive(); + if (a.pluginId === pluginId && (a.runId === runId || a.status === "running")) { + writeActive({ status: "idle", userId: "", pluginId: "", version: "", runId: "", startedAt: "" }); + _wake(); + } +} + +// ==================== 平台命名空间并发闸(同平台串行,保护共享 cookies) ==================== +const _nsQueues = {}; +const _nsInflight = {}; + +function nsLocked(platform) { + const key = (platform || "").trim() || "local"; + return (_nsInflight[key] || 0) > 0; +} + +async function withNsLock(platform, fn) { + const key = (platform || "").trim() || "local"; + const prev = _nsQueues[key] || Promise.resolve(); + const run = prev.then(async () => { + _nsInflight[key] = (_nsInflight[key] || 0) + 1; + try { + return await fn(); + } finally { + _nsInflight[key] = (_nsInflight[key] || 0) - 1; + } + }); + _nsQueues[key] = run.catch(() => {}); + return run; +} + +module.exports = { + ACTIVE_PATH, + readActive, + isBusy, + writeActive, + initActive, + current, + isActive, + requestStart, + markDone, + nsLocked, + withNsLock, +}; diff --git a/desktop/electron-shell/electron/server.js b/desktop/electron-shell/electron/server.js new file mode 100644 index 0000000..f19455e --- /dev/null +++ b/desktop/electron-shell/electron/server.js @@ -0,0 +1,923 @@ +// 本地 HTTP/WS 兼容层(127.0.0.1:8799):壳 UI 本地 API 全集 + /pui 插件 UI + /ws 事件 + 静态前端。 +// 路由与返回结构对齐 Python webhost backend/apis/*(渲染层主通道走 HTTP,插件 iframe 同源调用)。 +"use strict"; + +const http = require("http"); +const fs = require("fs"); +const path = require("path"); +const crypto = require("crypto"); +const { URL } = require("url"); +const { WebSocketServer } = require("ws"); +const cp = require("./cpclient"); +const config = require("./config"); +const state = require("./state"); +const session = require("./session"); +const licensing = require("./licensing"); +const registry = require("./registry"); +const meta = require("./meta"); +const runner = require("./runner"); +const runHistory = require("./run-history"); +const lastFields = require("./last-fields"); +const pluginConfigs = require("./plugin-configs"); +const scheduler = require("./scheduler"); +const tasks = require("./tasks"); +const platformAuth = require("./platform-auth"); +const platformCreds = require("./platform-creds"); +const shellUpdater = require("./shell-updater"); +const chromeManager = require("./chrome-manager"); +const pluginSync = require("./plugin-sync"); +const envSync = require("./env-sync"); +const { HUB } = require("./hub"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("server"); + +const MIME = { + ".html": "text/html", ".js": "application/javascript", ".mjs": "application/javascript", + ".css": "text/css", ".json": "application/json", ".map": "application/json", + ".svg": "image/svg+xml", ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", + ".gif": "image/gif", ".ico": "image/x-icon", ".woff": "font/woff", + ".woff2": "font/woff2", ".ttf": "font/ttf", ".txt": "text/plain", +}; + +// ==================== 工具 ==================== +function parseCookies(req) { + const out = {}; + const raw = req.headers.cookie || ""; + for (const part of raw.split(";")) { + const idx = part.indexOf("="); + if (idx > 0) { + const k = part.slice(0, idx).trim(); + const v = part.slice(idx + 1).trim(); + try { + out[k] = decodeURIComponent(v); + } catch (e) { + out[k] = v; + } + } + } + return out; +} + +function readJsonBody(req, limit = 2 * 1024 * 1024) { + return new Promise((resolve, reject) => { + const chunks = []; + let size = 0; + req.on("data", (c) => { + size += c.length; + if (size > limit) { + const e = new Error("请求体过大"); + e.status = 413; + reject(e); + req.destroy(); + return; + } + chunks.push(c); + }); + req.on("end", () => { + const buf = Buffer.concat(chunks); + if (buf.length === 0) return resolve({}); + try { + resolve(JSON.parse(buf.toString("utf-8"))); + } catch (e) { + const err = new Error("JSON 解析失败"); + err.status = 400; + reject(err); + } + }); + req.on("error", reject); + }); +} + +function readRawBody(req, limit = 5 * 1024 * 1024) { + return new Promise((resolve, reject) => { + const chunks = []; + let size = 0; + req.on("data", (c) => { + size += c.length; + if (size > limit) { + const e = new Error("请求体过大"); + e.status = 413; + reject(e); + req.destroy(); + return; + } + chunks.push(c); + }); + req.on("end", () => resolve(Buffer.concat(chunks))); + req.on("error", reject); + }); +} + +function sendJson(res, status, obj) { + const body = JSON.stringify(obj); + res.writeHead(status, { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": Buffer.byteLength(body), + }); + res.end(body); +} + +function sendHtml(res, status, html) { + const body = Buffer.from(html, "utf-8"); + res.writeHead(status, { + "Content-Type": "text/html; charset=utf-8", + "Content-Length": body.length, + }); + res.end(body); +} + +function setSessionCookie(res, token) { + res.setHeader("Set-Cookie", `${session.SESSION_COOKIE}=${token}; Path=/; HttpOnly; SameSite=Lax`); +} + +function clearSessionCookie(res) { + res.setHeader("Set-Cookie", `${session.SESSION_COOKIE}=; Path=/; HttpOnly; SameSite=Lax; Max-Age=0`); +} + +function handleError(res, err) { + if (err && err.status) { + sendJson(res, err.status, { detail: err.message || String(err.status) }); + } else { + logger.error(`请求处理异常:${err && err.stack ? err.stack : err}`); + sendJson(res, 500, { detail: "内部错误" }); + } +} + +// ==================== 钉钉登录 state(防 CSRF) ==================== +const _LOGIN_STATES = new Map(); +const LOGIN_STATE_TTL = 5 * 60 * 1000; + +function loginStateNew() { + const now = Date.now(); + for (const [s, exp] of _LOGIN_STATES) { + if (exp < now) _LOGIN_STATES.delete(s); + } + const s = crypto.randomBytes(24).toString("base64url"); + _LOGIN_STATES.set(s, now + LOGIN_STATE_TTL); + return s; +} + +function loginStateTake(s) { + const exp = _LOGIN_STATES.get(s); + _LOGIN_STATES.delete(s); + return !!exp && exp >= Date.now(); +} + +// ==================== 业务组装 ==================== +async function dingtalkEstablish(account, nickname, dingtalkUid, res) { + if (!account) throw Object.assign(new Error("工号不能为空"), { status: 400 }); + const r = await cp.request("POST", "/api/admin/dingtalk/auth", { + headers: { ...cp.machineHeaders(), "Content-Type": "application/json" }, + json: { account, nickname, dingtalk_uid: dingtalkUid }, + timeout: 15, + }); + const acct = r.account || account; + const token = session.establishSession(acct, null); + setSessionCookie(res, token); + if (config.CONTROLPLANE_URL) { + try { + await licensing.syncLicensing(acct); + } catch (e) { + logger.warning(`登录后同步离线授权票据失败:${e.message}`); + } + // 异步刷新敏感凭证(不阻断) + require("./creds-sync") + .load(acct) + .then((creds) => { + if (creds && Object.keys(creds).length) config.applyCreds(creds); + }) + .catch(() => {}); + } + return { + ok: true, + account: acct, + is_admin: !!r.is_admin, + created: !!r.created, + must_change_pwd: !!r.must_change_pwd, + }; +} + +// ==================== 路由表 ==================== +async function route(req, res, url) { + const cookies = parseCookies(req); + const p = url.pathname; + const method = req.method; + + // ---------- 静态前端 ---------- + if (method === "GET" && !p.startsWith("/api") && !p.startsWith("/pui") && !p.startsWith("/auth")) { + return serveStatic(res, url); + } + + // ---------- 认证 / 会话 ---------- + if (p === "/api/admin/me" && method === "GET") { + const account = session.sessAccount(cookies); + if (!account) { + return sendJson(res, 200, { account: "", is_admin: false, dept: "", nickname: "", avatar: "" }); + } + try { + const r = await cp.request("GET", "/api/admin/me", { headers: session.cpHeaders(cookies), timeout: 10 }); + if (r.account === account) return sendJson(res, 200, r); + } catch (e) { + /* 云端不可达降级 */ + } + return sendJson(res, 200, { account, is_admin: false, dept: "", nickname: "", avatar: "" }); + } + + if (p === "/api/admin/login" && method === "POST") { + const body = await readJsonBody(req); + const account = String(body.account || "").trim(); + if (!account) throw Object.assign(new Error("账号不能为空"), { status: 400 }); + const r = await cp.request("POST", "/api/admin/auth", { + headers: { + "X-Admin-User": account, + ...(config.CONTROLPLANE_TOKEN ? { "X-API-Token": config.CONTROLPLANE_TOKEN } : {}), + "Content-Type": "application/json", + }, + json: { account, password: body.password }, + timeout: 15, + }); + if (!r.ok) return sendJson(res, 200, r); + const token = session.establishSession(account, r.cloud_token || ""); + setSessionCookie(res, token); + // 登录成功即后台同步:授权票据 + 插件 + 敏感凭证(失败不阻断登录) + afterLogin(account); + return sendJson(res, 200, { ...r, account }); + } + + if (p === "/api/admin/logout" && method === "POST") { + const token = cookies[session.SESSION_COOKIE] || ""; + session.clearSession(token); + clearSessionCookie(res); + return sendJson(res, 200, { ok: true }); + } + + if (p === "/api/admin/password" && method === "POST") { + const body = await readJsonBody(req); + const r = await cp.request("POST", "/api/admin/password", { + headers: { ...session.cpHeaders(cookies), "Content-Type": "application/json" }, + json: body, + timeout: 15, + }); + return sendJson(res, 200, r); + } + + if (p === "/api/admin/overview" && method === "GET") { + return sendJson(res, 200, { plugins: [], accounts: [], admins: [] }); + } + + // ---------- 头像 ---------- + const avatarMatch = p.match(/^\/api\/avatar\/([^/]+)$/); + if (avatarMatch && method === "GET") { + if (!config.CONTROLPLANE_URL) throw Object.assign(new Error("统一后端未配置(CONTROLPLANE_URL)"), { status: 503 }); + const r = await cp.request("GET", `/api/avatar/${encodeURIComponent(avatarMatch[1])}`, { timeout: 10, raw: true }); + res.writeHead(200, { + "Content-Type": r.headers.get("content-type") || "application/octet-stream", + "Content-Length": r.body.length, + }); + return res.end(r.body); + } + + if (p === "/api/avatar" && method === "POST") { + const account = session.sessAccount(cookies); + if (!account) throw Object.assign(new Error("未登录"), { status: 401 }); + if (!config.CONTROLPLANE_URL) throw Object.assign(new Error("统一后端未配置(CONTROLPLANE_URL)"), { status: 503 }); + const raw = await readRawBody(req); + if (raw.length === 0) throw Object.assign(new Error("头像文件为空"), { status: 400 }); + const r = await cp.request("POST", `/api/admin/avatar?account=${encodeURIComponent(account)}`, { + headers: { ...session.cpHeaders(cookies), "Content-Type": req.headers["content-type"] || "multipart/form-data" }, + body: raw, + timeout: 30, + }); + return sendJson(res, 200, r); + } + + // ---------- 钉钉 ---------- + if (p === "/api/admin/dingtalk/login" && method === "POST") { + const body = await readJsonBody(req); + const r = await dingtalkEstablish(String(body.account || "").trim(), body.nickname || "", body.dingtalk_uid || "", res); + return sendJson(res, 200, r); + } + + if (p === "/api/admin/dingtalk/inline" && method === "POST") { + const body = await readJsonBody(req); + if (!String(body.code || "").trim()) throw Object.assign(new Error("缺少扫码截图码"), { status: 400 }); + if (!config.CONTROLPLANE_URL) throw Object.assign(new Error("未配置中心机地址,无法扫码登录"), { status: 503 }); + const info = await cp.request("POST", "/api/admin/dingtalk/sns", { + headers: { ...cp.machineHeaders(), "Content-Type": "application/json" }, + json: { code: String(body.code).trim() }, + timeout: 15, + }); + const account = String(info.account || "").trim(); + if (!account) throw Object.assign(new Error("扫码未解析到有效账号,请重新扫码"), { status: 401 }); + const r = await dingtalkEstablish(account, info.nickname || "", info.unionid || "", res); + return sendJson(res, 200, r); + } + + if (p === "/api/admin/dingtalk/inline_qr" && method === "GET") { + if (!config.CONTROLPLANE_URL) throw Object.assign(new Error("未配置中心机地址,无法扫码登录"), { status: 503 }); + const back = `http://${url.host}/api/admin/dingtalk/cb`; + const r = await cp.request("GET", "/api/admin/dingtalk/inline_qr", { + headers: cp.machineHeaders(), + params: { back }, + timeout: 15, + }); + return sendJson(res, 200, r); + } + + if (p === "/api/auth/dingtalk" && method === "GET") { + if (!config.CONTROLPLANE_URL) throw Object.assign(new Error("未配置中心机地址(CONTROLPLANE_URL)"), { status: 503 }); + const stateParam = loginStateNew(); + const redirectUri = `http://localhost:${config.PORT}/auth/done`; + const r = await cp.request("GET", "/api/dingtalk/login-url", { + headers: cp.machineHeaders(), + params: { back: redirectUri, state: stateParam }, + timeout: 15, + }); + return sendJson(res, 200, { url: r.url || "", state: stateParam }); + } + + if (p === "/auth/done" && method === "GET") { + const code = url.searchParams.get("code") || ""; + const stateParam = url.searchParams.get("state") || ""; + const error = url.searchParams.get("error") || ""; + if (error) return sendHtml(res, 200, authDonePage("钉钉登录被取消或失败,请返回重试。")); + if (!(code && stateParam) || !loginStateTake(stateParam)) { + return sendHtml(res, 200, authDonePage("登录状态无效或已过期,请返回重新扫码。")); + } + let info; + try { + info = await cp.request("POST", "/auth/exchange", { json: { code }, timeout: 15 }); + } catch (e) { + return sendHtml(res, 200, authDonePage(`登录失败:${e.message}`)); + } + const account = String(info.account || "").trim(); + if (!account || !info.exists) return sendHtml(res, 200, authDonePage("账号未开通或未解析到有效工号,请联系管理员。")); + const token = session.establishSession(account, info.token || ""); + setSessionCookie(res, token); + if (config.CONTROLPLANE_URL) { + try { + await licensing.syncLicensing(account); + } catch (e) { + logger.warning(`登录后同步离线授权票据失败:${e.message}`); + } + } + res.writeHead(302, { Location: "/" }); + return res.end(); + } + + if (p === "/api/admin/dingtalk/qr" && method === "GET") { + if (!config.CONTROLPLANE_URL) return sendJson(res, 200, { url: "" }); + const back = `http://${url.host}/api/admin/dingtalk/cb`; + return sendJson(res, 200, { + url: `${config.CONTROLPLANE_URL}/api/admin/dingtalk/scan?${encodeURIComponent("back")}=${encodeURIComponent(back)}`, + }); + } + + if (p === "/api/admin/dingtalk/cb" && method === "GET") { + return sendHtml(res, 200, DINGTALK_CB_HTML); + } + + // ---------- 元数据 / 插件同步 ---------- + if (p === "/api/meta" && method === "GET") { + const account = session.sessAccount(cookies); + const data = await meta.buildMeta(account); + return sendJson(res, 200, data); + } + + if (p === "/api/plugins/sync" && method === "POST") { + const account = session.requireLogin(cookies); + const result = await pluginSync.withSyncLock(async () => { + const r = await pluginSync.syncPlugins(account); + const manifest = await pluginSync.cloudPluginManifest(account); + if (manifest !== null) state.setAllowed(new Set(manifest.map((pl) => pl.id))); + return r; + }); + try { + await licensing.syncLicensing(account); + } catch (e) { + logger.warning(`同步后刷新授权票据失败:${e.message}`); + } + return sendJson(res, 200, result); + } + + // ---------- 插件回滚(升级前自动备份上一版,坏包可回退) ---------- + if (p === "/api/plugins/rollback" && method === "GET") { + session.requireLogin(cookies); + return sendJson(res, 200, { items: pluginSync.rollbackIndex() }); + } + const rollbackMatch = p.match(/^\/api\/plugins\/rollback\/([^/]+)$/); + if (rollbackMatch && method === "POST") { + session.requireLogin(cookies); + const pluginId = decodeURIComponent(rollbackMatch[1]); + if (scheduler.isBusy()) { + throw Object.assign(new Error("设备正在执行任务,请结束后再回滚"), { status: 409 }); + } + const done = pluginSync.rollbackPlugin(pluginId); + return sendJson(res, 200, { ok: true, rollback: done }); + } + + // ---------- 壳子更新 ---------- + if (p === "/api/shell/update-status" && method === "GET") { + session.requireLogin(cookies); + return sendJson(res, 200, shellUpdater.pendingStatus()); + } + if (p === "/api/shell/check" && method === "POST") { + session.requireLogin(cookies); + shellUpdater.startCheck(); + return sendJson(res, 200, { ok: true, checking: true }); + } + if (p === "/api/shell/download" && method === "POST") { + session.requireLogin(cookies); + shellUpdater.startDownload(); + return sendJson(res, 200, { ok: true }); + } + if (p === "/api/shell/apply" && method === "POST") { + session.requireLogin(cookies); + shellUpdater.applyUpdate(); + return sendJson(res, 200, { ok: true }); + } + + // ---------- Chrome ---------- + if (p === "/api/chrome/status" && method === "GET") { + session.requireLogin(cookies); + return sendJson(res, 200, await chromeManager.status()); + } + if (p === "/api/chrome/check" && method === "POST") { + session.requireLogin(cookies); + await chromeManager.refresh(); + return sendJson(res, 200, { ok: true }); + } + if (p === "/api/chrome/download" && method === "POST") { + session.requireLogin(cookies); + chromeManager.startDownload(); + return sendJson(res, 200, { ok: true }); + } + if (p === "/api/chrome/install" && method === "POST") { + session.requireLogin(cookies); + return sendJson(res, 200, chromeManager.install()); + } + + // ---------- 环境包(便携 Python 运行时) ---------- + if (p === "/api/env/status" && method === "GET") { + session.requireLogin(cookies); + return sendJson(res, 200, envSync.status()); + } + if (p === "/api/env/sync" && method === "POST") { + session.requireLogin(cookies); + const r = await envSync.checkAndSync(true); + return sendJson(res, 200, { ok: r.ok, reason: r.reason || "", version: r.version || "" }); + } + if (p === "/api/env/rollback" && method === "POST") { + session.requireLogin(cookies); + return sendJson(res, 200, envSync.rollback()); + } + + // ---------- 平台登录(按账号隔离会话与账号密码) ---------- + // 当前账号的平台状态:在线态 + 是否已配置个人 HR/OA 账号密码 + 已存用户名 + if (p === "/api/platforms/status" && method === "GET") { + const account = session.requireLogin(cookies); + return sendJson(res, 200, { platforms: await platformAuth.status(account) }); + } + + // 保存当前账号的 HR/OA 账号密码(本机加密);pass 留空表示保留原密码 + if (p === "/api/platforms/creds" && method === "PUT") { + const account = session.requireLogin(cookies); + const body = await readJsonBody(req); + const updated = []; + for (const pid of ["hr", "oa"]) { + if (body && body[pid] && (body[pid].user !== undefined || body[pid].pass !== undefined)) { + platformCreds.upsert(account, pid, body[pid]); + updated.push(pid); + } + } + logger.info(`账号 ${account} 更新平台账号密码:${updated.join(",") || "无"}`); + return sendJson(res, 200, { ok: true, updated }); + } + + const platLogin = p.match(/^\/api\/platforms\/([^/]+)\/(login|logout)$/); + if (platLogin && method === "POST") { + const account = session.requireLogin(cookies); + const pid = platLogin[1]; + const action = platLogin[2]; + if (!state.PLATFORMS[pid]) throw Object.assign(new Error("平台不存在"), { status: 404 }); + if (action === "logout") { + return sendJson(res, 200, platformAuth.logout(pid, account)); + } + // login:授权票据有效 + 平台白名单 + const lic = await licensing.ensureLicense(account); + if (!lic.ok) throw Object.assign(new Error("授权已过期(最长离线 7 天),请联网刷新后重试"), { status: 403 }); + const allowed = await meta.accountAllowedPlatforms(account); + if (allowed === null) throw Object.assign(new Error("控制面不可达,无法校验平台权限"), { status: 503 }); + if (!allowed.has(pid)) throw Object.assign(new Error("无该平台访问权限,请联系管理员在控制面授权"), { status: 403 }); + const r = await platformAuth.login(pid, account); + return sendJson(res, 200, r); + } + + // ---------- 运行 ---------- + if (p === "/api/runs" && method === "POST") { + const account = session.requireLogin(cookies); + const body = await readJsonBody(req); + let plugin; + try { + plugin = registry.find(body.plugin_id); + } catch (e) { + throw Object.assign(new Error("插件不存在"), { status: 404 }); + } + const online = licensing.isOnline(); + const deny = await licensing.runCheckAllowed(plugin.id, account, online); + if (deny) { + logger.info(`插件 ${plugin.id} 启动被拒(账号 ${account}):${deny}`); + throw Object.assign(new Error(deny), { status: 403 }); + } + // 记住本次参数(不含 password 字段),供执行台「恢复上次参数」 + lastFields.remember(account, plugin.id, body.fields || {}, plugin.fields); + const runId = runner.submitRun(account, plugin, body.fields || {}, { trigger: "manual" }); + return sendJson(res, 202, { run_id: runId }); + } + + // 运行历史列表(当前账号,新的在前):右轨「最近运行」与执行台「已完成」态的数据源 + if (p === "/api/runs" && method === "GET") { + const account = session.requireLogin(cookies); + const limit = url.searchParams.get("limit") || 20; + return sendJson(res, 200, { runs: runHistory.list(account, limit) }); + } + + const runMatch = p.match(/^\/api\/runs\/([^/]+)(\/stop)?$/); + if (runMatch && method === "GET") { + const account = session.requireLogin(cookies); + const run = state.RUNS.get(runMatch[1]); + if (run && run.account === account) return sendJson(res, 200, run); + // 内存态已淘汰(壳子重启 / 超过 MAX_RUNS)时回落到持久化历史,保证「点击回放」仍可用 + const hist = runHistory.get(runMatch[1], account); + if (!hist) throw Object.assign(new Error("运行不存在"), { status: 404 }); + return sendJson(res, 200, hist); + } + if (runMatch && runMatch[2] && method === "POST") { + const account = session.requireLogin(cookies); + const run = state.RUNS.get(runMatch[1]); + if (!run || run.account !== account) throw Object.assign(new Error("运行不存在"), { status: 404 }); + if (run.status !== "running") throw Object.assign(new Error("运行已结束,无需停止"), { status: 409 }); + if (!runner.terminateRun(runMatch[1])) { + throw Object.assign(new Error("任务尚未真正启动(排队中或刚结束),请稍候再试"), { status: 409 }); + } + return sendJson(res, 200, { ok: true }); + } + + // ---------- 定时任务 ---------- + if (p === "/api/schedules" && method === "GET") { + const account = session.requireLogin(cookies); + return sendJson(res, 200, { schedules: tasks.listSchedules(account) }); + } + if (p === "/api/schedules" && method === "POST") { + const account = session.requireLogin(cookies); + const body = await readJsonBody(req); + if (!body.plugin_id) throw Object.assign(new Error("请选择插件"), { status: 400 }); + try { + registry.find(body.plugin_id); + } catch (e) { + throw Object.assign(new Error("插件不存在"), { status: 404 }); + } + let rec; + try { + rec = tasks.createSchedule(account, body); + } catch (e) { + throw Object.assign(new Error(`cron 表达式无效:${e.message}`), { status: 400 }); + } + tasks.pushBackup(account, session.cpHeaders(cookies)); + return sendJson(res, 201, rec); + } + + const schedMatch = p.match(/^\/api\/schedules\/([^/]+)(\/toggle)?$/); + if (schedMatch && method === "PUT") { + const account = session.requireLogin(cookies); + findOwned(schedMatch[1], account); + const body = await readJsonBody(req); + if (body.plugin_id) { + try { + registry.find(body.plugin_id); + } catch (e) { + throw Object.assign(new Error("插件不存在"), { status: 404 }); + } + } + let rec; + try { + rec = tasks.updateSchedule(schedMatch[1], body); + } catch (e) { + throw Object.assign(new Error(`cron 表达式无效:${e.message}`), { status: 400 }); + } + if (!rec) throw Object.assign(new Error("任务不存在"), { status: 404 }); + tasks.pushBackup(account, session.cpHeaders(cookies)); + return sendJson(res, 200, rec); + } + if (schedMatch && !schedMatch[2] && method === "DELETE") { + const account = session.requireLogin(cookies); + findOwned(schedMatch[1], account); + if (!tasks.deleteSchedule(schedMatch[1])) throw Object.assign(new Error("任务不存在"), { status: 404 }); + tasks.pushBackup(account, session.cpHeaders(cookies)); + return sendJson(res, 200, { ok: true }); + } + if (schedMatch && schedMatch[2] && method === "POST") { + const account = session.requireLogin(cookies); + findOwned(schedMatch[1], account); + const body = await readJsonBody(req); + const rec = tasks.toggleSchedule(schedMatch[1], !!body.enabled); + if (!rec) throw Object.assign(new Error("任务不存在"), { status: 404 }); + tasks.pushBackup(account, session.cpHeaders(cookies)); + return sendJson(res, 200, rec); + } + + // ---------- 插件配置 / UI ---------- + const cfgMatch = p.match(/^\/api\/plugin-config\/([^/]+)$/); + if (cfgMatch && method === "GET") { + session.requireLogin(cookies); + checkUiAllowed(cfgMatch[1]); + const data = readPluginConfig(cfgMatch[1]); + return sendJson(res, 200, data); + } + if (cfgMatch && method === "POST") { + session.requireLogin(cookies); + checkUiAllowed(cfgMatch[1]); + const data = await readJsonBody(req); + if (!data || typeof data !== "object" || Array.isArray(data)) { + throw Object.assign(new Error("配置体必须是 JSON 对象"), { status: 400 }); + } + savePluginConfig(cfgMatch[1], data); + return sendJson(res, 200, { ok: true }); + } + + // 上次执行参数(执行台「恢复上次参数」):只含非敏感项,password 字段不落盘 + const lastFieldsMatch = p.match(/^\/api\/plugins\/([^/]+)\/last-fields$/); + if (lastFieldsMatch && method === "GET") { + const account = session.requireLogin(cookies); + checkUiAllowed(lastFieldsMatch[1]); + const rec = lastFields.recall(account, lastFieldsMatch[1]); + return sendJson(res, 200, { fields: rec.fields, at: rec.at }); + } + + // ---------- 场景配置方案(多配置,SQLite 存储)---------- + if (p === "/api/plugin-configs" && method === "GET") { + const account = session.requireLogin(cookies); + const pluginId = url.searchParams.get("plugin_id") || ""; + if (!pluginId) throw Object.assign(new Error("缺少 plugin_id"), { status: 400 }); + checkUiAllowed(pluginId); + return sendJson(res, 200, { configs: pluginConfigs.listConfigs(account, pluginId) }); + } + if (p === "/api/plugin-configs" && method === "POST") { + const account = session.requireLogin(cookies); + const body = await readJsonBody(req); + if (!body.plugin_id) throw Object.assign(new Error("缺少 plugin_id"), { status: 400 }); + checkUiAllowed(body.plugin_id); + const plugin = registry.find(body.plugin_id); + const cfg = pluginConfigs.saveConfig(account, body.plugin_id, body.name, body.fields, plugin.fields); + if (!cfg) throw Object.assign(new Error("配置名称不能为空"), { status: 400 }); + return sendJson(res, 200, { ok: true, config: cfg }); + } + const cfgDelMatch = p.match(/^\/api\/plugin-configs\/([^/]+)\/([^/]+)$/); + if (cfgDelMatch && method === "DELETE") { + const account = session.requireLogin(cookies); + const pluginId = decodeURIComponent(cfgDelMatch[1]); + const cfgId = decodeURIComponent(cfgDelMatch[2]); + checkUiAllowed(pluginId); + const ok = pluginConfigs.deleteConfig(account, pluginId, cfgId); + if (!ok) throw Object.assign(new Error("配置不存在"), { status: 404 }); + return sendJson(res, 200, { ok: true }); + } + + const puiMatch = p.match(/^\/pui\/([^/]+)(\/.*)?$/); + if (puiMatch && method === "GET") { + session.requireLogin(cookies); + checkUiAllowed(puiMatch[1]); + return servePluginUi(res, puiMatch[1], puiMatch[2] || ""); + } + + sendJson(res, 404, { detail: "Not Found" }); +} + +function findOwned(sid, account) { + const s = tasks.getSchedule(sid); + if (!s) throw Object.assign(new Error("任务不存在"), { status: 404 }); + if (s.account !== account) throw Object.assign(new Error("仅创建者可管理该任务"), { status: 403 }); +} + +function checkUiAllowed(pluginId) { + try { + registry.find(pluginId); + } catch (e) { + throw Object.assign(new Error("插件不存在"), { status: 404 }); + } + if (state.ALLOWED !== null && !state.ALLOWED.has(pluginId)) { + throw Object.assign(new Error("插件不存在"), { status: 404 }); + } +} + +function readPluginConfig(pluginId) { + const p = path.join(config.PLUGIN_CONFIG_DIR, `${pluginId}.json`); + if (!fs.existsSync(p)) return {}; + try { + const data = JSON.parse(fs.readFileSync(p, "utf-8")); + return data && typeof data === "object" && !Array.isArray(data) ? data : {}; + } catch (e) { + return {}; + } +} + +function savePluginConfig(pluginId, data) { + const p = path.join(config.PLUGIN_CONFIG_DIR, `${pluginId}.json`); + try { + fs.mkdirSync(config.PLUGIN_CONFIG_DIR, { recursive: true }); + const tmp = p + ".tmp"; + fs.writeFileSync(tmp, JSON.stringify(data, null, 2), "utf-8"); + fs.renameSync(tmp, p); // 原子替换 + } catch (e) { + logger.warning(`插件 ${pluginId} 配置保存失败:${e.message}`); + throw Object.assign(new Error("配置保存失败"), { status: 500 }); + } +} + +function servePluginUi(res, pluginId, rel) { + const uiRoot = path.resolve(path.join(registry.pluginRoot(), pluginId, "ui")); + if (!fs.existsSync(uiRoot) || !fs.statSync(uiRoot).isDirectory()) { + throw Object.assign(new Error("该插件未提供前端界面"), { status: 404 }); + } + let target; + if (!rel.trim()) target = path.join(uiRoot, "index.html"); + else target = path.resolve(path.join(uiRoot, rel)); + if (!target.startsWith(uiRoot + path.sep) && target !== uiRoot) { + throw Object.assign(new Error("not found"), { status: 404 }); + } + if (fs.existsSync(target) && fs.statSync(target).isDirectory()) target = path.join(target, "index.html"); + if (!fs.existsSync(target) || !fs.statSync(target).isFile()) { + const fallback = path.join(uiRoot, "index.html"); + if (!fs.existsSync(fallback)) throw Object.assign(new Error("not found"), { status: 404 }); + target = fallback; + } + const mediaType = MIME[path.extname(target).toLowerCase()] || "application/octet-stream"; + const cache = path.basename(target) === "index.html" ? "no-cache" : "public, max-age=86400"; + const body = fs.readFileSync(target); + // 插件 UI 内容安全策略:仅允许同源资源(内网离线部署),阻断外联脚本/图片/跳转外域 + const CSP = + "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; " + + "img-src 'self' data:; font-src 'self' data:; connect-src 'self'; base-uri 'none'; form-action 'self'"; + res.writeHead(200, { + "Content-Type": mediaType, + "Cache-Control": cache, + "Content-Length": body.length, + "Content-Security-Policy": CSP, + }); + res.end(body); +} + +function serveStatic(res, url) { + const dist = config.frontendDist(); + let rel = url.pathname === "/" ? "index.html" : url.pathname.slice(1); + let target = path.resolve(path.join(dist, rel)); + if (!target.startsWith(dist + path.sep) && target !== dist) { + return sendJson(res, 404, { detail: "Not Found" }); + } + if (fs.existsSync(target) && fs.statSync(target).isDirectory()) target = path.join(target, "index.html"); + if (!fs.existsSync(target) || !fs.statSync(target).isFile()) { + // SPA 兜底:回 index.html(history 路由) + target = path.join(dist, "index.html"); + if (!fs.existsSync(target)) return sendJson(res, 404, { detail: "Not Found" }); + } + const mediaType = MIME[path.extname(target).toLowerCase()] || "application/octet-stream"; + const body = fs.readFileSync(target); + res.writeHead(200, { "Content-Type": mediaType, "Content-Length": body.length }); + res.end(body); +} + +function escapeHtml(s) { + return String(s === undefined || s === null ? "" : s) + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); +} + +function authDonePage(text) { + return `登录 + +

${escapeHtml(text)}

返回

`; +} + +const DINGTALK_CB_HTML = `登录中 + +
钉钉登录中,请稍候…
+`; + +// ==================== 登录后异步同步(不阻断登录响应) ==================== +function afterLogin(account) { + if (!config.CONTROLPLANE_URL) return; + void licensing + .syncLicensing(account) + .catch((e) => logger.warning(`登录后同步离线授权票据失败:${e.message}`)); + void pluginSync + .withSyncLock(async () => { + await pluginSync.syncPlugins(account); + const manifest = await pluginSync.cloudPluginManifest(account); + if (manifest !== null) state.setAllowed(new Set(manifest.map((pl) => pl.id))); + }) + .catch((e) => logger.warning(`登录后插件同步失败:${e.message}`)); + void require("./creds-sync") + .load(account) + .then((creds) => { + if (creds && Object.keys(creds).length) config.applyCreds(creds); + }) + .catch(() => {}); +} + +// ==================== 服务器启动 ==================== +function createServer() { + const server = http.createServer(async (req, res) => { + const url = new URL(req.url, `http://${req.headers.host || `127.0.0.1:${config.PORT}`}`); + logger.debug(`${req.method} ${url.pathname}`); // 请求级调试日志(DEBUG 模式) + try { + await route(req, res, url); + } catch (e) { + handleError(res, e); + } + }); + + // WS /ws:握手需有效统一账户会话 + const wss = new WebSocketServer({ noServer: true }); + server.on("upgrade", (req, socket, head) => { + const url = new URL(req.url, `http://127.0.0.1:${config.PORT}`); + if (url.pathname !== "/ws") { + socket.destroy(); + return; + } + const cookies = parseCookies(req); + if (!session.sessAccount(cookies)) { + socket.write("HTTP/1.1 401 Unauthorized\r\n\r\n"); + socket.destroy(); + return; + } + wss.handleUpgrade(req, socket, head, (ws) => { + wss.emit("connection", ws, req); + }); + }); + wss.on("connection", (ws) => { + // 心跳标记:30s ping 一次,连续一个周期无 pong 视为僵尸连接 terminate(浏览器会自动回 pong) + ws.isAlive = true; + ws.on("pong", () => { + ws.isAlive = true; + }); + HUB.addClient(ws); + }); + // 心跳巡检:防 WS 连接泄漏(页面刷新残留/半开连接) + const heartbeat = setInterval(() => { + for (const ws of wss.clients) { + if (!ws.isAlive) { + ws.terminate(); + continue; + } + ws.isAlive = false; + try { + ws.ping(); + } catch (e) { + ws.terminate(); + } + } + }, 30 * 1000); + if (heartbeat.unref) heartbeat.unref(); // 不阻碍进程退出 + server.on("close", () => clearInterval(heartbeat)); + + return server; +} + +function listen(cb) { + const server = createServer(); + server.listen(config.PORT, "127.0.0.1", () => { + logger.info(`本地服务已启动:http://127.0.0.1:${config.PORT}`); + if (cb) cb(server); + }); + server.on("error", (e) => { + if (e.code === "EADDRINUSE") { + logger.error(`端口 ${config.PORT} 已被占用(旧实例?),请先停止旧底座`); + } else { + logger.error(`本地服务启动失败:${e.message}`); + } + process.exit(1); + }); + return server; +} + +module.exports = { createServer, listen, parseCookies }; diff --git a/desktop/electron-shell/electron/session.js b/desktop/electron-shell/electron/session.js new file mode 100644 index 0000000..76378ea --- /dev/null +++ b/desktop/electron-shell/electron/session.js @@ -0,0 +1,148 @@ +// 统一账户会话:cookie 会话唯一真源 + 本机会话落盘持久化 + 云端 token 缓存。 +// 对齐 Python webhost session.py:cp_session cookie、7 天滑动续期、重启恢复。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const crypto = require("crypto"); +const config = require("./config"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("session"); + +const SESSION_COOKIE = "cp_session"; +const SESS_TTL = 7 * 24 * 3600 * 1000; // ms + +const _SESS = new Map(); // token -> { account, ts } +// account -> 最近云端会话 token(7 天,供 /api/plugins 等用 Bearer) +const _ACCT_CLOUD_TOKEN = new Map(); + +const SESS_FILE = path.join(config.SHELL_ROOT, "_cp_sessions.json"); + +function persist() { + const payload = {}; + for (const [token, item] of _SESS) { + payload[token] = [item.account, Math.floor(item.ts / 1000), _ACCT_CLOUD_TOKEN.get(item.account) || ""]; + } + try { + fs.writeFileSync(SESS_FILE, JSON.stringify(payload), "utf-8"); + } catch (e) { + logger.warning(`本机会话持久化失败: ${e.message}`); + } +} + +function load() { + if (!fs.existsSync(SESS_FILE)) return; + try { + const raw = JSON.parse(fs.readFileSync(SESS_FILE, "utf-8")); + const now = Date.now(); + for (const [token, item] of Object.entries(raw || {})) { + try { + const [acct, ts, cloudTok] = item; + const t = parseFloat(ts) * 1000; + if (now - t <= SESS_TTL) { + _SESS.set(token, { account: acct, ts: t }); + if (cloudTok) _ACCT_CLOUD_TOKEN.set(acct, cloudTok); + } + } catch (e) { + /* 跳过坏条目 */ + } + } + } catch (e) { + /* 损坏则忽略 */ + } +} + +// cookies: {name: value};返回当前登录账号(滑动续期) +function sessAccount(cookies) { + const token = (cookies || {})[SESSION_COOKIE] || ""; + if (!token) return ""; + const item = _SESS.get(token); + if (!item) return ""; + const now = Date.now(); + if (now - item.ts > SESS_TTL) { + _SESS.delete(token); + return ""; + } + item.ts = now; // 滑动续期 + persist(); + return item.account; +} + +function requireLogin(cookies) { + const account = sessAccount(cookies); + if (!account) { + const err = new Error("未登录:请先登录统一账户"); + err.status = 401; + throw err; + } + return account; +} + +// 建立会话(登录成功):写入内存 + 落盘 + 返回新 token(调用方 set-cookie) +function establishSession(account, cloudToken) { + const token = crypto.randomBytes(16).toString("hex"); + _SESS.set(token, { account, ts: Date.now() }); + if (cloudToken) _ACCT_CLOUD_TOKEN.set(account, cloudToken); + persist(); + return token; +} + +function clearSession(token) { + if (token) _SESS.delete(token); + persist(); +} + +function sessActiveAccount() { + let best = ""; + let bestTs = 0; + for (const item of _SESS.values()) { + if (item.ts > bestTs) { + bestTs = item.ts; + best = item.account; + } + } + return best; +} + +function accountSet() { + return new Set([..._SESS.values()].map((i) => i.account)); +} + +function cloudToken(account) { + return _ACCT_CLOUD_TOKEN.get(account) || ""; +} + +// 到中心机调用头:Bearer 云令牌优先 + X-Admin-User 兜底 + X-API-Token +function cpHeaders(cookies) { + const h = {}; + const account = sessAccount(cookies); + if (account) { + const tok = cloudToken(account); + if (tok) h["Authorization"] = `Bearer ${tok}`; + h["X-Admin-User"] = account; + } + if (config.CONTROLPLANE_TOKEN) h["X-API-Token"] = config.CONTROLPLANE_TOKEN; + return h; +} + +// 启动恢复 +load(); + +module.exports = { + SESSION_COOKIE, + SESS_FILE, + sessAccount, + requireLogin, + establishSession, + clearSession, + sessActiveAccount, + accountSet, + cloudToken, + setCloudToken: (account, tok) => { + if (tok) _ACCT_CLOUD_TOKEN.set(account, tok); + else _ACCT_CLOUD_TOKEN.delete(account); + persist(); + }, + cpHeaders, +}; diff --git a/desktop/electron-shell/electron/shell-updater.js b/desktop/electron-shell/electron/shell-updater.js new file mode 100644 index 0000000..c45616d --- /dev/null +++ b/desktop/electron-shell/electron/shell-updater.js @@ -0,0 +1,313 @@ +// 壳子(主程序)自动更新:检查 → 用户确认下载(带进度)→ 点击重启升级。 +// 对齐 Python shell_updater.py 的状态结构与并发控制。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const { spawn } = require("child_process"); +const cp = require("./cpclient"); +const config = require("./config"); +const { versionLt, sha256Hex } = require("./crypto"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("shell-updater"); + +const SHELL_CACHE = path.join(config.APP_DATA, "shell"); +const PERIODIC_INTERVAL = 30 * 60 * 1000; + +let _checking = false; +let _downloading = false; +let _pendingVersion = ""; +let _pendingNotes = ""; + +const _STATE = { + checking: false, + check_at: 0, + latest: "", + notes: "", + available: false, + check_error: "", + dl_version: "", + dl_status: "idle", // idle | downloading | downloaded | failed + dl_received: 0, + dl_total: 0, + dl_pct: 0, + dl_error: "", + applying: false, +}; + +function shellVersionFile() { + // 打包运行:exe 同级 shell.version + if (process.env.ELECTRON_RUN_AS_NODE) return null; + if (process.resourcesPath) return path.join(path.dirname(process.execPath), "shell.version"); + return null; +} + +function localShellVersion() { + const vf = shellVersionFile(); + if (!vf) return ""; // 源码/CLI 开发模式:不参与自更新 + try { + return fs.existsSync(vf) ? fs.readFileSync(vf, "utf-8").trim() : ""; + } catch (e) { + return ""; + } +} + +async function fetchCloudVersion() { + if (!localShellVersion() || !config.CONTROLPLANE_URL) { + _STATE.check_error = !localShellVersion() ? "源码开发模式,不参与自更新" : "未配置中心机地址"; + return null; + } + try { + const r = await cp.request("GET", "/api/shell/version", { headers: cp.machineHeaders(), timeout: 5 }); + return r; + } catch (e) { + logger.info(`检查壳子更新失败(离线跳过):${e.message}`); + _STATE.check_error = `控制面不可达(${e.constructor.name})`; + return null; + } +} + +function cachedPkg(version) { + const p = path.join(SHELL_CACHE, `setup-37du-host-${version}.exe`); + return fs.existsSync(p) ? p : null; +} + +function restorePending(cloud, notes) { + _pendingVersion = cloud; + _pendingNotes = notes; + _STATE.dl_version = cloud; + _STATE.dl_status = "downloaded"; + _STATE.dl_pct = 100; + logger.info(`壳子新版本 ${cloud} 已在缓存中,等待用户重启更新`); +} + +async function checkUpdate() { + if (_checking) return; + _checking = true; + try { + _STATE.checking = true; + const cur = localShellVersion(); + const info = await fetchCloudVersion(); + _STATE.check_at = Date.now(); + if (!cur) { + _STATE.latest = ""; + _STATE.notes = ""; + _STATE.available = false; + return; + } + if (!info) { + _STATE.available = false; + return; + } + const cloud = String(info.version || ""); + const notes = String(info.notes || ""); + _STATE.latest = cloud; + _STATE.notes = notes; + _STATE.check_error = ""; + if (!cloud || !versionLt(cur, cloud)) { + _STATE.available = false; + return; + } + _STATE.available = true; + if (cachedPkg(cloud)) restorePending(cloud, notes); + } finally { + _STATE.checking = false; + _checking = false; + } +} + +function startCheck() { + void checkUpdate(); +} + +function startPeriodicCheck() { + setInterval(() => { + try { + void checkUpdate(); + } catch (e) { + logger.warning(`周期检查壳子更新失败:${e.message}`); + } + }, PERIODIC_INTERVAL); +} + +async function startDownload() { + const cur = localShellVersion(); + if (!cur) return; + if (_STATE.dl_status === "downloading") return; + if (_STATE.dl_status === "downloaded" && _pendingVersion) return; + const info = await fetchCloudVersion(); + if (!info) return; + const cloud = String(info.version || ""); + if (!cloud || !versionLt(cur, cloud)) return; + if (cachedPkg(cloud)) { + restorePending(cloud, String(info.notes || "")); + return; + } + if (_downloading) return; + _downloading = true; + _STATE.dl_version = cloud; + _STATE.dl_status = "downloading"; + _STATE.dl_received = 0; + _STATE.dl_total = 0; + _STATE.dl_pct = 0; + _STATE.dl_error = ""; + try { + await download(cloud, info); + } catch (e) { + logger.warning(`下载壳子安装包失败:${e.message}`); + _STATE.dl_status = "failed"; + _STATE.dl_error = `安装包下载失败(${e.constructor.name})`; + cleanupPart(cloud); + } finally { + _downloading = false; + } + logger.info(`开始下载壳子新版本 ${cloud}`); +} + +async function download(cloud, info) { + const innerUrl = String(info.url || "").trim(); + const tmp = path.join(SHELL_CACHE, `setup-37du-host-${cloud}.exe.part`); + const pkg = path.join(SHELL_CACHE, `setup-37du-host-${cloud}.exe`); + const expect = String(info.sha256 || "").toLowerCase(); + fs.mkdirSync(SHELL_CACHE, { recursive: true }); + const out = fs.createWriteStream(tmp); + const crypto = require("crypto"); + const sha = crypto.createHash("sha256"); + let received = 0; + let total = 0; + if (innerUrl) { + await downloadFromUrl(innerUrl, {}, out, sha, (rcv, tot) => { + received = rcv; + total = tot; + _STATE.dl_received = received; + _STATE.dl_total = total; + _STATE.dl_pct = total ? Math.floor((received * 100) / total) : 0; + }); + } else { + const r = await cp.streamDownload("/api/shell/pkg", { + headers: cp.machineHeaders(), + timeout: 600, + onData: (chunk) => { + out.write(chunk); + sha.update(chunk); + }, + onProgress: (rcv, tot) => { + received = rcv; + total = tot; + _STATE.dl_received = received; + _STATE.dl_total = total; + _STATE.dl_pct = total ? Math.floor((received * 100) / total) : 0; + }, + }); + received = r.received; + total = r.contentLength; + } + await new Promise((res, rej) => out.end((e) => (e ? rej(e) : res()))); + const digest = sha.digest("hex"); + if (expect && digest !== expect) { + logger.error(`壳子安装包 sha256 校验失败,放弃更新`); + _STATE.dl_status = "failed"; + _STATE.dl_error = "安装包校验失败,请重试"; + cleanupPart(cloud); + return; + } + try { + fs.renameSync(tmp, pkg); + } catch (e) { + _STATE.dl_status = "failed"; + _STATE.dl_error = "安装包保存失败"; + cleanupPart(cloud); + return; + } + _STATE.dl_status = "downloaded"; + _STATE.dl_pct = 100; + _STATE.dl_received = received; + _STATE.dl_total = total; + restorePending(cloud, String(info.notes || "")); +} + +async function downloadFromUrl(url, headers, out, sha, onProgress) { + const ctrl = new AbortController(); + const timer = setTimeout(() => ctrl.abort(), 600 * 1000); + const res = await fetch(url, { headers, signal: ctrl.signal, redirect: "follow" }); + if (!res.ok) throw new Error(`HTTP ${res.status}`); + const total = parseInt(res.headers.get("content-length") || "0", 10); + let received = 0; + const reader = res.body.getReader(); + for (;;) { + const { done, value } = await reader.read(); + if (done) break; + out.write(value); + sha.update(value); + received += value.length; + onProgress(received, total); + } + clearTimeout(timer); +} + +function cleanupPart(cloud) { + try { + fs.unlinkSync(path.join(SHELL_CACHE, `setup-37du-host-${cloud}.exe.part`)); + } catch (e) { + /* 忽略 */ + } +} + +function pendingStatus() { + let cur = localShellVersion(); + let downloaded = !!_pendingVersion && cachedPkg(_pendingVersion) !== null; + if (!downloaded) { + _pendingVersion = ""; + _pendingNotes = ""; + } + return { + current: cur, + new: downloaded ? _pendingVersion : "", + notes: downloaded ? _pendingNotes : "", + downloaded, + available: !!_STATE.available, + latest: _STATE.latest || "", + checked_at: _STATE.check_at || 0, + checking: !!_STATE.checking, + error: _STATE.check_error || "", + applying: !!_STATE.applying, + dl: { + version: _STATE.dl_version || "", + status: _STATE.dl_status || "idle", + received: _STATE.dl_received || 0, + total: _STATE.dl_total || 0, + pct: _STATE.dl_pct || 0, + error: _STATE.dl_error || "", + }, + }; +} + +function applyUpdate() { + const version = _pendingVersion; + const pkg = cachedPkg(version); + if (!pkg) throw new Error(`未找到已下载的安装包:setup-37du-host-${version}.exe`); + _STATE.applying = true; + logger.info(`开始静默升级到 ${version}:${pkg}`); + const child = spawn(pkg, ["/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART"], { + cwd: path.dirname(pkg), + windowsHide: true, + stdio: "ignore", + detached: true, + }); + child.unref(); + // 给安装器接管进程,随后退出 + setTimeout(() => { + if (typeof process.exit === "function") process.exit(0); + }, 1000); +} + +module.exports = { + startCheck, + startPeriodicCheck, + startDownload, + pendingStatus, + applyUpdate, + cachedPkg, + localShellVersion, +}; diff --git a/desktop/electron-shell/electron/state.js b/desktop/electron-shell/electron/state.js new file mode 100644 index 0000000..1ce7ad5 --- /dev/null +++ b/desktop/electron-shell/electron/state.js @@ -0,0 +1,55 @@ +// 运行时共享状态:可变全局唯一真源(对齐 Python webhost state.py)。 +"use strict"; + +const PLATFORMS = { + hr: { id: "hr", label: "HR 系统" }, + oa: { id: "oa", label: "OA 系统" }, +}; + +// 运行会话:run_id -> {status, account, plugin_id, name, version, trigger, schedule_id, started, result, error, logs} +const RUNS = new Map(); +const MAX_RUNS = 50; + +// 单次运行内存中累积的日志上限(结束后由 run-history 落盘,此处只服务"正在跑"的实时展示与回放) +const MAX_RUN_LOGS = 800; + +// 插件权限白名单(null = 全量;空集 = 零权限)。由登录/启动/同步决定。 +let ALLOWED = null; + +function setAllowed(v) { + ALLOWED = v === undefined ? null : v; +} + +function setRun(runId, fields) { + const run = RUNS.get(runId); + if (run) Object.assign(run, fields); +} + +function registerRun(runId, record) { + if (RUNS.size >= MAX_RUNS) { + const oldest = RUNS.keys().next().value; + RUNS.delete(oldest); + } + RUNS.set(runId, record); +} + +// 累积"这一次运行"的日志:日志是运行的属性,跟着运行走(不再是全局单例) +function appendRunLog(runId, entry) { + const run = RUNS.get(runId); + if (!run) return; + if (!Array.isArray(run.logs)) run.logs = []; + run.logs.push(entry); + if (run.logs.length > MAX_RUN_LOGS) run.logs.splice(0, run.logs.length - MAX_RUN_LOGS); +} + +module.exports = { + PLATFORMS, + RUNS, + MAX_RUNS, + MAX_RUN_LOGS, + ALLOWED, + setAllowed, + setRun, + registerRun, + appendRunLog, +}; diff --git a/desktop/electron-shell/electron/tasks.js b/desktop/electron-shell/electron/tasks.js new file mode 100644 index 0000000..c7aad13 --- /dev/null +++ b/desktop/electron-shell/electron/tasks.js @@ -0,0 +1,483 @@ +// 定时任务(壳子内置定时):5 段 cron 解析 + schedules.json 存储 + 中心机备份/恢复 + 后台触发。 +// 语义对齐 Python tasks.py(★ 契约:dom/dow OR 规则、0/7 周日归一、30s tick、last_run_at 记忆)。 +// 差异:错过不补跑——壳子停机/离线期间到点的任务直接跳过(时间过了就过了,要补就人工运行一次); +// 触发失败(授权被拒/插件缺失/启动异常)同样跳过本次到点,等下一个 cron 点再试,不每 tick 重试。 +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const config = require("./config"); +const cp = require("./cpclient"); +const session = require("./session"); +const { newId, nowStr, versionLt: _unused } = require("./crypto"); +const { HUB } = require("./hub"); +const { makeLogger } = require("./logger"); + +const logger = makeLogger("tasks"); + +const SCHED_FILE = path.join(config.APP_DATA, "schedules.json"); +const TICK_SECS = 30; +const DENY_LOG_CD = 300; +// 到点判定容差:nxt 落在 now 前该时长内仍算"及时到点"正常触发;超过则视为错过(停机/离线期间到点),跳过。 +// 正常 tick 每 30s 一轮,单轮最坏耗时(deny 检查 5s 超时 + 多任务串行)远小于 4×TICK。 +const CATCHUP_SKIP_MS = TICK_SECS * 4 * 1000; + +// 到点且未错过(供 tick 使用;独立成纯函数便于测试) +function isDueNow(nxt, now) { + if (!nxt) return false; + const lag = now.getTime() - nxt.getTime(); + return lag >= 0 && lag <= CATCHUP_SKIP_MS; +} + +// 最小触发间隔(分钟):同一小时内相邻命中点的最小间距。 +// 分钟字段集合内任意相邻命中点间隔 < 60 → 存在 < 1 小时的连续触发(每分钟/每 30 分钟等),禁止。 +function minGapMinutes(cron) { + const mins = [...cron.minute].sort((a, b) => a - b); + if (mins.length <= 1) return 60; // 单点(如 `0`)= 每小时一次(或更稀疏) + let gap = Infinity; + for (let i = 0; i < mins.length; i++) { + const a = mins[i]; + const b = i + 1 < mins.length ? mins[i + 1] : mins[0] + 60; + gap = Math.min(gap, b - a); + } + return gap; +} + +// 校验:定时任务最低支持小时级间隔,分钟级禁止(避免高频触发 + 每 tick 无效检查影响性能) +function assertHourlyMin(cron) { + if (minGapMinutes(cron) < 60) { + const err = new Error("定时任务最小间隔为 1 小时,不支持分钟级触发(每分钟/每 30 分钟等)"); + err.status = 400; + throw err; + } +} + +let _schedules = []; +let _started = false; +const _denyLogTs = new Map(); + +// ==================== 标准 5 段 cron 解析 ==================== +function parseField(spec, lo, hi) { + if (spec === "*" || spec === "?") { + const s = new Set(); + for (let v = lo; v <= hi; v++) s.add(v); + return s; + } + const out = new Set(); + for (let part of String(spec).split(",")) { + part = part.trim(); + if (!part) continue; + let step = 1; + if (part.includes("/")) { + const idx = part.indexOf("/"); + const stepS = part.slice(idx + 1); + part = part.slice(0, idx); + step = parseInt(stepS, 10); + if (Number.isNaN(step) || step < 1) throw new Error(`无效步长:${stepS}`); + } + let a, b; + if (part === "*" || part === "?") { + a = lo; b = hi; + } else if (part.includes("-")) { + const idx = part.indexOf("-"); + a = parseInt(part.slice(0, idx), 10); + b = parseInt(part.slice(idx + 1), 10); + } else { + a = b = parseInt(part, 10); + } + if (Number.isNaN(a) || Number.isNaN(b) || a < lo || a > hi || b < lo || b > hi || a > b) { + throw new Error(`字段越界:${part}`); + } + for (let v = a; v <= b; v += step) out.add(v); + } + if (out.size === 0) throw new Error("空字段"); + return out; +} + +function parseCron(expr) { + const parts = String(expr || "").trim().split(/\s+/); + if (parts.length !== 5) throw new Error("cron 需为 5 段:分 时 日 月 周"); + const minute = parseField(parts[0], 0, 59); + const hour = parseField(parts[1], 0, 23); + const dom = parseField(parts[2], 1, 31); + const month = parseField(parts[3], 1, 12); + const dow = parseField(parts[4], 0, 7); + const has7 = dow.has(7); + dow.delete(7); + if (has7) dow.add(0); + return { minute, hour, dom, month, dow }; +} + +function cronDow(dt) { + // 标准 cron 周日编号:0=周日,1=周一 … 6=周六(与 Python 底座 _cron_dow 一致)。 + // 注意:JS getDay() 本身就是该编号(周日=0),不能再做 (x+6)%7 的偏移——那会整体差一天, + // 导致「工作日 1-5」实际落在周二~周六、且 `0`/`7`(周日)错到周一。 + return dt.getDay(); +} + +function setRange(lo, hi) { + const s = new Set(); + for (let v = lo; v <= hi; v++) s.add(v); + return s; +} + +function nextMatch(cron, after) { + const { minute, hour, dom, month, dow } = cron; + const domAny = dom.size === 31 && [...dom].every((v) => v >= 1 && v <= 31); + const dowAny = dow.size === 7; + let t = new Date(after); + t.setSeconds(0, 0); + t = new Date(t.getTime() + 60000); // +1 分钟 + for (let i = 0; i < 10000; i++) { + if (!month.has(t.getMonth() + 1)) { + const y = t.getMonth() === 11 ? t.getFullYear() + 1 : t.getFullYear(); + const m = t.getMonth() === 11 ? 0 : t.getMonth() + 1; + t = new Date(y, m, 1, 0, 0, 0, 0); + continue; + } + let dayOk; + if (!domAny && !dowAny) dayOk = dom.has(t.getDate()) || dow.has(cronDow(t)); + else if (!dowAny) dayOk = dow.has(cronDow(t)); + else if (!domAny) dayOk = dom.has(t.getDate()); + else dayOk = true; + if (!dayOk) { + t = new Date(t.getFullYear(), t.getMonth(), t.getDate() + 1, 0, 0, 0, 0); + continue; + } + if (!hour.has(t.getHours())) { + t = new Date(t.getFullYear(), t.getMonth(), t.getDate(), t.getHours() + 1, 0, 0, 0); + continue; + } + if (!minute.has(t.getMinutes())) { + t = new Date(t.getTime() + 60000); + continue; + } + return t; + } + return null; +} + +// ==================== 本地存储与 CRUD ==================== +function load() { + try { + if (fs.existsSync(SCHED_FILE)) { + const data = JSON.parse(fs.readFileSync(SCHED_FILE, "utf-8")); + _schedules = ((data || {}).schedules || []).filter((s) => s && typeof s === "object"); + } else { + _schedules = []; + } + } catch (e) { + logger.warning(`定时任务配置损坏,已忽略:${SCHED_FILE}`); + _schedules = []; + } +} + +function persist() { + try { + fs.mkdirSync(config.APP_DATA, { recursive: true }); + fs.writeFileSync(SCHED_FILE, JSON.stringify({ schedules: _schedules }, null, 2), "utf-8"); + } catch (e) { + logger.warning(`定时任务配置持久化失败:${e.message}`); + } +} + +function getSchedule(sid) { + for (const s of _schedules) { + if (s.id === sid) return { ...s }; + } + return null; +} + +function listSchedules(account) { + return _schedules.filter((s) => s.account === account).map(publicView); +} + +function createSchedule(account, payload) { + const cron = (payload.cron || "").trim(); + parseCron(cron); // 非法抛错 + assertHourlyMin(parseCron(cron)); // 分钟级抛错 + const rec = { + id: newId(), + name: (payload.name || "").trim() || "定时任务", + account, + plugin_id: payload.plugin_id || "", + fields: payload.fields || {}, + cron, + enabled: !!payload.enabled, + last_run_at: "", + created_at: nowStr(), + updated_at: nowStr(), + }; + _schedules.push(rec); + persist(); + return { ...rec }; +} + +function updateSchedule(sid, payload) { + if (payload.cron) { + parseCron(payload.cron); + assertHourlyMin(parseCron(payload.cron)); + } + for (const s of _schedules) { + if (s.id !== sid) continue; + if ("name" in payload) s.name = (payload.name || "").trim() || "定时任务"; + if ("plugin_id" in payload) s.plugin_id = payload.plugin_id; + if ("fields" in payload) s.fields = payload.fields || {}; + if (payload.cron) s.cron = payload.cron.trim(); + if ("enabled" in payload) s.enabled = !!payload.enabled; + s.updated_at = nowStr(); + persist(); + return { ...s }; + } + return null; +} + +function deleteSchedule(sid) { + const idx = _schedules.findIndex((s) => s.id === sid); + if (idx < 0) return false; + _schedules.splice(idx, 1); + persist(); + return true; +} + +function toggleSchedule(sid, enabled) { + for (const s of _schedules) { + if (s.id !== sid) continue; + s.enabled = !!enabled; + s.updated_at = nowStr(); + persist(); + return { ...s }; + } + return null; +} + +function nextRunAt(s) { + let cron; + try { + cron = parseCron(s.cron || ""); + } catch (e) { + return null; + } + let last = null; + if (s.last_run_at) { + const t = Date.parse(s.last_run_at.replace(" ", "T")); + if (!Number.isNaN(t)) last = new Date(t); + } + return nextMatch(cron, last || new Date()); +} + +function publicView(s) { + const out = { ...s }; + out.enabled = !!out.enabled; + out.last_run_at = out.last_run_at || ""; + // 上次执行结论(计划视图要显示"上次 ✓ 成功 31s";无记录时为空,前端按"从未"处理) + out.last_status = out.last_status || ""; + out.last_duration = parseInt(out.last_duration, 10) || 0; + out.last_error = out.last_error || ""; + const nxt = out.enabled ? nextRunAt(s) : null; + out.next_run_at = nxt ? fmt(nxt) : ""; + return out; +} + +function fmt(d) { + const p = (n) => String(n).padStart(2, "0"); + return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`; +} + +function exportByAccount(account) { + return _schedules.filter((s) => s.account === account).map((s) => ({ ...s })); +} + +// ==================== 后台触发 ==================== +function start() { + if (_started) return; + _started = true; + setInterval(() => { + try { + void tick(); + } catch (e) { + logger.warning(`定时任务检查异常:${e.message}`); + } + }, TICK_SECS * 1000); + logger.info(`定时任务后台检查已启动(每 ${TICK_SECS}s 一次)`); +} + +async function tick() { + const now = new Date(); + const due = []; + const changed = []; // 触发成功或错过跳过都改了 last_run_at,需落盘 + for (const s of _schedules) { + if (!s.enabled) continue; + let cron; + try { + cron = parseCron(s.cron || ""); + // 防御:历史遗留的分钟级任务不触发(创建/编辑已被 assertHourlyMin 拦截) + if (minGapMinutes(cron) < 60) { + logger.warning(`定时任务「${s.name}」为分钟级间隔,已禁止触发,请在计划页改为小时级或以上`); + continue; + } + } catch (e) { + continue; + } + let last = null; + if (s.last_run_at) { + const t = Date.parse(s.last_run_at.replace(" ", "T")); + if (!Number.isNaN(t)) last = new Date(t); + } + const nxt = nextMatch(cron, last || now); + if (!nxt || nxt.getTime() > now.getTime()) continue; // 未来触发点 + if (!isDueNow(nxt, now)) { + // 错过:壳子停机/离线期间到点,时间过了就过了,不补跑(要补就人工运行一次)。 + // last_run_at 推进到"现在",下次 tick 直接从未来点开始算。 + s.last_run_at = fmt(now); + changed.push(s); + logger.info(`定时任务「${s.name}」错过触发点 ${fmt(nxt)}(停机/离线期间),跳过不补跑`); + continue; + } + due.push([s, nxt]); + } + for (const [s, nxt] of due) { + if (await fire(s)) { + s.last_run_at = fmt(nxt); + } else { + // 触发失败(授权被拒/插件缺失/启动异常):跳过本次到点,等下一个 cron 点再试, + // 避免每 30s tick 对同一任务无效重试。 + s.last_run_at = fmt(now); + } + changed.push(s); + } + if (changed.length) persist(); +} + +async function fire(s) { + const registry = require("./registry"); + const licensing = require("./licensing"); + const runner = require("./runner"); + let plugin; + try { + plugin = registry.find(s.plugin_id || ""); + } catch (e) { + logger.warning(`定时任务「${s.name}」的插件 ${s.plugin_id} 不存在,跳过触发`); + return false; + } + const account = s.account || ""; + const deny = await licensing.runCheckAllowed(plugin.id, account, licensing.isOnline()); + if (deny) { + const ts = Date.now(); + const lastLog = _denyLogTs.get(s.id); + _denyLogTs.set(s.id, ts); + if (lastLog === undefined || ts - lastLog >= DENY_LOG_CD * 1000) { + logger.warning(`定时任务「${s.name}」触发被拒(账号 ${account}):${deny}`); + } + return false; + } + try { + const runId = runner.submitRun(account, plugin, s.fields || {}, { + trigger: "schedule", + schedule_id: s.id, + }); + watchRun(s.id, runId); + logger.info(`定时任务触发:「${s.name}」(插件 ${plugin.id},账号 ${account})`); + return true; + } catch (e) { + logger.error(`定时任务「${s.name}」启动失败:${e.message}`); + return false; + } +} + +// 定时触发的运行结束后,把结论回写到该任务上(计划视图展示"上次 ✓ 成功 31s") +function watchRun(scheduleId, runId) { + let timer = null; + const onEvent = (ev) => { + if (!ev || ev.t !== "run_done" || ev.run_id !== runId) return; + HUB.removeListener("event", onEvent); + if (timer) clearTimeout(timer); + const target = _schedules.find((x) => x.id === scheduleId); + if (!target) return; // 任务已被删除 + target.last_status = ev.ok ? "ok" : "error"; + target.last_duration = parseInt(ev.duration_sec, 10) || 0; + target.last_error = ev.ok ? "" : ev.error || ""; + persist(); + }; + HUB.on("event", onEvent); + // 兜底:进程异常或事件丢失时不让监听器长期驻留(执行超时上限 + 2 分钟宽限) + timer = setTimeout(() => HUB.removeListener("event", onEvent), (config.RUN_TIMEOUT + 120) * 1000); + if (timer.unref) timer.unref(); +} + +// ==================== 中心机备份(防丢失) ==================== +function pushBackup(account, headers) { + if (!config.CONTROLPLANE_URL || !account) return; + const payload = { data: { schedules: exportByAccount(account) } }; + cp.request("POST", "/api/schedules/backup", { + headers: { ...(headers || {}), "Content-Type": "application/json" }, + json: payload, + timeout: 10, + }) + .then(() => logger.info(`定时任务备份成功(账号 ${account})`)) + .catch((e) => logger.warning(`定时任务备份失败(账号 ${account}):${e.message}`)); +} + +function restoreFromCloud() { + if (!config.CONTROLPLANE_URL) return; + const account = session.sessActiveAccount(); + if (!account) return; + const headers = { "X-Admin-User": account }; + if (config.CONTROLPLANE_TOKEN) headers["X-API-Token"] = config.CONTROLPLANE_TOKEN; + const tok = session.cloudToken(account); + if (tok) headers["Authorization"] = `Bearer ${tok}`; + cp.request("GET", "/api/schedules/backup", { headers, timeout: 5 }) + .then((r) => { + const remote = ((r.data || {}).schedules) || []; + const localIds = new Set(_schedules.map((s) => s.id)); + let added = 0; + for (const s of remote) { + if (!s || typeof s !== "object" || localIds.has(s.id) || s.account !== account) continue; + try { + parseCron(s.cron || ""); + assertHourlyMin(parseCron(s.cron || "")); // 分钟级历史任务不恢复 + } catch (e) { + continue; + } + _schedules.push(s); + localIds.add(s.id); + added++; + } + if (added) { + persist(); + logger.info(`定时任务云端恢复 ${added} 条(账号 ${account})`); + } + }) + .catch((e) => logger.warning(`定时任务云端恢复失败(跳过):${e.message}`)); +} + +function init() { + load(); + start(); + restoreFromCloud(); +} + +module.exports = { + parseCron, + parseField, + nextMatch, + cronDow, + isDueNow, + minGapMinutes, + assertHourlyMin, + CATCHUP_SKIP_MS, + load, + persist, + getSchedule, + listSchedules, + createSchedule, + updateSchedule, + deleteSchedule, + toggleSchedule, + nextRunAt, + watchRun, + pushBackup, + restoreFromCloud, + init, + SCHED_FILE, +}; diff --git a/desktop/electron-shell/frontend/docs/design-preview-v2.html b/desktop/electron-shell/frontend/docs/design-preview-v2.html new file mode 100644 index 0000000..25a1219 --- /dev/null +++ b/desktop/electron-shell/frontend/docs/design-preview-v2.html @@ -0,0 +1,745 @@ + + + + + +37du 壳子 · 基于数据的重排版提案 v2(Run-centric Console) + + + +
+
+

基于数据的重排版 v2 · Run-centric Console

+

原子实体是「运行」:场景=模板 · 定时=触发器 · 平台会话=前置条件 · 日志/进度/结果=过程与产物。左轨选场景,中央看上下文,右轨看活动流 —— 点左侧导航或场景可切换视图

+
+ +
+ +
+
+
+ 37自动化工作台v2.3.1 + +
—▢✕
+
+ +
+ + + + +
+ + +
+
+ 考 +
+

考勤月报封存检查 v1.4.0 OA · 已登录 装浏览器

+

抓取当月 OA 考勤原始表,校验异常打卡并生成封存报表回传中心机

+
+
+ +
+
+ + +
+
+

执行参数

+ 3 项 · 全部必填已就绪 +
+
+
+
+ +
2025-11▾
+
+
+ +
2
+
+
+ +
zhangsan@37du.cn
+
+
+
↺ 已恢复上次执行参数(11 日 14:02) · 恢复默认
+
+
+ + +
+
+

运行

+
+ + + +
+
+
+ +
+ + 使用本机 Chrome 会话执行 · 日志实时显示在此卡片,不再占用全局底栏 +
+ +
+
+ 62% +
+ ● LIVE + run_8f3a +
+
+
14:02:01INFO启动 Chrome 会话,加载 OA 首页
+
14:02:07INFO登录态校验通过(cookie 有效)
+
14:02:09INFO进入 考勤月报 → 2025-11,开始抓取表格
+
14:02:24WARN抓取到 2 行异常打卡,已标记待人工复核
+
14:02:31INFO正在生成封存 ZIP 并回传中心机…
+
+
+ +
+
+ ✓ +
+ 执行完成 · 耗时 31s + 报表已封存并回传中心机 · 2 行异常打卡待人工复核 +
+ +
+
+
14:02:31INFO报表封存完成,已生成 ZIP 并回传中心机
+
14:02:32INFO===== 执行完成 =====(耗时 31s)
+
+
+
+
+ + +
+
+

定时触发

+ +
+
+
+ 每个工作日 08:00下次 明天 08:00 · 上次 今天 08:00 成功0 8 * * 1-5 + +
+
+
+
+ + +
+
+
+

早上好,张三

+

2025年12月11日 星期四 · 昨日自动执行 12 次,全部成功

+
+
+
6场景
+
3计划
+
2/2平台在线
+
✓ 14:02上次执行
+
+
+ +
接下来自动执行
+
+
+ 08:00明天 + 考勤月报封存检查0 8 * * 1-5 · 工作日 + OA ✓ +
+
+ 18:00周五 + 周报数据汇总0 18 * * 5 · 每周五 + OA ✓ +
+
+ +
全部场景
+
+ + + + + + +
+
+ + +
+
+
+

计划

+

按下次执行时间排序 · 配置自动备份到中心机

+
+ +
+
+
+ 明天 08:0012-12 周五 + 考勤月报封存检查工作日触发 · 参数:2025-11 · 重试 2 次 + 0 8 * * 1-5 + 上次 今天 08:00
✓ 成功 31s
+ +
+
+ 周五 18:0012-12 周五 + 周报数据汇总每周触发 · 全部默认参数 + 0 18 * * 5 + 上次 12-05 18:00
✓ 成功 12s
+ +
+
+ 12-01 09:00已过期 + 档案归档巡检每月 1 日触发 · 已停用 + 0 9 1 * * + 上次 12-01 09:00
✓ 成功 8s
+ +
+
+
+
+ + + +
+ +
+ 服务已连接 + Chrome 131 + 插件同步 2 分钟前 + + 127.0.0.1:8765 + WS 正常 +
+
+
+ + +
+

数据 → 界面归属对照(重排了什么,为什么)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
数据(接口字段)现在的位置新家理由
run / progress / logstopbar 进度条 + 执行按钮环 + 全局底栏日志(三处)执行台·运行卡(日志内联,三态一体)日志是「这次运行」的属性,跟着运行走;完成后同卡片展示结果与摘要
schedules + next_run_at独立的定时任务页(CRUD 表格)计划视图(按时间排序的队列)+ 场景执行台内联「定时触发」next_run_at 本来就有,但现状没有「接下来发生什么」的时间感;同时定时数据绑定插件,就地可见
platforms + online首页卡片区 + 个人中心抽屉(两处重复)右轨·平台会话(唯一入口)+ 场景头的依赖芯片它是运行的前置条件,应该常驻可见、一键登录,而不是藏在两个地方
recents(最近 8 次)首页底部摘要条右轨·最近运行(点击回放 → 执行台)run_id 与 getRun 都在,点击可回放日志,把摘要升级成入口
fields[](插件参数)插件页平铺表单,每次进入重置默认值执行台·参数卡 + 「恢复上次参数」新增可负担性:上次值本地持久化,重复执行不再逐项重填
首页(问候/统计卡)独立 home 视图溶解:KPI 行并入总览头部统计数字全部可由其余视图直接得出,独立页面信息密度过低
WS/Chrome/更新/授权状态topbar 芯片堆 + 全局提示条(3-4 处)收敛:状态栏 + 右轨票据卡 + 更新横幅(低频事件)常驻态进状态栏,异常态才升级为横幅/卡片,topbar 不再堆芯片
authExpired / 票据顶部橙色横幅(挤占布局)右轨·授权票据卡(剩余天数 + 刷新)7 天倒计时是持续性状态,横幅只该在临期/过期时出现
+
+ + + + diff --git a/desktop/electron-shell/frontend/docs/design-preview.html b/desktop/electron-shell/frontend/docs/design-preview.html new file mode 100644 index 0000000..0475797 --- /dev/null +++ b/desktop/electron-shell/frontend/docs/design-preview.html @@ -0,0 +1,603 @@ + + + + + +37du 壳子前端 · 重设计提案(Soft Precision) + + + +
+
+

37du 壳子前端 · 重设计提案 Soft Precision

+

精密工作台的秩序 × 天蓝品牌延续 × 奶油感收束为点缀 —— 右上角可切换深浅主题预览

+
+ +
+ +
+
+ +
+ 37 + 自动化工作台 + v2.3.1 + +
—▢✕
+
+ +
+ + + + +
+
+
+
+

早上好,张三

+

2025年12月11日 星期四 · 6 个可用场景 · 昨日自动执行 12 次

+
+ 服务已连接 +
+ +
+
+ +
6可用场景
+
+
+ +
3定时任务
+
+
+ +
2/2平台在线
+
+
+ +
执行成功考勤月报 · 14:02
+
+
+ +
+

常用场景

全部场景 →
+
+ + + + +
+
+ +
+

最近动态

最近 3 次执行
+
+ + + +
+
+
+ + +
+
+ 运行日志 ● LIVE +
+ 全部INFOWARNERROR +
+ + 复制清空 + +
+
+
14:02:01INFO[考勤月报] 启动 Chrome 会话,加载 OA 首页
+
14:02:07INFO登录态校验通过(cookie 有效)
+
14:02:09INFO进入 考勤月报 → 2025-11,开始抓取表格
+
14:02:24WARN抓取到 2 行异常打卡,已标记待人工复核
+
14:02:31INFO报表封存完成,已生成 ZIP 并回传中心机
+
14:02:32INFO===== 执行完成 =====(耗时 31s)
+
+
+ + +
+ 服务已连接 + Chrome 131 已就绪 + 授权剩余 5 天 + + 插件同步 2 分钟前 + 127.0.0.1:8765 +
+
+
+
+
+ + +
+

设计 Token 图鉴

+
+
+

色彩 · 主色与语义(全部过 AA 对比度)

+
+
primary-strong按钮底色,白字 5.9:1
+
primary链接 / 激活态 / 图标
+
primary-tint选中底 / 色块容器
+
ok成功 · 白字 4.8:1
+
err错误 · 替代过浅的 #E58B8B
+
warn警告 · 白字 5.1:1
+
+
+
+

字体 · 收敛为 7 档,数字一律等宽

+
28 / 70028 页面大数字
+
20 / 70020 页面标题
+
16 / 60016 卡片区块标题
+
14 / 60014 列表主文本
+
13 / 40013 正文基准
+
12 / 40012 辅助说明(下限)
+
monov1.4.0 · 0 8 * * * · 14:02:31
+
+
+

结构 · 发丝线优先,阴影只做两层

+
+
surface + hairline1px 边线替代大部分投影
+
surface-2hover / 次级容器
+
shadow-md仅悬浮卡片与弹层使用
+
radius 12 / 8卡片 12 · 控件 8(从 16-22 收敛)
+
+
+
+

方向对照 · 为什么改

+
+
+
现状 · 奶油治愈风
+
    +
  • 登录页=科技终端,工作台=可爱手账,身份分裂
  • +
  • 主按钮浅蓝底白字 ≈2:1,对比度不达标
  • +
  • 10.5px 小字遍地、字号 17 档碎片化
  • +
  • 窗口卡片套卡片,四层圆角互相打架
  • +
  • 浮动涂鸦 + 面板 hover 上浮,工具感被稀释
  • +
+
+
+
提案 · Soft Precision
+
    +
  • 冷灰画布 + 发丝线,主色压深保品牌色相
  • +
  • 一套 token 管到底,深浅主题同源切换
  • +
  • 自绘标题栏 + 状态栏,像原生桌面应用
  • +
  • 日志改可折叠抽屉,状态芯片收进状态栏
  • +
  • 动效只留 120-180ms 交互反馈,去掉常驻漂浮
  • +
+
+
+
+
+
+

提案稿 · 静态预览(单文件 HTML,数据为虚构示例)· 评审通过后按「token 层 → 布局壳 → 组件」三步落地到 Vue 组件

+ + diff --git a/desktop/electron-shell/frontend/index.html b/desktop/electron-shell/frontend/index.html new file mode 100644 index 0000000..c0c46fb --- /dev/null +++ b/desktop/electron-shell/frontend/index.html @@ -0,0 +1,12 @@ + + + + + + 37du 自动化工作台 + + +
+ + + \ No newline at end of file diff --git a/desktop/electron-shell/frontend/package-lock.json b/desktop/electron-shell/frontend/package-lock.json new file mode 100644 index 0000000..a373ad6 --- /dev/null +++ b/desktop/electron-shell/frontend/package-lock.json @@ -0,0 +1,1576 @@ +{ + "name": "37du-webhost-frontend", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "37du-webhost-frontend", + "version": "0.1.0", + "dependencies": { + "@element-plus/icons-vue": "^2.3.2", + "element-plus": "^2.14.5", + "vue": "^3.5.13" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^5.2.1", + "vite": "^6.0.3" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.8.tgz", + "integrity": "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.8" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", + "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@ctrl/tinycolor": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-4.2.1.tgz", + "integrity": "sha512-Vh5uy9Y1JBMId6J1f68TMXnZrTCvNdo9Fu2k0d1YnJngR+sM5kWTKl441c/3TFs+cG0NWOjRWgQ/iaWhbYx+7A==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/@element-plus/icons-vue": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/@element-plus/icons-vue/-/icons-vue-2.3.2.tgz", + "integrity": "sha512-OzIuTaIfC8QXEPmJvB4Y4kw34rSXdCJzxcD1kFStBvr8bK6X1zQAYDo0CNMjojnfTqRQCJ0I7prlErcoRiET2A==", + "license": "MIT", + "peerDependencies": { + "vue": "^3.2.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@floating-ui/core": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz", + "integrity": "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==", + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.12" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.8.0.tgz", + "integrity": "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.8.0", + "@floating-ui/utils": "^0.2.12" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.12.tgz", + "integrity": "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==", + "license": "MIT" + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "license": "MIT" + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@popperjs/core": { + "name": "@sxzz/popperjs-es", + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@sxzz/popperjs-es/-/popperjs-es-2.11.8.tgz", + "integrity": "sha512-wOwESXvvED3S8xBmcPWHs2dUuzrE4XiZeFu7e1hROIJkm02a49N120pmOXxY33sBb6hArItm5W5tcg1cBtV+HQ==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/popperjs" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.1.tgz", + "integrity": "sha512-UZ8sUxPTiHWYX9QNdJedb1kDZSpS1t/VPWBWGSgqHNi9w3Cu6IXvu2mzbhiTiPvtrqgTQJ+zqiAq2iPIPilpaQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.1.tgz", + "integrity": "sha512-cQ4nFQABN5cDvDpbvJ7bMStCpnaVxynZrRMfUJYgxcIk9Sh54FIO1vtfkg0B69REjER77ioZ/ov+eAApx/KmLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.1.tgz", + "integrity": "sha512-FQNqd1lRy/0QhDk3xeRIkSBiCpXCiDnZO3YLVdcDKN1UBiKToNftCzcXYNLshmPDUMlu2TdeS8tGcsU6f3YF1Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.1.tgz", + "integrity": "sha512-pvD16V939D3CloK0+qikpGaxiPrDUXTe7Y5cWOMkMSy7m1cawa8EGy/kXYi/G/cKAC4HDAbSnzCIk1WmsoOKXg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.1.tgz", + "integrity": "sha512-pcFGeL2345VwdTnJhA6zLbew+YgWB0qBG2+dMtXjCicf6+rm6kO6cOoh5VnTe0ZMrMRgRyuHmCJxZWrIdzYuOw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.1.tgz", + "integrity": "sha512-mRJlqSRulVzcKq/LKA6ICSIc3K/l4fzlVn/gePn2nXIHy8seRi5z/eeRE0d/XMBxcMldiXtQTSpRj0tkkC3g8Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.1.tgz", + "integrity": "sha512-YDUNvVM85TI3g/1OpnqKP1h4NeW/j64DfWMf+G3M809xNk1bJSnpFp4sh83NpmVE5DXnkh8ULor4LTVZKoYLHw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.1.tgz", + "integrity": "sha512-7Mcn71p9ZuQFAj+h+dhQXy/yeLePRS2yKRnmW1DijA9thKO5qap0GNOIQK4yQ6iP3SU0Mrb/yWo8h8vgRba8lw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.1.tgz", + "integrity": "sha512-4YiLQTX6U4CSl0L9cluep9A9W6UmTfqBDc2/CH6wlu54pl4E7Jn3cOD8oxzvBDEGk/JMKgJ47C8g+radF7mwvg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.1.tgz", + "integrity": "sha512-2ra8F7w8OquwZN9z2/fKFnli69wa8PLwaVzRMIPGb13ByMJwC28Fbp8YcVGoUhlYMTt7j5j9bNgpysrN2UM+vw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.1.tgz", + "integrity": "sha512-Sy20ncyhjmBP0Ml+UvQbimjlk6VFgjW5uNP+qqwHB00mTE8Bl2C1TuHTlRwK2YoXeZbee5lP2XevBWVkAQAtSQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.1.tgz", + "integrity": "sha512-noITLp8oNjYliPnGWmLyelIHwULGqbHloQHGw1rtxbWhTuWooRpnZarZQJ1y9EUC4szuCusCc+HEpUtxpIwYvA==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.1.tgz", + "integrity": "sha512-hlxxXd+F1mWiAcaFR7Sv9ZQT6m6UfI8+Vy/kFJzztq2pDMU/0wZ9sish0iszNZvsQDo8Gc0i5yuFEOz5dDf6fA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.1.tgz", + "integrity": "sha512-EF7OpqQTQ/BvGqLzUi4rEHuagCV9MugAUXSHemwPW5vxZ75RR+jxO/2j95Ph2dalMpFHSVECjRoioHZgA9zOYA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.1.tgz", + "integrity": "sha512-wQO3JesW9PRkwlabQ27y7sPfVOOTLRG73I4F2UYHG5PXun3J9U3y+b7ezVKSYbsvSKGQ1k1cq8Qlun4C9kLt3w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.1.tgz", + "integrity": "sha512-ouAGwhO6wHRXdnOVCOsB0tRFkA7nhNB2Nwax6oECXN0YiN8EYUTBAOudADOB1PI+yDL61TeNx/u7MVCzksNbkQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.1.tgz", + "integrity": "sha512-q2R38Sn+1J8RxhfJ+T54wSWmyKXWec+9jgDfqO2AtArEqHO5R2aeayp5H5OYLr5UYDVGsVaZPEFUooMhYCdz5A==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.1.tgz", + "integrity": "sha512-gfI5T24WLLuFfSKw7Go/zDXjAAV0fny0swTaDv+WjK7vqcw4cRhFfdsyKL1n+ukI+ooBxn3bVQnyrn06WpI50w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.1.tgz", + "integrity": "sha512-4h6XqthmB4Hspji84wvgk+ElodTsGj+dbZqHJHHtKxj4mYq0ANSEEPX9ys3moJueqsRjwpaJYH7874Itwnj2ow==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.1.tgz", + "integrity": "sha512-dlfCOa87o1VAYegLQ9EKilx2JCeRofiyPGhTCmqnuXZ6bMPiycO1rq1+sKoulAp7pGLIsTIw+1x5R+zgh5LhhA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.1.tgz", + "integrity": "sha512-cjkLbOlfcm3QGhMM1J5zaZjsw1GggbN6rw9UTSSRrPrR1KkcXnN7Uq9rPw34xImQ9VOY9GN+6u2Zj80B9ptkcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.1.tgz", + "integrity": "sha512-Li1KdUnWGE4N3e1F/B4RTB1ms+nG4WBgjByO46pkeBVX/2UBsY53xf5vK9WygVmnH3RwncIST7lkSdLSY6P9lg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.1.tgz", + "integrity": "sha512-t4ZYOSoLTgwhuFMrmTMLx/+i1DQVK7HYqMc6kY46EApwi8X0nIVphzdNoThU3xt6n+N5urG1/gxBdCaKDLavfg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.1.tgz", + "integrity": "sha512-RgroPfMmKlD1RzSDxvwgcPiy2HNQKoYV7OmwIXDsk73uKW5t6B/V8KIy27SMv/FNXFo/oSBtWc9J0X7t91ezZg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.1.tgz", + "integrity": "sha512-at8QVep6S3h5Y6gSbdGU06bRY5WJkf6WUduM9YtvYMbYhB1MOFfUgc6kehitQXzOtMSaT70q7f9ydPhpqu821w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/lodash": { + "version": "4.17.25", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.25.tgz", + "integrity": "sha512-+K1NIO8I+F9/wNulfVvu23QYd0Pe9/OCqRrim4NoYIf1VoEDL90Ve4ClzpyqBLc7NpGGWRvYNCKZ1BE/Jpf8dQ==", + "license": "MIT" + }, + "node_modules/@types/lodash-es": { + "version": "4.17.12", + "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz", + "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==", + "license": "MIT", + "dependencies": { + "@types/lodash": "*" + } + }, + "node_modules/@types/web-bluetooth": { + "version": "0.0.21", + "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.21.tgz", + "integrity": "sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==", + "license": "MIT" + }, + "node_modules/@vitejs/plugin-vue": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.2.4.tgz", + "integrity": "sha512-7Yx/SXSOcQq5HiiV3orevHUFn+pmMB4cgbEkDYgnkUWb0WfeQ/wa2yFv6D5ICiCQOVpjA7vYDXrC7AGO8yjDHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "vite": "^5.0.0 || ^6.0.0", + "vue": "^3.2.25" + } + }, + "node_modules/@vue/compiler-core": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.42.tgz", + "integrity": "sha512-2Ye1ilMtKXxl8qZUrQ5j0CdgenFp/HFQmta6rfRyfEsTG69L6Wk+tWuNoHYHMx9E8tF2Slvdg1FuwDvAXdy1LQ==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.8", + "@vue/shared": "3.5.42", + "entities": "^7.0.1", + "estree-walker": "^2.0.2", + "source-map-js": "^1.2.1" + } + }, + "node_modules/@vue/compiler-dom": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.42.tgz", + "integrity": "sha512-qbhQZEFmycr+ni/qyuccS4sucNN7VAbDfbkvNxWOX2VfgFm90MNs3/UhRNKoPMEIVn0F8gdlYjLPvqxHwHeQOA==", + "license": "MIT", + "dependencies": { + "@vue/compiler-core": "3.5.42", + "@vue/shared": "3.5.42" + } + }, + "node_modules/@vue/compiler-sfc": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.42.tgz", + "integrity": "sha512-fkCAFB4okcAANGMThboWnScp/gzWjU0ZSkVnjTIiplmMDq2uq0tIB3j+xVu4rhv5rvOgBySCysudmbMd6xRRqw==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.8", + "@vue/compiler-core": "3.5.42", + "@vue/compiler-dom": "3.5.42", + "@vue/compiler-ssr": "3.5.42", + "@vue/shared": "3.5.42", + "estree-walker": "^2.0.2", + "magic-string": "^0.30.21", + "postcss": "^8.5.19", + "source-map-js": "^1.2.1" + } + }, + "node_modules/@vue/compiler-ssr": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.42.tgz", + "integrity": "sha512-xmLk3wLkbizPAiLyomjgFFosf2ys9b5Ghb+oh/k2tnvipNz8OFrQOiTcWCzyK7MpBp9KkyGtfvgfLUivbmuGYA==", + "license": "MIT", + "dependencies": { + "@vue/compiler-dom": "3.5.42", + "@vue/shared": "3.5.42" + } + }, + "node_modules/@vue/reactivity": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.42.tgz", + "integrity": "sha512-TzNNfKpb7hDxbQltwAut8VDQA5YP+BuRlxntHUuRjyKwlMvmAPbs3unhCvieijifY6vFfVBwsS7wG/C7uq+bEQ==", + "license": "MIT", + "dependencies": { + "@vue/shared": "3.5.42" + } + }, + "node_modules/@vue/runtime-core": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.42.tgz", + "integrity": "sha512-9uACtuHs7vJGkm5Bp3xu4xRDLFTIYy5DgxpToVjqGIAhAEKwQfsaLvKINhM6nFVp6bZPRFGdDqd1g52MqKsotA==", + "license": "MIT", + "dependencies": { + "@vue/reactivity": "3.5.42", + "@vue/shared": "3.5.42" + } + }, + "node_modules/@vue/runtime-dom": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.42.tgz", + "integrity": "sha512-rsCmhiWLaRxGltLwhlCWyYkFn7WAbKRh0q17eZ1A6Dq6eqc2ACQ61IIryxz0LrsvCzHSilLA9JHovVwM8CNE2g==", + "license": "MIT", + "dependencies": { + "@vue/reactivity": "3.5.42", + "@vue/runtime-core": "3.5.42", + "@vue/shared": "3.5.42", + "csstype": "^3.2.3" + } + }, + "node_modules/@vue/server-renderer": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.42.tgz", + "integrity": "sha512-2++5dUyYS4gvo7xQXSECUDhB7TS0aOl5SeVfC5qSq1Jgfhjvegw1zqhwTIR3imZ+QYPJQw9gfcFvXGAjGZ7ajQ==", + "license": "MIT", + "dependencies": { + "@vue/compiler-ssr": "3.5.42", + "@vue/runtime-dom": "3.5.42", + "@vue/shared": "3.5.42" + } + }, + "node_modules/@vue/shared": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.42.tgz", + "integrity": "sha512-2rPxex1jQf4jvl9MOHl6YaXCPcrNqz/FstMOEh3QWY+/OME9nQTvl9WYeCwhW7AFjaR0SnngZGlp/wkR6rkI6g==", + "license": "MIT" + }, + "node_modules/@vueuse/core": { + "version": "14.4.0", + "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-14.4.0.tgz", + "integrity": "sha512-X4WHz1HlCzCBoYXesUkifzzWBAcZgXG8Fi5iNPQg/epdzOB3gu8Fawj3hvuwYR1nGcXGnvxwYYcUC/71++svtQ==", + "license": "MIT", + "dependencies": { + "@types/web-bluetooth": "^0.0.21", + "@vueuse/metadata": "14.4.0", + "@vueuse/shared": "14.4.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "vue": "^3.5.0" + } + }, + "node_modules/@vueuse/metadata": { + "version": "14.4.0", + "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-14.4.0.tgz", + "integrity": "sha512-swx/255R6JyHZFJhx845iz5CRWDZdCfvkZOpACWc5+c5WHcG24mv8gUT1WIdFQaHt6dq79rvILd9QnCWiyVm9g==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/shared": { + "version": "14.4.0", + "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-14.4.0.tgz", + "integrity": "sha512-JRgY90Sz8DDtPMsaDflvPMp9xYk69JZAmbuDvAquUVXKr2gEjqtzGNTTthLfckH0BzBqvnu31gb4a8TGLRe79g==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "vue": "^3.5.0" + } + }, + "node_modules/async-validator": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/async-validator/-/async-validator-4.2.5.tgz", + "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==", + "license": "MIT" + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT" + }, + "node_modules/dayjs": { + "version": "1.11.23", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.23.tgz", + "integrity": "sha512-QDTCU0M0MxR3hQfnlDJfwekQiaanm1ubOD231u73WBckQ/fsamwRLiE2GBz6D3a/xF1NgfiDLJjXBa1hYOYTtQ==", + "license": "MIT" + }, + "node_modules/element-plus": { + "version": "2.14.5", + "resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.14.5.tgz", + "integrity": "sha512-bghYy/S+qg87enHPXELirhEdDqsVAUGcGpbGIeG8dz0kwpIkGz7gYsifulBshXX74iRtHib85XWQj0uSH2A1Yg==", + "license": "MIT", + "dependencies": { + "@ctrl/tinycolor": "^4.2.0", + "@element-plus/icons-vue": "^2.3.2", + "@floating-ui/dom": "^1.8.0", + "@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.8", + "@types/lodash": "^4.17.24", + "@types/lodash-es": "^4.17.12", + "@vueuse/core": "14.4.0", + "async-validator": "^4.2.5", + "dayjs": "^1.11.20", + "lodash": "^4.18.1", + "lodash-es": "^4.18.1", + "lodash-unified": "^1.0.3", + "memoize-one": "^6.0.0", + "normalize-wheel-es": "^1.2.0", + "vue-component-type-helpers": "^3.3.9" + }, + "peerDependencies": { + "vue": "^3.3.7" + } + }, + "node_modules/entities": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz", + "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "license": "MIT" + }, + "node_modules/lodash-es": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz", + "integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==", + "license": "MIT" + }, + "node_modules/lodash-unified": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/lodash-unified/-/lodash-unified-1.0.3.tgz", + "integrity": "sha512-WK9qSozxXOD7ZJQlpSqOT+om2ZfcT4yO+03FuzAHD0wF6S0l0090LRPDx3vhTTLZ8cFKpBn+IOcVXK6qOcIlfQ==", + "license": "MIT", + "peerDependencies": { + "@types/lodash-es": "*", + "lodash": "*", + "lodash-es": "*" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/memoize-one": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", + "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.18", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", + "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/normalize-wheel-es": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/normalize-wheel-es/-/normalize-wheel-es-1.2.0.tgz", + "integrity": "sha512-Wj7+EJQ8mSuXr2iWfnujrimU35R2W4FAErEyTmJoJ7ucwTn2hOUSsRehMb5RSYkxXGTM7Y9QpvPmp++w5ftoJw==", + "license": "BSD-3-Clause" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rollup": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.1.tgz", + "integrity": "sha512-3Df9jsstwhccuEfmAMi9l8XUh/GOkVObmFTU7CCVBysEbcOZLl84jCtaAZMcPiMz2EGKsATzQcU+Xr3n/wU6cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.63.1", + "@rollup/rollup-android-arm64": "4.63.1", + "@rollup/rollup-darwin-arm64": "4.63.1", + "@rollup/rollup-darwin-x64": "4.63.1", + "@rollup/rollup-freebsd-arm64": "4.63.1", + "@rollup/rollup-freebsd-x64": "4.63.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.63.1", + "@rollup/rollup-linux-arm-musleabihf": "4.63.1", + "@rollup/rollup-linux-arm64-gnu": "4.63.1", + "@rollup/rollup-linux-arm64-musl": "4.63.1", + "@rollup/rollup-linux-loong64-gnu": "4.63.1", + "@rollup/rollup-linux-loong64-musl": "4.63.1", + "@rollup/rollup-linux-ppc64-gnu": "4.63.1", + "@rollup/rollup-linux-ppc64-musl": "4.63.1", + "@rollup/rollup-linux-riscv64-gnu": "4.63.1", + "@rollup/rollup-linux-riscv64-musl": "4.63.1", + "@rollup/rollup-linux-s390x-gnu": "4.63.1", + "@rollup/rollup-linux-x64-gnu": "4.63.1", + "@rollup/rollup-linux-x64-musl": "4.63.1", + "@rollup/rollup-openbsd-x64": "4.63.1", + "@rollup/rollup-openharmony-arm64": "4.63.1", + "@rollup/rollup-win32-arm64-msvc": "4.63.1", + "@rollup/rollup-win32-ia32-msvc": "4.63.1", + "@rollup/rollup-win32-x64-gnu": "4.63.1", + "@rollup/rollup-win32-x64-msvc": "4.63.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/vite": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", + "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vue": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.42.tgz", + "integrity": "sha512-4RyHQTbQvOPs3MfvUO1Sg0YRrKNnA0mAVtvpd12Tg1fKDN7OHBUl1IqSn8zGJjK9nI3NkNp8cgTpVrSZC5TTcA==", + "license": "MIT", + "dependencies": { + "@vue/compiler-dom": "3.5.42", + "@vue/compiler-sfc": "3.5.42", + "@vue/runtime-dom": "3.5.42", + "@vue/server-renderer": "3.5.42", + "@vue/shared": "3.5.42" + }, + "peerDependencies": { + "typescript": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/vue-component-type-helpers": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/vue-component-type-helpers/-/vue-component-type-helpers-3.3.11.tgz", + "integrity": "sha512-LwcxzeliO9fkQcpJG0PoX8X5kmAhKmH9wkpDLxNabwzkQ9Zeib2YVHwFV4pcWmMLfXVfjr/dSV+DaJ3cIPgSNA==", + "license": "MIT" + } + } +} diff --git a/desktop/electron-shell/frontend/package.json b/desktop/electron-shell/frontend/package.json new file mode 100644 index 0000000..483bf97 --- /dev/null +++ b/desktop/electron-shell/frontend/package.json @@ -0,0 +1,23 @@ +{ + "name": "37du-shell-frontend", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "@element-plus/icons-vue": "^2.3.2", + "element-plus": "^2.14.5", + "vue": "^3.5.13" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^5.2.1", + "vite": "^6.0.3" + }, + "allowScripts": { + "esbuild@0.25.12": true + } +} diff --git a/desktop/electron-shell/frontend/src/App.vue b/desktop/electron-shell/frontend/src/App.vue new file mode 100644 index 0000000..04e9967 --- /dev/null +++ b/desktop/electron-shell/frontend/src/App.vue @@ -0,0 +1,903 @@ + + + + + \ No newline at end of file diff --git a/desktop/electron-shell/frontend/src/api.js b/desktop/electron-shell/frontend/src/api.js new file mode 100644 index 0000000..c93e56a --- /dev/null +++ b/desktop/electron-shell/frontend/src/api.js @@ -0,0 +1,172 @@ +// 与 FastAPI 后端交互 + WebSocket 实时流 +const WS_BASE = (location.protocol === 'https:' ? 'wss://' : 'ws://') + location.host + +async function j(url, opts) { + const res = await fetch(url, opts) + if (!res.ok) { + let msg = `HTTP ${res.status}` + try { msg = (await res.json()).detail || msg } catch (e) {} + throw new Error(msg) + } + return res.json() +} + +export async function fetchMeta() { + return j('/api/meta') +} + +export async function syncPlugins() { + return j('/api/plugins/sync', { method: 'POST' }) +} + +// ===== 插件回滚(升级前自动备份上一版,坏包可回退) ===== +export async function listRollbacks() { + return j('/api/plugins/rollback') +} +export async function rollbackPlugin(id) { + return j(`/api/plugins/rollback/${encodeURIComponent(id)}`, { method: 'POST' }) +} + +// ===== 场景配置方案(多配置,SQLite 存储) ===== +export async function listPluginConfigs(pluginId) { + return j(`/api/plugin-configs?plugin_id=${encodeURIComponent(pluginId)}`) +} +export async function savePluginConfig(pluginId, name, fields) { + return j('/api/plugin-configs', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ plugin_id: pluginId, name, fields }), + }) +} +export async function deletePluginConfig(pluginId, cfgId) { + return j(`/api/plugin-configs/${encodeURIComponent(pluginId)}/${encodeURIComponent(cfgId)}`, { method: 'DELETE' }) +} + +export async function getShellStatus() { + return j('/api/shell/update-status') +} + +export async function checkShellUpdate() { + return j('/api/shell/check', { method: 'POST' }) +} + +export async function downloadShellUpdate() { + return j('/api/shell/download', { method: 'POST' }) +} + +export async function applyShellUpdate() { + return j('/api/shell/apply', { method: 'POST' }) +} + +// ===== 浏览器(Chrome)安装 ===== +export async function getChromeStatus() { + return j('/api/chrome/status') +} +export async function checkChrome() { + return j('/api/chrome/check', { method: 'POST' }) +} +export async function downloadChrome() { + return j('/api/chrome/download', { method: 'POST' }) +} +export async function installChrome() { + return j('/api/chrome/install', { method: 'POST' }) +} + +export async function loginPlatform(id) { + return j(`/api/platforms/${id}/login`, { method: 'POST' }) +} + +export async function logoutPlatform(id) { + return j(`/api/platforms/${id}/logout`, { method: 'POST' }) +} + +// 当前账号的平台状态(个人中心):在线态 + 是否已配置个人账号密码 + 已存用户名 +export async function getPlatformStatus() { + return j('/api/platforms/status') +} + +// 保存当前账号的 HR/OA 账号密码(本机加密);pass 留空表示保留原密码 +export async function savePlatformCreds(payload) { + return j('/api/platforms/creds', { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(payload), + }) +} + +export async function startRun(pluginId, fields) { + return j('/api/runs', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ plugin_id: pluginId, fields }), + }) +} + +export async function getRun(runId) { + return j(`/api/runs/${runId}`) +} + +// 运行历史列表(当前账号,新的在前):执行台「历史运行」数据源 +export async function fetchRuns(limit = 30) { + return j(`/api/runs?limit=${limit}`) +} + +// ===== 定时任务(壳子内置定时,配置自动备份中心机) ===== +export async function listSchedules() { + return j('/api/schedules') +} +export async function createSchedule(body) { + return j('/api/schedules', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(body), + }) +} +export async function updateSchedule(sid, body) { + return j(`/api/schedules/${sid}`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(body), + }) +} +export async function deleteSchedule(sid) { + return j(`/api/schedules/${sid}`, { method: 'DELETE' }) +} +export async function toggleSchedule(sid, enabled) { + return j(`/api/schedules/${sid}/toggle`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ enabled }), + }) +} + +export function connectWS(onEvent) { + const ws = new WebSocket(WS_BASE + '/ws') + ws.onmessage = (e) => { + try { onEvent(JSON.parse(e.data)) } catch (_) {} + } + return ws +} + +// ===== 统一账户登录/会话(底座仅保留认证与个人密码,管理走中心机控制面) ===== +export async function adminMe() { + return j('/api/admin/me') +} +export async function adminLogin(account, password) { + return j('/api/admin/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ account, password }) }) +} +// v3 钉钉直连接登录:生成钉钉授权 URL(redirect_uri=本机 /auth/done),前端当前窗口跳转到该 URL +export async function authDingtalk() { + return j('/api/auth/dingtalk') +} +export async function adminLogout() { + return j('/api/admin/logout', { method: 'POST' }) +} +export async function adminPassword(body) { + return j('/api/admin/password', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }) +} +export async function adminAvatarUpload(file) { + const fd = new FormData() + fd.append('file', file) + return j('/api/avatar', { method: 'POST', body: fd }) +} \ No newline at end of file diff --git a/desktop/electron-shell/frontend/src/components/ChangePasswordDialog.vue b/desktop/electron-shell/frontend/src/components/ChangePasswordDialog.vue new file mode 100644 index 0000000..0441a19 --- /dev/null +++ b/desktop/electron-shell/frontend/src/components/ChangePasswordDialog.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/desktop/electron-shell/frontend/src/components/HomePage.vue b/desktop/electron-shell/frontend/src/components/HomePage.vue new file mode 100644 index 0000000..43dde79 --- /dev/null +++ b/desktop/electron-shell/frontend/src/components/HomePage.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/desktop/electron-shell/frontend/src/components/LogPanel.vue b/desktop/electron-shell/frontend/src/components/LogPanel.vue new file mode 100644 index 0000000..7ac039c --- /dev/null +++ b/desktop/electron-shell/frontend/src/components/LogPanel.vue @@ -0,0 +1,173 @@ + + + + + \ No newline at end of file diff --git a/desktop/electron-shell/frontend/src/components/LoginPage.vue b/desktop/electron-shell/frontend/src/components/LoginPage.vue new file mode 100644 index 0000000..e5bfefa --- /dev/null +++ b/desktop/electron-shell/frontend/src/components/LoginPage.vue @@ -0,0 +1,653 @@ + + + + + diff --git a/desktop/electron-shell/frontend/src/components/PlatformAccounts.vue b/desktop/electron-shell/frontend/src/components/PlatformAccounts.vue new file mode 100644 index 0000000..87b7bf5 --- /dev/null +++ b/desktop/electron-shell/frontend/src/components/PlatformAccounts.vue @@ -0,0 +1,163 @@ + + + + + diff --git a/desktop/electron-shell/frontend/src/components/PluginPage.vue b/desktop/electron-shell/frontend/src/components/PluginPage.vue new file mode 100644 index 0000000..8621173 --- /dev/null +++ b/desktop/electron-shell/frontend/src/components/PluginPage.vue @@ -0,0 +1,685 @@ + + + + + diff --git a/desktop/electron-shell/frontend/src/components/ScenesPage.vue b/desktop/electron-shell/frontend/src/components/ScenesPage.vue new file mode 100644 index 0000000..1db7fc5 --- /dev/null +++ b/desktop/electron-shell/frontend/src/components/ScenesPage.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/desktop/electron-shell/frontend/src/components/SchedulePage.vue b/desktop/electron-shell/frontend/src/components/SchedulePage.vue new file mode 100644 index 0000000..ae46cb5 --- /dev/null +++ b/desktop/electron-shell/frontend/src/components/SchedulePage.vue @@ -0,0 +1,628 @@ + + + + + diff --git a/desktop/electron-shell/frontend/src/main.js b/desktop/electron-shell/frontend/src/main.js new file mode 100644 index 0000000..513aa66 --- /dev/null +++ b/desktop/electron-shell/frontend/src/main.js @@ -0,0 +1,97 @@ +import { createApp } from 'vue' +import ElementPlus from 'element-plus' +import zhCn from 'element-plus/es/locale/lang/zh-cn' +import * as ElementPlusIconsVue from '@element-plus/icons-vue' +import 'element-plus/dist/index.css' +import App from './App.vue' +import './style.css' + +const app = createApp(App) +// 全量注册图标,模板中可直接 使用 +for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) +} +app.use(ElementPlus, { locale: zhCn }).mount('#app') + +/* ============================================================ + 皮肤(skin):只切 token,不改组件。 + precision = 冷灰 + 压深天蓝的精密工作台(默认) + cream = 奶油极简治愈风(旧皮肤,保留可切换) + 切换:localStorage['37du.skin'] = 'precision' | 'cream' + ============================================================ */ +const SKIN_KEY = '37du.skin' +const SKINS = ['cream', 'precision'] + +function initSkin() { + let skin = 'precision' + try { skin = localStorage.getItem(SKIN_KEY) || 'precision' } catch (_) { /* 隐私模式等 */ } + if (!SKINS.includes(skin)) skin = 'precision' + document.documentElement.dataset.skin = skin +} + +// 在挂载前应用,避免首屏闪一下默认皮肤 +initSkin() + +/* ============================================================ + 奶油涂鸦装饰层:fixed 浮于页面顶层,仅视觉点缀。 + 可开关:localStorage['37du.doodles'] = 'off'(登录页顶部 ✿ 按钮同源) + 注意:涂鸦是奶油皮肤专属装饰,precision 皮肤下由 CSS 整体隐藏。 + ============================================================ */ +const DOODLES = { + squiggle: + '' + + '' + + '', + cloud: + '' + + '', + sparkles: + '' + + '' + + '' + + '', + heart: + '' + + '', + plant: + '' + + '' + + '' + + '', + sun: + '' + + '' + + '' + + '', +} + +function initDoodles() { + if (document.getElementById('dsh-doodles')) return + const wrap = document.createElement('div') + wrap.id = 'dsh-doodles' + // [类型, left, top, 水平翻转] + const spots = [ + ['squiggle', '6%', '12%', false], + ['cloud', '88%', '8%', false], + ['sun', '93%', '40%', false], + ['sparkles', '78%', '66%', false], + ['heart', '5%', '68%', false], + ['plant', '13%', '36%', true], + ] + for (const [name, left, top, flip] of spots) { + const el = document.createElement('span') + el.className = 'doodle' + el.style.left = left + el.style.top = top + el.innerHTML = DOODLES[name] || DOODLES.sparkles + if (flip) el.querySelector('svg').style.transform = 'scaleX(-1)' + wrap.appendChild(el) + } + document.body.appendChild(wrap) + let on = 'on' + try { on = localStorage.getItem('37du.doodles') || 'on' } catch (_) {} + document.documentElement.classList.toggle('no-doodles', on === 'off') +} + +// 应用挂载后注入(body 已存在),不阻塞首屏 +initDoodles() \ No newline at end of file diff --git a/desktop/electron-shell/frontend/src/store.js b/desktop/electron-shell/frontend/src/store.js new file mode 100644 index 0000000..82245ff --- /dev/null +++ b/desktop/electron-shell/frontend/src/store.js @@ -0,0 +1,125 @@ +import { reactive } from 'vue' + +export const store = reactive({ + appName: '', + platforms: [], + plugins: [], + selectedId: '', + logs: [], // {time, level, msg} + progress: 0, + running: false, + currentRun: '', // 当前接收日志/进度的 run_id + lastRunId: '', // 最近一次执行的 run_id + lastResult: null, // {ok, error} + lastSummary: '', // 完成时后端返回的摘要 + wsOn: false, + // 个人身份信息(中心机 accounts,登录/会话校验回填) + dept: '', + nickname: '', // 真实姓名(中心机 accounts.nickname,钉钉登录时自动带入) + avatar: '', // 账号头像文件名(中心机 accounts.avatar,用户上传) + avatarUrl: '', // 在线头像(localStorage 缓存,避免每次刷新都请求) + current: (() => { try { return localStorage.getItem('cp_account') || '' } catch (_) { return '' } })(), + // 当前主视图(Run-centric 三栏:总览 / 运行台 / 计划) + // overview 总览(工作台首页)· run 运行台(单场景执行)· plans 计划(定时任务) + view: 'overview', + authExpired: false, // 授权票据已过期(最长离线 7 天),须联网刷新才能继续使用 + license: null, // 授权票据概要 {status, expire_ts, expire_at, days_left}(/api/meta 下发,供状态栏展示) + recents: [], // 最近运行记录(run_done 时追加):{pluginId, runId, ok, error, time, name} + _runPlugins: {}, // run_id → plugin_id(run_start 登记,run_done 消费) + pendingReplay: null, // 活动流点击最近运行 → 运行台回看:{pluginId, runId}(PluginPage 消费后清空) +}) + +// ===== 在线头像:优先读缓存,无缓存时请求接口并落盘;图片加载失败时清除缓存重新拉取 ===== +// 缓存按账号隔离(cp_avatar_url_<账号>),切换账号不会串用上一个人的头像 +const AVATAR_API = 'https://v2.xxapi.cn/api/head' + +function avatarCacheKey() { + return `cp_avatar_url_${store.current || 'anon'}` +} + +export function loadAvatar() { + const key = avatarCacheKey() + try { + const cached = localStorage.getItem(key) + if (cached) { store.avatarUrl = cached; return } + } catch (_) {} + store.avatarUrl = '' + fetch(AVATAR_API, { signal: AbortSignal.timeout(4000) }) + .then((r) => r.json()) + .then((j) => { + if (j && j.code === 200 && j.data) { + store.avatarUrl = j.data + try { localStorage.setItem(avatarCacheKey(), j.data) } catch (_) {} + } + }) + .catch(() => { /* 网络不可达/超时:保持首字符色块兜底 */ }) +} + +export function clearAvatarCache() { + store.avatarUrl = '' + try { localStorage.removeItem(avatarCacheKey()) } catch (_) {} + loadAvatar() +} + +// 头像优先级:账号上传头像(中心机) > 外部随机头像 > 首字符兜底 +export function accountAvatar() { + if (store.avatar) { + return `/api/avatar/${store.current}?v=${encodeURIComponent(store.avatar)}` + } + return store.avatarUrl +} + +export function clearLogs() { + store.logs = [] + store.lastResult = null + store.lastSummary = '' +} + +export function log(level, msg) { + const time = new Date().toLocaleTimeString('zh-CN', { hour12: false }) + store.logs.push({ time, level, msg }) + if (store.logs.length > 500) store.logs.splice(0, store.logs.length - 500) +} + +export function handleEvent(ev) { + switch (ev.t) { + case 'run_start': + store.currentRun = ev.run_id + store._runPlugins[ev.run_id] = ev.plugin_id || '' + // 运行态由事件驱动:定时任务触发的运行没有本地点击,必须靠 run_start 点亮 + // (设备级单活,同时只会有一个 run)。日志归属本次运行,故开始时清空。 + clearLogs() + store.running = true + store.progress = 0 + break + case 'log': + if (ev.run_id === store.currentRun || !store.currentRun) { + log(ev.level || 'INFO', ev.msg) + } + break + case 'progress': + if (ev.run_id === store.currentRun) store.progress = ev.pct + break + case 'run_done': + store.running = false + store.progress = 100 + store.lastResult = { ok: ev.ok, error: ev.error || '' } + if (ev.ok) log('INFO', '===== 执行完成 =====') + else log('ERROR', `执行失败:${ev.error}`) + store.currentRun = '' + // 最近运行记录(供总览首页展示) + const pid = store._runPlugins[ev.run_id] || '' + delete store._runPlugins[ev.run_id] + const rec = { + pluginId: pid, + runId: ev.run_id || '', + name: (store.plugins.find((p) => p.id === pid) || {}).name || pid || '未知场景', + ok: !!ev.ok, + error: ev.error || '', + time: new Date().toLocaleTimeString('zh-CN', { hour12: false }), + } + store.recents.unshift(rec) + if (store.recents.length > 8) store.recents.pop() + break + } +} \ No newline at end of file diff --git a/desktop/electron-shell/frontend/src/style.css b/desktop/electron-shell/frontend/src/style.css new file mode 100644 index 0000000..604c40c --- /dev/null +++ b/desktop/electron-shell/frontend/src/style.css @@ -0,0 +1,429 @@ +/* ============ 37du 执行机壳 · 设计令牌(token 层) ============ + 规则:组件内**只允许**引用这里的 token,不写字面色值(rgba 一律走 --*-rgb 变量)。 + 换肤只需在 [data-skin="..."] 里重映射同名 token,组件代码零改动。 + 默认皮肤 = cream(奶油极简治愈风,现状像素级不变)。 + ============================================================ */ +:root { + /* ---- 基础 ---- */ + --bg: #F9F7F2; + --bg-grad: radial-gradient(1200px 720px at 50% -8%, #FDFCF8 0%, #F9F7F2 55%, #F4F1EA 100%); + --surface: #ffffff; + --surface-2: #F6F3EC; + --surface-3: #FDFCF9; /* 输入框底 */ + --surface-glow: #FBFDFF; /* 卡片高亮底(运行中/渐变收尾) */ + --border: #EFE9DE; + --border-strong: #E0D9C9; + --border-warm: #E7E0D2; /* 登录页卡片描边 */ + --border-warm-2: #F1ECE2; /* 更浅一级描边 */ + --border-hover: #D6CFC0; + --row-hover: #F8F5EF; /* 日志行 hover */ + --track: #EDE7DB; /* 进度条底槽 */ + --scrollbar: #DED7C8; + --scrollbar-hover: #CCC4B2; + + --text: #222222; + --text-sub: #666666; + --text-faint: #9C9589; + --text-warm-sub: #5B5B5B; + --text-warm-faint: #8A8377; + --text-muted-warm: #C4B89E; /* 未登录/未配置的弱提示 */ + --text-disabled: #C9C2B4; + --placeholder: #B5AD9D; + --on-primary: #ffffff; /* 主色/渐变底上的前景 */ + --text-rgb: 34, 34, 34; + --on-primary-rgb: 255, 255, 255; + + --primary: #7CC3E8; /* 浅天蓝 · 辅助强调色 */ + --primary-2: #A8D8F2; + --primary-rgb: 124, 195, 232; + --primary-grad: linear-gradient(135deg, #92D1F0 0%, #6FBAE6 100%); + --primary-grad-2: linear-gradient(135deg, #8FD0F0 0%, #6FBAE6 100%); + --primary-grad-3: linear-gradient(135deg, #9BD1EE, #7CC3E8); + --primary-strong: #5FAFD9; + --primary-hover: #6FBAE6; /* 主按钮 hover 底(纯色,与渐变收尾同色) */ + --primary-soft: #9BD1EE; + --primary-line: #BFE2F4; + --primary-weak: #EFF7FC; + --primary-weak-2: #E3F1FA; + --primary-tint: #F4FAFD; + --primary-disabled: #C9E6F5; + + --ok: #5BBE96; + --ok-weak: #E9F7F0; + --ok-text: #3F9E77; + --ok-text-2: #1a8f63; + --ok-rgb: 91, 190, 150; + --ok-rgb-2: 34, 176, 122; + --err: #E58B8B; + --err-weak: #FBF0F0; + --err-rgb: 229, 139, 139; + --danger: #e5484d; /* 对话框错误文案(比 --err 更重的红) */ + --warn: #E0A85C; + --warn-weak: #FBF3E3; + --warn-bg: #FFF4E5; + --warn-text: #9A5B14; + --warn-rgb: 224, 122, 40; + --warn-icon-rgb: 247, 162, 58; + + /* ---- 场景磁贴 / 装饰 ---- */ + --tile-fg: #ffffff; /* 磁贴前景(皮肤若改用淡色底需同步改这个) */ + --tile-faint-bg: #E3DED2; + --dot-off: #c6ccdc; + --dot-muted: #D0C9BA; + --sep-warm: #CFC8B8; + --switch-off: #D8D0BF; + --badge-warm-text: #A08F6F; + --badge-warm-bg: #FBF7EE; + --badge-warm-border: #EFE4CB; + --badge-off-text: #B09E7E; + --badge-dot: #C9BFA6; + --border-strong-rgb: 224, 217, 201; + --chrome-rgb: 74, 140, 247; + --chrome-icon: radial-gradient(circle at 30% 30%, #e6f2ff, #4a8cf7 55%, #2b6be0); + --chrome-icon-warn: radial-gradient(circle at 30% 30%, #fff6e6, #f7a23a 55%, #e07324); + --hero-grad: linear-gradient(120deg, #FFFFFF 0%, #FBFDFF 55%, #F7FBFE 100%); + --profile-head-grad: linear-gradient(135deg, #dfe7ff 0%, #eef2ff 55%, #f6f8ff 100%); + --surface-cool: #f6f8fd; + --surface-cool-2: #fafbfe; + + /* ---- 阴影:仅极柔和浅阴影 ---- */ + --shadow-sm: 0 1px 3px rgba(var(--text-rgb), .05), 0 2px 10px -4px rgba(var(--text-rgb), .06); + --shadow-md: 0 8px 24px -14px rgba(var(--text-rgb), .14); + --shadow-lift: 0 14px 34px -16px rgba(var(--text-rgb), .18); + + /* ---- 圆角:全局大圆角 ---- */ + --radius: 16px; + --radius-sm: 11px; + + /* ---- 字体:正文无衬线 Inter;标题可用圆润手写装饰字体 ---- */ + --mono: "JetBrains Mono", "Consolas", "Courier New", monospace; + --font-mono: "JetBrains Mono", "Consolas", "Courier New", monospace; + --font-body: "Inter", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", -apple-system, sans-serif; + --font-doodle: "Segoe Script", "Comic Sans MS", "KaiTi", "STKaiti", "cursive"; + + /* ---- element-plus 主题与浅天蓝统一 ---- */ + --el-color-primary: #7CC3E8; + --el-color-primary-light-3: #9BD1EE; + --el-color-primary-light-5: #BFE2F4; + --el-color-primary-light-7: #DCEFF9; + --el-color-primary-light-8: #E9F5FB; + --el-color-primary-light-9: #F4FAFD; + --el-color-primary-dark-2: #5FAFD9; + --el-border-radius-base: 12px; + --el-border-radius-small: 10px; + --el-border-radius-round: 999px; + --el-box-shadow: 0 8px 24px -16px rgba(var(--text-rgb), .14); + --el-box-shadow-light: 0 6px 18px -14px rgba(var(--text-rgb), .10); + + /* ---- 产品级排版/间距/动效 ---- */ + --radius-lg: 22px; + --space-1: 4px; + --space-2: 8px; + --space-3: 12px; + --space-4: 16px; + --space-5: 20px; + --space-6: 28px; + --dur: .18s; + --ease: cubic-bezier(.22, 1, .36, 1); + --grad-sky: linear-gradient(135deg, #A8D8F2, #7CC3E8); + --grad-peach: linear-gradient(135deg, #F2C9B8, #E8A98E); + --grad-mint: linear-gradient(135deg, #C9E6BB, #9BC88F); + --grad-lilac: linear-gradient(135deg, #D9C7F0, #B79AE3); + --grad-honey: linear-gradient(135deg, #F7D9A0, #EFBE6B); + --grad-blush: linear-gradient(135deg, #F2B8C6, #E48E9F); +} + +/* ============================================================ + 皮肤 · precision(冷灰 + 压深天蓝的"精密工作台") + —— 只是 token 重映射的**首版脚手架**,用于后续「双皮肤同页对比」评审; + 尚未做像素级打磨,也不改变任何组件代码。默认不启用: + 启用方式 = (localStorage['37du.skin'])。 + ============================================================ */ +[data-skin="precision"] { + --bg: #F4F6F9; + --bg-grad: #F4F6F9; /* 冷灰画布:去掉奶油径向渐变 */ + --surface: #FFFFFF; + --surface-2: #F1F4F8; + --surface-3: #FFFFFF; + --surface-glow: #F8FAFC; + --border: #E4E9F0; + --border-strong: #CDD6E1; + --border-warm: #E4E9F0; + --border-warm-2: #EEF2F7; + --border-hover: #CDD6E1; + --row-hover: #F1F4F8; + --track: #E4E9F0; + --scrollbar: #CBD5E1; + --scrollbar-hover: #94A3B8; + + --text: #182230; + --text-sub: #5A6674; + --text-faint: #7C8896; + --text-warm-sub: #5A6674; + --text-warm-faint: #7C8896; + --text-muted-warm: #7C8896; + --text-disabled: #A8B3C1; + --placeholder: #94A3B8; + --on-primary: #FFFFFF; + --text-rgb: 15, 23, 42; + --on-primary-rgb: 255, 255, 255; + + --primary: #1E6FA8; + --primary-2: #3E93CF; + --primary-rgb: 30, 111, 168; + --primary-grad: #17608F; /* 皮肤可把渐变 token 设成纯色 */ + --primary-grad-2: #1E6FA8; + --primary-grad-3: #3E93CF; + --primary-strong: #17608F; + --primary-hover: #1E6FA8; + --primary-soft: #3E93CF; + --primary-line: #CDD6E1; + --primary-weak: #E9F2FA; + --primary-weak-2: #E9F2FA; + --primary-tint: #E9F2FA; + --primary-disabled: #BFD8EA; + + /* element-plus 主题同步(否则表单/表格等内置组件会残留奶油浅蓝) */ + --el-color-primary: #1E6FA8; + --el-color-primary-light-3: #3E93CF; + --el-color-primary-light-5: #7FB4D8; + --el-color-primary-light-7: #BFD8EA; + --el-color-primary-light-8: #D9E8F4; + --el-color-primary-light-9: #E9F2FA; + --el-color-primary-dark-2: #17608F; + + --ok: #1F8A4C; + --ok-weak: #E7F5EC; + --ok-text: #1F8A4C; + --ok-text-2: #1F8A4C; + --ok-rgb: 31, 138, 76; + --ok-rgb-2: 31, 138, 76; + --err: #D64545; + --err-weak: #FBEBEB; + --err-rgb: 214, 69, 69; + --danger: #D64545; + --warn: #B26B00; + --warn-weak: #FBF3E0; + --warn-bg: #FBF3E0; + --warn-text: #B26B00; + --warn-rgb: 178, 107, 0; + --warn-icon-rgb: 178, 107, 0; + + /* 场景磁贴:淡色底 + 同色系前景(v2 的 tile 风格),故前景不能再用白色 */ + --tile-fg: #1E6FA8; + --grad-sky: #E9F2FA; + --grad-peach: #FBF3E0; + --grad-mint: #E7F5EC; + --grad-lilac: #EFEAF7; + --grad-honey: #FBF3E0; + --grad-blush: #FBEBEB; + --tile-faint-bg: #E9EDF3; + --dot-off: #CBD5E1; + --dot-muted: #CBD5E1; + --sep-warm: #CDD6E1; + --switch-off: #CBD5E1; + --badge-warm-text: #B26B00; + --badge-warm-bg: #FBF3E0; + --badge-warm-border: #E7C88F; + --badge-off-text: #7C8896; + --badge-dot: #CBD5E1; + --border-strong-rgb: 205, 214, 225; + --chrome-rgb: 74, 140, 247; + --hero-grad: #FFFFFF; + --profile-head-grad: #F1F4F8; + --surface-cool: #F1F4F8; + --surface-cool-2: #F8FAFC; + + --radius: 12px; + --radius-sm: 8px; + --radius-lg: 14px; + --shadow-sm: 0 1px 2px rgba(var(--text-rgb), .05); + --shadow-md: 0 8px 24px -12px rgba(var(--text-rgb), .14); + --shadow-lift: 0 14px 34px -16px rgba(var(--text-rgb), .18); + + /* 精密工作台不用手写装饰字体 */ + --font-doodle: var(--font-body); +} + +/* 涂鸦层是奶油皮肤专属装饰,换肤时整体关闭(同一开关也支持手动 off) */ +html[data-skin="precision"] .doodle { display: none; } + +* { box-sizing: border-box; } +html, body, #app { height: 100%; margin: 0; } + +body { + font-family: var(--font-body); + font-size: 13px; + color: var(--text); + background: var(--bg); + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; +} +.__app { + height: 100%; + background: var(--bg-grad); + padding: 16px 18px 18px; + display: flex; + flex-direction: column; +} + +/* 滚动条(柔和) */ +::-webkit-scrollbar { width: 10px; height: 10px; } +::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; } +::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); background-clip: content-box; border: 2px solid transparent; } +::-webkit-scrollbar-track { background: transparent; } + +/* 通用白卡:大圆角 + 极柔和阴影 + hover 轻微上浮 */ +.panel { + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius); + box-shadow: var(--shadow-sm); + transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; +} +.panel:hover { + transform: translateY(-3px); + box-shadow: var(--shadow-md); + border-color: var(--border-strong); +} + +/* 分节标题 */ +.sec-title { + font-size: 11px; + font-weight: 700; + letter-spacing: 0.05em; + text-transform: uppercase; + color: var(--text-faint); +} + +/* 白底圆角卡(通用卡片:总览首页统计/场景/最近动态等) */ +.card { + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius); + box-shadow: var(--shadow-sm); +} + +/* 按钮 */ +.btn { + border: 1px solid var(--border-strong); + background: var(--surface); + color: var(--text-sub); + border-radius: 12px; + padding: 7px 16px; + font-size: 13px; + font-family: inherit; + cursor: pointer; + transition: all .15s ease; +} +.btn:hover { color: var(--text); border-color: var(--border-hover); background: var(--surface-2); } +.btn:active { transform: translateY(1px); } +.btn:disabled { color: var(--text-disabled); border-color: var(--border); background: var(--surface-2); cursor: not-allowed; transform: none; } + +.btn.primary { + background: var(--primary-grad); + color: var(--on-primary); + border: 1px solid transparent; + font-weight: 600; + box-shadow: 0 6px 16px -6px rgba(var(--primary-rgb), .6); +} +.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 22px -8px rgba(var(--primary-rgb), .7); color: var(--on-primary); } +.btn.primary:disabled { background: var(--primary-disabled); box-shadow: none; } + +/* 输入 / 选择 */ +.input { + height: 34px; + border: 1px solid var(--border-strong); + border-radius: 11px; + background: var(--surface); + color: var(--text); + padding: 0 12px; + font-size: 13px; + font-family: inherit; + outline: none; + transition: border-color .15s, box-shadow .15s; +} +.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); } +select.input { padding-right: 30px; appearance: none; cursor: pointer; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239C9589' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); + background-repeat: no-repeat; background-position: right 10px center; } +.field-label { color: var(--text-sub); font-size: 13px; } + +/* 进度条 */ +.progress { height: 8px; width: 180px; background: var(--track); border-radius: 999px; overflow: hidden; } +.progress > div { height: 100%; border-radius: 999px; + background: var(--primary-grad); + transition: width .25s ease; + box-shadow: 0 0 6px rgba(var(--primary-rgb),.5); } + +/* 日志 */ +.log-box { + font-family: var(--mono); + font-size: 12px; + line-height: 1.75; + color: var(--text); + padding: 12px 14px; + overflow: auto; + white-space: pre-wrap; + word-break: break-all; + flex: 1 1 auto; /* 在 .log-wrap 里填满剩余高度并自己滚 */ + min-height: 0; +} +.log-line:hover { background: var(--row-hover); } +.log-box .t { color: var(--text-faint); margin-right: 10px; user-select: none; } +.log-box .lv { margin-right: 6px; font-weight: 700; } +.log-box .s-INFO { color: var(--primary); } +.log-box .s-ERROR { color: var(--err); } +.log-box .s-WARN { color: var(--warn); } + +/* 过渡 */ +.fade-enter-active, .fade-leave-active { transition: opacity .18s ease, transform .18s ease; } +.fade-enter-from { opacity: 0; transform: translateY(4px); } +.fade-leave-to { opacity: 0; } + +/* ============================================================ + 产品级通用元素:分节标题(更大更清晰)/ 空状态 + ============================================================ */ +.page-title { + font-size: 20px; + font-weight: 700; + color: var(--text); + letter-spacing: .01em; +} +.page-sub { + font-size: 12.5px; + color: var(--text-sub); + line-height: 1.7; +} +.empty-note { + color: var(--text-faint); + text-align: center; + padding: 40px 20px; + font-size: 12.5px; + line-height: 2; + flex-shrink: 0; +} +.empty-note b { color: var(--text-sub); font-weight: 600; } + + +/* ============================================================ + 手绘涂鸦装饰层:fixed 浮于页面顶层,仅视觉点缀, + 不参与流式布局、不拦截交互;html.no-doodles 整体关闭 + ============================================================ */ +.doodle { + position: fixed; + pointer-events: none; + user-select: none; + z-index: 9999; + opacity: .55; + filter: drop-shadow(0 2px 3px rgba(var(--text-rgb), .06)); + animation: doodleFloat 7s ease-in-out infinite; +} +html.no-doodles .doodle { display: none; } +@keyframes doodleFloat { + 0%, 100% { transform: translateY(0) rotate(-1deg); } + 50% { transform: translateY(-8px) rotate(1.5deg); } +} +@media (prefers-reduced-motion: reduce) { + .doodle { animation: none; } +} diff --git a/desktop/electron-shell/frontend/vite.config.js b/desktop/electron-shell/frontend/vite.config.js new file mode 100644 index 0000000..8fbb8b0 --- /dev/null +++ b/desktop/electron-shell/frontend/vite.config.js @@ -0,0 +1,20 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' + +// dev 时把 /api 与 /ws 代理到 FastAPI 后端,实现前后端分离开发 +export default defineConfig({ + plugins: [vue()], + server: { + port: 5173, + strictPort: true, + proxy: { + '/api': { target: 'http://127.0.0.1:8799', changeOrigin: true }, + '/ws': { target: 'ws://127.0.0.1:8799', ws: true }, + }, + }, + build: { + // 构建产物直接输出到壳的渲染层目录(Electron 壳/CLI 服务以此为前端根) + outDir: '../renderer/dist', + emptyOutDir: true, + }, +}) \ No newline at end of file diff --git a/desktop/electron-shell/package-lock.json b/desktop/electron-shell/package-lock.json new file mode 100644 index 0000000..1a5e951 --- /dev/null +++ b/desktop/electron-shell/package-lock.json @@ -0,0 +1,4168 @@ +{ + "name": "37du-electron-shell", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "37du-electron-shell", + "version": "1.0.0", + "dependencies": { + "adm-zip": "^0.5.18", + "better-sqlite3": "^13.0.3", + "ws": "^8.21.3" + }, + "devDependencies": { + "electron": "^30.5.1", + "electron-builder": "^24.13.3" + } + }, + "node_modules/@develar/schema-utils": { + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/@develar/schema-utils/-/schema-utils-2.6.5.tgz", + "integrity": "sha512-0cp4PsWQ/9avqTVMCtZ+GirikIA36ikvjtHweU4/j8yLtgObI0+JUPhYFScgwlteveGB1rt3Cm8UhN04XayDig==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.0", + "ajv-keywords": "^3.4.1" + }, + "engines": { + "node": ">= 8.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/@electron/asar": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.4.1.tgz", + "integrity": "sha512-i4/rNPRS84t0vSRa2HorerGRXWyF4vThfHesw0dmcWHp+cspK743UanA0suA5Q5y8kzY2y6YKrvbIUn69BCAiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "commander": "^5.0.0", + "glob": "^7.1.6", + "minimatch": "^3.0.4" + }, + "bin": { + "asar": "bin/asar.js" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/@electron/asar/node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@electron/asar/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@electron/get": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.3.tgz", + "integrity": "sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "env-paths": "^2.2.0", + "fs-extra": "^8.1.0", + "got": "^11.8.5", + "progress": "^2.0.3", + "semver": "^6.2.0", + "sumchecker": "^3.0.1" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "global-agent": "^3.0.0" + } + }, + "node_modules/@electron/notarize": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.2.1.tgz", + "integrity": "sha512-aL+bFMIkpR0cmmj5Zgy0LMKEpgy43/hw5zadEArgmAMWWlKc5buwFvFT9G/o/YJkvXAJm5q3iuTuLaiaXW39sg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^9.0.1", + "promise-retry": "^2.0.1" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@electron/notarize/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/notarize/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@electron/notarize/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@electron/osx-sign": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@electron/osx-sign/-/osx-sign-1.0.5.tgz", + "integrity": "sha512-k9ZzUQtamSoweGQDV2jILiRIHUu7lYlJ3c6IEmjv1hC17rclE+eb9U+f6UFlOOETo0JzY1HNlXy4YOlCvl+Lww==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "compare-version": "^0.1.2", + "debug": "^4.3.4", + "fs-extra": "^10.0.0", + "isbinaryfile": "^4.0.8", + "minimist": "^1.2.6", + "plist": "^3.0.5" + }, + "bin": { + "electron-osx-flat": "bin/electron-osx-flat.js", + "electron-osx-sign": "bin/electron-osx-sign.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@electron/osx-sign/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@electron/osx-sign/node_modules/isbinaryfile": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", + "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, + "node_modules/@electron/osx-sign/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@electron/osx-sign/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@electron/universal": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.5.1.tgz", + "integrity": "sha512-kbgXxyEauPJiQQUNG2VgUeyfQNFk6hBF11ISN2PNI6agUgPl55pv4eQmaqHzTAzchBvqZ2tQuRVaPStGf0mxGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@electron/asar": "^3.2.1", + "@malept/cross-spawn-promise": "^1.1.0", + "debug": "^4.3.1", + "dir-compare": "^3.0.0", + "fs-extra": "^9.0.1", + "minimatch": "^3.0.4", + "plist": "^3.0.4" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/@electron/universal/node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@electron/universal/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/universal/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@electron/universal/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@electron/universal/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", + "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/@malept/cross-spawn-promise": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz", + "integrity": "sha512-RTBGWL5FWQcg9orDOCcp4LvItNzUPcyEU9bwaeJX0rJ1IQxzucC48Y0/sQLp/g6t99IQgAlGIaesJS+gTn7tVQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/malept" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund" + } + ], + "license": "Apache-2.0", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@malept/flatpak-bundler": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@malept/flatpak-bundler/-/flatpak-bundler-0.4.0.tgz", + "integrity": "sha512-9QOtNffcOF/c1seMCDnjckb3R9WHcG34tky+FHpNKKCW0wc/scYLwMtO+ptyGUfMW0/b/n4qRiALlaFHc9Oj7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^9.0.0", + "lodash": "^4.17.15", + "tmp-promise": "^3.0.2" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@malept/flatpak-bundler/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@malept/flatpak-bundler/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@malept/flatpak-bundler/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "dev": true, + "license": "MIT", + "dependencies": { + "defer-to-connect": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@tootallnate/once": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.1.tgz", + "integrity": "sha512-HqmEUIGRJ5fSXchkVgR5F7qn48bDBzv0kWj/Kfu5e6uci4UlEeng4331LnBkWffb++Ei3FOVLxo8JJWMFBDMeQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-cache-semantics": "*", + "@types/keyv": "^3.1.4", + "@types/node": "*", + "@types/responselike": "^1.0.0" + } + }, + "node_modules/@types/debug": { + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/fs-extra": { + "version": "9.0.13", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", + "integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-L3LgimLHXtGkWikKnsPg0/VFx9OGZaC+eN1u4r+OB1XRqH3meBIAVC2zr1WdMH+RHmnRkqliQAOHNJ/E0j/e0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "20.19.43", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz", + "integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/plist": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.5.tgz", + "integrity": "sha512-E6OCaRmAe4WDmWNsL/9RMqdkkzDCY1etutkflWk4c+AcjDU07Pcz1fQwTX0TQz+Pxqn9i4L1TU3UFpjnrcDgxA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*", + "xmlbuilder": ">=11.0.1" + } + }, + "node_modules/@types/responselike": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz", + "integrity": "sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/verror": { + "version": "1.10.11", + "resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.11.tgz", + "integrity": "sha512-RlDm9K7+o5stv0Co8i8ZRGxDbrTxhJtgjqjFyVh/tXQyl/rYtTKlnTvZ88oSTeYREWurwx20Js4kTuKCsFkUtg==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@xmldom/xmldom": { + "version": "0.9.12", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.12.tgz", + "integrity": "sha512-5AXjrcMClTryPe9LgZrygpB1lj7s0S9E0+W+AHaVKAVyHanafK86iPSvG5xHVSp/jC+VH1UXu0TAEmY279xH7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.6" + } + }, + "node_modules/7zip-bin": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-5.2.0.tgz", + "integrity": "sha512-ukTPVhqG4jNzMro2qA9HSCSSVJN3aN7tlb+hfqYCt3ER0yWroeA2VR38MNrOHLQ/cVj+DaIMad0kFCtWWowh/A==", + "dev": true, + "license": "MIT" + }, + "node_modules/adm-zip": { + "version": "0.5.18", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.18.tgz", + "integrity": "sha512-ufJnssQGbxzLNS1Ho9bCtX4rQKCCvoVuDLHoJyc3F9dOGDB4BkWs2Ci0kv53lqocAEQ/Cbi+I2XCsNYGqVYqng==", + "license": "MIT", + "engines": { + "node": ">=12.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/app-builder-bin": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-4.0.0.tgz", + "integrity": "sha512-xwdG0FJPQMe0M0UA4Tz0zEB8rBJTRA5a476ZawAqiBkMv16GRK5xpXThOjMaEOFnZ6zabejjG4J3da0SXG63KA==", + "dev": true, + "license": "MIT" + }, + "node_modules/app-builder-lib": { + "version": "24.13.3", + "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-24.13.3.tgz", + "integrity": "sha512-FAzX6IBit2POXYGnTCT8YHFO/lr5AapAII6zzhQO3Rw4cEDOgK+t1xhLc5tNcKlicTHlo9zxIwnYCX9X2DLkig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@develar/schema-utils": "~2.6.5", + "@electron/notarize": "2.2.1", + "@electron/osx-sign": "1.0.5", + "@electron/universal": "1.5.1", + "@malept/flatpak-bundler": "^0.4.0", + "@types/fs-extra": "9.0.13", + "async-exit-hook": "^2.0.1", + "bluebird-lst": "^1.0.9", + "builder-util": "24.13.1", + "builder-util-runtime": "9.2.4", + "chromium-pickle-js": "^0.2.0", + "debug": "^4.3.4", + "ejs": "^3.1.8", + "electron-publish": "24.13.1", + "form-data": "^4.0.0", + "fs-extra": "^10.1.0", + "hosted-git-info": "^4.1.0", + "is-ci": "^3.0.0", + "isbinaryfile": "^5.0.0", + "js-yaml": "^4.1.0", + "lazy-val": "^1.0.5", + "minimatch": "^5.1.1", + "read-config-file": "6.3.2", + "sanitize-filename": "^1.6.3", + "semver": "^7.3.8", + "tar": "^6.1.12", + "temp-file": "^3.4.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "dmg-builder": "24.13.3", + "electron-builder-squirrel-windows": "24.13.3" + } + }, + "node_modules/app-builder-lib/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/app-builder-lib/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/app-builder-lib/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/app-builder-lib/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/archiver": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.3.2.tgz", + "integrity": "sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "archiver-utils": "^2.1.0", + "async": "^3.2.4", + "buffer-crc32": "^0.2.1", + "readable-stream": "^3.6.0", + "readdir-glob": "^1.1.2", + "tar-stream": "^2.2.0", + "zip-stream": "^4.1.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/archiver-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-2.1.0.tgz", + "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "glob": "^7.1.4", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^2.0.0" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/archiver-utils/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/archiver-utils/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/archiver-utils/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true, + "license": "MIT" + }, + "node_modules/async-exit-hook": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/async-exit-hook/-/async-exit-hook-2.0.1.tgz", + "integrity": "sha512-NW2cX8m1Q7KPA7a5M2ULQeZ2wR5qI5PAbw5L0UOMxdioVk9PMZ0h1TmyZEkPYrCvYjDlFICusOu1dlEKAAeXBw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/better-sqlite3": { + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-13.0.3.tgz", + "integrity": "sha512-RbOBxmLBG8uvFUc15X9+9SFemKcQ0WBuISBVkpuiaUB2qblC8UWlHEjdWVoZ8AdhSwmoEgsiXKfopX0CQxaACQ==", + "license": "MIT", + "dependencies": { + "node-addon-api": "^8.0.0" + }, + "engines": { + "node": ">=22" + } + }, + "node_modules/better-sqlite3/node_modules/node-addon-api": { + "version": "8.9.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.9.2.tgz", + "integrity": "sha512-VijLXbi3UACN69I0JVXJsX4tjACjNoQDgv2gTF6sx2wWEi8tkSg2eX8p5gSIFi8z2+DL3oHmY6OyKce38SDolg==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/bluebird-lst": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/bluebird-lst/-/bluebird-lst-1.0.9.tgz", + "integrity": "sha512-7B1Rtx82hjnSD4PGLAjVWeYH3tHAcVUmChh85a3lltKQm6FresXh9ErQo6oAv6CqxttczC3/kEg8SY5NluPuUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bluebird": "^3.5.5" + } + }, + "node_modules/boolean": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz", + "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/brace-expansion": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz", + "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/buffer-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.1.tgz", + "integrity": "sha512-QoV3ptgEaQpvVwbXdSO39iqPQTCxSF7A5U99AxbHYqUdCizL/lH2Z0A2y6nbZucxMEOtNyZfG2s6gsVugGpKkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/builder-util": { + "version": "24.13.1", + "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-24.13.1.tgz", + "integrity": "sha512-NhbCSIntruNDTOVI9fdXz0dihaqX2YuE1D6zZMrwiErzH4ELZHE6mdiB40wEgZNprDia+FghRFgKoAqMZRRjSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/debug": "^4.1.6", + "7zip-bin": "~5.2.0", + "app-builder-bin": "4.0.0", + "bluebird-lst": "^1.0.9", + "builder-util-runtime": "9.2.4", + "chalk": "^4.1.2", + "cross-spawn": "^7.0.3", + "debug": "^4.3.4", + "fs-extra": "^10.1.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-ci": "^3.0.0", + "js-yaml": "^4.1.0", + "source-map-support": "^0.5.19", + "stat-mode": "^1.0.0", + "temp-file": "^3.4.0" + } + }, + "node_modules/builder-util-runtime": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.4.tgz", + "integrity": "sha512-upp+biKpN/XZMLim7aguUyW8s0FUpDvOtK6sbanMFDAMBzpHDqdhgVYm6zc9HJ6nWo7u2Lxk60i2M6Jd3aiNrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "sax": "^1.2.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/builder-util/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/builder-util/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/builder-util/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.6.0" + } + }, + "node_modules/cacheable-request": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", + "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", + "dev": true, + "license": "MIT", + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/chromium-pickle-js": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz", + "integrity": "sha512-1R5Fho+jBq0DDydt+/vHWj5KJNJCKdARKOCwZUen84I5BreWoLqRLANH1U87eJy1tiASPtMnGqJJq0ZsLoRPOw==", + "dev": true, + "license": "MIT" + }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/clone-response": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/compare-version": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/compare-version/-/compare-version-0.1.2.tgz", + "integrity": "sha512-pJDh5/4wrEnXX/VWRZvruAGHkzKdr46z11OlTPN+VrATlWWhSKewNCJ1futCO5C7eJB3nPMFZA1LeYtcFboZ2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/compress-commons": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.2.tgz", + "integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "buffer-crc32": "^0.2.13", + "crc32-stream": "^4.0.2", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/config-file-ts": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/config-file-ts/-/config-file-ts-0.2.6.tgz", + "integrity": "sha512-6boGVaglwblBgJqGyxm4+xCmEGcWgnWHSWHY5jad58awQhB6gftq0G8HbzU39YqCIYHMLAiL1yjwiZ36m/CL8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob": "^10.3.10", + "typescript": "^5.3.3" + } + }, + "node_modules/config-file-ts/node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/config-file-ts/node_modules/minimatch": { + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/config-file-ts/node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/crc": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", + "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "buffer": "^5.1.0" + } + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/crc32-stream": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.3.tgz", + "integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "crc-32": "^1.2.0", + "readable-stream": "^3.4.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/dir-compare": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-3.3.0.tgz", + "integrity": "sha512-J7/et3WlGUCxjdnD3HAAzQ6nsnc0WL6DD7WcwJb7c39iH1+AWfg+9OqzJNaI6PkBwBvm1mhZNL9iY/nRiZXlPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-equal": "^1.0.0", + "minimatch": "^3.0.4" + } + }, + "node_modules/dir-compare/node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/dir-compare/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/dmg-builder": { + "version": "24.13.3", + "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-24.13.3.tgz", + "integrity": "sha512-rcJUkMfnJpfCboZoOOPf4L29TRtEieHNOeAbYPWPxlaBw/Z1RKrRA86dOI9rwaI4tQSc/RD82zTNHprfUHXsoQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "app-builder-lib": "24.13.3", + "builder-util": "24.13.1", + "builder-util-runtime": "9.2.4", + "fs-extra": "^10.1.0", + "iconv-lite": "^0.6.2", + "js-yaml": "^4.1.0" + }, + "optionalDependencies": { + "dmg-license": "^1.0.11" + } + }, + "node_modules/dmg-builder/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/dmg-builder/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/dmg-builder/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/dmg-license": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/dmg-license/-/dmg-license-1.0.11.tgz", + "integrity": "sha512-ZdzmqwKmECOWJpqefloC5OJy1+WZBBse5+MR88z9g9Zn4VY+WYUkAyojmhzJckH5YbbZGcYIuGAkY5/Ys5OM2Q==", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "dependencies": { + "@types/plist": "^3.0.1", + "@types/verror": "^1.10.3", + "ajv": "^6.10.0", + "crc": "^3.8.0", + "iconv-corefoundation": "^1.1.7", + "plist": "^3.0.4", + "smart-buffer": "^4.0.2", + "verror": "^1.10.0" + }, + "bin": { + "dmg-license": "bin/dmg-license.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dotenv": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-9.0.2.tgz", + "integrity": "sha512-I9OvvrHp4pIARv4+x9iuewrWycX6CcZtoAu1XrzPxc5UygMJXJZYmBsynku8IkrJwgypE5DGNjDPmPRhDCptUg==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=10" + } + }, + "node_modules/dotenv-expand": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", + "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/electron": { + "version": "30.5.1", + "resolved": "https://registry.npmjs.org/electron/-/electron-30.5.1.tgz", + "integrity": "sha512-AhL7+mZ8Lg14iaNfoYTkXQ2qee8mmsQyllKdqxlpv/zrKgfxz6jNVtcRRbQtLxtF8yzcImWdfTQROpYiPumdbw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@electron/get": "^2.0.0", + "@types/node": "^20.9.0", + "extract-zip": "^2.0.1" + }, + "bin": { + "electron": "cli.js" + }, + "engines": { + "node": ">= 12.20.55" + } + }, + "node_modules/electron-builder": { + "version": "24.13.3", + "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-24.13.3.tgz", + "integrity": "sha512-yZSgVHft5dNVlo31qmJAe4BVKQfFdwpRw7sFp1iQglDRCDD6r22zfRJuZlhtB5gp9FHUxCMEoWGq10SkCnMAIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "app-builder-lib": "24.13.3", + "builder-util": "24.13.1", + "builder-util-runtime": "9.2.4", + "chalk": "^4.1.2", + "dmg-builder": "24.13.3", + "fs-extra": "^10.1.0", + "is-ci": "^3.0.0", + "lazy-val": "^1.0.5", + "read-config-file": "6.3.2", + "simple-update-notifier": "2.0.0", + "yargs": "^17.6.2" + }, + "bin": { + "electron-builder": "cli.js", + "install-app-deps": "install-app-deps.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/electron-builder-squirrel-windows": { + "version": "24.13.3", + "resolved": "https://registry.npmjs.org/electron-builder-squirrel-windows/-/electron-builder-squirrel-windows-24.13.3.tgz", + "integrity": "sha512-oHkV0iogWfyK+ah9ZIvMDpei1m9ZRpdXcvde1wTpra2U8AFDNNpqJdnin5z+PM1GbQ5BoaKCWas2HSjtR0HwMg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "app-builder-lib": "24.13.3", + "archiver": "^5.3.1", + "builder-util": "24.13.1", + "fs-extra": "^10.1.0" + } + }, + "node_modules/electron-builder-squirrel-windows/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/electron-builder-squirrel-windows/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/electron-builder-squirrel-windows/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/electron-builder/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/electron-builder/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/electron-builder/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/electron-publish": { + "version": "24.13.1", + "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-24.13.1.tgz", + "integrity": "sha512-2ZgdEqJ8e9D17Hwp5LEq5mLQPjqU3lv/IALvgp+4W8VeNhryfGhYEQC/PgDPMrnWUp+l60Ou5SJLsu+k4mhQ8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/fs-extra": "^9.0.11", + "builder-util": "24.13.1", + "builder-util-runtime": "9.2.4", + "chalk": "^4.1.2", + "fs-extra": "^10.1.0", + "lazy-val": "^1.0.5", + "mime": "^2.5.2" + } + }, + "node_modules/electron-publish/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/electron-publish/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/electron-publish/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true, + "license": "MIT" + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/extsprintf": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz", + "integrity": "sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==", + "dev": true, + "engines": [ + "node >=0.6.0" + ], + "license": "MIT", + "optional": true + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/filelist": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.6.tgz", + "integrity": "sha512-5giy2PkLYY1cP39p17Ech+2xlpTRL9HLspOfEgm0L6CwBXBTgsK5ou0JtzYuepxkaQ/tvhCFIJ5uXo0OrM2DxA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/form-data": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz", + "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.4", + "mime-types": "^2.1.35" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/global-agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz", + "integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "boolean": "^3.0.1", + "es6-error": "^4.1.1", + "matcher": "^3.0.0", + "roarr": "^2.15.3", + "semver": "^7.3.2", + "serialize-error": "^7.0.1" + }, + "engines": { + "node": ">=10.0" + } + }, + "node_modules/global-agent/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "optional": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/got": { + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=10.19.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/iconv-corefoundation": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz", + "integrity": "sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "dependencies": { + "cli-truncate": "^2.1.0", + "node-addon-api": "^1.6.3" + }, + "engines": { + "node": "^8.11.2 || >=10" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-ci": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz", + "integrity": "sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ci-info": "^3.2.0" + }, + "bin": { + "is-ci": "bin.js" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/isbinaryfile": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-5.0.7.tgz", + "integrity": "sha512-gnWD14Jh3FzS3CPhF0AxNOJ8CxqeblPTADzI38r0wt8ZyQl5edpy75myt08EG2oKvpyiqSqsx+Wkz9vtkbTqYQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/jake": { + "version": "10.9.4", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.4.tgz", + "integrity": "sha512-wpHYzhxiVQL+IV05BLE2Xn34zW1S223hvjtqk0+gsPrwd/8JNLXJgZZM/iPFsYc1xyphF+6M6EvdE5E9MBGkDA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "async": "^3.2.6", + "filelist": "^1.0.4", + "picocolors": "^1.1.1" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/lazy-val": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/lazy-val/-/lazy-val-1.0.5.tgz", + "integrity": "sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/lazystream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", + "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "readable-stream": "^2.0.5" + }, + "engines": { + "node": ">= 0.6.3" + } + }, + "node_modules/lazystream/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/lazystream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/lazystream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/lodash.difference": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/lodash.union": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", + "integrity": "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/matcher": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz", + "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "escape-string-regexp": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mime": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz", + "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-addon-api": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", + "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/plist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.1.tgz", + "integrity": "sha512-ZIfcLJC+7E7FBFnDxm9MPmt7D+DidyQ26lewieO75AdhA2ayMtsJSES0iWzqJQbcVRSrTufQoy0DR94xHue0oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@xmldom/xmldom": "^0.9.10", + "base64-js": "^1.5.1", + "xmlbuilder": "^15.1.1" + }, + "engines": { + "node": ">=10.4.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-config-file": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/read-config-file/-/read-config-file-6.3.2.tgz", + "integrity": "sha512-M80lpCjnE6Wt6zb98DoW8WHR09nzMSpu8XHtPkiTHrJ5Az9CybfeQhTJ8D7saeBHpGhLPIVyA8lcL6ZmdKwY6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "config-file-ts": "^0.2.4", + "dotenv": "^9.0.2", + "dotenv-expand": "^5.1.0", + "js-yaml": "^4.1.0", + "json5": "^2.2.0", + "lazy-val": "^1.0.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdir-glob": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", + "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "minimatch": "^5.1.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "lowercase-keys": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/roarr": { + "version": "2.15.4", + "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz", + "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "boolean": "^3.0.1", + "detect-node": "^2.0.4", + "globalthis": "^1.0.1", + "json-stringify-safe": "^5.0.1", + "semver-compare": "^1.0.0", + "sprintf-js": "^1.1.2" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "peer": true + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/sanitize-filename": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.4.tgz", + "integrity": "sha512-9ZyI08PsvdQl2r/bBIGubpVdR3RR9sY6RDiWFPreA21C/EFlQhmgo20UZlNjZMMZNubusLhAQozkA0Od5J21Eg==", + "dev": true, + "license": "WTFPL OR ISC", + "dependencies": { + "truncate-utf8-bytes": "^1.0.0" + } + }, + "node_modules/sax": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz", + "integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=11.0.0" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/serialize-error": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", + "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "type-fest": "^0.13.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/stat-mode": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stat-mode/-/stat-mode-1.0.0.tgz", + "integrity": "sha512-jH9EhtKIjuXZ2cWxmXS8ZP80XyC3iasQxMDV8jzhNJpfDb7VbQLVW4Wvsxz9QZvzV+G4YoSfBUVKDOyxLzi/sg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sumchecker": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz", + "integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.1.0" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "deprecated": "Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/temp-file": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/temp-file/-/temp-file-3.4.0.tgz", + "integrity": "sha512-C5tjlC/HCtVUOi3KWVokd4vHVViOmGjtLwIh4MuzPo/nMYTV/p1urt3RnMz2IWXDdKEGJH3k5+KPxtqRsUYGtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-exit-hook": "^2.0.1", + "fs-extra": "^10.0.0" + } + }, + "node_modules/temp-file/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/temp-file/node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/temp-file/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/tmp": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.7.tgz", + "integrity": "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.14" + } + }, + "node_modules/tmp-promise": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz", + "integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tmp": "^0.2.0" + } + }, + "node_modules/truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==", + "dev": true, + "license": "WTFPL", + "dependencies": { + "utf8-byte-length": "^1.0.1" + } + }, + "node_modules/type-fest": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", + "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/utf8-byte-length": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz", + "integrity": "sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA==", + "dev": true, + "license": "(WTFPL OR MIT)" + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/verror": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz", + "integrity": "sha512-veufcmxri4e3XSrT0xwfUR7kguIkaxBeosDg00yDWhk49wdwkSUrvvsm7nc75e1PUyvIeZj6nS8VQRYz2/S4Xg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.21.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz", + "integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xmlbuilder": { + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "17.7.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.3.tgz", + "integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/zip-stream": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.1.tgz", + "integrity": "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "archiver-utils": "^3.0.4", + "compress-commons": "^4.1.2", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/zip-stream/node_modules/archiver-utils": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-3.0.4.tgz", + "integrity": "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "glob": "^7.2.3", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + } + } +} diff --git a/desktop/electron-shell/package.json b/desktop/electron-shell/package.json new file mode 100644 index 0000000..323b3f8 --- /dev/null +++ b/desktop/electron-shell/package.json @@ -0,0 +1,58 @@ +{ + "name": "37du-electron-shell", + "productName": "37du 自动化工作台", + "version": "1.0.0", + "description": "37du 执行机 Node/Electron 客户端(替代 Python webhost 底座,插件保持 Python 子进程执行)", + "main": "electron/main.js", + "private": true, + "type": "commonjs", + "scripts": { + "start": "node electron/main.js --cli", + "dev": "node electron/main.js --cli --dev", + "electron": "electron .", + "pack": "electron-builder --win nsis", + "copy-renderer": "powershell -NoProfile -ExecutionPolicy Bypass -File scripts/copy-renderer.ps1" + }, + "dependencies": { + "adm-zip": "^0.5.18", + "better-sqlite3": "^13.0.3", + "ws": "^8.21.3" + }, + "devDependencies": { + "electron": "^30.5.1", + "electron-builder": "^24.13.3" + }, + "build": { + "appId": "com.37du.automation", + "productName": "37du 自动化工作台", + "asar": true, + "directories": { + "output": "dist-app" + }, + "files": [ + "electron/**/*", + "renderer/**/*", + "package.json" + ], + "win": { + "target": [ + { + "target": "nsis", + "arch": [ + "x64" + ] + } + ], + "artifactName": "setup-37du-shell-${version}.exe" + }, + "nsis": { + "oneClick": false, + "perMachine": false, + "allowToChangeInstallationDirectory": true, + "createDesktopShortcut": true, + "createStartMenuShortcut": true, + "shortcutName": "37du 自动化工作台", + "runAfterFinish": true + } + } +} diff --git a/desktop/electron-shell/scripts/build-python-env.ps1 b/desktop/electron-shell/scripts/build-python-env.ps1 new file mode 100644 index 0000000..dd44fcf --- /dev/null +++ b/desktop/electron-shell/scripts/build-python-env.ps1 @@ -0,0 +1,191 @@ +# Build portable Python + environment package (python-env-.zip) +# ============================================================================ +# Purpose: give the packaged Electron client a self-contained Python runtime so +# plugins and platform-login no longer depend on an external Python install. +# - Portable interpreter: python.org embeddable (self-contained) +# - Dependencies: pinned to the versions validated in the project .venv +# - Runtime subset: webhost/backend/{plugins,core,shared} (minimal for +# plugin_runner protocol + platform login) +# - Output: dist-env/python-env-.zip + .sha256; by default also +# installs into electron-shell/python-env/ for local dev (client probes it). +# Usage (ASCII-safe, works on Windows PowerShell 5.1 with GBK codepage): +# powershell -NoProfile -ExecutionPolicy Bypass -File scripts\build-python-env.ps1 [-EnvVersion 1.0.0] [-SkipLocal] +# Needs: access to python.org / pypi.org (or an internal mirror via $PipIndex) +# ============================================================================ +[CmdletBinding()] +param( + [string]$EnvVersion = "1.0.0", + [switch]$SkipLocal, # do NOT install into electron-shell/python-env/ + [switch]$Force # re-download embeddable / get-pip +) + +$ErrorActionPreference = "Stop" + +$Shell = Resolve-Path (Join-Path $PSScriptRoot "..") +$Repo = Resolve-Path (Join-Path $Shell "..\..") +$Build = Join-Path $Shell "build\python-env" +$Dist = Join-Path $Shell "dist-env" +$DownloadDir = Join-Path $Build "downloads" +$PyDir = Join-Path $Build "py" # temp root: interpreter + deps + runtime subset + +$PythonVersion = "3.11.9" +$EmbedUrl = "https://www.python.org/ftp/python/$PythonVersion/python-$PythonVersion-embed-amd64.zip" +$EmbedZip = Join-Path $DownloadDir "python-$PythonVersion-embed-amd64.zip" +$GetPip = Join-Path $DownloadDir "get-pip.py" +$PipIndex = $null # e.g. "https://pypi.tuna.tsinghua.edu.cn/simple" + +# All dependencies (top-level + key transitive), pinned to .venv-validated versions +$Pinned = @( + "requests==2.34.2", "python-dotenv==1.2.2", "cryptography==50.0.1", + "pandas==3.0.5", "numpy==2.3.5", "openpyxl==3.1.5", + "python-dateutil==2.9.0.post0", "tzdata==2026.3", "et-xmlfile", + "websocket-client==1.9.0", + "DrissionPage==4.1.1.4", "DrissionGet==1.2.1", "DrissionRecord==2.0.1", + "lxml==6.1.1", "psutil==7.2.2", "tldextract==5.3.2", "cssselect==1.5.0", "click==8.4.2", + "ddddocr==1.6.1", "onnxruntime==1.28.0", "Pillow==12.3.0", + "opencv-python-headless==5.0.0.93", "flatbuffers==25.12.19", "protobuf==7.35.1", + "pywin32==312", + "urllib3==2.7.0", "certifi==2026.7.22", "idna==3.18", + "charset-normalizer==3.4.9", "six==1.17.0", "packaging==26.3" +) + +function Download-File([string]$Url, [string]$Dest) { + if (-not $Force -and (Test-Path $Dest) -and (Get-Item $Dest).Length -gt 0) { + Write-Host " cache hit: $Dest" + return + } + Write-Host " downloading: $Url" + curl.exe -sL --retry 3 -o $Dest $Url + if (-not (Test-Path $Dest) -or (Get-Item $Dest).Length -eq 0) { + throw "download failed: $Url" + } +} + +Write-Host "=== 37du portable python env build v$EnvVersion ===" -ForegroundColor Cyan + +# ---------- 1. portable interpreter ---------- +New-Item -ItemType Directory -Force -Path $Build, $Dist, $DownloadDir | Out-Null +Download-File $EmbedUrl $EmbedZip +if (Test-Path $PyDir) { Remove-Item -Recurse -Force $PyDir } +New-Item -ItemType Directory -Force -Path $PyDir | Out-Null +Write-Host "extracting embeddable python ..." +Expand-Archive -Path $EmbedZip -DestinationPath $PyDir -Force +$PyExe = Join-Path $PyDir "python.exe" +if (-not (Test-Path $PyExe)) { throw "missing python.exe in embeddable" } + +# enable site-packages (pip / pywin32 .pth depend on 'import site') +$Tag = ($PythonVersion.Split('.')[0..1] -join '') +$Pth = Join-Path $PyDir "python$Tag._pth" +Write-Host "enabling site + site-packages: $Pth" +Set-Content -Path $Pth -Encoding ascii -Value @( + "python$Tag.zip" + "." + "Lib\site-packages" + "" + "# Enable site (pip / pywin32 .pth)" + "import site" +) + +# ---------- 2. pip + dependencies ---------- +Download-File "https://bootstrap.pypa.io/get-pip.py" $GetPip +Write-Host "bootstrapping pip ..." +& $PyExe $GetPip --no-warn-script-location --disable-pip-version-check | Out-Host +if ($LASTEXITCODE -ne 0) { throw "get-pip failed (exit $LASTEXITCODE)" } + +Write-Host "installing pinned deps ($($Pinned.Count)) with --only-binary ..." +$PipArgs = @("-m", "pip", "install", "--no-warn-script-location", + "--disable-pip-version-check", "--only-binary=:all:") +if ($PipIndex) { $PipArgs += "--index-url", $PipIndex } +$PipArgs += $Pinned +& $PyExe $PipArgs | Out-Host +if ($LASTEXITCODE -ne 0) { throw "pip install failed (exit $LASTEXITCODE)" } + +# copy pywin32 DLLs next to the interpreter (no postinstall / PATH dependency) +$PyWin32Sys = Join-Path $PyDir "Lib\site-packages\pywin32_system32" +if (Test-Path $PyWin32Sys) { + Copy-Item -Path (Join-Path $PyWin32Sys "*.dll") -Destination $PyDir -Force + Write-Host "pywin32 DLLs copied to interpreter root" +} + +# ---------- 3. webhost runtime subset ---------- +$Wb = Join-Path $Repo "desktop\webhost\backend" +$EnvWb = Join-Path $PyDir "webhost\backend" +New-Item -ItemType Directory -Force -Path (Join-Path $EnvWb "plugins"), (Join-Path $EnvWb "core"), (Join-Path $EnvWb "shared") | Out-Null + +# top-level __init__ files: minimal (do NOT import the full core, avoids fastapi etc.) +Set-Content -Path (Join-Path $PyDir "webhost\__init__.py") -Encoding utf8 -Value @( + "# -*- coding: utf-8 -*-" + '"""37du env-package runtime (self-contained)."""' +) +Set-Content -Path (Join-Path $EnvWb "__init__.py") -Encoding utf8 -Value @( + "# -*- coding: utf-8 -*-" + '"""37du env-package runtime subset (webhost.backend).' + 'Carries only the minimal modules needed for plugin execution and platform login:' + 'plugin_runner + plugins + shared + core.auth (+ winjob/job_guard).' + 'Deliberately does NOT import the full core (scheduler/http/etc. live in Node)."""' +) + +# core: plugin_runner + auth + winjob + job_guard (no scheduler/http modules) +$CoreFiles = @("__init__.py", "plugin_runner.py", "auth.py", "winjob.py", "job_guard.py") +foreach ($f in $CoreFiles) { + $src = Join-Path (Join-Path $Wb "core") $f + if (-not (Test-Path $src)) { throw "missing webhost core file: $f" } + Copy-Item -Path $src -Destination (Join-Path $EnvWb "core") -Force +} +# plugins: loader + base +foreach ($f in @("__init__.py", "base.py")) { + $src = Join-Path (Join-Path $Wb "plugins") $f + if (-not (Test-Path $src)) { throw "missing webhost plugins file: $f" } + Copy-Item -Path $src -Destination (Join-Path $EnvWb "plugins") -Force +} +# shared: all platform login / export modules +Get-ChildItem -Path (Join-Path $Wb "shared") -Filter "*.py" | ForEach-Object { + Copy-Item -Path $_.FullName -Destination (Join-Path $EnvWb "shared") -Force +} + +# ---------- 4. smoke test ---------- +Write-Host "=== smoke test ===" -ForegroundColor Cyan +& $PyExe -c "import sys; print(' python:', sys.version.split()[0])" | Out-Host +& $PyExe -c "import requests,pandas,numpy,openpyxl,websocket,dotenv,cryptography; print(' core deps ok')" | Out-Host +if ($LASTEXITCODE -ne 0) { throw "core deps import failed" } +& $PyExe -c "import DrissionPage; print(' DrissionPage', DrissionPage.__version__)" | Out-Host +& $PyExe -c "import ddddocr; print(' ddddocr ok')" | Out-Host +& $PyExe -c "import win32com.client; print(' win32com ok')" | Out-Host +Push-Location $PyDir +try { + & $PyExe -c "from webhost.backend.plugins import load_plugins; print(' webhost plugins ok')" | Out-Host + if ($LASTEXITCODE -ne 0) { throw "webhost plugins import failed" } + & $PyExe -c "from webhost.backend.core import auth, job_guard; print(' webhost core ok')" | Out-Host + if ($LASTEXITCODE -ne 0) { throw "webhost core import failed" } +} finally { Pop-Location } + +# ---------- 5. package ---------- +$Zip = Join-Path $Dist "python-env-$EnvVersion.zip" +if (Test-Path $Zip) { Remove-Item -Force $Zip } +Write-Host "packaging: $Zip" +Add-Type -AssemblyName System.IO.Compression.FileSystem +Push-Location $PyDir +try { + [System.IO.Compression.ZipFile]::CreateFromDirectory($PyDir, $Zip, [System.IO.Compression.CompressionLevel]::Optimal, $false) +} finally { Pop-Location } +$Sha = (Get-FileHash -Algorithm SHA256 $Zip).Hash.ToLower() +Set-Content -Path "$Zip.sha256" -Value $Sha -Encoding ascii +Set-Content -Path (Join-Path $Dist "python-env-latest.txt") -Value $EnvVersion -Encoding ascii +Write-Host " sha256: $Sha" +Write-Host " artifact: $Zip ($([math]::Round((Get-Item $Zip).Length / 1MB, 1)) MB)" + +# ---------- 6. local install (for dev integration testing) ---------- +if (-not $SkipLocal) { + $LocalEnv = Join-Path $Shell "python-env" + $LocalVer = Join-Path $LocalEnv $EnvVersion + if (Test-Path $LocalVer) { Remove-Item -Recurse -Force $LocalVer } + New-Item -ItemType Directory -Force -Path $LocalEnv, $LocalVer | Out-Null + Copy-Item -Path (Join-Path $PyDir "*") -Destination $LocalVer -Recurse -Force + $Stamp = Get-Date -Format o + $Json = "{`n `"version`": `"$EnvVersion`",`n `"updated_at`": `"$Stamp`"`n}" + # BOM-less UTF-8(PS 5.1 的 Set-Content -Encoding utf8 会写 BOM,JSON.parse 会挂) + [System.IO.File]::WriteAllText((Join-Path $LocalEnv "current.json"), $Json, (New-Object System.Text.UTF8Encoding($false))) + Write-Host "local install done: $LocalVer (current.json -> $EnvVersion)" -ForegroundColor Green +} + +Write-Host "=== build complete v$EnvVersion ===" -ForegroundColor Green diff --git a/desktop/electron-shell/scripts/copy-renderer.ps1 b/desktop/electron-shell/scripts/copy-renderer.ps1 new file mode 100644 index 0000000..26afb0b --- /dev/null +++ b/desktop/electron-shell/scripts/copy-renderer.ps1 @@ -0,0 +1,15 @@ +# Build shell frontend source -> renderer/dist (self-contained direction; old webhost untouched) +# Usage: npm run copy-renderer +$ErrorActionPreference = "Stop" +$fd = Join-Path $PSScriptRoot "..\frontend" +if (-not (Test-Path (Join-Path $fd "node_modules\vite\bin\vite.js"))) { + Write-Error "frontend deps missing; run: cd desktop\electron-shell\frontend && npm install" +} +Push-Location $fd +try { + npm run build + if ($LASTEXITCODE -ne 0) { throw "vite build failed" } +} finally { + Pop-Location +} +Write-Host "renderer/dist rebuilt" diff --git a/desktop/electron-shell/scripts/test-plugins/dummy_env_probe/__init__.py b/desktop/electron-shell/scripts/test-plugins/dummy_env_probe/__init__.py new file mode 100644 index 0000000..78ac7dd --- /dev/null +++ b/desktop/electron-shell/scripts/test-plugins/dummy_env_probe/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +"""环境包链路探针插件:仅验证运行时可用性,不触网。""" +from webhost.backend.plugins.base import ScenePlugin, PLUGINS + + +class Dummy(ScenePlugin): + id = "dummy_env_probe" + name = "环境包探针" + version = "1.0.0" + description = "验证环境包执行链路" + platform = "" + fields = [] + + def run(self, fields, ctx): + # 验证环境包内关键依赖可导入 + import pandas + import openpyxl + import requests + import websocket + ctx.log("探针插件已加载 pandas/openpyxl/requests/websocket") + return {"summary": "env-ok", "detail": "deps-loaded", "echo": fields} + + +PLUGINS.append(Dummy())