Compare commits

..
304 Commits
Author SHA1 Message Date
qiqi e57d6d0a57 fix(preview): 输出节点双击预览走图库条目(本地原图优先)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 53s
2026-12-03 18:40:00 +08:00
qiqi d740f2565e docs: v3.26.240 补记任务合并/取消/输出节点修复 2026-12-03 18:18:56 +08:00
qiqi 8d110f285c fix: 图+文本合并单任务;取消作废在飞结果;ready 不再回退远程
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 48s
2026-12-03 18:18:44 +08:00
qiqi 189ba3b8f8 docs: v3.26.240 补记多参考图合并修复 2026-12-03 17:56:51 +08:00
qiqi 475c048694 fix(task-graph): 插件文本节点接多张参考图合并为 1 个任务(相册仍一图一任务)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m44s
2026-12-03 17:56:41 +08:00
qiqi 858144aabe docs: 锚点/事实同步 v3.26.240
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m5s
2026-12-03 17:31:15 +08:00
qiqi 33631d1176 chore: v3.26.240(下载走系统网络栈 + 并发可调) 2026-12-03 17:31:06 +08:00
qiqi 2ff1ccd2d1 feat(download): 走系统网络栈(Rust)+并发默认30可调;修并发限制从未生效
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 48s
2026-12-03 17:29:48 +08:00
qiqi 3894c697ac docs: 锚点/事实同步 v3.26.239
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 48s
2026-12-03 16:43:46 +08:00
qiqi 87e5851b72 chore: v3.26.239(清理未引用修正 + 模板节点连图修复;promptlib 1.14.14) 2026-12-03 16:43:38 +08:00
qiqi c59aa4c3e8 fix(task-graph): 插件文本节点接上游时不再丢自己的文本(修连图后生图 400)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m12s
2026-12-03 16:37:18 +08:00
qiqi 1dd0652825 chore(plugins): promptlib 1.14.14(模板节点补输入端口)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
2026-12-03 16:26:24 +08:00
qiqi 4c16bcafbb chore(plugins): promptlib 1.14.13(打开即自适应 + 编辑防误关)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 46s
2026-12-03 16:21:05 +08:00
qiqi 8f5803d75a site: 插件页同步 promptlib 1.14.12
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 49s
2026-12-03 16:05:16 +08:00
qiqi db550fac8a chore(plugins): promptlib 1.14.12(长文本变量 + 双击回填)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 50s
2026-12-03 16:02:03 +08:00
qiqi 0ff4859268 docs: 域名边界(iwb 网页版独立,桌面版只碰 download/market) 2026-12-03 14:22:41 +08:00
qiqi c98b14df5b fix(settings): 清理未引用图片跳过缩略图缓存;弹窗文案与实现对齐
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m3s
2026-12-03 13:54:30 +08:00
qiqi c3bbff9f57 release: v3.26.238 下载页/站点(三平台齐平)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m44s
2026-12-03 12:49:16 +08:00
qiqi 7577b66b78 docs: 插件 SRI 与换行符(Windows autocrlf)记录 2026-12-03 12:34:24 +08:00
qiqi 1f94249282 fix(build): 插件产物按 LF 写入 dist + dist/plugins 哈希校验;e2e 图库夹具补 orig
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 50s
2026-12-03 12:34:01 +08:00
qiqi d9848e2e52 docs: 图片读取/下载规范定稿 + 2026-12-03 经验记录 2026-12-03 12:05:18 +08:00
qiqi a86606e2cc docs: 锚点与事实同步 v3.26.238
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m2s
2026-12-03 11:55:44 +08:00
qiqi 48a68a7e8a chore: v3.26.238(图片读取/下载本地优先 + 命名统一图库行名) 2026-12-03 11:55:28 +08:00
qiqi ec9ca02a82 site: 插件页同步 taskqueue 1.0.3(含 gallery 1.9.12 等已上线版本)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
2026-12-03 11:35:30 +08:00
qiqi c3b76ec444 docs: 锚点同步 v3.26.237
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 24s
2026-12-03 11:35:02 +08:00
qiqi dc5c1a6b0a chore: v3.26.237(任务队列页头固定 / 老记录预览取原图,taskqueue 1.0.3) 2026-12-03 11:34:53 +08:00
qiqi a8b9296558 docs: 锚点同步 v3.26.236
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 43s
2026-12-03 11:02:34 +08:00
qiqi ab8579dcef chore: v3.26.236(测试版:标签条 portal 固定) 2026-12-03 11:02:24 +08:00
qiqi 9cbd5fa673 docs: 锚点同步 v3.26.235
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m3s
2026-12-03 10:46:38 +08:00
qiqi ac6a0062c3 chore: v3.26.235(测试版:任务队列修复) 2026-12-03 10:46:33 +08:00
qiqi 2e62769421 docs: 锚点同步 v3.26.234
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 45s
2026-12-03 10:22:55 +08:00
qiqi 42033a54ab chore: v3.26.234(测试版:任务队列体验修正) 2026-12-03 10:22:37 +08:00
qiqi 48232bec5c fix(queue): 选中态/缩略图复用/提示词标题/画布归属/状态与下载语义 2026-12-03 10:20:05 +08:00
qiqi 7b2bb0d58e docs: 锚点同步 v3.26.233
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 46s
2026-12-03 09:55:08 +08:00
qiqi 1c7cbd9726 chore: v3.26.233(测试版:任务队列左栏整页插件) 2026-12-03 09:54:59 +08:00
qiqi 630949eac7 fix(queue): 定位回画布 / 已在图库判定 / 上限保护 / 缩略图与兜底 2026-12-03 09:51:38 +08:00
qiqi 9edc635ed8 fix(queue): link-only 再次下载回到 queued + 执行计划状态 2026-12-03 09:45:08 +08:00
qiqi a0f86bf09c fix(queue): 账本上限/进行中保留 + 任务队列页工具区与状态修正 2026-12-03 09:44:35 +08:00
qiqi f5859b7596 feat(queue): 任务队列左栏整页插件 + 宿主 queue/pages 能力 2026-12-03 09:39:48 +08:00
qiqi 3cc53eec4b docs(plan): 任务队列左栏整页插件执行计划 2026-12-03 09:30:11 +08:00
qiqi 380d39146d docs(mockup): 任务队列缩略图支持点击预览(cursor/提示) 2026-12-03 09:23:13 +08:00
qiqi 81e73bd89b docs(mockup): 任务队列页 UI 原型(token 化、浅/深色截图) 2026-12-03 09:20:59 +08:00
qiqi 4cf0947e76 docs: 锚点同步 v3.26.232
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 40s
2026-12-03 08:15:34 +08:00
qiqi ba2918ff95 chore: v3.26.232(测试版:NEW 标记层叠修正) 2026-12-03 08:15:30 +08:00
qiqi bb9e7f487f docs: 锚点同步 v3.26.231
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 37s
2026-12-03 07:28:43 +08:00
qiqi 6102b7358a chore: v3.26.231(测试版:NEW 标记排除未落地) 2026-12-03 07:28:36 +08:00
qiqi 287da25a24 docs: 锚点同步 v3.26.230
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 34s
2026-12-03 07:17:58 +08:00
qiqi 14457c04f2 chore: v3.26.230(测试版:新图 NEW 标记) 2026-12-03 07:17:45 +08:00
qiqi e996975bf9 plugins: gallery 1.9.12(卡片下载钮对齐输出面板:SVG 图标 / 26px / 无阴影) 2026-12-03 07:10:51 +08:00
qiqi d81c085972 docs: 锚点同步 v3.26.229
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 38s
2026-12-03 01:08:48 +08:00
qiqi aeba3d3785 chore: v3.26.229(测试版:图库下载圆钮对齐输出面板) 2026-12-03 01:08:41 +08:00
qiqi 6d9842ecd3 docs: 锚点同步 v3.26.228
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m2s
2026-12-03 00:40:31 +08:00
qiqi f948a45fcc chore: v3.26.228(测试版:输出节点下载圆钮) 2026-12-03 00:40:26 +08:00
qiqi c3bbe1a75a docs: 锚点同步 v3.26.227
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 51s
2026-12-03 00:25:56 +08:00
qiqi 0b9d7d4cfc chore: v3.26.227(测试版:图库一致性快修) 2026-12-03 00:25:50 +08:00
qiqi 7d106d2f2c fix(types): 补 window.__iwbIngest 声明(typecheck)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
2026-12-02 23:38:56 +08:00
qiqi a95e38d2f7 docs: 锚点同步 v3.26.226 2026-12-02 23:38:39 +08:00
qiqi f0ccaf79d3 chore: v3.26.226(测试版:先落地再显示 / 单次下载) 2026-12-02 23:38:27 +08:00
qiqi ae6549354d docs: 锚点同步 v3.26.225
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m40s
2026-12-02 22:49:40 +08:00
qiqi 32e2c037ff chore: v3.26.225(测试版:撤销失败态) 2026-12-02 22:49:40 +08:00
qiqi 8c115c6f7d fix(out): onLoad 时撤销 is-broken / is-broken-cell(修「加载失败」盖在正常图上) 2026-12-02 22:49:40 +08:00
qiqi 308324a749 docs(workflow): 明确交付节奏 —— 报问题后先分析,经用户确认再改代码/构建 2026-12-02 22:46:24 +08:00
qiqi 8bac6bc701 docs: 锚点同步 v3.26.224
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m24s
2026-12-02 22:43:16 +08:00
qiqi c7f7d54db8 chore: v3.26.224(测试版:白板期可见) 2026-12-02 22:43:16 +08:00
qiqi 9463db2538 fix(out): 角标默认显示(onLoad 后由 CSS 收起);骨架垫在图片下方,白板期也能看到 2026-12-02 22:43:16 +08:00
qiqi 5246a1ef85 docs: 锚点同步 v3.26.223
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 55s
2026-12-02 22:40:37 +08:00
qiqi f8d547353f chore: v3.26.223(测试版:去重 + 续传) 2026-12-02 22:40:37 +08:00
qiqi 61dbbb83d3 feat(gallery): 启动按 url 去重(修 220 遗留的重复条目);超时失败在窗口聚焦时自动续传 2026-12-02 22:40:37 +08:00
qiqi fd5f7c7a17 chore(ratchet): app.js 9049→9053、Workbench→2552(归档补漏修正 +8 行)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m29s
2026-12-02 22:31:17 +08:00
qiqi 61c31b3203 docs: 锚点同步 v3.26.222
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 7s
2026-12-02 22:31:07 +08:00
qiqi 75e81ebc29 chore: v3.26.222(测试版:归档补漏修正) 2026-12-02 22:31:07 +08:00
qiqi aa9a54cdc2 fix(gallery): 归档补漏改按 item 级 url 判定(条目本身没有 url,原判定恒为待补 → 重复入库) 2026-12-02 22:31:07 +08:00
qiqi 7caa564ea1 docs: 锚点同步 v3.26.221
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m51s
2026-12-02 22:08:50 +08:00
qiqi f62ec18b0f chore: v3.26.221(测试版:渐进渲染回归) 2026-12-02 22:08:49 +08:00
qiqi 4e8f3215a5 fix(out): 有远程 url 时不做骨架遮挡(回到渐进渲染);落地超时改 5 分钟安全阀 2026-12-02 22:08:49 +08:00
qiqi ee09343011 docs: 锚点同步 v3.26.220
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m45s
2026-12-02 22:06:28 +08:00
qiqi 2b2eb263cd chore: v3.26.220(测试版:少一张 + 超时) 2026-12-02 22:06:28 +08:00
qiqi 25335ddd3d fix(gallery): 已归档但索引缺失的条目仍补入库;落地超时 25s→60s 2026-12-02 22:06:27 +08:00
qiqi 2c1a7e01e9 docs: 锚点同步 v3.26.219
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m19s
2026-12-02 21:54:53 +08:00
qiqi d86031bd76 chore: v3.26.219(诊断版:入库计数) 2026-12-02 21:54:53 +08:00
qiqi 6fe52f0ece diag(gallery): 记录 add-outputs / archive 的张数与跳过原因(定位「总少一张」) 2026-12-02 21:54:53 +08:00
qiqi 2ffe95f0aa docs: 锚点同步 v3.26.218
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m54s
2026-12-02 21:25:53 +08:00
qiqi f4ab497c73 chore: v3.26.218(测试版:下载超时) 2026-12-02 21:25:53 +08:00
qiqi 2f79d12c54 fix(ingest): 下载加 25s 超时(fetch 挂住会让状态永久停在下载中) 2026-12-02 21:25:52 +08:00
qiqi 95b6f45bfd docs: 锚点同步 v3.26.217
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m38s
2026-12-02 21:13:51 +08:00
qiqi b59120beb4 chore: v3.26.217(测试版:打类目标修正 + 骨架撑高) 2026-12-02 21:13:51 +08:00
qiqi 49d11744a6 fix(out): 加载/失败类打到最近的 .iwb-out-cell(img 被浮层包裹,parentElement 不是单元格) 2026-12-02 21:13:51 +08:00
qiqi 420e87628e docs: 锚点同步 v3.26.216
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 1m9s
2026-12-02 21:12:41 +08:00
qiqi ebde29c9d7 chore: v3.26.216(测试版:骨架撑高) 2026-12-02 21:12:41 +08:00
qiqi 15b3352f8f fix(out): 骨架改为撑高(min-height 140px),出图前不再塌成一条线 2026-12-02 21:12:40 +08:00
qiqi 8fdcf3b3dc docs: 锚点同步 v3.26.215
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m34s
2026-12-02 21:05:17 +08:00
qiqi fa0b97bdf6 chore: v3.26.215(测试版:失败态) 2026-12-02 21:05:17 +08:00
qiqi 37fe86c88c fix(out): 加载/失败态改用父容器打类(去 :has 依赖);破图显示「加载失败」 2026-12-02 21:05:17 +08:00
qiqi c20834b623 docs: 锚点同步 v3.26.214
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 58s
2026-12-02 20:59:09 +08:00
qiqi 10ad8618d7 chore: v3.26.214(测试版:加载态与回退) 2026-12-02 20:59:09 +08:00
qiqi fd1a9c636b feat(out): 骨架/角标改以图片 onLoad 为准(CSS :has 联动);onError 两级回退并标失败态 2026-12-02 20:59:09 +08:00
qiqi 8398a389fe docs: 锚点同步 v3.26.213
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 57s
2026-12-02 20:36:29 +08:00
qiqi 8487ef2c91 chore: v3.26.213(测试版:骨架 TDZ 修复) 2026-12-02 20:36:29 +08:00
qiqi 9f88b3a71c fix(out): 修骨架 TDZ(_localSrc 先声明),骨架仅对远程 url 生效 2026-12-02 20:36:29 +08:00
qiqi f0c39fb1c4 fix(style): 骨架用已定义 token(layer2/text2),修「引用未定义变量 +2」
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 53s
2026-12-02 20:30:45 +08:00
qiqi 5fe41ffad4 docs: 锚点同步 v3.26.212
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 14s
2026-12-02 20:30:30 +08:00
qiqi 7f38d31ac2 chore: v3.26.212(测试版:下载骨架) 2026-12-02 20:30:30 +08:00
qiqi 301669a148 feat(out): 无本地源时显示「下载中…」骨架(方案 A),有缩略图时仍走 LOD(方案 B) 2026-12-02 20:30:30 +08:00
qiqi d36bbe3b91 docs: 锚点同步 v3.26.211
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 58s
2026-12-02 20:09:54 +08:00
qiqi 768d01360d chore: v3.26.211(测试版:角标空指针修复) 2026-12-02 20:09:54 +08:00
qiqi fce4fedad6 fix(out): 角标空指针(视图未命中时 ingSt 为 null)+ 未落地优先于下载中 2026-12-02 20:09:54 +08:00
qiqi a6d4f5cc63 docs: 锚点同步 v3.26.210
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m25s
2026-12-02 20:01:01 +08:00
qiqi dde8e861e8 chore: v3.26.210(测试版:恢复下载中角标 + 分层修正) 2026-12-02 20:01:01 +08:00
qiqi e8894d6864 feat(out): 恢复「下载中」角标(按「无本地源且为远程 url」判定,不依赖视图命中) 2026-12-02 20:01:01 +08:00
qiqi 3a70e16ead refactor(boundary): 落地状态视图改为注入(src 不再直接读 window 全局);ResultImg 回到纯展示
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m20s
2026-12-02 19:31:53 +08:00
qiqi c346256115 docs: 锚点同步 v3.26.209
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 48s
2026-12-02 19:21:22 +08:00
qiqi 2d3aba2ed2 chore: v3.26.209(测试版:对账去轮询) 2026-12-02 19:21:22 +08:00
qiqi 9893d1121d perf(ingest): 对账改为「启动一次 + 窗口聚焦时」,去掉 30s 常驻轮询(用户要求空闲零开销) 2026-12-02 19:21:22 +08:00
qiqi 1b36960e4f docs(changelog): 补 v3.26.208 条目 2026-12-02 19:19:25 +08:00
qiqi 0bc96494e9 docs: 锚点同步 v3.26.208
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m26s
2026-12-02 19:19:18 +08:00
qiqi dd24679c3a chore: v3.26.208(测试版:ingest 日志 + 对账) 2026-12-02 19:19:18 +08:00
qiqi 9c8867fdae feat(ingest): 补进队/失败/就绪日志;新增索引对账(启动 3s 后 + 每 30s,幂等) 2026-12-02 19:19:17 +08:00
qiqi c0e4efc06e docs(changelog): 补 v3.26.207 与历史缺失的 v3.24.86 条目(release-records 守卫) 2026-12-02 18:35:43 +08:00
qiqi 9222144d22 docs: 锚点同步 v3.26.207
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 46s
2026-12-02 18:29:21 +08:00
qiqi ac4446d4a0 chore: v3.26.207(测试版:落地重试 + 留痕) 2026-12-02 18:29:20 +08:00
qiqi 1606e0cd7c fix(gallery): 落地 ready 未命中索引时延迟重试(1s/3s)并留痕(修批量静默不落库) 2026-12-02 18:29:20 +08:00
qiqi 17a8681897 docs(changelog): 补 v3.26.206 条目(183 起无记录,release-records 守卫需要) 2026-12-02 18:15:57 +08:00
qiqi c34cadc7d9 fix(style): 恢复 .iwb-pop-anchor 的 z-index(下拉弹层被压在节点下面,打不开)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 47s
2026-12-02 18:14:51 +08:00
qiqi a4d0f8ab79 fix(style): 去掉角标规则里的 z-index 声明(计数棘轮 +2;DOM 顺序已足够)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 46s
2026-12-02 18:08:13 +08:00
qiqi a56ad1829b chore(plugins): 回滚后重新同步插件产物(gallery 1.9.11) 2026-12-02 18:07:59 +08:00
qiqi bbd1e090b5 docs: 锚点同步 v3.26.206 2026-12-02 18:07:44 +08:00
qiqi fd76c76589 chore: v3.26.206(测试版:回滚到 203 行为) 2026-12-02 18:07:44 +08:00
qiqi 71cd7bc41e test: 补 useEffect 桩(183 起既有失败,与本轮无关) 2026-12-02 18:07:44 +08:00
qiqi af9d261636 revert(ui): 整树回滚到 v3.26.203 行为(下载钮/浮层/token 改造导致图库加载异常,先恢复功能) 2026-12-02 18:07:36 +08:00
qiqi 7c20ca90ee docs: 锚点同步 v3.26.205
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 40s
2026-12-02 17:48:28 +08:00
qiqi 8755e7327c chore: v3.26.205(测试版:图库圆钮位置/尺寸修正) 2026-12-02 17:48:27 +08:00
qiqi dc311ec0a9 fix(ui): 图库下载钮回右下角(覆盖宿主旧规则)、尺寸 28→26、与输出节点同款 2026-12-02 17:48:27 +08:00
qiqi eddd635846 fix(ui): 圆钮容器 pointer-events:none(空白时不挡图);修 result-img 单测(useEffect 桩 + 新结构断言)
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 25s
2026-12-02 17:47:59 +08:00
qiqi c22d28320e chore(plugins): gallery 1.9.11 产物(修圆钮掉出卡片)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 33s
2026-12-02 17:45:49 +08:00
qiqi c6e3488aed docs: 锚点同步 v3.26.204
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 28s
2026-12-02 17:37:17 +08:00
qiqi e1c4501f00 chore: v3.26.204(测试版:宿主下载按钮圆形 + token 化;诊断读数修正) 2026-12-02 17:37:16 +08:00
qiqi 42304bc88f chore(tokens): 收紧 token 计数基线(deadTokens 31 / hex 78 / fontSize 119 / radius 69 / spacing 351 / radiusDistinct 12)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 29s
2026-12-02 17:33:44 +08:00
qiqi f83ed2e08a feat(tokens): 下载按钮尺寸提升为正式 token(--iwb-dl-size/radius/inset/gap),宿主与 gallery 共用
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 31s
2026-12-02 17:31:17 +08:00
qiqi 559945281f chore(plugins): gallery 1.9.10 产物(卡片下载改圆形图标、选中只留外框)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s
2026-12-02 17:24:29 +08:00
qiqi fcbeab6cb1 feat(ui): 下载浮层改右下角圆形图标;图库选中只留外框(不显示角标)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 32s
2026-12-02 17:18:14 +08:00
qiqi 499f16a2df fix(diag): 私有内存读数做防守(Windows 出现 private>工作集 的错误值时不展示)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 34s
2026-12-02 16:58:15 +08:00
qiqi 1677f86129 docs: 锚点同步 v3.26.203
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 35s
2026-12-02 16:32:08 +08:00
qiqi 8872c2fa47 chore: v3.26.203(测试版:节点 LOD 优先) 2026-12-02 16:32:08 +08:00
qiqi 56b39b9829 perf(out): 节点取图回到 LOD 优先(本地源才走缩略图),并用本地字节预热 512/768 2026-12-02 16:32:08 +08:00
qiqi 711822092e fix(gallery): mutate 返回 {ok:false} 也按失败处理(避免误记 ok 并白刷一次)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 34s
2026-12-02 16:19:16 +08:00
qiqi c330d3ecf8 docs: 锚点同步 v3.26.202
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 32s
2026-12-02 16:08:58 +08:00
qiqi 65ea7dff9d chore: v3.26.202(测试版:orig 写对数据源) 2026-12-02 16:08:58 +08:00
qiqi 409233670c fix(gallery): orig 状态改写 ModularOutputStore(插件读的那份),不再只改 KV 索引 2026-12-02 16:08:58 +08:00
qiqi a9f36c26e7 docs: 锚点同步 v3.26.201
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 59s
2026-12-02 15:56:33 +08:00
qiqi 8b539ca03e chore: v3.26.201(测试版:图库刷新修复) 2026-12-02 15:56:33 +08:00
qiqi 4315072394 fix(gallery): 原图回填后让宿主重读 outputs(修「数据已 ok、界面不刷新」) 2026-12-02 15:56:33 +08:00
qiqi 8742bbd256 docs: 锚点同步 v3.26.200
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 34s
2026-12-02 15:35:19 +08:00
qiqi b674aae1bc chore: v3.26.200(诊断版修正) 2026-12-02 15:35:19 +08:00
qiqi 3563e54bd0 fix(diag): wIngestLog 自递归改为 wLog(上一版把 helper 内的调用也替换了) 2026-12-02 15:35:19 +08:00
qiqi d5787ca44a docs: 锚点同步 v3.26.199
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 43s
2026-12-02 15:26:36 +08:00
qiqi c411fbe851 chore: v3.26.199(诊断版:日志进 _boot.log) 2026-12-02 15:26:36 +08:00
qiqi bda61026ff diag(gallery): gallery-orig 双写 _boot.log(wLog 不进 _boot.log) 2026-12-02 15:26:36 +08:00
qiqi 3ab39fd522 docs: 锚点同步 v3.26.198
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 48s
2026-12-02 15:21:29 +08:00
qiqi 3993673ee6 chore: v3.26.198(诊断版:gallery-orig 日志) 2026-12-02 15:21:29 +08:00
qiqi c962859837 diag(gallery): 原图回填加 gallery-orig 日志(取证:为什么不命中) 2026-12-02 15:21:29 +08:00
qiqi 0276efd813 docs: 锚点同步 v3.26.197
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 35s
2026-12-02 15:11:22 +08:00
qiqi 68480551c6 chore: v3.26.197(测试版:原图回填补跑) 2026-12-02 15:11:22 +08:00
qiqi 434cf0d92d fix(gallery): 原图回填抽成公共函数,并在 wAddOutputs 之后补跑(修「下载比索引先完成」的时序竞争) 2026-12-02 15:11:22 +08:00
qiqi eb19811c8f docs: 锚点同步 v3.26.196
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
2026-12-02 14:31:41 +08:00
qiqi 7228436b6f chore: v3.26.196(测试版:修图库原图状态) 2026-12-02 14:31:41 +08:00
qiqi a5b8b8b693 fix(gallery): 落地写原图后同步索引 orig=ok(修「仅缩略图」不消失) 2026-12-02 14:31:41 +08:00
qiqi 9f4abdbf44 docs: 锚点同步 v3.26.195
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m36s
2026-12-02 14:13:40 +08:00
qiqi 39294cec38 chore: v3.26.195(测试版:落地即存原图) 2026-12-02 14:13:40 +08:00
qiqi 1862d55563 feat(gallery): 落地成功即写原图到 images/gallery(out_orig_)并把索引 orig 置 ok 2026-12-02 14:13:40 +08:00
qiqi b756ae0ce7 docs: 锚点同步 v3.26.194
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m12s
2026-12-02 13:44:21 +08:00
qiqi 71d4a34197 chore: v3.26.194(测试版:图库读本地副本) 2026-12-02 13:44:21 +08:00
qiqi 5df4f626ee feat(gallery): 图库缩略图优先用落地本地副本;摘掉「生成中」样式 2026-12-02 13:44:21 +08:00
qiqi ff6e8ec883 docs: 锚点同步 v3.26.193
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m34s
2026-12-02 13:33:47 +08:00
qiqi fe94d89a46 chore: v3.26.193(测试版:生成中改 id 无关判定) 2026-12-02 13:33:47 +08:00
qiqi d3ef0f3940 fix(out): 生成中改为「存在任一 out 运行」判定,不再依赖具体节点 id 2026-12-02 13:33:47 +08:00
qiqi ae41246f5a docs: 锚点同步 v3.26.192
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m5s
2026-12-02 13:22:59 +08:00
qiqi 1fed4d4df3 chore: v3.26.192(测试版:生成中按宿主 busy 信号) 2026-12-02 13:22:59 +08:00
qiqi 73936ae076 fix(out): 生成中改读 busy[out::out](宿主运行态写入点,确定信号) 2026-12-02 13:22:59 +08:00
qiqi 67a379a0cf docs: 锚点同步 v3.26.191
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m0s
2026-12-02 13:16:32 +08:00
qiqi 48829aea5d chore: v3.26.191(测试版:生成中看源节点进度) 2026-12-02 13:16:32 +08:00
qiqi 61b6df94c5 fix(out): 生成中同时看源节点进度(等上游时表头取的是 sourceProgOut) 2026-12-02 13:16:32 +08:00
qiqi 02ccb87ec7 docs: 锚点同步 v3.26.190
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m4s
2026-12-02 13:01:44 +08:00
qiqi 5137f38b7f chore: v3.26.190(测试版:生成中角标按进度信号) 2026-12-02 13:01:44 +08:00
qiqi 2c46b0b756 feat(out): 生成中角标改用 progress[node::out](与表头进度同源,无 TDZ) 2026-12-02 13:01:44 +08:00
qiqi b4d8a7ba6a docs: 锚点同步 v3.26.189
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 43s
2026-12-02 13:00:59 +08:00
qiqi a594efc64a chore: v3.26.189(测试版:摘掉生成中角标,保留落地角标) 2026-12-02 13:00:59 +08:00
qiqi a4928d472c revert(out): 先摘掉「生成中」角标(忙碌信号取不到,不能带着猜实现;下载角标保留) 2026-12-02 13:00:59 +08:00
qiqi a8b0999a1b docs: 锚点同步 v3.26.188
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 37s
2026-12-02 12:56:49 +08:00
qiqi ce8a837923 chore: v3.26.188(测试版:修输出节点渲染崩溃) 2026-12-02 12:56:49 +08:00
qiqi 5947e0c18b fix(out): 生成中判定改用 busy 标记(修 TDZ 崩溃 Cannot access before initialization) 2026-12-02 12:56:49 +08:00
qiqi a204298fee docs: 锚点同步 v3.26.187
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 38s
2026-12-02 12:51:18 +08:00
qiqi 955423eac6 chore: v3.26.187(测试版:生成中角标) 2026-12-02 12:51:17 +08:00
qiqi 7ff3dd57f4 docs: 事实快照同步(srcLines) 2026-12-02 12:51:17 +08:00
qiqi 2cadad7ea7 feat(out): 生成中给旧图压暗 + 「生成中」角标(不动 data,失败即恢复)
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 9s
2026-12-02 12:51:08 +08:00
qiqi 6ff6ab6a9f docs: 基线锚点同步到 v3.26.186(a1ac3dff)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 36s
2026-12-02 12:40:15 +08:00
qiqi a1ac3dffe1 chore: v3.26.186(测试版:输出节点落地角标 + 本地优先) 2026-12-02 12:40:15 +08:00
qiqi 4b7dc6ee40 fix(ingest): 入队改到「结果写进节点数据」处,输出节点体本地优先 + 角标
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 6s
上一版把角标加在了 ResultImg,而它全仓没有调用点(输出节点用的是
ui-node-bodies 的 iwb-out-cell-img),所以用户看不到任何变化。

- runtime-workbench-logic.liveUpsert:每张结果写入节点数据时 enqueue(批量/恢复都走这里)
- ui-node-bodies:输出单元格优先用 ingest 的 localUrl,另加「排队中/下载中/未落地」角标
- app.js onEvent 里补 wThumbBump(),让命令式渲染的节点体跟着重绘
- 棘轮:app 8,895→8,896、Workbench 2,487→2,488
2026-12-02 12:40:06 +08:00
qiqi a409fa6206 docs: 基线锚点同步到 v3.26.185(b2a01354)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 30s
2026-12-02 12:28:33 +08:00
qiqi b2a0135467 chore: v3.26.185(测试版:出图结果接落地队列,仅 win 测试用) 2026-12-02 12:28:33 +08:00
qiqi c6e259a2b0 fix(ingest): ready 后异步补一次本地 URL(首次 objectURL 未就绪时也能切到本地)
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 13s
2026-12-02 12:28:17 +08:00
qiqi a8c2cd9d97 feat(ingest): 出图结果接落地队列(节点先显示远程,就绪后换本地)
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 29s
- src/image-ingest-store.js:localStorage 索引(500 条上限、pinned 不淘汰)+ url→状态视图(供组件订阅)
- app.js:装配 ingest(fetchBytes = wBlobFromSrc → dataURL → wImgRefWrite;persist 走 store)
  启动时 restore,出图后立即 enqueue(不等下载完)
- ui-components ResultImg:读视图状态,排队/下载中显示角标并压暗,失败显示「未落地」,
  就绪后 src 换成本地 objectURL(不再直连 CDN)
- style.css:角标样式全部走 token(z-anchor / radius-full / font-xs / err 语义色)
- 棘轮:app.js 8,860→8,891、Workbench 2,454→2,483、global 122→123(均按 B3 记账)

验证:image-ingest 24 条 + writeback 23 条单测、e2e 冒烟 33/33、lint/typecheck/facts/ratchet/token-lint 全绿。
图库侧仍走原缩略图链路,下一步接同一份本地引用。
2026-12-02 12:27:47 +08:00
qiqi bca71e53b9 feat(ingest): 结果图片落地管线基座(src/image-ingest.js + 24 条契约单测)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 58s
背景:出图后输出节点直接用 <img src=远程CDN>、图库缩略图再各自 fetch 一次,
CDN 慢/断流时就是「从上往下慢慢刷 / 卡住半张」,图库还晚一步。
先把「远程结果 → 本地字节」收敛成一条队列,本次只落基座,不接线(零行为变化)。

- src/image-ingest.js:状态机 queued/downloading/ready/failed/link-only;
  幂等(同 url 复用记录)、重试 1s/2s/4s×3、并发 ≤2、失败保留 url、
  释放字节(link-only)、启动恢复(queued/downloading 重排)、markMissing 自检入口。
  依赖全注入(fetchBytes/writeRef/persist/onEvent/sleep),不读任何全局,便于单测。
- tests/image-ingest-test.js:24 条断言(正常落地/幂等/重试成功/彻底失败/manual retry/
  释放/恢复/取消/并发上限/统计),已进 test:unit。
- 注册:build.js 顺序 + 模块顺序快照 + 耦合面快照;global 写入口 121→122(单列命名空间)。

下一步(未做):接线到出图结果与图库、节点改吃本地副本、失败/进度 UI —— 需与显示层一起上。
2026-12-02 12:19:30 +08:00
qiqi 200c1d35b1 docs(design): 任务队列页面方案 + 交互样式图(mockup HTML / 浅色·深色截图) 2026-12-02 12:11:37 +08:00
qiqi fae497289d docs(site): v3.26.184 发布登记(三平台齐平)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 43s
- releases.json:3.26.184 / darwin-aarch64(10,145,011 B)、darwin-x86_64(10,601,813 B)、windows-x86_64(5,589,965 B)
- 首页 / 下载页 / 插件页重新生成并上传(显示 v3.26.184)
- latest.json 三平台齐平(windows 条目来自 latest-windows.json 的 184)
2026-12-02 11:49:26 +08:00
qiqi 0cf7af230f docs: 基线锚点同步到 v3.26.184(08367fc7)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
2026-12-02 11:36:12 +08:00
qiqi 08367fc707 chore: v3.26.184(测试版:插件画布桥拆分 + 性能快照接口)
相对 3.26.183 的运行时变化只有两处:
- 插件画布桥从 app.js 迁到 src/plugin-canvas-bridge.js(行为等价,app.js −51 行)
- IWBPerf 新增只读 snapshot()(性能基线用,不影响业务)

其余为工程侧:发布验收脚本、插件 harness 修正、插件产物同步(安装包会剥离插件,不影响包内)。
2026-12-02 11:36:05 +08:00
qiqi 04d309435e docs(plan): 记录插件 harness 巡检结果(10/10 全绿,6 份过期断言已修) 2026-12-02 11:31:52 +08:00
qiqi 29d8c22d53 refactor: 插件画布桥迁到 src/plugin-canvas-bridge.js(app.js −51 / Workbench −51)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s
app.js 与 Workbench 的行数棘轮都是零余量(8,911 / 2,505),再改一行就红。桥本身不需要 React
(只读 refs + 调已有命令),适合按 ctx + 注入搬出。

- 新增 src/plugin-canvas-bridge.js:getNodes / getSelectedNode / getNodeImage / createNode /
  screenToWorld / createImageNode / setNodeImage / saveNodeImage 全部迁出,内部持有
  src/image-writeback 实例;依赖(findSpot/placeAtDrop/addPluginNode/uid/cloneNodeDefaults/
  gallerySync/imgRefWrite/ensureTier/pluginPreview/shrinkDataUrl/showToast…)由 app.js 注入。
- app.js 只保留 20 行装配:wPluginCanvasBridge / wImageWriteback 由工厂返回,卸载置空。
- 棘轮:MAX_APP_JS_LINES 8,911→8,860(−51)、MAX_WORKBENCH_LINES 2,505→2,454(−51),按 B3 记账。
- 顺带删两个从未被引用的工厂导出(IWBStorageRuntimeFactory / IWBRuntimeMetricsFactory),
  global 写入口 122→121(+1 新模块,−2 死导出)。
- scripts/perf-baseline.js 改用 npm run build(含 copy-plugins):只跑 build.js 会缺 plugins/,
  图库面板相关 e2e 会假红。

验证:test:unit 140 文件、e2e 冒烟 33/33、lint/typecheck/facts/ratchet/boundary 全绿。
2026-12-02 11:19:51 +08:00
qiqi 8c47ef75fe feat(release): 发布后统一验收 npm run release:verify
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
背景:v3.26.183 发布时踩了两次坑 —— 残留脚本覆盖产物、三处版本/记录不同步,都是人工比对才发现的。

- 新增 scripts/release-verify.js:一次核对
  ① latest.json / latest-windows.json / site/releases.json / package.json 四处版本
  ② 三平台齐全 + 文件形态(mac 更新器 .app.tar.gz / 下载 .dmg;win 同一 setup.exe)+ 签名非空
  ③ 每个资产线上实际 size(HEAD)与 sha256(下载校验,--fast 跳过)与登记一致
  ④ 下载页含当前版本
- package.json 增加 release:verify;PUBLISHING/ CONTRIBUTING 增加「发布收尾必须跑」的说明
- 实测当前 3.26.183:25 项全过(mtime/sha 与线上一致)
2026-12-02 11:11:43 +08:00
qiqi 3707eb6f2c feat(perf): 性能基线纳入 App 帧探针断言(C 项)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 39s
背景:之前的 _perf-baseline.spec.js 只用页内自建的 __FRAMES__ 探针测,与 App 运行时真正
输出的 perf 行(IWBPerf,长帧 >50ms + longtask)不是同一套数据,用户日志里的数值无法回归。

- src/runtime-frame-probe.js:新增只读 snapshot()(结构化读数 + 清零),与 60s 落盘窗口解耦,
  _boot.log 的 perf 行格式不变。
- tests/_perf-baseline.spec.js:平移段前后取快照,新增 3 条断言
  · frames > 30(防「探针没启动 → 0 长帧」假绿)
  · 长帧比例 ≤ 40%
  · longtask 总时长 ≤ 2500ms
  快照同时写入 P1_BASELINE= 便于历史对比;IWB_PROBE_PERF=0 可只测不断言。
- scripts/perf-baseline.js + npm run perf:baseline:build → 动态端口起本地服 → 只跑该 spec → 关服。
- 本机实测(headless / 7000 节点 / 12 步平移,三次):长帧 13~17/57~59(22.8%~30.9%)、
  longtask 25 次 1905~1934ms、最长帧 ~400ms;阈值取实测最大值 ×1.3,换机器需重设。
- 文档:performance-lessons 增加「性能回归怎么跑」;计划 C 项标记完成。

仍不进 CI(无头环境无 GPU,数字不可比),只作真机回归。
2026-12-02 09:41:32 +08:00
qiqi 80f19a74da docs(site): 下掉 3.26.182(历史产物已被残留脚本污染,统一使用 3.26.183)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 49s
- site/releases.json 移除 3.26.182 条目(下载页历史版本不再提供该版本)
- 重新生成并上传 首页 / 下载页 / 插件页;下载页已无 3.26.182 链接
- NAS 上 182 的 mac 产物(dmg ×2 / app.tar.gz ×2 / sig ×2,字节已被覆盖成 183)
  移到 updates/_deprecated/182/,对应 URL 现返回 404,避免下载到与记录不符的文件
- scripts/audit-release-files.js 复跑:14 条全部一致(退出码 0)
2026-12-02 09:21:18 +08:00
qiqi e4a9fdacd0 feat(release): 发布收尾增加「产物 == 登记」机械自检
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 50s
背景(2026-12-02):v3.26.183 发布时发现 NAS 上 3.26.182 的 mac 产物被一个残留后台脚本
覆盖成了 183 的字节,而 site/releases.json 仍记着旧 size/sha256 —— 用户下载到的文件与记录不符,
全程零报错,直到事后人工比对才发现。

- 新增 scripts/audit-release-files.js:读 site/releases.json,对最近 5 个版本的每个平台发 HEAD,
  比对线上 content-length 与记录的 size;--all 全量、--sha 对最新版本额外下载核对 sha256;
  不一致 / 404 以非零退出。
- publish-update.sh 收尾调用它:不一致就中止,release.sh 因此不会继续登记站点/打 tag。
- 实测:当前恰好指出 3.26.182 的两条 mac 记录不一致(10143942≠10142798、10605679≠10600607),
  其余 13 条(183/169/154/153 + 182 win)全部一致。
2026-12-02 09:14:55 +08:00
qiqi 78ddeee40a docs(site): v3.26.183 发布登记(三平台齐平)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 40s
- releases.json:3.26.183 / darwin-aarch64(10,143,986 B)、darwin-x86_64(10,605,713 B)、windows-x86_64(5,591,250 B)
- 下载页 / 首页 / 插件页重新生成并上传 NAS(页面显示 v3.26.183)
- 更新源 latest.json 已含三平台(windows 条目来自 latest-windows.json 的 183)
2026-12-02 09:11:41 +08:00
qiqi 4abdd2323a docs(site): 插件市场发布 white-bg-800 1.2.3 / blank-canvas 1.0.1(站点与插件页同步)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 37s
- market.maqiart.eu.org:index.json + 两个 zip + 旧版单文件产物 + 展示页已更新并回读校验
  (索引版本 1.2.3 / 1.0.1;下载 zip 的 sha256 == 索引 bundleSha256;单文件 sha256 == 索引 file.sha256)
- 下载站:index.html / plugins-index.json / plugins/index.html 重新生成并上传(插件卡片版本同步)
2026-12-02 08:56:11 +08:00
qiqi 036865a201 chore(plugins+preflight): white-bg-800 1.2.3 / blank-canvas 1.0.1 产物 + preflight B1/B2/B3
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 38s
插件批次(插件仓 e2982e3,产物同步到 plugins/):
- white-bg-800 1.2.3:覆盖模式走 saveNodeImage(落盘校验/失败回滚/可读原因),老宿主回退同步 setNodeImage;
  harness 改为双形态(new/old)并把两处过期断言改对
- blank-canvas 1.0.1:空白判定补 localRef/ref,避免只有本地引用的节点被白图覆盖

preflight / 守卫:
- B1 preflight 第 6 项:扫现行文档里已下线的路径与命令(functions/api、verify:release、plugins-publish、_inbox、wrangler),
  删除线/已弃用豁免;首次运行抓到 4 处仍在教 NAS _inbox 取件的过期说明,改为 tailnet HTTP 流程
- B2 source-text-ratchet 增加 src global.* 写入口棘轮(实测 122,只减不增)
- B3 棘轮上限行必须带「日期 + 相对上一版的差(或基线说明)+ 原因」,否则红(防"谁写谁抬")
2026-12-02 08:53:02 +08:00
qiqi 04c87ff0f6 docs: 基线锚点同步到 v3.26.183(b721febd)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 36s
守门第 7 组要求锚点 == 最近一次 bump 版本的提交,发版提交 b721febd 之后必须同步,
否则 npm run test:facts 恒红。顺带在锚点描述里记上 183 的改动主题。
2026-12-02 07:40:23 +08:00
qiqi b721febd63 chore: v3.26.183(三处版本一致 + Cargo.lock 版本对齐)
- package.json / src-tauri/tauri.conf.json / src-tauri/Cargo.toml 三处 3.26.183
- Cargo.lock 里 image-workbench 的 version 一并改为 3.26.183:
  此前它停在 3.26.180,而 Cargo.toml 已是 3.26.182,任何一次 cargo 构建都会把锁文件改脏,
  preflight 就只能靠人工还原。对齐后构建不再产生这份噪声改动。
2026-12-02 07:40:13 +08:00
qiqi 5728efd9b4 refactor: 图片写回收口到 src/image-writeback.js(3.26.183 前置)
四个线上问题(174~182)都落在同一条链上:插件写图 → 节点数据 → 缩略图缓存 → 渲染。
旧实现分散在 app.js 插件桥与 runtime-workbench-logic,顺序靠人记,改一处漏一处就复发。

- 新增 src/image-writeback.js 三入口:
  · replaceNodeImage:引用化 → 一次 commit → saveNow → 回读校验(失败回滚旧图)→ 旧/新双 key 失效 → bump
  · replaceNodeImageSync:同步严格布尔、只改内存不落盘(blank-canvas / white-bg-800 依赖此语义)
  · createNodeImage:同步返回 id,大图后台引用化(6 个建图插件零改动)
- app.js 只做装配:删除 origImagePatch 与三个写入口旧实现;「还原替换前原图」支持引用形态
- 阈值只留一条判据:IMPORT_INLINE_MAX + wImportImage(keepOriginal);删除 182 的 200KB + 裸 wImgRefWrite 旁路
- orig 一起引用化,并补进 HISTORY_IMG_REF_FIELDS(撤销快照不再整串存旧图)
- 单测 tests/image-writeback-test.js(23 条断言)已进 test:unit
- 棘轮记账:MAX_APP_JS_LINES 8743→8911(+168)、MAX_WORKBENCH_LINES 2333→2505(+172,相对 HEAD −19)
  (174~182 修 bug 期间累计 +196 未记账,本轮把写回逻辑搬进 src 后按实测显式上调)
- 门禁修复:裁剪矩形守卫文本(cullRectsOf 已用 p = pad + extra)、事实文档数字与基线锚点、模块顺序/耦合面快照
- 文档:plugin-development.md 修正 ctx.canvasWrite 旧写法 + 新增「图片写回契约」表;
  workflow-2026-12-02.md 增加分工红线(代码改动只在 mac 侧,构建机只做流程性动作)
2026-12-02 07:40:02 +08:00
qiqi 49a35e5dc3 docs: 质量与性能优化计划(待确认) 2026-12-02 07:09:05 +08:00
qiqi e8806eb705 docs: Windows 发布流程改为 tailnet 取件(弃用 _inbox 路径说明) 2026-12-02 07:00:51 +08:00
qiqi 19e2fcd690 docs: 清理过期说明(网页版 Functions/KV、verify:release、插件来路、基线锚点)+ 修 Windows 签名脚本 env 冲突
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 40s
2026-12-02 07:00:22 +08:00
qiqi 30cf375ea0 docs+tooling: 工程流程优化约定(preflight 体检 / diag-tail 日志过滤)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s
2026-12-02 06:54:16 +08:00
qiqi 32ac08faeb docs(site): v3.26.182 Windows 条目(5,587,784 B / 41dd2e78…)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m47s
2026-12-01 22:14:58 +08:00
qiqi 795a67bf80 docs: v3.26.182 发布记录与下载页(mac 双架构)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 55s
2026-12-01 22:12:52 +08:00
qiqi 2429577637 docs: 画布性能与图片链路优化参考(2026-12-01 排查结论) 2026-12-01 22:08:49 +08:00
qiqi 738b70c535 perf: v3.26.182 标注写回后大图无损引用化(DOM 不再挂 1.2MB base64)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m11s
2026-12-01 22:02:11 +08:00
qiqi f0b75b401d perf: 缩略图失败 key 负缓存(v3.26.181 实际源码,之前漏提交)
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 13m54s
2026-12-01 21:48:16 +08:00
qiqi 7d0ee9c11a perf: v3.26.181 缩略图生成失败的 key 不再重试(标注覆盖后反复解码吃 CPU)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m58s
2026-12-01 21:44:08 +08:00
qiqi 190ec3934b perf: v3.26.180 停用常驻合成层(窗口可见时持续 CPU)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 9m19s
2026-12-01 21:34:29 +08:00
qiqi 7ca372efec fix: v3.26.179 无缩略图时直接显示原图(空 src 触发 onError 被永久标失效);onLoad 清除失效标记
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m49s
2026-12-01 21:20:31 +08:00
qiqi c3227ce0d5 fix: v3.26.178 logPut 兼容单对象入参;plugin-img 同时写 _boot.log
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m46s
2026-12-01 21:01:22 +08:00
qiqi 44073f8d09 diag: v3.26.177 插件写回加可见 toast(成功/失败原因)
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 1m0s
2026-12-01 21:00:21 +08:00
qiqi d4983a8aa1 diag: v3.26.176 插件图片写回路径落 _boot.log(定位标注覆盖不生效)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m11s
2026-12-01 20:52:40 +08:00
qiqi e9d22d235d fix: v3.26.175 覆盖替换图片时清掉 localRef/ref(旧引用一直压过新图)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m53s
2026-12-01 20:45:04 +08:00
qiqi 7833e6c4fe fix: v3.26.174 插件写回图片后失效缩略图缓存并重渲染(修标注覆盖后不落地/CPU 空转)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m3s
2026-12-01 20:34:18 +08:00
qiqi e2b976413c feat: v3.26.173 帧探针可开关(rAF 帧时长 + JS 长任务写 _boot.log)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m5s
2026-12-01 20:01:31 +08:00
qiqi 7bc0752cec fix: v3.26.172 新图无缩略图时最多占位 300ms 后回退原图(修标注替换原图后节点空白)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s
2026-12-01 17:40:43 +08:00
qiqi 56975e69fd release(plugins): image-vectorize 0.6.3(关闭面板释放源图与 SVG)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 42s
2026-12-01 17:36:48 +08:00
qiqi b1b2438fa0 perf: v3.26.171 自动回收阈值放松(空闲 90s;RSS>2500MB 直接完整回收)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m57s
2026-12-01 17:15:25 +08:00
qiqi 624cc4a34f feat: v3.26.170 诊断采样可关闭(15s 曲线 + 4s 进程轮询)+ 面板明细 60s 缓存
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s
2026-12-01 17:13:44 +08:00
qiqi b0fd0a725c perf: v3.26.170 诊断面板明细改为 60s 缓存 + 手动刷新(修面板开着时空闲 CPU 20%)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m47s
2026-12-01 17:04:46 +08:00
qiqi 30c9ef93be docs(site): v3.26.169 Windows 条目(5,586,528 B / 90f1fad7…)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 51s
2026-12-01 15:12:21 +08:00
qiqi 766e434e1d docs: v3.26.169 发布记录与下载页(mac 双架构)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 49s
2026-12-01 15:02:50 +08:00
qiqi a0a98b738e docs: 锚点对齐 v3.26.169+7856afd(publish 自动) 2026-12-01 15:00:28 +08:00
qiqi 7856afd08e chore: v3.26.169 回到 167 的空格平移行为(撤销 168 的隐藏两帧)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 53s
2026-12-01 14:55:23 +08:00
qiqi 2e7f01838e Revert "fix: v3.26.168 空格平移收尾也走隐藏两帧重绘(进一步消掉残影)"
This reverts commit 82c93bddea.
2026-12-01 14:55:16 +08:00
qiqi 82c93bddea fix: v3.26.168 空格平移收尾也走隐藏两帧重绘(进一步消掉残影)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m3s
2026-12-01 14:50:53 +08:00
qiqi f7a990bada fix: v3.26.167 手势期间每帧同步连线命中层 + 松开空格补收尾(修空格平移后命中数据仍在原地)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m27s
2026-12-01 14:45:50 +08:00
qiqi 0e5a80ae2c fix: v3.26.166 松手后到视口提交前关闭连线命中层(修鼠标扫过旧位置仍命中已移走的连线)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m20s
2026-12-01 14:35:10 +08:00
qiqi 14f92efc4a fix: v3.26.165 松手后隐藏两帧再重绘边线,强制丢弃旧合成位图(修残影)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m49s
2026-12-01 14:32:05 +08:00
qiqi 29db0024bf fix: v3.26.164 只在结束平移的 pointerup 上重绘边线(修 163 误用旧视口导致连线错位残留)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 58s
2026-12-01 14:26:42 +08:00
qiqi 0617eb7b14 fix: v3.26.163 松手同帧强制重绘边线(进一步消掉旧连线残留)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m14s
2026-12-01 14:15:48 +08:00
qiqi 37369d1145 fix: v3.26.162 手势结束主动重绘边线(修松手后旧连线滞留约 1s)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 10s
2026-12-01 13:56:12 +08:00
qiqi 538816bd9f fix: v3.26.161 平移期间挂过即不卸载,松手后按视口回收(消掉节点换挂导致的突现)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 48s
2026-12-01 13:35:19 +08:00
qiqi 5bd9e925fd fix: v3.26.160 平移裁剪窗口边距 1.5 屏、更新步长 1/3 屏(修节点在视野内突然出现)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 47s
2026-12-01 12:46:55 +08:00
qiqi e02364fd93 fix: v3.26.159 连线不再按视口裁剪、平移期不冻结边线(修新区域连线迟到/跳动)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 56s
2026-12-01 12:45:35 +08:00
qiqi 9e1b78f466 feat(diag): 手势期提升加面板开关,导出带 gestureLayer 状态
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 49s
2026-12-01 12:11:12 +08:00
qiqi 093a1525c0 feat(diag): 导出 JSON 带上开关状态(合成层/毛玻璃)与 DOM 规模,便于 A/B 比对
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 42s
2026-12-01 11:55:22 +08:00
qiqi b3cfea4715 feat: v3.26.158 诊断导出带上分进程内存拆解;mac 辅助函数补 cfg(unix)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 39s
2026-12-01 11:35:56 +08:00
qiqi 2f9590bcc7 feat: v3.26.157 诊断页 Windows 分进程内存拆解(工作集+私有提交);取消 30% LOD 档只留 15% 占位
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 39s
2026-12-01 10:13:08 +08:00
qiqi e9581e52a6 perf: v3.26.156 平移期窗口化裁剪(不再全量挂载)+ 手势期关毛玻璃
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 37s
2026-12-01 09:28:51 +08:00
qiqi c80dc7e50a perf: v3.26.155 手势期临时合成层 + 命中层 SVG 不再每帧变形(修拖动画面滞留/掉帧)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 39s
2026-12-01 08:53:07 +08:00
qiqi 4ce222a4bd docs(site): v3.26.154 Windows 包登记(5,623,889 B / 53be3b40…)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 39s
2026-12-01 07:57:56 +08:00
qiqi 3ab11b9db7 docs(site): v3.26.154 平移边线缓存
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 33s
2026-12-01 07:42:38 +08:00
qiqi 142a13db36 chore: 移除网页版遗留(KV 插件发布脚本 / verify-release / 旧域名引用),插件纯函数抽到 scripts/plugin-integrity.mjs
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 4s
2026-12-01 07:42:33 +08:00
qiqi bf29d9f9d9 docs: 锚点对齐 v3.26.154+d874e02(publish 自动) 2026-12-01 07:42:32 +08:00
qiqi d874e028f4 perf: v3.26.154 平移移动边线缓存,减少每帧 Canvas 重画 2026-12-01 07:38:45 +08:00
qiqi 04745b0b31 test(perf): WebKit 平移 A/B 开关与结果(合成层/边线冻结/全量渲染) 2026-12-01 07:32:28 +08:00
qiqi 67443ef831 docs(site): 下载站插件列表跟进 album 1.2.5 / gallery 1.9.9 / promptlib 1.14.11 等版本
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 39s
2026-12-01 07:03:18 +08:00
qiqi fbc6e55964 release(plugins): 同步 album 1.2.5 / gallery 1.9.9 / promptlib 1.14.11(hover 简化)+ 修正各插件 manifest 版本号
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 34s
2026-12-01 07:01:36 +08:00
qiqi 9ec4b2c99c docs(site): v3.26.153 cache-migrate 修复
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 35s
2026-12-01 06:53:29 +08:00
qiqi f3ed768a7c docs: 锚点对齐 v3.26.153+2640e15(publish 自动) 2026-12-01 06:53:23 +08:00
qiqi 2640e15fda fix: v3.26.153 cache-migrate 失败键不再重复触发画板加载 2026-12-01 06:50:01 +08:00
qiqi 20122def31 docs(site): v3.26.152 内存优化
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 36s
2026-12-01 01:54:29 +08:00
qiqi 139d366938 docs: 锚点对齐 v3.26.152+9ef5218(publish 自动) 2026-12-01 01:54:23 +08:00
qiqi 9ef5218856 perf: v3.26.152 简化卡片 hover 效果 + 可见空闲回收 2026-12-01 01:51:10 +08:00
qiqi 359ad97329 chore(release): 3.26.151 Windows 条目并入 latest.json / releases.json / 下载页
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 38s
2026-12-01 01:44:01 +08:00
qiqi 9a6ff4f4b7 docs(canvas-v3): v3.26.151 顶部层级修复记录 2026-12-01 01:28:34 +08:00
qiqi 2007b5b083 docs(site): v3.26.151 顶部层级修复
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 36s
2026-12-01 01:28:28 +08:00
qiqi 08f9608cad docs: 锚点对齐 v3.26.151+f9ea5d5(publish 自动) 2026-12-01 01:28:22 +08:00
qiqi f9ea5d5cf0 fix(ui): 节点/浮层不再盖住顶部 tab 栏 2026-12-01 01:25:07 +08:00
qiqi 424b4e3b31 docs(site): v3.26.150 停止 Canvas V3
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 38s
2026-12-01 01:16:58 +08:00
qiqi f11ad6ebc2 docs: 锚点对齐 v3.26.150+35e68c7(publish 自动) 2026-12-01 01:16:52 +08:00
qiqi 35e68c7508 release: v3.26.150 Canvas V3 异常兜底 + 7000 节点数据 2026-12-01 01:15:25 +08:00
qiqi bb6c8d9772 docs(canvas-v3): v3.26.149 发布记录 2026-12-01 01:04:59 +08:00
qiqi 86e19b5dd7 docs(site): v3.26.149 Canvas V3 LOD
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 45s
2026-12-01 01:04:54 +08:00
qiqi fbc31110f9 docs: 锚点对齐 v3.26.149+6ce5f67(publish 自动) 2026-12-01 01:04:48 +08:00
qiqi 6ce5f67920 release: v3.26.149 Canvas V3 LOD + 1000 节点基线 2026-12-01 01:01:34 +08:00
qiqi 56eb70f794 docs(canvas-v3): v3.26.148 发布记录 2026-12-01 01:00:42 +08:00
qiqi b3197db596 docs(site): v3.26.148 Canvas layer
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 46s
2026-12-01 01:00:37 +08:00
qiqi a45f114e51 docs: 锚点对齐 v3.26.148+a5d41a8(publish 自动) 2026-12-01 01:00:31 +08:00
qiqi a5d41a85fe release: v3.26.148 Canvas V3 layer 节点 2026-12-01 00:57:17 +08:00
qiqi e071923d1e test(canvas-v3): perf probe 支持 Canvas V3 开关并记录 60 节点基线 2026-12-01 00:54:42 +08:00
qiqi 253cba51a2 docs(canvas-v3): v3.26.147 发布记录 2026-12-01 00:53:56 +08:00
qiqi 7c65ef1272 docs(site): v3.26.147 Canvas V3 稳定化
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 47s
2026-12-01 00:53:51 +08:00
qiqi 7f6da413b7 docs: 锚点对齐 v3.26.147+655d042(publish 自动) 2026-12-01 00:53:45 +08:00
qiqi 655d042439 release: v3.26.147 Canvas V3 稳定化(插件 fallback 默认关) 2026-12-01 00:50:39 +08:00
qiqi 0642b87ef8 docs(canvas-v3): v3.26.146 发布记录 2026-12-01 00:48:09 +08:00
qiqi 1717c2d7fb docs(site): v3.26.146 Canvas V3 P3
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
2026-12-01 00:48:03 +08:00
qiqi b5db6cce3f docs: 锚点对齐 v3.26.146+aced51f(publish 自动) 2026-12-01 00:47:58 +08:00
qiqi aced51f27c release: v3.26.146 Canvas V3 P3 fallback + 统计 2026-12-01 00:44:43 +08:00
qiqi ec304b49d7 feat(canvas-v3): P3 插件 fallback + canvas 绘制统计 2026-12-01 00:44:34 +08:00
qiqi b0ceb3353d feat(canvas-v3): P3 插件节点未选中走 canvas 占位 fallback 2026-12-01 00:42:02 +08:00
qiqi 0b1293892c docs(canvas-v3): v3.26.145 实验版发布记录 2026-12-01 00:39:17 +08:00
130 changed files with 6773 additions and 1415 deletions

No files matched your search

+277
View File
@@ -16,6 +16,283 @@
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
## v3.24.86(2026-11-16)补记
- 历史条目补录:该 tag 当时未在 CHANGELOG 记录(release-records 守卫要求 tag 与条目双向一致),内容按当时提交补一句占位说明。
## v3.26.240(2026-12-03)下载改系统网络栈 + 并发可调
- 图片下载改走 Rust fetch_image_b64(reqwest,系统网络栈):不受 CORS/WebView 限制,修「浏览器能下、任务队列卡在 55% 不动」;失败仍回退 WebView fetch。
- 同时下载默认 30(设置 → 通用 → 生成 → 同时下载,1–64 可调),改设置下一轮立即生效。
- 修并发限制从未生效的老 bug:pump() 的 active++ 原在延迟任务里,会把整个队列一次性放出去。
- 新增/扩展 tests/image-ingest-test.js(Rust 优先/回退、并发按设置生效)。
- 任务图:插件文本节点接了多张参考图时合并为 1 个任务(此前一条边一个任务);相册一图一任务不受影响。
- 任务图:图 + 文本混合上游也合并为 1 个任务(此前会多生成一张没图的)。
- 落地:取消/重下的在飞结果作废(不再双写或把 link-only 复活);abort 后不再回退二次抓取。
- 输出节点:ready 但本地 URL 未就绪时不再回退远程,修新图「从上往下」渐进重下。
- 输出节点双击预览改用图库条目(origIdb → 磁盘原图),不再直接喂远程 URL;打开即有缩略图、原图本地解析。
## v3.26.239(2026-12-03)清理未引用修正 + 模板节点连图修复
- 设置「清理未引用图片」:`images/thumbs/*_<max>` 缩略图缓存不再计入未引用、不再搬进 trash;弹窗文案与实现对齐(画布在用=保留、登记表缺失=已丢失无法恢复);trash 同名冲突加时间戳。
- 生成任务图:插件文本节点接了上游(如参考图)时不再丢自己的文本 —— 修「参考图 → 提示词模板 → 生图」只发图不发提示词导致的 400 INVALID_ARGUMENT。
- 新增守卫 `tests/plugin-text-node-refs-test.js`(6 条,进 test:unit)。
- 插件:promptlib 1.14.14(模板节点输入端口 / 变量内容支持长文本多行 / 节点双击标题回填 / 编辑防误关)。
## v3.26.238(2026-12-03)图片读取/下载口径统一(本地优先 + 图库行名)
- 新增本地原图读取:`galleryOriginalOf`(预览,原生按 2048 解码)/ `galleryOriginalBlob`(下载,原始字节),老记录不再退 320 缩略图。
- 任务队列预览改为只读本地(origIdb → images/gallery 原图);本地没有就提示「先下载」,远程链接不再参与预览。
- 下载统一本地优先(`wResolveOutputSrc` 先读本地字节);输出节点 / 预览 / 批量下载的文件名统一用图库行名(未落地回退 image.png、image-001.png)。
- 新增规范 `docs/standards/image-read-and-download.md` 与守卫 `tests/image-download-contract-test.js`(命名写死、预览直连远程都会被拦)。
- 棘轮:app.js 9345→9354(+9)、Workbench 2686→2687(+1),原因已写在常量注释。
- 构建链:`copy-plugins` 统一按 LF 写入 dist;`check-dist` 增加 dist/plugins 与 index.json 哈希校验(修 Windows autocrlf 下 style-source 被 SRI 拒绝)。
## v3.26.237(2026-12-03)任务队列页头/页签固定、页脚不再被压
- 插件根节点改为占满整页高度(`.iwb-tq{height:100%}`),宿主不再整页滚动;只有列表自己滚。
- 列表加 overflow-y:auto:修「行内容溢出压在页脚说明上」与「页头/筛选页签随列表滚走」。
- 任务队列预览取源改「原图优先」:老记录(无 origIdb)不再被 320 缩略图放大,改为原图链接优先、缩略图只兜底。
- 插件 taskqueue 1.0.3。
## v3.26.236(2026-12-03)顶栏标签条彻底固定
- 工作区标签条 portal 到 body + position:fixed,脱离 overlay 的滚动/层叠;插件页改 position:fixed。
- 修 235 在 WebView2 下仍会被整页滚动带走的问题。
## v3.26.235(2026-12-03)任务队列修复(选中/滚动/缩略图/定位)
- 修任务队列入口在离开页面后仍高亮(activePage 增加 shellView==='page' 判断)。
- 锁住插件整页滚动(只有 body 滚);工作区标签条改 fixed,页头不再被滚走。
- 队列缩略图/预览优先图库稳定字节(row.idb / row.origIdb),localUrl 最后;img onerror 回退占位。
- `archiveGenerationResults` 支持 meta(boardId/boardName/nodeId),兜底入队不再「未知画布」。
- 下载中超过 60 秒显示「可能卡住」并提供「重新下载」(cancel + retry);等待时长可见。
- 插件 taskqueue 1.0.2。
## v3.26.234(2026-12-03)任务队列体验修正
- 修任务队列页打开时画布图标仍选中(nav view 空串回退 canvas)。
- 缩略图复用图库已有的 320 缩略图(按 url 取 idb);占位图标修 SVG 命名空间;一次最多读 120 条并缓存。
- 标题改用提示词前 24 字 + 「第 N 张」;旧记录用「历史记录 · 时间 · #id」兜底;显示画布名(旧记录显示未知画布,不补)。
- 状态细分为「已入图库 / 待入库 / 下载中·排队中 / 下载失败 / 未下载」;失败行主按钮改为「下载」(land 会建图库行并重试),去掉含义模糊的「重试」。
- 插件 taskqueue 1.0.1。
## v3.26.233(2026-12-03)任务队列(左栏整页插件)
- 新增宿主 `queue` / `pages` 能力:全局生图账本(url/状态/画布/节点/模型/尺寸)、记录上限、下载落地图库、重试、复制原始链接、定位节点、点击缩略图预览。
- 新增插件 `taskqueue 1.0.0`:左栏一级入口「任务队列」整页;可启用/禁用;插件关闭时宿主仍按上限记账。
- 账本独立落 `library/task-queue/index.json`;上限 `canvas.taskQueueMax` 默认 500(100~5000),淘汰最旧不影响图库文件。
- 图库保持只显示已落地图片;「下载」= 建索引行 + 入落地队列,图库自动刷新。
## v3.26.232(2026-12-03)NEW 标记层叠修正
- 修「NEW 标记实际不可见」:角标在图片浮层(.iwb-dl-ov)之前、又没有 z-index,被图片盖住;把角标移到浮层之后(同为 positioned 元素,靠 DOM 顺序压在上面),不新增 z-index 声明。
- 实测:真实单元格 DOM(角标 + 图片浮层)下,角标像素为品牌色、在图片之上;点击仍不挡图。
## v3.26.231(2026-12-03)NEW 标记排除未落地
- 修「未落地且没有上一张可显示」时仍显示 NEW:isNew 增加 failed 状态排除,与「下载中/未落地不显示 NEW」一致。
## v3.26.230(2026-12-03)新图 NEW 标记 + 图库插件 1.9.12
- 输出节点新图左上角新增「NEW」标记:只标本次启动后生成、且已显示的新图;点击/双击即消失。
- 设置 → 生成 →「新图标记」可自定义显示时长(默认 120 秒,0 = 不自动消失);不跨重启。
- 图库插件 gallery 1.9.12:卡片下载钮改为与输出面板一致的 SVG 图标 / 26px / 无阴影(需在市场更新插件)。
## v3.26.229(2026-12-03)图库下载圆钮对齐输出面板
- 图库卡片的下载按钮改到右下角圆形图标(26px),与输出节点一致;修宿主旧规则把按钮居中在底部的问题。
- 只改宿主 CSS(body .iwb-history-embedded 作用域覆盖),不动插件产物、不改类名、不动 z-index/token。
## v3.26.228(2026-12-03)输出节点下载圆钮
- 输出节点结果图的下载浮层从底部横条改为右下角圆形图标:只占一个角,矮图不再被横条挡住中心。
- 只新增 .iwb-dl-corner / .iwb-dl-round 规则;容器 pointer-events:none、按钮 auto;不动 z-index、不动 token、不动图库。旧的横条样式保留可回退。
## v3.26.227(2026-12-03)图库一致性快修
- add 按 url 幂等(已存在复用、本批去重),从源头杜绝同一张图两条索引。
- 整批补漏前先等单张归档队列排空;每批结束自动按 url 去重(不再只在启动时去重)。
- markOk 前校验原图真的落盘;索引建行保留 orig 字段(修「文件在但图库一直不显示」)。
- 图库面板打开/刷新时做一次轻量自愈(去重 + 补标 ok),不用重启就能恢复。
## v3.26.226(2026-12-02)先落地再显示(单次下载)
- 结果图改为「先落地、再显示」:落地队列成为唯一下载器,输出格在新图本地字节就绪前继续显示上一张(不再白板),就绪后整体替换。
- 不再为缩略图/原图二次抓远程:图库索引与 320 缩略图统一由落地字节生成;自动下载也优先等落地字节(最多 20s)。
- 下载中显示百分比(有 content-length 时),失败保留旧图 + 「未落地」可点重试。
- 图库只展示已落地(orig=ok)的图,pending/missing 静默隐藏,修「缩略图加载失败」空卡。
## v3.26.225(2026-12-02)撤销失败态
- onLoad 时清除 is-broken / is-broken-cell:首帧本地 blob 失效打上的失败态,在回退远程加载成功后撤销,避免「加载失败」与半透明一直盖在正常图上。
## v3.26.224(2026-12-02)白板期可见
- 角标默认显示、图片 onLoad 后由 CSS 收起;骨架垫在图片下方(未绘制时可见),白板期不再没有任何提示。
## v3.26.223(2026-12-02)图库去重 + 超时续传
- 启动时按 url 去重图库索引(修 220 遗留的重复条目,同 url 优先保留已落地原图的那条)。
- 超时失败不再判永久失败:窗口重新聚焦时自动放回队列重试。
## v3.26.222(2026-12-02)归档补漏判定修正
- 归档补漏改按 item 级 url 判定(条目形状是 items[{url}],原先读 e.url 恒为 undefined → 重复入库)。
## v3.26.221(2026-12-02)回到渐进渲染
- 有远程 url 时不再用骨架遮挡(回到 203 的渐进渲染观感);骨架仅在连 url 都没有时出现。
- 落地下载超时由 60s 改为 300s(只作真挂死的安全阀,不误杀慢 CDN)。
## v3.26.220(2026-12-02)图库少一张 + 落地超时
- 修「一次出多张、图库少一张」:wasArchived 按条目对象记,单张归档标记后批量归档整批跳过;现在已标记但图库索引里查不到该 url 的仍会补入库。
- 落地下载超时 25s → 60s(实测该 CDN 常超 25s)。
## v3.26.219(2026-12-02)入库诊断
- 记录 add-outputs(in/accepted/skipNoOk/skipNoUrl)与 archive(entries/pending),用于定位「出图多张、图库少一张」。
## v3.26.218(2026-12-02)落地下载超时
- 落地队列的下载加 25s 超时:fetch 挂住时不再永久停在「下载中」,按失败重试并最终降级。
## v3.26.217(2026-12-02)打类目标修正
- 加载/失败态改用 closest(.iwb-out-cell)(img 被下载浮层包裹,parentElement 不是单元格);含 216 的骨架撑高。
## v3.26.216(2026-12-02)骨架撑高
- 输出单元格骨架由绝对定位改为撑高(min-height 140px),出图前不再塌成一条线。
## v3.26.215(2026-12-02)失败态可见
- 加载/失败态改用父容器打类(去掉 :has 依赖,兼容老 WebView2);破图收起骨架与角标并显示「加载失败」。
## v3.26.214(2026-12-02)加载态与失败回退
- 骨架与「下载中」角标改以图片 onLoad 为准(CSS :has 联动),消除「角标已撤、图还没出来」的空窗。
- onError 两级回退(本地 blob → 远程 url),都失败标 is-broken(半透明),不再显示破图。
## v3.26.213(2026-12-02)骨架 TDZ 修复
- 修输出单元格骨架的 TDZ(_localSrc 先声明再用,上一版五态全崩);骨架仅对远程 url 生效。
## v3.26.212(2026-12-02)输出单元格加载骨架
- 无本地源时在单元格垫一层「下载中…」骨架,避免大图区域纯空白;有缩略图时仍走 LOD 显示。
## v3.26.211(2026-12-02)角标空指针修复
- 修输出单元格角标在「视图未命中 + 远程 url」时抛 TypeError(先取安全状态再判);未落地优先于下载中。
## v3.26.210(2026-12-02)输出节点恢复「下载中」角标 + 分层修正
- 恢复输出单元格的「下载中」角标:判定改为「无本地源且结果为远程 url」,不再依赖落地视图是否命中。
- 落地状态视图改为宿主注入(src 不再直接读 window.IWBImageIngestView),修 architecture-boundary-guard;ResultImg 回到纯展示。
## v3.26.209(2026-12-02)对账不再常驻轮询
- 索引对账由「每 30s」改为「启动 3s 后 + 窗口重新获得焦点时」,闲置零开销(用户要求)。
## v3.26.208(2026-12-02)落地可观测 + 对账兜底
- ingest 补 enqueue/ready/failed 三类日志(kind=gallery-orig,双写 _boot.log),下载失败不再静默。
- 新增索引对账:启动 3s 后与每 30s 各扫一次,把「索引未 ok 但落地已有本地引用」的条目补写原图(幂等)。
## v3.26.207(2026-12-02)结果落地重试
- 修「批量出图部分原图不进 gallery」:ready 事件早于图库索引写入时,原来静默 return;现在记 orig-defer 并在 1s / 3s 后各重试一次,命中即补写原图。
## v3.26.206(2026-12-02)结果落地管线 / 图库原图 / 回滚下载钮改造
- 新增「结果落地队列」:出图后后台把远程图下到本地(幂等、重试 1/2/4s×3、并发 2、失败保留 URL、重启续跑),节点与图库不再直连 CDN。
- 落地成功即把**原图**写进 images/gallery(out_orig_)并把图库索引 orig 置 ok(写 ModularOutputStore,插件读的就是这份);修「仅缩略图」不消失。
- 节点取图回到 LOD 优先(本地源才走缩略图),避免每张图整幅解码原图。
- 图库缩略图优先用落地得到的本地副本,不再为同一张图二次请求远程。
- 回滚 204/205 的下载钮圆钮改造与 --iwb-dl-* token(导致图库加载异常、下拉弹层被压);恢复 203 的横条下载按钮。
- 修 .iwb-pop-anchor 的 z-index 被误删(模型/尺寸下拉打不开)。
- 补 result-img 单测的 useEffect 桩(183 起既有失败)。
## v3.26.182(2026-12-01)标注覆盖落地 / 空闲 CPU / 画布平移
- 修「标注插件覆盖后图片丢失」:写回后清空 localRef/ref(旧引用曾压过新数据)、失效缩略图缓存并重渲染;>200KB 的新图无损转 __blob 引用,DOM 不再挂 1.2MB base64(这也是空闲 CPU 15% 的主因)。
- 修「图片源已失效」:无缩略图时直接显示原图(不再返回空 src 触发 onError),onLoad 清除失效标记。
- 缩略图生成失败加负缓存,避免每次重渲染重复解码。
- 停用「合成层常驻提升」:常驻合成层会让窗口可见时持续吃 CPU;手势期临时提升保留。
- 平移:连线不再按视口裁剪、边线层不冻结;裁剪窗口边距 1.5 屏、步长 1/3 屏,手势期间只扩张不收缩;命中层每帧同步(空格平移无 pointerup)。
- 取消约 30% 的 LOD lite 档,只在 <15% 切占位,避免阈值附近闪动。
- 诊断:Windows 分进程内存拆解(工作集+私有+PID)、导出 JSON 带开关状态与图片管线、帧探针(rAF+longtask)、可关闭诊断采样;修 logPut 契约导致日志丢失。
- 插件:image-vectorize 0.6.3(关闭面板释放源图与 SVG)。
- 自动内存回收阈值放松:可见空闲 90s 轻量回收;RSS ≥ 2500MB 立即完整回收。
## v3.26.172(2026-12-01)空闲 CPU / 图片回退 / 诊断开关
- 修「标注替换原图后节点空白」:新写入的本地图片在没有缩略图时最多占位 300ms,超时回退显示原图;粘贴、图库插入、标注替换走同一逻辑。
- 自动内存回收阈值放松:可见空闲 90 秒即轻量回收;RSS ≥ 2500MB 时不等空闲,直接完整回收(含缩略图缓存)。实测大堆导致的空闲 GC 抖动(CPU ~20%)由此消除。
- 诊断页新增「关闭诊断采样」总开关(关掉后 15s 采样与 4s 进程轮询降频/跳过);面板明细自动刷新 8s → 60s,「刷新」按钮改为强制重取。
- 插件:image-vectorize 0.6.3(关闭面板释放源图与 SVG)。
## v3.26.169(2026-12-01)平移稳定性与诊断补强
- 平移不再按视口裁剪连线(新进入区域的连线不再迟到);平移期不冻结边线层,改为按帧重画。
- 节点裁剪窗口边距 0.7→1.5 屏、更新步长 1/2→1/3 屏;平移期间「挂过即不卸载」,松手后再按视口回收,消除节点在视野内突然出现。
- 连线命中层(透明 SVG)在手势期间每帧同步,并在松开空格/中键时收尾对齐;修复「平移后鼠标扫过旧位置仍点亮已移走的连线」。
- 诊断页:新增 Windows 分进程内存拆解(工作集 + 私有提交 + PID/角色)、导出 JSON 带开关状态与解码/缩略图/图库读数;新增「手势期提升」开关。
- 取消约 30% 的 LOD lite 档,只在 <15% 切纯占位,避免阈值附近来回切换导致画面闪。
- 清理 3 条 mac 侧 dead-code 警告(辅助函数补 cfg(unix))。
## v3.26.154(2026-12-01)平移:移动已画好的边线 Canvas,不再每帧重画
- 平移期间用 CSS translate 移动 `.iwb-edge-canvas` 缓存;松手后清 transform 并重画一次。
- 目的:减少 WKWebView 每帧 clear + stroke + 纹理上传;`iwb_pan_edges_redraw=1` 可退回旧行为做 A/B。
- 保留合成层开启:WebKit A/B 显示关闭后 pan p95 约 60ms,开启约 22ms。
- 平移全量渲染保持现状:关闭它没有帧率收益。
## v3.26.153(2026-12-01)修 cache-migrate 全失败导致的重复画板加载
- `IWBImageCacheMigrate` 增加 `isFailed(key)`;已知不可迁移的 `{__cache}` 不再让 `wBoardNeedsHydrate` 反复为真。
- `wBoardNeedsHydrate` 跳过失败缓存键,避免每次同步/切画板重复进入 `wLoadBoard`、刷 `cache-migrate ok=0 fail=N`。
- 新增 `tests/image-cache-migrate-test.js` 覆盖失败键只读一次。
- 插件 CSS 优化已在插件源仓修改,但市场尚未发布(见版本状态)。
## v3.26.152(2026-12-01)内存优化:简化卡片效果 + 可见空闲回收
- 图库卡片去掉 hover 放大/投影,只保留描边反馈;相册 cell 同样去掉 hover scale/双层阴影。
- 提示词库卡片移除 `.iwb-plp-bg` 的常驻 `will-change: transform`,并去掉 hover 阴影/放大;减少每卡片合成层。
- 自动回收折中:应用不可见时回收;可见但连续 5 分钟无输入时做轻量回收(保留显示缩略图)。
- 插件版本:gallery 1.9.9 / promptlib 1.14.11 / album 1.2.5。
## v3.26.151(2026-12-01)修复节点/浮层盖住顶部 tab 栏
- `.iwb-world` 增加 `z-index: 1` 形成画布内部 stacking context;
- 节点及其内部高 z-index 浮层不再越过 `.iwb-tabstrip`(z36)/顶栏(z35);
- 画布外层面板(工具栏/停靠栏/弹窗)不受影响。
## v3.26.150(2026-12-01)停止 Canvas V3 实验,回到 DOM 渲染
- **Canvas V3 实验停止**:移除诊断开关与产品入口;新增 kill switch,旧用户即使 localStorage 里还留有 `iwb_canvas_v3=1`,升级后也强制回 DOM。
- 插件/内置节点恢复原有 DOM 渲染与交互;不再有 Canvas 占位卡。
- 保留 Canvas V3 期间验证过的独立优化:屏幕坐标系 Canvas 边线、网格视口大小、裁剪 280、平移全量渲染、后台回收、图库 30s 预热、性能探针。
- Canvas V3 代码保留为未启用研究代码,不再进入产品路径。
## v3.26.149(2026-12-01)Canvas V3:LOD + 1000 节点基线
- Canvas 节点绘制增加屏幕宽度 LOD(<8px 底板、<40px 跳内容);
- headless Chromium 1000 节点:pan p95 21.5ms → 17.5ms,DOM 1000 → 0;
- 60 节点仍锁 60fps;WKWebView 实机待测。
## v3.26.148(2026-12-01)Canvas V3:layer 节点 + 插件 fallback 保持关闭
- `layer` 接入 Canvas:未选中画层列表,选中恢复完整 NodeCard;
- 内置类型除 plugin 外全部 Canvas 化;
- 插件 fallback 仍默认关闭,插件节点保持真实 DOM。
## v3.26.147(2026-12-01)Canvas V3 稳定化:插件 fallback 默认关闭
- 插件 fallback 改为仅 `window.__IWB_CANVAS_V3_PLUGIN_FALLBACK__ === true` 时启用;默认 Canvas V3 只接管内置类型,插件节点保持真实 DOM,避免未选中插件变空白。
- Canvas 图片缓存上限 64,避免 ref/out 缩略图无限常驻。
- 诊断页保留「Canvas V3 绘制」统计。
## v3.26.146(2026-12-01)Canvas V3:P3 插件 fallback + 诊断绘制统计
- Canvas V3 支持插件节点 plugin:*:未选中时 Canvas 占位,选中恢复真实插件 NodeCard(fallback,不是插件 Canvas 渲染)。
- 诊断页新增「Canvas V3 绘制 Xms · 帧 N · 图 M」,用于桌面实机对比。
- 默认仍关闭;P3 只是移除未选中插件 DOM,插件内容需选中后查看。
- 详细进度:docs/plans/canvas-v3-progress.md。
## v3.26.145(2026-12-01)Canvas V3 实验:8 类节点 Canvas 静态层(默认关闭)
- 新增 `IWBCanvasV3` 特性开关(诊断页「Canvas V3(实验,需刷新)」,默认关闭)。
+8 -5
View File
@@ -11,7 +11,7 @@
- 使用说明与功能: [`README.md`](README.md)
- 发布流程: [`PUBLISHING.md`](PUBLISHING.md)
- 线上: https://iwb.maqiart.eu.org
- 下载站: https://download.maqiart.eu.org
---
@@ -41,7 +41,7 @@ build esbuild 打包到 dist/(单 dist/app.js = src/ 模块按序
node --check app.js 与 dist/app.js 语法
check-dist.js 产物体检
lint ESLint(src/ + app.js,正确性规则)
test:unit 138 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
test:unit 143 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
test relay-task-graph-fixture + iwb-v32-web-test
test:facts 事实基线守门(见 §5)
typecheck 渐进类型检查(tsc --noEmit;范围 = src/*.js,不含 app.js)
@@ -105,8 +105,8 @@ IWB_WRITE_BOUNDARY_SNAPSHOT=1 node tests/architecture-boundary-guard-test.js #
| 守卫 | 位置 | 现在的上限 |
|---|---|---|
| `app.js` 总行数 | `tests/source-text-ratchet-test.js` `MAX_APP_JS_LINES` | **8,716**(另守「占总源码 ≤ 40%」,见 `MAX_APP_JS_SHARE`) |
| `Workbench()` 行数 | 同上 `MAX_WORKBENCH_LINES` | **2,314** |
| `app.js` 总行数 | `tests/source-text-ratchet-test.js` `MAX_APP_JS_LINES` | **9,368**(另守「占总源码 ≤ 40%」,见 `MAX_APP_JS_SHARE`) |
| `Workbench()` 行数 | 同上 `MAX_WORKBENCH_LINES` | **2,690** |
| 单组件行数(不含 Workbench)| 同上 `MAX_APP_COMPONENT_LINES` | **423** |
三条都是**只减不增**。确需在 app.js 增长时,必须**同步上调上限并在 commit 里写理由**(等于显式记账,不会悄悄发生)。
@@ -183,6 +183,8 @@ release: vX.Y.Z 发版
| 记在哪 | 记什么 |
|---|---|
| [`docs/standards/engineering-rulebook.md`](docs/standards/engineering-rulebook.md) | 新增的**工程规则**(§13.x,按主题编号) |
| [`docs/standards/image-read-and-download.md`](docs/standards/image-read-and-download.md) | **图片读取/下载口径**(取源顺序、命名;新增预览/下载入口先对照) |
| [`docs/standards/deploy-domains.md`](docs/standards/deploy-domains.md) | **域名边界**(网页版 / 下载站 / 插件市场互不干扰) |
| [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md) | 改动的**现状事实**(常量、模块数、已知缺陷) |
| [`CHANGELOG.md`](CHANGELOG.md) | 用户可见的变更(发版时) |
@@ -195,8 +197,9 @@ release: vX.Y.Z 发版
1. bump 版本:`node scripts/set-version.js X.Y.Z`,更新 CHANGELOG 后提交
2. `npm run verify:ci`
3. mac:`bash scripts/publish-update.sh`(构建双架构、签名、上传、生成 latest.json)
4. Windows:按 [`docs/WIN_BUILD_SPEC.md`](docs/WIN_BUILD_SPEC.md) 出 exe → NAS `_inbox/` → mac `publish-windows-update.sh` → 再跑一次 `publish-update.sh` 合并 latest.json
4. Windows:按 [`docs/WIN_BUILD_SPEC.md`](docs/WIN_BUILD_SPEC.md) 出 exe → 由 win 起一次性 tailnet HTTP 服务、mac 拉取并核对 sha256 → mac `publish-windows-update.sh` → 再跑一次 `publish-update.sh` 合并 latest.json
5. 登记 `site/releases.json`、生成站点、上传 NAS,打 tag `vX.Y.Z` 并 push
6. 发布验收:`npm run release:verify`(四处版本 + 三平台资产 sha + 下载页;有任何 ✗ 视为未发布完成)
> 版本只认 `package.json`;平台必须同批。详细规则见 [`PUBLISHING.md`](PUBLISHING.md) 与工程规则 §13.60。
+5 -5
View File
@@ -71,12 +71,12 @@ Windows 未签名:SmartScreen 提示,仅影响首次运行体验。
## 六、插件资源的来路
网页版插件由 Cloudflare KV 在 `/plugins/*` 提供;桌面版没有服务端,所以把
**发布产物**(`plugins/runtime/*.js`,文件名带内容哈希)随仓库带走,构建后由
`scripts/copy-plugins.js` 拷进 `dist/plugins/`。每个文件的 SHA-256 与
`plugins/index.json` 里的 `integrity` 一致(已校验)。
桌面版没有服务端:插件由**插件市场**(`market.maqiart.eu.org`)分发,用户按需安装到
`<资料目录>/plugins/`;安装时按 zip 的 `bundleSha256` + 逐文件 sha256 校验。
升级插件时:换掉 `plugins/runtime/` 里的文件 + 同步 `plugins/index.json` 即可,代码不用动。
随安装包内置的插件在仓库 `plugins/`(目录形插件 + 内容寻址的 `runtime/plugin-<id>.<hash12>.js`),构建时由 `scripts/copy-plugins.js` 拷入 `dist/plugins/`,打包后由 `strip-plugins` 剥离(插件只走市场)。
升级插件:源仓改 → `sync-plugins-from-repo.js` → `gen-market.js` → 上传市场(详见 `docs/reference/plugin-publish.md`)。
## 七、本机实测记录(2026-11-16,macOS arm64)
+8 -4
View File
@@ -29,12 +29,16 @@ bash scripts/publish-update.sh
`release.sh` 收尾会校验线上 `latest.json`,与本次版本不一致时打印告警并提示补跑 `publish-update.sh`。
注意 `publish-update.sh` 会**重新构建并覆盖 dmg**,所以顺序建议:先 `publish-update.sh`(写 latest.json + 覆盖 dmg),再跑 `update-releases.js` 按新 dmg 的 size/sha 登记、gen 站点、上传。
`npm run release:verify` 是发布收尾的统一验收(2026-12-02 新增):核对 latest.json / latest-windows.json / site/releases.json / package.json 四处版本一致、三平台齐全、每个资产在线上实际 size+sha256 与登记一致、下载页含当前版本。完整模式会下载 dmg/exe(约 40s),`-- --fast` 只比对 size。**任何一项 ✗ 都不要对外宣布发布完成。**
## Windows 发布
1. Windows 端按 [`docs/WIN_BUILD_SPEC.md`](docs/WIN_BUILD_SPEC.md) 构建 `*-setup.exe`,放 NAS `_inbox/`
2. mac 端签名:`bash scripts/publish-windows-update.sh <setup.exe>`
3. **再跑一次** `bash scripts/publish-update.sh`,把 `windows-x86_64` 合并进 `latest.json`
4. 下载页登记 Windows 条目并核验
1. Windows 端构建 `*-setup.exe`(不签名、不产 .sig),回报:本地路径 / 字节 / sha256 / `dist/version.json`。
2. **取件**:用户在 Windows 本机时优先让他直接装本地产物;mac 需要签名时,由 Windows 端起**一次性 tailnet HTTP**(`http://100.101.6.64:1876x/<token>/<file>`),mac 拉取并核对 sha256。
- 局域网地址(如 `10.20.2.111`)跨网段不通;早先用的 NAS `_inbox/` 取件已弃用(UDG 共享 mac 读不到),现在只走 tailnet HTTP。
3. mac 端签名并上传:`bash scripts/publish-windows-update.sh <setup.exe>`(签名 → 上传 `updates/windows-x86_64` → 写 `latest-windows.json`)。
4. 把 `windows-x86_64` 条目并入 `latest.json`(保留 darwin 两条签名),核验三平台齐平。
5. 下载页登记 Windows 条目,回读 exe 的字节与 sha256 一致。
## 版本/tag 纪律
+5 -5
View File
@@ -66,12 +66,12 @@ npx serve dist
## 与独立版的关系
独立版 `image-workbench-app`(Node 服务,本地 data/ 存储)功能保持一致且仍受支持;本 Web 版面向免服务器 / 免运维的部署场景。
独立版 `image-workbench-app`(Node 服务,本地 data/ 存储)功能保持一致且仍受支持。
桌面版**不再提供网页版部署**:`functions/`、`wrangler.toml`、Cloudflare Pages 发布流程与 KV 插件通道均已移除;仓库里的 `npx serve dist` 只用于本地静态预览,不是发布形态。
## 生产版本确认
```bash
curl -fsSL https://iwb.maqiart.eu.org/version.json
```
安装包是唯一发布形态:下载站 <https://download.maqiart.eu.org> ,插件市场 <https://market.maqiart.eu.org> 。
正式域名:`https://iwb.maqiart.eu.org`。稳定回滚标签的**现行语义**(`vX.Y.Z` / `stable-vX.Y.Z` / 移动可变 `stable` / `stable-verified-YYYY-MM-DD`)见 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md);历史锚点示例:`stable-v3.1.0-stability3` 等。
客户端「检查更新」读 `https://download.maqiart.eu.org/updates/latest.json`(macOS)与 `latest-windows.json`(Windows);发布后按 `PUBLISHING.md` 回读 `latest.json` / `latest-windows.json` / 下载页三处一致。稳定回滚标签的**现行语义**(`vX.Y.Z` / `stable-vX.Y.Z` / 移动可变 `stable` / `stable-verified-YYYY-MM-DD`)见 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md)。
+760 -108
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -45,7 +45,7 @@
|---|---|
| `nodeActions` | 给节点右键/工具条加自定义动作 |
| `canvas` | 只读访问画布(`getNodes` 等) |
| `canvasWrite` | 写画布(`setNodeImage` 等),**必须同时声明** |
| `canvasWrite` | 写画布(`setNodeImage` / `saveNodeImage`),接口合并进 `ctx.canvas`(无 `ctx.canvasWrite`),**必须同时声明** |
| `events` | 订阅宿主事件 |
| `storage` | 插件私有持久化(按插件 id 隔离) |
+1
View File
@@ -115,6 +115,7 @@ Get-ChildItem src-tauri\target\release\bundle -Recurse -File |
顺手验一下版本已嵌进 PE:`(Get-Item <setup.exe>).VersionInfo.FileVersion`。
## 7. 交付:**Taildrop 是首选通道(不需要任何密钥)**
> 2026-12-02 更新:实测 Windows 侧 `T:\iwb-download\_inbox` 落在 UGD 共享,mac 的 `/vol8/web` 读不到;现在默认用**一次性 tailnet HTTP**(`100.101.6.64:1876x/<token>/<file>`,token 两侧带斜杠)或 Taildrop,取完即关。
规范 §6 的路径是 scp 到 `[email protected]:/vol8/web/iwb-download/_inbox/`。**本机现状**:
Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

+485
View File
@@ -0,0 +1,485 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>任务队列 · UI 原型</title>
<style>
/* 设计 token 静态快照 —— **生成文件,勿手改**
*
* 源:src/theme-tokens.js(derive() + 本文件生成器的 SCALE 表)
* 生成:node scripts/gen-tokens.js --write (校验:--check,已进 verify:ci)
*
* 为什么要有这一层:JS 未执行的那一帧没有内联变量,用它顶住,避免首屏闪白/跳变。
* 所以它必须逐值等于 derive() 的输出 —— 这条约束由 scripts/gen-tokens.js --check 强制。
* 结构层(chrome/home/dock/edge/hr)刻意用 color-mix 表达关系式:换主题时 :root 的声明会在
* html 元素上按新的 --iwb-bg/--iwb-canvas-bg 重新求值,天然跟随。
*/
:root {
/* —— 表面阶(亮色往白里 mix) —— */
--iwb-bg: #f7f7f7;
--iwb-canvas-bg: #c6c6c6;
--iwb-layer: #f5f5f5;
--iwb-layer2: #ffffff;
--iwb-panel: #fefefe;
--iwb-node-bg: #efefef;
--iwb-field: #ffffff;
/* —— 结构层(公式与 derive 一致,见文件头) —— */
--iwb-chrome: color-mix(in srgb, var(--iwb-bg) 60%, var(--iwb-canvas-bg) 40%); /* 顶部 chrome 色:页面底与画布之间的过渡层(标签条用) */
--iwb-home-bg: color-mix(in srgb, var(--iwb-bg) 35%, var(--iwb-canvas-bg) 65%); /* 首页底色:画布色与顶栏色之间取 35/65 */
--iwb-hr: color-mix(in srgb, var(--iwb-border) 50%, var(--iwb-border2) 50%); /* 首页上的细分隔线 */
--iwb-dock-bg: color-mix(in srgb, var(--iwb-chrome) 55%, var(--iwb-canvas-bg) 45%); /* 左右停靠栏底色:排进 bg→chrome→home→canvas 灰阶 */
--iwb-dock-head-bg: color-mix(in srgb, var(--iwb-panel) 55%, var(--iwb-dock-bg)); /* 顶栏底色比停靠栏更浅一档 */
--iwb-accent-on-surface: color-mix(in srgb, var(--iwb-brand) 45%, var(--iwb-text)); /* 强调色当文字/图标用:与正文色混,亮色更沉、暗色更亮,两端过 4.5:1 */
--iwb-accent-tint: color-mix(in srgb, var(--iwb-brand) 18%, transparent); /* 强调色淡底:选中标签/药丸的底(与 --iwb-accent-on-surface 配对使用) */
--iwb-plugin-bg: var(--iwb-bg); /* v3.25.85 插件主题契约:插件只能用这组别名 */
--iwb-plugin-panel: var(--iwb-panel);
--iwb-plugin-layer: var(--iwb-layer);
--iwb-plugin-border: var(--iwb-border);
--iwb-plugin-text: var(--iwb-text);
--iwb-plugin-text2: var(--iwb-text2);
--iwb-plugin-brand: var(--iwb-brand);
--iwb-plugin-on-brand: var(--iwb-on-brand);
--iwb-plugin-err: var(--iwb-err);
--iwb-plugin-ok: var(--iwb-ok);
--iwb-plugin-warn: var(--iwb-warn);
--iwb-edge: var(--iwb-border2); /* 连线默认色:跟随边框灰(主题色只用于选中/悬停/上游高亮) */
--iwb-edge-hot: var(--iwb-brand);
--iwb-focus-ring: 2px solid color-mix(in srgb, var(--iwb-brand-text) 70%, transparent); /* 键盘焦点环(D8):颜色走 brand-text,暗色下 brand 画不出环 */
--iwb-edge-w: 1.8px; /* 外观自定义:由 src/ui-appearance.js 按配置写入,这里只给兜底默认值 */
--iwb-edge-dash: 4 3;
--iwb-node-radius: 14px;
--iwb-node-sel-w: 1px;
--iwb-grid-size: 1.4px;
--iwb-grid-gap: 22px;
--iwb-grid-on: 1;
--iwb-nav-w: 52px; /* 一级导航宽度:左停靠栏/工具栏让位都以它为基准 */
/* —— 描边 / 文字三级(目标对比度见 IWBThemeTokens.RATIO) —— */
--iwb-border: #c2c2c2;
--iwb-border2: #ababab;
--iwb-sel-surface: #eff0f1;
--iwb-sel-ring: #383838;
--iwb-text: #404040;
--iwb-text2: #5c5c5c;
--iwb-text-dim: #767676;
--iwb-color-text-on-canvas: #404040;
--iwb-node-text: #404040;
--iwb-node-text2: #6b6b6b;
--iwb-tint: #404040;
/* —— 品牌色:填充与文字是两个角色(D7) —— */
--iwb-brand: #6b7280;
--iwb-brand-text: #575d69;
--iwb-on-brand: #ffffff;
--iwb-grid-dot: #a6a6a6;
/* —— 插件表面四层(只提供取值,不做变量重指) —— */
--iwb-surface: #fefefe;
--iwb-hover: #e9e9e9;
--iwb-bg-menu: #fefefe;
--iwb-plugin-surface: #f5f5f5;
--iwb-plugin-card: #fefefe;
--iwb-plugin-inset: #ebebeb;
--iwb-plugin-hover: #e2e2e2;
/* —— 语义色 —— */
--iwb-err: #b91c1c;
--iwb-ok: #15803d;
--iwb-warn: #b45309;
--iwb-err-bg: #f1e1e1;
--iwb-err-bd: #dfa4a4;
--iwb-ok-bg: #e0ebe4;
--iwb-ok-bd: #a1cab0;
--iwb-warn-bg: #f0e7df;
--iwb-warn-bd: #deb99d;
/* —— 尺度层(L1)—— */
--sp-1: 4px; /* @deprecated 全部 5 个 → M3 的 --iwb-space-4/8/12/16/24 */
--sp-2: 8px;
--sp-3: 12px;
--sp-4: 16px;
--sp-5: 24px;
--rd-sm: 6px; /* @deprecated rd-sm/rd-md/rd-lg → M3 的 --iwb-radius-chip/control/popover */
--rd: 8px;
--rd-md: 10px;
--rd-lg: 12px;
--fs-xs: 10px; /* @deprecated fs-xs/fs-md/fs-lg/fs-xl → M3 的 --iwb-font-*(fs-sm 仍被引用) */
--fs-sm: 11px;
--fs-md: 12px;
--fs-lg: 13px;
--fs-xl: 14px;
--tr-fast: 0.1s ease-out;
--tr-base: 0.2s ease-out; /* @deprecated tr-base/tr-slow → M3 的 --iwb-motion-*(tr-fast 仍被引用) */
--tr-slow: 0.3s ease-out;
--iwb-space-2: 2px;
--iwb-space-4: 4px;
--iwb-space-6: 6px;
--iwb-space-8: 8px;
--iwb-space-10: 10px;
--iwb-space-12: 12px;
--iwb-space-16: 16px;
--iwb-space-20: 20px;
--iwb-space-24: 24px;
--iwb-space-32: 32px;
--iwb-space-40: 40px;
--iwb-space-48: 48px;
--iwb-space-64: 64px;
--iwb-radius-chip: 6px; /* M4 圆角:胶囊/标签 */
--iwb-radius-control: 8px; /* 输入框/按钮 */
--iwb-radius-card: 10px; /* 卡片/分组 */
--iwb-radius-panel: 12px; /* 面板/工具栏 */
--iwb-radius-popover: 14px; /* 浮层/菜单/右键 */
--iwb-radius-full: 999px; /* 圆形/药丸 */
--iwb-font-2xs: 10px; /* 极小标注:徽标角标/画布坐标/缩略图角标(2026-11-24 承认它,此前 29 处裸写) */
--iwb-font-xs: 11px; /* M4 字号:状态栏/徽标 */
--iwb-font-sm: 12px; /* 标签/次要正文 */
--iwb-font-md: 13px; /* 紧凑正文/工具栏标题 */
--iwb-font-base: 14px; /* 标准正文:表单行标题/命令输入/帮助正文 */
--iwb-font-lg: 15px; /* 小标题/节点标题 */
--iwb-font-xl: 17px; /* 面板标题 */
--iwb-font-2xl: 20px; /* 页面大标题 */
--iwb-font-display: 24px; /* 展示级标题:页面/视图主标题(≤5 处) */
--iwb-chrome-h: 36px; /* 顶部标签条高度:tabstrip / dockarea / home-panel 三处共用(原来各写一遍 36px) */
--iwb-tab-h: 28px; /* 标签高度 */
--iwb-tab-radius: 7px; /* 标签圆角 */
--iwb-control-h: 30px; /* 表单控件高度:同一行里的输入框与默认按钮必须等高(设置页实测曾是 33 vs 24) */
--iwb-bw: 1px; /* 描边宽度(2026-11-24):常规分隔/控件边框 */
--iwb-bw-strong: 2px; /* 强调描边:选中/焦点/危险操作(不要再用 2px 裸值) */
--iwb-icon-sm: 14px; /* 小图标:行内/按钮内 */
--iwb-icon-md: 16px; /* 标准图标:工具栏/菜单 */
--iwb-icon-lg: 18px; /* 大图标:导航/空态 */
--iwb-opacity-disabled: 0.45; /* 禁用态透明度(此前 0.45/0.55 混用) */
--iwb-opacity-muted: 0.7; /* 次要/未激活元素透明度 */
--iwb-ease-out: cubic-bezier(0.16, 1, 0.3, 1); /* 入场/展开缓动:快出慢停 */
--iwb-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); /* 状态切换缓动 */
--iwb-motion-fast: 0.12s; /* M6 动效:悬停/开关/小位移 */
--iwb-motion-base: 0.15s; /* M6 动效:面板展开/尺寸变化 */
--iwb-motion-slow: 0.3s; /* M6 动效:整屏过渡/抽屉 */
--iwb-motion-hover: 0.15s; /* L2 悬停:卡片/结果图浮层统一时长 */
--iwb-ease-hover: cubic-bezier(0.16, 1, 0.3, 1); /* L2 悬停:快出慢停 */
--iwb-hover-lift: -2px; /* L2 悬停:上浮位移 */
--iwb-hover-scale: 1.02; /* L2 悬停:缩放(相册格子单独用 1.08) */
--iwb-hover-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); /* L2 悬停:投影(单值,供 filter: drop-shadow 用;box-shadow 会多一种写法) */
--iwb-hover-border: var(--iwb-brand); /* L2 悬停:描边色 */
--iwb-scrim: rgba(0, 0, 0, 0.62); /* 图片上的遮罩渐变底:下载浮层/预览条(两套主题都用深色,保证白字可读) */
--iwb-selection-ring: var(--iwb-brand); /* 选中描边(跟随强调色) */
--iwb-selection-on: var(--iwb-on-brand); /* 选中描边的隔离内环(品牌底上的文字色) */
--iwb-selection-bg: color-mix(in srgb, var(--iwb-brand) 12%, transparent); /* 选中格淡底(不压黑缩略图) */
--iwb-selection-halo: color-mix(in srgb, var(--iwb-brand) 45%, transparent); /* 选中外发光(与 hover 区分) */
--iwb-z-ctx: 90; /* 右键遮罩 */
--iwb-z-ctx-menu: 91; /* 右键菜单 */
--iwb-z-curtain: 100; /* 应用遮罩 / 图片预览底 */
--iwb-z-command: 120; /* 命令面板(⌘K) */
--iwb-z-sheet: 260; /* 全窗口面板(资源中心) */
--iwb-z-sheet-menu: 270; /* 面板内 portal 菜单:> sheet、< modal */
--iwb-z-modal: 300; /* 弹窗 + 遮罩 */
--iwb-z-modal-menu: 310; /* 侧栏/弹窗里挂 body 的菜单 */
--iwb-z-splash: 400; /* 启动页 */
--iwb-z-toast: 500; /* 提示条:必须高于弹窗 */
--iwb-z-preview: 800; /* 图片预览(全屏) */
--iwb-z-anchor: 3200; /* 锚定浮层:挂 body 的面板/首页菜单 */
--iwb-z-palette: 3300; /* 背景色板 host(含锚定浮层) */
--iwb-z-alert: 4000; /* 确认框 / 崩溃屏(最后一道) */
/* —— 阴影 —— */
--sh-sm: 0 2px 8px rgba(0, 0, 0, 0.12); /* @deprecated → M3 的 --iwb-elevation-1 */
--sh-md: 0 6px 20px rgba(0, 0, 0, 0.16);
--sh-lg: 0 12px 32px rgba(0, 0, 0, 0.24);
--iwb-elevation-1: 0 2px 8px rgba(0, 0, 0, 0.12); /* 贴面浮层:浮动条 / 状态栏 */
--iwb-elevation-2: 0 10px 30px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.10); /* 浮窗 / 菜单 / toast */
--iwb-elevation-3: 0 18px 56px rgba(0, 0, 0, 0.26); /* 命令面板 / 锚定大浮层 */
--iwb-elevation-4: 0 24px 64px rgba(0, 0, 0, 0.30); /* 弹窗 / 全窗口面板 */
}
/* 暗色主题:html.theme-dark
* 同一套语义名,值来自 derive(DEFAULTS, true)。结构层不在这里重复定义 ——
* :root 的 color-mix 公式会在本元素上按新的 --iwb-bg/--iwb-canvas-bg 重新求值。 */
.theme-dark {
/* 生图动效在暗色下必须「发亮」:--iwb-brand 是中性灰,直接用会糊在深底里 */
--iwb-anim: #ffffff;
--iwb-anim-track: color-mix(in srgb, #ffffff 18%, transparent);
--iwb-anim-glow: rgba(255, 255, 255, 0.72);
--iwb-anim-tint: color-mix(in srgb, #ffffff 16%, transparent);
--iwb-anim-flow-a: color-mix(in srgb, #ffffff 26%, var(--iwb-layer));
--iwb-anim-flow-b: color-mix(in srgb, #ffffff 76%, var(--iwb-layer));
/* —— 表面阶 —— */
--iwb-bg: #121212;
--iwb-canvas-bg: #313131;
--iwb-layer: #161616;
--iwb-layer2: #1c1c1c;
--iwb-panel: #1c1c1c;
--iwb-node-bg: #3d3d3d;
--iwb-field: #494949;
--iwb-border: #333333;
--iwb-border2: #4d4d4d;
--iwb-sel-surface: #313234;
--iwb-sel-ring: #e8e8e8;
/* —— 文字 / 品牌 —— */
--iwb-text: #e3e3e3;
--iwb-text2: #bababa;
--iwb-text-dim: #989898;
--iwb-color-text-on-canvas: #b2b2b2;
--iwb-node-text: #e3e3e3;
--iwb-node-text2: #aaaaaa;
--iwb-tint: #e3e3e3;
--iwb-brand: #6b7280;
--iwb-brand-text: #b6bac0;
--iwb-on-brand: #ffffff;
--iwb-grid-dot: #525252;
/* —— 插件表面 / 浮层 / 语义色 —— */
--iwb-surface: #1c1c1c;
--iwb-hover: #2a2a2a;
--iwb-bg-menu: #3c3c3c;
--iwb-plugin-surface: #232323;
--iwb-plugin-card: #2c2c2c;
--iwb-plugin-inset: #191919;
--iwb-plugin-hover: #383838;
--iwb-err: #f26666;
--iwb-ok: #4acf7b;
--iwb-warn: #e1953d;
/* —— 阴影 —— */
--sh-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
--sh-md: 0 6px 20px rgba(0, 0, 0, 0.45);
--sh-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
--iwb-elevation-1: 0 2px 8px rgba(0, 0, 0, 0.40);
--iwb-elevation-2: 0 8px 28px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.40);
--iwb-elevation-3: 0 18px 56px rgba(0, 0, 0, 0.62);
--iwb-elevation-4: 0 24px 64px rgba(0, 0, 0, 0.70);
}
/* 亮色主题的生图动效 token:与暗色同结构,色取品牌色 */
:root:not(.theme-dark) {
--iwb-anim: var(--iwb-brand);
--iwb-anim-track: color-mix(in srgb, var(--iwb-brand) 16%, transparent);
--iwb-anim-glow: color-mix(in srgb, var(--iwb-brand) 75%, transparent);
--iwb-anim-tint: color-mix(in srgb, var(--iwb-brand) 7%, transparent);
--iwb-anim-flow-a: color-mix(in srgb, var(--iwb-brand) 16%, var(--iwb-layer));
--iwb-anim-flow-b: color-mix(in srgb, var(--iwb-brand) 46%, var(--iwb-layer));
}
/* component.settings:由 gen-tokens 生成,勿手改;布局属性仍在 style.css */
.iwb-settings-modal {
--iwb-set-label-w: 180px; /* 标签列宽 */
--iwb-set-col-gap: var(--iwb-space-16); /* 标签列与控件列间距 */
--iwb-set-row-h: 40px; /* 设置行高 */
--iwb-set-row-pad-y: var(--iwb-space-8); /* 行上下内边距 */
--iwb-set-group-gap: var(--iwb-space-32); /* 分组之间(规范 §3.11:32px) */
--iwb-set-title-gap: var(--iwb-space-8); /* 分组标题与分组体间距 */
--iwb-set-group-bg: hsl(0 0% 97.6%); /* 分组体底色:设计值 #F9F9F9(用 hsl 表达以过 hex 闸门) */
--iwb-set-group-radius: var(--iwb-radius-card); /* 分组体圆角 */
--iwb-set-group-pad-x: var(--iwb-space-20); /* 分组体左右内边距 */
--iwb-set-group-pad-y: var(--iwb-space-12); /* 分组体上下内边距 */
--iwb-set-divider: color-mix(in srgb, var(--iwb-border) 55%, transparent); /* 行分隔线 */
--iwb-set-hint-color: var(--iwb-text-dim); /* 说明文字色 */
--iwb-set-hint-size: var(--iwb-font-xs); /* 说明文字字号 */
--iwb-set-hint-gap: var(--iwb-space-2); /* 说明文字上间距 */
--iwb-set-input-border: color-mix(in srgb, var(--iwb-border) 40%, var(--iwb-panel)); /* 输入框描边 */
--iwb-set-check-size: 16px; /* 复选项尺寸 */
--iwb-set-check-radius: 4px; /* 复选项圆角 */
--iwb-set-btn-gap: var(--iwb-space-8); /* 操作按钮间距 */
}
/* component.settings · 暗色覆盖 */
.theme-dark .iwb-settings-modal {
--iwb-set-group-bg: color-mix(in srgb, var(--iwb-text) 8%, var(--iwb-panel)); /* 暗色分组体:文字色 8% 混面板 */
}
/* component.popover:由 gen-tokens 生成,勿手改;布局属性仍在 style.css */
.iwb-pop {
--iwb-pop-w: 360px; /* 面板宽度(窄屏靠 max-width 兜底) */
--iwb-pop-pad-y: var(--iwb-space-10); /* 面板上下内边距 */
--iwb-pop-pad-x: var(--iwb-space-12); /* 面板左右内边距 */
--iwb-pop-gap: var(--iwb-space-8); /* 分组之间 */
--iwb-pop-radius: var(--iwb-radius-popover); /* 面板圆角 */
--iwb-pop-title-size: var(--iwb-font-base); /* 面板标题字号 */
--iwb-pop-chip-h: 28px; /* 选择项/下拉/数字框高度 */
--iwb-pop-chip-pad-x: var(--iwb-space-10); /* 选择项左右内边距 */
--iwb-pop-chip-radius: 6px; /* 选择项圆角 */
--iwb-pop-chip-gap: var(--iwb-space-6); /* 选择项间距 */
--iwb-pop-chip-size: var(--iwb-font-md); /* 选择项字号 */
}
</style>
<style>
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--iwb-bg); color: var(--iwb-text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; font-size: var(--iwb-font-base); line-height: 1.45; }
.app { display: flex; height: 100vh; overflow: hidden; }
.rail { width: 56px; flex: 0 0 56px; background: var(--iwb-dock-bg); border-right: 1px solid var(--iwb-border); display: flex; flex-direction: column; align-items: center; padding: var(--iwb-space-10) 0; gap: var(--iwb-space-6); }
.rail .logo { width: 30px; height: 30px; border-radius: var(--iwb-radius-control); background: var(--iwb-brand); color: var(--iwb-on-brand); display: grid; place-items: center; font-size: var(--iwb-font-sm); font-weight: 700; margin-bottom: var(--iwb-space-6); }
.rail .item { width: 36px; height: 36px; border-radius: var(--iwb-radius-control); display: grid; place-items: center; color: var(--iwb-text2); cursor: default; }
.rail .item svg { width: var(--iwb-icon-lg); height: var(--iwb-icon-lg); }
.rail .item:hover { background: var(--iwb-hover); color: var(--iwb-text); }
.rail .item.active { background: var(--iwb-accent-tint); color: var(--iwb-accent-on-surface); }
.page { flex: 1; min-width: 0; padding: var(--iwb-space-24) var(--iwb-space-32) var(--iwb-space-16); display: flex; flex-direction: column; gap: var(--iwb-space-16); overflow: hidden; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--iwb-space-16); }
.title { font-size: var(--iwb-font-2xl); font-weight: 650; letter-spacing: .01em; }
.sub { display: block; margin-top: 2px; font-size: var(--iwb-font-sm); font-weight: 400; color: var(--iwb-text2); }
.tools { display: flex; align-items: center; gap: var(--iwb-space-8); flex-wrap: wrap; justify-content: flex-end; }
.field { display: inline-flex; align-items: center; gap: var(--iwb-space-6); font-size: var(--iwb-font-sm); color: var(--iwb-text2); }
select, button { font: inherit; }
select { height: 30px; padding: 0 var(--iwb-space-10); color: var(--iwb-text); background: var(--iwb-field); border: 1px solid var(--iwb-border2); border-radius: var(--iwb-radius-control); }
.btn { height: 30px; padding: 0 var(--iwb-space-12); border-radius: var(--iwb-radius-control); border: 1px solid var(--iwb-border2); background: var(--iwb-panel); color: var(--iwb-text); display: inline-flex; align-items: center; gap: var(--iwb-space-6); cursor: pointer; font-size: var(--iwb-font-sm); white-space: nowrap; }
.btn:hover { background: var(--iwb-hover); border-color: var(--iwb-hover-border); }
.btn.primary { background: var(--iwb-brand); color: var(--iwb-on-brand); border-color: var(--iwb-brand); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; background: var(--iwb-layer); color: var(--iwb-text2); border-color: var(--iwb-border); }
.tabs { display: flex; gap: var(--iwb-space-4); border-bottom: 1px solid var(--iwb-border); padding-bottom: 0; }
.tab { padding: var(--iwb-space-6) var(--iwb-space-10); font-size: var(--iwb-font-sm); color: var(--iwb-text2); border-radius: var(--iwb-radius-control) var(--iwb-radius-control) 0 0; cursor: pointer; display: inline-flex; align-items: center; gap: var(--iwb-space-6); }
.tab:hover { color: var(--iwb-text); background: var(--iwb-hover); }
.tab.active { color: var(--iwb-accent-on-surface); background: var(--iwb-accent-tint); }
.tab .n { font-size: var(--iwb-font-2xs); color: var(--iwb-text2); background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-full); padding: 0 6px; line-height: 15px; }
.tab.active .n { color: var(--iwb-accent-on-surface); background: transparent; border-color: var(--iwb-accent-on-surface); }
.list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: var(--iwb-space-8); padding-right: 2px; }
.row { display: grid; grid-template-columns: 96px minmax(0,1fr) auto; gap: var(--iwb-space-12); align-items: center; padding: var(--iwb-space-10); background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-card); transition: border-color .15s, background .15s; }
.row:hover { border-color: var(--iwb-hover-border); }
.row.failed { border-color: var(--iwb-err-bd); background: color-mix(in srgb, var(--iwb-err) 9%, var(--iwb-panel)); }
.thumb { cursor: zoom-in; width: 96px; height: 64px; border-radius: var(--iwb-radius-control); border: 1px solid var(--iwb-border); background: var(--iwb-layer2); overflow: hidden; position: relative; display: grid; place-items: center; }
.thumb svg, .thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.thumb .ph { color: var(--iwb-text2); display: grid; place-items: center; gap: 2px; font-size: var(--iwb-font-2xs); }
.thumb .ph svg { width: 20px; height: 20px; }
.thumb .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--iwb-layer); }
.thumb .prog i { display: block; height: 100%; width: 42%; background: var(--iwb-brand); }
.main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.line1 { display: flex; align-items: center; gap: var(--iwb-space-8); min-width: 0; }
.name { font-size: var(--iwb-font-base); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { flex: 0 0 auto; height: 18px; padding: 0 var(--iwb-space-8); border-radius: var(--iwb-radius-full); font-size: var(--iwb-font-2xs); line-height: 18px; border: 1px solid var(--iwb-border2); color: var(--iwb-text2); background: var(--iwb-layer); }
.badge.ok { color: var(--iwb-ok); border-color: var(--iwb-ok-bd); background: var(--iwb-ok-bg); }
.badge.err { color: var(--iwb-err); border-color: var(--iwb-err-bd); background: var(--iwb-err-bg); }
.badge.warn { color: var(--iwb-warn); border-color: var(--iwb-warn-bd); background: var(--iwb-warn-bg); }
.meta { font-size: var(--iwb-font-sm); color: var(--iwb-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.errline { font-size: var(--iwb-font-xs); color: var(--iwb-err); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; align-items: center; gap: var(--iwb-space-6); flex-wrap: wrap; justify-content: flex-end; }
.foot { font-size: var(--iwb-font-xs); color: var(--iwb-text2); display: flex; justify-content: space-between; gap: var(--iwb-space-12); }
.foot .hint { color: var(--iwb-text-dim); }
.empty { padding: var(--iwb-space-32); text-align: center; color: var(--iwb-text2); font-size: var(--iwb-font-sm); }
@media (max-width: 860px) { .page { padding: var(--iwb-space-16); } .row { grid-template-columns: 72px minmax(0,1fr); } .actions { grid-column: 2; justify-content: flex-start; } .thumb { width: 72px; height: 50px; } }
</style>
</head>
<body>
<div class="app">
<aside class="rail" aria-label="主导航">
<div class="logo">IW</div>
<div class="item" title="首页"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><path d="M3 10.5 12 3l9 7.5"/><path d="M5 9.5V21h14V9.5"/></svg></div>
<div class="item" title="画布"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 9h18"/></svg></div>
<div class="item" title="插件"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><path d="M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"/></svg></div>
<div class="item active" title="任务队列"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><path d="M4 6h12M4 12h12M4 18h8"/><circle cx="19" cy="18" r="2.2"/></svg></div>
</aside>
<main class="page">
<header class="head">
<div>
<div class="title">任务队列</div>
<span class="sub">全局生图记录 · 数据由宿主保存,插件关闭也继续记录</span>
</div>
<div class="tools">
<label class="field">记录上限
<select id="limit"><option>200</option><option selected>500</option><option>1000</option><option>2000</option><option>5000</option></select>
</label>
<button class="btn ghost" id="clear">清空记录</button>
<button class="btn ghost" id="theme">深色</button>
</div>
</header>
<nav class="tabs" id="tabs">
<div class="tab active" data-f="all">全部 <span class="n">6</span></div>
<div class="tab" data-f="ok">已完成 <span class="n">2</span></div>
<div class="tab" data-f="down">下载中 <span class="n">1</span></div>
<div class="tab" data-f="fail">失败 <span class="n">1</span></div>
<div class="tab" data-f="only">仅记录 <span class="n">2</span></div>
</nav>
<section class="list" id="list">
<!-- 已完成 -->
<div class="row" data-s="ok">
<div class="thumb" title="点击预览"><svg viewBox="0 0 96 64"><rect width="96" height="64" fill="#fff"/><text x="8" y="24" font-size="13" font-weight="700" fill="#111">古茗草莓</text><text x="8" y="40" font-size="13" font-weight="700" fill="#111">新品专场</text><text x="8" y="55" font-size="9" fill="#555">单杯不到12r</text></svg></div>
<div class="main">
<div class="line1"><span class="name">pop 手绘体设计 · 第 1 张</span><span class="badge ok">已完成</span></div>
<div class="meta">品牌视觉 · 12-03 14:20 · 1536×1024 · gpt-image-2.6</div>
</div>
<div class="actions">
<button class="btn" disabled>已在图库</button>
<button class="btn ghost">复制原始链接</button>
<button class="btn ghost">定位</button>
</div>
</div>
<!-- 下载中 -->
<div class="row" data-s="down">
<div class="thumb" title="点击预览"><svg viewBox="0 0 96 64"><rect width="96" height="64" fill="#fff"/><text x="8" y="26" font-size="13" font-weight="700" fill="#111">艺术字体</text><text x="8" y="44" font-size="11" fill="#111">买一送一</text></svg><div class="prog"><i></i></div></div>
<div class="main">
<div class="line1"><span class="name">艺术字体 · 第 1 张</span><span class="badge">下载中 42%</span></div>
<div class="meta">活动海报 · 12-03 14:22 · 1536×1024 · 正在写入 images/gallery</div>
</div>
<div class="actions">
<button class="btn" disabled>下载中…</button>
<button class="btn ghost">复制原始链接</button>
<button class="btn ghost">定位</button>
</div>
</div>
<!-- 失败 -->
<div class="row failed" data-s="fail">
<div class="thumb" title="点击预览"><svg viewBox="0 0 96 64"><rect width="96" height="64" fill="#fff"/><text x="8" y="26" font-size="12" font-weight="700" fill="#111">披萨新品</text><text x="8" y="44" font-size="12" font-weight="700" fill="#111">买一送一</text></svg></div>
<div class="main">
<div class="line1"><span class="name">艺术字体 · 第 2 张</span><span class="badge err">失败</span></div>
<div class="meta">活动海报 · 12-03 14:25 · 1536×1024</div>
<div class="errline">timeout · 已重试 3 次 · 原始链接仍可复制</div>
</div>
<div class="actions">
<button class="btn primary">重试</button>
<button class="btn ghost">复制原始链接</button>
<button class="btn ghost">定位</button>
</div>
</div>
<!-- 仅记录 -->
<div class="row" data-s="only">
<div class="thumb" title="点击预览"><div class="ph"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg><span>仅记录</span></div></div>
<div class="main">
<div class="line1"><span class="name">披萨新品 · 买一送一</span><span class="badge warn">仅记录</span></div>
<div class="meta">活动海报 · 12-02 18:10 · 1536×1024 · gpt-image-2.5</div>
</div>
<div class="actions">
<button class="btn primary">下载</button>
<button class="btn ghost">复制原始链接</button>
<button class="btn ghost">定位</button>
</div>
</div>
<!-- 已完成,画布已删除 -->
<div class="row" data-s="ok">
<div class="thumb" title="点击预览"><svg viewBox="0 0 96 64"><rect width="96" height="64" fill="#fff"/><text x="8" y="24" font-size="12" font-weight="700" fill="#111">pop 手绘体</text><text x="8" y="42" font-size="10" fill="#555">新品上市</text></svg></div>
<div class="main">
<div class="line1"><span class="name">pop 手绘体设计 · 第 2 张</span><span class="badge ok">已完成</span></div>
<div class="meta">品牌视觉 · 12-01 09:40 · 1536×1024</div>
</div>
<div class="actions">
<button class="btn" disabled>已在图库</button>
<button class="btn ghost">复制原始链接</button>
<button class="btn ghost" disabled>画布已删除</button>
</div>
</div>
<!-- 仅记录,节点已删除 -->
<div class="row" data-s="only">
<div class="thumb" title="点击预览"><div class="ph"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg><span>仅记录</span></div></div>
<div class="main">
<div class="line1"><span class="name">艺术字体 · 第 3 张</span><span class="badge warn">仅记录</span></div>
<div class="meta">活动海报 · 11-30 16:05 · 1536×1024</div>
</div>
<div class="actions">
<button class="btn primary">下载</button>
<button class="btn ghost">复制原始链接</button>
<button class="btn ghost" disabled>节点已删除</button>
</div>
</div>
</section>
<footer class="foot">
<span>记录只保留链接与本机状态;上限内自动淘汰最旧记录,不影响 images/gallery 里的文件。</span>
<span class="hint">点击「下载」= 落地到图库(图库会自动刷新出现)</span>
</footer>
</main>
</div>
<script>
const html = document.documentElement
const themeBtn = document.getElementById('theme')
themeBtn.addEventListener('click', () => { html.classList.toggle('theme-dark'); themeBtn.textContent = html.classList.contains('theme-dark') ? '浅色' : '深色' })
const tabs = Array.from(document.querySelectorAll('#tabs .tab'))
const rows = Array.from(document.querySelectorAll('#list .row'))
tabs.forEach((t) => t.addEventListener('click', () => {
tabs.forEach((x) => x.classList.toggle('active', x === t))
const f = t.getAttribute('data-f')
rows.forEach((r) => { r.style.display = (f === 'all' || r.getAttribute('data-s') === f) ? '' : 'none' })
}))
</script>
</body>
</html>
+163
View File
@@ -0,0 +1,163 @@
<!doctype html>
<html lang="zh-CN" data-theme="light">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>任务队列 · UI 方案</title>
<style>
:root{--bg:#f6f7f9;--panel:#fff;--panel2:#fafbfc;--line:#e8eaee;--line2:#dfe2e8;--text:#1a1a1a;--text2:#6b7280;--text3:#9aa1ab;--brand:#f59e0b;--brand-weak:#fff7e6;--brand-line:#f5d08a;--ok:#16a34a;--ok-weak:#eefaf0;--err:#dc2626;--err-weak:#fdeeee;--r:10px;--rs:8px;--shadow:0 1px 2px rgba(16,24,40,.04),0 8px 24px rgba(16,24,40,.06)}
html[data-theme="dark"]{--bg:#121212;--panel:#1c1c1c;--panel2:#202020;--line:#2a2a2a;--line2:#343434;--text:#e9e9ea;--text2:#9a9a9a;--text3:#6f6f6f;--brand:#f5a623;--brand-weak:#2a2114;--brand-line:#5a4420;--ok:#4ade80;--ok-weak:#16281b;--err:#f87171;--err-weak:#2c1a1a;--shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35)}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font:13px/1.5 -apple-system,"PingFang SC","Microsoft YaHei",sans-serif}
.app{display:flex;min-height:100vh}
.rail{width:52px;flex:0 0 52px;background:var(--panel);border-right:1px solid var(--line);display:flex;flex-direction:column;align-items:center;padding:10px 0;gap:6px}
.rail .logo{width:30px;height:30px;border-radius:9px;background:linear-gradient(135deg,#111,#444);margin-bottom:8px}
.rail button{width:36px;height:36px;border:0;border-radius:10px;background:transparent;color:var(--text2);display:grid;place-items:center;cursor:pointer}
.rail button:hover{background:var(--panel2);color:var(--text)}
.rail button.on{background:var(--text);color:var(--panel)}
.rail .spacer{flex:1}
.rail svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.head{padding:20px 24px 0;display:flex;align-items:center;gap:12px}
.head h1{margin:0;font-size:20px;font-weight:650}
.head .right{margin-left:auto;display:flex;gap:8px}
.ghost{height:30px;padding:0 12px;border:1px solid var(--line2);border-radius:var(--rs);background:var(--panel);color:var(--text2);cursor:pointer;font-size:12px}
.ghost:hover{background:var(--panel2);color:var(--text)}
.tabs{display:flex;gap:22px;padding:14px 24px 0;border-bottom:1px solid var(--line);margin-top:8px}
.tab{position:relative;padding:0 0 10px;border:0;background:none;color:var(--text2);font-size:13px;cursor:pointer}
.tab b{font-weight:600;margin-left:3px;color:var(--text3);font-size:12px}
.tab.on{color:var(--text);font-weight:600}
.tab.on:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;background:var(--brand);border-radius:2px}
.filters{display:flex;align-items:center;gap:8px;padding:12px 24px;flex-wrap:wrap}
.chip{height:30px;padding:0 10px;border:1px solid var(--line2);border-radius:8px;background:var(--panel);color:var(--text2);cursor:pointer;display:inline-flex;align-items:center;gap:6px;font-size:12px}
.chip.on{border-color:var(--brand);background:var(--brand-weak);color:var(--text)}
.search{flex:1;min-width:220px;height:32px;border:1px solid var(--line2);border-radius:8px;background:var(--panel);display:flex;align-items:center;gap:8px;padding:0 10px;color:var(--text3)}
.search input{border:0;outline:0;background:none;flex:1;font-size:12px;color:var(--text)}
.date{height:30px;padding:0 10px;border:1px solid var(--line2);border-radius:8px;background:var(--panel);display:inline-flex;align-items:center;color:var(--text3);font-size:12px}
.dates{display:flex;align-items:center;gap:8px;color:var(--text2);font-size:12px}
.list{padding:4px 24px 120px;display:flex;flex-direction:column;gap:8px}
.row{position:relative;display:flex;gap:14px;padding:14px;background:var(--panel);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow)}
.row:hover{border-color:var(--line2)}
.row.sel{border-color:var(--brand);box-shadow:0 0 0 1px var(--brand-line),var(--shadow)}
.thumb{position:relative;width:88px;height:88px;flex:0 0 88px;border-radius:var(--rs);overflow:hidden;background:var(--panel2);border:1px solid var(--line)}
.thumb .ph{position:absolute;inset:0;display:grid;place-items:center;color:var(--text3);font-size:10px;letter-spacing:.5px}
.thumb .img{position:absolute;inset:0;background:radial-gradient(120% 90% at 15% 10%,#ffe9c9 0,transparent 55%),radial-gradient(90% 70% at 85% 0,#d7f0e3 0,transparent 60%),linear-gradient(160deg,#efe6d8,#d9cbb8 45%,#bfae98)}
.thumb .img.b{background:radial-gradient(100% 80% at 20% 20%,#dfe8ff 0,transparent 60%),linear-gradient(160deg,#e9edff,#c7d3f5 50%,#a9b8e8)}
.thumb .img.c{background:radial-gradient(100% 80% at 70% 10%,#ffe3e0 0,transparent 60%),linear-gradient(160deg,#ffe9e5,#efc9c1 55%,#d9a99f)}
.thumb .badge{position:absolute;left:6px;top:6px;padding:1px 6px;border-radius:6px;font-size:10px;background:rgba(0,0,0,.55);color:#fff}
.thumb .prog{position:absolute;left:0;right:0;bottom:0;height:4px;background:rgba(0,0,0,.12)}
.thumb .prog i{display:block;height:100%;background:var(--brand);width:62%}
.thumb .err{position:absolute;inset:0;display:grid;place-items:center;background:var(--err-weak);color:var(--err);font-size:22px}
.body{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px}
.title{font-size:13.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.meta{display:flex;align-items:center;gap:10px;color:var(--text3);font-size:12px;flex-wrap:wrap}
.dot{width:3px;height:3px;border-radius:50%;background:var(--line2)}
.state{display:inline-flex;align-items:center;gap:5px;padding:1px 7px;border-radius:999px;font-size:11px;border:1px solid transparent}
.state.ok{color:var(--ok);background:var(--ok-weak);border-color:rgba(22,163,74,.25)}
.state.err{color:var(--err);background:var(--err-weak);border-color:rgba(220,38,38,.25)}
.state.dl{color:#b45309;background:var(--brand-weak);border-color:var(--brand-line)}
.state.wait{color:var(--text2);background:var(--panel2);border-color:var(--line2)}
.link{color:var(--brand);cursor:pointer;border-bottom:1px dashed rgba(245,158,11,.5)}
.errbar{margin-top:2px;padding:7px 10px;border-radius:8px;background:var(--err-weak);color:var(--err);font-size:12px;display:flex;gap:8px}
.errbar .rid{color:var(--text3);font-size:11px}
.actions{display:flex;align-items:center;gap:4px;flex:0 0 auto}
.ico{width:30px;height:30px;border:0;border-radius:8px;background:transparent;color:var(--text3);display:grid;place-items:center;cursor:pointer;font-size:14px}
.ico:hover{background:var(--panel2);color:var(--text)}
.primary{height:30px;padding:0 14px;border:0;border-radius:999px;background:var(--brand);color:#fff;font-size:12px;font-weight:600;cursor:pointer}
.primary:hover{filter:brightness(.96)}
.primary.ghostish{background:var(--panel);color:var(--text);border:1px solid var(--line2)}
.batchbar{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);background:var(--panel);border:1px solid var(--line2);border-radius:12px;box-shadow:var(--shadow);display:flex;align-items:center;gap:10px;padding:8px 12px}
.batchbar .n{font-size:12px;color:var(--text2)}
.batchbar button{height:28px;padding:0 10px;border-radius:8px;border:1px solid var(--line2);background:var(--panel);color:var(--text);font-size:12px;cursor:pointer}
.drawer{position:fixed;top:0;right:0;bottom:0;width:400px;background:var(--panel);border-left:1px solid var(--line);box-shadow:-12px 0 32px rgba(16,24,40,.1);padding:18px;overflow:auto}
.drawer h3{margin:0 0 4px;font-size:15px}
.drawer .sub{color:var(--text3);font-size:12px;margin-bottom:14px}
.kv{display:grid;grid-template-columns:78px 1fr;gap:8px 10px;font-size:12px;margin-bottom:14px}
.kv .k{color:var(--text3)}
.kv .v{word-break:break-all}
.kv code{font-family:ui-monospace,Menlo,monospace;font-size:11.5px;background:var(--panel2);border:1px solid var(--line);border-radius:6px;padding:2px 6px}
.sect{font-size:11px;letter-spacing:.6px;color:var(--text3);margin:16px 0 8px}
.row2{display:flex;gap:8px;flex-wrap:wrap}
.warn{margin-top:10px;padding:8px 10px;border-radius:8px;background:var(--brand-weak);border:1px solid var(--brand-line);color:#8a5a00;font-size:11.5px}
.hint{position:fixed;right:16px;bottom:16px;font-size:11px;color:var(--text3);background:var(--panel);border:1px dashed var(--line2);border-radius:8px;padding:6px 10px}
</style>
</head>
<body>
<div class="app">
<aside class="rail">
<div class="logo"></div>
<button title="首页"><svg viewBox="0 0 24 24"><path d="M3 10.5 12 3l9 7.5"/><path d="M5 9.5V21h14V9.5"/></svg></button>
<button title="画布"><svg viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 9h18"/></svg></button>
<button class="on" title="任务队列(新增)"><svg viewBox="0 0 24 24"><path d="M4 6h16"/><path d="M4 12h16"/><path d="M4 18h10"/><circle cx="19" cy="18" r="2.2"/></svg></button>
<button title="插件"><svg viewBox="0 0 24 24"><path d="M12 3l8 4.5v9L12 21l-8-4.5v-9L12 3z"/><path d="M12 12l8-4.5M12 12v9M12 12L4 7.5"/></svg></button>
<div class="spacer"></div>
<button title="帮助"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M9.5 9a2.5 2.5 0 1 1 3.6 2.3c-.7.4-1.1 1-1.1 1.8"/><path d="M12 17h.01"/></svg></button>
<button title="设置"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M4 12h2M18 12h2M12 4v2M12 18v2"/></svg></button>
</aside>
<main class="main">
<div class="head"><h1>任务队列</h1><div class="right"><button class="ghost" id="themeBtn">切换深色</button><button class="ghost">全部重试</button><button class="ghost">清理已完成</button></div></div>
<div class="tabs"><button class="tab on">全部 <b>124</b></button><button class="tab">下载中 <b>1</b></button><button class="tab">失败 <b>1</b></button><button class="tab">已完成 <b>121</b></button><button class="tab">历史 <b>1111</b></button></div>
<div class="filters">
<button class="chip on">▾ 筛选</button><button class="chip on">图片</button><button class="chip">视频</button><button class="chip">音频</button><button class="chip">文本</button>
<label class="search">🔍<input placeholder="搜索提示词、文件名或原始链接"></label>
<div class="dates"><span>创建日期</span><span class="date">2026-12-01</span><span>至</span><span class="date">2026-12-02</span></div>
<button class="chip">多选</button>
</div>
<div class="list">
<div class="row sel" data-drawer="1"><div class="thumb"><div class="img"></div><span class="badge">下载 62%</span><div class="prog"><i></i></div></div>
<div class="body"><div class="title">去掉画面顶部的文案与文案的装饰,保留背景与商品和装饰内容。</div>
<div class="meta"><span class="state dl">下载中 62%</span><span>gpt-image-2.6</span><span class="dot"></span><span>1824×2288</span><span class="dot"></span><span>1.8 / 2.9 MB</span></div>
<div class="meta"><span>2026-12-02 11:04:10</span><span class="dot"></span><span>耗时 1m 13s</span><span class="dot"></span><a class="link">查看原始链接</a></div></div>
<div class="actions"><button class="ico" title="取消下载">×</button><button class="primary ghostish">暂停</button></div></div>
<div class="row" data-drawer="1"><div class="thumb"><div class="err">!</div><span class="badge">未落地</span></div>
<div class="body"><div class="title">减少图片边缘四周的植物,提高清晰度</div>
<div class="meta"><span class="state err">下载失败 · 已重试 3 次</span><span>gpt-image-2.6</span><span class="dot"></span><span>1824×2288</span></div>
<div class="meta"><span>2026-12-02 10:51:22</span><span class="dot"></span><span>原始链接仍可用</span></div>
<div class="errbar">连接超时(CDN 返回 504)<span class="rid">request id 202612020905172288</span></div></div>
<div class="actions"><button class="ico" title="复制链接">⧉</button><button class="ico" title="浏览器打开">↗</button><button class="ico" title="删除">🗑</button><button class="primary">重试</button></div></div>
<div class="row" data-drawer="1"><div class="thumb"><div class="img b"></div><span class="badge">2048</span></div>
<div class="body"><div class="title">去掉图片边缘四周的植物,提高清晰度</div>
<div class="meta"><span class="state ok">已完成</span><span>gpt-image-2.6-vip</span><span class="dot"></span><span>批量 1/1</span><span class="dot"></span><span>1824×2288</span><span class="dot"></span><span>2.9 MB</span></div>
<div class="meta"><span>2026-12-02 10:43:08</span><span class="dot"></span><span>58s</span><span class="dot"></span><a class="link">打开预览</a><span class="dot"></span><a class="link">原始链接</a></div></div>
<div class="actions"><button class="ico" title="下载原图">↓</button><button class="ico" title="复制链接">⧉</button><button class="ico" title="定位节点">◎</button><button class="ico" title="删除">🗑</button><button class="primary">插入画布</button></div></div>
<div class="row" data-drawer="1"><div class="thumb"><div class="img c"></div><span class="badge">2048</span></div>
<div class="body"><div class="title">扩图,向 4 周扩图</div>
<div class="meta"><span class="state ok">已完成</span><span>gpt-image-2.6-vip</span><span class="dot"></span><span>1868×2288</span><span class="dot"></span><span>3.2 MB</span></div>
<div class="meta"><span>2026-12-02 10:02:17</span><span class="dot"></span><a class="link">打开预览</a><span class="dot"></span><a class="link">原始链接</a></div></div>
<div class="actions"><button class="ico" title="下载原图">↓</button><button class="ico" title="复制链接">⧉</button><button class="primary">插入画布</button></div></div>
<div class="row" data-drawer="1"><div class="thumb"><div class="ph">本地已清理</div><span class="badge">仅链接</span></div>
<div class="body"><div class="title">去掉画面顶部的文案与文案的装饰,保留背景与商品和装饰内容。</div>
<div class="meta"><span class="state wait">仅保留链接</span><span>gpt-image-2.6</span><span class="dot"></span><span>1824×2288</span></div>
<div class="meta"><span>2026-12-01 16:58:23</span><span class="dot"></span><a class="link">复制原始链接</a><span class="dot"></span><span>可重新下载</span></div></div>
<div class="actions"><button class="ico" title="复制链接">⧉</button><button class="primary">重新下载</button></div></div>
<div class="row" data-drawer="1"><div class="thumb"><div class="img"></div></div>
<div class="body"><div class="title">把背景换成浅灰色,保留商品与投影</div>
<div class="meta"><span class="state ok">已完成</span><span>gpt-image-2.6</span><span class="dot"></span><span>1536×1536</span><span class="dot"></span><span>1.4 MB</span></div>
<div class="meta"><span>2026-12-01 15:20:44</span><span class="dot"></span><span>47s</span><span class="dot"></span><a class="link">打开预览</a></div></div>
<div class="actions"><button class="ico" title="下载原图">↓</button><button class="primary">插入画布</button></div></div>
</div>
</main>
<aside class="drawer" id="drawer">
<h3>去掉图片边缘四周的植物,提高清晰度</h3>
<div class="sub">2026-12-02 10:43:08 · 58s · gpt-image-2.6-vip</div>
<div class="kv">
<div class="k">原始链接</div><div class="v"><code>https://cdn.example.com/gen/8f3a…-1824.png</code></div>
<div class="k">本地副本</div><div class="v">已落地 · 2.9 MB · <code>__blob:3f7c…</code></div>
<div class="k">显示层</div><div class="v">长边 2048(≈9 MB 纹理,导出仍用原图)</div>
<div class="k">来源</div><div class="v">节点「出图 3」 · 画板「主图」</div>
</div>
<div class="sect">操作</div>
<div class="row2"><button class="primary">插入画布</button><button class="chip">复制图片</button><button class="chip">复制链接</button><button class="chip">下载原图</button></div>
<div class="sect">重新获取</div>
<div class="row2"><button class="chip">重新下载(覆盖本地)</button><button class="chip">仅保留链接</button></div>
<div class="warn">本地字节被清理后,这条会变成「仅保留链接」;原始链接随时可重新下载,不会丢。</div>
</aside>
</div>
<div class="batchbar"><span class="n">已选 1 项</span><button>插入画布</button><button>批量下载</button><button>复制链接</button><button>删除</button></div>
<div class="hint">mockup:点行看详情 · 右上角切换深色</div>
<script>
var html=document.documentElement;
document.getElementById("themeBtn").onclick=function(){html.dataset.theme=html.dataset.theme==="dark"?"light":"dark";this.textContent=html.dataset.theme==="dark"?"切换浅色":"切换深色"};
document.querySelectorAll(".tab").forEach(function(b){b.onclick=function(){document.querySelectorAll(".tab").forEach(function(x){x.classList.remove("on")});b.classList.add("on")}});
document.querySelectorAll(".row").forEach(function(r){r.onclick=function(e){if(e.target.closest("button"))return;document.getElementById("drawer").style.transform="none"}});
</script>
</body>
</html>
+3 -3
View File
@@ -11,9 +11,9 @@
|---|---|---|---|
| P0 | 特性开关、渲染接口、基线指标 | 已完成(2026-12-01) | 关闭开关时行为零变化 |
| P1 | 图片/ref 节点 Canvas 化 + 选中 DOM overlay | 垂直切片完成,待桌面验证(默认关闭) | 100 图节点每节点 DOM=0;应用外壳 ~866 |
| P2 | 内置文本/gen/out/combine/batch/relay 节点 Canvas 化 | 基本完成(8 类已 Canvas,待桌面验证) | DOM < 500;编辑/生成不回归 |
| P3 | 插件节点 fallback + browser/webview | 待开始 | 旧插件可用;仅可见/选中挂 DOM |
| P4 | 稳定化、A/B、默认开启、旧路径退场 | 待开始 | 视觉/e2e/性能门禁通过 |
| P2 | 内置节点 Canvas 化 | 内置类型全部已 Canvas(plugin 除外),待桌面验证 | DOM < 500;编辑/生成不回归 |
| P3 | 插件节点 fallback + browser/webview | 已取消 fallback;插件永远 DOM | 旧插件可用;不参与 Canvas V3 |
| P4 | 稳定化、A/B、默认开启、旧路径退场 | **已停止**(2026-12-01,用户裁定) | 保留 DOM;Canvas V3 仅研究代码 |
## 目标架构
+109
View File
@@ -139,6 +139,115 @@
- 选中后恢复完整 NodeCard,下载/预览/分组仍走原逻辑。
实测 gen+out(out 接 1 张结果):DOM 771、NodeCard 0、canvas 正常绘制;直接调用 outThumbUrlsOf 返回结果 URL。
## 2026-12-01 · v3.26.145 发布(Canvas V3 实验,默认关闭)
- 已构建并发布 macOS arm64/x64:3.26.145;
- 诊断页「Canvas V3(实验,需刷新)」可开启;默认关闭;
- 已 Canvas 化:ref / prompt / textout / combine / batch / relay / gen / out;
- 插件、layer 及部分编辑态仍走 NodeCard;
- 桌面端实机 graphics/长帧、P3 插件 fallback 尚未验证。
发布地址:https://download.maqiart.eu.org/updates/latest.json
## 2026-12-01 · P3 插件 fallback(原型)
- Canvas V3 的 isType 谓词支持 `plugin` / `plugin:*`;
- 未选中插件节点由 canvas 画通用卡片(标题/占位),不挂插件 DOM;
- 选中后恢复插件 NodeCard(插件真实 UI 只在选中时挂载);
- 这是 fallback,不是插件 Canvas 渲染:插件内部仍无法直接参与 canvas,只是把未选中实例从 DOM 移除。
### P3 fallback + 诊断统计
- 插件节点未选中时走 Canvas 占位,选中恢复插件 NodeCard;
- `IWBCanvasV3.stats()` 返回 DOM、最近一次节点 canvas 绘制耗时、帧数、图片缓存数;
- 诊断页显示「Canvas V3 绘制 Xms · 帧 N · 图 M」,用于桌面实机 A/B。
## 2026-12-01 · v3.26.146 发布
- macOS arm64/x64 已发布 3.26.146;
- Canvas V3 仍默认关闭;新增插件 fallback 与诊断「Canvas V3 绘制」统计;
- 线上 latest:https://download.maqiart.eu.org/updates/latest.json
## 2026-12-01 · v3.26.151 顶部层级修复
- 用户反馈节点盖住顶部 tab 栏;
- `.iwb-world` 增加 `z-index:1`,使节点内部高 z-index 浮层被限制在画布内部 stacking context;
- tabstrip(z36)/顶栏(z35) 在其上;工具栏/停靠栏/弹窗不受影响;
- 已发布 3.26.151。
## 2026-12-01 · v3.26.149 发布
- Canvas V3 节点绘制 LOD(<8px 底板、<40px 跳内容);
- 1000 节点 Chromium:DOM 1000→0,pan p95 21.5→17.5ms;
- macOS arm64/x64 已发布 3.26.149,Canvas V3 默认关闭。
## 2026-12-01 · v3.26.148 发布
- layer 节点接入 Canvas;
- 内置类型除 plugin 外全部 Canvas 化;
- 插件 fallback 仍默认关闭;
- macOS arm64/x64 已发布 3.26.148,Canvas V3 默认关闭。
### P4 浏览器基线探针(2026-12-01)
在 `tests/_perf-baseline.spec.js` 增加 `IWB_CANVAS_V3` 开关,60 节点 light probe(headless Chromium,非 WKWebView):
| 模式 | DOM 节点 | pan p50 | pan p95 | max | longtasks |
|---|---:|---:|---:|---:|---:|
| Canvas V3 off | 60 | 16.7ms | 17.7ms | 18.0ms | 0 |
| Canvas V3 on | 0 | 16.7ms | 17.3ms | 18.6ms | 0 |
结论:Chromium 下两者都锁 60fps,Canvas V3 的收益主要体现为 DOM 数(60→0);WKWebView 需桌面实机验证。
运行:`IWB_CANVAS_V3=1 IWB_PROBE_NODES=60 IWB_PROBE_LIGHT=1 npx playwright test tests/_perf-baseline.spec.js`。
### P4 LOD + 1000 节点基线(2026-12-01)
Canvas 节点绘制增加屏幕宽度 LOD:
- 屏幕宽度 <8px:只画底板;
- <40px:跳过标题/文本/图片;
- 正常缩放:完整体。
1000 节点 light probe(headless Chromium):
| 模式 | DOM 节点 | pan p50 | pan p95 | max |
|---|---:|---:|---:|---:|
| off | 1000 | 16.7ms | 21.5ms | 26.0ms |
| on + LOD | 0 | 16.6ms | 17.5ms | 17.6ms |
结论:Chromium 下 1000 节点时 Canvas V3 的 p95 从 21.5ms 降到 17.5ms;WKWebView 仍需实机。
### P4 7000 节点压力探针(2026-12-01)
headless Chromium,7000 节点,light probe:
| 模式 | DOM 节点 | pan p50 | pan p95 | max | longtasks |
|---|---:|---:|---:|---:|---:|
| off | 7000 | 34.0ms | 139.5ms | 400.5ms | 27 / 2136ms |
| on + LOD | 0 | 16.5ms | 18.8ms | 20.7ms | 0 |
结论:7000 节点时 Canvas V3 差距非常明显;这也是当前浏览器端最强的收益证据。
WKWebView 仍需桌面实机复测。
## 2026-12-01 · v3.26.147 发布
- 插件 fallback 默认关闭;后续已彻底移除(插件节点永远走真实 DOM)。
## 2026-12-01 · 插件显示修复
- 用户反馈 Canvas V3 开启后插件显示异常;
- 已移除插件 fallback 代码:插件节点永远走真实 DOM,Canvas V3 只接管内置类型;
- 不再受 __IWB_CANVAS_V3_PLUGIN_FALLBACK__ 影响。
## 2026-12-01 · 方向停止(用户裁定)
- Canvas V3 开启后,gen/out/combine/plugin 等节点只剩卡片壳,编辑/插件内容不可用;
- 继续需要完整节点编辑 overlay + 插件 Canvas API,收益不足以覆盖风险;
- 决定:停止 Canvas V3,回到 DOM 渲染;
- 处理:移除诊断开关与产品入口,新增 kill switch(旧 localStorage 值也强制关闭);
- 保留独立优化:Canvas 边线、视口网格、280 裁剪、平移全量渲染、后台回收、30s 预热、性能探针;
- Canvas V3 代码保留为未启用研究代码,后续可删除。
### P2 第五批:layer
- `layer` 加入 Canvas 类型;未选中画层列表(最多 8 层),选中恢复完整 NodeCard;
- 现在内置类型中除 plugin 外已全部 Canvas 化:ref/prompt/textout/combine/batch/relay/gen/out/layer;
- layer 的图层缩略图/蒙版编辑仍只在选中后的 NodeCard 中。
- Canvas 图片缓存上限 64;
- macOS arm64/x64 已发布 3.26.147;Canvas V3 仍默认关闭。
### 稳定化:插件 fallback 默认关闭
- 插件未选中时直接画空白占位会隐藏相册/图库/网页内容,体验不可接受;
- v3.26.147 起插件 fallback 只在 `window.__IWB_CANVAS_V3_PLUGIN_FALLBACK__ === true` 时启用;
- 默认 Canvas V3 只接管内置类型,插件节点保持原 DOM;
- 图片 canvas 缓存上限 64,避免大量 out/ref 缩略图无限常驻。
### P2 第三批:gen
- `TYPES` 增加 `gen`;未选中 gen 节点改为 canvas 卡片(标题/摘要),选中恢复 NodeCard 配置;
+254
View File
@@ -0,0 +1,254 @@
# 质量与性能优化计划(2026-12-02,执行中 · 未提交)
> 依据:`performance-lessons-2026-12-01.md`、`workflow-2026-12-02.md`、2026-12-02 代码体检与插件调用面取证。
> 状态:第 0 步 + A 已提交并出包 3.26.183(Windows 包已验证通过);A2 + B 本轮完成(未提交);C 未开工。
## 0. 体检结论(含门禁现状)
- `app.js` 8,939 行(单文件装配,不在 tsc 范围);`src/` 123 个模块;单测 139 个文件。
- `tsc` / `eslint` 通过。**但 `verify:ci` 在 HEAD 上是红的**,共 4 处,不能拿「全绿」当基线:
1. `source-text-ratchet`:app.js 8,939 > 上限 8,743(174–182 连续修 bug 期间累积 +196,未记账)。
2. `architecture-facts-guard` §3:视口裁剪守卫还在找 `- pad / + pad` 文本,`cullRectsOf` 已重构成 `const p = pad + extra`(行为等价,守卫文本过期)。
3. `architecture-facts-guard` §6:`architecture-current-state.md` 里的棘轮数字(appLines / workbenchLines / sharePct / srcLines)过时。
4. `architecture-facts-guard` §7:文档未记录基线 SHA `738b70c5`。
- `preflight` 仅因 `src-tauri/Cargo.lock` 有一行构建残留(3.26.180→3.26.182)而红,已还原。
- 近两天 4 个线上问题全部落在同一条图片链路:取图 → 缩略图 → 写回 → 节点渲染。
## 1. 范围
| 编号 | 事项 | 产出 |
| --- | --- | --- |
| 0 | 门禁恢复绿 | 棘轮记账、守卫文本、事实文档、Cargo.lock |
| A | 图片写入路径收口 | `src/image-writeback.js` + 单测 |
| A2 | 插件批次(解耦,不占出包) | white-bg-800 1.2.3、blank-canvas 1.0.1 |
| B | preflight 强化 | 文档过期词扫描 + `global.*` 只减不增 |
| C | 性能回归入口 | 扩展 `_perf-baseline.spec.js` 帧探针断言 |
不做(另排):发布脚本固化(`release:desktop`)、远程图纹理长边限制、`src` 开 `noImplicitAny`。
## 2. A|图片写入路径收口
### 2.1 插件调用面取证(12 个插件实测)
| 能力 | 使用方 | 结论 |
| --- | --- | --- |
| `setNodeImage` | blank-canvas、white-bg-800 | **同步返回布尔**,必须保持同步 |
| `saveNodeImage` | image-annotate(+ setNodeImage 兜底) | 唯一关心落盘结果的插件 |
| `createImageNode` | white-bg-800、image-annotate、image-vectorize、xianyi-cutout、style-source、promptlib | 只用返回 id/布尔 → 宿主引用化对插件透明 |
| `getNodeImage` | 上述 + batch-export、ai-chat | 只读;`nodeImageOf` 走 `refDataUrl`,引用化后仍返回 dataUrl |
| `ctx.images.*` | 仅 album | 本来就走 `wImportImage` 引用式,与写回不交叉 |
### 2.2 三条硬边界
1. **`setNodeImage` 不得改成异步**:`blank-canvas/src/index.js:90`、`white-bg-800/src/index.js:273` 都是 `if (!setNodeImage(...)) throw`;返回 Promise 会恒真、错误静默,image-annotate 的兜底三元也会误判。它只能是同步包装:改内存(commit 一次)+ 失效缓存 + bump,**不调 saveNow**。
2. **`createImageNode` 目前完全不做引用化**:白底新建(`replace` 默认 false)、抠图、矢量化、风格图、提示词封面都把几 MB base64 直接写进 `node.data.data` —— 与标注同源。宿主内部异步引用化对 6 个调用点零改动。
3. **`orig` 备份是 182 的隐性坑**:首覆盖把旧图整串塞进 `data.orig`(工作区 JSON 多一份);第二次覆盖时 `prev.data` 已是引用对象,`typeof === 'string'` 不成立 → orig 判空,右键「还原替换前原图」静默消失。
### 2.3 三个入口(`src/image-writeback.js`)
- `replaceNodeImage(id, dataUrl)`:`await importer(keepOriginal)` → 组装 patch(`data/url/localRef/ref` 同指一个引用,orig 一并引用化)→ `commitCanvas` 一次 → `saveNow` → 回读校验,失败回滚旧图并返回原因 → 失效缩略图(**旧值 key + 新值 key,双档**)→ `bump` → 写 `plugin-img` 日志。
- `replaceNodeImageSync(id, dataUrl)`:同步 patch + 失效 + bump,返回严格布尔;仅当 `length > inlineMax` 时后台引用化(同样的 commit 通道,靠防抖落盘)。
- `createNodeImage(payload)`:同步建节点返回 id;`length > inlineMax` 时后台引用化并 `bump`。
### 2.4 阈值唯一口径
**唯一判据 = `wImportImage` 的内联阈值 `IMPORT_INLINE_MAX`(字符数,现 3000)**,超过即引用化。
- 引用化一律走 `wImportImage(dataUrl, { keepOriginal: true })`(无损、不重压缩、含 `{__blob}` 主通道与 `{__cache}` 兜底)。
- **删除 182 里那处裸 `wImgRefWrite` + `200 * 1024` 字符阈值的旁路**,不留第二套。
- `inlineMax` 由 `app.js` 从同一个常量注入,模块内不写字面量。
### 2.5 `orig` 读取点盘点(收口前逐个改)
| 位置 | 用途 | 处理 |
| --- | --- | --- |
| `app.js` `origImagePatch` | 写入 | 迁进模块;旧图走同一 importer 引用化,已是引用则原样保留 |
| `app.js` 右键「还原替换前原图」 | 读取/回填 | 改为 `wImgRefDataUrl` 解析(string/ref 都支持),回填后同样引用化 |
| `src/runtime-workbench-logic.js` `dataOk` 校验 | 读取比较 | 保持引用比较(`sd.orig !== prev.orig`) |
| `src/runtime-workbench-logic.js` `HISTORY_IMG_REF_FIELDS` | 撤销快照引用化 | **补 `'orig'`**(现在漏了 ⇒ 每次覆盖都在历史里留一整串 base64) |
### 2.6 文档修正(本轮一起做)
- `docs/standards/plugin-development.md:53,57`:`canvasWrite` 已合并进 `ctx.canvas`(`src/plugin-host.js:8`),旧写法会让新插件调 `ctx.canvasWrite.setNodeImage` 直接报「宿主不支持」。
- 同文档补两行契约:`setNodeImage` = 同步、不落盘;`saveNodeImage` = 落盘 + 校验 + 失败回滚。
- 补一句 `getNodes()` 返回的 `data` 是只读视图(实际目前是同一对象引用,见 §9 记录,本轮不改)。
### 2.7 单测(`tests/image-writeback-test.js`,5 条具体断言)
1. `replaceNodeImageSync` 返回**严格布尔**(`typeof === 'boolean'`、不是 Promise),`saveNow` 调用 0 次(不落盘),`commitCanvas` 恰好 1 次(UI 必须更新,这里的「不提交」只指不落盘)。
2. `replaceNodeImage` 成功后 `data / data.localRef / data.ref` 三者是同一个引用对象,且节点里没有 `data:` 字符串残留。
3. 覆盖两次:第一次把旧图变成 `orig` 引用;第二次 `orig` 仍是引用(不是 base64、不丢),且还原动作能解析回原图。
4. 阈值唯一:`length <= inlineMax` 时不产生引用(不调 importer);`> inlineMax` 时恰好调一次 importer。
5. 双 key 失效:旧值 key 与新值 key 都被失效(引用对象也取得到 key),512/256 两档都删。
> 门禁联动:新测试文件必须加进 `package.json` 的 `test:unit`(`architecture-facts-guard` 查「无孤儿单测」);`source-text-ratchet` 里 `saveNodeImage` 相关文本钉点按实测收紧。
### 2.8 行数棘轮处理
搬走写回装配约 −70 行后仍有差额(8,939 → ≈8,869,上限 8,743)。处理方式:
- 本轮**显式上调** `MAX_APP_JS_LINES` 到实测值(零余量),注释写清:174–182 修 bug 期间 +196 未记账、本轮搬走写回装配 −70、剩余 +126 显式记账,后续按 domain 拆回落。
- 不新增任何 app.js 逻辑;A 项之后 app.js 只减不增。
## 3. A2|插件批次(与出包解耦)
- **white-bg-800 1.2.3**:覆盖模式改「`saveNodeImage` 优先 + 老宿主 `setNodeImage` 兜底」(与 image-annotate 同款三段式),失败要有可见提示。
- **harness 必须双形态参数化**(2026-12-02 补):市场窗口期用户可能仍跑 3.26.182(无 `saveNodeImage` 的新语义),所以 mock 要按 `hostKind` 跑两遍 ——
① 新宿主:有 `saveNodeImage`(返回 `{ok,error}`、会校验落盘);断言「走 saveNodeImage 时 setNodeImage 调用 0 次」、失败时把 error 抛给用户;
② 老宿主:没有 `saveNodeImage`;断言回落到同步 `setNodeImage` 且仍返回 `true`。
只覆盖一种形态等于另一半永远假通过。
- **blank-canvas 1.0.1**:空白判定从 `!data.data && !data.url` 加上 `localRef / ref`,避免只有本地引用的节点被误判为空、被白图覆盖。
- image-annotate 不改。
- 插件不进安装包(`beforeBuildCommand` 已剥离 `dist/plugins`),两仓可并行推进;但**插件改动必须各自过 harness/测试**才算完成。
## 4. B|preflight 强化
**B1 文档过期词扫描**:扫 `README.md` / `CONTRIBUTING.md` / `PUBLISHING.md` / `docs/standards` / `docs/reference`(排除 `archive`、`history`、`CHANGELOG`),命中即 FAIL:
`functions/api`、`functions/plugins`、`verify:release`、`plugins-publish`、`wrangler`、`_inbox`。行内含 `~~` 或「已删除/已下线/已停用」时豁免。
**B2 `global.*` 棘轮**:统计 `src/*.js` 的 `global.X =`(实测 119),写成常量只减不增;新增需同批下调基线。
**B3 棘轮上调必须自证(2026-12-02 补,针对「谁写谁抬」)**:`MAX_APP_JS_LINES` / `MAX_WORKBENCH_LINES` / `MAX_SRC_COMPONENT_LINES` 这一行
必须同时含「日期 + 行数差 + 原因」,否则 CI 红。判据:该行能匹配 `\d{4}-\d{2}-\d{2}`、`[+-]\d+`、且长度 > 40 字。
目的:上调本身仍是一次**显式记账**(评审能在 diff 里看到日期和差额),而不是把上限改成一个更大的数字了事。
验收:`npm run preflight` 通过;故意加一行 `global.FooBar =` 会红;故意写 `verify:release` 会红;把某条棘轮上限改大但删掉「日期/差额」→ 红(B3)。
## 5. C|性能回归入口
扩展既有 `tests/_perf-baseline.spec.js`(7k 节点平移、可选 CPU/VISUAL/PROFILE,已被 `list-e2e-specs.js` 排除,不进 CI):
1. 复用平移段,开 `iwb_perf_probe` 后读 `window.IWBPerf.recent`;
2. 新增断言:`long` 帧比例与 `js` 总时长上限(阈值先宽,跑稳再收紧);
3. `IWB_PROBE_LIGHT=1` 作为日常快速档。
验收:本地跑出基线并记录;连续两次差异 <20%。
## 6. 出包口径(Windows 侧)
- A 项改宿主代码 ⇒ 完工后出新版本 **3.26.183**,三处同步:`package.json` / `src-tauri/tauri.conf.json` / `src-tauri/Cargo.toml`(`preflight` 第 2 项校验这三处);`src-tauri/Cargo.lock` 由构建改动,**交付前还原**。
- win 侧只出 NSIS x64:不签名、不产 `.sig`、不动 `latest*.json` / `releases.json` / 站点。
- mac 侧交付时给:基线 commit + 三处版本号;win 侧回:路径 / 字节 / sha256 / FileVersion。
- 插件批次不占出包,单独走市场。
- **183 出包前若还要动 app.js,棘轮必红**(上限已等于实测、零余量):必须在**同一次提交**里同步上调 `MAX_APP_JS_LINES` / `MAX_WORKBENCH_LINES`,并按 B3 写清「日期 + **相对上一版上限**的差(如 +196 / −28)+ 原因」,别等 CI 红了临时抬;差值不要写成相对 HEAD,否则基线一漂就没人能核对。
- **提交 3.26.183 之后必须同步基线锚点**:`docs/standards/architecture-current-state.md` 第 4 行的 `main = <sha>` 要指向**这次 bump 提交**,
否则 `npm run test:facts` 会红(守门第 7 组)。当前锚点是 `main = 738b70c5`(最近一次 bump,v3.26.182 的提交),A 项未提交期间这是正确的。
## 7. 执行顺序与检查点
0. 门禁恢复绿(§0 的 4 处)→ `npm run test:facts` + `node tests/source-text-ratchet-test.js` 绿
1. A 代码 + 单测 → `node --check app.js`、新单测、棘轮
2. A2 插件仓(独立,各自 harness 绿)
3. B → `npm run preflight`
4. C → `IWB_PROBE_LIGHT=1` 记录基线
5. 收尾:更新 `performance-lessons`(每项 3 行)
每步不过就停。
## 8. 交付物
- 代码:`src/image-writeback.js`、两处调用改造 + `createImageNode` 引用化、`orig` 四处读取点、`tests/image-writeback-test.js`、preflight 两条检查、`_perf-baseline` 扩展
- 文档:本计划、`plugin-development.md` 修正、`architecture-current-state.md`(sync-facts)、执行小结
- 插件:white-bg-800 1.2.3、blank-canvas 1.0.1
## 9. 复查记录
**第 1 遍(正确性与风险)**
- A 是搬移 + 固定顺序,唯一行为变化是「引用化提前到落盘前」与「orig 也引用化」;回滚为 revert 两个调用点。
- B1 有误报风险(历史引用旧词)→ 只扫现行文档 + 删除线/已删除词豁免。
- C 在 CI 无 GPU 环境不稳定 → 不进 CI 必跑,只作真机回归。
- 结论:无阻断风险。
**第 2 遍(覆盖与顺序)**
- C 不新建 spec:扩展 `_perf-baseline.spec.js` 口径更统一。
- A 新单测必须加进 `test:unit`,否则孤儿门禁红。
- A 会动源码棘轮钉点,需按实测收紧。
- 顺序 0→A→A2→B→C 合理:门禁先绿,B 的基线才可信。
- 结论:补齐后可行。
**第 3 遍(插件面与出包口径,2026-12-02 补)**
- 插件侧只有 3 个写回点;其中 2 个依赖同步语义 ⇒ `setNodeImage` 保持同步是**契约红线**,不是实现偏好。
- `createImageNode` 覆盖面比写回更广(6 个插件),必须一起做,否则「白底/抠图/矢量化」仍是同一根因。
- orig 有 4 个读取点,漏一个就会复现「第二次覆盖静默失效」+ 历史快照存 base64,故列为盘点项。
- 门禁在 HEAD 上已红 ⇒ 增加第 0 步;否则 A 完成后无法用 `verify:ci` 证明没有回归。
- 插件批次不占出包,可与 3.26.183 并行,但 harness mock 修复是验收项(否则假通过)。
- 结论:可执行。
## 10. 执行记录(2026-12-02)
### 已完成
**第 0 步|门禁恢复绿**
- `src-tauri/Cargo.lock`:还原构建残留(工作区该行不计入改动)。
- `tests/architecture-facts-guard-test.js`:裁剪矩形守卫从 `- pad / + pad` 改为「先认 `const p = pad + extra`,再数 4 条边按 p 收放」(`cullRectsOf` 早已重构成局部变量 p,守卫文本过期)。
- `docs/standards/architecture-current-state.md`:锚点改为 `main = 738b70c5`;计数/棘轮数字用 `node scripts/sync-facts.js --write` 复算。
- `tests/fixtures/iwb-source-modules-order.json`:补 `image-writeback.js`(顺序与 build.js 一致);耦合面快照用 `IWB_WRITE_BOUNDARY_SNAPSHOT=1` 更新(新增 `IWBImageWriteback`)。
- 结果:`test:facts`、`source-text-ratchet`、`architecture-boundary-guard` 全部通过。
**A 项|写回收口**
- 新增 `src/image-writeback.js`(184 行,三入口 + restoreOrig),注册进 `scripts/build.js`。
- `app.js`:删除 `origImagePatch` 与三个写入口的旧实现,改为装配 `IWBImageWriteback`;右键「还原替换前原图」改走 `restoreOrig`(支持引用形态)。
- `src/runtime-workbench-logic.js`:删除搬走的 `saveNodeImage`;`HISTORY_IMG_REF_FIELDS` 补 `'orig'`(撤销快照不再整串存旧图)。
- 阈值:只有 `IMPORT_INLINE_MAX` 一条判据,引用化统一走 `wImportImage(keepOriginal)`;**182 的 200KB + 裸 `wImgRefWrite` 旁路已删除**。
- `createImageNode` 大图后台引用化(6 个建图插件零改动)。
- 文档:`docs/standards/plugin-development.md` 修正 `ctx.canvasWrite` 旧写法 + 新增「图片写回契约」表(含 setNodeImage 同步不落盘、saveNodeImage 落盘校验、getNodes 只读);`docs/PLUGIN-SDK.md` 同步。
- 单测:`tests/image-writeback-test.js`(21 条断言,覆盖 §2.7 五条契约)已进 `test:unit`。
**行数记账**
- `MAX_APP_JS_LINES`:8,743 → **8,911**(实测;174–182 累积 +196 未记账,本轮搬走写回装配 −29,剩余 +168 显式记账)。
- `MAX_WORKBENCH_LINES`:2,333 → **2,505**(= 本轮实测 2,505;HEAD 是 2,524,本轮 −19,所以 2,505 并不小于实测,二者相等)。
- 两个上限当前都是**零余量**(上限 == 实测)。这是本仓既有纪律(守卫文件里写明「上限取实测值本身,留 0 余量」);
针对「谁写谁抬」的风险,B3 会把「上调必须带日期+行数差记账」变成机械检查。
### 验证结果
- `npm run build` + `node scripts/check-dist.js`:通过;dist 内含 `IWBImageWriteback`,`node --check dist/app.js` 通过。
- `npm run lint` / `npm run typecheck`:通过。
- `npm run test:unit`(140 个文件)与 `npm test`:通过。
- `npm run test:facts` / `node tests/source-text-ratchet-test.js` / `node tests/architecture-boundary-guard-test.js` / `node scripts/ctx-menu-audit.js` / `tokens:check` / `check-plugins-sync`:通过。
- `preflight`:仅「存在未提交改动」一项红(未提交阶段预期);提交后应转绿。
### 未做(等确认)
- A2 插件批次(white-bg-800 1.2.3 / blank-canvas 1.0.1,在插件仓,需发市场)。
- B preflight 两条检查;C `_perf-baseline` 扩展。
- 3.26.183 版本号三处 bump(出包前做,避免提前改版本号)。
### A2|插件批次(2026-12-02 完成,未发市场)
- **white-bg-800 1.2.3**:覆盖模式改「`saveNodeImage` 优先 + 老宿主 `setNodeImage` 兜底」;harness 双形态(new/old)跑通:
new 断言「saveNodeImage 1 次 / setNodeImage 0 次」、落盘失败必须把宿主原因抛给用户;old 断言回退同步写回仍成功。
顺带修了 harness 两处早已过期的断言(version 写死 1.2.0、icon 写成 fit)——说明这份 harness 之前没人跑,现已全绿。
- **blank-canvas 1.0.1**:空白判定改为「data / url / localRef / ref 四者皆无」,避免只有本地引用的节点被白图覆盖。
- 插件仓提交 `e2982e3` 已推 gitea;宿主的 `plugins/` 产物已 `sync-plugins-from-repo` 同步。
- **已发布市场(2026-12-02)**:white-bg-800 1.2.3 / blank-canvas 1.0.1 已上传 `market.maqiart.eu.org`(index.json + zip + 旧版单文件产物 + 展示页),并回读校验(索引版本对得上、下载 zip 的 sha256 == 索引 bundleSha256);下载站插件页同步更新。
### B|preflight 强化(2026-12-02 完成)
- **B1 文档过期写法**:preflight 第 6 项扫 `README/CONTRIBUTING/PUBLISHING/docs/standards/docs/reference`,
命中 `functions/api`、`functions/plugins`、`verify:release`、`plugins-publish`、`wrangler`、`_inbox` 即红(删除线 / 已弃用等豁免)。
首次运行就抓到 4 处真实过期内容(仍在教人用 NAS `_inbox/` 取件),已一并改为 tailnet HTTP 流程。
- **B2 `global.*` 写入口棘轮**:`src/*.js` 的 `global.X =` 实测 122,写成常量只减不增(已试:+1 即红)。
- **B3 棘轮上调必须自证**:`MAX_APP_JS_LINES` / `MAX_WORKBENCH_LINES` / `MAX_SRC_COMPONENT_LINES` 行必须含
「日期 + 相对上一版的差(或基线说明)+ 原因」,否则红(已试:改成 9000 且无注释 → 立刻红)。
### C|性能回归入口(2026-12-02 完成)
- `IWBPerf` 新增只读 `snapshot()`(结构化读数 + 清零),与 60s 落盘窗口解耦,不影响 `_boot.log` 格式。
- `tests/_perf-baseline.spec.js`:平移段前后取快照,新增 3 条断言 —— `frames > 30`(防探针没启动导致「0 长帧」假绿)、
长帧比例 ≤ 40%、longtask 总时长 ≤ 2500ms;快照同时写进 `P1_BASELINE=` 便于历史对比;`IWB_PROBE_PERF=0` 可只测不断言。
- `scripts/perf-baseline.js` + `npm run perf:baseline`:build → 动态端口起本地服 → 只跑该 spec → 关服(不用再开两个终端)。
- 实测(本机 headless,7000 节点 / 12 步平移,三次):长帧 13~17 / 帧 57~59(22.8%~30.9%)、longtask 25 次 / 1905~1934ms、最长帧 ~400ms。
阈值取「实测最大值 ×1.3" → 40% / 2500ms;换机器必须重设基线(写进注释)。
- 仍不进 CI(无头环境无 GPU,数字不可比),只作真机回归。
### D|app.js 拆分:插件画布桥(2026-12-02 完成)
- 新增 `src/plugin-canvas-bridge.js`:把 `wPluginCanvasBridge`(getNodes / getSelectedNode / getNodeImage / createNode / screenToWorld / createImageNode / setNodeImage / saveNodeImage)
与图片写回装配整体迁出 Workbench,模块只做装配、依赖全部注入。
- app.js 8,911 → 8,860(−51),Workbench 2,505 → 2,454(−51),两个棘轮上限同步收紧(B3 记账)。
- 顺带删掉两个从未被引用的工厂导出(`IWBStorageRuntimeFactory` / `IWBRuntimeMetricsFactory`),
`global.*` 写入口 122 → 121(新模块 +1,删死导出 −2)。
- 验证:test:unit 140 文件、e2e 冒烟 33 条、lint/typecheck/facts/ratchet/boundary 全绿。
注:冒烟必须用 `npm run build`(含 copy-plugins),只跑 build.js 会缺 plugins/,图库面板相关 3 条会假红 —— 已把它写进 perf 脚本。
### E|插件 harness 巡检(2026-12-02 完成)
- 10 个插件 harness 全跑一遍:4 个绿、6 个长期假红(说明没人跑)。逐条判定后**全部是测试过期**,不是插件回归:
- album:写死版本 1.1.2(实为 1.2.5);`addPaths` 涨到 36 行导致 900 字符窗口不够;缩略图写入形态改成 `ctx.files.put(thumbNameOf(key, ext), url)`
- gallery / promptlib:同样写死版本
- style-source:要求 chips「必须一行」(当时 9~10 个标签),标签涨到 13 个必然换行 → 改钉「不溢出 + 行数 ≤3」
- image-vectorize:11-19 起「取消」改名「关闭」并用主色区分,「四颗同色」规则已作废
- sticky:改成纯节点类型后不再注册面板,harness 仍要求 panels 并在 `panelApi.mount` 崩
- 修复原则:**测试只钉「会真出错的点」**(两处版本一致、不溢出、顺序与区分色),不再钉死具体版本号与当时的布局数值。
- 复跑 10/10 全绿(插件仓 `4f7bb25`)。
+108
View File
@@ -0,0 +1,108 @@
# 任务队列(左栏整页插件)执行计划 · 2026-12-03
> 上游讨论:`docs/plans/task-queue-plan.md`(2026-12-02)、`docs/mockups/task-queue-v2.html`。
> 本文是**本次实施口径**:宿主记账 + 插件整页 + 左栏入口;图库保持「只显示已落地」。
## 1. 目标 / 非目标
**目标**
- 记录每一次生成结果(url、状态、画布/节点、时间、模型/尺寸),全局跨画布。
- 记录由**宿主**保存;插件关闭也继续记录,重新开启即可看到历史。
- 左栏一级入口「任务队列」(插件整页),可启用/禁用。
- 行内主操作「下载」= 落地到 `images/gallery`,图库自动刷新出现。
- 支持「重试 / 复制原始链接 / 定位节点 / 点击缩略图预览」。
- 记录上限可在插件页设置(宿主配置),超限淘汰最旧;淘汰不影响图库文件。
**非目标**
- 不做自动对账(图库保持只读展示,不扫描、不补录)。
- 不处理本版本之前的旧记录(无 meta 显示「未知画板」)。
- 不做详情抽屉、批量选择、进度详情页。
- 不新增下载器:复用 `image-ingest`。
## 2. 数据与存储
- 账本:沿用 `image-ingest-store`(全局 key `iwb_ingest_idx`)。
- 新增 meta(入队时写):`boardId / boardName / nodeId / prompt / model / size / at`。
- 桌面端独立文件:`src/storage-file.js` 的 `LIB_FILES` 增加
`iwb_ingest_idx: 'task-queue/index.json'`(不塞 data.json)。
- 上限:配置 `canvas.taskQueueMax`,默认 500,范围 100~5000;store 写入时按上限淘汰最旧(不删图片)。
- 备份/导出:确认包含 `library/task-queue/index.json`,不包含则补清单。
## 3. 宿主能力
### 3.1 `queue` 能力(新)`src/plugin-api-queue.js`
- `list({status, limit, query})`:返回账本记录(含 meta、状态、url、`thumbUrl`:仅 ready 的本地缩略图/objectURL)。
- `retry(id)`:重新入队。
- `land(id)`:建图库索引行(按 url 幂等)→ 入队 → 已有本地字节则立即补写;图库自动刷新。
- `preview(id)`:用现有 `ImagePreview` 打开,列表=所有可预览记录(本地优先,否则远程 url)。
- `copyLink(id)`:复制完整原始链接(页面不展示链接)。
- `locate(id)`:按 `boardId` 切画布、加载后选中 `nodeId`;画布/节点缺失返回错误。
- `stats()`:各状态计数。
- `clear()`:清空非进行中的记录(不动图库/文件)。
- `getLimit()/setLimit(n)`:读写 `canvas.taskQueueMax`,立即裁剪。
- `onChanged(fn)`:订阅账本变更(下载进度/状态)。
### 3.2 `pages` 能力(新)
- `plugin-host.js`:`CAPABILITIES` 加 `pages`,`CAPABILITY_API_KEYS.pages = 'ui'`。
- 插件 `ctx.ui.registerPage({id,title,icon,mount})`;禁用插件自动移除;若当前正停在该页,自动切回画布。
- `ui-nav-rail.js` 增加插件页图标;app.js 增加 `pluginPage` 状态与页面容器(`.iwb-plugin-page`)。
## 4. 插件 `taskqueue`(左栏整页)
- 源仓:`~/open/github/iwb-plugins-desktop/taskqueue`(package.json + src/index.js + styles.css)。
- 清单:`capabilities: ['pages','queue']`,page `{id:'taskqueue', title:'任务队列', icon:'list'}`。
- UI 按 `docs/mockups/task-queue-v2.html`:
- 页签:全部 / 已完成 / 下载中 / 失败 / 仅记录(计数)。
- 行:缩略图(可点击预览)、标题、状态徽标、画布·时间·尺寸/模型;失败行错误摘要。
- 操作:**下载**(主)/ 重试 / 复制原始链接 / 定位;删除态提示「画布已删除 / 节点已删除」。
- 顶部:记录上限下拉(200/500/1000/2000/5000)、清空记录。
- 颜色/字体/圆角/间距全部用 `var(--iwb-*)`;结构尺寸可字面量(与 gallery 一致)。
## 5. 代码改动清单
| 文件 | 改动 |
| --- | --- |
| `src/image-ingest-store.js` | 上限可注入(函数)、`trim()`、`clear()`;meta 透传 |
| `src/image-ingest.js` | `enqueue` 支持 meta;`clearFinished()`(保留进行中) |
| `src/storage-file.js` | `LIB_FILES` 加 `iwb_ingest_idx` |
| `src/runtime-workbench-logic.js` | `liveUpsert` 入队时补 board/node/prompt/model/size meta |
| `src/plugin-api-queue.js`(新) | queue 能力桥(setImpl/api/emit) |
| `src/plugin-api-pages.js`(新)或并入 plugin-host | pages 注册桥 |
| `src/plugin-host.js` | 注册 `queue` / `pages` 能力 |
| `src/ui-nav-rail.js` | 渲染插件页入口 |
| `app.js` | queue/pages 能力实现;land/preview/locate/clear/limit;页面状态与容器;ingest onEvent 通知插件 |
| `plugins/taskqueue/*`(新) | 整页插件 |
| `plugins/index.json` / `manifest` / `market` | 新插件产物与市场 |
| `tests/*` | queue 能力契约、插件渲染/空态、上限裁剪、locate 错误 |
| docs | 本计划、CHANGELOG、锚点/事实同步 |
## 6. 关键实现口径
- `land(id)`:`wAddOutputs([{ok:true,url,...}])`(幂等)→ `enqueue({url,source:'task-queue'})` → 若 view 已 ready 立即 `wFillOutputFromIngest`;图库靠 `wGalleryChanged` 自动刷新。
- 预览:`setPreview({list, idx})`,list 项 `{url, w, h, name}`;本地 ready 用 `wResolveImg(ref)`,否则用原始 url;失败提示「预览失败」。
- `locate`:`setActiveWsId(boardId)` → `openTab` → `loadWsInto` → 等加载 → `setSel([nodeId])` + 居中;失败返回 `{ok:false,error}`。
- 上限:`setLimit` 写配置并 `store.trim()`;插件页只调用 API。
- 账本淘汰只删记录,不删 `images/gallery`、不动图库索引。
- 插件禁用:账本继续记录(宿主),页面入口消失;重新启用可见历史。
## 7. 验收
1. 生成 1 张:左栏任务队列出现 1 条;点「下载」→ `images/gallery` 出现、图库自动显示;重复点不产生第二条/第二份文件。
2. 失败记录:状态失败 + 错误摘要;点重试成功;复制链接可用。
3. 点击缩略图打开预览;本地秒开,仅记录走远程;失效提示。
4. 定位:跳到对应画布并选中节点;画布/节点删除时提示。
5. 上限改 200:记录裁剪到 200 条,图库文件不变。
6. 禁用插件:记账继续(上限内);启用后历史仍在。
7. 跨画布:在 A 画布生成、切到 B 画布,队列仍能看到 A 的记录并定位。
8. 门禁:build / eslint / typecheck / 单测 / tokens / plugin 契约 / facts。
## 8. 交付节奏
- 代码 + 本地验证完成 → 通知用户,**不构建**;等用户确认后再 bump 版本、出测试包、发插件市场。
## 9. 实施状态(2026-12-03)
- 已完成:宿主 `queue`/`pages` 能力、账本 meta/独立文件 `library/task-queue/index.json`、上限配置 `canvas.taskQueueMax`、左栏整页插件 `taskqueue 1.0.0`、下载落地/预览/定位/复制链接/清空/重试、真实应用页面与注入记录验证。
- 待确认:bump 版本、出测试包、上传插件市场(taskqueue 1.0.0)。
+97
View File
@@ -0,0 +1,97 @@
# 任务队列(左栏页)方案 · 2026-12-02
> 交互样式见 docs/mockups/task-queue.html(可点行看详情、右上角切深色),截图 task-queue-light.png / -dark.png。
> 本文只谈设计与落地口径,代码未动。
## 1. 定位
左栏新增一级入口「任务队列」:记录**每一次收到图片链接的事实**——生成结果、插件产出、外链参考图——
即使本地字节被清理,也能从原始链接重新取回;并能定位到画布上对应的节点。
它不是一个新系统,而是「结果落地管线」的**账本 + 操作台**:
- 执行器:src/image-ingest.js(后台下载 / 重试 / 断点恢复)
- 账本:src/task-queue-store.js(一条记录 = 一次 ingest 任务)
- 界面:src/ui-task-queue.js(本方案)
## 2. 数据模型(一条记录)
| 字段 | 说明 |
| --- | --- |
| id / createdAt / updatedAt | 记录标识与时间 |
| source | gen(生成)/ plugin(插件产出)/ remote-ref(外链参考)/ manual(手动导入) |
| status | queued / downloading / ready / failed / link-only / missing |
| url | **原始链接,永不改写**(生成/导出/重试都以它为准) |
| localRef / displayRef / thumbRef | 原图字节 / 显示层(长边 2048)/ 缩略图(320) |
| bytes / sha256 / w / h / mime | 落地后回填 |
| prompt / model / size / batch / durationMs | 生成信息,用于搜索与展示 |
| nodeId / boardId / wsId | 定位到画布节点 |
| retries / lastError / requestId | 失败可诊断 |
| pinned | 被画布或图库引用时置位,清理时跳过 |
## 3. 状态机
queued → downloading(进度) → ready →(清理策略触发)→ link-only
↘ failed(重试 1s/2s/4s,最多 3 次)
ready/link-only →(字节丢失)→ missing(可一键回源)
- 幂等键:记录 id;同一 url 重复触发不重复下载
- 断点:任务表落 IDB,重启后 queued 继续、downloading 重新排队
- 原子写:临时键 → 校验 bytes(有 content-length 比对)→ 提交索引 → 才算 ready
## 4. 交互(对照样式图)
1. 左栏第 3 个图标(列表+圆点)→ 整页;与首页/画布/插件同级
2. 顶部页签:全部 / 下载中 / 失败 / 已完成 / 历史,均带计数
3. 筛选行:类型 chips(图片/视频/音频/文本)、搜索(提示词 / 文件名 / 原始链接)、创建日期区间、多选
4. 行结构:缩略图(下载中叠进度条与百分比;失败盖错误标)→ 标题=提示词 → 第一行元信息(状态徽标 / 模型 / 批量 / 尺寸 / 字节)→ 第二行(时间 / 耗时 / 打开预览 / 原始链接)
5. 行操作(hover 显示图标,主操作常驻按钮):下载原图 / 复制链接 / 插入画布 / 定位节点 / 重试 / 删除
6. 失败行:红色错误条 + request id + 「重试」;原始链接仍可用(可复制/浏览器打开)
7. 详情抽屉(点行打开):原始链接(可复制,默认打码)、本地副本状态与 blob 引用、显示层说明、来源节点与画板、操作(插入 / 复制图片 / 复制链接 / 下载 / 重新下载 / 仅保留链接)
8. 多选:底部浮动条(已选 N 项 → 插入画布 / 批量下载 / 复制链接 / 删除)
9. 空态:没有记录时给一句「出图后会自动出现在这里」+ 前往画布
10. 离线态:只读展示已有记录,下载类操作置灰并提示
## 5. 保留与清理
- 默认保留 30 天 / 500 条(可设置);pinned 记录永不自动清理
- 「仅保留链接」:释放原图字节,保留元数据与 URL(历史页签可见,可重新下载)
- 清理只删字节,不删记录;删除记录才移除行
## 6. 安全
- 原始链接常带签名参数:列表里默认打码(显示前 24 字符 + …),点「显示」才完整展示
- 复制/打开外链走现有的 openExternal(系统浏览器),不内嵌 iframe
## 7. 性能
- 列表虚拟化(与图库同一套),只渲染可视区
- 缩略图 320,绝不为了列表去解码原图
- 索引分页读取;下载进度用事件节流(≥200ms 一次)
## 8. 改动清单(代码,全部落在 src)
| 文件 | 改动 |
| --- | --- |
| src/task-queue-store.js(新) | 索引 CRUD、状态机、清理策略、pinned 判定 |
| src/ui-task-queue.js(新) | 页面组件(页签/筛选/列表/抽屉/批量条) |
| src/image-ingest.js(新,见落地管线方案) | 后台下载、重试、断点、派生 |
| src/ui-nav-rail.js | 增加 rail 项与 props.onQueue |
| app.js | 只加装配:页面状态 + 把 ingest 事件接到 store(预计 +8 行,需同步上调 MAX_APP_JS_LINES 并记账) |
| src/ui-components.js | 结果图支持「下载中/失败」两种状态外观 |
## 9. 分期
| 阶段 | 范围 | 预估 |
| --- | --- | --- |
| P1 | 只读账本:记录已有生成结果与原始链接,列表 + 详情 + 复制/下载/重新下载 + 定位节点 | 1 天 |
| P2 | 接 ingest:实时进度、失败重试、断点恢复;节点与图库改吃本地副本 | 1 天 |
| P3 | 显示层派生(长边 2048)+ 清理策略 + 批量操作 | 0.5 天 |
## 10. 验收
- 出图后 3 秒内列表出现该条;下载中能看到进度;完成后节点/图库/队列三处一致
- 断网:行显示失败 + request id;恢复网络点重试成功
- 清理字节后行变「仅保留链接」,点重新下载能取回
- 同一条只下载一次(网络面板 1 次请求)
- 链接默认打码,点显示才完整
- 7000 节点画布下打开队列页,滚动不掉帧
+44 -204
View File
@@ -1,222 +1,62 @@
# 插件发布契约(给插件源码项目的交接说明)
# 插件发布(桌面版)
> 适用对象:在**另一个项目**里写插件、需要发到 Image Workbench Web 线上的人 / agent。
> 权威实现:`scripts/plugins-publish.mjs`(发布脚本)、`functions/plugins/[[path]].js`(KV 分发)、`src/plugin-host.js` + `app.js:9214`(加载与注册)。
> 最后核对:2026-11-14(新增 §8 插件节点与自定义节点体)
> 2026-12-01 重写:网页版已停用,Cloudflare Pages / Functions / `PLUGINS` KV 通道一起下线,
> `scripts/plugins-publish.sh`、`scripts/plugins-publish.mjs` 已删除。桌面版插件只走**插件市场**。
---
## 两条链路
## 0. 一句话
插件是**一个经典脚本文件**,上传到 Cloudflare KV 的 `plugins/` 下,由同源 `/plugins/index.json` 清单 + SRI 完整性校验驱动加载。**发布只用一条命令,不要手写清单。**
---
## 1. 文件与命名(硬约束)
| 约束 | 说明 |
|---|---|
| 源文件名 | **必须** `plugin-<id>.js` —— 发布脚本从文件名解析 id,不符合直接报错 |
| id 规则 | `^[a-z][a-z0-9-]{2,31}$`(小写字母开头,3–32 字符,只含 `a-z 0-9 -`) |
| 模块形态 | **必须是经典脚本(IIFE),不能是 ES Module**。宿主用 `document.createElement('script')` 注入,没有 `type="module"`,`import`/`export` 会语法错误 |
| 存储名 | 由脚本生成:`plugin-<id>.<sha256前12位>.js`(内容寻址)。**不要自己造这个名字** |
| 注册 | 必须自我注册:`window.IWBPluginHost.register(manifest, factory)`;`manifest.id` 必须**等于**文件名里的 `<id>`,否则加载后状态是 `not-registered` |
| 样式 | 用 JS 注入 `<style>` 字符串(`style-src 'self' 'unsafe-inline'` 允许);不要外链 CSS |
### CSP 限制(线上 `_headers` 实测)
```
default-src 'self'; script-src 'self'; worker-src 'self' blob:;
style-src 'self' 'unsafe-inline'; img-src 'self' https: data: blob:;
connect-src 'self' https: http://127.0.0.1:30092 http://localhost:30092 http://127.0.0.1:3425 http://localhost:3425;
object-src 'none'; base-uri 'none'; frame-ancestors 'none'
```
结论:
- ❌ 不能用 `eval` / `new Function`(`script-src` 没有 `unsafe-eval`)
- ❌ 不能内联 `<script>`、不能从 CDN 引脚本
- ✅ 可以 `fetch` 同源与任意 `https://` 接口(`connect-src` 放行)
- ✅ 可以 `data:` / `blob:` / `https:` 图片
---
## 2. manifest 必填字段(真实插件示例)
```js
;(function (global) {
'use strict'
var STYLE_ID = 'iwb-myplugin-style'
// ... 插件实现 ...
global.IWBPluginHost.register({
id: 'my-plugin', // 必须等于文件名 plugin-my-plugin.js 里的 id
name: '我的插件', // 显示名
version: '1.0.0', // 见 §4:要与清单 version 保持一致
apiVersion: 1, // 正整数,<= 宿主 API_VERSION
capabilities: ['nodeActions', 'canvas', 'canvasWrite'],
}, function (ctx) {
// ctx 提供 storage / settings / 事件订阅等,按需使用
})
})(typeof window !== 'undefined' ? window : globalThis)
```
- `capabilities` 只允许宿主声明的能力名,写未知值会被 `register` 拒绝。
- `settings` 可选,用于在插件管理里生成配置项。
---
## 3. 发布:一条命令
```bash
# 在 Image Workbench Web 仓库根目录执行(脚本在这里,运行时在 KV)
node scripts/plugins-publish.mjs /path/to/plugin-<id>.js --version <id>=1.3.0 --upload
```
脚本会依次:
1. 按 `plugin-<id>.js` 解析 id,算 `sha256` → `integrity`
2. 生成内容寻址名 `plugin-<id>.<hash12>.js`(同字节同名 ⇒ **幂等**;字节变则名变 ⇒ 客户端永不命中旧缓存)
3. **合并**既有清单:本次没传的插件原样保留,同 id 由新条目覆盖
4. `PUT` 插件字节 + `PUT` 清单到 KV(走 Cloudflare REST API,不依赖 wrangler)
5. **回读校验**:把线上 `plugins/index.json` 拉回来与本地比对,不一致直接报错
凭据:`CLOUDFLARE_API_TOKEN`(需 `Account → Workers KV Storage → Edit`)+ `CLOUDFLARE_ACCOUNT_ID`。macOS 上缺失时脚本**自动读钥匙串**(`CLOUDFLARE_PAGES_TOKEN` / `CLOUDFLARE_ACCOUNT_ID`),本机可直接跑。
先看计划不上传:去掉 `--upload` 即 dry-run,打印将写入的键。
---
## 4. 版本号:两处要一起改
| 位置 | 谁改 |
|---|---|
| 插件源码里的 `manifest.version` | 你自己改(脚本读不到源码里的 manifest) |
| 清单里的 `version` | `--version <id>=x.y.z` 改 |
`--version` **只写清单,不会改你源码里的 version**。两处不一致不会报错,但插件管理页会显示清单版本、插件内部日志显示源码版本,排查时容易误判 ⇒ 发版时同时改。
---
## 5. 绝对不要做
| ❌ 禁止 | 原因 |
|---|---|
| 手写 / 手改 `plugins/index.json` 再上传 | 会**整份覆盖** KV 清单,把别人的插件从列表里抹掉(2026-11-03 真实事故:6 个插件只剩 1 个) |
| 手填 `integrity` | 错一个字符浏览器就拒绝执行,且表现为「脚本完整性校验失败」很难查 |
| 自己造 `plugin-<id>.<hash>.js` 名字直传 | 内容寻址名必须与字节绑死,手造会破坏缓存语义 |
| 加 `--prune` | 它会把「本次没传入的插件」全部从清单删掉,只在确定要下线全部未传插件时用 |
| 用 ESM / `import` / `eval` | 经典脚本 + CSP 双杀 |
---
## 6. 上线后怎么验(3 步)
```bash
# ① 清单里有没有你的条目
curl -fsSL https://iwb.maqiart.eu.org/plugins/index.json | python3 -m json.tool | grep -A2 '"my-plugin"'
# ② 字节取得到,且 SRI 与清单一致
curl -fsSL "https://iwb.maqiart.eu.org/plugins/plugin-my-plugin.<hash12>.js" -o /tmp/p.js
echo "sha256-$(openssl dgst -sha256 -binary /tmp/p.js | openssl base64 -A)" # 应与清单 integrity 完全相同
# ③ 页面:设置 → 插件管理,找到你的插件并勾选启用
```
插件管理页的状态含义:
| 状态 | 含义 | 常见原因 |
| 链路 | 说明 | 产物 |
|---|---|---|
| `远程` / `loaded` | 已加载并注册成功 | 正常 |
| `远程·未加载` | 清单里有,但没启用 | 勾选即按需下载 |
| `远程·not-registered` | 脚本执行了但没注册 | `manifest.id` 与文件名/id 不一致,或 `register` 被拒(capabilities 未知等) |
| `远程·bad-entry` | 清单条目不可信 | `integrity` 缺失或格式不合法(fail-closed,直接拒绝) |
| `远程·failed` | 下载/校验失败 | SRI 与字节不符、404、网络 |
| 内置插件 | 随安装包发布,启动即加载 | 桌面仓 `plugins/`(`plugin-<id>.<sha12>.js` + `index.json` 带 SRI `integrity`) |
| 市场插件 | 用户按需安装 | `market/plugins/<id>-<ver>.zip` + `market/index.json`,托管在 `market.maqiart.eu.org` |
---
纯函数(`integrityOf` / `storedNameOf` / `buildIndex` / `mergeIndexes`)在 `scripts/plugin-integrity.mjs`,
由同步脚本与测试共用;加载与注册仍由 `src/plugin-host.js` + `src/runtime-plugin-loader.js` 负责。
## 7. 清理陈旧字节(可选)
内容寻址 ⇒ 插件更新后旧哈希键仍留在 KV(不再被清单引用)。
## 发布步骤
```bash
npm run plugins:gc # 只列出,不删
node scripts/plugins-publish.mjs --gc --delete --keep ai-chat # 真删(保留归档插件)
# 1) 插件源仓:改版本(package.json 与 src/index.js 里 register 的 version 必须同时改)→ 校验 → 提交
cd ~/open/github/iwb-plugins-desktop
npm run build -- <需构建的插件> # 手写单文件跳过
npm run validate # 必须 15/15
# 2) 桌面仓:同步内置产物 + 生成市场
cd ~/open/github/image-workbench-desktop
node scripts/sync-plugins-from-repo.js
node scripts/gen-market.js
node scripts/gen-market-page.js
node scripts/gen-site.js # 复制成 site/plugins-index.json 并刷新首页/插件页版本号
npm run check:plugins # 13 个插件一致性门禁(发布脚本也会自动跑)
# 3) 上传 NAS(文件是只读位,覆盖前先 rm)
scp market/index.json market/index.html [email protected]:/vol8/web/iwb-market/
scp market/plugins/<id>-<ver>.zip [email protected]:/vol8/web/iwb-market/plugins/
scp site/index.html site/plugins-index.json [email protected]:/vol8/web/iwb-download/
scp site/plugins/index.html [email protected]:/vol8/web/iwb-download/plugins/
ssh [email protected] "chmod -R a+rX /vol8/web/iwb-market /vol8/web/iwb-download"
```
判定以**线上清单**为准,不用本地清单(本地落后时会误删)。`--keep` 是必需的:`ai-chat` 属「移出清单但字节留 KV 待启用」的归档态,不加 keep 会被当垃圾删掉,想启用就得重新上传字节。
## 必须回读核验
---
不能只看命令退出码,下载站与市场都要回读:
## 8. 插件自己的节点与节点体(`capabilities: ['nodeTypes']`)
插件可以注册**自己的节点类型**,并让节点体跑自己写的 DOM 表单(`style-source` 的「样式节点」就是这套,
2026-11-14 上线测试站)。
```js
global.IWBPluginHost.register({
id: 'my-plugin',
version: '1.3.0',
// ⚠️ 能力名是 nodeTypes,但挂到 ctx 上的 key 叫 nodes(CAPABILITY_API_KEYS 的映射)。
// 写成 ctx.nodeTypes 不会报错,只会静默失效 —— 排查时最容易踩的一条。
capabilities: ['canvas', 'canvasWrite', 'nodeTypes'],
}, function (ctx) {
if (!ctx.nodes || typeof ctx.nodes.register !== 'function') return {}
ctx.nodes.register({
id: 'style', // 类型 id = plugin:my-plugin:style
title: '样式节点',
defaults: {}, // 新节点的 data 初值
ports: { in: false, out: true }, // 可覆盖;不传 = in/out 都开(只出不入就靠这条)
height: 360, // 初始高度;内容超过时宿主按实测自适应
color: '#969696', // 可覆盖序号/边框色
render: renderMyNode, // 可选;不传 = 宿主默认节点体(标题 + 文本框 + 运行按钮)
// run: async (node, host) => {...} // 可选;不传 = 节点上没有「运行」按钮
})
return {}
})
```bash
curl -s "https://market.maqiart.eu.org/index.json?t=$(date +%s)" | head -c 200
curl -s "https://download.maqiart.eu.org/plugins-index.json?t=$(date +%s)" | head -c 200
```
### 8.1 `render` 契约(插件节点体)
- 市场索引条数正确(当前 13 个),改动插件版本已更新
- 每个新 zip 的 `bundleSha256` 与线上下载字节一致
- 解包 `main.js` 确认 manifest 的 `version` 真的变了(2026-12-01 就踩过:清单升版、产物没升版)
| 项 | 规则 |
|---|---|
| 签名 | `render(node, props, host)`。`node` 是最新节点对象,`props` 与内置节点体同款(`onUpdate(id, patch)` / `busy` / `progress` / `onPreview` 等),`host` 是一个**固定不变的 div** |
| 怎么画 | 直接往 `host` 里写真实 DOM。宿主**不会**用 React 重建这个 div ⇒ 输入框不会每帧失焦 |
| 会重调 | 节点数据一变就再调一次(同一个 `host`、同一个 `node` 引用会被替换)。请做**幂等同步**:缓存自己建的元素、只改内容,**不要**每次 `innerHTML = ''` 重建,否则光标和选中会丢 |
| 输入框 | `input` / `textarea` 上务必 `pointerdown` / `mousedown` 里 `stopPropagation()`,否则宿主把这次按下当成「拖节点」,框点不进去 |
| 写回 | 一律 `props.onUpdate(node.id, patch)`;高频输入自己做防抖(300ms)+ `blur` 立刻提交,避免每次按键都写存档 |
| 正在编辑 | 重调时若 `document.activeElement` 就是那个输入框,**跳过 value 覆盖**,不然用户正在打的字会被 data 顶回旧值 |
| 清理 | 可选 `render.dispose(host)`,节点卸载时调用(解绑 window/document 级监听、停定时器) |
| 抛错 | 宿主捕获后把该节点体降级成一行提示文本,画布其余部分继续可用(不会白屏) |
| 样式 | 自己注入 `<style>`(`style-src 'unsafe-inline'` 允许);类名请加插件前缀,避免污染内置节点体 |
## 客户端安装时的校验
### 8.2 节点自带参考图(不用连一张参考图节点)
`src/runtime-plugin-market.js` 对市场条目做:zip 整体 `bundleSha256` → 逐文件 sha256(`files[]`)→ 路径白名单 → 体积/数量上限;
内置清单的 `integrity` 交给浏览器 SRI 强制校验,缺失即拒载(开发者模式的 `plugins/local/` 例外)。
节点 `data.refOn === true` 且 `data.refUrl` 有值 ⇒ 宿主在**本节点参与的任务图**里补一个伪参考图节点
(`id = <节点id>:ref`,`x/y` 取本节点坐标 ⇒ 参与「图片按 X 轴排序」这条既有规则)。
## 版本号一致性(历史事故)
- 参考图**只存 URL**,不转 base64 —— 接收方认链接,转 base64 会让存档和请求体积翻几倍。
- 它对这个节点的所有下游生效:直连生图、经组合节点、经批量、经分层节点都算。
- 典型用法:样式节点上「☑ 示例图作参考」勾上 = 多一张参考图;取消勾选 = `refOn: false`,这张图在任何下游都消失。
### 8.3 连线的白名单
插件节点要连到生图 / 组合 / 批量节点,靠的是宿主 `connectReasonOf` 那 7 条白名单。
2026-11-14 起:**`data.outKind === 'prompt'` 的节点按「提示词节点」对待**,7 条规则全部放行
(此前 `plugin:*` 只能连到少数下游)。所以「这个节点产出的是提示词文本」就显式声明
`outKind: 'prompt'`,别指望宿主猜。
---
## 9. 给插件项目的自查清单
发版前逐条打勾:
- [ ] 文件名是 `plugin-<id>.js`,id 符合 `^[a-z][a-z0-9-]{2,31}$`
- [ ] 是 IIFE 经典脚本,全文没有 `import` / `export` / `eval` / `new Function`
- [ ] 调了 `IWBPluginHost.register(manifest, factory)`,`manifest.id` 与文件名一致
- [ ] `capabilities` 只用了宿主支持的能力名
- [ ] `manifest.version` 与将要传的 `--version` 一致
- [ ] 本地 `node --check plugin-<id>.js` 通过
- [ ] 注册了节点类型的话:`capabilities` 含 `nodeTypes`,且用的是 `ctx.nodes`(不是 `ctx.nodeTypes`)
- [ ] 自定义 `render` 是幂等同步(不每帧 `innerHTML=''`)、输入框 `pointerdown` 有 `stopPropagation`
- [ ] 发布后 §6 的 3 步验证全过
- `package.json` 与 `src/index.js` 里 register 的 `version` 是两处,只改一处会让客户端自报旧版本
- 需构建的插件(image-annotate / image-vectorize)**先确认 `<id>/plugin/` 源码不落后于已提交产物**再 build,
否则重建会回退手工补的补丁(2026-12-01 实测会丢 `getNodeImage(id,{max:4096/2048})`)
+7 -7
View File
@@ -1,7 +1,7 @@
# 现状架构与性能事实基线(桌面版)
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 370e72f`(线上 `v3.26.145+370e72f` —— 2026-11-30 **图库链路收尾**:宫格不再读原图(原生 320 tier)、缩略图原子写 + 同键合并 + 补 .png、空闲预热;插件图片策略 v2(thumb/preview/original/budget)全量落地。上一条 `v3.26.129+a7da7f7` —— 2026-11-30 **插件源读数**:诊断页显示加载器实际读取的插件目录、索引条数、id@version 版本表与报错。上一条 `v3.26.128+9bcf6d7` —— 2026-11-30 **浏览器窗口空闲休眠**:它是独立 WKWebView(实测整树 +480MB),失焦满 30 分钟自动 close。上一条 `v3.26.127+ed762ad` —— 2026-11-30 **DOM 规模进诊断**:顶部显示 DOM 元素总数 + 停靠面板子树 + 图库卡片数,用来量化「面板开着」的真实成本(实测主窗口 29 节点却有 348MB WebKit malloc,大头在插件面板 DOM)。上一条 `v3.26.126+94d9952` —— 2026-11-30 **诊断增强**:新增 Rust app_memory_breakdown(逐进程 footprint + 分类 Dirty/Reclaimable),诊断页新增「内存拆解(分进程)」与「图片管线」(原生解码次数/峰值 + 缩略图磁盘 512/256/768 统计)。上一条 `v3.26.125+5d70782` —— 2026-11-30 **内存口径修正**:ps 的 RSS 会把每个 WebKit 子进程映射的共享框架各算一遍,四进程求和虚高 1.5~2 倍;改为 footprint(1) 的 phys_footprint(活动监视器同源),并只认比本进程更年轻的 WebKit 子进程。实测 WebContent footprint 653MB 中 dirty 仅 32MB、CG raster 1.7MB、Image IO 0 ⇒ 图片内存已压到底。上一条 `v3.26.124+a0526e7` —— 2026-11-30 **插件图片策略 v2**:宿主三层 ctx.images(thumb/preview/original/budget) + 原生解码闸门(并发 ≤2,>1024px ≤1);album 1.2.4 / promptlib 1.14.10 / batch-export 1.2.3 / annotate 1.20.9 / vectorize 0.6.2 / white-bg 1.2.2 / cutout 1.0.4 全部改走宿主小图;check-plugins-sync 增加图片策略守卫(warn)。上一条 `v3.26.123+309963c` —— 2026-11-30 **缩略图改原生生成**:WebKit 忽略 createImageBitmap 的 resize 选项,JS 生成缩略图要整幅解码 4K 原图(21MB/张),100 多张 ⇒ WebContent 1GB+;新增 Tauri 命令 img_thumbs(Rust image crate,按目标尺寸解码/编码),webview 只接触几十 KB 小图、原图永不进 WebKit 图片缓存。上一条 `v3.26.121+71fe162` —— 2026-11-30 **内存可观测性 + LOD 256 档**:新增 Rust 命令 app_memory_tree_mb(Windows Toolhelp32 / mac ps 建树)→ 诊断页「进程实测 XXX MB」,内存护栏优先用它;createImageBitmap 改 resizeWidth 在解码阶段降采样;新增 256 小档缩略图(纯内存)按 need 分档;macOS 的 WKWebView 子进程按 etime(±180s) 认领,避免把 Safari 算进来。上一条 `v3.26.120+eaf2512` —— 2026-11-30 **图库面板开一次涨 200MB**:`gallery-sync.thumbFor` 原先让宫格每张图都过 `displayThumbOf`,给每张 mint 一个 objectURL 并进 `displayThumbs`(300 上限);关面板后 URL 仍被缓存持有、解码位图不释放。现改为直接吃磁盘 320 缩略图(~20KB data URL)、不过 displayThumbOf;插件 gallery 1.9.6→1.9.7:卡片缓存 400→60 且淘汰时显式摘 `<img src>`。上一条 `v3.26.119+db55d45` —— 2026-11-30 **诊断修复**:三处导出调用点写的 `window.__IWB_SAVE_BLOB__` 从未定义,桌面端「导出诊断 JSON / 导出节点组」必然抛错,已统一走顶层 `wSaveBlob`;`procEstMB` 的解码位图改按 min(自然尺寸, 渲染尺寸×dpr) 累加(原按 512²×4 低报 3~4 倍);「估算进程」改称「画布估算」并注明不含宿主进程;读不出的旧 `{__cache}` 引用按 key 记住失败、本会话不再重试,诊断新增「失效引用 N」;上一条 `v3.26.118+3944fc5` —— 2026-11-30 **内存第二批收敛**:显示缩略图 640→512(124 张图的解码位图 200MB→128MB)、缩略图生成并发 4→2、图片字节缓存 96→64MB、远程 http(s) 图不再进缩略图队列(跨域必败,只换来 thumb-fail 日志)、内存护栏改看 `procEstMB`(估算进程 = JS 堆 + 字节缓存 + 解码位图,阈值 800MB;只盯 JS 堆时 106 张图堆 20MB / 位图 200MB,护栏永远不动);上一条 `v3.26.117+3809c38` —— 2026-11-30 **内存:图片字节预算 + 绝对占用护栏 + 诊断页「立即回收内存」**(Windows 测试版,未发布):`image-blob-store` 的 LRU 补字节预算(96MB ≈ 20 张原图,原来只按 200 条封顶 ⇒ 4~7.5MB 原图最多常驻 1.5GB)并新增 `trim()`;内存护栏在「上限 75%」(4GB ⇒ 3.1GB)之外补一条 ≥900MB 的绝对占用线,每 2 分钟做一次轻量回收;诊断页新增节点级 `nodeBigSamples`、`blobCacheMB/N`、`objUrls`,并把「内存」改称「JS 堆Line truncated
> 日期 **2026-12-02**(**2026-12-02 复算 · v3.26.184**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 33631d11`(线上 `v3.26.240+33631d11` —— 2026-12-02 **图片写回收口**:插件写回三入口统一到 src/image-writeback.js(同步布尔 / 落盘校验 / 建图引用化),阈值只剩 IMPORT_INLINE_MAX,orig 一起引用化并进撤销快照;上一条 `v3.26.182+738b70c` —— 2026-11-30 **图库链路收尾**:宫格不再读原图(原生 320 tier)、缩略图原子写 + 同键合并 + 补 .png、空闲预热;插件图片策略 v2(thumb/preview/original/budget)全量落地。上一条 `v3.26.129+a7da7f7` —— 2026-11-30 **插件源读数**:诊断页显示加载器实际读取的插件目录、索引条数、id@version 版本表与报错。上一条 `v3.26.128+9bcf6d7` —— 2026-11-30 **浏览器窗口空闲休眠**:它是独立 WKWebView(实测整树 +480MB),失焦满 30 分钟自动 close。上一条 `v3.26.127+ed762ad` —— 2026-11-30 **DOM 规模进诊断**:顶部显示 DOM 元素总数 + 停靠面板子树 + 图库卡片数,用来量化「面板开着」的真实成本(实测主窗口 29 节点却有 348MB WebKit malloc,大头在插件面板 DOM)。上一条 `v3.26.126+94d9952` —— 2026-11-30 **诊断增强**:新增 Rust app_memory_breakdown(逐进程 footprint + 分类 Dirty/Reclaimable),诊断页新增「内存拆解(分进程)」与「图片管线」(原生解码次数/峰值 + 缩略图磁盘 512/256/768 统计)。上一条 `v3.26.125+5d70782` —— 2026-11-30 **内存口径修正**:ps 的 RSS 会把每个 WebKit 子进程映射的共享框架各算一遍,四进程求和虚高 1.5~2 倍;改为 footprint(1) 的 phys_footprint(活动监视器同源),并只认比本进程更年轻的 WebKit 子进程。实测 WebContent footprint 653MB 中 dirty 仅 32MB、CG raster 1.7MB、Image IO 0 ⇒ 图片内存已压到底。上一条 `v3.26.124+a0526e7` —— 2026-11-30 **插件图片策略 v2**:宿主三层 ctx.images(thumb/preview/original/budget) + 原生解码闸门(并发 ≤2,>1024px ≤1);album 1.2.4 / promptlib 1.14.10 / batch-export 1.2.3 / annotate 1.20.9 / vectorize 0.6.2 / white-bg 1.2.2 / cutout 1.0.4 全部改走宿主小图;check-plugins-sync 增加图片策略守卫(warn)。上一条 `v3.26.123+309963c` —— 2026-11-30 **缩略图改原生生成**:WebKit 忽略 createImageBitmap 的 resize 选项,JS 生成缩略图要整幅解码 4K 原图(21MB/张),100 多张 ⇒ WebContent 1GB+;新增 Tauri 命令 img_thumbs(Rust image crate,按目标尺寸解码/编码),webview 只接触几十 KB 小图、原图永不进 WebKit 图片缓存。上一条 `v3.26.121+71fe162` —— 2026-11-30 **内存可观测性 + LOD 256 档**:新增 Rust 命令 app_memory_tree_mb(Windows Toolhelp32 / mac ps 建树)→ 诊断页「进程实测 XXX MB」,内存护栏优先用它;createImageBitmap 改 resizeWidth 在解码阶段降采样;新增 256 小档缩略图(纯内存)按 need 分档;macOS 的 WKWebView 子进程按 etime(±180s) 认领,避免把 Safari 算进来。上一条 `v3.26.120+eaf2512` —— 2026-11-30 **图库面板开一次涨 200MB**:`gallery-sync.thumbFor` 原先让宫格每张图都过 `displayThumbOf`,给每张 mint 一个 objectURL 并进 `displayThumbs`(300 上限);关面板后 URL 仍被缓存持有、解码位图不释放。现改为直接吃磁盘 320 缩略图(~20KB data URL)、不过 displayThumbOf;插件 gallery 1.9.6→1.9.7:卡片缓存 400→60 且淘汰时显式摘 `<img src>`。上一条 `v3.26.119+db55d45` —— 2026-11-30 **诊断修复**:三处导出调用点写的 `window.__IWB_SAVE_BLOB__` 从未定义,桌面端「导出诊断 JSON / 导出节点组」必然抛错,已统一走顶层 `wSaveBlob`;`procEstMB` 的解码位图改按 min(自然尺寸, 渲染尺寸×dpr) 累加(原按 512²×4 低报 3~4 倍);「估算进程」改称「画布估算」并注明不含宿主进程;读不出的旧 `{__cache}` 引用按 key 记住失败、本会话不再重试,诊断新增「失效引用 N」;上一条 `v3.26.118+3944fc5` —— 2026-11-30 **内存第二批收敛**:显示缩略图 640→512(124 张图的解码位图 200MB→128MB)、缩略图生成并发 4→2、图片字节缓存 96→64MB、远程 http(s) 图不再进缩略图队列(跨域必败,只换来 thumb-fail 日志)、内存护栏改看 `procEstMB`(估算进程 = JS 堆 + 字节缓存 + 解码位图,阈值 800MB;只盯 JS 堆时 106 张图堆 20MB / 位图 200MB,护栏永远不动);上一条 `v3.26.117+3809c38` —— 2026-11-30 **内存:图片字节预算 + 绝对占用护栏 + 诊断页「立即回收内存」**(Windows 测试版,未发布):`image-blob-store` 的 LRU 补字节预算(96MB ≈ 20 张原图,原来只按 200 条封顶 ⇒ 4~7.5MB 原图最多常驻 1.5GB)并Line truncated
<!-- 2026-10-28 P1 拆分批 1:新增 src/generation-task-graph.js(5 个任务图纯函数自 app.js 迁出)
⇒ 模块数 60→61、耦合面 51→52、sourceModules 60→61。耦合面只**新增** IWBWTaskGraph,无删除。
2026-10-28 P1 拆分批 2:新增 src/storage-config-shape.js(9 个配置形状纯函数自 app.js 迁出)
@@ -22,7 +22,7 @@
- 图片**新写入主通道 = IndexedDB Blob `{__blob}` / key `imgblob_<hash>_<len>`** (A) `app.js:2143`;`{__cache}`(Cache Storage)为兜底;\`ref_\`(`app.js` 内定义的 `IDB_REF_PREFIX = 'ref_'`)为 legacy 形态 (A)。
- 大图判定:`isBigDataUrl` = `data:` 且 `length > 3000` (A) `app.js:2018`;**画布保存保留阈值** `< 16384` 才原样保留 (A) `app.js:2182`。**两处阈值并存,含义不同**。
- 单测是**源码契约测试**:`tests/` 目录共 **493** 处源码文本钉点(`source.includes` / `source.indexOf` / `/re/.test(source)`),分布在 **20** 个文件(其中 `iwb-v32-web-test.js` 一个就占 **407**)→ **结构性重构会先打红测试**。**该数字已由 `tests/source-text-ratchet-test.js` 的「只减不增」棘轮守门**(2026-10-20 起守卫范围从 1 个文件扩到全目录:新增任何一处源码文本钉点都会打红)。**2026-11-12 复算**(`npm run audit:pins`,v3.24.76):二分 STRUCT **417** / NAME **76**;形态 **POS 403 / NEG 87 / COUNT 3**;难度 **易 62 / 中 316 / 难 115**。钉点减法第一批(v3.24.72)把 **537 → 505**:8 条探针钉点改为「门禁内 spec 是否真的读该计数器」、5 条改为运行时断言(生产态 `window` 上无探针)、10 条改为 DOM 断言(质量档位禁用 / 传输页无三模式按钮 / 模型项 title)、4 条改为运行时对象断言(健康检查两域、策略对象冻结)、其余 9 条有同文件 DOM 等价断言或仅剩 NEG。第二批(v3.24.76)把 **505 → 493**:94-5~7 三条「多标签释放语义」(10 处正则)换成 `tests/iwb-tabs-release.spec.js` 的 3 条真 e2e,剩 1 条「消费方契约」(断言该 spec 在门禁内且 spec 源码真的读两个探针);另 2 条 `wPurgeIntent.add` 钉点改为读 `src/workspace-purge.js`。**这一批一换就查出 3 个真缺陷**(objectURL 从未释放 / 彻底删除留孤儿标签 · session / 刷新后误回收打开标签的图)—— 见 CHANGELOG v3.24.76。
- `app.js` = 单 IIFE **8,716 行**(**双层预算**:绝对上限 8,716 / 占总源码 ≤ 40%,现 **25.8%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,314 行**(上限 **2,314**,余量 0;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **123** 个模块 / 25,085 行,`sourceModules` 123 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。
- `app.js` = 单 IIFE **9,368 行**(**双层预算**:绝对上限 9,368 / 占总源码 ≤ 40%,现 **26.2%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,690 行**(上限 **2,690**,余量 0;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **128** 个模块 / 26,334 行,`sourceModules` 128 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。
- 门禁:`npm run verify` = `verify:ci`(`build` → `node --check app.js` → `node --check dist/app.js` → `check-dist.js` → `lint`(ESLint 正确性规则,`src/` + `app.js`,P4-16a)→ `test:unit` → `test` → `test:facts`)+ `test:e2e` (A) `package.json`。
## 1.5 内存基线(2026-11-30,v3.26.115,Windows / WebView2 实测)
@@ -192,7 +192,7 @@
- 同一张图被 3 个节点引用、hydrate 成 3 个不同 objectURL 时,preview/display 缓存各自 miss → 重复解码(与 F2 相邻)。
- **F10|`refs.genScheduler` 是桩** (A) → 未接线,暂无运行时影响(P3)。
- **F11|已建但未接线的模块层(2026-10-17 接线审计;2026-10-18 复核更正)** (A)
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**123 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**128 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
- **仅被测试引用(9 模块 + 2 导出)**:`canvas-domain`、`generation-retry`、`generation-service`、`runtime-recovery-runner`、`runtime-state-bridge`、`runtime-store`、`storage-reconcile`、`storage-result`、`workspace-service`;导出 `IWBStorageHealthFactory`、`IWBPluginHostFactory`。(`storage-result` 是**存储层共享结果类型**,被 6 个存储模块读取,**非死代码**;`runtime-store` 为状态模型 epic 地基。)
- **app.js 零引用(1 模块 + 3 导出)**:模块 `generation-controller`;导出 `IWBRuntimeMetricsFactory`、`IWBStorageRuntimeFactory`、`IWBUIComponents`。`canvas-relations` 已随 `06cf211` 删除(本文档早前把它列为"唯一可删者",实际已删)。零引用证据 = `grep -rn "<名字>" .`(排除 `node_modules|dist|vendor|test-results`)**只命中其自身赋值行**。
- **半接线 / 未接线**:`IWBRuntimeStateBridge` **无 app.js 引用(仅测试)**;`IWBRuntimeRunContext` **已接线**(`runNode` 读取运行上下文);`IWBGenerationController` 是完整但**从未被调用**的工厂;`ModularWorkspaceStore`(`app.js` 内)是 `storage-workspace` 的**预留接线 seam**(当前无下游使用,保留);`window.IWBImageFolder` 自注册后读回(装载路径)。
@@ -208,7 +208,7 @@
| `storage-reconcile` | 存储对账(`createReconciler`/`check`) | 内联对账 | 存储层收口 |
| `runtime-recovery-runner` | 执行恢复候选(`candidate`/`valid`/`run`) | 内联恢复 | 断点恢复 |
| `canvas-domain` | 画布域模型(`commit`/`updateNode`/`deleteNodes`…) | `CanvasStore` 那一套 | Workbench 解耦(P2-9) |
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**102** 项)与 `sourceModules` 顺序(**123** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**107** 项)与 `sourceModules` 顺序(**128** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
## 12. 易踩的坑
@@ -279,7 +279,7 @@
**信任模型(必须明示)**:形态 A 的插件是**可信代码**(与核心同权限、无沙箱);启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27 教训:前端开关一定可被绕过)。
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**102** 项)与 `sourceModules` 顺序(**123** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**107** 项)与 `sourceModules` 顺序(**128** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。
**关键陷阱**:`normalizeNodes`(现位于 `src/canvas-normalize.js`)会**静默丢弃**不在 `NODE_H` 里的节点类型 ⇒ 新增节点类型必须先登记 `NODE_H`,否则节点一刷新就消失(§13.27 规则三的同一失败模式)。
@@ -300,9 +300,9 @@
v3.25.11 的「CSP 清理」误判 30092 为遗留端口删掉 ⇒ 桌面版鲜艺抠图插件 `Failed to fetch`。
现由 `tests/desktop-csp-loopback-test.js` 钉住(只断言桌面 CSP 的运行时值,避免源码钉点棘轮)。
**鲜艺抠图插件(2026-10-17 起改为 A2 运行时插件,`dist` 不再内置)**:源码已迁出主仓到独立插件仓(`iwb-plugins`),经 Cloudflare Function `functions/plugins/[[path]].js` + KV(binding `PLUGINS`)**同源运行时加载**(同源 ⇒ CSP 零改动);主包**已不含** `src/plugin-xianyi-cutout.js`。功能:右键命令「抠图:选中节点」→ `POST {apiUrl}/rmbg?crop=`(`application/octet-stream` + 原始字节)→ 结果 PNG 写回为新的参考图节点(`<原名>_cutout.png`)。契约对齐 `iwb-plaus` v3.1.3 的 `background.js`(二进制进 / PNG 字节出;无 token、无 JSON),但**补齐了原版缺失的超时**(`AbortController` + 可配 `timeoutMs`)。设置项:`apiUrl` / `crop` / `timeoutMs`。尚未提供的能力面(若日后需要):插件只读「选中节点」与按 id 取节点图(`canvas` 目前只有 `getNodes` / `listNodeTypes`)。
**鲜艺抠图插件(现为市场插件 `xianyi-cutout` 1.0.4)**:源码在独立插件仓 `iwb-plugins-desktop`,桌面端从插件市场安装到 `<资料目录>/plugins/`,不再经 Cloudflare Function / KV。功能:右键命令「抠图:选中节点」→ `POST {apiUrl}/rmbg?crop=`(`application/octet-stream` + 原始字节)→ 结果 PNG 写回为新的参考图节点(`<原名>_cutout.png`)。设置项:`apiUrl` / `crop` / `timeoutMs`。
**KV 信任锚与治理(2026-10-19 补充,规则见规则库 §13.35)**:A2 运行时插件的信任边界 = **谁能写 `PLUGINS` KV**。`/plugins/index.json`(清单)与插件字节**同源同 KV** ⇒ 客户端 `integrity`(SRI)只防缓存/部分损坏,**不防 KV 被攻陷**(能改 KV 者可同时改插件与清单)。治理要求:`PLUGINS` KV 写权限**仅限发布脚本(`scripts/plugins-publish.mjs`,默认 dry-run)与本人**,不交给 CI 或第三方;第三方插件经 `scripts/plugins-sync.sh` 合入前**必须人工审计**(脚本运行时打印显式提示)。
**插件信任锚(2026-12-01 修订)**:桌面版没有 KV 通道,A2 运行时插件的信任锚 = **由本人发布的市场索引**(`market.maqiart.eu.org`)。客户端安装时校验 zip 整体 `bundleSha256` + 逐文件 sha256 + 路径白名单 + 体积上限(`src/runtime-plugin-market.js`),内置清单随包(`plugins/index.json`,带 SRI `integrity`);网页版与 KV 发布脚本已于 2026-12-01 移除,第三方插件不经 CI、不共享凭据。
**app.js 拆分(2026-11-26,已完成三批)**:`app.js` 是单 IIFE、`Workbench()` 是巨型组件,行数棘轮长期零余量,新逻辑无处可落。按「逐字搬运 + ctx 注入」分三批收编,`Workbench()` 由 3,060 行降至 2,169 行。
+20
View File
@@ -0,0 +1,20 @@
# 域名边界(2026-12-03 用户裁定)
三个域名属于**两个互不干扰的项目**。桌面版的发布流程只允许碰后两个。
| 域名 | 归属 | 托管 | 允许谁改 |
|---|---|---|---|
| `iwb.maqiart.eu.org` | **网页版项目(独立)** | Cloudflare Pages(独立项目) | 只有网页版项目自己。桌面版发布流程**不得**改它的 DNS / Pages / 内容 / 重定向 |
| `download.maqiart.eu.org` | 桌面版下载站 | NAS `/vol8/web/iwb-download` | 桌面版发布(`publish-update.sh` / `release.sh` / 手工 scp) |
| `market.maqiart.eu.org` | 桌面版插件市场 | NAS `/vol8/web/iwb-market` | 桌面版插件发布(`gen-market.js` + scp) |
## 硬规则
- `iwb.maqiart.eu.org` 是网页版,**与桌面版无关**;即使它挂掉/522,也不要用桌面版站点去「接管」这个地址。
- 发布脚本、Cloudflare 操作、DNS 改动,动手前先确认目标是上表里的哪个域名;不确定就别动。
- 网页版与桌面版的代码/产物/插件清单各自独立,不要互相覆盖。
## 历史
- 2026-12-01:网页版退役期间,曾用 `CNAME → iwb-redirect-979.pages.dev` 把 `iwb.maqiart.eu.org` 301 到下载站。
- 2026-12-03:用户恢复网页版访问,并明确「以后不要动这个地址、两个项目不要相互干扰」。本文件为长期约束。
+11 -11
View File
@@ -52,7 +52,7 @@
- **唯一版本源**:`package.json`;`node scripts/set-version.js X.Y.Z` 同步 `tauri.conf.json` / `Cargo.toml`。
- **mac**:`npm run verify:ci` → 更新 CHANGELOG → 提交 → `bash scripts/publish-update.sh`(双架构构建、签名、上传、生成 `latest.json`)。
- **Windows**:按 `docs/WIN_BUILD_SPEC.md` 构建 `*-setup.exe` → 放 NAS `_inbox/` → mac `publish-windows-update.sh` 重签 → **再跑一次** `publish-update.sh` 把 `windows-x86_64` 合并进 `latest.json`。
- **Windows**:按 `docs/WIN_BUILD_SPEC.md` 构建 `*-setup.exe` → 由 win 起一次性 tailnet HTTP 服务、mac 拉取并核对 sha256(NAS `_inbox/` 已弃用)→ mac `publish-windows-update.sh` 重签 → **再跑一次** `publish-update.sh` 把 `windows-x86_64` 合并进 `latest.json`。
- **站点**:登记 `site/releases.json` → `gen-release-page.js` / `gen-site.js` → 上传 NAS → 核验 200 与字节数。
- **tag**:`vX.Y.Z` 指向 bump 提交;docs/站点提交可在 tag 之后,但不要再改业务代码。
- 平台版本必须同批;Windows 落后时不要往 `latest.json` 塞旧包。
@@ -74,7 +74,7 @@
**方法论沉淀(也是排查顺序):**
- **先抓真实用户反馈**,不要凭猜测改。症状要问清:是「本地存空间不足 / CPU 持续高 / 内存爬升 / 拖动掉帧」中的哪一种,各自根因不同。
- **用 Performance 画像定位**:录**干净空闲段**看 Bottom-Up / Call Tree。CPU 高要看 React 渲染 / graph 缓存 / IDB 读写;内存爬升要看**无界缓存**(如 `outThumbCache` 原为无上限 Map)和**每次保存的深拷贝/全量扫描**;掉帧要看**每帧 O(n) 重渲染**和 **Layout/Paint**。
- **改动要能回滚**:每段先打 `vX-pre-Y` 标签;`npm run verify` 346/0/5 + e2e 16/16 是契约;部署确认 wrangler "Deployment complete" + 域名版本。
- **改动要能回滚**:每段先打 `vX-pre-Y` 标签;`npm run verify:ci` 是契约;桌面版发布用 `scripts/publish-update.sh` / `publish-windows-update.sh`,核验以 `latest.json` / `latest-windows.json` / 下载页三处一致为准(网页版的 wrangler 部署已废弃)。
- **性能修复也要「不增加不必要的 O(n)」**:惰性剥离、引用 memo、节流、DOM transform——都遵循「能 O(1) 就别 O(n),能按需就别全量」。
- **规范先行**:这类经验写入 13 章,避免将来反向改回去(如曾出现的「大图缓存失败保留 base64」与 CPU/内存冲突)。
@@ -254,7 +254,7 @@
### 13.23 CSP 是运行环境的一部分:本地 e2e 必须下发 `_headers`(v3.86.10 沉淀)
- **本地测试服务器不解析 `_headers` = 永远测不到线上安全策略**:本项目线上是 Cloudflare Pages,CSP 写在 `_headers` 里;本地 `serve-test.js` 若只发 `content-type`,`fetch(data:)` / `fetch(blob:)` / CDN `<script>` / `new Worker(blob:)` 这些**在线上必然被拦**的写法会在本地全绿。规则:**测试服务器必须下发与线上同源的响应头**(`scripts/serve-test.js` 解析仓库根 `_headers`,按 Pages 的路径分组语义应用;解析失败只提示不报错)。
- **本地 e2e 必须与真机同源的 CSP**:网页版时代 CSP 写在 `_headers`(已随 Cloudflare Pages 下线删除);桌面版 CSP 在 `src-tauri/tauri.conf.json`,`scripts/serve-test.js` 需要下发与桌面端一致的响应头,否则 `fetch(data:)` / `fetch(blob:)` / CDN `<script>` 这类**真机必被拦**的写法会在本地全绿。
- **当前 CSP(`_headers` 的 `/*` 组)实际拦掉什么**(全部为 Chromium 实测原文,别凭记忆猜):
- `connect-src 'self' https:` → **`fetch(data:...)` 与 `fetch(blob:...)` 都被拦**("Refused to connect to 'blob:...' ... connect-src 'self' https:")。注意 `blob:` URL 属于 document 的 origin,但**仍然不在 `'self'` 的 scheme 匹配里**——这条最反直觉。
- `script-src 'self'` → 动态插的 CDN `<script>` 触发 `onerror`("Refused to load the script ... script-src 'self'"),`eval` / `new Function` 也全禁用(Playwright 的 `page.evaluate` 传字符串同样会被拒)。
@@ -421,7 +421,7 @@
### 规则二:**跨域图床必须走"本站同源代理",禁止第三方代理**
豆包(火山 TOS)等图床**不发 CORS 头** ⇒ `fetch(cors)` 必失败。做法:
- 新增 `functions/api/img.js`(Cloudflare Pages Function):本站 CORS 头 + **仅 https** + **域名白名单** + 仅透传 `image/*`;
- ~~新增 `functions/api/img.js`(Cloudflare Pages Function)~~ —— **网页版已停用,该 Function 已删除**;桌面端跨域取字节走宿主能力,失败必须有可见提示。
- `downloadUrl` 链路:直连 → 本地已归档原图 → **本站代理** → 新标签兜底(**绝不静默失败**,失败必有可见提示);
- 断言锁死"全代码库不得出现第三方代理域名"。
@@ -481,7 +481,7 @@ LRU 上限 + 切画板/离开画布/卸载时回收;`revokeAll()` 幂等。
### 13.34.3 跨域图片:唯一允许的取字节方式
- 豆包(火山 TOS)、七牛、阿里云等**不发 CORS 头** ⇒ `fetch(cors)` 必失败;`canvas.toDataURL()` 因污染必抛错。
- **必须**经本站同源代理 `functions/api/img.js`(`/api/img?url=`):仅 https + 域名白名单 + 仅透传 `image/*` + 本站 CORS 头。
- **桌面端**:跨域取字节走宿主(Tauri http / 本地归档优先);网页版时代的 `functions/api/img.js` 代理已删除,文档与代码都不要再引用它。
- **禁止第三方代理**(曾用 `wsrv.nl`,已按用户要求移除);下载链路四级兜底:直连 → 本地已归档原图 → **本站代理** → 新标签(绝不静默失败)。
### 13.34.4 契约与验证方法(本方案的"证据链")
@@ -495,7 +495,7 @@ LRU 上限 + 切画板/离开画布/卸载时回收;`revokeAll()` 幂等。
### 13.34.5 发布纪律(在 §13.32 基础上追加,均为真实失误驱动)
1. `verify`/`deploy` **不得管道给 `tail`**(吞退出码 ⇒ 假成功)。
2. **先部署、后打标签**,标签必须指向"已部署且验证通过"的提交;三地址核验一律执行 `npm run verify:release`(含 CDN 传播退避重试)。
2. **先发布、后打标签**,标签必须指向“已发布且验证通过”的提交;核验读 `latest.json` / `latest-windows.json` / 下载页三处一致(旧 `npm run verify:release` 已随网页版删除)。
3. **任何时刻线上保持绿色**:改动失败即 `git reset --hard` 回到已知良好提交;不留"半成品分支状态"。
4. **探针三原则**:零行为变更 / 用户可自助取回 / **查清即删并加"零残留"契约**。
5. 每版必写 `CHANGELOG`(含"如实记录的残留风险");每个里程碑建 GitHub Release。
@@ -507,11 +507,11 @@ LRU 上限 + 切画板/离开画布/卸载时回收;`revokeAll()` 幂等。
| 完整执行文档与复盘(§0–§13,含被推翻推断的留档、踩坑清单、验收表) | `docs/archive/plans/opentu-parity-image-memory.md` |
| ~~预览产物生成器(解码即缩放 + `close()` + objectURL 回收)~~ **已于 v3.26.65 删除**:交付时只做到「模块 + 单测」,从未接到 `wPreviewUrlOf`(实际是恒等函数)—— 属"假绿",重做见 BACKLOG | — |
| 图片字节 Blob 仓库(内容寻址去重) | `src/image-blob-store.js`(9/9 单测) |
| 同源图片代理(跨域取字节唯一通道) | `functions/api/img.js` |
| ~~同源图片代理(跨域取字节唯一通道)~~ **网页版时代已删除**:桌面端无此代理 | — |
| 内存行为契约 | `tests/iwb-image-memory-parity.spec.js` |
| 新写入主通道契约(`{__blob}` / 存量 `{__cache}` 兼容 / A/B 开关) | `tests/iwb-blob-write.spec.js`(2 条) |
| 守护契约编号 | `120-1 … 142-1`(见 `tests/iwb-v32-web-test.js`) |
| 发布核验工具 | `scripts/verify-release.js`(`npm run verify:release`) |
| 发布核验工具 | `publish-update.sh` / `publish-windows-update.sh` 发布后回读 `latest.json` / `latest-windows.json` |
### 13.34.7 已知残留(明确记录,避免误以为已解决)
- **JS 堆 <120MB 未经真机堆快照确认**(仅有等价 A/B 代理证据:画布 base64 → 0 ✓)。
@@ -616,14 +616,14 @@ B-② 撤销/重做后图片真能解码显示,`naturalWidth=768`)· e2e `te
## §13.35 插件 = 完全可信代码:信任模型与治理(2026-10-19)
> 适用:应用内插件体系(现状见事实基线 §14)。自 A2 起,远程插件经 Cloudflare Pages Function `functions/plugins/[[path]].js` + KV(binding `PLUGINS`)**同源运行时加载**。
> 适用:应用内插件体系(现状见事实基线 §14)。桌面版插件经**插件市场**(`market.maqiart.eu.org`)分发,安装到 `<资料目录>/plugins/`,安装时按 zip 的 `bundleSha256` + 逐文件 sha256 校验;网页版的 Pages Function + KV 通道已下线。
**背景(为什么会踩)**:插件是**同源 JS**,与主程序同权 —— 可读 `localStorage` 里的**全部 API Key**、IndexedDB 里的**全部图片**、注入任意 UI、发起任意 `https:` 与本机请求。宿主**不做沙箱**(`script-src 'self'` 对同源脚本无能为力)。启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27)。
**规则(三条,硬性)**:
1. **插件 = 完全可信代码,只装自己审计过的**。文档/发布说明必须**明示**这一点;不得向用户暗示"插件有沙箱 / 有权限隔离"。
2. **信任锚是「谁能写 `PLUGINS` KV」,不是客户端 SRI**。`/plugins/index.json`(清单)与插件字节**由同一 KV 提供** ⇒ 能改 KV 者可同时改插件与其 `integrity`;客户端 fail-closed 的 `integrity` 校验**只防缓存/部分损坏,不防 KV 被攻陷**。因此 `PLUGINS` KV 写权限**只给发布脚本与本人**,不交给 CI、第三方或共享凭据;发布统一走 `scripts/plugins-publish.mjs`(算 SHA-256 + 写清单 + 上传,默认 dry-run,`--upload` 才落 KV)。
2. **信任锚是「谁能写插件市场」,不是客户端 SRI**:市场索引与本机安装/内置清单校验(zip `bundleSha256` + 逐文件 sha256 + SRI `integrity`)共同定界;网页版与 KV 发布脚本已于 2026-12-01 移除,发布只走「插件源仓 → 桌面仓 sync/gen-market → NAS `/vol8/web/iwb-market`」,凭据不进 CI。
3. **合入第三方插件前先审代码**。`scripts/plugins-sync.sh` 会把插件仓产物拷成 `src/plugin-<id>.js`(可执行可信代码);**同步前必须人工审计**(脚本已在运行时打印该显式提示)。
**验证方式**:`tests/plugin-host-test.js`(宿主契约)· `tests/plugin-integrity-test.js`(清单/integrity 生成)· `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 dev 探针,不进 34 门禁)。
@@ -1657,6 +1657,6 @@ JS 只能拿到 `TypeError: Failed to fetch`。
- 构建机只认 `package.json` 的版本;文档中的固定版本号是历史示例,照抄必错。
- `tokens:check` 失败先看 CRLF:`build.js` 与 `gen-tokens.js` 都必须把 `\r\n` 归一后再比较;只修一处会在 `app:build` 再炸一次。
- `.gitattributes` 的 `eol=lf` 不会 renormalize 已有 checkout;校验层容忍才是根治。
- Windows 只负责出 `*-setup.exe` 放 NAS `_inbox/`;签名、`latest-windows.json`、合并 `latest.json` 全部在 mac 做。
- Windows 只负责出 `*-setup.exe` 并通过 tailnet HTTP 交给 mac(`_inbox/` 已弃用);签名、`latest-windows.json`、合并 `latest.json` 全部在 mac 做。
- 平台版本必须同批:Windows 版本落后时 mac 的 `latest.json` 不应塞旧 win 包,等 win 同版本发布后重跑发布脚本自动齐平。
- 发布后核验三件事:`latest.json` 含三平台、`latest-windows.json` 版本一致、下载页 exe 可 200 且字节数一致。
+69
View File
@@ -0,0 +1,69 @@
# 图片读取与下载口径(2026-12-03 定稿)
> **这是规范**:同一张图,不管从输出节点、图库、任务队列还是预览打开/下载/复制,
> **取源顺序与文件名只有一套**。新代码按本文写;`tests/image-download-contract-test.js` 会拦住已知的偏离写法。
>
> 背景与踩坑记录见 [`image-read-lessons-2026-12-03.md`](image-read-lessons-2026-12-03.md)。
## 0. 术语
| 词 | 含义 |
|---|---|
| 原图 | 用户要看的完整分辨率图片。桌面端 = `images/gallery/<文件>` 或 `origIdb` 字节 |
| 缩略图 | 320px 级小图(`row.idb` / `images/thumbs/`),**只用于列表、宫格、占位** |
| 图库行 | 输出索引里的一行(`f.name` / `f.url` / `f.orig` / `f.origIdb` / `f.idb`) |
| 会话副本 | `IWBImageIngestView.localUrl`,本次运行内有效,重启即失效 |
| 远程 URL | 生成结果上游地址(图床),会过期、跨域、慢 |
## 1. 取源顺序(唯一口径)
按顺序取,**拿到一层就停**:
1. **`origIdb`** —— 图库行写入的原图字节(新记录)
2. **`images/gallery/<文件>`** —— 本地原图文件(老记录没有 `origIdb`;入口 `IWBStorageFile.galleryOriginalOf` / `galleryOriginalBlob`)
3. **会话副本** —— `IWBImageIngestView.localUrl`(任务队列专用)
4. **远程 URL** —— 仅「下载 / 插入画布」允许兜底
5. **320 缩略图** —— 只做占位底图,**永远不当原图**
硬规则:
- **预览不许直连远程**:本地没有原图就提示「先下载」,不打开预览,也不把 320 缩略图放大冒充原图。
- **下载必须本地优先**:`wResolveOutputSrc` 先 `origIdb` → 本地原图文件 → 数据 → 远程。
- 缩略图可以「先出画面」,但 `ImagePreview` / 节点体必须在原图到达后替换掉它(现有的「先糊后清」逻辑)。
- 「能显示 = 本地有图」是产品判据:显示不出来就是没落地,不是网络慢。
### 各场景落点
| 场景 | 入口 | 取源 |
|---|---|---|
| 任务队列预览 | `queue.preview` → `ImagePreview` | 本地原图;无则提示未下载 |
| 图库预览 | `gallery.preview` → `ImagePreview` | `origIdb` → 本地原图文件 |
| 输出节点双击 | `props.onPreview` → `ImagePreview` | 同上(条目带 `name` 时按行名读本地) |
| 输出节点 ↓、预览下载、图库下载 | `wResolveOutputSrc` | 本地优先 |
| 插件 `ctx.images.preview/thumb` | `wPluginPreview` | 已有分层(thumb/preview/original) |
## 2. 下载文件名
**一律用图库行名 `f.name`**(经 `wOutNameOf(url)` 按 url 查行)。
| 场景 | 文件名 |
|---|---|
| 图库卡片下载 | `f.name` |
| 输出节点 ↓ | `wOutNameOf(url) \|\| 'image.png'` |
| 预览「下载当前图片」 | 图库条目用 `entry.name`,其余 `wOutNameOf(url) \|\| 'image.png'` |
| 输出节点批量下载 | `wOutNameOf(url) \|\| 'image-001.png'` |
| 任务队列「下载」 | 落地到图库,不产生浏览器下载 |
禁止:给 `downloadUrl(...)` 传写死的业务文件名。`image.png` / `image-00N.png` 只允许作为「还没落地、没有行名」的兜底。
## 3. 相关入口(实现索引)
- `src/storage-file.js`:`galleryOriginalOf(row, max)`(预览,原生按尺寸解码、落 thumbs 缓存)、`galleryOriginalBlob(row)`(下载,原始字节,不重编码)
- `app.js`:`wResolveOutputSrc`(下载取源)、`wOutNameOf`(命名)、`queue.preview`(任务队列预览)
- `src/ui-canvas-view.js`:`ImagePreview` 统一解析 `{__gallery, name, origIdb, idb}` 条目
- `src/ui-node-bodies.js`:输出节点下载 / 预览入口
## 4. 检查
- `node tests/image-download-contract-test.js`(已进 `npm run test:unit`)
- 新增下载/预览入口时,先对照本表;守卫不覆盖的写法,**改守卫**再写代码。
@@ -0,0 +1,47 @@
# 图片本地读取改造 · 经验与踩坑(2026-12-03)
> 对应规范:[`image-read-and-download.md`](image-read-and-download.md)。本文只记「为什么」和踩过的坑,
> 下次改图片读取/预览/下载前先看这里。
## 1. 老记录为什么会被「放大发糊」
- 图库行有两种原图形态:**新记录**写 `origIdb`(IndexedDB 字节);**老记录**只有磁盘文件 `images/gallery/<文件>`,索引里 `origIdb` 是空的。
- 任务队列预览曾经按 `origIdb → idb → localUrl` 取源。老记录没有 `origIdb`,直接落 `idb` —— 那是 **320 缩略图**,全屏一放大必然糊。
- 教训:**`idb` 永远是缩略图,不是原图**。任何「原图」路径都不允许读 `idb`。
- 判定方法:新图清晰、老图糊,且糊得很均匀 → 先怀疑取到了 320 档。
## 2. 「本地有」不等于「IndexedDB 里有」
- 桌面端的权威原图是 `images/gallery` 的**文件**;`origIdb` 只是其中一种缓存形态。
- 所以「本地优先」必须包含**按行名读磁盘**这一步(`galleryOriginalOf` / `galleryOriginalBlob`),否则老记录只能退远程或缩略图。
- `assets` 的键约定:`out_orig_<name>`;行里 `origIdb` 为空时可以按这个约定回查。
## 3. 预览只读本地之后的产品语义
- 能显示 = 本地有图;显示不出来 = 没落地。
- 本地没有原图时给提示「先下载」,**不要**偷偷回退远程 —— 否则用户以为图在本地,断网/过期就整片破图。
- 缩略图只做「先糊后清」的底图,不能作为最终图。
## 4. 预览路径与缓存归属(容易踩内存坑)
- `galleryOriginalOf` 返回的 objectURL **归 storage 持有**(`thumbUrlCache`,不 revoke)。
- `ImagePreview` 自己的 `urlsRef` 会在淘汰时 `URL.revokeObjectURL`;**不要把 storage 的 URL 塞进 `remember()`**,否则一处淘汰、另一处还在用 → 破图。
- 反过来:`galleryOriginalBlob` 给的是原始字节,可以交给预览的下载/复制链路自行登记 URL。
## 5. 下载命名的坑
- 改之前:图库下载用行名 `gen_...png`,输出节点写死 `image.png`。同一张图两个名字,用户对不上。
- 统一规则:**行名优先,未落地才回退**。新增下载入口一律走 `wOutNameOf(url)`。
- 守卫 `tests/image-download-contract-test.js` 会拦「写死业务文件名 / 预览直连远程 / 把 idb 当原图」。
## 6. 任务队列页头被滚走 / 页脚被压(同日,相关布局坑)
- 现象一:筛选页签、页头随列表滚走。原因:整页容器和列表都在滚。
- 现象二:列表行压在页脚说明上。原因:宿主滚动容器高度固定,插件根节点 `flex: column` 里的列表被压缩到 540px,但列表没设 `overflow`,内容溢出画在页脚上。
- 修法:插件根 `.iwb-tq{height:100%}` + 列表 `.iwb-tq-list{overflow-y:auto}` —— 只有列表自己滚。
- 教训:**「谁滚」只能有一个**;滚动容器里再放一个 `flex:1; min-height:0` 的子块,必须给它 `overflow`,否则内容会溢出到兄弟元素上。
## 7. 工程约束
- `app.js` 有行数棘轮(新能力优先落 `src/<domain>-*.js`);本次因下载命名 + 队列预览同期改,棘轮 9345→9354、Workbench 2686→2687,注释已写日期/差/原因。
- 改完跑:`npm run build && node --check dist/app.js && npx eslint src app.js && npm run typecheck && npm run test:unit && npm run test:facts`。
+16
View File
@@ -108,6 +108,22 @@
5. **弹线/拖动节点命令式重画 canvas**:`dragApplyVisual` 与 `applyViewportDom` 都调用 `refs.edgeCanvasDraw`,不触发 React。
验收:平移 1000px 不出现节点迟到/空白;边线选择/双击仍可用;graphics 不再包含 SVG 边线层。
## 八、平移 A/B(2026-12-01,Playwright WebKit,104 节点/92 边/无大图)
| 配置 | pan p50 | pan p95 |
|---|---:|---:|
| 合成层关闭 | 17ms | **60~66ms** |
| 合成层开启 | 17ms | **22ms** |
| 合成层开启 + 平移冻结 Canvas 边线 | 17ms | **18ms** |
| 合成层开启 + 关闭平移全量渲染 | 17ms | 23ms |
结论:
- WebKit 下 world/grid 合成层是平移流畅的关键,关闭后 p95 约 3 倍;
- 平移时冻结 Canvas 边线再松手重画,可再降 p95(22→18ms);
- 关闭“平移全量渲染”没有帧率收益,保留它以避免平移空白。
诊断开关(localStorage):`iwb_layers_on`、`iwb_pan_edges_freeze`、`iwb_pan_all_off`。
## 七、代码位置
- 边线层:`src/canvas-geometry.js`(edgeLayer* / applyViewportDom)、`app.js`(`.iwb-edges` 渲染)
@@ -0,0 +1,193 @@
# 画布性能与图片链路优化参考(2026-12-01)
> 来源:v3.26.154 → v3.26.182 之间连续多轮真机排查(Windows 为主,mac 对照)。
> 本文只记录**已验证的事实**与**可复用的方法**,不是规范条文;改代码前先看「反模式」与「回归清单」。
## 0. 一页结论
1. **JS 堆不是内存大头**:正常态 20–80MB;`performance.memory` 只是堆,和任务管理器差 1.5–3 倍是正常的。
2. **WebView2 的 GPU 进程私有内存会冲到 1–2.6GB,但大头是「已提交未驻留」**:工作集只 130–180MB,20–60 秒内自己回落到比基线还低。不要拿任务管理器的「私有」当泄漏证据。
3. **真正不回落的是 renderer**:一次「开大画板 + 平移」会抬 40–120MB 并长期不降,量级与 DOM 元素数同步(1500 → 4600+)。
4. **空闲 CPU 高 ≠ 有后台任务**:多数是内存压力导致的 GC 抖动,或「常驻合成层 + 大 base64 图片」让合成器持续工作。判据:最小化窗口 CPU 掉 → 渲染/合成侧;不掉 → JS 侧。
5. **DOM 里挂 1MB 级 base64 `<img src>` 是明确的 CPU/内存放大器**:标注覆盖后图能显示,但 CPU 从个位数升到 15% 且不回落;把它转成 `{__blob}` 引用后立刻恢复。
6. **空 `src` 会把节点永久标成「图片源已失效」**:缩略图未就绪时返回 `""` 会触发 `onError`,遮罩加上后没人移除;显示层必须「有图就显示原图」,不要空占位。
7. **取图优先级是 `localRef → data → url`**:覆盖式替换图片时必须同时清 `localRef`/`ref`,否则旧引用(及其缓存的 objectURL)永远压过新数据。
8. **缩略图生成失败必须负缓存**:失败后每次重渲染都重新入队 → 反复整幅解码,是「做一次标注后 CPU 一直高」的直接原因。
9. **视口裁剪是双刃剑**:裁得太紧,平移时节点/连线会「突然冒出来」;正确做法是「手势期间只扩张不收缩 + 边距 1.5 屏 + 步长 1/3 屏」,松手后再回收。
10. **常驻合成层(`data-layers=on` 给 world 加 `will-change`)应停用**:手势期间的临时提升已经够用,常驻只会让窗口可见时持续吃 CPU。
## 1. 诊断方法论(先取数,再改代码)
### 1.1 三层指标,别混用
| 指标 | 来源 | 说明 |
| --- | --- | --- |
| JS 堆 | `performance.memory.usedJSHeapSize` | 只有 Chromium 有;WKWebView 恒空。20–80MB 属正常,锯齿是 GC |
| 进程工作集 / 私有提交 | 诊断页「内存拆解」 | Windows 用 Toolhelp32 + `GetProcessMemoryInfo`;mac 用 `footprint` |
| 进程树合计 | `app_memory_tree_mb` | 宿主 + 全部 WebView2 子进程;和任务管理器「内存」列同源 |
判读顺序:**先看进程树合计是否随操作抬升并回落**,再看 renderer 是否台阶式上涨,最后才看堆。
### 1.2 三个对照实验(各 30 秒,性价比最高)
- **最小化对照**:窗口最小化后 CPU 掉 → 渲染/合成侧;不掉 → 定时器/JS 侧。
- **回收对照**:点「立即回收内存」后 CPU 掉 → 与缓存/大对象有关(历史、缩略图、图片字节、大 base64)。
- **开关对照**:逐个关「合成层常驻提升 / 手势期提升 / 帧探针」,看 CPU 与残影变化。
### 1.3 帧探针(`iwb_perf_probe=1` 或诊断页勾选)
每 60 秒写一条到 `_boot.log`:
```
perf 60s frames=3598 long=0 max=0ms js=0/0ms tags=- domImgs=13
```
- `js=条数/总ms`:主线程长任务(>50ms)。为 0 说明不是脚本在算。
- `frames`:rAF 次数(探针自身也在跑,接近 60 说明页面在出帧)。
- 注意:**短任务不会进 longtask**;60fps 的小任务循环(如逐帧 canvas 重绘)表现为「js=0 但 CPU 高」。
### 1.4 插件写回日志(`plugin-img`)
写回路径会往 `_boot.log` 记一行:`plugin-img save id=… ok=… err=… len=… localRef=Y/N keys=…`。
- `ok=false` → 写回校验失败(保存/落盘问题)
- `localRef=Y` → 旧引用还在,新图会被压住
- `keys` 缺 `data` → 数据没落到节点上
> 坑:桌面端 `logPut` 曾经签名不匹配(app 传对象、存储层收两个参数),所有 `wLog` 都写进 `log:[object Object]`、值为 `undefined`。排查日志类问题前先确认落盘通道本身是通的。
## 2. 内存:真实的构成与阈值
### 2.1 谁在吃内存
- **GPU 进程**:合成层/纹理。峰值 1–2.6GB 但大部分可换出,会自己回落;工作集只有 130–180MB。
- **renderer**:DOM + 图片解码 + JS 堆。开 97 节点画板时 DOM 1500 → 4600+,私有内存 +40–120MB 且不回。
- **宿主**:30–50MB,稳定。
- **图片字节缓存**:`blobCache` 按条数+字节双上限(96/64MB);`imgBigN` 必须为 0(DOM 里不得出现 >500KB 的 base64)。
### 2.2 阈值与自动回收(v3.26.171 之后)
- 可见空闲 **90 秒** → 轻量回收(保留显示缩略图)。
- 进程树 RSS **≥ 2500MB** → 不等空闲,直接完整回收(含缩略图缓存)。
- 旧策略要求「可见 + 空闲 5 分钟」,日常几乎不触发,是「内存上来不降」的隐藏原因之一。
### 2.3 已证伪的假设(不要再走一遍)
- 「deps/.fingerprint 被删导致构建慢」:实际是构建机 shell 的文件视图看不到那两个目录,cargo 一直命中缓存。
- 「GPU 私有 1.3GB 是泄漏」:是已提交未驻留,工作集只有 100MB 级,会回落。
- 「切画板残留 DOM」:DOM 在 720↔3752 之间振荡,停止切换后回落,不构成阶梯泄漏。
## 3. 画布渲染:分层与手势
### 3.1 分层现状
- **边线**:canvas 视觉层(视口大小)+ 透明 SVG 命中层(负责 hover/点选/双击断线)。
- **节点**:DOM(`.iwb-world` 内的绝对定位节点)。
- **网格**:预生成贴图 + `background-position`。
### 3.2 手势期间的正确姿势
1. **世界层临时提升**:`.iwb-canvas.iwb-gesture .iwb-world { will-change: transform }`,停手后撤销(不要常驻)。
2. **连线不再按视口裁剪**:全部绘制,canvas 自身被视口裁掉;否则新进入视口的线会「迟到」。
3. **边线层不冻结**:平移期每帧重画,而不是把 canvas 用 CSS 平移走。
4. **节点裁剪窗口**:边距 1.5 屏、更新步长 1/3 屏;**手势期间只扩张不收缩**(`panKeep`),松手后按视口回收。
5. **命中层每帧同步**:空格平移不经过 `pointerup`,只靠手势结束事件对齐会漏。
### 3.3 LOD
- 只保留一档:`<15%` 切纯占位;取消 ~30% 的 lite 档(阈值附近来回切换会「画面常闪」)。
### 3.4 仍存在的已知问题
- 平移松手后仍有极轻微残影(合成层位图延迟),当前以「手势结束重绘 + 短暂关闭命中层」缓解,未彻底消除。
- renderer 相对最早基线高 ~36MB(DOM 规模导致),暂不处理。
## 4. 插件
### 4.1 生命周期
- 关闭插件面板 **不等于** 停用插件:面板只卸 DOM,插件实例仍在。重对象必须在 `close()` 里主动释放。
- 反例(已修):`image-vectorize` 关闭面板时只删 DOM,源图解码位图与 SVG 字符串仍挂在闭包里,开过一次大图后堆不回落。0.6.3 起在 `close()` 里置空 `source` / `currentSvg`。
### 4.2 插件写回图片的接口
- `ctx.canvas.saveNodeImage(id, dataUrl)`:写入 → 落盘 → 回读校验,失败回滚并返回原因(首选)。
- `ctx.canvas.setNodeImage(id, dataUrl)`:同步写节点数据,不做落盘校验。
- 两条路径都必须:**清旧引用 → 失效缩略图缓存 → 触发重渲染 → 大图引用化**。
## 5. 图片保存链路(标注覆盖为例)
### 5.1 正确流程
```
编辑器输出 Blob
→ imageToDataUrl
→ saveNodeImage(id, dataUrl)
├ 写节点:{ data, url:"", localRef:null, ref:null, orig:旧图 }
├ commitCanvas(setNodes 触发渲染)
├ saveNow(落盘)
└ 回读校验:磁盘上的节点数据必须与旧值不同,否则回滚并报错
→ 成功后:删缩略图缓存条目 → wThumbBump()
→ 若 dataUrl > 200KB:wImgRefWrite 无损转 {__blob},节点三字段指向引用
```
### 5.2 四个必须同时满足的条件(缺一个就表现为「图丢了」)
1. `localRef` / `ref` 必须清空 —— 否则旧引用压过新 `data`。
2. 显示层不得返回空 `src` —— 空 src 触发 `onError`,节点被永久标成「图片源已失效」。
3. `onLoad` 必须清除 `is-broken` 标记 —— 否则换图后遮罩残留。
4. 缩略图失败要负缓存 —— 否则每次重渲染重新解码。
### 5.3 大图不要留在 DOM
- 1.2MB base64 挂在 `<img src>` 上:内存上涨,且合成器持续工作 → 空闲 CPU 15%。
- 落地方式:`wImgRefWrite(dataUrl)` → `{__blob}` → 显示走 objectURL;磁盘/IDB 存字节。
- 阈值:>200KB 即引用化;小图(≤ `IMPORT_INLINE_MAX`)可内联。
## 6. 反模式清单
- ❌ 用任务管理器的「私有内存」判断泄漏(先看工作集与回落曲线)。
- ❌ 用 JS 堆判断图片内存(图片在 renderer 原生侧,不在堆里)。
- ❌ 在渲染路径里返回空 `src` 当占位。
- ❌ 覆盖替换图片只改 `data`,不清 `localRef` / `ref`。
- ❌ 缩略图失败后无限重试。
- ❌ 常驻 `will-change: transform` 把整个世界层做成合成层。
- ❌ 手势期间收缩裁剪窗口(节点/连线会「突然出现」)。
- ❌ 依赖「手势结束事件」对齐命中层(空格平移没有 pointerup)。
- ❌ 插件关闭面板只删 DOM,不释放大对象。
## 7. 回归检查清单
改到以下位置时,至少跑一遍对应检查:
| 改动 | 必查 |
| --- | --- |
| 缩略图 / 取图 | `imgBigN=0`、`imgMaxKB<500`、节点不出现「源已失效」 |
| 裁剪 / 手势 | 快速平移:连线不迟到、节点不突现、松手后不残留 |
| 插件写回 | 标注覆盖后立刻显示新图、`plugin-img ok=true`、DOM 无大 base64 |
| 内存回收 | 空闲 2 分钟 CPU 稳定、堆不锯齿、进程树不持续抬升 |
| 合成层 / will-change | 最小化对照:CPU 应随窗口最小化明显下降 |
## 8. 工具与开关速查
| 开关 | 位置 | 作用 |
| --- | --- | --- |
| `iwb_perf_probe` | 诊断页「帧探针」 | rAF 帧时长 + longtask → `_boot.log` |
| `iwb_diag_off` | 诊断页「关闭诊断采样」 | 停 15s 采样与 4s 进程轮询 |
| `iwb_gesture_layer` | 诊断页「手势期提升」 | 手势期间临时合成层 |
| `iwb_layers_on` | 诊断页「合成层常驻提升」 | **已停用**(不再产生常驻层) |
| `iwb_noblur_on` | 诊断页「禁用毛玻璃」 | 二分 graphics 占用 |
## 9. 后续方向
1. 平移残影:把边线层移出主合成层(独立 layer / `contain: paint`)后再观察。
2. renderer 台阶:DOM 规模是硬成本;若要继续降,只能走「静态内容 canvas 化」(Canvas V3 已被否决,需重新评估范围)。
3. 图片管线:远程图(http)目前仍可能以原图进纹理,按缩放档限制长边是下一步。
4. 诊断:把 `_boot.log` 的 mem 采样改成可配置频率,并支持一键导出最近 10 分钟曲线。
## 性能回归怎么跑(2026-12-02 起)
- 日常:`npm run perf:baseline`(build → 起本地服 → 只跑 `tests/_perf-baseline.spec.js` → 关服;默认 LIGHT=1,12 步平移)
- 完整档:`IWB_PROBE_LIGHT=0 npm run perf:baseline`;只测不断言:`IWB_PROBE_PERF=0`
- 判据(本机 2026-12-02 headless 基线):长帧比例 ≤ 40%、longtask 总时长 ≤ 2500ms、帧数 > 30(防探针没启动导致假绿)
- 实测参考:长帧 22.8%~30.9%、longtask 1905~1934ms、最长帧 ~400ms —— **换机器必须重设阈值**,注释里已写明
+16 -3
View File
@@ -49,14 +49,27 @@ package.json:
| panels | ctx.ui | 侧栏/独立面板注册 |
| promptlib | ctx.promptlib | 提示词库数据 + 文件 + 备份 |
| nodeTypes | ctx.nodes | 画布节点类型注册 |
| canvas | ctx.canvas | 只读:getNodes / getSelectedNode / screenToWorld |
| canvasWrite | ctx.canvasWrite | 写入:createNode / createImageNode / setNodeImage |
| canvas | ctx.canvas | 读:getNodes / getSelectedNode / getNodeImage / screenToWorld |
| canvasWrite | ctx.canvas(**合并,没有 ctx.canvasWrite**) | 写:createNode / createImageNode / setNodeImage / saveNodeImage |
| nodeActions | ctx.nodeActions | 节点右键/气泡动作 |
| commands | ctx.commands | 命令面板 |
| settings | ctx.settings | KV 配置 |
| data | ctx.data | 插件数据文件 |
**注意**:createNode 在 ctx.canvasWrite,不在 ctx.canvas。调错只会提示“宿主不支持”。
**注意**:`CAPABILITY_API_KEYS` 把 canvasWrite 的接口**合并进 `ctx.canvas`**(`src/plugin-host.js`);
`ctx.canvasWrite` 并不存在,但 manifest 的 `capabilities` 仍须同时声明 `canvas` 与 `canvasWrite`,否则拿不到写接口。
调错只会提示“宿主不支持”。
**图片写回契约(v3.26.183,改前必读)**:
| 接口 | 语义 | 用法 |
|---|---|---|
| `ctx.canvas.setNodeImage(id, dataUrl)` | **同步**返回严格布尔;只改内存 + 失效缓存 + 重渲染,**不落盘** | 只要“立刻显示”的场景(blank-canvas 填白图、white-bg-800 覆盖) |
| `ctx.canvas.saveNodeImage(id, dataUrl)` | 返回 `Promise<{ok, error}>`;落盘 + 回读校验,失败**回滚旧图**并给原因 | 用户编辑成果必须落地的场景(image-annotate 覆盖) |
| `ctx.canvas.createImageNode({ dataUrl, name, x?, y? })` | **同步**返回节点 id;超过内联阈值的图由宿主后台引用化 | 生成新图(白底新建、抠图、矢量化、插图) |
- 大图(> 宿主内联阈值,现 3000 字符)会被宿主转成本地引用,`getNodeImage` 仍返回 dataUrl,插件无需感知。
- `getNodes()` 返回的 `data` 是**只读视图**:不要原地改,宿主不会失效缩略图/触发保存;写图只走上面三个接口。
## 3. 面板
+7
View File
@@ -105,3 +105,10 @@ node scripts/gen-market.js && node scripts/gen-market-page.js
- 插件版本独立于客户端版本:客户端 3.26.x 与插件 1.9.x/1.14.x 互不绑定。
- 插件改动**不需要**重打客户端(桌面包不含插件);发完市场,用户重启客户端即生效。
- 客户端需要新插件能力(新宿主 API)时,先在桌面仓实现并发布客户端,再升插件版本依赖它——顺序不能反。
## 8. 换行符与 SRI(2026-12-03 Windows 实测)
- 现象:Windows 构建机(`core.autocrlf=true`)出的包里,`plugin-style-source.*.js` 的 SRI 校验失败,WebView2 拒绝执行该插件;构建本身不报错。
- 根因:插件产物是逐字拷进 dist 的,CRLF 让字节和 `plugins/index.json` 里记的哈希对不上;`git status` 看不出(text 归一化)。
- 已修:`scripts/copy-plugins.js` 写 dist 时对 `.js/.css/.json/.html/.svg/.txt/.md` 统一转 LF;`scripts/check-dist.js` 新增「dist/plugins 逐条 vs index.json 哈希」校验(`verify:ci` 会跑)。
- 以后新增「逐字拷贝」的文件类型,必须同时进 `TEXT_EXT` 或保持二进制,别让它带着平台换行进包。
@@ -253,7 +253,7 @@ npm run verify
- 发布后记录 commit 与版本;核验 `latest.json` / `latest-windows.json` / 下载页三处一致。
- **"部署成功"≠ 验收:部署后要在真实 URL 上跑关键 e2e**(本轮做法,测试地址与正式域名各跑一遍):
```bash
IWB_BASE_URL=https://iwb.maqiart.eu.org npx playwright test tests/<关键>.spec.js
# 网页版已停用;桌面版发布后在安装包上跑 npm run test:e2e:smoke
```
同时核验 `app.js` 里的 `APP_VERSION` 与 `version.json`——只看外层退出码或"Deployment complete"会漏掉真实故障(管道 `tail` 退出码恒为 0)。
- **文档 / 发布说明里的"地址"必须是完整可点 URL**:禁止用 `站点/#iwb-tools=<暗号>` 这类**占位符**充当地址(用户会直接粘进浏览器 → 白跑一趟并以为站点坏了)。若必须举例,明确标注"占位符,非真实地址"。
@@ -266,7 +266,7 @@ npm run verify
- **CI 红灯排查顺序**:`gh run view <id> --log-failed` 看具体 job;优先怀疑 action/依赖,而不是代码。
- **构建产物已压缩打包(应用版本 v3.1.1)**:`scripts/build.js` 改为 **esbuild 逐文件 minify 再拼接** 成单个 `dist/app.js`(**不再输出 `dist/src/*`**),`style.css` 一并 minify;vendor React 保持独立、不压缩。**逐文件 minify(`transformSync`,非 `bundle`)** 是关键:拼接前每个 IIFE 已封闭,避免"整文件拼接后顶层声明重复/改名"的解析级隐患。
- **产物体检进 `verify`**:`npm run verify` 增加 `node --check dist/app.js` 与 `node scripts/check-dist.js`(断言 banner 版本 == `version.json`、`index.html` 恰 3 个 `<script>` 且无 `src/`、压缩后内嵌 Worker 字面量标记仍在)。
- **`verify-release.js` 改读 `/version.json`**(**不再**抓 `app.js` 里的 `APP_VERSION`——压缩会破坏该字符串正则,导致假失败)。
- **发布核验读产物清单**:`latest.json` / `latest-windows.json` / 下载页三处一致;网页版时代的 `verify-release.js`(读 `/version.json`)已随网页版下线一并删除。
## 11. 分层与边界
+85
View File
@@ -0,0 +1,85 @@
# 工程流程优化建议(2026-12-02)
> 背景:v3.26.154 → v3.26.182 两天内连续排掉「标注覆盖丢图 / 图片源失效 / 空闲 CPU 15% / 平移残影」四类问题,
> 过程中走了不少弯路(连改 6 版靠猜、日志写丢、提交漏文件、并行构建抢锁)。本文把教训固化成流程。
> 技术细节见 `performance-lessons-2026-12-01.md`;UI 数值规则见 `ui-change-checklist.md`。本文只谈「怎么做事」。
## 0. 现状判断:规范不缺,缺的是执行顺序
- 已有:`engineering-rulebook.md`(技术规则)、`ui-change-checklist.md`(token 四道闸门)、`plugin-*.md`(插件契约)、多份 lessons 文档。
- 缺的是:**一次问题从「现象」到「验证」的标准路径**,以及「什么时候必须停下来取数、不许再改代码」。
## 1. 这两天真事暴露的 5 个流程缺陷
| # | 现象 | 根因 | 新约定 |
| --- | --- | --- | --- |
| 1 | 162→168 连改 6 版,163 反而更糟 | 全程靠假设,没有先取证 | 先取数,再改代码(见 §2) |
| 2 | 加了 plugin-img 日志却查不到 | 观测通道本身没验证(logPut 契约不匹配) | 改代码前先确认日志真能落盘 |
| 3 | 181 提交 message 写了、diff 里没有 | 提交前没对文件清单 | 提交后 `git show --stat` 自检 |
| 4 | 两个构建任务同时跑,互相抢 artifact 锁 | 没有「构建单实例」约束 | 构建前 `preflight`,任务名带版本 |
| 5 | 一天 bump 29 个版本 | 每次小改都出一版 | 一轮修复只出一个测试包(除非用户明确要逐版) |
## 2. 修 bug 的标准流程(7 步,缺一步就回到第 1 步)
1. **写现象卡**:可复现步骤、期望 vs 实际、影响面(哪个页面/哪个动作)。
2. **取证**(至少一项):诊断页数值 / `_boot.log` / 帧探针 `perf` / 最小对照实验(最小化、回收内存、关开关)。
3. **列假设**(≤3 条),每条写清「如果成立,应该看到什么数据」。
4. **一次只改一条**,改前记录基线(CPU、堆、进程、DOM、日志行)。
5. **验证**:同一条复现路径,数值回到基线或现象消失。
6. **留断言**:单测 / 契约测试 / 日志断言,必须能在这个 bug 上变红。
7. **写 3 行结论**进 lessons 文档并提交(现象、根因、修法)。
> 硬性停止条件:同一假设连改两次没效果 → 停下来重新取证,不要换着位置继续改。
## 3. 新功能探索:先切片,再扩展
1. **最小切片**:一个文件 + 一个 feature flag + 一条接线,先用真机确认「方向对」。
2. **先定退出条件**:什么算成功(指标/截图/日志),达不到就回滚,不带病上线。
3. **不变量自查**:会不会碰图片链路(字节/引用/缩略图)、存储(落盘/回滚)、插件契约(ctx.api)?碰了就按对应 lessons 文档过一遍。
4. **一次一个行为**:不把「重构 + 新功能 + 样式」塞进同一个提交。
## 4. UI 与 design token
沿用 `ui-change-checklist.md` 的四道闸门(`tokens:check` / `lint:tokens` / 插件契约 / 尺度棘轮 / 视觉回归)。
新增改 UI 前的「三问」:
1. 这个值属于哪一层 token?(L2 语义层优先,禁止裸值)
2. 有没有同类组件先例?(有就复用,不新造)
3. 这次改动的视觉基线是哪张截图?(改完要和它 diff)
新增 token 的门槛不变:消费者 ≥2、亮暗两套值、有弃用计划(见 `design-tokens.md` §5.1)。
## 5. 与构建机(work)协作
> **交付节奏(2026-12-02 用户明确)**:用户报问题后,先只做分析与方案,**不要立即改代码、不要构建任何版本(含 Windows 测试包)**;等用户明确说「开始/可以做」再动手。构建前必须得到确认。
> **分工红线(2026-12-02 用户明确)**:**所有代码修改只在 mac 侧执行**(mac 上负责实施的 agent)。
> win 构建机只做「拉取指定 SHA → 构建/打包 → 回报路径/字节/sha256/FileVersion」这类流程性动作,
> **不具备也不承担改代码的能力**;遇到需要改源码/测试/文档的情况,一律回报给 mac 侧处理,不许在 win 侧就地改。
> 文档/计划/单测同样算代码改动。
- **基线只认已推送的 SHA**;给不出明确基线时,由 mac 侧先 fetch 再指定。
- 产物回报四件套:本地路径 / 字节 / sha256 / `dist/version.json`。
- 取件只走 tailnet(局域网段、UGD 共享都验过不通);用户在本机时优先让他直接装本地产物。
- 构建前跑 `preflight`,确保没有并行构建。
## 6. 已落地的工具
| 命令 | 作用 |
| --- | --- |
| `npm run preflight` | 工作区 / 三处版本一致 / 构建单实例 / 插件两仓一致 / token 快照,一次体检 |
| `npm run diag:tail` | 取资料目录 `_boot.log` 的 `plugin-img / perf / thumb-fail / mem` 关键行 |
脚本在 `scripts/preflight.sh`、`scripts/diag-tail.sh`;`IWB_DATA_DIR` 可指定非默认资料目录。
## 7. 过程度量(用来判断流程是否真的在起作用)
每个问题记录三个数:**版本数、构建数、往返次数**(用户测 → 反馈 → 再改算一次往返)。
- 目标:版本 ≤2、构建 ≤3、往返 ≤3。
- 超过任一阈值 → 停下来写现象卡,而不是继续试。
## 8. 一句话总结
> 先取证再动手;一次只动一个变量;改完留断言;提交前对清单;发版前跑 preflight。
+7 -5
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.26.145",
"version": "3.26.240",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
@@ -10,10 +10,9 @@
"app:build": "tauri build",
"lint": "eslint src app.js",
"test": "node tests/relay-task-graph-fixture-test.js && node tests/plugin-style-node-test.js && node tests/inherit-text-test.js",
"test:unit": "node tests/result-img-doubleclick-test.js && node tests/gallery-audit-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/design-tokens-component-doc-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/album-task-graph-test.js && node tests/generation-endpoint-test.js && node tests/storage-config-shape-test.js && node tests/generation-default-model-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/gallery-sync-test.js && node tests/image-blob-store-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/clipboard-native-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js && node tests/plugin-scale-contract-test.js && node tesLine truncated
"test:unit": "node tests/result-img-doubleclick-test.js && node tests/gallery-audit-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/design-tokens-component-doc-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/album-task-graph-test.js && node tests/plugin-text-node-refs-test.js && node tests/generation-endpoint-test.js && node tests/storage-config-shape-test.js && node tests/generation-default-model-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/gallery-sync-test.js && node tests/image-blob-store-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/clipboard-native-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/image-writeback-test.js && node tests/image-ingest-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/uiLine truncated
"test:diagnostics": "node tests/runtime-diagnostics-hotpath-test.js",
"test:facts": "node tests/architecture-facts-guard-test.js && node tests/release-records-test.js",
"plugins:gc": "node scripts/plugins-publish.mjs --gc",
"check:plugins": "node scripts/check-plugins-sync.js",
"plugins:doctor": "node scripts/plugin-index-doctor.js",
"hooks:install": "bash scripts/install-git-hooks.sh",
@@ -30,7 +29,6 @@
"e2e:known-red": "node scripts/e2e-known-red-report.js",
"verify:ci": "npm run build && node --check app.js && node --check dist/app.js && node scripts/check-dist.js && node scripts/ctx-menu-audit.js && npm run tokens:check && npm run lint:tokens && npm run lint && npm run typecheck && npm run test:unit && npm test && npm run test:facts && npm run test:e2e:smoke",
"verify": "npm run verify:ci && npm run test:e2e",
"verify:release": "node scripts/verify-release.js",
"coverage:e2e": "node scripts/coverage-e2e.js",
"sync:facts": "node scripts/sync-facts.js",
"sync:facts:write": "node scripts/sync-facts.js --write",
@@ -38,7 +36,11 @@
"release:desktop": "bash scripts/release.sh",
"lint:tokens": "node scripts/token-lint.js",
"test:tokens": "node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js",
"test:e2e:smoke": "node scripts/e2e-smoke.js"
"test:e2e:smoke": "node scripts/e2e-smoke.js",
"preflight": "bash scripts/preflight.sh",
"diag:tail": "bash scripts/diag-tail.sh",
"perf:baseline": "node scripts/perf-baseline.js",
"release:verify": "node scripts/release-verify.js"
},
"devDependencies": {
"@playwright/test": "^1.64.1",
+1 -1
View File
@@ -1149,7 +1149,7 @@
global.IWBPluginHost.register({
id: 'album',
name: '相册',
version: '1.2.3',
version: '1.2.5',
apiVersion: 1,
capabilities: ['nodeTypes', 'images', 'files'],
settings: {
+3 -3
View File
@@ -1,7 +1,7 @@
{
"id": "album",
"name": "相册",
"version": "1.2.4",
"version": "1.2.5",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -14,7 +14,7 @@
"出图"
],
"files": {
"main.js": "79ac746f0065103a32b083e2d79f16fb09fcf9032709952ba256887db1bedb4a",
"styles.css": "40623c831620d0082dde956300461b29b9256aab98da86c7ab5e3495214f8d49"
"main.js": "38ec9d214ed204fc47d9ad8c82d8b3bf461c6cfbd09dbe18dc9d81061729e596",
"styles.css": "63f70828151481ee96fd102e3c18baecbf51999d8fd96044aabbefdd5c2d2225"
}
}
+2 -2
View File
@@ -29,12 +29,12 @@
竖图撑到 167px,和 capacityOf() 按方形算的容量是两套账(最后一行常被裁一半)。
aspect-ratio 让每一格高 = 宽,容量因此可精确预测,宫格也终于整齐。
padding:0 必须显式写:<button> 的 UA 默认内边距会把图顶出边框。 */
.iwb-album-cell { position: relative; aspect-ratio: 1 / 1; padding: 0; border-radius: var(--iwb-radius-chip); overflow: hidden; background: color-mix(in srgb, var(--iwb-border) 55%, transparent); border: 1px solid var(--iwb-border); cursor: grab; transition: transform var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out), box-shadow var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out); }
.iwb-album-cell { position: relative; aspect-ratio: 1 / 1; padding: 0; border-radius: var(--iwb-radius-chip); overflow: hidden; background: color-mix(in srgb, var(--iwb-border) 55%, transparent); border: 1px solid var(--iwb-border); cursor: grab; transition: border-color var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out); }
/* 1.1.4(用户:1.06 太不明显):放大到 1.08 + 更深的投影 + 2px 品牌描边。
网格内**不做位移**(translateY 会让相邻格的 hover 判定抖动);描边用 outline 而不是加粗 border,
避免图片内容被 1px 的 border 变化挤动。z-index 走宿主层级 token(插件禁止裸值),
且被 .iwb-album-grid 的 overflow:hidden 限制在节点内。 */
.iwb-album-cell:hover { transform: scale(1.08); outline: 2px solid var(--iwb-hover-border, var(--iwb-brand)); outline-offset: -2px; box-shadow: 0 10px 26px rgba(0, 0, 0, .42), 0 2px 6px rgba(0, 0, 0, .28); z-index: var(--iwb-z-ctx, 90); }
.iwb-album-cell:hover { outline: 2px solid var(--iwb-hover-border, var(--iwb-brand)); outline-offset: -2px; border-color: var(--iwb-hover-border, var(--iwb-brand)); z-index: var(--iwb-z-ctx, 90); }
@media (prefers-reduced-motion: reduce) { .iwb-album-cell { transition: none; } .iwb-album-cell:hover { transform: none; } }
.iwb-album-cell img { width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; }
/* v1.2.0:来源徽标 + 文件夹模式说明/路径 */
+30 -4
View File
@@ -76,6 +76,28 @@
svg.appendChild(p)
return p
}
// 2026-12-03:卡片下载图标与输出面板同款(同一组 path / 线宽 / 14px)。
// 之前是文本 '↓',字形随字体渲染,和宿主按钮对不齐。
function dlGlyph () {
var svg = document.createElementNS(SVG_NS, 'svg')
svg.setAttribute('viewBox', '0 0 24 24')
svg.setAttribute('width', '14')
svg.setAttribute('height', '14')
svg.setAttribute('fill', 'none')
svg.setAttribute('stroke', 'currentColor')
svg.setAttribute('stroke-width', '2')
svg.setAttribute('stroke-linecap', 'round')
svg.setAttribute('stroke-linejoin', 'round')
svg.setAttribute('aria-hidden', 'true')
svgPath(svg, 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4')
var pl = document.createElementNS(SVG_NS, 'polyline')
pl.setAttribute('points', '7 10 12 15 17 10')
svg.appendChild(pl)
var ln = document.createElementNS(SVG_NS, 'line')
ln.setAttribute('x1', '12'); ln.setAttribute('x2', '12'); ln.setAttribute('y1', '15'); ln.setAttribute('y2', '3')
svg.appendChild(ln)
return svg
}
function sel (options, value) {
var s = el('select', { class: 'iwb-input iwb-select-compact' })
for (var i = 0; i < options.length; i++) {
@@ -578,12 +600,16 @@
b.addEventListener('click', function (e) { e.stopPropagation(); fn() })
return b
}
// v1.7.2:图片卡片上只留「下载」;插入仍可从顶部工具栏或右键菜单进入。
acts.appendChild(act('下载', '下载到本地', function () { doDownload([it.name]) }))
// 2026-12-02(用户裁定):卡片上的「下载」胶囊改成右下角圆形图标 —— 矮图不再被横条压住中心;
// 只留图标不加文案(title/aria-label 兜底)。插入仍走顶部工具栏与右键菜单。
var dlBtn = el('button', { class: 'iwb-gal-dl', title: '下载到本地', 'aria-label': '下载' }, dlGlyph())
dlBtn.addEventListener('click', function (e) { e.stopPropagation(); doDownload([it.name]) })
acts.appendChild(dlBtn)
// 不要再改 class:定位样式挂在 .iwb-history-actions 上,改名会让按钮掉出卡片
box.appendChild(acts)
// 角标/勾选最后挂:不要 z-index(插件层级闸门禁止裸值),靠 DOM 顺序盖在图片上
if (origBadge) box.appendChild(origBadge)
if (on) box.appendChild(el('span', { class: 'iwb-history-check', title: '已选中' }))
// 2026-12-02:选中只留外框,不再挂角标图标(用户裁定)
box.__iwbItem = it
box.__iwbBoot = boot
nodeCache[it.name] = box
@@ -849,7 +875,7 @@
global.IWBPluginHost.register({
id: 'gallery',
name: '图库',
version: '1.9.6',
version: '1.9.12',
apiVersion: 1,
capabilities: ['panels', 'gallery'],
data: { schemaVersion: 1, maxBytes: 65536 },
+3 -3
View File
@@ -1,7 +1,7 @@
{
"id": "gallery",
"name": "图库",
"version": "1.9.8",
"version": "1.9.12",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -13,7 +13,7 @@
"图库"
],
"files": {
"main.js": "8586409417599dec4b0f229e88eaf937f991f1942db49df97ce9a27e16a35d9f",
"styles.css": "c7db0f9d78b98c1b5bb9782c45dfc2274673c1c7d34fdf676aae41680866eb3d"
"main.js": "017277118b96545cd7cae386b37dca9b23a44593f53e0e858aedf901b994a153",
"styles.css": "d0479dad661370dfa23d85e4470c5885cbe38fb3b4de9097ad084c952e16d516"
}
}
+18 -12
View File
@@ -69,16 +69,13 @@
.iwb-history-embedded .iwb-history-item img {
width: 100%; height: auto; display: block; object-fit: contain; margin: 0 auto;
border-radius: 6px; border: 1px solid var(--iwb-border); background: var(--iwb-layer2); cursor: pointer;
transition: transform var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out),
border-color var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out),
box-shadow var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out);
/* 2026-12-01:卡片不再做 hover 放大/投影;只保留描边反馈,减少悬停时的合成/raster 成本。 */
transition: border-color var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out);
}
/* v1.7.3:卡片悬停上浮 + 阴影 + 品牌描边(与输出节点共用宿主 L2 token)。
用 item:hover 而不是 img:hover:指针移到下载浮层按钮上时卡片仍保持浮起,不抖。 */
.iwb-history-embedded .iwb-history-item:hover img {
transform: translateY(var(--iwb-hover-lift, -2px)) scale(var(--iwb-hover-scale, 1.02));
border-color: var(--iwb-hover-border, var(--iwb-brand));
box-shadow: var(--iwb-hover-shadow, 0 5px 16px rgba(0, 0, 0, .22));
}
/* v1.9.4:卡片按宽高比占位后,占位层要铺满卡片 —— 否则缩略图出现时仍会有一次高度跳变(滚动时表现为闪动) */
.iwb-history-embedded .iwb-history-item .iwb-history-missing { position: absolute; inset: 0; min-height: 0; }
@@ -87,19 +84,28 @@
min-height: 84px; padding: 8px; border-radius: 6px; border: 1px dashed var(--iwb-border);
font-size: 11px; color: var(--iwb-text2); background: var(--iwb-layer2); word-break: break-all;
}
/* v1.7.3:把「下载」做成卡片底部渐变的下载浮层(与输出节点同一套语义)。
条本身 pointer-events:none,只有悬停后按钮可点,避免挡住卡片点击/双击预览。 */
/* 2026-12-02(用户裁定):卡片下载从「底部横条」改为「右下角圆形图标」。
—— 矮图(宽幅)不再被横条压住中心,除按钮外整张图都能点。
尺寸/圆角/间距抽成 --iwb-dl-* 变量,宿主 style.css 用同名变量(同一套 token 口径,后续可提升到主题层)。 */
.iwb-history-actions {
position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px;
padding: var(--iwb-space-16) var(--iwb-space-4) var(--iwb-space-4); border-radius: 0 0 6px 6px;
background-image: linear-gradient(to top, rgba(0, 0, 0, .62), transparent);
position: absolute; right: var(--iwb-dl-inset, 8px); bottom: var(--iwb-dl-inset, 8px);
display: flex; gap: var(--iwb-dl-gap, 4px);
opacity: 0; transition: opacity var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out);
pointer-events: none;
}
.iwb-history-embedded .iwb-history-item:hover .iwb-history-actions,
.iwb-history-embedded .iwb-history-item:focus-within .iwb-history-actions { opacity: 1; pointer-events: auto; }
.iwb-history-actions .iwb-btn-sm { padding: 2px 8px; font-size: 11px; border: none; background: var(--iwb-panel); color: var(--iwb-text); }
.iwb-history-actions .iwb-btn-sm:hover { background: var(--iwb-panel); color: var(--iwb-brand); }
/* 2026-12-03:与输出面板的圆钮完全对齐(26px / 无阴影 / SVG 14px / hover 只变底色)。 */
.iwb-gal-dl {
width: var(--iwb-dl-size, 26px); height: var(--iwb-dl-size, 26px);
border-radius: var(--iwb-dl-radius, 999px);
border: 1px solid var(--iwb-border2);
background: var(--iwb-panel); color: var(--iwb-text);
display: grid; place-items: center; padding: 0; cursor: pointer;
font-size: var(--iwb-font-xs); line-height: 1;
}
.iwb-gal-dl svg { width: 14px; height: 14px; }
.iwb-gal-dl:hover { background: var(--iwb-hover); color: var(--iwb-text); }
@media (prefers-reduced-motion: reduce) {
.iwb-history-embedded .iwb-history-item img { transition: none; }
.iwb-history-embedded .iwb-history-item:hover img { transform: none; }
+35 -24
View File
@@ -4,23 +4,23 @@
"dir": "album",
"main": "main.js",
"style": "styles.css",
"version": "1.2.4",
"version": "1.2.5",
"files": {
"main.js": "79ac746f0065103a32b083e2d79f16fb09fcf9032709952ba256887db1bedb4a",
"styles.css": "40623c831620d0082dde956300461b29b9256aab98da86c7ab5e3495214f8d49"
"main.js": "38ec9d214ed204fc47d9ad8c82d8b3bf461c6cfbd09dbe18dc9d81061729e596",
"styles.css": "63f70828151481ee96fd102e3c18baecbf51999d8fd96044aabbefdd5c2d2225"
}
},
{
"id": "batch-export",
"file": "plugin-batch-export.e0152de8d928.js",
"file": "plugin-batch-export.496febf1312c.js",
"version": "1.2.3",
"integrity": "sha256-4BUt6NkoAWOoCk1omq3EcE3CZdexZyEqs9qeYqtnwb0="
"integrity": "sha256-SW/r8TEs+kQbYnZp0jw8b2lF0wDgxZhvwC0c/DwoOiQ="
},
{
"id": "blank-canvas",
"file": "plugin-blank-canvas.67763893fa99.js",
"version": "1.0.0",
"integrity": "sha256-Z3Y4k/qZyP4di89kBCb1u8V2q9NbzchMkQt7CPeZZPk="
"file": "plugin-blank-canvas.80bcccc04527.js",
"version": "1.0.1",
"integrity": "sha256-gLzMwEUn42aQISBsetmCJ2GKdNHPoDmrlZB6WkOMam8="
},
{
"id": "browser",
@@ -33,10 +33,10 @@
"dir": "gallery",
"main": "main.js",
"style": "styles.css",
"version": "1.9.8",
"version": "1.9.12",
"files": {
"main.js": "8586409417599dec4b0f229e88eaf937f991f1942db49df97ce9a27e16a35d9f",
"styles.css": "c7db0f9d78b98c1b5bb9782c45dfc2274673c1c7d34fdf676aae41680866eb3d"
"main.js": "017277118b96545cd7cae386b37dca9b23a44593f53e0e858aedf901b994a153",
"styles.css": "d0479dad661370dfa23d85e4470c5885cbe38fb3b4de9097ad084c952e16d516"
}
},
{
@@ -55,23 +55,23 @@
"dir": "promptlib",
"main": "main.js",
"style": "styles.css",
"version": "1.14.10",
"version": "1.14.14",
"files": {
"main.js": "a05ce22ad8ab2e079e313dd31d8fe34f2e2e07e017bfb782afcd08047e0b485b",
"styles.css": "86f73b4d1c7b827f97ec1135c9130c7da6898537b2ed2ab815e282618232f56b"
"main.js": "27f5c4dd5e90ee6ae0bf7ad8ecf36bae62c2e436c2882c7c41f6272a32f7bafd",
"styles.css": "a086b172cc8261b9f346e612b5f76cc085d5a1e486657d0c656cb87c675f238c"
}
},
{
"id": "image-annotate",
"file": "plugin-image-annotate.fda7cfeefb9b.js",
"file": "plugin-image-annotate.ce58bab92abd.js",
"version": "1.20.9",
"integrity": "sha256-/afP7vub8Psm2dGzos2M4fcE/GxmS2I9Jvx523xCZr0="
"integrity": "sha256-zli6uSq9AazBsk5fqfkoWrSzA0Ki/NaESekszQA+IRA="
},
{
"id": "image-vectorize",
"file": "plugin-image-vectorize.2d9e6c796bf6.js",
"version": "0.6.2",
"integrity": "sha256-LZ5seWv25KomL7q8Wa5VGALyj16HWk805YbLyUEDgPs="
"file": "plugin-image-vectorize.a47baa43948e.js",
"version": "0.6.3",
"integrity": "sha256-pHuqQ5SODCQ4EoAXRgKzsHghTLBvKu9pibGz6jNZQrk="
},
{
"id": "sticky",
@@ -87,14 +87,25 @@
},
{
"id": "white-bg-800",
"file": "plugin-white-bg-800.988d72d6f09d.js",
"version": "1.2.2",
"integrity": "sha256-mI1y1vCd5IF8UTGdOzggB4OnCpQrQkmCclL6y9w86IE="
"file": "plugin-white-bg-800.a27695876233.js",
"version": "1.2.3",
"integrity": "sha256-onaVh2IzZW8Gluc4ZhDbMEh5KO+yaRWB7LsIhOaoBEY="
},
{
"id": "xianyi-cutout",
"file": "plugin-xianyi-cutout.84907706bb31.js",
"file": "plugin-xianyi-cutout.f7898f6e0fe9.js",
"version": "1.0.4",
"integrity": "sha256-hJB3Brsx1krtgrhXhEg7kTNTAaitQeDkSBOiud/he0c="
"integrity": "sha256-94mPbg/p+Pikvfkc59u+U4wPJ+45jc46JTlNptVZIB0="
},
{
"id": "taskqueue",
"dir": "taskqueue",
"main": "main.js",
"style": "styles.css",
"version": "1.0.3",
"files": {
"main.js": "5f08181338062c9327f22e742be7e1e161a32d2e1bc41ae775a73e0e15b9f3a9",
"styles.css": "4de612a1d25cb74a76f1888fdde32c0f617cc6ab5cc1a0f0bd6ff1adccc757e4"
}
}
]
+11
View File
@@ -140,5 +140,16 @@
"批量",
"出图"
]
},
"taskqueue": {
"name": "任务队列",
"desc": "全局生图记录:链接/状态/画布节点;下载落地图库、重试、复制链接、定位节点(数据由宿主保存)",
"author": "official",
"icon": "⏳",
"color": "#eef6f6",
"tags": [
"工具",
"记录"
]
}
}
+125 -38
View File
@@ -85,7 +85,7 @@
// 看不到 mount() 内部的函数(曾导致 "Can't find variable: fillTpl")。
function detectVars (text) {
var out = [], seen = {}
var re = /\{([^{}\n]{1,60})\}/g, m
var re = /\{([^{}]*)\}/g, m
var str = String(text || '')
while ((m = re.exec(str))) {
var k = String(m[1] || '').trim()
@@ -96,7 +96,7 @@
return out
}
function fillTpl (tpl, vals) {
return String(tpl || '').replace(/\{([^{}\n]{1,60})\}/g, function (all, k) {
return String(tpl || '').replace(/\{([^{}]*)\}/g, function (all, k) {
var key = String(k || '').trim()
var v = (vals && Object.prototype.hasOwnProperty.call(vals, key)) ? String(vals[key] == null ? '' : vals[key]) : ''
return v ? v : all
@@ -125,27 +125,36 @@
ta.style.overflowY = h > max + 1 ? 'auto' : 'hidden'
}
// `{…}` 里能放多少字:v1.13.0 起占位符里放的是「内容」原文(用户裁定),所以这条上限
// 按「一句内容」定,不再按短变量名定。**必须与下面所有正则里的 {1,60} 保持一致**:
// 识别用 60、替换用更小的值,就会出现「识别到了但替换不到」⇒ 变量那段被 outputText 整段删掉。
var KEY_MAX = 60
// 变量「内容」框的最大高度(约 10 行后框内滚动)。下限由 rows=3 + CSS min-height 保证。
// v1.13.0:用户要求「默认最高行数多加 4 行」⇒ 6 行(132px)→ 10 行(212px,行高 1.65×12px≈19.8)。
var VDEF_MAX = 212
// 内容 → 正文里的占位符键:`{…}` 只能单行、不超过 KEY_MAX 字、不含花括号。
// v1.15.0(2026-12-03,用户裁定):正文 `{}` 里放「内容」原文,**不限长度、允许多行**;只禁花括号。
// 下面 6 处正则必须保持一致(都以「最近的一对花括号」为界),否则会「识别到但替换不到」。
// 变量「内容」框的最大高度(超出后框内滚动;面板本身可拖大)。
var VDEF_MAX = 320
// 节点输入框:默认最多 20 行(行高 1.5×12px=18px),超过后折叠,可「展开」看全;永不出滚动条。
var NIN_LINES = 20
var NIN_LINE_H = 18
var NIN_MAX = NIN_LINES * NIN_LINE_H + 8
// 空值只显示灰字提示时的上限:避免一条几千字的默认内容把刚放下的节点撑很高。
var NIN_PH_MAX = 120
// 内容 → 正文里的占位符键:任意长、可多行,但不能含花括号(边界会分不清)。
// 不满足就返回空串 ⇒ 调用方保留原键(正文不跟随),绝不硬塞进 `{}` —— 塞进去会让变量
// 直接识别不到,下次 sync 就把它从变量列表里清掉,用户刚写的内容当场丢失。
function contentKeyOf (s) {
// 2026-12-03(用户裁定):正文 `{}` 里就是内容原文,允许长文本与多行;只禁花括号(否则边界分不清)。
var t = String(s || '').trim()
if (!t || t.length > KEY_MAX) return ''
if (/[{}\n\r]/.test(t)) return ''
if (!t) return ''
if (/[{}]/.test(t)) return ''
return t
}
// 提交给下游/生图的文本:填完变量后,把未填的 {占位} 从输出里剔除(只在编辑器里展示)。
function outputText (tpl, vals) {
var s = fillTpl(tpl, vals)
return s.replace(/[{][^{}]{1,60}[}]/g, ' ').replace(/[ ]{2,}/g, ' ').trim()
// 2026-12-03:先剔除「没有值」的占位,再填值 —— 填完不再扫花括号,避免把值里的 {} 一起删掉。
var s = String(tpl || '').replace(/\{([^{}]*)\}/g, function (all, k) {
var key = String(k || '').trim()
var has = !!(vals && Object.prototype.hasOwnProperty.call(vals, key) && String(vals[key] == null ? '' : vals[key]) !== '')
return has ? all : ' '
})
return fillTpl(s, vals).replace(/[ ]{2,}/g, ' ').trim()
}
function varsOf (p) {
@@ -1143,9 +1152,17 @@
function up () { global.removeEventListener('pointermove', mv); global.removeEventListener('pointerup', up); saveDlg(key, live) }
global.addEventListener('pointermove', mv); global.addEventListener('pointerup', up)
})
mask.addEventListener('pointerdown', function (e) { if (e.target === mask) close() })
// 2026-12-03:关闭前给调用方一次拦截机会(编辑词例用它做「未保存确认」);
// maskClose:false 时点空白不关闭(防止误点丢编辑)。
function requestClose () {
if (typeof opts.confirmClose === 'function') {
try { opts.confirmClose(close); return } catch (e) { /* 回退到直接关闭 */ }
}
close()
}
mask.addEventListener('pointerdown', function (e) { if (opts.maskClose !== false && e.target === mask) requestClose() })
function onKey (e) {
if (e.key === 'Escape') { e.stopPropagation(); close() } else if ((e.metaKey || e.ctrlKey) && e.key === 'Enter' && opts.onSaveKey) { e.preventDefault(); opts.onSaveKey() }
if (e.key === 'Escape') { e.stopPropagation(); requestClose() } else if ((e.metaKey || e.ctrlKey) && e.key === 'Enter' && opts.onSaveKey) { e.preventDefault(); opts.onSaveKey() }
}
function close () {
saveDlg(key, live)
@@ -1164,7 +1181,7 @@
// label = 变量名称:只影响节点左栏显示(最多 4 字,超出省略),空则显示 key
// def = 内容:正文里 `{}` 里的那段字,也是节点输入框留空时真正传给下游的值
// desc = 说明:可选,填了就优先于内容作为节点输入框的灰字提示
// 约束:`{}` 里不能换行、不能超过 KEY_MAX(60) 字。不满足时正文保留原键并在摘要里提示,
// 约束:`{}` 里不能含花括号。不满足时正文保留原键并在摘要里提示,
// 绝不硬塞 —— 塞进去变量就识别不到了,下次 sync 会把它从列表里清掉,内容当场丢失。
// 收起态只留一行「名称 + 内容字数」,展开出现名称/内容/说明;允许多个同时展开。
function makeVarsEditor (text, initial, onTextChange, opts) {
@@ -1202,8 +1219,9 @@
// 摘要:内容字数 + 说明 + 「正文未同步」告警(内容塞不进 `{}` 时才会出现)。
function summaryOf (v) {
var body = bodyOf(v)
var base = (body ? '内容 ' + body.length + ' 字' : '未填内容') + (v.desc ? ' · 有说明' : '')
if (v.def && !contentKeyOf(v.def)) base += ' · 正文未同步(需单行 ≤' + KEY_MAX + ' 字)'
var nl = body ? body.split('\n').length : 0
var base = (body ? '内容 ' + body.length + ' 字' + (nl > 1 ? ' · ' + nl + ' 行' : '') : '未填内容') + (v.desc ? ' · 有说明' : '')
if (v.def && !contentKeyOf(v.def)) base += ' · 内容里不能有 { }(无法同步到正文)'
return base
}
function field (labelText, ctrl) {
@@ -1247,7 +1265,7 @@
// v1.12.3:内容固定从 3 行起步(rows=3),可继续长到 VDEF_MAX 后框内滚动。
// 上一版 rows=1 且「append 之前」就 autoGrowArea ⇒ 元素不在文档里时 scrollHeight 读不到,
// 高度被 CSS min-height 兜成一行,长文案在框里被裁切(用户截图里就是这个现象)。
var area = el('textarea', { class: 'iwb-input iwb-plp-vdef', rows: '3', placeholder: '内容(单行 ≤' + KEY_MAX + ' 字)' })
var area = el('textarea', { class: 'iwb-input iwb-plp-vdef', rows: '3', placeholder: '内容(可多行,不能含 { })' })
area.value = bodyOf(v)
area.addEventListener('input', function () {
v.def = area.value
@@ -1744,7 +1762,7 @@
var txt = el('div', { class: 'iwb-plp-dtext' })
;(function paintText () {
var str = String(p.text || '')
var re = /[{]([^{}]{1,60})[}]/g, last = 0, m
var re = /[{]([^{}]*)[}]/g, last = 0, m
while ((m = re.exec(str))) {
if (m.index > last) txt.appendChild(document.createTextNode(str.slice(last, m.index)))
txt.appendChild(el('span', { class: 'iwb-plp-dvar', text: m[0] }))
@@ -1809,11 +1827,17 @@
var cancelBtn = el('button', { class: 'iwb-btn iwb-btn-sm', text: '取消' })
var saveBtn = el('button', { class: 'iwb-btn iwb-btn-primary iwb-btn-sm', text: isNew ? '创建' : '保存' })
var dirty = false
function closeWithGuard (done) {
if (!dirty) { done(); return }
ask('有未保存的修改,确定放弃?', { title: '放弃修改', okText: '放弃' }).then(function (ok) { if (ok) done() })
}
openDialog({
key: 'edit',
title: isNew ? '新建词例' : '编辑词例',
width: 880, height: 640,
actions: [cancelBtn, saveBtn],
maskClose: false,
confirmClose: function (done) { closeWithGuard(done) },
onSaveKey: function () { doSave() },
build: function (bodyEl, footEl, close) {
var left = el('div', { class: 'iwb-plp-eleft' })
@@ -1898,7 +1922,7 @@
function paintHl () {
var v = textIn.value || ''
hl.textContent = ''
var re = /[{]([^{}]{1,60})[}]/g, last = 0, m
var re = /[{]([^{}]*)[}]/g, last = 0, m
while ((m = re.exec(v))) {
if (m.index > last) hl.appendChild(document.createTextNode(v.slice(last, m.index)))
hl.appendChild(el('span', { class: 'iwb-plp-hlvar', text: m[0] }))
@@ -1938,7 +1962,7 @@
var e = Math.min(Math.max(lastSel.e == null ? s : lastSel.e, s), v.length)
var picked = s !== e ? String(v.slice(s, e)).trim() : ''
// v1.13.0(用户裁定):`{}` 里放的就是内容原文 ⇒ 选中的原文直接当占位符。
// 塞不进 `{}` 时才退到「变量N」:没选中、含换行、或超过 KEY_MAX 字。
// 塞不进 `{}` 时才退到「变量N」:没选中,或选中的文字里带花括号。
// (1.12.0 曾把长句一律改成变量N + 原文进内容,用户否掉了:正文该跟着内容走。)
var embed = contentKeyOf(picked)
var used = {}
@@ -2017,7 +2041,9 @@
}).catch(function () { saveBtn.disabled = false; notify('保存失败', 'err') })
}
saveBtn.addEventListener('click', doSave)
cancelBtn.addEventListener('click', function () { close(); if (!isNew && p) { try { openDetailModal(p) } catch (e) { /* ignore */ } } })
cancelBtn.addEventListener('click', function () {
closeWithGuard(function () { close(); if (!isNew && p) { try { openDetailModal(p) } catch (e) { /* ignore */ } } })
})
dupBtn.addEventListener('click', function () {
var c = collect()
close()
@@ -2244,7 +2270,7 @@
global.IWBPluginHost.register({
id: 'promptlib',
name: '提示词库',
version: '1.14.9',
version: '1.14.14',
apiVersion: 1,
capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite', 'nodeActions', 'commands'],
data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 },
@@ -2361,7 +2387,7 @@
if (st.title.textContent !== name) st.title.textContent = name
var tpl = String(d.tpl || '')
var defs = Array.isArray(d.vdefs) && d.vdefs.length ? d.vdefs : (function () {
var out = [], seen = {}, re = /\{([^{}\n]{1,60})\}/g, m
var out = [], seen = {}, re = /\{([^{}]*)\}/g, m
while ((m = re.exec(tpl))) {
var k = String(m[1] || '').trim()
if (!k || seen[k]) continue
@@ -2386,16 +2412,73 @@
defs.forEach(function (v) {
var row = el('div', { class: 'iwb-plp-nrow' })
var nk = el('span', { class: 'iwb-plp-nk', text: v.label || v.key })
nk.title = v.label || v.key
nk.title = (v.label || v.key) + '(双击回填原内容)'
row.appendChild(nk)
// v1.12.0:单行 input → 自适应 textarea(rows=1 起,最多约 5 行后框内滚动)。
// 以前长文案挤在 24px 单行框里,只能左右拖动看末尾。
// v1.12.3:值默认为空(用户裁定);不填说明时用「内容」当灰字提示,与说明同一样式。
// v1.12.0:单行 input → 自适应 textarea。
// v1.15.0:节点上最多 20 行(NIN_MAX),超出折叠成「展开」,永不出滚动条;节点高度跟着内容走。
var inp = el('textarea', { class: 'iwb-input iwb-plp-nin', rows: '1', placeholder: v.desc || v.def || ('填写 ' + (v.label || v.key)) })
inp.value = String((d.vars && d.vars[v.key]) || '')
inp.addEventListener('input', function () { autoGrowArea(inp, 96); scheduleUpdate(st, d) })
// 失焦后重测:清空输入框时焦点在框内,placeholder 高度没量到,blur 时补一次
inp.addEventListener('blur', function () { autoGrowArea(inp, 96) })
var more = el('button', { class: 'iwb-plp-nmore', type: 'button' })
more.style.display = 'none'
if (!st.expanded) st.expanded = {}
if (!st.refreshH) st.refreshH = {}
var cell = el('div', { class: 'iwb-plp-ncell' }, inp, more)
var refreshH = function () {
var has = String(inp.value || '') !== ''
// 空值的高度靠灰字提示撑:浏览器不把 placeholder 计入 scrollHeight,
// 未聚焦时临时塞进 value 量一次再恢复(沿用旧 autoGrowArea 的做法,不打断输入法)。
var restore = ''
if (!has && (typeof document === 'undefined' || document.activeElement !== inp)) {
var ph = ''
try { ph = String(inp.getAttribute('placeholder') || '') } catch (e0) { ph = '' }
if (ph) { restore = ph; inp.value = ph }
}
inp.style.height = 'auto'
var full = Number(inp.scrollHeight) || 0
if (restore) inp.value = ''
var expanded = !!st.expanded[v.key]
var max = has ? NIN_MAX : NIN_PH_MAX
inp.style.height = Math.min(full, expanded ? full : max) + 'px'
inp.style.overflowY = 'hidden'
if (has && full > NIN_MAX) {
more.style.display = ''
more.textContent = expanded ? '收起' : ('展开(共 ' + String(inp.value || '').length + ' 字)')
} else more.style.display = 'none'
}
// 宽度变化(拖对话框 / 改节点宽度 / 窗口缩放)时重测;只认宽度,避免高度变化自己触发自己。
st.__lastW = st.__lastW || {}
if (typeof ResizeObserver !== 'undefined') {
try {
var ro = new ResizeObserver(function () {
var w = inp.clientWidth
if (w === st.__lastW[v.key]) return
st.__lastW[v.key] = w
refreshH()
})
ro.observe(inp)
} catch (eRO) { /* ignore */ }
}
st.refreshH[v.key] = refreshH
more.addEventListener('pointerdown', function (e) { e.stopPropagation() })
more.addEventListener('click', function (e) {
e.preventDefault(); e.stopPropagation()
st.expanded[v.key] = !st.expanded[v.key]
refreshH()
})
// 双击左侧标题:把这条变量的「内容」回填进输入框(仅当输入框为空),方便接着改长文。
nk.addEventListener('dblclick', function (e) {
e.preventDefault(); e.stopPropagation()
if (String(inp.value || '') !== '') return
var def = st.defOf(v.key)
if (!def) { notify('这条变量没有预设内容'); return }
inp.value = def
st.expanded[v.key] = true
refreshH()
try { inp.focus(); inp.setSelectionRange(inp.value.length, inp.value.length) } catch (err) { /* ignore */ }
scheduleUpdate(st, d)
})
inp.addEventListener('input', function () { refreshH(); scheduleUpdate(st, d) })
inp.addEventListener('blur', function () { refreshH() })
// 宿主的可交互控件白名单是 input/select/button…(src/ui-node-card.js:281,不含 textarea)⇒
// 不拦的话按住文本框拖选文字会把整个节点拖走。
inp.addEventListener('pointerdown', function (e) {
@@ -2408,11 +2491,14 @@
if (inp.scrollHeight > inp.clientHeight + 1) e.stopPropagation()
}, { passive: true })
st.inputs[v.key] = inp
row.appendChild(inp)
row.appendChild(cell)
st.vars.appendChild(row)
// 必须 append 之后再量:脱离文档的元素 scrollHeight 不可靠(会量不到 placeholder 的折行)
autoGrowArea(inp, 96)
setTimeout(function () { autoGrowArea(inp, 96) }, 0)
refreshH()
setTimeout(refreshH, 0)
// 字体/布局晚一拍才定下来:再补两次,避免「打开时偏矮、点一下才对」
try { (typeof requestAnimationFrame === 'function' ? requestAnimationFrame : function (f) { setTimeout(f, 16) })(refreshH) } catch (e1) { /* ignore */ }
setTimeout(refreshH, 120)
})
if (!defs.length) st.vars.appendChild(el('div', { class: 'iwb-plp-nempty', text: '正文里没有 {变量}' }))
try {
@@ -2428,7 +2514,7 @@
var inp = st.inputs[v.key]
if (!inp) return
var ph = v.desc || v.def || ('填写 ' + (v.label || v.key))
if (inp.placeholder !== ph) { inp.placeholder = ph; autoGrowArea(inp, 96) }
if (inp.placeholder !== ph) { inp.placeholder = ph; try { st.refreshH && st.refreshH[v.key] && st.refreshH[v.key]() } catch (e2) { /* ignore */ } }
})
// 缩略图:封面可能是 dataURL,也可能是插件文件引用
@@ -2471,7 +2557,8 @@
}
if (ctx.nodes && typeof ctx.nodes.register === 'function') {
try {
ctx.nodes.register({ id: 'ptpl', title: '提示词模板', defaults: { outKind: 'prompt' }, ports: { in: false, out: true }, height: 360, render: renderTplNode })
// 2026-12-03(用户):补输入端口 —— 参考图节点可以接到模板上(宿主的 nodeRefsOf 会把入边 ref 透传给下游生图)。
ctx.nodes.register({ id: 'ptpl', title: '提示词模板', defaults: { outKind: 'prompt' }, ports: { in: true, out: true }, height: 360, render: renderTplNode })
} catch (e) {
try { ctx.storage && ctx.storage.set('lastError', 'node:' + String((e && e.message) || e)) } catch (e2) { /* ignore */ }
}
+3 -3
View File
@@ -1,7 +1,7 @@
{
"id": "promptlib",
"name": "提示词库",
"version": "1.14.10",
"version": "1.14.14",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -13,7 +13,7 @@
"提示词"
],
"files": {
"main.js": "a05ce22ad8ab2e079e313dd31d8fe34f2e2e07e017bfb782afcd08047e0b485b",
"styles.css": "86f73b4d1c7b827f97ec1135c9130c7da6898537b2ed2ab815e282618232f56b"
"main.js": "27f5c4dd5e90ee6ae0bf7ad8ecf36bae62c2e436c2882c7c41f6272a32f7bafd",
"styles.css": "a086b172cc8261b9f346e612b5f76cc085d5a1e486657d0c656cb87c675f238c"
}
}
+10 -4
View File
@@ -149,7 +149,7 @@
/* v1.12.1:标签列定宽(此前是 flex:0 0 auto,宽度跟着名称长短变 ⇒ 每个变量输入框左边缘错位)。
v1.13.0:用户要求按 4 字定宽 ⇒ 56px(12px 字号 × 4 + 8px 余量)。超过 4 字的名称省略号截断,完整名称在 title 里。 */
.iwb-plp-nrow{display:flex;align-items:flex-start;gap:6px;min-height:26px}
.iwb-plp-nk{flex:0 0 56px;width:56px;max-width:56px;padding-top:4px;color:var(--iwb-text2,#5b6472);font-size: 12px;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iwb-plp-nk{flex:0 0 56px;width:56px;max-width:56px;padding-top:4px;color:var(--iwb-text2,#5b6472);font-size: 12px;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none}
.iwb-plp-nin{flex:1 1 auto;min-width:0;height:auto;min-height:24px;padding:2px 8px;line-height:1.5;font-size: 12px;resize:none;overflow-y:hidden}
/* v1.14.2:参考图开关移到头部(与样式节点一致)——做成浅色药丸,不再是底部分隔行 */
.iwb-plp-nref{display:inline-flex;align-items:center;gap:6px;margin-top:6px;padding:2px 8px;border-radius:6px;background:var(--iwb-layer,#f0f1f4);color:var(--iwb-text2,#4d5668);font-size: 12px;cursor:pointer;align-self:flex-start}
@@ -379,7 +379,7 @@ box-shadow: 0 24px 60px rgba(0,0,0,.32);
/* v1.6.8:卡片悬停放大 + 按下/拖拽反馈 */
.iwb-plp-card{transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease, opacity .14s ease}
.iwb-plp-card:hover{transform:scale(1.03);box-shadow:0 8px 22px rgba(0,0,0,.14);z-index:2}
.iwb-plp-card:hover{border-color:var(--iwb-border2,#b9bfca)}
.iwb-plp-card.is-pressed{border-color:var(--iwb-plp-accent,#7c4dff);box-shadow:0 0 0 2px color-mix(in srgb,var(--iwb-plp-accent,#7c4dff) 22%,transparent)}
.iwb-plp-card.is-dragging{opacity:.55;transform:scale(.98)}
@@ -391,9 +391,9 @@ box-shadow: 0 24px 60px rgba(0,0,0,.32);
.iwb-plp-ghosthint{font-size: 11px;color:var(--iwb-plp-accent,#5a4bd0)}
/* v1.6.10:悬停放大改为「内层背景层缩放」——卡片命中区域不变,渐变卡不再闪烁 */
.iwb-plp-bg{position:absolute;inset:0;overflow:hidden;border-radius:inherit;transition:transform .16s ease;will-change:transform;backface-visibility:hidden}
.iwb-plp-bg{position:absolute;inset:0;overflow:hidden;border-radius:inherit;transition:transform .16s ease;backface-visibility:hidden}
.iwb-plp-card:hover .iwb-plp-bg{transform:scale(1.045)}
.iwb-plp-card:hover{border-color:var(--iwb-border2,#b9bfca);box-shadow:0 8px 22px rgba(0,0,0,.14)}
.iwb-plp-card:hover{border-color:var(--iwb-border2,#b9bfca)}
/* 取消卡片本体的缩放/层级切换(闪烁与边缘点击丢失的来源) */
.iwb-plp-card{transform:none}
.iwb-plp-card:hover{transform:none;z-index:auto}
@@ -605,3 +605,9 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki
.iwb-plp-dialog .iwb-plp-vrow2{padding:0 var(--iwb-space-4)}
.iwb-plp-dialog .iwb-plp-vrow2:hover{background:var(--iwb-plugin-hover);border-radius:var(--iwb-radius-control, var(--iwb-radius-card))}
.iwb-plp-vitem.is-open .iwb-plp-vcaret{color:var(--iwb-plp-accent, var(--iwb-text2))}
/* v1.15.0:节点变量输入框(20 行内自然长高,超出折叠;无滚动条) */
.iwb-plp-ncell{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:2px}
.iwb-plp-ncell .iwb-plp-nin{width:100%;flex:0 0 auto}
.iwb-plp-nmore{align-self:flex-start;border:0;background:transparent;color:var(--iwb-brand-text,#2f6bff);font-size:11px;line-height:1.4;padding:0 0 2px;cursor:pointer}
.iwb-plp-nmore:hover{text-decoration:underline}
@@ -510,7 +510,7 @@
global.IWBPluginHost.register({
id: 'batch-export',
name: '批量出图',
version: '1.2.2',
version: '1.2.3',
apiVersion: 1,
capabilities: ['panels', 'canvas'],
settings: {
@@ -39,7 +39,7 @@
global.IWBPluginHost.register({
id: 'blank-canvas',
name: '空白画布',
version: '1.0.0',
version: '1.0.1',
apiVersion: 1,
capabilities: ['nodeActions', 'canvas', 'canvasWrite'],
}, function (ctx) {
@@ -56,10 +56,13 @@
}
// 与上游 isEmptyRefNode 等价:ref 节点且既无本地数据也无 URL({__blob}/{__cache} 引用是对象,天然为真)
// 空白判定:data / url / localRef / ref 任一存在都不算空白。
// v1.0.1:宿主 3.26.183 起大图会被引用化(data 变成 {__blob}/{__file} 对象、localRef/ref 同时指向它),
// 只看 data/url 时「只有本地引用」的节点会被误判为空、直接被白图覆盖掉。
function isEmptyImageNode(node) {
if (!node || node.type !== 'ref') return false
var d = node.data || {}
return !d.data && !d.url
return !d.data && !d.url && !d.localRef && !d.ref
}
function whitePng(w, h) {
@@ -11,7 +11,7 @@
var __IWB_ANNOTATE_MANIFEST__ = {
id: 'image-annotate',
name: '标注 / 修图',
version: '1.20.8',
version: '1.20.9',
apiVersion: 1,
skin: 'private',
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
@@ -11,7 +11,7 @@
var __IWB_VECTORIZE_MANIFEST__ = {
id: 'image-vectorize',
name: '位图转矢量',
version: '0.6.1',
version: '0.6.3',
apiVersion: 1,
skin: 'private',
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
@@ -3597,6 +3597,11 @@ var __IWB_VECTORIZE_MANIFEST__ = {
document.removeEventListener("keyup", onKeyUp, true);
window.removeEventListener("blur", onBlur);
releasePreview();
// v0.6.3: free heavy state on close (decoded source image + svg string were retained by the closure)
source = null;
currentSvg = "";
lastElements = 0;
lastIslands = 0;
const node = root;
root = null;
els = null;
@@ -145,7 +145,7 @@
global.IWBPluginHost.register({
id: 'white-bg-800',
name: '白底图',
version: '1.2.1',
version: '1.2.3',
apiVersion: 1,
capabilities: ['commands', 'canvas', 'canvasWrite', 'nodeActions'],
settings: {
@@ -228,6 +228,23 @@
return clamp(Number(ctx.settings.get(key)) || fallback, min, max)
}
// 写回(2026-12-02,宿主 3.26.183+):优先 saveNodeImage —— 它会落盘、回读校验、失败回滚旧图并带回原因;
// 老宿主(市场窗口期仍可能是 3.26.182 及更早)没有这个接口,退回同步 setNodeImage。
async function writeBack(id, dataUrl) {
const cw = ctx.canvas
if (cw && typeof cw.saveNodeImage === 'function') {
let r = null
try {
r = await cw.saveNodeImage(id, dataUrl)
} catch (e) {
throw new Error((e && e.message) || '写回画布失败')
}
if (!r || r.ok === false) throw new Error((r && r.error) || '写回画布失败')
return
}
if (!cw || typeof cw.setNodeImage !== 'function' || !cw.setNodeImage(id, dataUrl)) throw new Error('写回画布失败')
}
async function runOne(nodeId, nodeName) {
const img = await resolveImage(nodeId)
@@ -270,7 +287,7 @@
const encoded = await encodeTarget(canvas, target.format, quality, maxBytes, target.allowOversize)
const name = outName(base, size, encoded, target.format)
if (replace && !dual) {
if (!ctx.canvas.setNodeImage(nodeId, encoded.dataUrl)) throw new Error('写回画布失败')
await writeBack(nodeId, encoded.dataUrl)
made.push('覆盖当前节点')
} else {
const created = ctx.canvas.createImageNode({ dataUrl: encoded.dataUrl, name: name })
@@ -37,7 +37,7 @@
global.IWBPluginHost.register({
id: 'xianyi-cutout',
name: '鲜艺抠图',
version: '1.0.3',
version: '1.0.4',
apiVersion: 1,
capabilities: ['commands', 'canvas', 'canvasWrite', 'nodeActions'],
settings: {
+249
View File
@@ -0,0 +1,249 @@
// iwb-plugin: 任务队列 —— 左栏整页
//
// 数据全部在宿主:账本(image-ingest-store)、下载/重试(image-ingest)、落地图库、定位节点、记录上限。
// 插件只做视图与手动操作;禁用插件时宿主仍记账(上限内)。
;(function (global) {
'use strict'
if (!global.IWBPluginHost) return
var PAGE_ID = 'taskqueue-page'
var TABS = [['all', '全部'], ['ok', '已完成'], ['down', '下载中'], ['fail', '失败'], ['only', '仅记录']]
var STATUS = { ok: '已完成', down: '下载中', fail: '失败', only: '仅记录' }
var LIMITS = [100, 200, 500, 1000, 2000, 5000]
function el (tag, attrs) {
var node = document.createElement(tag)
if (attrs) {
for (var k in attrs) {
if (!Object.prototype.hasOwnProperty.call(attrs, k)) continue
var v = attrs[k]
if (v === null || v === undefined) continue
if (k === 'class') node.className = v
else if (k === 'text') node.textContent = v
else if (k === 'style') node.setAttribute('style', v)
else node.setAttribute(k, v)
}
}
for (var i = 2; i < arguments.length; i++) append(node, arguments[i])
return node
}
function append (node, v) {
if (v === null || v === undefined || v === false) return
if (Array.isArray(v)) { for (var i = 0; i < v.length; i++) append(node, v[i]); return }
node.appendChild(typeof v === 'string' ? document.createTextNode(v) : v)
}
function clear (node) { while (node.firstChild) node.removeChild(node.firstChild) }
var SVG_NS = 'http://www.w3.org/2000/svg'
function svgEl (tag, attrs) {
var node = document.createElementNS(SVG_NS, tag)
if (attrs) for (var k in attrs) if (Object.prototype.hasOwnProperty.call(attrs, k)) node.setAttribute(k, attrs[k])
return node
}
function fmtTime (ms) {
var d = new Date(Number(ms) || 0)
if (!isFinite(d.getTime())) return ''
var p = function (n) { return (n < 10 ? '0' : '') + n }
return p(d.getMonth() + 1) + '-' + p(d.getDate()) + ' ' + p(d.getHours()) + ':' + p(d.getMinutes())
}
function fmtSize (w, h) { return (w > 0 && h > 0) ? (w + '×' + h) : '' }
function titleOf (it) {
var m = it.meta || {}
var base = String(m.promptText || m.prompt || '').trim()
if (!base) return '历史记录 · ' + fmtTime(it.createdAt) + ' · #' + String(it.id || '').slice(-4)
if (base.length > 24) base = base.slice(0, 24) + '…'
if (m.variant) base += ' · 第 ' + m.variant + ' 张'
return base
}
function mount (host, ctx) {
clear(host)
if (!ctx || !ctx.queue) { host.textContent = '任务队列能力未就绪(请更新客户端)'; return function () {} }
host.classList.add('iwb-plugin-node-body', 'iwb-tq')
var state = { filter: 'all', limit: 500, items: [], total: 0, loading: true, msg: '' }
var timer = 0
var unsub = function () {}
var head = el('div', { class: 'iwb-tq-head' })
var sub = el('div', { class: 'iwb-tq-sub', text: '全局生图记录 · 数据由宿主保存,插件关闭也继续记录' })
var tools = el('div', { class: 'iwb-tq-tools' })
var limitSel = el('select', { class: 'iwb-input iwb-tq-limit', 'aria-label': '记录上限' })
for (var li = 0; li < LIMITS.length; li++) limitSel.appendChild(el('option', { value: String(LIMITS[li]), text: String(LIMITS[li]) + ' 条' }))
var clearBtn = el('button', { class: 'iwb-btn iwb-btn-sm iwb-tq-ghost', text: '清空记录' })
var refreshBtn = el('button', { class: 'iwb-btn iwb-btn-sm iwb-tq-ghost', text: '刷新' })
tools.appendChild(el('span', { class: 'iwb-tq-tool-lbl', text: '记录上限' }))
tools.appendChild(limitSel)
tools.appendChild(clearBtn)
tools.appendChild(refreshBtn)
append(head, [sub, tools])
var tabs = el('div', { class: 'iwb-tq-tabs' })
var tabEls = {}
for (var ti = 0; ti < TABS.length; ti++) {
var key = TABS[ti][0]
var t = el('button', { class: 'iwb-tq-tab' + (key === 'all' ? ' on' : ''), 'data-k': key },
el('span', { text: TABS[ti][1] }), el('span', { class: 'iwb-tq-n', text: '0' }))
tabEls[key] = t
tabs.appendChild(t)
}
var list = el('div', { class: 'iwb-tq-list' })
var foot = el('div', { class: 'iwb-tq-foot' })
// 2026-12-03:整页高度由宿主给满(.iwb-tq{height:100%}),只有列表自己滚;
// 页头/页签/底部说明全程不动,也不会再出现列表撑出容器压住底部说明。
append(host, [head, tabs, list, foot])
function setMsg (m) { state.msg = m || ''; renderFoot() }
function renderFoot () {
clear(foot)
append(foot, [
el('span', { text: '记录只保留链接与本机状态;上限内自动淘汰最旧记录,不影响 images/gallery 里的文件。' }),
el('span', { class: 'iwb-tq-hint', text: state.msg || '点击「下载」= 落地到图库(图库会自动刷新出现)' }),
])
}
function setCounts (stats) {
var s = stats || {}
var map = { all: s.total || 0, ok: s.ok || 0, down: s.down || 0, fail: s.fail || 0, only: s.only || 0 }
for (var k in tabEls) {
var n = tabEls[k].querySelector('.iwb-tq-n')
if (n) n.textContent = String(map[k] || 0)
}
}
function phEl (it) {
return el('div', { class: 'iwb-tq-ph' },
(function () { var s = svgEl('svg', { viewBox: '0 0 24 24', width: '20', height: '20', fill: 'none', stroke: 'currentColor', 'stroke-width': '1.6', 'aria-hidden': 'true' }); s.appendChild(svgEl('path', { d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4' })); s.appendChild(svgEl('polyline', { points: '7 10 12 15 17 10' })); s.appendChild(svgEl('line', { x1: '12', x2: '12', y1: '15', y2: '3' })); return s })(),
el('span', { text: it && it.kind === 'only' ? '仅记录' : '' }))
}
function thumbOf (it) {
if (it.thumbUrl) {
var img = el('img', { class: 'iwb-tq-img', src: it.thumbUrl, alt: '', draggable: 'false' })
img.addEventListener('error', function () { try { if (img.parentNode) img.parentNode.replaceChild(phEl(it), img) } catch (e) { /* ignore */ } })
return img
}
return phEl(it)
}
function stuckMin (it) {
if (!it || it.kind !== 'down' || it.status !== 'downloading') return 0
var t = Number(it.updatedAt) || Number(it.createdAt) || 0
if (!t) return 0
var ms = Date.now() - t
return ms > 60000 ? Math.floor(ms / 60000) : 0
}
function badgeOf (it) {
if (it.kind === 'ok') return el('span', { class: 'iwb-tq-badge ' + (it.inGallery ? 'ok' : 'warn'), text: it.inGallery ? '已入图库' : '待入库' })
if (it.kind === 'down') {
var sm = stuckMin(it)
if (sm) return el('span', { class: 'iwb-tq-badge warn', text: '可能卡住 · ' + sm + ' 分' })
var label = it.status === 'queued' ? '排队中' : '下载中'
if (it.status === 'downloading' && it.progress > 0) label += ' ' + Math.round(it.progress * 100) + '%'
return el('span', { class: 'iwb-tq-badge', text: label })
}
if (it.kind === 'fail') return el('span', { class: 'iwb-tq-badge fail', text: '下载失败' })
return el('span', { class: 'iwb-tq-badge warn', text: '未下载' })
}
function btn (label, cls, onClick) {
var b = el('button', { class: 'iwb-btn iwb-btn-sm iwb-tq-btn' + (cls ? ' ' + cls : ''), text: label })
b.addEventListener('click', function (e) { e.stopPropagation(); onClick(b) })
return b
}
function rowOf (it) {
var meta = it.meta || {}
var thumb = el('div', { class: 'iwb-tq-thumb', title: '点击预览' }, thumbOf(it))
thumb.addEventListener('click', function () { try { Promise.resolve(ctx.queue.preview(it.id)).catch(function () { setMsg('预览失败') }) } catch (e) { setMsg('预览失败') } })
var line1 = el('div', { class: 'iwb-tq-line1' }, el('span', { class: 'iwb-tq-name', text: titleOf(it), title: String(meta.promptText || meta.prompt || '') }), badgeOf(it))
var bits = []
bits.push(meta.boardName || '未知画布')
if (it.createdAt) bits.push(fmtTime(it.createdAt))
var sz = fmtSize(it.w, it.h); if (sz) bits.push(sz)
if (meta.model) bits.push(meta.model)
var metaLine = el('div', { class: 'iwb-tq-meta', text: bits.join(' · ') })
var main = el('div', { class: 'iwb-tq-main' }, line1, metaLine)
if (it.kind === 'fail' && it.error) main.appendChild(el('div', { class: 'iwb-tq-err', text: it.error + (it.retries ? (' · 已重试 ' + it.retries + ' 次') : '') }))
var acts = el('div', { class: 'iwb-tq-actions' })
if (it.kind === 'ok' && it.inGallery) acts.appendChild(el('button', { class: 'iwb-btn iwb-btn-sm iwb-tq-btn', text: '已在图库', disabled: 'disabled' }))
else if (it.kind === 'down' && !stuckMin(it)) acts.appendChild(el('button', { class: 'iwb-btn iwb-btn-sm iwb-tq-btn', text: '下载中…', disabled: 'disabled' }))
else if (it.kind === 'down') acts.appendChild(btn('重新下载', 'iwb-tq-primary', function () { Promise.resolve(ctx.queue.restart(it.id)).then(function () { setMsg('已重新排队'); schedule() }).catch(function () { setMsg('重新下载失败') }) }))
else acts.appendChild(btn('下载', 'iwb-tq-primary', function (b) { b.disabled = true; ctx.queue.land(it.id).then(function (r) { b.disabled = false; setMsg(r && r.already ? '已在图库' : (r && r.ok ? '已加入落地队列,图库会自动刷新' : '下载失败')) ; schedule() }).catch(function () { b.disabled = false; setMsg('下载失败') }) }))
acts.appendChild(btn('复制原始链接', '', function () { ctx.queue.copyLink(it.id).then(function (r) { setMsg(r && r.ok ? '链接已复制' : '复制失败') }).catch(function () { setMsg('复制失败') }) }))
var loc = btn('定位', '', function (b) { b.disabled = true; ctx.queue.locate(it.id).then(function (r) { b.disabled = false; setMsg(r && r.ok ? '已定位到节点' : ({ 'board-missing': '画布已删除', 'node-missing': '节点已删除', 'missing-meta': '没有定位信息' }[r && r.error] || '定位失败')) }).catch(function () { b.disabled = false; setMsg('定位失败') }) })
if (!(meta.boardId && meta.nodeId)) { loc.disabled = true; loc.title = '没有画布/节点信息' }
acts.appendChild(loc)
return el('div', { class: 'iwb-tq-row ' + (it.kind || '') }, thumb, main, acts)
}
function renderList () {
clear(list)
if (!state.items.length) {
list.appendChild(el('div', { class: 'iwb-tq-empty', text: state.loading ? '加载中…' : '暂无记录 · 生成后会自动出现在这里' }))
return
}
for (var i = 0; i < state.items.length; i++) list.appendChild(rowOf(state.items[i]))
}
function load () {
state.loading = true
renderList()
Promise.all([
ctx.queue.list({ status: state.filter, limit: state.limit }),
ctx.queue.stats(),
ctx.queue.getLimit(),
]).then(function (rs) {
var r = rs[0] || {}
state.items = Array.isArray(r.items) ? r.items : []
state.total = Number(r.total) || state.items.length
state.loading = false
setCounts(rs[1])
var lim = Number(rs[2]) || 500
if (LIMITS.indexOf(lim) < 0) lim = 500
limitSel.value = String(lim)
state.limit = lim
renderList()
}).catch(function () {
state.loading = false; state.items = []; renderList(); setMsg('加载失败')
})
}
function schedule () { clearTimeout(timer); timer = setTimeout(load, 250) }
for (var k in tabEls) (function (key) {
tabEls[key].addEventListener('click', function () {
state.filter = key
for (var kk in tabEls) tabEls[kk].classList.toggle('on', kk === key)
load()
})
})(k)
limitSel.addEventListener('change', function () {
var n = Number(limitSel.value) || 500
state.limit = n
ctx.queue.setLimit(n).then(function () { setMsg('记录上限已改为 ' + n) ; load() }).catch(function () { setMsg('修改上限失败') })
})
clearBtn.addEventListener('click', function () {
if (!global.confirm('清空已完成/失败的记录?不会删除图库文件。')) return
ctx.queue.clear().then(function () { setMsg('已清空记录'); load() }).catch(function () { setMsg('清空失败') })
})
refreshBtn.addEventListener('click', function () { load() })
renderFoot()
load()
try { unsub = ctx.queue.onChanged(schedule) || function () {} } catch (e) { unsub = function () {} }
return function () { clearTimeout(timer); try { unsub() } catch (e) { /* ignore */ } }
}
global.IWBPluginHost.register({
id: 'taskqueue',
name: '任务队列',
version: '1.0.3',
apiVersion: 1,
capabilities: ['pages', 'queue'],
}, function (ctx) {
ctx.ui.registerPage({
id: PAGE_ID,
title: '任务队列',
icon: 'queue',
mount: function (host) { return mount(host, ctx) },
})
return {}
})
})(typeof window !== 'undefined' ? window : globalThis)
+19
View File
@@ -0,0 +1,19 @@
{
"id": "taskqueue",
"name": "任务队列",
"version": "1.0.3",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
"description": "全局生图记录:链接/状态/画布节点;下载落地图库、重试、复制链接、定位节点(数据由宿主保存)",
"author": "official",
"icon": "⏳",
"tags": [
"工具",
"记录"
],
"files": {
"main.js": "5f08181338062c9327f22e742be7e1e161a32d2e1bc41ae775a73e0e15b9f3a9",
"styles.css": "4de612a1d25cb74a76f1888fdde32c0f617cc6ab5cc1a0f0bd6ff1adccc757e4"
}
}
+40
View File
@@ -0,0 +1,40 @@
/* 任务队列页(插件)—— 颜色/字号/圆角/间距全部走宿主 token;结构尺寸允许字面量。 */
.iwb-tq { display: flex; flex-direction: column; height: 100%; min-height: 0; gap: var(--iwb-space-10); }
.iwb-tq-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--iwb-space-16); flex-wrap: nowrap; }
.iwb-tq-sub { color: var(--iwb-text2); font-size: var(--iwb-font-sm); }
.iwb-tq-tools { display: flex; align-items: center; gap: var(--iwb-space-8); flex: 0 0 auto; flex-wrap: nowrap; }
.iwb-tq-tool-lbl { font-size: var(--iwb-font-sm); color: var(--iwb-text2); white-space: nowrap; }
.iwb-tq-limit { height: 28px; padding: 0 var(--iwb-space-8); flex: 0 0 auto; width: auto; min-width: 76px; max-width: 96px; }
.iwb-tq-ghost { background: var(--iwb-panel); white-space: nowrap; flex: 0 0 auto; }
.iwb-tq-tabs { display: flex; gap: var(--iwb-space-4); border-bottom: 1px solid var(--iwb-border); }
.iwb-tq-tab { display: inline-flex; align-items: center; gap: var(--iwb-space-6); padding: var(--iwb-space-6) var(--iwb-space-10); border: 0; background: transparent; color: var(--iwb-text2); font: inherit; font-size: var(--iwb-font-sm); border-radius: var(--iwb-radius-card) var(--iwb-radius-card) 0 0; cursor: pointer; }
.iwb-tq-tab:hover { color: var(--iwb-text); background: var(--iwb-hover); }
.iwb-tq-tab.on { color: var(--iwb-accent-on-surface); background: var(--iwb-accent-tint); }
.iwb-tq-n { font-size: var(--iwb-font-2xs); line-height: 15px; padding: 0 var(--iwb-space-6); border-radius: var(--iwb-radius-full); border: 1px solid var(--iwb-border); color: var(--iwb-text2); }
.iwb-tq-tab.on .iwb-tq-n { border-color: var(--iwb-accent-on-surface); color: var(--iwb-accent-on-surface); background: transparent; }
.iwb-tq-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; display: flex; flex-direction: column; gap: var(--iwb-space-8); }
.iwb-tq-row { display: grid; grid-template-columns: 96px minmax(0,1fr) auto; gap: var(--iwb-space-12); align-items: center; padding: var(--iwb-space-10); background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-card); }
.iwb-tq-row:hover { border-color: var(--iwb-hover-border); }
.iwb-tq-row.fail { border-color: var(--iwb-err-bd); background: color-mix(in srgb, var(--iwb-err) 9%, var(--iwb-panel)); }
.iwb-tq-thumb { width: 96px; height: 64px; border-radius: var(--iwb-radius-control); border: 1px solid var(--iwb-border); background: var(--iwb-layer2); overflow: hidden; display: grid; place-items: center; cursor: zoom-in; position: relative; }
.iwb-tq-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.iwb-tq-ph { display: grid; place-items: center; gap: var(--iwb-space-2); color: var(--iwb-text2); font-size: var(--iwb-font-2xs); }
.iwb-tq-ph svg { width: 20px; height: 20px; }
.iwb-tq-main { min-width: 0; display: flex; flex-direction: column; gap: var(--iwb-space-4); }
.iwb-tq-line1 { display: flex; align-items: center; gap: var(--iwb-space-8); min-width: 0; }
.iwb-tq-name { font-size: var(--iwb-font-base); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iwb-tq-badge { flex: 0 0 auto; height: 18px; line-height: 18px; padding: 0 var(--iwb-space-8); border-radius: var(--iwb-radius-full); border: 1px solid var(--iwb-border2); background: var(--iwb-layer); color: var(--iwb-text2); font-size: var(--iwb-font-2xs); }
.iwb-tq-badge.ok { color: var(--iwb-ok); border-color: var(--iwb-ok-bd); background: var(--iwb-ok-bg); }
.iwb-tq-badge.fail { color: var(--iwb-err); border-color: var(--iwb-err-bd); background: var(--iwb-err-bg); }
.iwb-tq-badge.only { color: var(--iwb-warn); border-color: var(--iwb-warn-bd); background: var(--iwb-warn-bg); }
.iwb-tq-badge.warn { color: var(--iwb-warn); border-color: var(--iwb-warn-bd); background: var(--iwb-warn-bg); }
.iwb-tq-meta { font-size: var(--iwb-font-sm); color: var(--iwb-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iwb-tq-err { font-size: var(--iwb-font-xs); color: var(--iwb-err); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iwb-tq-actions { display: flex; align-items: center; gap: var(--iwb-space-6); flex-wrap: wrap; justify-content: flex-end; }
.iwb-tq-btn { white-space: nowrap; }
.iwb-tq-btn.iwb-tq-primary { background: var(--iwb-brand); color: var(--iwb-on-brand); border-color: var(--iwb-brand); }
.iwb-tq-btn.iwb-tq-primary:hover { filter: brightness(1.05); }
.iwb-tq-empty { padding: var(--iwb-space-32); text-align: center; color: var(--iwb-text2); font-size: var(--iwb-font-sm); }
.iwb-tq-foot { display: flex; justify-content: space-between; gap: var(--iwb-space-12); color: var(--iwb-text2); font-size: var(--iwb-font-xs); }
.iwb-tq-hint { color: var(--iwb-text-dim); }
@media (max-width: 900px) { .iwb-tq-row { grid-template-columns: 72px minmax(0,1fr); } .iwb-tq-actions { grid-column: 2; justify-content: flex-start; } .iwb-tq-thumb { width: 72px; height: 50px; } }
+94
View File
@@ -0,0 +1,94 @@
#!/usr/bin/env node
'use strict'
// 发布产物与站点登记的一致性自检(2026-12-02)
//
// 为什么有它:v3.26.183 发布时发现,NAS 上 3.26.182 的 mac 产物被一个残留后台脚本覆盖成了 183 的字节,
// 而 site/releases.json 仍记着旧 size/sha256 —— 用户下载到的文件与记录不符,全程没有任何报错。
// 这个脚本把「记录 == 线上」变成发布收尾的机械检查:不一致就 FAIL,发版当场发现,而不是等用户下载到错字节。
//
// 用法:
// node scripts/audit-release-files.js # 最近 5 个版本,逐条 HEAD 比对 size(快)
// node scripts/audit-release-files.js --all # 全部版本
// node scripts/audit-release-files.js --sha # 最新版本额外下载核对 sha256(慢)
// 退出码:0 = 全部一致;1 = 有不一致 / 404
//
// 环境变量:IWB_RELEASE_BASE(默认 https://download.maqiart.eu.org/)便于本地/测试站核对。
const fs = require('fs')
const path = require('path')
const https = require('https')
const http = require('http')
const crypto = require('crypto')
const BASE = (process.env.IWB_RELEASE_BASE || 'https://download.maqiart.eu.org/').replace(/\/?$/, '/')
const argv = process.argv.slice(2)
const ALL = argv.includes('--all')
const WITH_SHA = argv.includes('--sha')
const LIMIT = ALL ? Infinity : 5
const json = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'site', 'releases.json'), 'utf8'))
const releases = (json.releases || []).slice(0, LIMIT)
function request (url, method) {
return new Promise((resolve, reject) => {
const lib = url.indexOf('https:') === 0 ? https : http
const req = lib.request(url, { method }, (res) => {
if (method === 'GET') {
const hash = crypto.createHash('sha256')
let bytes = 0
res.on('data', (c) => { bytes += c.length; hash.update(c) })
res.on('end', () => resolve({ status: res.statusCode, size: bytes, sha256: hash.digest('hex') }))
res.on('error', reject)
return
}
res.resume()
resolve({ status: res.statusCode, size: Number(res.headers['content-length'] || 0) })
})
req.on('error', reject)
req.setTimeout(20000, () => req.destroy(new Error('timeout')))
req.end()
})
}
;(async () => {
const bad = []
const rows = []
let first = true
for (const rel of releases) {
for (const [platform, p] of Object.entries(rel.platforms || {})) {
const url = BASE + String(p.file || '')
const wantSize = Number(p.size || 0)
const wantSha = String(p.sha256 || '')
let got
try {
got = await request(url, 'HEAD')
if (got.status !== 200) throw new Error('HTTP ' + got.status)
} catch (e) {
bad.push(rel.version + ' ' + platform + ' → ' + (e && e.message ? e.message : 'request failed'))
rows.push(['✗', rel.version, platform, '?', String(wantSize), String(e && e.message)])
continue
}
const sizeOk = !wantSize || got.size === wantSize
let shaNote = ''
if (sizeOk && WITH_SHA && first && wantSha) {
try {
const full = await request(url, 'GET')
shaNote = full.sha256 === wantSha ? 'sha ok' : ('sha DIFF ' + full.sha256.slice(0, 12) + ' ≠ ' + wantSha.slice(0, 12))
if (full.sha256 !== wantSha) bad.push(rel.version + ' ' + platform + ' → sha256 不一致(线上 ' + full.sha256.slice(0, 12) + '… / 记录 ' + wantSha.slice(0, 12) + '…)')
} catch (e) { shaNote = 'sha 校验失败' }
}
if (!sizeOk) bad.push(rel.version + ' ' + platform + ' → size 不一致(线上 ' + got.size + ' B / 记录 ' + wantSize + ' B)' + (got.size === (p.size || 0) ? '' : ',文件可能被覆盖'))
rows.push([sizeOk ? '✓' : '✗', rel.version, platform, String(got.size), String(wantSize), shaNote])
}
first = false
}
const pad = (s, n) => String(s).padEnd(n)
console.log('发布产物一致性检查(' + BASE + (ALL ? ',全部版本' : ',最近 ' + Math.min(LIMIT, (json.releases || []).length) + ' 个版本') + ')')
for (const r of rows) console.log(' ' + r[0] + ' ' + pad(r[1], 10) + ' ' + pad(r[2], 16) + ' 线上 ' + pad(r[3], 10) + ' 记录 ' + pad(r[4], 10) + ' ' + r[5])
if (bad.length) {
console.error('\n不一致 ' + bad.length + ' 处:')
for (const b of bad) console.error(' - ' + b)
console.error('\n处理:重传该版本产物并同步 site/releases.json,或把该版本从下载页下掉。')
process.exit(1)
}
console.log('\n全部一致(' + rows.length + ' 条)')
})()
+5
View File
@@ -84,6 +84,7 @@ const sourceModules = [
'ui-components.js',
'plugin-data.js',
'plugin-api-gallery.js',
'plugin-api-queue.js',
'plugin-api-grouplib.js',
'plugin-api-promptlib.js',
'plugin-host.js',
@@ -107,6 +108,9 @@ const sourceModules = [
'canvas-v3-hit.js',
'image-display-thumb.js',
'image-cache-migrate.js',
'image-writeback.js',
'image-ingest.js',
'image-ingest-store.js',
'runtime-frame-probe.js',
'image-remote-cache.js',
'gallery-sync.js',
@@ -148,6 +152,7 @@ const sourceModules = [
'ui-gen-config-panel.js',
'canvas-webview.js',
'plugin-api-images.js',
'plugin-canvas-bridge.js',
'plugin-files-policy.js',
'image-prompt-cover.js',
]
+31
View File
@@ -75,3 +75,34 @@ for (const f of ['favicon.svg', 'manifest.webmanifest', 'icon-192.png', 'icon-51
}
if (!fs.existsSync(path.join(dist, 'sw.js'))) fail('dist/sw.js 必须保留(更新检测 + 图片缓存)')
pass('PWA 图标/manifest 未进 dist,index.html 无引用;sw.js 保留')
// 7. dist/plugins 逐条与 plugins/index.json 的哈希一致(2026-12-03)。
// 动机:Windows 构建机 autocrlf 会把插件 .js 检出成 CRLF,SRI 对不上 → WebView2 拒绝执行该插件,
// 而构建本身不报错(style-source 真实踩过)。这条在 verify:ci 里跑,跨平台都能拦住。
const crypto = require('crypto')
const pluginsDist = path.join(dist, 'plugins')
const pluginsIdxPath = path.join(pluginsDist, 'index.json')
if (!fs.existsSync(pluginsIdxPath)) fail('dist/plugins/index.json 不存在')
const pidx = JSON.parse(fs.readFileSync(pluginsIdxPath, 'utf8'))
const sha256of = (p) => crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex')
let pin = 0
for (const ent of (pidx || [])) {
if (ent.file) {
const p = path.join(pluginsDist, ent.file)
if (!fs.existsSync(p)) fail('dist/plugins/' + ent.file + ' 不存在')
if (ent.integrity) {
const want = 'sha256-' + crypto.createHash('sha256').update(fs.readFileSync(p)).digest('base64')
if (want !== ent.integrity) fail('dist/plugins/' + ent.file + ' 的 SRI 与 index.json 不一致(换行符/字节被改动?)')
}
if (ent.sha256 && sha256of(p) !== ent.sha256) fail('dist/plugins/' + ent.file + ' 的 sha256 与 index.json 不一致')
pin++
} else if (ent.dir) {
for (const [rel, want] of Object.entries(ent.files || {})) {
const p = path.join(pluginsDist, ent.dir, rel)
if (!fs.existsSync(p)) fail('dist/plugins/' + ent.dir + '/' + rel + ' 不存在')
if (sha256of(p) !== want) fail('dist/plugins/' + ent.dir + '/' + rel + ' 的 sha256 与 index.json 不一致(换行符/字节被改动?)')
pin++
}
}
}
pass('dist/plugins 与 index.json 哈希一致(' + pin + ' 个文件)')
+29 -2
View File
@@ -16,9 +16,35 @@ if (!fs.existsSync(src)) {
}
fs.mkdirSync(dst, { recursive: true })
// 2026-12-03:文本类插件文件统一按 LF 写入 dist。
// Windows 构建机 core.autocrlf=true 时,检出的 .js 是 CRLF;直接 copyFile 会让 dist 里的字节
// 与 plugins/index.json 记的 SRI/sha256 对不上 → WebView2 拒绝执行(style-source 真实踩过)。
const TEXT_EXT = new Set(['.js', '.css', '.json', '.html', '.svg', '.txt', '.md'])
function copyNormalized(from, to) {
if (TEXT_EXT.has(path.extname(from).toLowerCase())) {
const buf = fs.readFileSync(from)
const txt = buf.toString('utf8')
if (txt.indexOf('\r\n') >= 0) {
fs.writeFileSync(to, txt.replace(/\r\n/g, '\n'))
return
}
}
fs.copyFileSync(from, to)
}
function normalizeTree(dir) {
for (const name of fs.readdirSync(dir)) {
const abs = path.join(dir, name)
const st = fs.statSync(abs)
if (st.isDirectory()) { normalizeTree(abs); continue }
if (!TEXT_EXT.has(path.extname(name).toLowerCase())) continue
const txt = fs.readFileSync(abs, 'utf8')
if (txt.indexOf('\r\n') >= 0) fs.writeFileSync(abs, txt.replace(/\r\n/g, '\n'))
}
}
let count = 0
for (const name of fs.readdirSync(src)) {
fs.copyFileSync(path.join(src, name), path.join(dst, name))
copyNormalized(path.join(src, name), path.join(dst, name))
count++
}
// v3.25.41(M1):目录插件 <plugins>/<id>/{manifest.json,main.js} 一并进包(应用按 /plugins/<id>/… 取)
@@ -30,8 +56,9 @@ for (const name of fs.readdirSync(pluginsRoot)) {
if (name === 'runtime' || name === 'local') continue
if (!fs.existsSync(path.join(abs, 'manifest.json'))) continue
fs.cpSync(abs, path.join(dst, name), { recursive: true })
normalizeTree(path.join(dst, name))
folders++
}
// 索引与插件文件必须同源同包:应用按 index.json 里的 filename / dir 去 /plugins/ 取
fs.copyFileSync(path.join(root, 'plugins', 'index.json'), path.join(dst, 'index.json'))
copyNormalized(path.join(root, 'plugins', 'index.json'), path.join(dst, 'index.json'))
console.log('[copy-plugins] 已拷入 ' + count + ' 个文件 + ' + folders + ' 个目录插件 → dist/plugins/')
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# 取资料目录 _boot.log 的关键行。
set -uo pipefail
DIR="${IWB_DATA_DIR:-$HOME/Documents/ImageWorkbench}"
LOG="$DIR/_boot.log"
if [ ! -f "$LOG" ]; then echo "找不到 $LOG(可用 IWB_DATA_DIR 指定资料目录)"; exit 2; fi
PAT="${*:-plugin-img|perf |thumb-fail|mem }"
echo "== $LOG (匹配:$PAT)"
tail -n 400 "$LOG" | grep -E "$PAT" | tail -n 40
+91
View File
@@ -0,0 +1,91 @@
#!/usr/bin/env node
'use strict'
/* 性能基线日常跑(2026-12-02,C 项)
*
* 做什么:build → 起本地静态服(动态端口)→ 只跑 tests/_perf-baseline.spec.js → 关服。
* 为什么单起一个脚本:playwright 没有 webServer 配置,日常跑要手动开两个终端;这里封成一条命令。
* 注意:本 spec **不进 CI**(无头环境没 GPU,数字不可比),只作真机回归。
*
* 用法:
* npm run perf:baseline # 日常档(IWB_PROBE_LIGHT=1,12 步平移)
* IWB_PROBE_LIGHT=0 npm run perf:baseline # 完整档(50 步平移 + 缩放 + 切标签)
* IWB_PROBE_PERF=0 npm run perf:baseline # 只测量不断言(排查时用)
* 阈值可用环境变量覆盖:IWB_PROBE_LR_MAX(长帧比例)/ IWB_PROBE_JS_MAX(longtask 总 ms)/ IWB_PROBE_MIN_FRAMES
*/
const { spawn } = require('node:child_process')
const http = require('node:http')
const net = require('node:net')
const path = require('node:path')
const root = path.resolve(__dirname, '..')
const wait = (ms) => new Promise((r) => setTimeout(r, ms))
function freePort () {
return new Promise((resolve, reject) => {
const s = net.createServer()
s.unref()
s.on('error', reject)
s.listen(0, '127.0.0.1', () => {
const port = s.address().port
s.close(() => resolve(port))
})
})
}
function ping (base) {
return new Promise((resolve) => {
const req = http.get(base + '/', (res) => { res.resume(); resolve(res.statusCode === 200) })
req.on('error', () => resolve(false))
req.setTimeout(1000, () => { req.destroy(); resolve(false) })
})
}
async function main () {
console.log('== 1/3 构建 dist')
// 用 npm run build(build.js + copy-plugins):少了插件,页面 DOM 与真机不一致,帧数据会偏
const build = spawn('npm', ['run', 'build'], { cwd: root, stdio: 'inherit' })
const buildCode = await new Promise((resolve) => build.on('exit', (c) => resolve(c == null ? 1 : c)))
if (buildCode !== 0) { console.error('[perf] 构建失败'); return buildCode }
const PORT = await freePort()
const BASE = 'http://127.0.0.1:' + PORT
const server = spawn(process.execPath, [path.join(root, 'scripts', 'serve-test.js')], {
cwd: root,
env: Object.assign({}, process.env, { IWB_LOCAL_PORT: String(PORT) }),
stdio: ['ignore', 'ignore', 'pipe'],
})
let serverErr = ''
server.stderr.on('data', (d) => { serverErr += String(d) })
const stop = () => { try { server.kill('SIGTERM') } catch (e) { /* ignore */ } }
process.on('SIGINT', () => { stop(); process.exit(130) })
try {
console.log('== 2/3 起本地服 ' + BASE)
let up = false
for (let i = 0; i < 40; i++) {
if (await ping(BASE)) { up = true; break }
if (server.exitCode !== null) break
await wait(250)
}
if (!up) { console.error('[perf] 测试服没起来(端口 ' + PORT + ')' + (serverErr ? '\n' + serverErr.slice(0, 400) : '')); return 1 }
const env = Object.assign({}, process.env, { IWB_BASE_URL: BASE })
if (env.IWB_PROBE_LIGHT == null) env.IWB_PROBE_LIGHT = '1'
console.log('== 3/3 跑基线(LIGHT=' + env.IWB_PROBE_LIGHT + (env.IWB_PROBE_PERF === '0' ? ',只测不断言' : '') + ')')
const args = [require.resolve('@playwright/test/cli'), 'test', 'tests/_perf-baseline.spec.js', '--reporter=line', '--workers=1']
const code = await new Promise((resolve) => {
const pw = spawn(process.execPath, args, { cwd: root, env, stdio: 'inherit' })
pw.on('exit', (c) => resolve(c == null ? 1 : c))
})
if (code !== 0 && serverErr) console.error('[perf] 测试服 stderr:\n' + serverErr.slice(0, 800))
return code
} finally {
stop()
await wait(150)
}
}
main().then((code) => process.exit(code)).catch((e) => {
console.error('[perf] ' + (e && e.message))
process.exit(1)
})
+42
View File
@@ -0,0 +1,42 @@
// 插件清单纯函数:内容寻址命名 + SRI integrity。
//
// 桌面端插件清单 plugins/index.json 由 scripts/sync-plugins-from-repo.js 生成,
// 市场 zip 由 scripts/gen-market.js 生成;两条链路都依赖这里的哈希/命名规则。
// 历史上这些函数长在 scripts/plugins-publish.mjs(直写 Cloudflare KV 的网页版发布脚本),
// 网页版已停用,脚本删除,纯函数留在此处给同步脚本与测试复用。
import { createHash } from 'node:crypto'
import { basename } from 'node:path'
export const integrityOf = (buffer) => 'sha256-' + createHash('sha256').update(buffer).digest('base64')
export const idFromFile = (file) => {
const base = basename(String(file))
const m = /^plugin-([a-z][a-z0-9-]{2,31})\.js$/.exec(base)
return m ? m[1] : ''
}
// 内容寻址存储名:同 id + 同字节 ⇒ 同名(幂等);字节变 ⇒ 名变 ⇒ 客户端永不拿到陈旧缓存
export const storedNameOf = (id, buffer) => {
if (!/^[a-z][a-z0-9-]{2,31}$/.test(String(id))) throw new Error('非法插件 id:' + id)
return 'plugin-' + id + '.' + createHash('sha256').update(buffer).digest('hex').slice(0, 12) + '.js'
}
export const buildIndex = (entries) => {
const seen = new Set()
const out = []
for (const e of entries) {
if (!e || !e.id || !e.file || !e.integrity) throw new Error('清单项缺字段:' + JSON.stringify(e))
if (seen.has(e.id)) throw new Error('插件 id 重复:' + e.id)
seen.add(e.id)
out.push({ id: e.id, file: e.file, version: e.version || '', integrity: e.integrity })
}
return out.sort((a, b) => a.id.localeCompare(b.id))
}
// 并入既有清单:本次**未提供**文件的插件予以保留(incoming 同 id 覆盖旧的)。
// 2026-11-03 事故:只按传入文件重建清单 ⇒ 单发一个插件就把其余插件从清单里抹掉。
export const mergeIndexes = (existing, incoming) => {
const incomingIds = new Set(incoming.map((e) => e.id))
const kept = (Array.isArray(existing) ? existing : []).filter((e) => e && e.id && e.file && e.integrity && !incomingIds.has(e.id))
return buildIndex([...incoming, ...kept])
}
-297
View File
@@ -1,297 +0,0 @@
// A2 插件发布:为每个插件文件算 SHA-256(SRI integrity)→ 以内容寻址名 plugin-<id>.<hash12>.js 入库 → 写 plugins/index.json →(可选)上传 KV。
//
// 用法:
// node scripts/plugins-publish.mjs <plugin-<id>.js ...> [--out plugins/index.json] [--kv-id <namespaceId>] [--version <id>=<ver>] [--upload] [--prune]
// node scripts/plugins-publish.mjs --gc [--delete] [--keep <id>] # 列出(并删除)KV 里线上清单不再引用的陈旧插件键
// --keep 用于「归档保留」的插件(如 ai-chat:移出清单但字节留 KV 待启用),可重复。
//
// 默认 **dry-run**:只写本地清单并打印计划;只有显式 --upload 才会写线上 KV。
//
// 上传走 **Cloudflare REST API**(2026-11-03 起),不再 spawn `npx wrangler`:
// PUT /accounts/<acct>/storage/kv/namespaces/<ns>/values/<urlenc key>
// GET /accounts/<acct>/storage/kv/namespaces/<ns>/values/<urlenc key>
// GET /accounts/<acct>/storage/kv/namespaces/<ns>/keys?prefix=plugins/
// DELETE /accounts/<acct>/storage/kv/namespaces/<ns>/bulk (body = key 数组)
// 原因:wrangler v3/v4 的子命令名不同(`kv:key put` / `kv key put`),靠 spawnSync 传参数永远踩版本坑。
// 凭据:CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID;macOS 上缺失时自动回退读钥匙串
// (服务名 CLOUDFLARE_PAGES_TOKEN / CLOUDFLARE_ACCOUNT_ID)。token 需 **Account → Workers KV Storage → Edit**。
//
// version 默认从既有 --out 清单里按 id 保留;要改版本用 --version <id>=<ver>。
// 清单**默认与既有清单合并**:本次未传入的插件原样保留(同 id 覆盖)。要缩减清单必须显式 --prune
// (2026-11-03:旧版只按命令行文件重建 ⇒ 单发 style-source 就把另外 5 个抹掉,插件管理页只剩 1 个)。
// 运行时宿主读 /plugins/index.json 的 integrity,用 <script integrity> 交给浏览器强制校验(不符即拒绝执行)。
//
// 存储名为内容寻址:storedNameOf(id, bytes) = plugin-<id>.<sha256前12位hex>.js。同字节 ⇒ 同名(幂等);内容变 ⇒ 名变。
// 因此 Pages Function 可对带哈希文件名发 `cache-control: public, max-age=31536000, immutable`。
// 内容变化后 KV 会同时保留**新旧哈希键**(旧键不再被清单引用)⇒ 用 --gc 清理(默认只列出,加 --delete 才删)。
import { createHash } from 'node:crypto'
import { spawnSync } from 'node:child_process'
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs'
import { basename, dirname, join, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..')
const CF_API = 'https://api.cloudflare.com/client/v4'
const REQ_TIMEOUT_MS = 30000
export const integrityOf = (buffer) => 'sha256-' + createHash('sha256').update(buffer).digest('base64')
export const idFromFile = (file) => {
const base = basename(String(file))
const m = /^plugin-([a-z][a-z0-9-]{2,31})\.js$/.exec(base)
return m ? m[1] : ''
}
// 内容寻址存储名:同 id + 同字节 ⇒ 同名(幂等);字节变 ⇒ 名变 ⇒ 客户端永不拿到陈旧缓存
export const storedNameOf = (id, buffer) => {
if (!/^[a-z][a-z0-9-]{2,31}$/.test(String(id))) throw new Error('非法插件 id:' + id)
return 'plugin-' + id + '.' + createHash('sha256').update(buffer).digest('hex').slice(0, 12) + '.js'
}
export const buildIndex = (entries) => {
const seen = new Set()
const out = []
for (const e of entries) {
if (!e || !e.id || !e.file || !e.integrity) throw new Error('清单项缺字段:' + JSON.stringify(e))
if (seen.has(e.id)) throw new Error('插件 id 重复:' + e.id)
seen.add(e.id)
out.push({ id: e.id, file: e.file, version: e.version || '', integrity: e.integrity })
}
return out.sort((a, b) => a.id.localeCompare(b.id))
}
// 并入既有清单:本次**未提供**文件的插件予以保留(incoming 同 id 覆盖旧的)。
// 2026-11-03 事故:旧版只拿命令行文件重建清单 ⇒ 单发一个插件就把另外 5 个从清单里抹掉
// (字节还在 KV,但插件管理页只剩 1 个)。默认必须合并;确要缩减清单走 --prune。
export const mergeIndexes = (existing, incoming) => {
const incomingIds = new Set(incoming.map((e) => e.id))
const kept = (Array.isArray(existing) ? existing : []).filter((e) => e && e.id && e.file && e.integrity && !incomingIds.has(e.id))
return buildIndex([...incoming, ...kept])
}
// 陈旧键 = KV 里 plugins/ 下、但**线上清单不再引用**的键(清单自身永远保留)。
// keep 可传插件 id 或完整键(如 'ai-chat' / 'plugins/plugin-ai-chat.824397a8e54b.js'),用于**归档保留**的插件:
// ai-chat 就是「移出清单但字节留在 KV 等启用」的形态,不加 keep 会被当成垃圾。
// 纯函数便于单测;调用方必须以线上清单为准,不能用本地文件(否则本地落后时会误删)。
export const staleKeys = (keys, index, keep = []) => {
const keepSet = new Set(['plugins/index.json'])
for (const e of Array.isArray(index) ? index : []) if (e && e.file) keepSet.add('plugins/' + e.file)
const keeps = (Array.isArray(keep) ? keep : []).map(String).filter(Boolean)
const kept = (key) => keeps.some((p) => key === p || key === 'plugins/' + p || key.startsWith('plugins/plugin-' + p + '.'))
return (Array.isArray(keys) ? keys : [])
.map(String)
.filter((k) => k.startsWith('plugins/') && !keepSet.has(k) && !kept(k))
.sort()
}
const readKvId = () => {
try {
const toml = readFileSync(join(ROOT, 'wrangler.toml'), 'utf8')
const i = toml.indexOf('binding = "PLUGINS"')
if (i < 0) return ''
const m = /id = "([^"]+)"/.exec(toml.slice(i))
return m ? m[1] : ''
} catch (e) { return '' }
}
const readEntries = (outPath) => {
try {
const parsed = JSON.parse(readFileSync(outPath, 'utf8'))
const list = Array.isArray(parsed) ? parsed : (parsed && Array.isArray(parsed.plugins) ? parsed.plugins : [])
return list.filter((e) => e && e.id && e.file && e.integrity)
} catch (e) { return [] }
}
const readVersions = (outPath) => {
const map = new Map()
for (const e of readEntries(outPath)) map.set(String(e.id), String(e.version || ''))
return map
}
// —— 凭据:env 优先,macOS 回退钥匙串(本机 token 就存在那儿)——
const keychain = (service) => {
try {
const r = spawnSync('security', ['find-generic-password', '-s', service, '-w'], { encoding: 'utf8' })
return r.status === 0 ? String(r.stdout || '').trim() : ''
} catch (e) { return '' }
}
const resolveCreds = () => {
let token = String(process.env.CLOUDFLARE_API_TOKEN || '').trim()
let account = String(process.env.CLOUDFLARE_ACCOUNT_ID || '').trim()
if (!token && process.platform === 'darwin') token = keychain('CLOUDFLARE_PAGES_TOKEN')
if (!account && process.platform === 'darwin') account = keychain('CLOUDFLARE_ACCOUNT_ID')
if (!token) throw new Error('缺少 CLOUDFLARE_API_TOKEN(该 token 需 Account → Workers KV Storage → Edit)')
if (!account) throw new Error('缺少 CLOUDFLARE_ACCOUNT_ID')
return { token, account }
}
const kvBase = (creds, kvId) => CF_API + '/accounts/' + creds.account + '/storage/kv/namespaces/' + kvId
const kvValueUrl = (creds, kvId, key) => kvBase(creds, kvId) + '/values/' + encodeURIComponent(key)
const cfJson = async (creds, url, init) => {
const r = await fetch(url, Object.assign({
headers: Object.assign({ Authorization: 'Bearer ' + creds.token }, (init && init.contentType) ? { 'content-type': init.contentType } : {}),
signal: AbortSignal.timeout(REQ_TIMEOUT_MS),
}, init ? { method: init.method, body: init.body } : {}))
const text = await r.text()
let json = null
try { json = JSON.parse(text) } catch (e) { /* 非 JSON 响应 */ }
if (!r.ok || (json && json.success === false)) {
const detail = (json && json.errors && json.errors[0] && json.errors[0].message) || text.slice(0, 200) || '(空响应)'
throw new Error('Cloudflare API ' + r.status + ':' + detail)
}
return json
}
const kvPut = async (creds, kvId, key, body) => {
await cfJson(creds, kvValueUrl(creds, kvId, key), { method: 'PUT', body, contentType: 'text/plain; charset=utf-8' })
}
const kvGetText = async (creds, kvId, key) => {
const r = await fetch(kvValueUrl(creds, kvId, key), {
headers: { Authorization: 'Bearer ' + creds.token },
signal: AbortSignal.timeout(REQ_TIMEOUT_MS),
})
if (!r.ok) throw new Error('读取 KV 失败 ' + r.status + ':' + key)
return await r.text()
}
const kvListPluginKeys = async (creds, kvId) => {
const out = []
let cursor = ''
for (;;) {
const url = kvBase(creds, kvId) + '/keys?limit=1000&prefix=' + encodeURIComponent('plugins/') + (cursor ? '&cursor=' + encodeURIComponent(cursor) : '')
const json = await cfJson(creds, url)
for (const k of (json && json.result) || []) out.push(String(k.name))
cursor = String((json && json.result_info && json.result_info.cursor) || '')
if (!cursor) break
}
return out
}
const kvDeleteKeys = async (creds, kvId, keys) => {
if (!keys.length) return
await cfJson(creds, kvBase(creds, kvId) + '/bulk', { method: 'DELETE', body: JSON.stringify(keys), contentType: 'application/json' })
}
const main = async () => {
const argv = process.argv.slice(2)
const files = []
let outPath = join(ROOT, 'plugins', 'index.json')
let kvId = ''
let upload = false
let prune = false
let gc = false
let del = false
const keeps = []
const overrides = new Map()
for (let i = 0; i < argv.length; i++) {
const a = argv[i]
if (a === '--upload') upload = true
else if (a === '--prune') prune = true
else if (a === '--gc') gc = true
else if (a === '--delete') del = true
else if (a === '--keep') keeps.push(String(argv[++i] || ''))
else if (a === '--out') outPath = resolve(argv[++i] || '')
else if (a === '--kv-id') kvId = String(argv[++i] || '')
else if (a === '--version') { const kv = String(argv[++i] || ''); const eq = kv.indexOf('='); if (eq > 0) overrides.set(kv.slice(0, eq), kv.slice(eq + 1)) }
else if (a.startsWith('--')) throw new Error('未知参数:' + a)
else files.push(a)
}
if (!files.length && !gc) throw new Error('至少给一个 plugin-<id>.js 文件(只想清理陈旧键用 --gc)')
if ((upload || gc) && !kvId) kvId = readKvId()
if (del && !gc) throw new Error('--delete 只能与 --gc 一起用(避免误删)')
const creds = (upload || gc) ? resolveCreds() : null
if ((upload || gc) && !kvId) throw new Error('未找到 KV namespace id:用 --kv-id 指定,或在 wrangler.toml 里确认 binding = "PLUGINS"')
let index = readEntries(outPath)
let entries = []
if (files.length) {
const versions = readVersions(outPath)
entries = files.map((f) => {
const abs = resolve(f)
if (!existsSync(abs)) throw new Error('文件不存在:' + abs)
const id = idFromFile(abs)
if (!id) throw new Error('文件名须为 plugin-<id>.js(id 须 ^[a-z][a-z0-9-]{2,31}$):' + basename(abs))
const bytes = readFileSync(abs)
return { id, file: storedNameOf(id, bytes), version: overrides.get(id) || versions.get(id) || '', integrity: integrityOf(bytes), abs }
})
// 默认合并:未在本次传入的插件原样保留(同 id 由新条目覆盖)
const prev = prune ? [] : readEntries(outPath)
index = mergeIndexes(prev, entries)
const kept = index.length - entries.length
mkdirSync(dirname(outPath), { recursive: true })
writeFileSync(outPath, JSON.stringify(index, null, 2) + '\n')
console.log('[plugins-publish] 已写清单 ' + outPath + '(共 ' + index.length + ' 个,本次发布 ' + entries.length + ' 个' + (kept > 0 ? ',保留既有 ' + kept + ' 个' : '') + ')')
for (const e of index) console.log(' ' + e.id + ' ' + e.file + ' ' + e.integrity)
}
const plan = () => {
console.log('[plugins-publish] 将写 KV(REST,' + kvId + '):')
for (const e of entries) console.log(' PUT plugins/' + e.file + ' (' + e.abs + ')')
if (files.length) console.log(' PUT plugins/index.json (' + outPath + ')')
}
if (!upload && !gc) {
console.log('[plugins-publish] dry-run(未上传)。加 --upload 才会写 KV:')
plan()
return
}
if (upload) {
// 只上传本次传入的插件字节(保留项已在 KV 里,无需重传)
for (const e of entries) await kvPut(creds, kvId, 'plugins/' + e.file, readFileSync(e.abs))
if (files.length) await kvPut(creds, kvId, 'plugins/index.json', readFileSync(outPath))
// 回读校验:写成功 ≠ 内容对(曾经清单被覆写成 1 条就是这么发生的)
if (files.length) {
const remote = JSON.parse(await kvGetText(creds, kvId, 'plugins/index.json'))
const a = JSON.stringify(remote)
const b = JSON.stringify(readEntries(outPath))
if (a !== b) throw new Error('回读校验失败:KV 里的 plugins/index.json 与本地清单不一致')
console.log('[plugins-publish] 回读校验通过(线上清单 ' + remote.length + ' 条与本地一致)')
}
console.log('[plugins-publish] 已上传 ' + entries.length + ' 个插件' + (files.length ? ' + 清单' : '') + ' 到 KV ' + kvId)
}
if (gc) await runGc(creds, kvId, del, keeps)
}
const runGc = async (creds, kvId, del, keeps = []) => {
// 以**线上清单**为准判定引用关系(本地清单可能落后于线上)
let online = []
try {
online = JSON.parse(await kvGetText(creds, kvId, 'plugins/index.json'))
} catch (e) {
throw new Error('GC 中止:读不到线上 plugins/index.json(' + ((e && e.message) || e) + ')——不能用本地清单猜,否则会误删')
}
const keys = await kvListPluginKeys(creds, kvId)
const stale = staleKeys(keys, online, keeps)
console.log('[plugins-publish] KV 共 ' + keys.length + ' 个 plugins/ 键,线上清单引用 ' + online.length + ' 个,陈旧 ' + stale.length + ' 个' + (keeps.length ? '(保留 ' + keeps.join(', ') + ')' : ''))
for (const k of stale) console.log(' 陈旧 ' + k)
if (!stale.length) return
const archived = stale.filter((k) => /plugin-ai-chat\./.test(k))
if (archived.length) {
console.log('[plugins-publish] ⚠️ ' + archived.join('、') + ' 属「归档但保留待启用」的插件(移出清单、字节留 KV),')
console.log(' 删掉后要重新上传字节才能再启用。要保留就加 --keep ai-chat。')
}
if (!del) {
console.log('[plugins-publish] 仅列出(未删除)。确认无误后加 --delete 真正删除:node scripts/plugins-publish.mjs --gc --delete [--keep ai-chat]')
return
}
await kvDeleteKeys(creds, kvId, stale)
console.log('[plugins-publish] 已删除 ' + stale.length + ' 个陈旧键')
}
if (process.argv[1] && resolve(process.argv[1]) === resolve(fileURLToPath(import.meta.url))) {
main().catch((e) => {
console.error('[plugins-publish] ' + ((e && e.message) || e))
process.exit(1)
})
}
-148
View File
@@ -1,148 +0,0 @@
#!/usr/bin/env bash
# A2 插件发布:把插件上传到 KV(同源 /plugins/* 由 Functions 提供)并更新清单。
# 上传后**刷新浏览器即生效** —— 不需要重编译、不需要 deploy 主仓。
# 会为插件算 SHA-256(SRI integrity)写入清单 —— 运行时 fail-closed 校验所必需(缺失即拒载)。
#
# 用法:
# scripts/plugins-publish.sh <插件 id> <插件文件路径> [版本号]
# scripts/plugins-publish.sh <插件 id> --remove # 从清单移除(KV 里的文件保留)
#
# 例:
# scripts/plugins-publish.sh whitebg /path/to/iwb-plugins/whitebg/src/index.js 1.2.0
set -euo pipefail
usage() { sed -n '2,10p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; }
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
ID="${1:-}"
ARG="${2:-}"
VERSION="${3:-}"
if [ -z "$ID" ] || [ -z "$ARG" ]; then usage; exit 2; fi
if ! [[ "$ID" =~ ^[a-z][a-z0-9-]{2,31}$ ]]; then echo "插件 id 不合法:须匹配 ^[a-z][a-z0-9-]{2,31}$" >&2; exit 2; fi
NS_ID="$(awk '/^\[\[kv_namespaces\]\]/{f=1} f&&/^id *=/{gsub(/[" ]/,"",$3); print $3; exit}' "$ROOT/wrangler.toml")"
if [ -z "$NS_ID" ]; then echo "未能在 wrangler.toml 找到 KV namespace id" >&2; exit 1; fi
# ── 读取线上清单(fail-closed)────────────────────────────────────────────
# 旧写法 `... 2>/dev/null || true` 把网络/授权/代理失败也吞成空串,随后被当成 '[]',
# 于是写回时**只剩本次发布的插件**,其余全部从清单消失。
# 2026-11-08 真实发生:image-annotate 1.8.2 发布后清单从 7 条塌成 1 条。
# 现在只有「键确实不存在」才允许从空清单开始,其余情况一律中止。
KV_ERR="$(mktemp)"
if CUR_RAW="$(npx --yes wrangler kv key get --namespace-id="$NS_ID" --remote "plugins/index.json" 2>"$KV_ERR")"; then
CUR="$CUR_RAW"
case "$CUR" in
\[*|{*) ;;
*)
echo "✗ 线上清单读取成功但不是合法 JSON,拒绝继续(避免把它覆盖成单条清单)" >&2
printf '%s\n' "$CUR" | head -c 200 >&2; echo >&2
rm -f "$KV_ERR"; exit 1 ;;
esac
else
if grep -qiE "not found|does not exist|no such key|404" "$KV_ERR" 2>/dev/null; then
CUR='[]'
echo "[plugins-publish] 线上清单尚不存在,将新建"
else
echo "✗ 读取线上清单失败 —— 拒绝继续。" >&2
echo " 继续下去会用「只有本次插件」的清单覆盖线上,把其他插件全部下架。" >&2
sed -n '1,4p' "$KV_ERR" >&2
rm -f "$KV_ERR"; exit 1
fi
fi
rm -f "$KV_ERR"
if [ "$ARG" = "--remove" ]; then
NEXT="$(node -e 'const cur=JSON.parse(process.argv[1]||"[]");const id=process.argv[2];process.stdout.write(JSON.stringify(cur.filter(x=>x&&x.id!==id),null,2))' "$CUR" "$ID")"
TMP="$(mktemp)"; printf '%s\n' "$NEXT" > "$TMP"
npx --yes wrangler kv key put --namespace-id="$NS_ID" --remote "plugins/index.json" --path="$TMP"
echo "[plugins-publish] 已从清单移除 $ID"
exit 0
fi
FILE="$ARG"
if [ ! -f "$FILE" ]; then echo "插件文件不存在:$FILE" >&2; exit 1; fi
if ! head -c 4096 "$FILE" | grep -q "IWBPluginHost"; then
echo "警告:$FILE 里没看到 IWBPluginHost.register —— 请确认这确实是插件产物。" >&2
fi
# ── 主干卫生前置校验(2026-11-05 立规,详见 HANDBOOK 第八节)─────────────
# 背景:本脚本直写 CF KV、绕开 git,曾导致 iwb-plugins 的 main 落后 40 个提交、
# 线上版本与 commit 断链。发布前强制:插件所在仓库工作区干净 + HEAD 已在 origin/main。
# 紧急热修可 IWB_PUBLISH_SKIP_CHECKS=1 跳过(事后必须补 tag 与合并)。
PLUGIN_REPO="$(git -C "$(dirname "$FILE")" rev-parse --show-toplevel 2>/dev/null || true)"
if [ "${IWB_PUBLISH_SKIP_CHECKS:-0}" != "1" ]; then
if [ -z "$PLUGIN_REPO" ]; then
echo "⚠ 未识别插件所属 git 仓库(${FILE}),跳过主干校验" >&2
else
if [ -n "$(git -C "$PLUGIN_REPO" status --porcelain 2>/dev/null)" ]; then
echo "✗ 工作区不干净:$PLUGIN_REPO" >&2
git -C "$PLUGIN_REPO" status --porcelain | sed -n '1,5p' >&2
echo " 先提交并推送,再发布;紧急热修可设 IWB_PUBLISH_SKIP_CHECKS=1" >&2
exit 1
fi
if ! git -C "$PLUGIN_REPO" fetch -q origin main 2>/dev/null; then
echo "⚠ 无法 fetch origin/main(离线发布可设 IWB_PUBLISH_SKIP_CHECKS=1)" >&2
fi
if git -C "$PLUGIN_REPO" rev-parse --verify -q origin/main >/dev/null 2>&1 \
&& ! git -C "$PLUGIN_REPO" merge-base --is-ancestor HEAD origin/main; then
echo "✗ 当前 HEAD 不在 origin/main 上(分支:$(git -C "$PLUGIN_REPO" rev-parse --abbrev-ref HEAD))" >&2
echo " 先把分支合进 main(纯祖先用 --ff-only)再发布,否则线上版本会与主干断链。" >&2
exit 1
fi
fi
fi
# 存储名内容寻址:plugin-<id>.<sha256前12位hex>.js(与 plugins-publish.mjs 的 storedNameOf 一致)
#
# 曾用固定名 plugin-<id>.js,2026-11-08 因此出过一次线上事故:
# 客户端缓存里还是旧字节,清单却已是新 integrity ⇒ 浏览器 SRI 判定失败,
# 报「脚本完整性校验失败(integrity 不符或加载失败)」,插件直接不可用。
# 固定名的 no-cache + ETag 只能要求「回源校验」,管不住中间层与浏览器内存缓存的旧副本。
# 内容寻址后:内容变 ⇒ 文件名变 ⇒ 新版本必然是新 URL,SRI 必中;
# 同时命中 Functions 的 IMMUTABLE_JS_RE ⇒ public, max-age=31536000, immutable。
# 代价:KV 会累积不再被清单引用的旧哈希键(无害),需要时用 plugins-publish.mjs --gc 清理。
HASH12="$(node -e 'const c=require("crypto"),fs=require("fs");process.stdout.write(c.createHash("sha256").update(fs.readFileSync(process.argv[1])).digest("hex").slice(0,12))' "$FILE")"
INTEGRITY="$(node -e 'const c=require("crypto"),fs=require("fs");process.stdout.write("sha256-"+c.createHash("sha256").update(fs.readFileSync(process.argv[1])).digest("base64"))' "$FILE")"
BASENAME="plugin-$ID.$HASH12.js"
echo "[plugins-publish] 上传 $BASENAME 到 KV(integrity=${INTEGRITY})"
npx --yes wrangler kv key put --namespace-id="$NS_ID" --remote "plugins/$BASENAME" --path="$FILE"
NEXT="$(node -e 'const cur=JSON.parse(process.argv[1]||"[]");const [id,file,ver,integ]=process.argv.slice(2);const out=cur.filter(x=>x&&x.id!==id);out.push(Object.assign({id,file},ver?{version:ver}:{},integ?{integrity:integ}:{}));out.sort((a,b)=>String(a.id).localeCompare(String(b.id)));process.stdout.write(JSON.stringify(out,null,2))' "$CUR" "$ID" "$BASENAME" "$VERSION" "$INTEGRITY")"
# 第二道保险:清单条数只允许「不变」或「+1」(新增插件),减少即视为异常。
# 只替换本次插件那一条时,条数必须与旧清单相同。
COUNT_OF='const v=JSON.parse(process.argv[1]||"[]");process.stdout.write(String(Array.isArray(v)?v.length:0))'
OLD_N="$(node -e "$COUNT_OF" "$CUR")"
NEW_N="$(node -e "$COUNT_OF" "$NEXT")"
if [ "$OLD_N" -ge 2 ] && [ "$NEW_N" -lt "$OLD_N" ]; then
echo "✗ 清单条数将从 ${OLD_N} 降到 ${NEW_N} —— 拒绝写入。" >&2
echo " 正常发布只替换本插件那一条,条数不应减少。检查线上清单是否被并发改动。" >&2
exit 1
fi
echo "[plugins-publish] 清单:${OLD_N} 条 → ${NEW_N} 条"
TMP="$(mktemp)"; printf '%s\n' "$NEXT" > "$TMP"
npx --yes wrangler kv key put --namespace-id="$NS_ID" --remote "plugins/index.json" --path="$TMP"
# 本地快照同步:本脚本直写 KV、绕开 git,但仓库里那份 plugins/index.json 是「线上清单应有的样子」
# 的记录。不同步的后果不是「少个文件」,而是下次有人(或旧脚本)拿这份旧文件当基线发布时,
# 把线上清单**整体回退**到旧版本 —— 2026-11-03 就因此把 7 条塌成 1 条。
# 这里只写文件不提交,让 git status 把它亮出来。
printf '%s\n' "$NEXT" > "$ROOT/plugins/index.json"
echo "[plugins-publish] 本地 plugins/index.json 已同步(记得提交)"
echo "[plugins-publish] 已发布 ${ID} (${BASENAME}${VERSION:+ @$VERSION})"
# 发布即可反查:打 插件id@版本 tag(仅在 HEAD 已确认在 origin/main 上时)
if [ -n "$VERSION" ] && [ -n "${PLUGIN_REPO:-}" ] && [ "${IWB_PUBLISH_SKIP_CHECKS:-0}" != "1" ]; then
TAG="$ID@$VERSION"
if git -C "$PLUGIN_REPO" rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then
echo "[plugins-publish] tag $TAG 已存在,跳过"
else
git -C "$PLUGIN_REPO" tag -a "$TAG" -m "插件发布:$ID ${VERSION}(KV 已上线)"
echo "[plugins-publish] 已打 tag $TAG → 记得:git -C \"$PLUGIN_REPO\" push origin \"$TAG\""
fi
fi
echo "→ 刷新浏览器即生效。管理面板「插件管理」→「远程加载(KV)」可看到状态。"
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# 发版/构建前的统一体检(只读)。
set -uo pipefail
cd "$(dirname "$0")/.."
fail=0
ok() { printf " ok %s\n" "$1"; }
bad() { printf " FAIL %s\n" "$1"; fail=1; }
echo "== 1. 工作区"
dirty=$(git status --porcelain | grep -v -E '^(\?\? (PLUGIN-API-GOVERNANCE-ISSUE|docs/ISSUE-REPLIES|icon\.png))' || true)
if [ -z "$dirty" ]; then ok "无未提交改动(长期未跟踪文件除外)"; else bad "存在未提交改动"; printf "%s\n" "$dirty" | sed 's/^/ /'; fi
echo "== 2. 版本号三处一致"
v1=$(node -p 'require("./package.json").version' 2>/dev/null)
v2=$(node -p 'require("./src-tauri/tauri.conf.json").version' 2>/dev/null)
v3=$(grep -m1 '^version = ' src-tauri/Cargo.toml | cut -d'"' -f2)
if [ "$v1" = "$v2" ] && [ "$v1" = "$v3" ]; then ok "版本 $v1"; else bad "版本不一致 pkg=$v1 tauri=$v2 cargo=$v3"; fi
echo "== 3. 构建单实例"
if pgrep -f 'tauri build|cargo build --bins' >/dev/null 2>&1; then bad "已有构建在跑(等它结束,避免抢锁)"; else ok "无并行构建"; fi
echo "== 4. 插件两仓一致"
if node scripts/check-plugins-sync.js >/dev/null 2>&1; then ok "plugins/ 与源仓一致"; else bad "插件两仓不一致(跑 sync-plugins-from-repo.js)"; fi
echo "== 5. 设计 token 快照"
if npm run -s tokens:check >/dev/null 2>&1; then ok "tokens 无漂移"; else bad "tokens 漂移(npm run tokens:check 看详情)"; fi
echo "== 6. 文档过期写法"
# B1(2026-12-02):现行文档里不得再出现已下线的路径/命令;历史说明用 ~~删除线~~ 或「已弃用/已移除」等词豁免。
stale=$(grep -rnE 'functions/api|functions/plugins|verify:release|plugins-publish|wrangler|_inbox' \
README.md CONTRIBUTING.md PUBLISHING.md docs/standards docs/reference 2>/dev/null \
| grep -v '~~' \
| grep -vE '已删除|已下线|已停用|已移除|已废弃|已弃用|已不存在|已无|不再|删除|废弃|历史|旧|曾' || true)
if [ -z "$stale" ]; then ok "无过期写法(functions/api、verify:release、plugins-publish、_inbox、wrangler)"; else bad "仍有过期写法"; printf "%s\n" "$stale" | sed 's/^/ /' | head -8; fi
echo
if [ "$fail" = "0" ]; then echo "preflight: 通过"; else echo "preflight: 有问题,见上"; fi
exit "$fail"
+11
View File
@@ -135,6 +135,17 @@ if git rev-parse --git-dir >/dev/null 2>&1; then
fi
fi
# == 发布产物一致性自检(2026-12-02)==
# 动机:183 发布时发现 NAS 上 182 的产物被残留后台脚本覆盖,而 releases.json 仍记旧字节,
# 用户下载到错字节却没有任何报错。这里在发布收尾做机械核对(最近 5 个版本 HEAD 比对 size),
# 不一致就非零退出 —— release.sh 会因此停在上传/登记之前,避免把错记录继续带出去。
if node scripts/audit-release-files.js; then
echo "== 产物一致性:通过"
else
echo "✗ 发布产物与 site/releases.json 不一致(见上)—— 先修产物或登记,再继续发版" >&2
exit 1
fi
echo "== 完成:https://download.maqiart.eu.org/updates/latest.json"
curl -s -m 15 https://download.maqiart.eu.org/updates/latest.json | head -c 200; echo
+1 -1
View File
@@ -30,7 +30,7 @@ echo " $OUT"
echo " size=$SIZE sha256=$SHA"
echo "== 2/4 用正式私钥签名"
npx tauri signer sign -f "$KEY" -p "${TAURI_SIGNING_PRIVATE_KEY_PASSWORD:-}" --app-version "$V" "$OUT" >/dev/null
env -u TAURI_SIGNING_PRIVATE_KEY npx tauri signer sign -f "$KEY" -p "${TAURI_SIGNING_PRIVATE_KEY_PASSWORD:-}" --app-version "$V" "$OUT" >/dev/null
SIG_FILE="$OUT.sig"
[ -f "$SIG_FILE" ] || { echo "签名失败:没有产出 $SIG_FILE"; exit 1; }
echo " .sig $(wc -c < "$SIG_FILE" | tr -d ' ') 字节"
+143
View File
@@ -0,0 +1,143 @@
#!/usr/bin/env node
'use strict'
/* 发布后验收(2026-12-02)
*
* 为什么有它:v3.26.183 发布时踩过两次坑 ——
* ① 一个残留后台脚本把 NAS 上的产物覆盖成别的版本,releases.json 仍记旧字节;
* ② latest.json / latest-windows.json / 站点 releases.json 三处版本一度不同步。
* 这两个问题当时全靠人工比对才发现。本脚本把「发布后该核对什么」变成一条命令。
*
* 核对项:
* 1) latest.json / latest-windows.json / site/releases.json / package.json 四处版本一致
* 2) 三平台齐全(darwin-aarch64 / darwin-x86_64 / windows-x86_64),且 latest.json 的 URL 指向同一版本文件
* 3) releases.json 里每条记录的 size(HEAD)与 sha256(下载校验,--fast 可跳过)与线上实际一致
* 4) 下载页 HTML 含当前版本号
*
* 用法:
* npm run release:verify # 完整(会下载 dmg/exe 核对 sha256,约 30~60s)
* npm run release:verify -- --fast # 只 HEAD 比对 size
* 退出码:0 通过;1 有不一致
*/
const fs = require('fs')
const path = require('path')
const https = require('https')
const http = require('http')
const crypto = require('crypto')
const BASE = (process.env.IWB_RELEASE_BASE || 'https://download.maqiart.eu.org/').replace(/\/?$/, '/')
const FAST = process.argv.includes('--fast')
const root = path.resolve(__dirname, '..')
const PLATS = ['darwin-aarch64', 'darwin-x86_64', 'windows-x86_64']
const rows = []
let failed = 0
const add = (ok, name, detail, warnOnly) => {
if (!ok && !warnOnly) failed++
rows.push({ ok, warnOnly: !!warnOnly, name, detail })
console.log(' ' + (ok ? '✓' : (warnOnly ? '!' : '✗')) + ' ' + String(name).padEnd(22) + ' ' + (detail || ''))
}
function req (url, method) {
return new Promise((resolve, reject) => {
const lib = url.indexOf('https:') === 0 ? https : http
const r = lib.request(url, { method, headers: { 'cache-control': 'no-cache' } }, (res) => {
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
res.resume(); return resolve(req(new URL(res.headers.location, url).toString(), method))
}
if (method === 'GET') {
const hash = crypto.createHash('sha256'); let bytes = 0; const chunks = []
res.on('data', (c) => { bytes += c.length; hash.update(c); chunks.push(c) })
res.on('end', () => resolve({ status: res.statusCode, size: bytes, sha256: hash.digest('hex'), body: Buffer.concat(chunks) }))
res.on('error', reject); return
}
res.resume()
resolve({ status: res.statusCode, size: Number(res.headers['content-length'] || 0) })
})
r.on('error', reject)
r.setTimeout(20000, () => r.destroy(new Error('timeout')))
r.end()
})
}
async function getJson (url) {
const r = await req(url + (url.indexOf('?') >= 0 ? '&' : '?') + 'x=' + Date.now(), 'HEAD')
if (r.status !== 200) throw new Error('HTTP ' + r.status)
const g = await req(url + (url.indexOf('?') >= 0 ? '&' : '?') + 'x=' + Date.now(), 'GET')
if (g.status !== 200) throw new Error('HTTP ' + g.status)
return JSON.parse(g.body.toString('utf8'))
}
;(async () => {
console.log('发布验收 ' + BASE + (FAST ? '(fast:跳过 sha256)' : ''))
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'))
const site = JSON.parse(fs.readFileSync(path.join(root, 'site', 'releases.json'), 'utf8'))
let latest = null, win = null
try { latest = await getJson(BASE + 'updates/latest.json') } catch (e) { add(false, 'latest.json', '拉取失败:' + e.message) }
try { win = await getJson(BASE + 'updates/latest-windows.json') } catch (e) { add(false, 'latest-windows.json', '拉取失败:' + e.message) }
const rel = (site.releases || [])[0] || {}
const vLatest = latest && latest.version
const vWin = win && win.version
const vSite = rel.version
const vPkg = pkg.version
add(!!vLatest, 'latest.json', vLatest ? ('v' + vLatest + '(' + Object.keys(latest.platforms || {}).length + ' 平台)') : '缺失')
add(!!vWin, 'latest-windows.json', vWin ? ('v' + vWin) : '缺失')
add(!!vSite, 'site/releases.json', vSite ? ('v' + vSite + '(' + Object.keys(rel.platforms || {}).length + ' 平台)') : '缺失')
add(vPkg === vLatest || vPkg === vSite, 'package.json', 'v' + vPkg + (vPkg === vLatest ? '' : '(与线上不一致,发布前正常)'), true)
if (vLatest && vWin && vSite) {
add(vLatest === vWin, '三处版本一致', vLatest === vWin ? 'latest == latest-windows' : ('latest ' + vLatest + ' ≠ windows ' + vWin))
add(vLatest === vSite, '三处版本一致', vLatest === vSite ? 'latest == releases.json' : ('latest ' + vLatest + ' ≠ releases ' + vSite))
}
// 平台齐全 + latest.json 的 URL 与 releases.json 指向同一文件
for (const p of PLATS) {
const lp = latest && latest.platforms && latest.platforms[p]
const rp = rel.platforms && rel.platforms[p]
const ok = !!(lp && rp)
add(ok, '平台 ' + p, ok ? 'latest + releases 都有' : ('缺 ' + (lp ? '' : 'latest.json ') + (rp ? '' : 'releases.json')))
if (ok) {
const lb = String(lp.url || '').split('/').pop()
const rb = String(rp.file || '').split('/').pop()
// mac:更新器拿 .app.tar.gz、下载页给 .dmg(本来就是两个文件);win:两者都是同一个 setup.exe
const wantUpdater = p === 'windows-x86_64' ? /\.exe$/ : /\.app\.tar\.gz$/
const wantDownload = p === 'windows-x86_64' ? /\.exe$/ : /\.dmg$/
add(wantUpdater.test(lb) && wantDownload.test(rb), ' 文件形态', lb + ' / ' + rb)
add(String(lp.signature || '').length > 100, ' 签名非空', String((lp.signature || '').length) + ' B')
add(lb.indexOf(vLatest) >= 0 && rb.indexOf(vLatest) >= 0, ' 文件名含版本', lb + ' / ' + rb)
}
}
// 资产实体:size + sha256
for (const [p, item] of Object.entries(rel.platforms || {})) {
const url = BASE + String(item.file || '')
let h
try { h = await req(url, 'HEAD') } catch (e) { add(false, '资产 ' + p, '请求失败:' + e.message); continue }
if (h.status !== 200) { add(false, '资产 ' + p, 'HTTP ' + h.status); continue }
const sizeOk = h.size === Number(item.size || 0)
add(sizeOk, '资产 ' + p, sizeOk ? (h.size + ' B') : ('线上 ' + h.size + ' B ≠ 记录 ' + item.size + ' B(文件可能被覆盖)'))
if (!sizeOk) continue
if (FAST) continue
try {
const g = await req(url, 'GET')
const shaOk = g.sha256 === String(item.sha256 || '')
add(shaOk, ' sha256 ' + p, shaOk ? (g.sha256.slice(0, 12) + '…') : ('线上 ' + g.sha256.slice(0, 12) + '… ≠ 记录 ' + String(item.sha256 || '').slice(0, 12) + '…'))
} catch (e) { add(false, ' sha256 ' + p, '下载失败:' + e.message) }
}
// 下载页
try {
const g = await req(BASE + 'download/?x=' + Date.now(), 'GET')
const html = g.body.toString('utf8')
add(g.status === 200 && html.indexOf(vLatest) >= 0, '下载页', g.status === 200 ? (html.indexOf(vLatest) >= 0 ? '含 v' + vLatest : ('未出现 v' + vLatest)) : ('HTTP ' + g.status))
} catch (e) { add(false, '下载页', '请求失败:' + e.message) }
console.log('')
if (failed) {
console.error('验收失败:' + failed + ' 项不一致(见上 ✗)')
process.exit(1)
}
console.log('验收通过:' + rows.filter((r) => r.ok).length + ' 项')
})().catch((e) => { console.error('验收异常:' + (e && e.message)); process.exit(1) })
+1 -1
View File
@@ -10,7 +10,7 @@ const crypto = require('crypto')
const root = path.resolve(__dirname, '..')
const srcRoot = process.argv[2] ? path.resolve(process.argv[2]) : path.resolve(root, '..', 'iwb-plugins-desktop')
const outDir = path.join(root, 'plugins', 'runtime')
const IDS = ['album', 'batch-export', 'blank-canvas', 'browser', 'gallery', 'grouplib', 'promptlib', 'image-annotate', 'image-vectorize', 'sticky', 'style-source', 'white-bg-800', 'xianyi-cutout']
const IDS = ['album', 'batch-export', 'blank-canvas', 'browser', 'gallery', 'grouplib', 'promptlib', 'image-annotate', 'image-vectorize', 'sticky', 'style-source', 'white-bg-800', 'xianyi-cutout', 'taskqueue']
// v3.25.41(M1):目录化插件试点 —— 这些 id 产出 <id>/{manifest.json,main.js},其余仍是单文件(双轨兼容)
// ⚠️ 2026-11-20 修正:桌面包不随包发插件(scripts/strip-plugins.js),插件只能从市场装,
// 而市场目前只支持单文件 ⇒ 目录形态暂不用于生产插件,等 M3(zip 安装)落地再启用。
-175
View File
@@ -1,175 +0,0 @@
#!/usr/bin/env node
/**
* 发布核验(基于 version.json):一次检查三个线上地址的 version.json 是否与 package.json 一致。
*
* 为什么需要:每次发布我都要手工 curl 三个地址比对版本;且要注意
* —— **docs-only 提交**会让本地 git sha 与线上 sha 不同(线上仍是上一个代码提交),
* 因此本脚本**只强校验版本号**,commit 仅作信息展示,避免误报失败 ✗。
*
* 校验方式:抓取 `<host>/version.json?cb=<ts>`,JSON 解析后比对 `.version`
* 与 `v<packageVersion>`(接受精确 `v<ver>` 或前缀 `v<ver>+`)。
*
* ── 严格模式(2026-10-20 新增)────────────────────────────────────────
* 背景(为什么会加):2026-10-20 实测发现**线上跑着 `f414fd8`,而 `origin/main` 仍是 `7a48e4b`** ——
* 那 4 个 commit **不在任何远端 ref 上**。根因:`npm run deploy` = `verify` + `wrangler pages deploy`,
* **不含 git push**;而 `PUBLISHING.md` 把 push 写在部署**之前**的第 4 步 —— 顺序没错,但**没有校验**
* 「push 的 commit == 部署的 commit」是否真的成立 ⇒ 于是部署了没推送的代码。
* 后果:本机故障 / 误 reset ⇒ **线上正在跑的代码永久丢失**,回滚只能退到 stable。
* 严格模式把「事后才发现」变成「当场拦截」:抓线上 version.json 的 `.commit`,
* 校验它**是 `origin/main` 的祖先**(= 线上代码可从远端恢复)。
* 不会误报 docs-only 提交:那种情况下线上 commit 是上一个**代码**提交,它仍在 origin/main 的历史里。
*
* 用法:
* node scripts/verify-release.js # 默认:只强校验版本号(行为不变)
* IWB_VERIFY_STRICT=1 node scripts/verify-release.js # 严格:额外校验线上代码可从远端恢复
* node scripts/verify-release.js --check-commit # 同上(等价写法)
*
* 退出码:0 = 三个地址版本一致且与 package.json 相同;1 = 有地址不可达/缺 version.json/版本不一致/
* 三地址分歧/(严格模式)线上代码未推送到远端
*/
const fs = require('fs')
const path = require('path')
const https = require('https')
const { execFileSync } = require('child_process')
// 严格模式:额外校验「线上代码在远端可恢复」。默认关闭 —— 保持既有调用行为不变。
const STRICT = process.env.IWB_VERIFY_STRICT === '1' || process.argv.includes('--check-commit')
const ROOT = path.join(__dirname, '..')
const URLS = [
'https://iwb.maqiart.eu.org',
'https://image-workbench-web.pages.dev',
'https://test.image-workbench-web.pages.dev',
]
const version = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')).version
function get(url, redirect) {
return new Promise((resolve) => {
const req = https.get(url + '/version.json?cb=' + Date.now(), { timeout: 20000 }, (res) => {
if ([301, 302, 307, 308].includes(res.statusCode) && res.headers.location && (redirect || 0) < 3) {
res.resume()
return resolve(get(res.headers.location, (redirect || 0) + 1))
}
let body = ''
res.setEncoding('utf8')
res.on('data', (c) => { body += c })
res.on('end', () => resolve({ ok: res.statusCode === 200, status: res.statusCode, body }))
})
req.on('timeout', () => { req.destroy(); resolve({ ok: false, status: 0, body: '', error: 'timeout' }) })
req.on('error', (e) => resolve({ ok: false, status: 0, body: '', error: String(e && e.message || e) }))
})
}
function parseVersion(body) {
try {
const meta = JSON.parse(body || '')
return meta && typeof meta.version === 'string' ? { version: meta.version, commit: meta.commit || '' } : null
} catch (e) {
return null
}
}
const okVersion = (v) => v === 'v' + version || v.indexOf('v' + version + '+') === 0
// 一致性比较必须用「去掉 +commit 后缀」的版本号。
// 为什么(2026-11-14 踩到):version.json 的 version 形如 `v3.24.84+c8b7543`,后缀是**部署时的 commit**。
// 正式站与测试站天然可能指向不同 commit —— 最常见的正是 **docs-only 提交**(正式站部署的是含文档提交的
// 这次 HEAD,测试站还停在上一版代码提交)⇒ 完整字符串永不相等 ⇒ 每次发布都误报「三地址版本不一致」,
// 重试 3 轮后失败。而「线上代码是否一致 / 可恢复」是严格模式单独判定的事(见下方 uniqCommits),
// 不该混进版本一致性里,否则真出问题时这个 ✗ 已经没人当回事了。
const baseVersion = (v) => String(v || '').split('+')[0]
// ── 严格模式:线上代码是否可从远端恢复 ──────────────────────────────────
// 判据:线上 commit 必须是 `origin/main` 的祖先(即远端历史里含它)。
// - 远端还没有该 commit ⇒ 线上跑的是**只存在于本机**的代码 ⇒ 不可恢复 ⇒ 失败。
// - 远端历史里含它 ⇒ 即使本机故障,也能从远端 checkout 出来 ⇒ 通过。
// 注意用 `merge-base --is-ancestor` 而不是「等于」:docs-only 提交后线上 commit
// 是上一个**代码**提交,它仍是 origin/main 的祖先 —— 这正是我们要的语义。
function isReachableFromRemote(commit) {
try {
execFileSync('git', ['merge-base', '--is-ancestor', commit, 'origin/main'], {
cwd: ROOT,
stdio: 'ignore',
})
return { ok: true }
} catch (e) {
return { ok: false, reason: '不是 origin/main 的祖先(远端历史里找不到它)' }
}
}
;(async () => {
console.log('期望版本(package.json): v' + version)
if (STRICT) console.log('严格模式:额外校验「线上代码可从远端恢复」')
let bad = 0
const seen = new Map()
const commits = new Map()
for (const u of URLS) {
const r = await get(u)
if (!r.ok) {
console.log(' ✗ ' + u + ' 不可达(' + (r.error || 'HTTP ' + r.status) + ')')
bad++
continue
}
const meta = parseVersion(r.body)
if (!meta || !meta.version) { console.log(' ✗ ' + u + ' 缺少/无法解析 version.json'); bad++; continue }
const okVer = okVersion(meta.version)
if (!okVer) bad++
seen.set(baseVersion(meta.version), (seen.get(baseVersion(meta.version)) || 0) + 1)
if (meta.commit) commits.set(meta.commit, (commits.get(meta.commit) || 0) + 1)
console.log(' ' + (okVer ? '✓' : '✗') + ' ' + u.padEnd(46) + ' ' + meta.version + ' commit=' + (meta.commit || '-'))
}
const uniq = [...seen.keys()]
if (uniq.length > 1) { console.log(' ✗ 三个地址版本不一致: ' + uniq.join(' / ')); bad++ }
// 部署后 CDN 传播有延迟(实测首次运行会假失败 ✗)⇒ 版本不一致时退避重试,最多 3 轮
if (bad && process.env.IWB_VERIFY_NO_RETRY !== '1') {
for (let attempt = 1; attempt <= 3 && bad; attempt++) {
console.log(' … 版本未收敛,' + (attempt * 10) + 's 后重试(第 ' + attempt + '/3 轮)')
await new Promise((r) => setTimeout(r, attempt * 10000))
let bad2 = 0
const seen2 = new Map()
for (const u of URLS) {
const r = await get(u)
const meta = r.ok ? parseVersion(r.body) : null
const v = meta ? meta.version : ''
if (!v || !okVersion(v)) bad2++
if (v) seen2.set(baseVersion(v), (seen2.get(baseVersion(v)) || 0) + 1)
}
if (seen2.size > 1) bad2++
if (!bad2) { console.log(' ✓ 重试后已收敛'); bad = 0; break }
bad = bad2
}
}
if (bad) { console.log('发布核验失败(' + bad + ' 项)'); process.exit(1) }
// ── 严格模式:线上代码必须在远端可恢复 ────────────────────────────────
// 与版本校验分开判定:版本对但代码没推送 ⇒ 仍是事故(只是暂时没出事)。
if (STRICT) {
const uniqCommits = [...commits.keys()]
if (uniqCommits.length === 0) {
console.log(' ✗ 严格模式:无法确定线上 commit(version.json 里没有 .commit 字段)')
console.log('发布核验失败:线上代码可恢复性无法确认')
process.exit(1)
}
let strictBad = 0
for (const c of uniqCommits) {
const reach = isReachableFromRemote(c)
if (reach.ok) {
console.log(' ✓ 线上代码可从 origin/main 恢复:' + c)
} else {
strictBad++
console.log(' ✗ 线上代码 ' + c + ' ' + reach.reason + ' ⇒ 该代码**只存在于本机**,本机故障即永久丢失')
console.log(' 修复:git push origin main && git tag -f stable HEAD && git push -f origin stable')
}
}
if (strictBad) {
console.log('发布核验失败:' + strictBad + ' 项(线上代码未推送到远端)')
process.exit(1)
}
console.log('发布核验通过:三地址一致 + 线上代码可从远端恢复 ✓')
return
}
console.log('发布核验通过:三地址一致且与 package.json 匹配 ✓(commit 仅信息展示,docs-only 提交时线上可能仍是上一个代码提交)')
console.log('提示:用 IWB_VERIFY_STRICT=1 或 --check-commit 可额外校验「线上代码已推送到远端」')
})()
+17 -5
View File
@@ -3,7 +3,7 @@
<title>插件开发规范 · Image Workbench</title>
<link rel="icon" href="/assets/favicon.png" type="image/png">
<link rel="apple-touch-icon" href="/assets/logo.png">
<link rel="stylesheet" href="/assets/style.css?v=3.26.145-mx3htd9y">
<link rel="stylesheet" href="/assets/style.css?v=3.26.238-mx7aia6a">
<style>
.devdoc{max-width:860px;margin:0 auto;padding:40px 0 72px;color:var(--ink,#1b1f24);font-size:15px;line-height:1.75}
.devdoc h1{font-size:38px;line-height:1.2;margin:8px 0 18px}
@@ -33,7 +33,7 @@
</div>
<div class="right">
<a class="btn" href="/plugins/">插件市场</a>
<a class="btn primary" href="/download/">下载 v3.26.145</a>
<a class="btn primary" href="/download/">下载 v3.26.238</a>
</div>
</div></nav>
<main>
@@ -77,14 +77,26 @@
<tr><td>panels</td><td>ctx.ui</td><td>侧栏/独立面板注册</td></tr>
<tr><td>promptlib</td><td>ctx.promptlib</td><td>提示词库数据 + 文件 + 备份</td></tr>
<tr><td>nodeTypes</td><td>ctx.nodes</td><td>画布节点类型注册</td></tr>
<tr><td>canvas</td><td>ctx.canvas</td><td>只读:getNodes / getSelectedNode / screenToWorld</td></tr>
<tr><td>canvasWrite</td><td>ctx.canvasWrite</td><td>写入:createNode / createImageNode / setNodeImage</td></tr>
<tr><td>canvas</td><td>ctx.canvas</td><td>读:getNodes / getSelectedNode / getNodeImage / screenToWorld</td></tr>
<tr><td>canvasWrite</td><td>ctx.canvas(<strong>合并,没有 ctx.canvasWrite</strong>)</td><td>写:createNode / createImageNode / setNodeImage / saveNodeImage</td></tr>
<tr><td>nodeActions</td><td>ctx.nodeActions</td><td>节点右键/气泡动作</td></tr>
<tr><td>commands</td><td>ctx.commands</td><td>命令面板</td></tr>
<tr><td>settings</td><td>ctx.settings</td><td>KV 配置</td></tr>
<tr><td>data</td><td>ctx.data</td><td>插件数据文件</td></tr>
</tbody></table>
<p><strong>注意</strong>:createNode 在 ctx.canvasWrite,不在 ctx.canvas。调错只会提示“宿主不支持”。</p>
<p><strong>注意</strong>:<code>CAPABILITY_API_KEYS</code> 把 canvasWrite 的接口<strong>合并进 <code>ctx.canvas</code></strong>(<code>src/plugin-host.js</code>);</p>
<p><code>ctx.canvasWrite</code> 并不存在,但 manifest 的 <code>capabilities</code> 仍须同时声明 <code>canvas</code> 与 <code>canvasWrite</code>,否则拿不到写接口。</p>
<p>调错只会提示“宿主不支持”。</p>
<p><strong>图片写回契约(v3.26.183,改前必读)</strong>:</p>
<table><thead><tr><th>接口</th><th>语义</th><th>用法</th></tr></thead><tbody>
<tr><td><code>ctx.canvas.setNodeImage(id, dataUrl)</code></td><td><strong>同步</strong>返回严格布尔;只改内存 + 失效缓存 + 重渲染,<strong>不落盘</strong></td><td>只要“立刻显示”的场景(blank-canvas 填白图、white-bg-800 覆盖)</td></tr>
<tr><td><code>ctx.canvas.saveNodeImage(id, dataUrl)</code></td><td>返回 <code>Promise&lt;{ok, error}&gt;</code>;落盘 + 回读校验,失败<strong>回滚旧图</strong>并给原因</td><td>用户编辑成果必须落地的场景(image-annotate 覆盖)</td></tr>
<tr><td><code>ctx.canvas.createImageNode({ dataUrl, name, x?, y? })</code></td><td><strong>同步</strong>返回节点 id;超过内联阈值的图由宿主后台引用化</td><td>生成新图(白底新建、抠图、矢量化、插图)</td></tr>
</tbody></table>
<ul>
<li>大图(&gt; 宿主内联阈值,现 3000 字符)会被宿主转成本地引用,<code>getNodeImage</code> 仍返回 dataUrl,插件无需感知。</li>
<li><code>getNodes()</code> 返回的 <code>data</code> 是<strong>只读视图</strong>:不要原地改,宿主不会失效缩略图/触发保存;写图只走上面三个接口。</li>
</ul>
<h2>3. 面板</h2>
<pre><code>ctx.ui.registerPanel({
id: 'my-panel',
+59 -7
View File
@@ -57,18 +57,18 @@
<h2>下载</h2>
<div class="row">
<div class="name">macOS · Apple Silicon<div class="hint">M1 / M2 / M3 / M4</div></div>
<div class="meta">版本 3.26.145 · 9.7 MB · .dmg<div class="hash">sha256 a9a3840b3368021a…</div></div>
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.145_aarch64.dmg?h=a9a3840b3368">下载</a>
<div class="meta">版本 3.26.238 · 9.7 MB · .dmg<div class="hash">sha256 9ecea14ff71c7ef0…</div></div>
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.238_aarch64.dmg?h=9ecea14ff71c">下载</a>
</div>
<div class="row">
<div class="name">macOS · Intel<div class="hint">x86_64</div></div>
<div class="meta">版本 3.26.145 · 10.1 MB · .dmg<div class="hash">sha256 ff13e4950e97699c…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.145_x64.dmg?h=ff13e4950e97">下载</a>
<div class="meta">版本 3.26.238 · 10.1 MB · .dmg<div class="hash">sha256 0cef46585d874ba2…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.238_x64.dmg?h=0cef46585d87">下载</a>
</div>
<div class="row">
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
<div class="meta">版本 3.26.135 · 5.4 MB · .exe<div class="hash">sha256 c70be225a8a0a176…</div></div>
<a class="btn" href="/updates/windows-x86_64/image-workbench_3.26.135_x64-setup.exe?h=c70be225a8a0">下载</a>
<div class="meta">版本 3.26.238 · 5.3 MB · .exe<div class="hash">sha256 d77c051770a139d5…</div></div>
<a class="btn" href="/updates/windows-x86_64/image-workbench_3.26.238_x64-setup.exe?h=d77c051770a1">下载</a>
</div>
<h2>系统要求</h2>
@@ -97,6 +97,58 @@
</ol>
<h2>历史版本</h2>
<div class="row">
<div class="name">3.26.238<div class="hint">任务队列页头/页签固定;图片读取/下载本地优先 + 命名统一图库行名</div></div>
<div class="meta">2026-12-03<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.26.184</div>
<div class="meta">2026-12-02<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.26.183</div>
<div class="meta">2026-12-02<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.26.169</div>
<div class="meta">2026-12-01<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.26.154</div>
<div class="meta">2026-11-30<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.26.153</div>
<div class="meta">2026-11-30<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.152</div>
<div class="meta">2026-11-30<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.26.151</div>
<div class="meta">2026-11-30<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.26.150</div>
<div class="meta">2026-11-30<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.149</div>
<div class="meta">2026-11-30<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.148</div>
<div class="meta">2026-11-30<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.147</div>
<div class="meta">2026-11-30<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.146</div>
<div class="meta">2026-11-30<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.145</div>
<div class="meta">2026-11-30<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
@@ -779,7 +831,7 @@
</div>
<div class="foot">
本页由 <code>scripts/gen-release-page.js</code> 从 releases.json 生成 · 源码 <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop">git.maqiart.eu.org</a> · 更新于 2026-11-30
本页由 <code>scripts/gen-release-page.js</code> 从 releases.json 生成 · 源码 <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop">git.maqiart.eu.org</a> · 更新于 2026-12-03
</div>
</div></div>
+13 -13
View File
@@ -4,7 +4,7 @@
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
<link rel="icon" href="/assets/favicon.png" type="image/png">
<link rel="apple-touch-icon" href="/assets/logo.png">
<link rel="stylesheet" href="/assets/style.css?v=3.26.145-mx3htd9y">
<link rel="stylesheet" href="/assets/style.css?v=3.26.238-mx7aia6a">
</head><body>
<nav><div class="wrap inner">
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
@@ -17,20 +17,20 @@
</div>
<div class="right">
<a class="btn" href="/plugins/">插件市场</a>
<a class="btn primary" href="/download/">下载 v3.26.145</a>
<a class="btn primary" href="/download/">下载 v3.26.238</a>
</div>
</div></nav>
<main>
<section class="hero hero-art">
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.145-mx3htd9y" alt=""></div>
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.238-mx7aia6a" alt=""></div>
<div class="hero-veil"></div>
<div class="wrap">
<span class="kicker">v3.26.145 · macOS / Windows · 数据在本地</span>
<span class="kicker">v3.26.238 · macOS / Windows · 数据在本地</span>
<h1>本地优先的<br>AI 生图无限画布</h1>
<p class="sub">用节点把「参考图 → 提示词 → 批量生成 → 图库」串成一条生产线。<br>图片、提示词、模型配置全部留在你自己的电脑里,插件按需安装。</p>
<div class="cta">
<a class="btn primary lg" href="/download/">下载 v3.26.145</a>
<a class="btn lg" href="/plugins/">浏览 13 个插件</a>
<a class="btn primary lg" href="/download/">下载 v3.26.238</a>
<a class="btn lg" href="/plugins/">浏览 14 个插件</a>
</div>
<div class="meta">支持 macOS 12+ 与 Windows 10 1803+ · 安装包约 7 MB · 无需登录</div>
</div></section>
@@ -55,7 +55,7 @@
<div class="grid c3">
<div class="pcard" data-name="相册 album 一个节点装多张本地图片:宫格随节点尺寸自适应分页,一图一任务 / 批量两种模式,批量生图不用再摆一堆图片节点 图片 批量 出图" data-tags="图片,批量,出图">
<div class="head"><span class="av" style="background:#eef2f6">🖼️</span>
<div><div class="nm">相册</div><div class="ver">v1.2.4 · 官方</div></div></div>
<div><div class="nm">相册</div><div class="ver">v1.2.5 · 官方</div></div></div>
<div class="desc">一个节点装多张本地图片:宫格随节点尺寸自适应分页,一图一任务 / 批量两种模式,批量生图不用再摆一堆图片节点</div>
<div class="tags"><span class="tag">图片</span><span class="tag">批量</span><span class="tag">出图</span></div>
</div>
@@ -67,7 +67,7 @@
</div>
<div class="pcard" data-name="空白画布 blank-canvas 新建空白画布节点,用于分区分组 画布 效率" data-tags="画布,效率">
<div class="head"><span class="av" style="background:#eef2f6">⬜</span>
<div><div class="nm">空白画布</div><div class="ver">v1.0.0 · 官方</div></div></div>
<div><div class="nm">空白画布</div><div class="ver">v1.0.1 · 官方</div></div></div>
<div class="desc">新建空白画布节点,用于分区分组</div>
<div class="tags"><span class="tag">画布</span><span class="tag">效率</span></div>
</div>
@@ -79,7 +79,7 @@
</div>
<div class="pcard" data-name="图库 gallery 右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供) 资源 图库" data-tags="资源,图库">
<div class="head"><span class="av" style="background:#eef2f6">🖼️</span>
<div><div class="nm">图库</div><div class="ver">v1.9.8 · 官方</div></div></div>
<div><div class="nm">图库</div><div class="ver">v1.9.12 · 官方</div></div></div>
<div class="desc">右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">图库</span></div>
</div>
@@ -90,15 +90,15 @@
<div class="tags"><span class="tag">资源</span><span class="tag">节点组</span></div>
</div>
</div>
<div style="margin-top:22px"><a class="btn" href="/plugins/">查看全部 13 个插件</a></div>
<div style="margin-top:22px"><a class="btn" href="/plugins/">查看全部 14 个插件</a></div>
</div></section>
<section class="section"><div class="wrap">
<h2>下载 Image Workbench</h2>
<p class="lead">选你的平台。装过一次之后,以后在应用内「设置 → 通用 → 版本与更新」就能一键升级。</p>
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.145_aarch64.dmg?h=a9a3840b3368"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 9.7 MB · .dmg</div></a>
<a href="/updates/darwin-x86_64/image-workbench_3.26.145_x64.dmg?h=ff13e4950e97"><div class="n">macOS · Intel</div><div class="s">x86_64 · 10.1 MB · .dmg</div></a>
<div class="none"><div class="n">Windows · x64</div><div class="s">暂未提供</div></div></div>
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.238_aarch64.dmg?h=9ecea14ff71c"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 9.7 MB · .dmg</div></a>
<a href="/updates/darwin-x86_64/image-workbench_3.26.238_x64.dmg?h=0cef46585d87"><div class="n">macOS · Intel</div><div class="s">x86_64 · 10.1 MB · .dmg</div></a>
<a href="/updates/windows-x86_64/image-workbench_3.26.238_x64-setup.exe?h=d77c051770a1"><div class="n">Windows · x64</div><div class="s">需要 WebView2 · 5.3 MB · .exe</div></a></div>
<div style="margin-top:20px;color:#9ca3af;font-size:12.5px">安装包未做 Apple 公证 / Windows 代码签名,首次打开需手动放行一次,细节见 <a href="/download/" style="text-decoration:underline">下载页</a>。</div>
</div></section>
</main>
+113 -79
View File
@@ -1,6 +1,6 @@
{
"version": 2,
"updatedAt": "2026-11-30T12:11:21.858Z",
"updatedAt": "2026-12-03T08:25:39.506Z",
"plugins": [
{
"id": "album",
@@ -14,26 +14,26 @@
"批量",
"出图"
],
"version": "1.2.4",
"version": "1.2.5",
"apiVersion": 1,
"bundle": "plugins/album-1.2.4.zip",
"bundleSize": 81343,
"bundleSha256": "4edd6f5bc34fc45d865e92ff153ff98b8adb94a66ec2d3b0d932773f8ce7008c",
"bundle": "plugins/album-1.2.5.zip",
"bundleSize": 81231,
"bundleSha256": "29dd3a8dbccd5cb6f9d23ba2274faf6d20d99d328477f558fbb5f7a41a77e747",
"files": [
{
"path": "manifest.json",
"sha256": "a17de056c904e9c83aca0911652c8ec69598a8435d69bc602633447df06fece2",
"sha256": "237aed8ac62bf43d8968fa3e600fdc770303525f2b3458e6f0b6b26d88ee5153",
"size": 593
},
{
"path": "main.js",
"sha256": "79ac746f0065103a32b083e2d79f16fb09fcf9032709952ba256887db1bedb4a",
"sha256": "38ec9d214ed204fc47d9ad8c82d8b3bf461c6cfbd09dbe18dc9d81061729e596",
"size": 67857
},
{
"path": "styles.css",
"sha256": "40623c831620d0082dde956300461b29b9256aab98da86c7ab5e3495214f8d49",
"size": 12583
"sha256": "63f70828151481ee96fd102e3c18baecbf51999d8fd96044aabbefdd5c2d2225",
"size": 12471
}
]
},
@@ -52,23 +52,23 @@
"apiVersion": 1,
"bundle": "plugins/batch-export-1.2.3.zip",
"bundleSize": 46021,
"bundleSha256": "e5c0912bcbf75db2d27b455f4ab0185153cbba3c509b161a8bccfc6c963e1355",
"bundleSha256": "99e40fa4e3a0c6e7fc19e8c4624445011ee638d57b92c8b808fee46854dd3bc7",
"files": [
{
"path": "manifest.json",
"sha256": "9fb16be34be882356f4022ac43063a93cb61eb1592a2006a04dd0e11839b53e5",
"sha256": "5dc47b2afe4fe6e2d7b260559341a435ad667ab2f764e1f6c1405d8a2774da94",
"size": 393
},
{
"path": "main.js",
"sha256": "e0152de8d9280163a80a4d689aadc4704dc265d7b167212ab3da9e62ab67c1bd",
"sha256": "496febf1312cfa441b627669d23c3c6f6945d300e0c5986fc02d1cfc3c283a24",
"size": 45414
}
],
"file": "plugins/plugin-batch-export.e0152de8d928.js",
"file": "plugins/plugin-batch-export.496febf1312c.js",
"size": 45414,
"sha256": "e0152de8d9280163a80a4d689aadc4704dc265d7b167212ab3da9e62ab67c1bd",
"integrity": "sha256-4BUt6NkoAWOoCk1omq3EcE3CZdexZyEqs9qeYqtnwb0="
"sha256": "496febf1312cfa441b627669d23c3c6f6945d300e0c5986fc02d1cfc3c283a24",
"integrity": "sha256-SW/r8TEs+kQbYnZp0jw8b2lF0wDgxZhvwC0c/DwoOiQ="
},
{
"id": "blank-canvas",
@@ -81,27 +81,27 @@
"画布",
"效率"
],
"version": "1.0.0",
"version": "1.0.1",
"apiVersion": 1,
"bundle": "plugins/blank-canvas-1.0.0.zip",
"bundleSize": 6674,
"bundleSha256": "b6bb7f37d7ae1ed5c0e19dacbae0050cf42b88dcdb6151385fd799443176ed7d",
"bundle": "plugins/blank-canvas-1.0.1.zip",
"bundleSize": 7021,
"bundleSha256": "3f588219048e23d869aa5b5259bc22ba68690d3df417b9c5e1df88e2d979d74b",
"files": [
{
"path": "manifest.json",
"sha256": "4ce80b37f07f900efaeddd68ef5379b755433555e4bdab222adbac509c2a21a6",
"sha256": "704c10d41877d4167d2f641c77e6d07d3b9cbe8eefe8829161aef6d0c876a9b9",
"size": 366
},
{
"path": "main.js",
"sha256": "67763893fa99c8fe1d8bcf640426f5bbc576abd35bcdc84c910b7b08f79964f9",
"size": 6094
"sha256": "80bcccc04527e3669021206c7ad98227618a74d1cfa039ab95907a5a438c6a6f",
"size": 6441
}
],
"file": "plugins/plugin-blank-canvas.67763893fa99.js",
"size": 6094,
"sha256": "67763893fa99c8fe1d8bcf640426f5bbc576abd35bcdc84c910b7b08f79964f9",
"integrity": "sha256-Z3Y4k/qZyP4di89kBCb1u8V2q9NbzchMkQt7CPeZZPk="
"file": "plugins/plugin-blank-canvas.80bcccc04527.js",
"size": 6441,
"sha256": "80bcccc04527e3669021206c7ad98227618a74d1cfa039ab95907a5a438c6a6f",
"integrity": "sha256-gLzMwEUn42aQISBsetmCJ2GKdNHPoDmrlZB6WkOMam8="
},
{
"id": "browser",
@@ -147,26 +147,26 @@
"资源",
"图库"
],
"version": "1.9.8",
"version": "1.9.12",
"apiVersion": 1,
"bundle": "plugins/gallery-1.9.8.zip",
"bundleSize": 57230,
"bundleSha256": "9f15a8c8fb6eadace5b7704e601399d0dba2ebb0ad01d42ce600cc95c1bf9ead",
"bundle": "plugins/gallery-1.9.12.zip",
"bundleSize": 58788,
"bundleSha256": "faf9e06c07e40b370867f9d28cfd0a69f6c9ddd77d7f8f4a7fdd6431a8da53e2",
"files": [
{
"path": "manifest.json",
"sha256": "204afbd3c9cfc52825ce68d5a2123411d664b0af9780dc3a330aa57d053a82e8",
"size": 526
"sha256": "2d93e891c43679101ecc86538fb5bb376fa64f8e8a098511b9e63446f5db8931",
"size": 527
},
{
"path": "main.js",
"sha256": "8586409417599dec4b0f229e88eaf937f991f1942db49df97ce9a27e16a35d9f",
"size": 47513
"sha256": "017277118b96545cd7cae386b37dca9b23a44593f53e0e858aedf901b994a153",
"size": 48954
},
{
"path": "styles.css",
"sha256": "c7db0f9d78b98c1b5bb9782c45dfc2274673c1c7d34fdf676aae41680866eb3d",
"size": 8881
"sha256": "d0479dad661370dfa23d85e4470c5885cbe38fb3b4de9097ad084c952e16d516",
"size": 8997
}
]
},
@@ -215,26 +215,26 @@
"资源",
"提示词"
],
"version": "1.14.10",
"version": "1.14.14",
"apiVersion": 1,
"bundle": "plugins/promptlib-1.14.10.zip",
"bundleSize": 190912,
"bundleSha256": "863768ef81136af63c890b82c993b3d5adc28b2992e55a830a3326d20c2b806a",
"bundle": "plugins/promptlib-1.14.14.zip",
"bundleSize": 196105,
"bundleSha256": "968e1ad0922d04ff9b396cf116ec21435961c9e3e300bea1c0d409fd95b4bd39",
"files": [
{
"path": "manifest.json",
"sha256": "24b15b2baf6262e0aa9e024f3ed67dbdf33a76be7a06324f844132aee012a161",
"sha256": "7460c3b6d8d60e9bf3400cf5d51ed6d2968122c051fdac5d132c4bcd9236ff63",
"size": 542
},
{
"path": "main.js",
"sha256": "a05ce22ad8ab2e079e313dd31d8fe34f2e2e07e017bfb782afcd08047e0b485b",
"size": 142645
"sha256": "27f5c4dd5e90ee6ae0bf7ad8ecf36bae62c2e436c2882c7c41f6272a32f7bafd",
"size": 147420
},
{
"path": "styles.css",
"sha256": "86f73b4d1c7b827f97ec1135c9130c7da6898537b2ed2ab815e282618232f56b",
"size": 47415
"sha256": "a086b172cc8261b9f346e612b5f76cc085d5a1e486657d0c656cb87c675f238c",
"size": 47833
}
]
},
@@ -253,23 +253,23 @@
"apiVersion": 1,
"bundle": "plugins/image-annotate-1.20.9.zip",
"bundleSize": 463183,
"bundleSha256": "f78212022f2cf2964e22063b8fcd3dbe4e8a331371af4c7b7284a168f3f470ee",
"bundleSha256": "d096f1d9738e8aa407ad63204103a454bdded41831bde06ee9b9f984deb2600b",
"files": [
{
"path": "manifest.json",
"sha256": "2d27bb11e77543bdc6f690aa4dcc65b777fa3f4cce6c1017b476707f525c4db1",
"sha256": "d1bc4c260c7b9212e7d0fdb4a1b3764f935ad437b91e786ebf3f04e1ed82814f",
"size": 373
},
{
"path": "main.js",
"sha256": "fda7cfeefb9bf0fb26d9d1b3a2cd8ce1f704fc6c664b623d26fc79db7c4266bd",
"sha256": "ce58bab92abd01acc1b24e5fa9f9285ab4b30342a2fcd68449e92ccd003e2110",
"size": 462596
}
],
"file": "plugins/plugin-image-annotate.fda7cfeefb9b.js",
"file": "plugins/plugin-image-annotate.ce58bab92abd.js",
"size": 462596,
"sha256": "fda7cfeefb9bf0fb26d9d1b3a2cd8ce1f704fc6c664b623d26fc79db7c4266bd",
"integrity": "sha256-/afP7vub8Psm2dGzos2M4fcE/GxmS2I9Jvx523xCZr0="
"sha256": "ce58bab92abd01acc1b24e5fa9f9285ab4b30342a2fcd68449e92ccd003e2110",
"integrity": "sha256-zli6uSq9AazBsk5fqfkoWrSzA0Ki/NaESekszQA+IRA="
},
{
"id": "image-vectorize",
@@ -282,27 +282,27 @@
"转换",
"矢量"
],
"version": "0.6.2",
"version": "0.6.3",
"apiVersion": 1,
"bundle": "plugins/image-vectorize-0.6.2.zip",
"bundleSize": 145959,
"bundleSha256": "7ba6074830abd833834a18fc567b37c2a66f0b0488baea76317e280b640fa176",
"bundle": "plugins/image-vectorize-0.6.3.zip",
"bundleSize": 146158,
"bundleSha256": "40fcb486828af5794e7fa562458f0974303b58eba780410fb1d1a829607fb179",
"files": [
{
"path": "manifest.json",
"sha256": "259c6c90ac0a25e5cab8c91daf38f5b2fa39804855dfdf6b90c3ad1262f28ba5",
"sha256": "b04701b97ca190eb7578e0411e67f59ea39bd277dc62cbccb784e1797e7a14d3",
"size": 362
},
{
"path": "main.js",
"sha256": "2d9e6c796bf6e4aa262fbabc59ae551802f28f5e875a4f34e586cbc9410380fb",
"size": 145383
"sha256": "a47baa43948e0c24381280174602b3b078214cb06f2aef6989b1b3ea335942b9",
"size": 145582
}
],
"file": "plugins/plugin-image-vectorize.2d9e6c796bf6.js",
"size": 145383,
"sha256": "2d9e6c796bf6e4aa262fbabc59ae551802f28f5e875a4f34e586cbc9410380fb",
"integrity": "sha256-LZ5seWv25KomL7q8Wa5VGALyj16HWk805YbLyUEDgPs="
"file": "plugins/plugin-image-vectorize.a47baa43948e.js",
"size": 145582,
"sha256": "a47baa43948e0c24381280174602b3b078214cb06f2aef6989b1b3ea335942b9",
"integrity": "sha256-pHuqQ5SODCQ4EoAXRgKzsHghTLBvKu9pibGz6jNZQrk="
},
{
"id": "sticky",
@@ -381,27 +381,27 @@
"电商",
"出图"
],
"version": "1.2.2",
"version": "1.2.3",
"apiVersion": 1,
"bundle": "plugins/white-bg-800-1.2.2.zip",
"bundleSize": 15573,
"bundleSha256": "c01d589bb091c5a9e9f05a8186db675d52aeddd2738042f8ef65429bc4616c39",
"bundle": "plugins/white-bg-800-1.2.3.zip",
"bundleSize": 16347,
"bundleSha256": "a7ec18de6a59a15a6f71e70237f1f0804655994924ad6de677557f83280b587f",
"files": [
{
"path": "manifest.json",
"sha256": "57d5c606adf14f4ae63f5a7e9d712bddda94efee2b4678a5fe2360e6e1db3029",
"sha256": "e02dba3a85ad7948e3b4755812ae8d2a6068a47397d74185d0e0c042c4a46f16",
"size": 357
},
{
"path": "main.js",
"sha256": "988d72d6f09de4817c51319d3b38200783a70a942b4249827252facbdc3ce881",
"size": 15002
"sha256": "a27695876233656f0696e7386610db30487928efb2691581ecbb0884e6a80446",
"size": 15776
}
],
"file": "plugins/plugin-white-bg-800.988d72d6f09d.js",
"size": 15002,
"sha256": "988d72d6f09de4817c51319d3b38200783a70a942b4249827252facbdc3ce881",
"integrity": "sha256-mI1y1vCd5IF8UTGdOzggB4OnCpQrQkmCclL6y9w86IE="
"file": "plugins/plugin-white-bg-800.a27695876233.js",
"size": 15776,
"sha256": "a27695876233656f0696e7386610db30487928efb2691581ecbb0884e6a80446",
"integrity": "sha256-onaVh2IzZW8Gluc4ZhDbMEh5KO+yaRWB7LsIhOaoBEY="
},
{
"id": "xianyi-cutout",
@@ -418,23 +418,57 @@
"apiVersion": 1,
"bundle": "plugins/xianyi-cutout-1.0.4.zip",
"bundleSize": 5111,
"bundleSha256": "327e5efd19bbe483107374b0108048c599000c5e77e5cbed245a611ecdb770d9",
"bundleSha256": "487dac0b9fe37537918ee6b90bd422cc5dbb2c1d1ba3758abda23335e6a9aefe",
"files": [
{
"path": "manifest.json",
"sha256": "19be5e8027e2bbb814d1a390f7569dd273a471b5a7e76f47c99b4ccfe803e159",
"sha256": "39693bdfd190f1e3b98b1300cab60bc3c1c97cc6a71b9336d5b2b0a8b3e8da59",
"size": 370
},
{
"path": "main.js",
"sha256": "84907706bb31d64aed82b85784483b91335301a8ad41e0e44813a2b9dfe17b47",
"sha256": "f7898f6e0fe9f8f8a4bdf91ce7dbbe538c0f27ee398dce3a25394da6d559201d",
"size": 4527
}
],
"file": "plugins/plugin-xianyi-cutout.84907706bb31.js",
"file": "plugins/plugin-xianyi-cutout.f7898f6e0fe9.js",
"size": 4527,
"sha256": "84907706bb31d64aed82b85784483b91335301a8ad41e0e44813a2b9dfe17b47",
"integrity": "sha256-hJB3Brsx1krtgrhXhEg7kTNTAaitQeDkSBOiud/he0c="
"sha256": "f7898f6e0fe9f8f8a4bdf91ce7dbbe538c0f27ee398dce3a25394da6d559201d",
"integrity": "sha256-94mPbg/p+Pikvfkc59u+U4wPJ+45jc46JTlNptVZIB0="
},
{
"id": "taskqueue",
"name": "任务队列",
"desc": "全局生图记录:链接/状态/画布节点;下载落地图库、重试、复制链接、定位节点(数据由宿主保存)",
"author": "official",
"icon": "⏳",
"color": "#eef6f6",
"tags": [
"工具",
"记录"
],
"version": "1.0.3",
"apiVersion": 1,
"bundle": "plugins/taskqueue-1.0.3.zip",
"bundleSize": 19127,
"bundleSha256": "c414710b3e1e7dac931a80f765dafd4e4bc8b0a8d3c4abfc54f84363cc010a47",
"files": [
{
"path": "manifest.json",
"sha256": "18830aec4c11dd8f0e55e4c4bb431fd00130cb12920c4d176d9c80eb38032821",
"size": 563
},
{
"path": "main.js",
"sha256": "5f08181338062c9327f22e742be7e1e161a32d2e1bc41ae775a73e0e15b9f3a9",
"size": 13189
},
{
"path": "styles.css",
"sha256": "4de612a1d25cb74a76f1888fdde32c0f617cc6ab5cc1a0f0bd6ff1adccc757e4",
"size": 5065
}
]
}
]
}
+17 -9
View File
@@ -3,7 +3,7 @@
<title>插件市场 · Image Workbench</title>
<link rel="icon" href="/assets/favicon.png" type="image/png">
<link rel="apple-touch-icon" href="/assets/logo.png">
<link rel="stylesheet" href="/assets/style.css?v=3.26.145-mx3htd9y">
<link rel="stylesheet" href="/assets/style.css?v=3.26.238-mx7aia6a">
</head><body>
<nav><div class="wrap inner">
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
@@ -16,13 +16,13 @@
</div>
<div class="right">
<a class="btn" href="/plugins/">插件市场</a>
<a class="btn primary" href="/download/">下载 v3.26.145</a>
<a class="btn primary" href="/download/">下载 v3.26.238</a>
</div>
</div></nav>
<main>
<section class="hero" style="padding:64px 0 8px;text-align:left"><div class="wrap">
<h1 style="font-size:40px;margin:0">插件市场</h1>
<p class="sub" style="margin:14px 0 0;text-align:left;max-width:720px">共 13 个插件。安装方式:应用内 <b>设置 → 插件 → 浏览</b>,点「安装」后重启生效。</p>
<p class="sub" style="margin:14px 0 0;text-align:left;max-width:720px">共 14 个插件。安装方式:应用内 <b>设置 → 插件 → 浏览</b>,点「安装」后重启生效。</p>
</div></section>
<section class="section" style="border-top:0;padding-top:24px"><div class="wrap">
<div style="display:flex;gap:8px;flex-wrap:wrap;margin:0 0 18px" id="chips">
@@ -47,12 +47,14 @@
<button class="tag" data-tag="电商" style="cursor:pointer;padding:5px 12px">电商</button>
<button class="tag" data-tag="抠图" style="cursor:pointer;padding:5px 12px">抠图</button>
<button class="tag" data-tag="去背景" style="cursor:pointer;padding:5px 12px">去背景</button>
<button class="tag" data-tag="工具" style="cursor:pointer;padding:5px 12px">工具</button>
<button class="tag" data-tag="记录" style="cursor:pointer;padding:5px 12px">记录</button>
</div>
<input id="q" placeholder="搜索插件,例如:出图、抠图、矢量…" style="width:100%;max-width:420px;height:40px;padding:0 14px;border:1px solid var(--line);border-radius:10px;font-size:14px;outline:none;margin-bottom:22px">
<div class="grid c3" id="list">
<div class="pcard" data-name="相册 album 一个节点装多张本地图片:宫格随节点尺寸自适应分页,一图一任务 / 批量两种模式,批量生图不用再摆一堆图片节点 图片 批量 出图" data-tags="图片,批量,出图">
<div class="head"><span class="av" style="background:#eef2f6">🖼️</span>
<div><div class="nm">相册</div><div class="ver">v1.2.4 · 官方</div></div></div>
<div><div class="nm">相册</div><div class="ver">v1.2.5 · 官方</div></div></div>
<div class="desc">一个节点装多张本地图片:宫格随节点尺寸自适应分页,一图一任务 / 批量两种模式,批量生图不用再摆一堆图片节点</div>
<div class="tags"><span class="tag">图片</span><span class="tag">批量</span><span class="tag">出图</span></div>
</div>
@@ -64,7 +66,7 @@
</div>
<div class="pcard" data-name="空白画布 blank-canvas 新建空白画布节点,用于分区分组 画布 效率" data-tags="画布,效率">
<div class="head"><span class="av" style="background:#eef2f6">⬜</span>
<div><div class="nm">空白画布</div><div class="ver">v1.0.0 · 官方</div></div></div>
<div><div class="nm">空白画布</div><div class="ver">v1.0.1 · 官方</div></div></div>
<div class="desc">新建空白画布节点,用于分区分组</div>
<div class="tags"><span class="tag">画布</span><span class="tag">效率</span></div>
</div>
@@ -76,7 +78,7 @@
</div>
<div class="pcard" data-name="图库 gallery 右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供) 资源 图库" data-tags="资源,图库">
<div class="head"><span class="av" style="background:#eef2f6">🖼️</span>
<div><div class="nm">图库</div><div class="ver">v1.9.8 · 官方</div></div></div>
<div><div class="nm">图库</div><div class="ver">v1.9.12 · 官方</div></div></div>
<div class="desc">右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">图库</span></div>
</div>
@@ -88,7 +90,7 @@
</div>
<div class="pcard" data-name="提示词库 promptlib 右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供) 资源 提示词" data-tags="资源,提示词">
<div class="head"><span class="av" style="background:#eef2f6">📖</span>
<div><div class="nm">提示词库</div><div class="ver">v1.14.10 · 官方</div></div></div>
<div><div class="nm">提示词库</div><div class="ver">v1.14.14 · 官方</div></div></div>
<div class="desc">右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">提示词</span></div>
</div>
@@ -100,7 +102,7 @@
</div>
<div class="pcard" data-name="位图转矢量 image-vectorize 把位图转成 svg 矢量路径 转换 矢量" data-tags="转换,矢量">
<div class="head"><span class="av" style="background:#eaf3ea">✒️</span>
<div><div class="nm">位图转矢量</div><div class="ver">v0.6.2 · 官方</div></div></div>
<div><div class="nm">位图转矢量</div><div class="ver">v0.6.3 · 官方</div></div></div>
<div class="desc">把位图转成 SVG 矢量路径</div>
<div class="tags"><span class="tag">转换</span><span class="tag">矢量</span></div>
</div>
@@ -118,7 +120,7 @@
</div>
<div class="pcard" data-name="白底图 white-bg-800 批量生成电商白底图(800px) 电商 出图" data-tags="电商,出图">
<div class="head"><span class="av" style="background:#eef7fb">🧾</span>
<div><div class="nm">白底图</div><div class="ver">v1.2.2 · 官方</div></div></div>
<div><div class="nm">白底图</div><div class="ver">v1.2.3 · 官方</div></div></div>
<div class="desc">批量生成电商白底图(800px)</div>
<div class="tags"><span class="tag">电商</span><span class="tag">出图</span></div>
</div>
@@ -128,6 +130,12 @@
<div class="desc">接入鲜艺抠图模型的一键去背景</div>
<div class="tags"><span class="tag">抠图</span><span class="tag">去背景</span></div>
</div>
<div class="pcard" data-name="任务队列 taskqueue 全局生图记录:链接/状态/画布节点;下载落地图库、重试、复制链接、定位节点(数据由宿主保存) 工具 记录" data-tags="工具,记录">
<div class="head"><span class="av" style="background:#eef6f6">⏳</span>
<div><div class="nm">任务队列</div><div class="ver">v1.0.3 · 官方</div></div></div>
<div class="desc">全局生图记录:链接/状态/画布节点;下载落地图库、重试、复制链接、定位节点(数据由宿主保存)</div>
<div class="tags"><span class="tag">工具</span><span class="tag">记录</span></div>
</div>
</div>
<div class="note" style="margin-top:26px">插件安装后会写进你的资料目录 <code>~/Documents/ImageWorkbench/plugins/</code>;卸载只删插件文件,不动画布与图库。</div>
</div></section>
+323 -1
View File
@@ -1,8 +1,330 @@
{
"app": "Image Workbench",
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
"updatedAt": "2026-11-30T16:39:09.337Z",
"updatedAt": "2026-12-03T04:48:38.283Z",
"releases": [
{
"version": "3.26.238",
"date": "2026-12-03",
"notes": "任务队列页头/页签固定;图片读取/下载本地优先 + 命名统一图库行名",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.238_aarch64.dmg",
"size": 10152907,
"sha256": "9ecea14ff71c7ef0fa91e28241f2a77ca5fea09dee0fa5e3e1024ee01edc0f8f",
"h": "9ecea14ff71c",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.238_x64.dmg",
"size": 10610501,
"sha256": "0cef46585d874ba20522aeecbfe9b10e8e52fbf1ea0ec5a8261eb8a10a789595",
"h": "0cef46585d87",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.26.238_x64-setup.exe",
"size": 5601034,
"sha256": "d77c051770a139d50aaa4e914763375abb85836d502b98cd13da8000aa9c3511",
"h": "d77c051770a1",
"kind": "exe"
}
}
},
{
"version": "3.26.184",
"date": "2026-12-02",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.184_aarch64.dmg",
"size": 10145011,
"sha256": "2358abf9f64ff17a4c3339f66cd4dd3bb17aea875b1af62335d329d5f32d8e80",
"h": "2358abf9f64f",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.184_x64.dmg",
"size": 10601813,
"sha256": "24d1030ba35016995181b712e65feba818e556257560b716434bace21ee334fc",
"h": "24d1030ba350",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.26.184_x64-setup.exe",
"size": 5589965,
"sha256": "d26a90dda86df474ce278751ec9c1f05916fd96f58c3f754538d987526507c92",
"h": "d26a90dda86d",
"kind": "exe"
}
}
},
{
"version": "3.26.183",
"date": "2026-12-02",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.183_aarch64.dmg",
"size": 10143986,
"sha256": "dc2d519f38ad502998001cc567a39c873a6af0431310187016bebbd8387636a0",
"h": "dc2d519f38ad",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.183_x64.dmg",
"size": 10605713,
"sha256": "d6decca171fcddfaca280a5fca718648fab047981021a5af8c850dcf504eba2f",
"h": "d6decca171fc",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.26.183_x64-setup.exe",
"size": 5591250,
"sha256": "02d1264162eaed0d95274de1c0a20bfe173030931db5a41d7443cbb2a874ae4a",
"h": "02d1264162ea",
"kind": "exe"
}
}
},
{
"version": "3.26.169",
"date": "2026-12-01",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.169_aarch64.dmg",
"size": 10139404,
"sha256": "c133b12c2b9660bbcbd8f1f175d4a4e3e3a8856ae4c746c53efe54221e2afbfd",
"h": "c133b12c2b96",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.169_x64.dmg",
"size": 10600637,
"sha256": "f0520a62218b2a827584ee292406d5a98b61caa686621bb5abe2734ab43fa97e",
"h": "f0520a62218b",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.26.169_x64-setup.exe",
"size": 5586528,
"sha256": "90f1fad79b2f54dd710beda6940a1549086a4a8b06d0c9fcfbfa8d7da597c947",
"h": "90f1fad79b2f",
"kind": "exe"
}
}
},
{
"version": "3.26.154",
"date": "2026-11-30",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.154_aarch64.dmg",
"size": 10142791,
"sha256": "0cb4b36492d1b691bbd22a142b0df423aebe1b17b7bf61a25d53148a002f2ae7",
"h": "0cb4b36492d1",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.154_x64.dmg",
"size": 10599688,
"sha256": "e803d95fb39b9f19c10cbb51ad613f399d293df4f1a834f066e8e1c547c03b05",
"h": "e803d95fb39b",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.26.154_x64-setup.exe",
"size": 5623889,
"sha256": "53be3b40ea52e9042197877dad09a72dce9601d85011c35b42be858652d433a4",
"h": "53be3b40ea52",
"kind": "exe"
}
}
},
{
"version": "3.26.153",
"date": "2026-11-30",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.153_aarch64.dmg",
"size": 10144677,
"sha256": "c5db4cc89faa00d52e81fbbc6cb6e335926807eb1a4ec1bfa4c18bc35d74f205",
"h": "c5db4cc89faa",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.153_x64.dmg",
"size": 10597228,
"sha256": "7cc145a35de16cbed313975008a6a212fb1e36712935e63ed5d060123d48a614",
"h": "7cc145a35de1",
"kind": "dmg"
}
}
},
{
"version": "3.26.152",
"date": "2026-11-30",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.152_aarch64.dmg",
"size": 10142029,
"sha256": "c15de46422635ffd44350738ab29f90db0137ca6f8d061a8f8224138e915fc26",
"h": "c15de4642263",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.152_x64.dmg",
"size": 10597414,
"sha256": "4e2b92cd9ae3844b406ce1e65d38117c17833521e967f70a58a5f5194bf70bc0",
"h": "4e2b92cd9ae3",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.26.152_x64-setup.exe",
"size": 5617791,
"sha256": "fdf0e2025580ccb714760a0e5314bebccb84a91ccba383c643b2087fe2d5cfdb",
"h": "fdf0e2025580",
"kind": "exe"
}
}
},
{
"version": "3.26.151",
"date": "2026-11-30",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.151_aarch64.dmg",
"size": 10142077,
"sha256": "a37da236abdd08a06c206a55bd8525cee00c2e24117ba5d3f72a637b55d623fd",
"h": "a37da236abdd",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.151_x64.dmg",
"size": 10598747,
"sha256": "e4ff71872a2568264fe63981f10090469636ac5e276b5440498b2d44fe031204",
"h": "e4ff71872a25",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.26.151_x64-setup.exe",
"size": 5624317,
"sha256": "69f81a2a570483c36064315fd5c23a5ac398f12e21fa430a10dac16b4572eb4b",
"h": "69f81a2a5704",
"kind": "exe"
}
}
},
{
"version": "3.26.150",
"date": "2026-11-30",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.150_aarch64.dmg",
"size": 10144929,
"sha256": "9f959acb1ddd19dd605cbeafb4fb13f38202cf11c4101c68f6b08403ce757483",
"h": "9f959acb1ddd",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.150_x64.dmg",
"size": 10602162,
"sha256": "bf6924849e9bf4d5857c17ab978fa363f1db90845cb44887d8624f1f61c17c49",
"h": "bf6924849e9b",
"kind": "dmg"
}
}
},
{
"version": "3.26.149",
"date": "2026-11-30",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.149_aarch64.dmg",
"size": 10147563,
"sha256": "aac96f14828d642c7feab1d509bf49344c0f8321c4c39700a4844f4eb30627d9",
"h": "aac96f14828d",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.149_x64.dmg",
"size": 10597596,
"sha256": "af90574b7c74f0bffa2968703a20b980a5940621508b81443fd73e7c83c7d616",
"h": "af90574b7c74",
"kind": "dmg"
}
}
},
{
"version": "3.26.148",
"date": "2026-11-30",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.148_aarch64.dmg",
"size": 10144542,
"sha256": "48e65f53d7c023cd9be62989254cd30d81f66c6aacafd6dd0b093b53fcb376e3",
"h": "48e65f53d7c0",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.148_x64.dmg",
"size": 10598579,
"sha256": "5249b32f4d3ea5d3978a218b8542bb2eedd62e6699ff1dfa191b5323f4989658",
"h": "5249b32f4d3e",
"kind": "dmg"
}
}
},
{
"version": "3.26.147",
"date": "2026-11-30",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.147_aarch64.dmg",
"size": 10143137,
"sha256": "8e4cecdf212887f6a3179b9f22decb6ccec3a76c1936de702a7b097dcf45a62d",
"h": "8e4cecdf2128",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.147_x64.dmg",
"size": 10599179,
"sha256": "e885e8a71a86e685f9de8c4c95ee6404afdbd78a2cf808de2f05c41160d21512",
"h": "e885e8a71a86",
"kind": "dmg"
}
}
},
{
"version": "3.26.146",
"date": "2026-11-30",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.146_aarch64.dmg",
"size": 10142147,
"sha256": "a380f10b3d1d77e7dfd8f451e7a7ad6cc086af187fdd62332705c1e7f1a5c616",
"h": "a380f10b3d1d",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.146_x64.dmg",
"size": 10599790,
"sha256": "464d13071f0f49d1a0ef6b376a907f7c767eb94b0c1cbbb255d0387fddbc34df",
"h": "464d13071f0f",
"kind": "dmg"
}
}
},
{
"version": "3.26.145",
"date": "2026-11-30",
+1 -1
View File
@@ -2014,7 +2014,7 @@ dependencies = [
[[package]]
name = "image-workbench"
version = "3.26.145"
version = "3.26.240"
dependencies = [
"arboard",
"base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.26.145"
version = "3.26.240"
description = "无限画布 · 生图工作台桌面版"
authors = ["malongan"]
license = ""
+125 -1
View File
@@ -292,6 +292,41 @@ fn do_thumbs(src: &str, jobs: &[ThumbJob]) -> Result<serde_json::Value, String>
Ok(serde_json::json!({ "ok": true, "files": out }))
}
// 2026-12-03(用户裁定):图片下载走系统网络栈。
// 为什么:WebView 的 fetch 是跨域 XHR,图床/CDN 会限速、挂起或按防盗链策略直接不回包
// (实测任务队列卡在 55% 不动);Rust 侧 reqwest 与浏览器导航同一栈,不受 CORS 约束。
// 返回 base64 + mime + 字节数;不写盘、不解析图片,调用方自己决定落到哪里。
#[tauri::command]
async fn fetch_image_b64(url: String, referer: Option<String>) -> Result<serde_json::Value, String> {
use base64::Engine as _;
let client = tauri_plugin_http::reqwest::Client::builder()
.connect_timeout(std::time::Duration::from_secs(15))
.timeout(std::time::Duration::from_secs(120))
.user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36")
.build()
.map_err(|e| e.to_string())?;
let mut req = client.get(&url);
if let Some(r) = referer {
if !r.is_empty() {
req = req.header(tauri_plugin_http::reqwest::header::REFERER, r);
}
}
let resp = req.send().await.map_err(|e| e.to_string())?;
let status = resp.status();
if !status.is_success() {
return Ok(serde_json::json!({ "ok": false, "error": format!("http-{}", status.as_u16()) }));
}
let mime = resp
.headers()
.get(tauri_plugin_http::reqwest::header::CONTENT_TYPE)
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream")
.to_string();
let bytes = resp.bytes().await.map_err(|e| e.to_string())?;
let b64 = base64::engine::general_purpose::STANDARD.encode(&bytes);
Ok(serde_json::json!({ "ok": true, "mime": mime, "bytes": bytes.len(), "b64": b64 }))
}
#[tauri::command]
async fn img_thumbs(src: String, jobs: Vec<ThumbJob>) -> Result<serde_json::Value, String> {
tauri::async_runtime::spawn_blocking(move || do_thumbs(&src, &jobs))
@@ -331,6 +366,7 @@ fn footprint_mb(pid: u32) -> Option<u64> {
// 注意:无任何写操作,只 spawn 只读工具。
// ps 的 etime(DD-HH:MM:SS / HH:MM:SS / MM:SS)→ 秒
#[cfg(unix)]
fn etime_secs(v: &str) -> u64 {
if let Some(pos) = v.find('-') {
let days = v[..pos].parse::<u64>().unwrap_or(0);
@@ -342,6 +378,7 @@ fn etime_secs(v: &str) -> u64 {
v.split(':').fold(0u64, |acc, x| acc * 60 + x.trim().parse::<u64>().unwrap_or(0))
}
#[cfg(unix)]
fn size_to_mb(num: f64, unit: &str) -> u64 {
let f = match unit {
"B" => num / 1048576.0,
@@ -354,6 +391,7 @@ fn size_to_mb(num: f64, unit: &str) -> u64 {
f.round() as u64
}
#[cfg(unix)]
fn parse_footprint(pid: u32) -> Option<serde_json::Value> {
let out = std::process::Command::new("/usr/bin/footprint")
.args(["-p", &pid.to_string()])
@@ -398,8 +436,92 @@ fn parse_footprint(pid: u32) -> Option<serde_json::Value> {
Some(serde_json::json!({ "pid": pid, "footprintMB": phys, "top": top }))
}
/// Windows:按进程给出工作集 + 私有提交(诊断页「内存拆解」用)。
/// 只归拢「本进程 + 它的子进程树」;WebView2 的渲染/GPU/工具进程都叫 msedgewebview2.exe,
/// 角色只能分到进程名,具体分工看 PID 与数值(可与任务管理器逐条对照)。
#[cfg(windows)]
fn windows_mem_breakdown(root: u32) -> serde_json::Value {
use windows_sys::Win32::Foundation::{CloseHandle, INVALID_HANDLE_VALUE};
use windows_sys::Win32::System::Diagnostics::ToolHelp::{
CreateToolhelp32Snapshot, Process32FirstW, Process32NextW, PROCESSENTRY32W, TH32CS_SNAPPROCESS,
};
use windows_sys::Win32::System::ProcessStatus::{GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS_EX};
use windows_sys::Win32::System::Threading::{OpenProcess, PROCESS_QUERY_LIMITED_INFORMATION, PROCESS_VM_READ};
let mut pairs: Vec<(u32, u32, String)> = Vec::new();
unsafe {
let snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if snap != INVALID_HANDLE_VALUE {
let mut e: PROCESSENTRY32W = std::mem::zeroed();
e.dwSize = std::mem::size_of::<PROCESSENTRY32W>() as u32;
if Process32FirstW(snap, &mut e) != 0 {
loop {
let end = e.szExeFile.iter().position(|c| *c == 0).unwrap_or(e.szExeFile.len());
let name = String::from_utf16_lossy(&e.szExeFile[..end]);
pairs.push((e.th32ProcessID, e.th32ParentProcessID, name));
e.dwSize = std::mem::size_of::<PROCESSENTRY32W>() as u32;
if Process32NextW(snap, &mut e) == 0 {
break;
}
}
}
CloseHandle(snap);
}
}
let mut tree: Vec<u32> = vec![root];
let mut i = 0;
while i < tree.len() {
let cur = tree[i];
for (p, pp, _) in pairs.iter() {
if *pp == cur && !tree.contains(p) {
tree.push(*p);
}
}
i += 1;
}
let mut rows: Vec<serde_json::Value> = Vec::new();
let mut total: u64 = 0;
for p in tree.iter() {
let h = unsafe { OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_VM_READ, 0, *p) };
if h == 0 {
continue;
}
let mut pmc: PROCESS_MEMORY_COUNTERS_EX = unsafe { std::mem::zeroed() };
pmc.cb = std::mem::size_of::<PROCESS_MEMORY_COUNTERS_EX>() as u32;
let ok = unsafe { GetProcessMemoryInfo(h, &mut pmc as *mut _ as *mut _, pmc.cb) } != 0;
unsafe { CloseHandle(h) };
if !ok {
continue;
}
let ws = (pmc.WorkingSetSize as u64) / 1048576;
let priv_mb = (pmc.PrivateUsage as u64) / 1048576;
total += ws;
let name = pairs.iter().find(|(id, _, _)| id == p).map(|(_, _, n)| n.clone()).unwrap_or_default();
let role = if *p == root {
"宿主".to_string()
} else if name.to_lowercase().contains("msedgewebview2") {
"WebView2".to_string()
} else if name.is_empty() {
"子进程".to_string()
} else {
name
};
rows.push(serde_json::json!({ "role": role, "pid": p, "footprintMB": ws, "privMB": priv_mb }));
}
rows.sort_by_key(|v| std::cmp::Reverse(v["footprintMB"].as_u64().unwrap_or(0)));
serde_json::json!({ "ok": true, "kind": "workingset", "totalMB": total, "procs": rows })
}
#[tauri::command]
async fn app_memory_breakdown() -> Result<serde_json::Value, String> {
#[cfg(windows)]
{
return Ok(windows_mem_breakdown(std::process::id()));
}
#[cfg(not(windows))]
{
tauri::async_runtime::spawn_blocking(move || {
let pid = std::process::id();
let mut procs: Vec<serde_json::Value> = Vec::new();
@@ -448,6 +570,7 @@ async fn app_memory_breakdown() -> Result<serde_json::Value, String> {
})
.await
.map_err(|e| e.to_string())?
}
}
/// 本进程及其全部子进程的常驻内存合计(MB)。
@@ -1967,7 +2090,8 @@ pub fn run() {
app_memory_mb,
app_memory_tree_mb,
app_memory_breakdown,
img_thumbs
img_thumbs,
fetch_image_b64
])
.setup(|app| {
if cfg!(debug_assertions) {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.26.145",
"version": "3.26.240",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
+22 -13
View File
@@ -301,8 +301,10 @@
if (!node || node.type === 'relay') return ''
const s = Number(viewport && viewport.scale)
if (!Number.isFinite(s) || s <= 0) return ''
// v3.26.157:取消 30% 那档 lite —— 它在阈值附近来回切换,视觉上就是「画面常闪」。
// 现在只剩一档:<15% 切 plain,其余一律渲染完整节点体。
if (s < LOD_PLAIN_SCALE) return 'plain'
return lodLowOf(viewport, node, nodeWidth) ? 'lite' : ''
return ''
}
// ── 按钮缩放(v3.24.83)────────────────────────────────────────────────
@@ -365,17 +367,21 @@
const t = String(type || '')
return /^(ref|out|image|combine|batch)$/.test(t) || /^plugin:(album|gallery)/.test(t)
}
function cullRectsOf (canvasSize, viewport) {
function cullRectsOf (canvasSize, viewport, extraPad) {
const w = Number(canvasSize && canvasSize.w) || 0
const h = Number(canvasSize && canvasSize.h) || 0
const s = Number(viewport && viewport.scale) || 0
if (!w || !h || !s) return null
const mk = (pad) => ({
left: -viewport.x / s - pad,
top: -viewport.y / s - pad,
right: (w - viewport.x) / s + pad,
bottom: (h - viewport.y) / s + pad,
})
const extra = Math.max(0, Number(extraPad) || 0)
const mk = (pad) => {
const p = pad + extra
return {
left: -viewport.x / s - p,
top: -viewport.y / s - p,
right: (w - viewport.x) / s + p,
bottom: (h - viewport.y) / s + p,
}
}
return { wide: mk(CULL_PAD_WIDE), tight: mk(CULL_PAD_TIGHT) }
}
function nodeVisibleIn (n, rects, opt) {
@@ -384,9 +390,10 @@
if (o.drag && o.drag.start && o.drag.start[n.id] != null) return true
if (o.resize && o.resize.nodeId === n.id) return true
if (o.sel && o.sel.indexOf(n.id) >= 0) return true
// v3.26.144:平移只改 DOM transform,viewport state 不更新 ⇒ 裁剪窗口会停在起点;
// 平移期间全量渲染(103 节点规模可接受),避免超过 280px 后新区域节点迟到/空白。
if (o.pan) return true
// v3.26.156:平移期默认只挂载「起点窗口 + 当前窗口」并集内的节点(不再全量)。
// 全量挂载会把整个世界层撑到几十屏大小,WebKit 只能分块栅格化,平移时就会出现残块/拖影。
// o.mountAll 保留旧行为(诊断开关 iwb_pan_mount_all=1 时启用)。
if (o.pan && o.mountAll) return true
const r = heavyNodeOf(n.type) ? rects.tight : rects.wide
const nw = o.widthOf ? o.widthOf(n) : 0
const nh = o.heightOf ? o.heightOf(n) : 0
@@ -417,11 +424,13 @@
const s = Number(viewport && viewport.scale) > 0 ? Number(viewport.scale) : 1
return 'translate(' + x + ',' + y + ') scale(' + s + ')'
}
function applyViewportDom (root, canvasSize, x, y, scale, gridOpts) {
function applyViewportDom (root, canvasSize, x, y, scale, gridOpts, opts) {
if (!root) return
const wl = root.querySelector && root.querySelector('.iwb-world')
if (wl) wl.style.transform = 'translate(' + x + 'px, ' + y + 'px) scale(' + scale + ')'
applyEdgeLayerDom(root, canvasSize, x, y, scale)
// v3.26.155:手势期间不写命中层 SVG 的 transform —— 每帧改一个装着上百条 path 的 <g>,
// WebKit 会把整层 SVG 重新布局+栅格化;它本来不可见(视觉在 canvas 上),停手后再对齐一次即可。
if (!(opts && opts.skipEdgeLayer)) applyEdgeLayerDom(root, canvasSize, x, y, scale)
const grid = root.querySelector ? root.querySelector('.iwb-grid') : null
if (!grid) return
const o = gridOpts || { base: 22, dot: 1.4, color: 'rgba(120,128,140,0.55)', on: true }
+49 -8
View File
@@ -12,6 +12,7 @@
const useEffect = React.useEffect
const useState = React.useState
const imgCache = new Map()
const perf = { lastMs: 0, frames: 0 }
function css (name, fallback) {
try {
@@ -40,13 +41,15 @@
entry.img.onload = () => { entry.loaded = true; if (typeof onLoad === 'function') onLoad() }
entry.img.onerror = () => { entry.failed = true; if (typeof onLoad === 'function') onLoad() }
entry.img.src = url
if (imgCache.size > 64) { const k = imgCache.keys().next().value; if (k !== undefined) imgCache.delete(k) }
imgCache.set(url, entry)
}
return entry
}
function draw (canvas, o) {
function drawUnsafe (canvas, o) {
if (!canvas || !o || typeof canvas.getContext !== 'function') return
const t0 = (typeof performance !== 'undefined' && performance.now) ? performance.now() : 0
const rect = canvas.getBoundingClientRect ? canvas.getBoundingClientRect() : null
const w = Math.max(1, Math.round((rect && rect.width) || canvas.clientWidth || 1))
const h = Math.max(1, Math.round((rect && rect.height) || canvas.clientHeight || 1))
@@ -68,6 +71,7 @@
const outThumbsFor = typeof o.outThumbsFor === 'function' ? o.outThumbsFor : () => []
const onImageLoad = o.onImageLoad
const types = Array.isArray(o.types) && o.types.length ? o.types : ['ref']
const isType = typeof o.isType === 'function' ? o.isType : (n) => types.indexOf(n.type) >= 0
const bg = css('--iwb-panel', '#ffffff')
const border = css('--iwb-border2', '#d7dbe2')
const text = css('--iwb-text2', '#5f6673')
@@ -77,8 +81,16 @@
ctx.setTransform(dpr * scale, 0, 0, dpr * scale, dpr * (Number(vp.x) || 0), dpr * (Number(vp.y) || 0))
ctx.lineJoin = 'round'
for (const n of nodes) {
if (!n || types.indexOf(n.type) < 0 || sel.indexOf(n.id) >= 0) continue
if (!n || !isType(n) || sel.indexOf(n.id) >= 0) continue
const x = n.x, y = n.y, nw = widthOf(n), nh = heightOf(n)
const screenW = nw * scale
// LOD:极小节点只画底板,跳标题/文本/图片,避免 7000 节点缩放时做无用绘制。
if (screenW < 8) {
ctx.fillStyle = bg
ctx.fillRect(x, y, nw, nh)
continue
}
const lowDetail = screenW < 40
// 卡片
ctx.fillStyle = bg
roundRect(ctx, x, y, nw, nh, radius)
@@ -89,13 +101,16 @@
// 标题
ctx.fillStyle = text
ctx.font = '600 ' + Math.max(10, 12 / scale * 0.9) + 'px -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif'
const title = String((n.data && (n.data.title || n.data.name)) || ({ ref: '参考图', prompt: '提示词', textout: '文本', combine: '组合', batch: '连接', relay: '中继', gen: '生成配置' }[n.type] || '节点'))
ctx.save()
ctx.beginPath(); ctx.rect(x + 10, y, Math.max(0, nw - 20), headH); ctx.clip()
ctx.fillText(title, x + 12, y + 21)
ctx.restore()
const title = String((n.data && (n.data.title || n.data.name)) || ({ ref: '参考图', prompt: '提示词', textout: '文本', combine: '组合', batch: '连接', relay: '中继', gen: '生成配置', layer: '分层', plugin: '插件' }[n.type] || (String(n.type).indexOf('plugin:') === 0 ? '插件' : '节点')))
if (!lowDetail) {
ctx.save()
ctx.beginPath(); ctx.rect(x + 10, y, Math.max(0, nw - 20), headH); ctx.clip()
ctx.fillText(title, x + 12, y + 21)
ctx.restore()
}
const pad = 10
const ix = x + pad, iy = y + headH, iw = Math.max(1, nw - pad * 2), ih = Math.max(1, nh - headH - pad)
if (lowDetail) continue
if (n.type === 'ref') {
// 图片区
const raw = n.data && (n.data.data || n.data.url)
@@ -138,6 +153,20 @@
ctx.font = Math.max(10, 12 / scale * 0.9) + 'px -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif'
ctx.fillText('选中查看结果', ix + 2, iy + Math.max(14, 16 / scale))
}
} else if (n.type === 'layer') {
// 分层节点:画层列表;选中后由 NodeCard 负责完整图层操作。
const layers = (n.data && Array.isArray(n.data.layers)) ? n.data.layers : []
ctx.fillStyle = text
ctx.font = Math.max(10, 12 / scale * 0.9) + 'px -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif'
const lh = Math.max(14, 20 / scale)
let yy = iy + Math.max(14, 18 / scale)
for (let i = 0; i < Math.min(8, layers.length); i++) {
const name = String((layers[i] && layers[i].name) || ('图层 ' + (i + 1)))
ctx.fillText(name, ix + 2, yy)
yy += lh
if (yy > iy + ih) break
}
if (!layers.length) ctx.fillText('选中查看分层', ix + 2, iy + Math.max(14, 16 / scale))
} else {
// P2 文本节点:画截断文本,选中后由 NodeCard 负责编辑。
ctx.save()
@@ -171,6 +200,17 @@
}
void accent
}
if (t0) { perf.lastMs = (typeof performance !== 'undefined' && performance.now ? performance.now() : t0) - t0; perf.frames++ }
}
// 单帧绘制失败不能冒泡到 React effect;记录后保留上一帧,下一帧重试。
function draw (canvas, o) {
try {
drawUnsafe(canvas, o)
perf.lastError = ''
} catch (e) {
perf.lastError = String((e && e.message) || e)
}
}
function CanvasNodeLayer (props) {
@@ -195,5 +235,6 @@
return el('canvas', { className: 'iwb-node-canvas', 'aria-hidden': 'true', ref: ref })
}
global.IWBCanvasV3NodeLayer = { CanvasNodeLayer, draw }
function stats () { return { drawMs: perf.lastMs, frames: perf.frames, images: imgCache.size, error: perf.lastError || '' } }
global.IWBCanvasV3NodeLayer = { CanvasNodeLayer, draw, stats }
})(typeof window !== 'undefined' ? window : globalThis)
+14 -11
View File
@@ -16,11 +16,9 @@
} catch (e) { return null }
}
// 2026-12-01:Canvas V3 实验停止。旧用户即使 localStorage 里还留着 '1',也必须回 DOM。
// 保留代码仅用于后续研究;产品路径不再进入 Canvas V3。
function isEnabled () {
try {
const s = store()
if (s && typeof s.rawGet === 'function') return s.rawGet(KEY, '0') === '1'
} catch (e) { /* ignore */ }
return false
}
@@ -33,10 +31,10 @@
}
function setEnabled (on) {
const next = !!on
const next = false // kill switch:不再允许开启
try {
const s = store()
if (s && typeof s.rawSet === 'function') s.rawSet(KEY, next ? '1' : '0')
if (s && typeof s.rawSet === 'function') s.rawSet(KEY, '0')
} catch (e) { /* ignore */ }
syncRoot(next)
try {
@@ -48,19 +46,24 @@
}
function init () {
const on = isEnabled()
syncRoot(on)
return on
syncRoot(false)
try { const s = store(); if (s && typeof s.rawSet === 'function') s.rawSet(KEY, '0') } catch (e) { /* ignore */ }
return false
}
function stats () {
const on = isEnabled()
let dom = -1
try { dom = document.getElementsByTagName('*').length } catch (e) { /* ignore */ }
return { enabled: on, dom }
let node = null
try {
const L = global.IWBCanvasV3NodeLayer
if (L && typeof L.stats === 'function') node = L.stats()
} catch (e) { /* ignore */ }
return { enabled: on, dom, node }
}
// P2 第一批:ref 图片节点 + prompt/textout 文本类节点。
const TYPES = ['ref', 'prompt', 'textout', 'combine', 'batch', 'relay', 'gen', 'out']
const TYPES = ['ref', 'prompt', 'textout', 'combine', 'batch', 'relay', 'gen', 'out', 'layer']
global.IWBCanvasV3 = { KEY, TYPES, isEnabled, setEnabled, init, stats }
})(typeof window !== 'undefined' ? window : globalThis)
+4 -1
View File
@@ -123,6 +123,9 @@
return out
}
// 等当前归档队列排空(整批补漏前调用:避免最后一张的索引还在写就被误判成「未归档」)
function whenIdle () { return queue.chain }
// 这条结果是否已经逐张归档过(整轮归档据此跳过,避免同一张图入两次库)
function wasArchived (entry) {
return !!(archived && entry && typeof entry === 'object' && archived.has(entry))
@@ -247,7 +250,7 @@
return ''
}
return { archiveEntryNow, wasArchived, notifyChanged, localCopySrcOf, prepareInsert, gridSpots, nodeImageOf, thumbFor, thumbStats }
return { archiveEntryNow, whenIdle, wasArchived, notifyChanged, localCopySrcOf, prepareInsert, gridSpots, nodeImageOf, thumbFor, thumbStats }
}
let attached = null
+29 -3
View File
@@ -184,9 +184,35 @@
return groups.map((g, gi) => ({ sourceNodeId: n.id + '#b' + gi, ownerNodeId: n.id, title: String((n.data && n.data.title) || '').trim(), text: albumText, refNodes: g, diagnostics: diag }))
}
if (children.length) {
return selfRefs.length
? children.map((t) => ({ ...t, ownerNodeId: n.id, refNodes: dedupeTaskRefs((t.refNodes || []).concat(selfRefs)) }))
: children.map((t) => ({ ...t, ownerNodeId: n.id }))
// 2026-12-03:插件文本节点接了上游(例如给「提示词模板」接一张参考图)时,
// 这里原来直接返回 children,把节点自己的 data.text 丢成空串 ⇒ 发出去只有图没有提示词,
// 生图服务商报 400 INVALID_ARGUMENT。口径与上面的 prompt 分支一致:自己的文本优先,参考图取并集。
const ownTitle = String((n.data && n.data.title) || '').trim()
// 2026-12-03(用户):上游是「纯图片」或「图片 + 至多一段文本」时,合并成**一个**任务
// (图1+图2 一起带,文本用节点自己的 > 上游那段);两段以上文本、相册/批量等多值源保持一子一任务。
const refChildren = []
const otherChildren = []
for (const t of children) {
const sn = graph.byId.get(t.sourceNodeId)
if (sn && sn.type === 'ref') refChildren.push(t)
else otherChildren.push(t)
}
const mergedRefs = dedupeTaskRefs(refChildren.flatMap((t) => t.refNodes || []))
const mergedDiag = { cycles: children.flatMap((t) => (t.diagnostics && t.diagnostics.cycles) || []), disabledSources: [] }
let base = children
if (refChildren.length && !otherChildren.length) {
base = [{ sourceNodeId: n.id, ownerNodeId: n.id, title: ownTitle, text: '', refNodes: mergedRefs, diagnostics: mergedDiag }]
} else if (refChildren.length && otherChildren.length === 1) {
const tc = otherChildren[0]
base = [{ ...tc, sourceNodeId: own ? n.id : (tc.sourceNodeId || n.id), ownerNodeId: n.id, title: ownTitle || tc.title || '', text: String(tc.text || ''), refNodes: dedupeTaskRefs((tc.refNodes || []).concat(mergedRefs)), diagnostics: tc.diagnostics || mergedDiag }]
}
return base.map((t) => ({
...t,
ownerNodeId: n.id,
title: ownTitle || t.title || '',
text: own || t.text,
refNodes: dedupeTaskRefs((t.refNodes || []).concat(selfRefs)),
}))
}
return [{ sourceNodeId: n.id, ownerNodeId: n.id, text: own, refNodes: selfRefs, diagnostics: { cycles: [], disabledSources: [] } }]
}
+2 -1
View File
@@ -60,5 +60,6 @@
}
function failedCount () { return failedKeys.size }
global.IWBImageCacheMigrate = { once: once, _collect: collect, failedCount: failedCount }
function isFailed (key) { return failedKeys.has(String(key || '')) }
global.IWBImageCacheMigrate = { once: once, _collect: collect, failedCount: failedCount, isFailed: isFailed }
})(typeof window !== 'undefined' ? window : globalThis)
+6 -3
View File
@@ -25,6 +25,9 @@
const pending = o.pending
if (!cache || !pending) throw new Error('cache/pending required')
const queue = []
// v3.26.181:失败过的 key 不再重试(标注覆盖后的新图没有缩略图,生成失败时
// 每次重渲染都会重新入队 → 反复整幅解码,CPU 被吃掉)。
const failed = new Set()
let running = 0
let scheduled = false
@@ -146,7 +149,7 @@
try { ok = await runNative(key) } catch (e) { ok = false }
if (!ok) { try { ok = await runBitmap(key, v) } catch (e) { ok = false } }
if (!ok) { try { ok = await runImg(key, v) } catch (e2) { ok = false } }
if (ok) bump()
if (ok) { failed.delete(key); bump() } else if (!(typeof o.isTransient === 'function' && o.isTransient(v))) failed.add(key)
return ok
}
@@ -174,13 +177,13 @@
return {
queue: function (key, v) {
if (!key || cache.has(key) || pending.has(key)) return false
if (!key || cache.has(key) || pending.has(key) || failed.has(key)) return false
pending.add(key)
queue.push({ key: key, v: v })
schedule()
return true
},
stats: function () { return { queued: queue.length, running: running } }
stats: function () { return { queued: queue.length, running: running, failed: failed.size } }
}
}
+111
View File
@@ -0,0 +1,111 @@
/* image-ingest-store.js —— 落地队列的持久化 + 状态视图(2026-12-02)
*
* 两个职责,都很薄:
* 1) store:把 ingest 的记录存在 localStorage(只存元数据与引用,不存字节;字节在 blob 引用存储里)
* —— 断点恢复靠它;上限 500 条,超出按最旧淘汰(pinned 不动)
* 2) view:url → 状态的内存索引,供结果图组件按 url 查「下载中 / 失败 / 已就绪」
* —— 组件订阅 notify 后重渲染,不需要把状态灌进画布节点数据
*
* 与 image-ingest.js 的分工:那边是执行器(下载/重试),这边只管「记账」和「给 UI 看」。
*/
;(function (global) {
'use strict'
const KEY = 'iwb_ingest_idx'
const MAX = 500
function createStore (deps) {
const d = deps || {}
const lsGet = typeof d.get === 'function' ? d.get : () => null
const lsSet = typeof d.set === 'function' ? d.set : () => {}
// 2026-12-03:上限由宿主配置注入(默认 500,范围 100~5000);插件只读/改配置。
const maxOf = () => {
let n = 500
try { n = typeof d.max === 'function' ? d.max() : (Number(d.max) || 500) } catch (e) { n = 500 }
n = Math.round(Number(n) || 500)
return Math.max(1, Math.min(5000, n))
}
let cache = null
function load () {
if (cache) return cache
let arr = null
try { arr = lsGet(KEY) } catch (e) { arr = null }
cache = Array.isArray(arr) ? arr.filter((x) => x && x.id && x.url) : []
return cache
}
function save (entry) {
if (!entry || !entry.id) return
const arr = load()
const at = arr.findIndex((x) => x.id === entry.id)
if (at >= 0) arr[at] = entry
else arr.push(entry)
const max = maxOf()
if (arr.length > max) {
// 淘汰最旧的非 pinned 记录(pinned = 被画布/图库引用)
const isActive = (x) => !!(x && (x.status === 'queued' || x.status === 'downloading'))
const drop = arr.filter((x) => !x.pinned && !isActive(x) && x.id !== entry.id).sort((a, b) => (a.createdAt || 0) - (b.createdAt || 0))
while (arr.length > max && drop.length) {
const victim = drop.shift()
const i = arr.indexOf(victim)
if (i >= 0) arr.splice(i, 1)
}
}
try { lsSet(KEY, arr) } catch (e) { /* 配额满:保留内存态,下次启动丢,不影响当前会话 */ }
}
function remove (id) {
const arr = load()
const i = arr.findIndex((x) => x.id === id)
if (i >= 0) arr.splice(i, 1)
try { lsSet(KEY, arr) } catch (e) { /* ignore */ }
}
function list () { return load().slice() }
// 立即按当前上限裁剪(改设置后调用;只删记录,不删图片)
function trim () {
const arr = load()
const max = maxOf()
if (arr.length <= max) return 0
const isActive = (x) => !!(x && (x.status === 'queued' || x.status === 'downloading'))
const drop = arr.filter((x) => !x.pinned && !isActive(x)).sort((a, b) => (a.createdAt || 0) - (b.createdAt || 0))
let removed = 0
while (arr.length > max && drop.length) {
const victim = drop.shift()
const i = arr.indexOf(victim)
if (i >= 0) { arr.splice(i, 1); removed++ }
}
if (removed) { try { lsSet(KEY, arr) } catch (e) { /* ignore */ } }
return removed
}
function clear () { cache = []; try { lsSet(KEY, []) } catch (e) { /* ignore */ } }
return { load, save, remove, list, trim, clear, KEY, MAX }
}
// 视图:url → { status, localUrl, bytes, error };订阅者用于 React 重渲染
function createView () {
const byUrl = new Map()
const subs = new Set()
function set (entry) {
if (!entry || !entry.url) return
const prev = byUrl.get(entry.url) || {}
byUrl.set(entry.url, {
id: entry.id,
status: entry.status,
ref: entry.ref || prev.ref || null,
displayRef: entry.displayRef || prev.displayRef || null,
localUrl: entry.localUrl || prev.localUrl || '',
bytes: entry.bytes || 0,
progress: entry.progress || 0,
receivedBytes: entry.receivedBytes || 0,
totalBytes: entry.totalBytes || 0,
error: entry.lastError || '',
})
}
function byUrlOf (url) { return byUrl.get(String(url || '')) || null }
function hydrate (entries) { for (const e of (entries || [])) set(e) }
function subscribe (fn) { if (typeof fn === 'function') { subs.add(fn); return () => subs.delete(fn) } return () => {} }
function notify () { for (const fn of [...subs]) { try { fn() } catch (e) { /* ignore */ } } }
return { set, get: byUrlOf, hydrate, subscribe, notify }
}
global.IWBImageIngestStore = { createStore, createView, KEY }
})(typeof window !== 'undefined' ? window : globalThis)
+347
View File
@@ -0,0 +1,347 @@
/* image-ingest.js —— 结果图片落地管线(2026-12-02)
*
* 解决什么:出图后输出节点直接用 <img src=远程CDN>,图库缩略图又各自去 fetch 一遍;
* CDN 慢/断流时表现为「图片从上往下慢慢刷 / 卡住半张」,图库还晚一步才出现。
* 这里把「远程结果 → 本地字节」收敛成一条队列:下载一次,节点/图库/队列页共用。
*
* 设计约束:
* · 幂等:同一条记录重复 enqueue 不会重复下载(按 id 去重;id 缺省用 url 的稳定 hash)
* · 不丢图:原始 url 永远保留在 entry 上;失败只改状态,不删记录
* · 可恢复:状态由宿主持久化(deps.persist),启动时用 restore() 把 queued/downloading 重排
* · 原子:先写字节再置 ready;写失败保持 failed,可重试
* · 可关:宿主不接线就是不启用(本模块自身不读任何全局)
*
* 依赖全部注入(便于单测):
* fetchBytes(url) -> Promise<{ ok, dataUrl?, bytes?, mime?, error? }>
* writeRef(dataUrl)-> Promise<ref|null> // 走宿主的唯一引用化入口
* persist(entry) -> void // 状态变化时持久化
* onEvent(kind, entry) -> void // 进度节流事件(宿主用来刷新 UI)
* now() -> number
* sleep(ms) -> Promise // 测试可注入
* concurrency -> number(默认 2)
* retries -> number(默认 3)
*/
;(function (global) {
'use strict'
const STATE = { QUEUED: 'queued', DOWNLOADING: 'downloading', READY: 'ready', FAILED: 'failed', LINK_ONLY: 'link-only' }
function create (deps) {
const d = deps || {}
// 2026-12-03(用户裁定):默认 30 并发,设置页可调(1–64);getConcurrency 让改动立即生效。
const concurrencyOf = () => {
const v = (typeof d.getConcurrency === 'function') ? d.getConcurrency() : d.concurrency
return Math.max(1, Math.min(64, Number(v) || 30))
}
const maxRetries = Math.max(0, Number(d.retries) || 3)
const now = typeof d.now === 'function' ? d.now : () => Date.now()
const sleep = typeof d.sleep === 'function' ? d.sleep : (ms) => new Promise((r) => setTimeout(r, ms))
const entries = new Map() // id -> entry
const queue = [] // 待下载 id
let active = 0
let seq = 0
const uid = () => 'ing_' + now().toString(36) + '_' + (++seq)
function hash (s) {
let h = 5381
const str = String(s || '')
for (let i = 0; i < str.length; i++) h = ((h * 33) ^ str.charCodeAt(i)) >>> 0
return h.toString(36)
}
const emit = (kind, e) => { try { if (typeof d.onEvent === 'function') d.onEvent(kind, e) } catch (err) { /* ignore */ } }
const persist = (e) => { try { if (typeof d.persist === 'function') d.persist(e) } catch (err) { /* ignore */ } }
function publicView (e) {
return {
id: e.id, url: e.url, source: e.source, status: e.status,
bytes: e.bytes || 0, mime: e.mime || '', w: e.w || 0, h: e.h || 0,
progress: e.progress || 0, receivedBytes: e.receivedBytes || 0, totalBytes: e.totalBytes || 0,
ref: e.ref || null, displayRef: e.displayRef || null, thumbRef: e.thumbRef || null,
retries: e.retries || 0, lastError: e.lastError || '', requestId: e.requestId || '',
createdAt: e.createdAt, updatedAt: e.updatedAt, meta: e.meta || {},
}
}
function get (id) { const e = entries.get(id); return e ? publicView(e) : null }
function list () { return [...entries.values()].map(publicView) }
function stats () {
const out = { total: 0, queued: 0, downloading: 0, ready: 0, failed: 0, linkOnly: 0, active: 0 }
for (const e of entries.values()) {
out.total++
if (e.status === STATE.QUEUED) out.queued++
else if (e.status === STATE.DOWNLOADING) out.downloading++
else if (e.status === STATE.READY) out.ready++
else if (e.status === STATE.FAILED) out.failed++
else if (e.status === STATE.LINK_ONLY) out.linkOnly++
}
out.active = active
return out
}
function setStatus (e, status, patch) {
e.status = status
e.updatedAt = now()
if (patch) Object.assign(e, patch)
persist(publicView(e))
emit(status, publicView(e))
}
async function runOne (e) {
// active 由 pump 在「决定启动」时同步 +1(见 pump):放在这里会晚一个微任务,
// pump 的 while 就会在 active 还是 0 时把整个队列一次性放出去(2026-12-03 实测并发限制从未生效)。
// 2026-12-03:每次运行带「运行序号 + 取消控制器」—— 取消/重下时旧请求的结果必须作废,
// 否则回包晚到会把 link-only 覆盖成 ready,或和新一轮同时写同一条记录。
const mySeq = (e.runSeq || 0) + 1
e.runSeq = mySeq
const ctrl = (typeof AbortController === 'function') ? new AbortController() : null
e.ctrl = ctrl
const stale = () => (e.runSeq !== mySeq || e.status !== STATE.DOWNLOADING)
const settle = () => { active--; try { delete e.ctrl } catch (e0) { /* ignore */ } pump() }
setStatus(e, STATE.DOWNLOADING, { lastError: '', progress: 0, receivedBytes: 0, totalBytes: 0 })
let lastErr = ''
// 2026-12-02:下载进度(有 content-length 才算百分比;拿不到就退回「下载中」文案)。
// 事件节流 250ms —— 每 chunk 都触发会让画布整树重渲染,反而拖慢下载。
const onProgress = (received, total) => {
const rcv = Math.max(0, Number(received) || 0)
const tot = Math.max(0, Number(total) || 0)
e.receivedBytes = rcv
e.totalBytes = tot
e.progress = tot > 0 ? Math.min(1, rcv / tot) : 0
const t = now()
e.updatedAt = t
if (t - (e._progAt || 0) < 250 && !(tot > 0 && rcv >= tot)) return
e._progAt = t
emit('progress', publicView(e))
}
for (let attempt = 0; attempt <= maxRetries; attempt++) {
try {
const got = typeof d.fetchBytes === 'function' ? await d.fetchBytes(e.url, onProgress, ctrl ? ctrl.signal : undefined) : { ok: false, error: 'no-fetcher' }
if (stale()) { settle(); return publicView(e) }
if (!got || !got.ok || !got.dataUrl) throw new Error((got && got.error) || 'fetch-failed')
const ref = typeof d.writeRef === 'function' ? await d.writeRef(got.dataUrl) : null
if (!ref) throw new Error('write-ref-failed')
if (stale()) { settle(); return publicView(e) }
active--
setStatus(e, STATE.READY, {
ref,
progress: 1,
bytes: Number(got.bytes || 0) || Math.round(String(got.dataUrl).length * 0.75),
mime: String(got.mime || ''),
w: Number(got.w || 0) || e.w || 0,
h: Number(got.h || 0) || e.h || 0,
retries: attempt,
lastError: '',
})
pump()
return publicView(e)
} catch (err) {
lastErr = (err && err.message) ? err.message : String(err)
if (stale()) { settle(); return publicView(e) }
if (attempt < maxRetries) {
setStatus(e, STATE.DOWNLOADING, { retries: attempt + 1, lastError: lastErr })
await sleep(Math.min(8000, 1000 * Math.pow(2, attempt)))
continue
}
}
}
if (stale()) { settle(); return publicView(e) }
active--
try { delete e.ctrl } catch (e1) { /* ignore */ }
setStatus(e, STATE.FAILED, { retries: maxRetries, lastError: lastErr })
pump()
return publicView(e)
}
function pump () {
while (active < concurrencyOf() && queue.length) {
const id = queue.shift()
const e = entries.get(id)
if (!e || e.status !== STATE.QUEUED) continue
active++
Promise.resolve().then(() => runOne(e))
}
}
// 入队:同一 url 已存在(且未失败)则直接返回旧记录,避免重复下载
function enqueue (input) {
const src = input || {}
const url = String(src.url || '')
if (!url) return null
const id = String(src.id || ('u_' + hash(url)))
const exist = entries.get(id)
if (exist) {
if (exist.status === STATE.FAILED || exist.status === STATE.LINK_ONLY) return retry(id)
return publicView(exist)
}
const e = {
id,
url,
source: String(src.source || 'gen'),
status: STATE.QUEUED,
bytes: 0, mime: '', w: Number(src.w || 0), h: Number(src.h || 0),
ref: null, displayRef: null, thumbRef: null,
retries: 0, lastError: '', requestId: String(src.requestId || ''),
createdAt: now(), updatedAt: now(), meta: src.meta || {},
}
entries.set(id, e)
queue.push(id)
persist(publicView(e))
emit(STATE.QUEUED, publicView(e))
pump()
return publicView(e)
}
// 重试:复位状态重新排队(失败记录不删,url 保留)
function retry (id) {
const e = entries.get(id)
if (!e) return null
e.runSeq = (e.runSeq || 0) + 1 // 旧运行作废(回包晚到不覆盖新状态)
e.retries = 0
setStatus(e, STATE.QUEUED, { lastError: '' })
queue.push(id)
pump()
return publicView(e)
}
// 取消:仅对排队中/下载中有效;字节未落地的记录回到 queued 之外的状态由宿主任意处理
function cancel (id) {
const e = entries.get(id)
if (!e) return null
e.runSeq = (e.runSeq || 0) + 1
try { if (e.ctrl && typeof e.ctrl.abort === 'function') e.ctrl.abort() } catch (eC) { /* ignore */ }
try { delete e.ctrl } catch (eD) { /* ignore */ }
const at = queue.indexOf(id)
if (at >= 0) queue.splice(at, 1)
if (e.status === STATE.QUEUED || e.status === STATE.DOWNLOADING) setStatus(e, STATE.LINK_ONLY, { lastError: 'cancelled' })
return publicView(e)
}
// 释放本地字节,保留记录与 url(「仅保留链接」)
function release (id) {
const e = entries.get(id)
if (!e) return null
setStatus(e, STATE.LINK_ONLY, { ref: null, displayRef: null, thumbRef: null })
return publicView(e)
}
// 清空已结束的记录(ready/failed/link-only);进行中的保留(正在下载/排队),避免清掉在飞任务。
function clearFinished () {
let n = 0
for (const [id, e] of Array.from(entries.entries())) {
if (e.status === STATE.READY || e.status === STATE.FAILED || e.status === STATE.LINK_ONLY) {
entries.delete(id)
try { if (typeof d.removeEntry === 'function') d.removeEntry(id) } catch (err) { /* ignore */ }
n++
}
}
if (n) emit('cleared', { count: n })
return n
}
function remove (id) {
const at = queue.indexOf(id)
if (at >= 0) queue.splice(at, 1)
entries.delete(id)
try { if (typeof d.removeEntry === 'function') d.removeEntry(id) } catch (e) { /* ignore */ }
emit('removed', { id })
return true
}
// 启动恢复:queued / downloading 重新排队;ready 但宿主说字节不在了 → missing(keep url)
function restore (saved) {
const arr = Array.isArray(saved) ? saved : []
for (const raw of arr) {
if (!raw || !raw.id || !raw.url) continue
const e = Object.assign({}, raw, { meta: raw.meta || {} })
if (e.status === STATE.READY) e.status = STATE.READY
else if (e.status === STATE.FAILED) e.status = STATE.FAILED
else if (e.status === STATE.LINK_ONLY) e.status = STATE.LINK_ONLY
else e.status = STATE.QUEUED
entries.set(e.id, e)
if (e.status === STATE.QUEUED) queue.push(e.id)
}
pump()
return stats()
}
// 宿主自检回调:索引是 ready 但字节读不出来 → 标 missing(仍保留 url,可 retry)
function markMissing (id, reason) {
const e = entries.get(id)
if (!e) return null
setStatus(e, STATE.FAILED, { lastError: String(reason || 'missing-bytes'), ref: null, displayRef: null })
return publicView(e)
}
return { enqueue, retry, cancel, release, remove, clearFinished, get, list, stats, restore, markMissing, STATE }
}
// 带进度的取字节:流式读 body,按 content-length 报百分比;拿不到长度就只报已收字节。
// 失败(CORS/非 2xx/无 body)抛错,交给宿主回退到既有 wBlobFromSrc。
function blobToDataUrl (blob) {
return new Promise((resolve) => {
try {
const fr = new FileReader()
fr.onload = () => resolve(String(fr.result || ''))
fr.onerror = () => resolve('')
fr.readAsDataURL(blob)
} catch (e) { resolve('') }
})
}
async function fetchWithProgress (url, onProgress, signal) {
const res = await fetch(url, signal ? { signal: signal } : undefined)
if (!res || !res.ok) throw new Error('http-' + String((res && res.status) || 'error'))
const total = Number(res.headers && res.headers.get && res.headers.get('content-length')) || 0
let blob = null
if (res.body && typeof res.body.getReader === 'function') {
const reader = res.body.getReader()
const chunks = []
let received = 0
for (;;) {
const step = await reader.read()
if (!step || step.done) break
if (step.value) { chunks.push(step.value); received += step.value.length || 0 }
if (typeof onProgress === 'function') onProgress(received, total)
}
blob = new Blob(chunks, { type: String((res.headers && res.headers.get && res.headers.get('content-type')) || '') })
} else {
blob = await res.blob()
if (typeof onProgress === 'function') onProgress(blob ? blob.size : 0, total)
}
const dataUrl = blob ? await blobToDataUrl(blob) : ''
if (!dataUrl) return { ok: false, error: 'empty-bytes' }
return { ok: true, dataUrl, mime: String((blob && blob.type) || ''), bytes: (blob && blob.size) || 0 }
}
// 宿主取字节适配器:流式(带进度)→ 失败回退宿主既有 blob 取法;整体带超时。
// 放进本模块是为了让 app.js 只留一行装配(Workbench 行数棘轮)。
function createFetchBytes (deps) {
const d = deps || {}
const timeoutMs = Math.max(1000, Number(d.timeoutMs) || 300000)
return async function fetchBytes (url, onProgress, signal) {
// 2026-12-03(用户裁定):优先用系统网络栈(Rust reqwest)—— 不受 CORS/WebView 限制,
// 图床/CDN 对 XHR 的限速、挂起、防盗链都不会再影响下载。拿不到再退回 WebView fetch。
if (typeof d.rustFetch === 'function') {
try {
const r = await d.rustFetch(url)
if (r && r.ok && r.b64) {
const mime = String(r.mime || 'application/octet-stream')
if (typeof onProgress === 'function') onProgress(Number(r.bytes) || 0, Number(r.bytes) || 0)
return { ok: true, dataUrl: 'data:' + mime + ';base64,' + String(r.b64), mime: mime, bytes: Number(r.bytes) || 0 }
}
} catch (eR) { /* 非 Tauri / 命令缺失 → 回退 WebView fetch */ }
}
let timer = null
const job = fetchWithProgress(url, onProgress, signal).catch(async () => {
// 用户取消(abort)导致的失败:不要回退再抓一次,直接按中止返回。
if (signal && signal.aborted) return { ok: false, error: 'aborted' }
const blob = await d.blobFromSrc(url)
const dataUrl = blob ? await d.blobToDataUrl(blob) : ''
return dataUrl ? { ok: true, dataUrl, mime: String((blob && blob.type) || '') } : { ok: false, error: 'empty-bytes' }
})
const timeout = new Promise((resolve) => { timer = setTimeout(() => resolve({ ok: false, error: 'timeout' }), timeoutMs) })
try { return await Promise.race([job, timeout]) } catch (e) { return { ok: false, error: String((e && e.message) || 'fetch-failed') } } finally { try { if (timer) clearTimeout(timer) } catch (e2) { /* ignore */ } }
}
}
global.IWBImageIngest = { create, STATE, fetchWithProgress, createFetchBytes }
})(typeof window !== 'undefined' ? window : globalThis)
+10 -2
View File
@@ -11,6 +11,7 @@
function create (deps) {
const d = deps || {}
const missAt = new Map() // key -> 首次发现「无缩略图」的时间(300ms 后回退原图)
const cache = d.cache // Map<stableKey, url>
const max = Math.max(64, Number(d.max) || 768)
// v3.26.121:小档(256)缓存与队列;缺省不启用(只有注入时才分档)
@@ -56,13 +57,20 @@
// 小图没就绪时先给 512(已有就秒出)或占位,绝不为了"小一档"去同步解原图。
if (key && smallCache && need <= smallMax) {
const sm = smallCache.get(key)
if (sm) return sm
if (sm) { missAt.delete(key); return sm }
const orig0 = (v && typeof v === 'object')
? ((typeof d.resolveImg === 'function' ? d.resolveImg(v) : '') || '')
: String(v || '')
if (orig0 && !/^https?:/i.test(orig0) && typeof smallQueue === 'function') smallQueue(key, orig0)
if (thumb) return thumb
return /^https?:/i.test(orig0) ? orig0 : (thumb || '')
// v3.26.172:小图还没生成时**最多占位 300ms**,超时就退回原图 ——
// 之前本地图无缩略图时一律返回空串,遇到「标注替换原图」这类新字节,
// 新 key 没有缓存、缩略图又生成失败/很慢时,节点就一直是空白(观感=图片丢了)。
// v3.26.179:本地图没有缩略图时**直接返回原图**。
// 之前返回空串占位,<img src=""> 会触发 onError,节点体把它永久标成「图片源已失效」,
// 之后又没有重渲染去纠正 ⇒ 标注覆盖后看起来就是“图丢了”(且错误态反复重试吃 CPU)。
// 缩略图仍会在后台生成,就绪后由 bump 触发一次重渲染换小图。
return orig0 || thumb || ''
}
if (thumb && need <= ORIG_HARD_CAP) return thumb
const orig = (v && typeof v === 'object')
+187
View File
@@ -0,0 +1,187 @@
/* image-writeback.js —— 图片写回的唯一收口(v3.26.183)
*
* 为什么单独成模块:v3.26.174~182 的 4 个线上问题全部落在同一条链上
* 「插件写图 → 节点数据 → 缩略图缓存 → 节点渲染」
* 修复时逻辑分散在 app.js 插件桥 / runtime-workbench-logic.saveNodeImage / 缩略图模块,
* 顺序靠人记(先清引用、再写、再失效、再重渲染),改一处漏一处就会复现「图不落地 / CPU 空转」。
* 这里把顺序固定下来,app.js 只做装配。
*
* 插件侧契约(改前先读 docs/standards/plugin-development.md):
* · replaceNodeImageSync —— 同步返回严格布尔:只改内存 + 失效缓存 + bump,不落盘。
* blank-canvas / white-bg-800 都写成 if (!setNodeImage(...)) throw,
* 返回 Promise 会恒真、错误静默,所以这条语义不能改。
* · replaceNodeImage —— Promise<{ok,error}>:落盘 + 回读校验,失败回滚旧图。
* · createNodeImage —— 同步返回节点 id;大图在后台引用化(失败保留 data URL,功能不降级)。
*
* 阈值只有一条判据:deps.inlineMax(= app.js 的 IMPORT_INLINE_MAX,与 wImportImage 同一个常量)。
* 超过即引用化,且统一走 deps.importer(app.js 注入 wImportImage(keepOriginal))——
* 不另造第二套阈值/写库通道。
*/
;(function (global) {
'use strict'
function create (deps) {
const d = deps || {}
const inlineMax = Math.max(1, Number(d.inlineMax) || 3000)
const log = typeof d.log === 'function' ? d.log : function () {}
const isDataUrl = (v) => typeof v === 'string' && v.indexOf('data:') === 0
const isBig = (v) => isDataUrl(v) && v.length > inlineMax
function nodes () { return (d.refs && d.refs.nodes) || [] }
function findNode (id) { const ns = nodes(); for (let i = 0; i < ns.length; i++) if (ns[i] && ns[i].id === id) return ns[i]; return null }
function invalidate (v) { if (v == null || v === '') return; try { if (typeof d.invalidate === 'function') d.invalidate(v) } catch (e) { /* ignore */ } }
function bump () { try { if (typeof d.bump === 'function') d.bump() } catch (e) { /* ignore */ } }
// 引用化:只处理「大于内联阈值」的数据;小图直接内联(同一判据,见模块头)
async function importFor (dataUrl) {
if (!isBig(dataUrl)) return null
if (typeof d.importer !== 'function') return null
try {
const r = await d.importer(dataUrl)
return (r && r.ok) ? r : null
} catch (e) { return null }
}
// 旧图备份:首覆盖取旧 data(其次 url),之后原样沿用;base64 一律引用化
async function origValue (prev) {
const own = prev && prev.orig
if (own) {
if (typeof own !== 'string') return own
if (!isDataUrl(own)) return own
const r = await importFor(own)
return r ? (r.ref || r.data) : own
}
const d0 = prev && prev.data
// 旧图可能已经是引用对象(上一次写回/迁移后的形态):原样当备份,不能再「引用化引用」
const cand = isDataUrl(d0) ? d0 : ((d0 && typeof d0 === 'object') ? d0 : ((prev && typeof prev.url === 'string') ? prev.url : ''))
if (!cand) return ''
if (typeof cand !== 'string') return cand
const r = await importFor(cand)
return r ? (r.ref || r.data) : cand
}
function readBack (id) {
try {
const res = typeof d.readWorkspace === 'function' ? d.readWorkspace() : null
const doc = (res && res.ok === true && res.value) ? res.value : (res && res.workspaces ? res : null)
const ws = ((doc && doc.workspaces) || []).find((w) => w.id === (typeof d.activeWsId === 'function' ? d.activeWsId() : ''))
return (ws && (ws.nodes || []).find((n) => n.id === id)) || null
} catch (e) { return null }
}
// 异步写回:引用化 → 一次 commit → 落盘 → 回读校验(失败回滚)→ 失效双 key → bump
async function replaceNodeImage (id, dataUrl) {
const src = String(dataUrl == null ? '' : dataUrl)
if (!isDataUrl(src)) return { ok: false, error: '图片数据无效' }
const t = findNode(id)
if (!t) return { ok: false, error: '原节点不存在' }
const prev = t.data || {}
if (prev.data === src) return { ok: true } // 没改动:不必落盘,也不该被「数据未变化」误判失败
const res = await importFor(src)
const ref = (res && res.ref) ? res.ref : null
const dataVal = (res && res.data) ? res.data : src
const orig = await origValue(prev)
const patch = { data: dataVal, url: '', localRef: ref, ref: ref }
if (orig) patch.orig = orig
const next = nodes().map((n) => (n && n.id === id ? { ...n, data: { ...(n.data || {}), ...patch } } : n))
d.commitCanvas(next, undefined, undefined)
try { await d.saveNow({ nodes: next }) } catch (e) { /* saveNow 内部会记恢复点 */ }
const saved = readBack(id)
const sd = saved && saved.data
// 不能只看「有没有 data」:保存失败时磁盘上仍是旧图,也是 truthy,必须确认相对旧值发生了变化
const dataOk = !!(sd && ((sd.data && sd.data !== prev.data) || sd.orig !== prev.orig || (sd.url && sd.url !== prev.url)))
if (!dataOk) {
const back = nodes().map((n) => (n && n.id === id ? { ...n, data: prev } : n))
try { d.commitCanvas(back, undefined, undefined) } catch (e) { /* ignore */ }
invalidate(prev.data); invalidate(prev.localRef)
bump()
log('plugin-img save id=' + id + ' ok=false err=disk-verify')
return { ok: false, error: '保存失败,已恢复原图;请检查磁盘空间或资料目录权限' }
}
invalidate(prev.data); invalidate(prev.localRef); invalidate(dataVal); invalidate(src)
bump()
log('plugin-img save id=' + id + ' ok=true ref=' + (ref ? 'Y' : 'N') + ' len=' + src.length)
return { ok: true }
}
// 同步写回:只改内存(一次 commit)+ 失效 + bump,绝不调 saveNow;
// 大图在后台引用化,避免把多 MB base64 留在 DOM/工作区里(与「立即回收内存」同一动作)
function replaceNodeImageSync (id, dataUrl) {
const src = String(dataUrl == null ? '' : dataUrl)
if (!isDataUrl(src)) return false
const t = findNode(id)
if (!t) return false
const prev = t.data || {}
const origCand = (prev.orig && typeof prev.orig !== 'string') ? prev.orig
: (typeof prev.orig === 'string' ? prev.orig
: (isDataUrl(prev.data) ? prev.data : (typeof prev.url === 'string' ? prev.url : '')))
const patch = { data: src, url: '', localRef: null, ref: null }
if (origCand) patch.orig = origCand
try { d.updateNode(id, patch) } catch (e) { return false }
invalidate(prev.data); invalidate(prev.localRef); invalidate(src)
bump()
log('plugin-img set id=' + id + ' len=' + src.length + ' prevLocal=' + (prev.localRef ? 'Y' : 'N'))
if (isBig(src)) {
importFor(src).then((r) => {
if (!r || !r.ref) return
const cur = findNode(id)
if (!cur || (cur.data || {}).data !== src) return // 期间又被覆盖过:不抢
try { d.updateNode(id, { data: r.ref, url: '', localRef: r.ref, ref: r.ref }) } catch (e) { return }
invalidate(src); invalidate(r.ref); bump()
log('plugin-img set id=' + id + ' ref=Y')
}).catch(() => { /* 引用化失败:保留 data URL,功能不降级 */ })
}
const oldOrig = patch.orig
if (isBig(oldOrig)) {
importFor(oldOrig).then((r) => {
if (!r || !(r.ref || r.data)) return
const cur = findNode(id)
if (!cur || (cur.data || {}).orig !== oldOrig) return
try { d.updateNode(id, { orig: r.ref || r.data }) } catch (e) { /* ignore */ }
}).catch(() => { /* ignore */ })
}
return true
}
// 建「参考图」节点:同步返回 id,大图后台引用化(6 个插件只用返回值,故对插件透明)
function createNodeImage (payload) {
const src = payload && payload.dataUrl
if (!isDataUrl(String(src == null ? '' : src))) return null
const at = payload || {}
const id = typeof d.createRefNode === 'function' ? d.createRefNode(at) : null
if (!id) return null
const s = String(src)
if (isBig(s)) {
importFor(s).then((r) => {
if (!r || !r.ref) return
const cur = findNode(id)
if (!cur || (cur.data || {}).data !== s) return
try { d.updateNode(id, { data: r.ref, url: '', localRef: r.ref, ref: r.ref }) } catch (e) { return }
invalidate(s); invalidate(r.ref); bump()
log('plugin-img new id=' + id + ' ref=Y len=' + s.length)
}).catch(() => { /* 保留 data URL */ })
}
return id
}
// 「还原替换前原图」:orig 可能是 string,也可能是引用对象
async function restoreOrig (id) {
const t = findNode(id)
if (!t) return { ok: false, error: '原节点不存在' }
const own = (t.data || {}).orig
let du = ''
if (typeof own === 'string') du = own
else if (own && typeof d.resolveRef === 'function') { try { du = await d.resolveRef(own) } catch (e) { du = '' } }
if (!isDataUrl(du)) return { ok: false, error: '原图已不可用' }
const r = await importFor(du)
const ref = (r && r.ref) ? r.ref : null
d.updateNode(id, { data: (r && r.data) || du, url: '', localRef: ref, ref: ref, orig: '' })
invalidate(du); invalidate(ref); bump()
return { ok: true }
}
return { replaceNodeImage, replaceNodeImageSync, createNodeImage, restoreOrig }
}
global.IWBImageWriteback = { create }
})(typeof window !== 'undefined' ? window : globalThis)
+5 -2
View File
@@ -63,10 +63,13 @@
const res = (Q && typeof Q.queryOutputs === 'function')
? Q.queryOutputs(list, { query: o.query || '', range: o.range || '', limit, width: 320, tile: 130 })
: { filtered: list, visible: list.slice(0, limit), total: list.length }
// 2026-12-02(方案 A:先落地再显示):只展示已落地(orig=ok)的图;
// pending(下载中)/ missing(失败)一律静默隐藏 —— 用户要的是「图库出现时就是完整可用的」,
// 不再先冒一张取不到缩略图的空卡。'off' 是旧版「不备份原图」的历史条目(有缩略图),保留可见。
const items = (res.visible || []).map(function (f) {
return { name: f.name, label: f.label || '', w: f.w || 0, h: f.h || 0, mtime: f.mtime || 0, orig: f.orig || (f.origIdb ? 'ok' : 'missing') }
})
return { items: items, total: res.total || items.length }
}).filter(function (it) { return it.orig === 'ok' || it.orig === 'off' })
return { items: items, total: items.length }
}
global.IWBPluginGallery = { setImpl: setImpl, api: function () { return API }, query: query, emit: emit }
+48
View File
@@ -0,0 +1,48 @@
/* plugin-api-queue.js —— 宿主「任务队列」能力(2026-12-03)
*
* 插件只是一个视图:账本、下载、落地、定位、记录上限全部在宿主。
* 与 gallery 能力同构:setImpl 由 Workbench 每次渲染注入,插件拿到稳定代理。
*/
;(function (global) {
'use strict'
let impl = null
const listeners = []
function setImpl (next) { impl = (next && typeof next === 'object') ? next : null }
function call (name) {
return function () {
const fn = impl && impl[name]
if (typeof fn !== 'function') return Promise.reject(new Error('任务队列能力未就绪'))
try { return Promise.resolve(fn.apply(null, arguments)) } catch (e) { return Promise.reject(e) }
}
}
function emit (reason) {
for (const fn of listeners.slice()) {
try { fn(reason || 'changed') } catch (e) { /* 插件回调异常不影响宿主 */ }
}
}
const API = {
list: call('list'),
retry: call('retry'),
restart: call('restart'),
land: call('land'),
preview: call('preview'),
copyLink: call('copyLink'),
locate: call('locate'),
stats: call('stats'),
clear: call('clear'),
getLimit: call('getLimit'),
setLimit: call('setLimit'),
onChanged: function (fn) {
if (typeof fn !== 'function') return function () {}
listeners.push(fn)
return function () { const i = listeners.indexOf(fn); if (i >= 0) listeners.splice(i, 1) }
},
}
global.IWBPluginQueue = { setImpl, api: function () { return API }, emit }
})(typeof window !== 'undefined' ? window : globalThis)
+126
View File
@@ -0,0 +1,126 @@
/* plugin-canvas-bridge.js —— 插件画布桥(2026-12-02 从 app.js 迁出)
*
* 为什么单独成模块:这是插件唯一能碰画布的入口(读节点 / 建节点 / 写图),
* 之前整块躺在 Workbench 里,占掉约 90 行,而 app.js 与 Workbench 行数棘轮都是零余量。
* 逻辑本身不需要 React —— 依赖全是「读 refs、调用已有命令」,所以按 ctx + 注入搬出来。
*
* 依赖约定(全部由 app.js 注入,模块内不读任何全局可变状态):
* · refs / selRef 画布节点与选中的实时引用
* · updateNode / commitCanvas / saveNow
* · findSpot / placeAtDrop / addPluginNode / uid / cloneNodeDefaults / NODE_TYPES
* · CanvasGeometry 坐标换算(纯函数)
* · importer / inlineMax 引用化唯一入口(app.js 的 wImportImage(keepOriginal) 与 IMPORT_INLINE_MAX)
* · invalidate / bump 缩略图双档缓存失效与重渲染
* · gallerySync / imgRefWrite / ensureTier / pluginPreview / shrinkDataUrl 取图链路
* · showToast / log 用户提示与 _boot.log
* · imageWritebackFactory src/image-writeback.js 的 create
*
* 返回 { bridge, writeback }:app.js 只保存这两个引用,卸载时置空。
*/
;(function (global) {
'use strict'
function create (deps) {
const d = deps || {}
const refs = d.refs
const CanvasGeometry = d.CanvasGeometry
const NODE_TYPES = d.NODE_TYPES
const gallerySync = d.gallerySync
const log = typeof d.log === 'function' ? d.log : function () {}
const showToast = typeof d.showToast === 'function' ? d.showToast : function () {}
const writeback = (d.imageWritebackFactory && typeof d.imageWritebackFactory.create === 'function')
? d.imageWritebackFactory.create({
refs,
updateNode: d.updateNode,
commitCanvas: d.commitCanvas,
saveNow: d.saveNow,
readWorkspace: d.readWorkspace,
activeWsId: d.activeWsId,
inlineMax: d.inlineMax,
importer: d.importer,
invalidate: d.invalidate,
bump: d.bump,
resolveRef: d.resolveRef,
createRefNode: (payload) => {
const at = payload || {}
// 与 createNode 同一套坐标语义:给了有限坐标就用它(拖拽松手点,压住节点时就近吸附),否则走 findSpot 找位
const spot = (CanvasGeometry && CanvasGeometry.wantsDefaultSpot(at.x, at.y)) ? d.findSpot('ref') : d.placeAtDrop('ref', at.x, at.y)
const node = { id: d.uid('n'), type: 'ref', x: spot.x, y: spot.y, data: { url: '', data: String(at.dataUrl), name: String(at.name || 'plugin.png'), localName: null } }
d.commitCanvas(refs.nodes.concat([node]), undefined, undefined)
return node.id
},
log: log,
})
: null
const bridge = {
getNodes: () => refs.nodes.map((n) => ({ id: n.id, type: n.type, x: n.x, y: n.y, data: n.data || {} })),
getSelectedNode: () => {
const id = d.selRef.current && d.selRef.current[0]
const n = id ? refs.nodes.find((x) => x.id === id) : null
return n ? { id: n.id, type: n.type, name: String((n.data && (n.data.name || n.data.title)) || '') } : null
},
// v3.26.61:逻辑在 src/gallery-sync.js 的 nodeImageOf(补 localRef 候选 + 远程按需落地)
getNodeImage: async (id, opts) => {
const n = refs.nodes.find((x) => x.id === id)
if (!n || !gallerySync) return null
const img = await gallerySync.nodeImageOf(n, { writeRef: (src) => d.imgRefWrite(src), onLocalRef: (ref) => d.updateNode(n.id, { localRef: ref }) })
// v3.26.124:插件只要能看/能预览时,给**缩过的**图,别让它整幅解码原图
const max = Math.max(64, Number(opts && opts.max) || 0)
if (!img || !max) return img
try {
const src = img.localRef || img.url || img.dataUrl
if (src && typeof src === 'object') {
const t = await d.ensureTier(src, max)
if (t) { const p = await d.pluginPreview(src, { max }); if (p && p.ok) return Object.assign({}, img, { dataUrl: p.dataUrl, capped: max }) }
} else if (typeof src === 'string' && src.indexOf('data:') === 0) {
const s2 = await d.shrinkDataUrl(src, max)
if (s2) return Object.assign({}, img, { dataUrl: s2, capped: max })
}
} catch (e) { /* ignore */ }
return img
},
createNode: (type, x, y, data) => {
// 插件节点传的是变体 id(web/style…):不在 NODE_TYPES 里,交给 addPluginNode 拼出 plugin:<插件>:<变体>
if (!NODE_TYPES.has(type)) return d.addPluginNode(type, x, y, data) || null
const spot = (CanvasGeometry && CanvasGeometry.wantsDefaultSpot(x, y)) ? d.findSpot(type) : d.placeAtDrop(type, x, y)
const node = { id: d.uid('n'), type, x: spot.x, y: spot.y, data: Object.assign({}, d.cloneNodeDefaults(type), data || {}) }
d.commitCanvas(refs.nodes.concat([node]), undefined, undefined)
return node.id
},
// 屏幕坐标 → 世界坐标:供插件「按住按钮拖到画布上松手」建节点(2026-11-02)。
// 读 .iwb-world 的实时 transform 与 .iwb-canvas 的 rect —— 与 tbCenterSeed 同一套口径,
// 不用 refs.viewport(渲染落后一拍时换算会偏)。换算本身是纯函数,在 canvas-geometry。
screenToWorld: (clientX, clientY) => {
const c = global.document ? global.document.querySelector('.iwb-canvas') : null
if (!c || !c.clientWidth) return null
const wl = /** @type {any} */ (global.document.querySelector('.iwb-world'))
const t = (CanvasGeometry && CanvasGeometry.parseWorldTransform) ? CanvasGeometry.parseWorldTransform(wl && wl.style ? wl.style.transform : '') : null
return CanvasGeometry.clientToWorld(clientX, clientY, c.getBoundingClientRect(), t || refs.viewport)
},
createImageNode: (payload) => (writeback ? writeback.createNodeImage(payload) : null),
// 同步入口:契约上必须返回严格布尔、不落盘(blank-canvas / white-bg-800 依赖)
setNodeImage: (id, dataUrl) => {
const ok = writeback ? writeback.replaceNodeImageSync(id, String(dataUrl || '')) : false
if (ok) { try { showToast('已替换图片', 'ok') } catch (eT) { /* ignore */ } }
return ok
},
// 异步入口:落盘 + 回读校验 + 失败回滚,结果原样回给插件(image-annotate 依赖 ok/error)
saveNodeImage: (id, dataUrl) => {
if (!writeback) return Promise.resolve({ ok: false, error: '画布能力未就绪' })
return writeback.replaceNodeImage(id, dataUrl).then((r) => {
try {
if (r && r.ok) showToast('已覆盖原图', 'ok')
else showToast('覆盖失败:' + String((r && r.error) || '未知原因'), 'err')
} catch (eT) { /* ignore */ }
return r
})
},
}
return { bridge, writeback }
}
global.IWBPluginCanvasBridge = { create }
})(typeof window !== 'undefined' ? window : globalThis)
+2 -2
View File
@@ -4,8 +4,8 @@
const API_VERSION = 1
const ID_PATTERN = /^[a-z][a-z0-9-]{2,31}$/
const REQUIRED_FIELDS = ['id', 'name', 'version', 'apiVersion', 'capabilities']
const CAPABILITIES = ['panels', 'commands', 'nodeTypes', 'generationHooks', 'providers', 'canvas', 'canvasWrite', 'nodeActions', 'gallery', 'grouplib', 'promptlib', 'files', 'images']
const CAPABILITY_API_KEYS = { panels: 'ui', commands: 'commands', nodeTypes: 'nodes', generationHooks: 'generation', providers: 'providers', canvas: 'canvas', canvasWrite: 'canvas', nodeActions: 'nodeActions', gallery: 'gallery', grouplib: 'grouplib', promptlib: 'promptlib', files: 'files', images: 'images' }
const CAPABILITIES = ['panels', 'commands', 'nodeTypes', 'generationHooks', 'providers', 'canvas', 'canvasWrite', 'nodeActions', 'gallery', 'grouplib', 'promptlib', 'files', 'images', 'queue', 'pages']
const CAPABILITY_API_KEYS = { panels: 'ui', commands: 'commands', nodeTypes: 'nodes', generationHooks: 'generation', providers: 'providers', canvas: 'canvas', canvasWrite: 'canvas', nodeActions: 'nodeActions', gallery: 'gallery', grouplib: 'grouplib', promptlib: 'promptlib', files: 'files', images: 'images', queue: 'queue', pages: 'ui' }
function createPluginHost(options) {
const opt = options || {}
+22 -4
View File
@@ -181,9 +181,20 @@
// performance.memory 只有 Chromium 系提供,Safari/Firefox 下静默降级不报错。
let memWarnAt = 0
let memReclaimAt = 0 // v3.26.117:绝对占用护栏的冷却时间(与 75% 那条链互不影响)
let lastUserAt = Date.now() // 2026-12-01:可见但空闲时的轻量回收判断
try {
if (typeof window !== 'undefined' && typeof window.addEventListener === 'function') {
const markUser = () => { lastUserAt = Date.now() }
window.addEventListener('pointerdown', markUser, { passive: true })
window.addEventListener('keydown', markUser, { passive: true })
window.addEventListener('wheel', markUser, { passive: true })
}
} catch (e) { /* ignore */ }
let memDegradeAt = 0
let memDegradeStage = 0 // S15:0=首触(只降级"非打开标签"画板);1=再触(压到活动标签 + 提示关标签)
const memTimer = setInterval(() => {
// v3.26.170:诊断关掉时整轮跳过(不采样、不算内存构成、不跑护栏)
try { if (lsGet('iwb_diag_off', false)) return } catch (e) { /* ignore */ }
try {
// v3.87.6:每次采样都落盘(环形 40 条 ≈ 10 分钟)——标签页被杀后重开即可看到"崩溃前的增长曲线"
// v3.87.37:启动后执行一次存量原图副本清理(只跑一次,localStorage 标记)
@@ -223,11 +234,18 @@
const estNow = (compNow && compNow.procEstMB > 0) ? compNow.procEstMB : 0
const procEst = rssNow > 0 ? rssNow : (estNow > 0 ? estNow : ((mem && mem.usedMB) || 0))
const procLimit = rssNow > 0 ? 1100 : 800
// v3.26.143(用户裁定):只在应用不可见时自动回收。以前在可见时每 2 分钟清缓存,
// 会触发图片重新解码/缩略图重载,表现为周期性卡顿;参考项目也没有运行中自动清缓存。
if (procEst >= procLimit && nowMs - memReclaimAt > 120000 && !(refs && refs.saving) && !(refs && refs.genRuns && refs.genRuns.size) && (typeof document === 'undefined' || document.hidden)) {
// v3.26.143:运行中不每 2 分钟清缓存(会触发图片重解码)。2026-12-01 折中:
// 不可见立即回收;可见但连续 5 分钟没有任何输入时,也只做轻量回收(保留显示缩略图)。
const idleMs = nowMs - lastUserAt
// v3.26.171:自动回收阈值放松 —— 实测 3.4GB 时手动回收能立刻把 CPU 从 20% 降下来
// (大堆导致持续 GC),而旧策略要求「可见且空闲 5 分钟」才动手,日常很难触发。
// 现在:空闲 90s 即可轻量回收;RSS 超过 2500MB 时不等空闲,直接做完整回收(含缩略图缓存)。
const canVisibleIdleReclaim = !(typeof document !== 'undefined' && document.hidden) && idleMs > 90000
const heavyNow = procEst >= 2500
const canReclaim = (typeof document === 'undefined' || document.hidden) || canVisibleIdleReclaim || heavyNow
if (procEst >= procLimit && nowMs - memReclaimAt > 120000 && !(refs && refs.saving) && !(refs && refs.genRuns && refs.genRuns.size) && canReclaim) {
memReclaimAt = nowMs
Promise.resolve().then(() => wReclaimMemoryNow('auto ' + (rssNow > 0 ? 'rss ' : 'est ') + procEst + 'MB', { keepThumbs: true })).catch(() => { /* ignore */ })
Promise.resolve().then(() => wReclaimMemoryNow('auto ' + (heavyNow ? 'heavy ' : (canVisibleIdleReclaim ? 'idle ' : '')) + (rssNow > 0 ? 'rss ' : 'est ') + procEst + 'MB', { keepThumbs: !heavyNow })).catch(() => { /* ignore */ })
}
// 下面这条是「堆占比 ≥75%」的老护栏,只有 Chromium 系(Windows)才有意义
if (!mem || !mem.ratio) return
+20 -1
View File
@@ -91,5 +91,24 @@
return direct
}
g.IWBDownloadAuto = Object.freeze({ create, resolveLocalFirst })
// 方案 A(2026-12-02):自动下载优先等落地队列的本地字节,避免为同一张图再抓一次远程。
// 返回 dataURL;拿不到(无记录/失败/超时)返回 '',交给调用方走原有本地优先链路。
async function waitIngestRef (url, deps) {
const d = deps || {}
if (!url || typeof d.get !== 'function') return ''
const t0 = Date.now()
const max = Math.max(0, Number(d.timeoutMs) || 20000)
for (;;) {
const v = d.get(url)
if (v && v.ref) {
const du = typeof d.refDataUrl === 'function' ? await d.refDataUrl(v.ref) : ''
if (du) return du
}
if (!v || v.status === 'failed') return ''
if (Date.now() - t0 >= max) return ''
await new Promise((r) => setTimeout(r, 250))
}
}
g.IWBDownloadAuto = Object.freeze({ create, resolveLocalFirst, waitIngestRef })
})(typeof window !== 'undefined' ? window : globalThis)
+51 -5
View File
@@ -32,17 +32,20 @@
if (global.console && global.console.warn) global.console.warn('[iwb] ' + line)
} catch (e) { /* ignore */ }
}
const blank = () => ({ at: Date.now(), n: 0, long: 0, max: 0, tags: Object.create(null) })
const blank = () => ({ at: Date.now(), n: 0, long: 0, max: 0, tags: Object.create(null), js: 0, jsMs: 0 })
// 累计器:给自动化测试用的结构化读数。与 60s 落盘窗口相互独立,
// 所以「取一次 snapshot」既不会打断 _boot.log 的汇总节奏,也不会被窗口边界截断。
const total = Object.assign(blank(), { since: 0 })
function tag (name) { tagName = String(name || ''); tagAt = Date.now() }
function flush (now) {
if (!bucket || now - bucket.at < WINDOW_MS) return
if (bucket.long > 0) {
{
const tags = Object.keys(bucket.tags).map((k) => k + ':' + bucket.tags[k]).join(',')
const imgs = (global.document && global.document.images) ? global.document.images.length : -1
logLine('perf ' + Math.round((now - bucket.at) / 1000) + 's frames=' + bucket.n + ' long=' + bucket.long +
' max=' + Math.round(bucket.max) + 'ms tags=' + (tags || '-') + ' domImgs=' + imgs)
' max=' + Math.round(bucket.max) + 'ms js=' + bucket.js + '/' + Math.round(bucket.jsMs) + 'ms tags=' + (tags || '-') + ' domImgs=' + imgs)
}
bucket = blank()
}
@@ -54,11 +57,16 @@
// 首帧、标签页休眠恢复、窗口最小化回来时 dt 会非常大,不算进统计
if (!(dt > 0) || dt > 3000) return
bucket.n++
total.n++
if (!total.since) total.since = Date.now()
if (dt > LONG_MS) {
bucket.long++
if (dt > bucket.max) bucket.max = dt
const name = (Date.now() - tagAt < TAG_TTL) ? tagName : 'idle'
bucket.tags[name] = (bucket.tags[name] || 0) + 1
total.long++
if (dt > total.max) total.max = dt
total.tags[name] = (total.tags[name] || 0) + 1
}
flush(Date.now())
}
@@ -66,14 +74,52 @@
function start () {
if (raf || typeof global.requestAnimationFrame !== 'function') return
bucket = blank()
total.n = 0; total.long = 0; total.max = 0; total.tags = Object.create(null); total.js = 0; total.jsMs = 0; total.since = 0
last = global.performance && global.performance.now ? global.performance.now() : Date.now()
raf = global.requestAnimationFrame(tick)
watchLongTasks()
}
global.IWBPerf = { tag: tag, start: start, recent: recent }
let jsObserver = null
function watchLongTasks () {
if (jsObserver || typeof global.PerformanceObserver !== 'function') return
try {
jsObserver = new global.PerformanceObserver(function (list) {
for (const e of list.getEntries()) { total.js++; total.jsMs += Number(e.duration) || 0; if (!bucket) continue; bucket.js++; bucket.jsMs += Number(e.duration) || 0 }
})
jsObserver.observe({ entryTypes: ['longtask'] })
} catch (e) { jsObserver = null }
}
function stop () {
if (raf) { try { global.cancelAnimationFrame(raf) } catch (e) { /* ignore */ } }
raf = 0
bucket = null
try { if (jsObserver) jsObserver.disconnect() } catch (e) { /* ignore */ }
jsObserver = null
}
// snapshot():返回「自 start() 或上次 snapshot() 以来」的累计读数并清零(结构化,供自动化断言)。
// 字段:frames(帧数)/ long(>50ms 长帧数)/ max(最长帧 ms)/ js、jsMs(longtask 次数与总时长)/ tags(长帧归属)/ since(本段起点)
function snapshot () {
const out = {
frames: total.n,
long: total.long,
max: Math.round(total.max),
js: total.js,
jsMs: Math.round(total.jsMs),
tags: Object.assign({}, total.tags),
since: total.since || 0,
}
total.n = 0; total.long = 0; total.max = 0; total.tags = Object.create(null); total.js = 0; total.jsMs = 0; total.since = 0
return out
}
global.IWBPerf = { tag: tag, start: start, stop: stop, snapshot: snapshot, recent: recent, running: () => !!raf }
// 默认不启动:正式包(对外)不能往 _boot.log 写性能采样。
// 只有构建时 IWB_PERF_PROBE=1 注入 window.__IWB_PERF_PROBE__,
// 或显式设置 localStorage.iwb_perf_probe='1' 时才开启(排查用)。
const wantProbe = global.__IWB_PERF_PROBE__ === 1 || global.__IWB_PERF_PROBE__ === true
let lsOn = false
try { const S = global.IWBStorageLocal; const st = (S && typeof S.getStore === 'function') ? S.getStore() : null; lsOn = !!(st && String(st.get('iwb_perf_probe', '')).replace(/"/g, '') === '1') } catch (e) { lsOn = false }
const wantProbe = global.__IWB_PERF_PROBE__ === 1 || global.__IWB_PERF_PROBE__ === true || lsOn
if (wantProbe && typeof global.requestAnimationFrame === 'function') start()
})(typeof window !== 'undefined' ? window : globalThis)
-1
View File
@@ -36,6 +36,5 @@
} catch (_) { /* 记账本身失败绝不能影响主流程 */ }
}
global.IWBMetricsSwallow = swallow
global.IWBRuntimeMetricsFactory = create
global.IWBRuntimeMetrics = create()
})(typeof window !== 'undefined' ? window : globalThis)
+23 -36
View File
@@ -16,38 +16,6 @@
// 唯一的可变模块级状态:getter/setter 注入(模块内 1 读 1 写)
/** @type {{ get: () => number, set: (v: number) => void }} */
let selfSaveAt = { get: () => 0, set: () => {} }
// 标注「覆盖保存」:写完立刻落盘并校验;失败回滚旧图,返回可读错误。
// 放在本模块是为了守住 app.js 行数棘轮(只做装配);依赖由调用点注入。
async function saveNodeImage(deps, id, dataUrl) {
const d = deps || {}
const refs = d.refs
if (!refs || !/^data:/i.test(String(dataUrl || ''))) return { ok: false, error: '图片数据无效' }
const t = (refs.nodes || []).find((x) => x.id === id)
if (!t) return { ok: false, error: '原节点不存在' }
const prev = t.data || {}
if (prev.data === String(dataUrl)) return { ok: true } // 没改动:不必落盘,也不该被「数据未变化」误判失败
const patch = typeof d.origPatch === 'function' ? d.origPatch(prev, String(dataUrl)) : { data: String(dataUrl), url: '' }
const next = (refs.nodes || []).map((n) => (n.id === id ? { ...n, data: { ...n.data, ...patch } } : n))
d.commitCanvas(next, undefined, undefined)
try { await d.saveNow({ nodes: next }) } catch (e) { /* saveNow 内部会记恢复点 */ }
let saved = null
try {
const res = typeof d.readWorkspace === 'function' ? d.readWorkspace() : null
const doc = (res && res.ok === true && res.value) ? res.value : (res && res.workspaces ? res : null)
const ws = ((doc && doc.workspaces) || []).find((w) => w.id === (typeof d.activeWsId === 'function' ? d.activeWsId() : ''))
saved = ws && (ws.nodes || []).find((n) => n.id === id)
} catch (e) { saved = null }
// 不能只看「有没有 data」:保存失败时磁盘上仍是旧图,也是 truthy。必须确认节点数据相对旧值发生了变化
// (压缩/引用化后 data 可能是 __blob/__cache 对象,但一定不等于旧值)。
const sd = saved && saved.data
const dataOk = !!(sd && ((sd.data && sd.data !== prev.data) || sd.orig !== prev.orig || (sd.url && sd.url !== prev.url)))
if (!dataOk) {
try { d.commitCanvas((refs.nodes || []).map((n) => (n.id === id ? { ...n, data: prev } : n)), undefined, undefined) } catch (e) { /* ignore */ }
return { ok: false, error: '保存失败,已恢复原图;请检查磁盘空间或资料目录权限' }
}
return { ok: true }
}
function inject(d) {
const D = d || {}
GEN_HARD_TIMEOUT_MIN = D.GEN_HARD_TIMEOUT_MIN
@@ -271,6 +239,23 @@
const gn = baseNodes.find((n) => n.id === nodeId)
const cur = gn && Array.isArray(gn.data.result) ? gn.data.result : []
const nextResult = upsertGenerationEntry(cur, entry)
// 2026-12-02:每张结果落地就入队(这里是「结果写进节点数据」的唯一入口,批量/恢复都经过它)
// 2026-12-03:带 meta(画布/节点/提示词/模型/尺寸),任务队列页据此跨画布展示与定位。
const _ws0 = (refs.workspaces || []).find((w) => w.id === runWorkspaceId)
const _task0 = (node && node.data && Array.isArray(node.data.tasks) ? node.data.tasks : []).find((t) => String(t && t.id) === String(pid))
const _promptText = String((_task0 && _task0.text) || (entry && entry.label) || '').slice(0, 80)
const _meta = {
boardId: runWorkspaceId,
boardName: String((_ws0 && _ws0.name) || ''),
nodeId,
prompt: String((entry && (entry.taskTitle || entry.label)) || '').slice(0, 200),
promptText: _promptText,
variant: Number(vi) + 1,
model: String((node && node.data && node.data.model) || ''),
size: size || ((entry && entry.width && entry.height) ? (entry.width + 'x' + entry.height) : ''),
at: Number(entry && entry.at) || Date.now(),
}
try { if (global.__iwbIngest && entry && entry.url) global.__iwbIngest.enqueue({ url: entry.url, source: 'gen', w: entry.width, h: entry.height, meta: _meta }) } catch (eI) { /* 落地失败不得影响出图 */ }
genLatest = baseNodes.map((n) => (n.id === nodeId ? { ...n, data: { ...(n.data || {}), result: nextResult } } : n))
genLatest = commitRunNodes(runWorkspaceId, genLatest)
}
@@ -468,7 +453,8 @@
if (od && od.type === 'out' && (od.w || NODE_W) < 420) applyPatch(od.id, { w: 420 })
}
// 浏览器模式:图库索引/缩略图异步旁路写入,不阻塞生成结果和画布保存。
const runResult = await archiveGenerationResults(groups, () => refreshOutputs())
const _wsName = ((refs.workspaces || []).find((w) => w.id === runWorkspaceId) || {}).name || ''
const runResult = await archiveGenerationResults(groups, () => refreshOutputs(), { boardId: runWorkspaceId, boardName: String(_wsName), nodeId })
const failItems = []
for (const g of groups) for (const x of (g.items || [])) if (!x.ok) failItems.push(x.error || '生成失败')
if (failItems.length) {
@@ -822,7 +808,7 @@
}
const entry = { promptId: 'layers', label: '图层(' + ok.length + ' 张)', items: ok.map((l) => ({ ...l, label: l.name })) }
commitLayerResult(entry)
await archiveGenerationResults([entry], () => refreshOutputs())
await archiveGenerationResults([entry], () => refreshOutputs(), { boardId: activeWsId, boardName: String(((refs.workspaces || []).find((w) => w.id === activeWsId) || {}).name || ''), nodeId })
setNotice({ type: 'ok', text: '已生成 ' + ok.length + ' 张图层 ≈ ¥' + (ok.length * layerPriceOf(szParam)).toFixed(2) })
} catch (e) {
setNotice({ type: 'err', text: apiErrorMessage(e) })
@@ -1666,7 +1652,8 @@
// ③ 语义不变:仍是「变更前捕获」,深度仍 HISTORY_MAX=20,栈结构与存储格式都不变
// ④ 恢复:restore → wBoardNeedsHydrate → wHydrateWorkspace → wEnsureImgUrl 解析 {__cache} → objectURL ✓
// 边界:Cache Storage 不可用(非安全上下文)时**不引用化** —— 宁可多占内存,也不产出指向不存在字节的引用。
const HISTORY_IMG_REF_FIELDS = ['data', 'url', 'result']
// v3.26.183:orig 也进引用化名单 —— 覆盖后 orig 是旧图备份,漏了它每次覆盖都会在撤销快照里留一整串 base64
const HISTORY_IMG_REF_FIELDS = ['data', 'url', 'result', 'orig']
const historyRefUsable = () => { try { return typeof caches !== 'undefined' && !!caches && typeof caches.open === 'function' } catch (e) { return false } }
// d 是快照**独占**的浅拷贝(`{ ...n.data }` 当场生成,谁都不再持有)⇒ 就地改写安全,实时画布的字节不受影响。
// 失败退化为带字节的 data(多占内存,但绝不影响编辑主流程、也绝不丢撤销)。
@@ -2401,5 +2388,5 @@
}
return exportCanvas
}
global.IWBWorkbenchLogic = { inject, saveNodeImage, createCancelActions, createWorkspaceListActions, createWBExportCanvas, createWorkbenchSessions, createWorkbenchCommands, applyLatestSync, ensurePolished, taskCountOf, saveWorkspaceSnapshot, runWorkspaceNodes, commitRunNodes, computeHistColumns, syncOnceNow, startSyncPolling, startCanvasDrop, startGalleryMeasure, startCanvasZoomAndSize, startWsMoreOutside, nodeInGroupOf, selAnchorOf, keyAnomalyOf, joinGroupOf, connectedGroupIdsOf, runNode, saveNow , resumeRuns, pasteGraph, runLLM, runLayerNode, finishGenerationRun, importCanvasFile}
global.IWBWorkbenchLogic = { inject, createCancelActions, createWorkspaceListActions, createWBExportCanvas, createWorkbenchSessions, createWorkbenchCommands, applyLatestSync, ensurePolished, taskCountOf, saveWorkspaceSnapshot, runWorkspaceNodes, commitRunNodes, computeHistColumns, syncOnceNow, startSyncPolling, startCanvasDrop, startGalleryMeasure, startCanvasZoomAndSize, startWsMoreOutside, nodeInGroupOf, selAnchorOf, keyAnomalyOf, joinGroupOf, connectedGroupIdsOf, runNode, saveNow , resumeRuns, pasteGraph, runLLM, runLayerNode, finishGenerationRun, importCanvasFile}
})(typeof window !== 'undefined' ? window : globalThis)
+59 -6
View File
@@ -63,6 +63,7 @@
iwb_web_groups: 'groups.json', // 节点组
iwb_web_groupgroups: 'group-groups.json', // 节点组的分组树
iwb_web_outputs: 'gallery/index.json', // 图库清单(图片字节仍在 images/gallery/,按 hash 引用)
iwb_ingest_idx: 'task-queue/index.json', // 任务队列账本(全局生成记录;不随设置/画布一起写)
}
const libFileOf = (k) => LIB_FILES[k] || ''
const dirtyWs = new Set()
@@ -256,7 +257,13 @@
} catch (e) { return false }
},
async keys() { try { return Object.keys(assets).concat(Object.keys(small)) } catch (e) { return [] } },
async logPut(id, entry) { return kv.put('log:' + id, JSON.stringify(entry)) },
async logPut(id, entry) {
// v3.26.178:兼容两种调用 —— 浏览器端传 (entry),app.js 传 ({id, at, kind, msg, detail})。
// 旧实现只认 (id, entry),桌面端把整个对象当 id ⇒ key 变 log:[object Object]、值变 undefined,
// 所有 wLog 记录互相覆盖成一条垃圾数据。
if (id && typeof id === 'object') { entry = id; id = entry.id || ('log-' + Date.now()) }
return kv.put('log:' + id, JSON.stringify(entry))
},
async logAll() {
const out = []
for (const k of Object.keys(small)) if (k.indexOf('log:') === 0) { try { out.push(JSON.parse(small[k])) } catch (e) { /* ignore */ } }
@@ -1093,6 +1100,36 @@
} catch (e) { return '' }
}
// 2026-12-03:图库条目 → **本地原图**。桌面端原图在 images/gallery/<文件>,老记录没有 origIdb。
// 预览用 galleryOriginalOf(原生按 max 解码,落 thumbs 缓存,可反复命中);下载用 galleryOriginalBlob(原始字节)。
function galleryOrigAssetOf (f) {
try {
if (!enabled() || !dir || !f) return null
const key = String(f.origIdb || ('out_orig_' + String(f.name || '')))
const a = assets[key]
return (a && a.f) ? a : null
} catch (e) { return null }
}
async function galleryOriginalOf (f, max) {
try {
const a = galleryOrigAssetOf(f)
if (!a) return null
const abs = await join(dir, a.f)
const m = Math.max(256, Number(max) || 2048)
const h16 = await sha16(new TextEncoder().encode('galorig:' + String(f.name || a.f)))
const r = await makeDisplayThumbFromPath(h16, abs, m)
return (r && r.url) ? { url: r.url, w: r.w || 0, h: r.h || 0 } : null
} catch (e) { return null }
}
async function galleryOriginalBlob (f) {
try {
const a = galleryOrigAssetOf(f)
if (!a) return null
const abs = await join(dir, a.f)
const u8 = await fs().readFile(abs)
return (u8 && u8.length) ? new Blob([u8], { type: a.m || 'application/octet-stream' }) : null
} catch (e) { return null }
}
// v3.26.131:宫格缩略图改发 **objectURL**(同一张只读一次盘、只建一次 URL)。
// 原来每张都 base64 成 dataURL(20~40KB 字符串),164 张 ⇒ 每次开面板 3~6MB 字符串 + 164 次 IPC,
// 这就是「能加载但很慢」的来源。objectURL 首帧即用,重复打开直接命中。
@@ -1473,6 +1510,10 @@
// 子目录也要扫:images/{canvas,gallery,thumbs,legacy}/ 里的孤儿同样占空间
const subs = ['', 'canvas', 'gallery', 'thumbs', 'legacy']
const orphans = []
// 2026-12-03:thumbs/<hash>_<max>.<ext> 是**显示缓存**(320/512/768/2048),不进 assets、可再生。
// 之前把它们算成「未引用图片」并搬进 trash ⇒ 每次清理都搬一遍新缓存,数字也被夸大。默认不动。
const THUMB_CACHE_RE = /_\d+\.(jpg|jpeg|webp|png)$/i
let thumbCaches = 0
for (const sub of subs) {
const abs = sub ? await join(imgAbs, sub) : imgAbs
let entries = []
@@ -1480,25 +1521,37 @@
for (const e of entries) {
if (!e || e.isDirectory) continue
const rel = IMG_DIR + '/' + (sub ? sub + '/' : '') + e.name
if (!used.has(rel)) orphans.push({ sub: sub, name: e.name, rel: rel })
if (used.has(rel)) continue
if (sub === 'thumbs' && THUMB_CACHE_RE.test(String(e.name))) { thumbCaches++; continue }
orphans.push({ sub: sub, name: e.name, rel: rel })
}
}
// 断链:画布引用了、但登记表里没有的 key —— 这类节点的图**已经显示不出来**,
// GC 不会动它们(文件根本不在),但值得在确认弹窗里报数,让用户知道数据已经缺了。
const dangling = Array.from(canvasKeys).filter((k) => !assets[k]).length
const keptByCanvas = referenced.size
if (dryRun || !orphans.length) return { ok: true, orphans: orphans.length, moved: 0, dryRun: dryRun, dangling: dangling, keptByCanvas: keptByCanvas }
if (dryRun || !orphans.length) return { ok: true, orphans: orphans.length, moved: 0, dryRun: dryRun, dangling: dangling, keptByCanvas: keptByCanvas, thumbCaches: thumbCaches }
const trashAbs = await join(dir, 'trash')
let moved = 0
for (const item of orphans) {
try {
const targetDir = item.sub ? await join(trashAbs, item.sub) : trashAbs
await fs().mkdir(targetDir, { recursive: true })
await fs().rename(await join(imgAbs, item.sub, item.name), await join(targetDir, item.name))
let target = await join(targetDir, item.name)
try {
await fs().rename(await join(imgAbs, item.sub, item.name), target)
} catch (eR) {
// 同名已在 trash 里(上次清理过):加时间戳,别让整条静默失败
const dot = String(item.name).lastIndexOf('.')
const sfx = '-' + Date.now()
const alt = dot > 0 ? String(item.name).slice(0, dot) + sfx + String(item.name).slice(dot) : String(item.name) + sfx
target = await join(targetDir, alt)
await fs().rename(await join(imgAbs, item.sub, item.name), target)
}
moved++
} catch (e) { /* 单条失败忽略 */ }
}
return { ok: true, orphans: orphans.length, moved: moved, dryRun: dryRun, dangling: dangling, keptByCanvas: keptByCanvas }
return { ok: true, orphans: orphans.length, moved: moved, dryRun: dryRun, dangling: dangling, keptByCanvas: keptByCanvas, thumbCaches: thumbCaches }
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
}
@@ -1606,7 +1659,7 @@
enabled, ready: init, flush,
// 供其它模块把诊断写进 _boot.log(v3.26.109)
logLine: (m) => blog(m),
runtime, pickDir, switchTo, migrateTo, deleteImageBytes, deleteGalleryBytesFor, galleryAudit, gcImages, rotateTrash, galleryThumb, galleryThumbUrl, galleryThumbOfEntry, readDisplayThumb, readDisplayThumbUrl, makeDisplayThumb, makeDisplayThumbFromPath, resizeDataUrl, decodeStats, thumbStats, writeDisplayThumb, writeDisplayThumbBlob, pruneThumbs, cleanupLegacy, maintain,
runtime, pickDir, switchTo, migrateTo, deleteImageBytes, deleteGalleryBytesFor, galleryAudit, gcImages, rotateTrash, galleryThumb, galleryThumbUrl, galleryThumbOfEntry, galleryOriginalOf, galleryOriginalBlob, readDisplayThumb, readDisplayThumbUrl, makeDisplayThumb, makeDisplayThumbFromPath, resizeDataUrl, decodeStats, thumbStats, writeDisplayThumb, writeDisplayThumbBlob, pruneThumbs, cleanupLegacy, maintain,
plugins: { manifest: pluginManifest, read: pluginRead, write: pluginWrite, remove: pluginRemove, dir: pluginDir, listLocal: pluginListLocal, listDirs: pluginListDirs, readFile: pluginReadFile, writeFile: pluginWriteFile, writeBinary: pluginWriteBinary, mkdir: pluginMkdir, removeDir: pluginRemoveDir, renameDir: pluginRenameDir, existsDir: pluginExistsDir },
pluginData: { read: pluginDataRead, write: pluginDataWrite, remove: pluginDataRemove, list: pluginDataList },
pluginFiles: { put: pluginFilePut, get: pluginFileGet, list: pluginFileList, remove: pluginFileRemove, stat: pluginFileStat, dir: pluginFilesDir, readBytes: pluginFileReadBytes, listAll: pluginFilesListAll },
+2 -1
View File
@@ -29,7 +29,8 @@
const added = []
for (const item of items || []) if (item && item.url) {
const name = item.name || ('gen_' + Date.now() + '_' + Math.floor(Math.random() * 1e6) + '.png')
index.push({ name, url: item.url, size: item.size || 0, mtime: item.mtime || Date.now(), w: item.width || item.w || 0, h: item.height || item.h || 0, label: item.label || '' })
// 2026-12-03:保留 orig 状态 —— 之前重建行时丢掉它,行若在 markOk 之后创建就永远显示「未落地」。
index.push({ name, url: item.url, size: item.size || 0, mtime: item.mtime || Date.now(), w: item.width || item.w || 0, h: item.height || item.h || 0, label: item.label || '', orig: item.orig || 'pending' })
added.push(name)
}
const opts = options || {}
-1
View File
@@ -139,6 +139,5 @@
const runtimeInstance = createStorageRuntime(defaultContract)
const runtimeCompat = function (contract) { return createStorageRuntime(contract || defaultContract) }
Object.assign(runtimeCompat, runtimeInstance)
global.IWBStorageRuntimeFactory = createStorageRuntime
global.IWBStorageRuntime = runtimeCompat
})(typeof window !== 'undefined' ? window : globalThis)
Loaded 100 of 130 files, more files were not shown because too many files have changed in this diff. Show more