ysk-omni 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,45 @@ Newest first. Every version from 1.0.0 is grouped by category. `README.md` shows
4
4
 
5
5
  Entries come from git history, tags, and GitHub Releases.
6
6
 
7
+ ## 1.0.10 — 2026-11-29
8
+
9
+ ### Security
10
+
11
+ - Vendor Admin DOMPurify **3.4.18 → 3.5.0** (`public/admin/vendor/purify.min.js`, official minified 3.5.0 build). 3.5.0 (2026-11-22) is a security release; there will be no further 3.4.x. GHSA-hrxw-jjj6-2g2j (Low): further `SAFE_FOR_TEMPLATES` bypass where nested tags can reassemble template expressions when sanitized output is reparsed. Also hardens DOM-input template bypasses, `IN_PLACE` fail-closed / hook cases, custom-element namespace checks, and hook config isolation. Admin chat markdown still sanitizes **string** HTML from marked with `USE_PROFILES: { html: true }` — not `SAFE_FOR_TEMPLATES`, `IN_PLACE`, hooks, or `CUSTOM_ELEMENT_HANDLING`. DOMPurify 4 is held.
12
+ - Production hosts should run Node ≥22.23.5, ≥24.22.3, or ≥26.13.1. As of 2026-11-29 those are still the current builds on those lines (no newer 22/24/26 security release after 2026-11-11). Package `engines` stay `>=20`. CI stays on Node 24.
13
+
14
+ ### Dependency upgrades
15
+
16
+ - `typescript-eslint` 8.73.0 → 8.74.0, including the matching `@typescript-eslint/*` packages (`adjacent-overload-signatures` `ignoreAccessors`; parser `jsxPragma` null for the automatic JSX runtime; plugin bugfixes: no-implied-eval switch discriminant, no-unsafe-enum-assignment, consistent-generic-constructors, no-deprecated union properties, array-type readonly autofix). This repo uses `tseslint.configs.recommended` (not type-checked). `no-unsafe-class-instance-assignment` is still not enabled. Canary 8.74.1-alpha.* is not taken.
17
+ - Lockfile `@types/node` 22.20.5 → 22.20.7 (latest 22.x; stay off 24/26). Other direct dependencies were already at the latest within-major version in the lockfile and were not changed.
18
+
19
+ ### Internal/CI
20
+
21
+ - Bump the package version to 1.0.10, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.10.
22
+ - Operations docs (English and 中文) re-check the Node current builds as of 2026-11-29: still 22.23.5, 24.22.3, and 26.13.1. Production floor stays ≥22.23.5, ≥24.22.3, or ≥26.13.1. `engines` and CI Node 24 are unchanged.
23
+ - Admin DOMPurify 3.5.0 tests: official minified build identity, Admin `USE_PROFILES: { html: true }` sanitizer wiring, and confirmation that Admin does not use `SAFE_FOR_TEMPLATES`, `IN_PLACE`, hooks, or `CUSTOM_ELEMENT_HANDLING`.
24
+
25
+ GitHub Release: https://github.com/yanshekki/ysk-omni/releases/tag/v1.0.10
26
+ Compare: https://github.com/yanshekki/ysk-omni/compare/v1.0.9...v1.0.10
27
+
28
+ ## 1.0.9 — 2026-11-22
29
+
30
+ ### Fixes
31
+
32
+ - Drain in-flight chat-queue jobs when the worker stops, and swallow Prisma writes that happen after `$disconnect`, so test teardown does not become an unhandled rejection. Shared-core (OTP login, admin panel, queue, API keys, DDoS); GCtoAC should port.
33
+
34
+ ### Dependency upgrades
35
+
36
+ - `typescript-eslint` 8.72.2 → 8.73.0, including the matching `@typescript-eslint/*` packages (`consistent-type-imports` narrower report location; new rule `no-unsafe-class-instance-assignment`; `typescript-estree` `projectService.EXPERIMENTAL_backend` for TypeScript 7.1 — not enabled). Other direct dependencies were already at the latest within-major version in the lockfile and were not changed.
37
+
38
+ ### Internal/CI
39
+
40
+ - Bump the package version to 1.0.9, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.9.
41
+ - Operations docs (English and 中文) re-check the Node current builds as of 2026-11-22: still 22.23.5, 24.22.3, and 26.13.1. Production floor stays ≥22.23.5, ≥24.22.3, or ≥26.13.1. `engines` and CI Node 24 are unchanged.
42
+
43
+ GitHub Release: https://github.com/yanshekki/ysk-omni/releases/tag/v1.0.9
44
+ Compare: https://github.com/yanshekki/ysk-omni/compare/v1.0.8...v1.0.9
45
+
7
46
  ## 1.0.8 — 2026-11-15
8
47
 
9
48
  ### Security
package/CHANGELOG.zh.md CHANGED
@@ -4,6 +4,45 @@
4
4
 
5
5
  條目來自 git 歷史、標籤與 GitHub Release。
6
6
 
7
+ ## 1.0.10 — 2026-11-29
8
+
9
+ ### 安全
10
+
11
+ - Admin 內嵌的 DOMPurify 由 **3.4.18** 升到 **3.5.0**(`public/admin/vendor/purify.min.js`,官方 3.5.0 壓縮檔)。3.5.0(2026-11-22)是安全版本;不會再有 3.4.x。GHSA-hrxw-jjj6-2g2j(低):進一步的 `SAFE_FOR_TEMPLATES` 繞過,嵌套標籤可在消毒輸出再解析時重組模板表達式。同時加固 DOM 輸入的模板繞過、`IN_PLACE` 失敗關閉/hook 情況、自訂元素命名空間檢查,以及 hook 設定隔離。對話 markdown 仍對 marked 產出的**字串** HTML 用 `USE_PROFILES: { html: true }` 消毒 — 不用 `SAFE_FOR_TEMPLATES`、`IN_PLACE`、hook 或 `CUSTOM_ELEMENT_HANDLING`。DOMPurify 4 暫不升級。
12
+ - 生產主機應使用 Node ≥22.23.5、≥24.22.3 或 ≥26.13.1。截至 2026-11-29,這些仍是各線上的現行版本(2026-11-11 之後沒有更新的 22/24/26 安全版本)。套件 `engines` 維持 `>=20`。CI 仍用 Node 24。
13
+
14
+ ### 依賴升級
15
+
16
+ - `typescript-eslint` 8.73.0 → 8.74.0,連同對應的 `@typescript-eslint/*`(`adjacent-overload-signatures` 的 `ignoreAccessors`;解析器在 automatic JSX runtime 下 `jsxPragma` 為 null;外掛修正:no-implied-eval 的 switch discriminant、no-unsafe-enum-assignment、consistent-generic-constructors、no-deprecated 聯合型別屬性、array-type readonly 自動修正)。本倉庫使用 `tseslint.configs.recommended`(非 type-checked)。`no-unsafe-class-instance-assignment` 仍未啟用。不採用 canary 8.74.1-alpha.*。
17
+ - lockfile 的 `@types/node` 由 22.20.5 升到 22.20.7(22.x 最新;不跳到 24/26)。其餘直接依賴在 lockfile 已是主版本內的最新版,沒有改動。
18
+
19
+ ### 內部/CI
20
+
21
+ - 將套件版本升至 1.0.10、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.10。
22
+ - 維運文件(英文與中文)於 2026-11-29 再核對 Node 現行版本:仍是 22.23.5、24.22.3 與 26.13.1。生產下限維持 ≥22.23.5、≥24.22.3 或 ≥26.13.1。`engines` 與 CI 的 Node 24 不變。
23
+ - 新增 Admin DOMPurify 3.5.0 測試:核對官方壓縮檔、Admin `USE_PROFILES: { html: true }` 消毒接線,並確認 Admin 不用 `SAFE_FOR_TEMPLATES`、`IN_PLACE`、hook 或 `CUSTOM_ELEMENT_HANDLING`。
24
+
25
+ GitHub Release:https://github.com/yanshekki/ysk-omni/releases/tag/v1.0.10
26
+ 比較:https://github.com/yanshekki/ysk-omni/compare/v1.0.9...v1.0.10
27
+
28
+ ## 1.0.9 — 2026-11-22
29
+
30
+ ### 修正
31
+
32
+ - 佇列 worker 停止時排空進行中的工作,並吞掉 Prisma `$disconnect` 之後的寫入,避免測試 teardown 變成未處理拒絕。共用核心(OTP 登入、Admin、佇列、API 金鑰、DDoS);GCtoAC 應一併移植。
33
+
34
+ ### 依賴升級
35
+
36
+ - `typescript-eslint` 8.72.2 → 8.73.0,連同對應的 `@typescript-eslint/*`(`consistent-type-imports` 報告位置收窄;新規則 `no-unsafe-class-instance-assignment`;`typescript-estree` 的 `projectService.EXPERIMENTAL_backend` 供 TypeScript 7.1 使用 — 未啟用)。其餘直接依賴在 lockfile 已是主版本內的最新版,沒有改動。
37
+
38
+ ### 內部/CI
39
+
40
+ - 將套件版本升至 1.0.9、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.9。
41
+ - 維運文件(英文與中文)於 2026-11-22 再核對 Node 現行版本:仍是 22.23.5、24.22.3 與 26.13.1。生產下限維持 ≥22.23.5、≥24.22.3 或 ≥26.13.1。`engines` 與 CI 的 Node 24 不變。
42
+
43
+ GitHub Release:https://github.com/yanshekki/ysk-omni/releases/tag/v1.0.9
44
+ 比較:https://github.com/yanshekki/ysk-omni/compare/v1.0.8...v1.0.9
45
+
7
46
  ## 1.0.8 — 2026-11-15
8
47
 
9
48
  ### 安全
package/README-ZH.md CHANGED
@@ -34,54 +34,58 @@ curl -sS http://127.0.0.1:3850/v1/models \
34
34
 
35
35
  ## 更新日誌
36
36
 
37
- ### 1.0.8 — 2026-11-15
37
+ ### 1.0.10 — 2026-11-29
38
38
 
39
39
  ### 安全
40
40
 
41
- - 將 `vite` 由 6.4.5 升至 **6.4.6**,修復 GHSA-p4f5-76q4-ffq7(危急)。未跳脫的 `__vite-browser-external`/`__vite-optional-peer-dep` 虛擬模組 ID,在 Vite **開發**伺服器對外開放(`--host`/`server.host`)時可遠端執行程式碼。受影響範圍:Vite `>=4.0.0,<=6.4.5`。生產環境 Admin 是已建置的靜態檔;`dev:admin` 與 lockfile 中的 Vite 已修補。變更日誌:6.4.6(2026-11-09)「fix: escape ids in resolve virtual modules」。
42
- - Admin 內嵌的 DOMPurify 由 **3.4.17** 升到 **3.4.18**(`public/admin/vendor/purify.min.js`,官方 3.4.18 壓縮檔)。3.4.18(2026-11-14)修復 `SAFE_FOR_TEMPLATES` 再解析繞過,以及 hook 把 config 物件交回 `sanitize()` 時允許清單外洩。對話 markdown 仍用 `USE_PROFILES: { html: true }` 消毒。
43
- - 生產主機應使用 Node ≥22.23.5、≥24.22.3 或 ≥26.13.1(2026-11-11 安全版本:CVE-2026-123863、CVE-2026-123864 及同批)。套件 `engines` 維持 `>=20`。CI 仍用 Node 24。
41
+ - Admin 內嵌的 DOMPurify 由 **3.4.18** 升到 **3.5.0**(`public/admin/vendor/purify.min.js`,官方 3.5.0 壓縮檔)。3.5.0(2026-11-22)是安全版本;不會再有 3.4.x。GHSA-hrxw-jjj6-2g2j(低):進一步的 `SAFE_FOR_TEMPLATES` 繞過,嵌套標籤可在消毒輸出再解析時重組模板表達式。同時加固 DOM 輸入的模板繞過、`IN_PLACE` 失敗關閉/hook 情況、自訂元素命名空間檢查,以及 hook 設定隔離。對話 markdown 仍對 marked 產出的**字串** HTML 用 `USE_PROFILES: { html: true }` 消毒 — 不用 `SAFE_FOR_TEMPLATES`、`IN_PLACE`、hook 或 `CUSTOM_ELEMENT_HANDLING`。DOMPurify 4 暫不升級。
42
+ - 生產主機應使用 Node ≥22.23.5、≥24.22.3 或 ≥26.13.1。截至 2026-11-29,這些仍是各線上的現行版本(2026-11-11 之後沒有更新的 22/24/26 安全版本)。套件 `engines` 維持 `>=20`。CI 仍用 Node 24。
44
43
 
45
44
  ### 依賴升級
46
45
 
47
- - `vite` 6.4.5 → 6.4.6
48
- - `typescript-eslint` 8.72.1 → 8.72.2,連同對應的 `@typescript-eslint/*`(外掛修正:prefer-string-starts-ends-with、no-deprecated 循環別名、no-unnecessary-type-assertion、prefer-nullish-coalescing)
49
- - 傳遞依賴 `qs` 的 override 由 **6.16.2** 改為 **6.17.1**。6.16.2 已不在 GHSA-6pq8-jhm2-2vcw/CVE-2026-110816 與 GHSA-w4cr-vjpx-p82q/CVE-2026-110910 範圍內;6.17.1 是目前 6.x。與 GCtoAC 1.7.9 一致。
50
- - 對齊 package.json 下限 `cors` `^2.8.6` 與 `@types/cors` `^2.8.19`(lockfile 本來已解析到這些版本)。
46
+ - `typescript-eslint` 8.73.0 → 8.74.0,連同對應的 `@typescript-eslint/*`(`adjacent-overload-signatures` 的 `ignoreAccessors`;解析器在 automatic JSX runtime 下 `jsxPragma` 為 null;外掛修正:no-implied-eval 的 switch discriminant、no-unsafe-enum-assignment、consistent-generic-constructors、no-deprecated 聯合型別屬性、array-type readonly 自動修正)。本倉庫使用 `tseslint.configs.recommended`(非 type-checked)。`no-unsafe-class-instance-assignment` 仍未啟用。不採用 canary 8.74.1-alpha.*。
47
+ - lockfile 的 `@types/node` 由 22.20.5 升到 22.20.7(22.x 最新;不跳到 24/26)。其餘直接依賴在 lockfile 已是主版本內的最新版,沒有改動。
51
48
 
52
49
  ### 內部/CI
53
50
 
54
- - 將套件版本升至 1.0.8、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.8。
55
- - 快速開始與維運文件(英文與中文)記錄 2026-11-11 的生產 Node 下限。`engines` 與 CI 的 Node 24 不變。
51
+ - 將套件版本升至 1.0.10、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.10。
52
+ - 維運文件(英文與中文)於 2026-11-29 再核對 Node 現行版本:仍是 22.23.5、24.22.3 與 26.13.1。生產下限維持 ≥22.23.5、≥24.22.3 或 ≥26.13.1。`engines` 與 CI 的 Node 24 不變。
53
+ - 新增 Admin DOMPurify 3.5.0 測試:核對官方壓縮檔、Admin `USE_PROFILES: { html: true }` 消毒接線,並確認 Admin 不用 `SAFE_FOR_TEMPLATES`、`IN_PLACE`、hook 或 `CUSTOM_ELEMENT_HANDLING`。
56
54
 
57
- ### 1.0.7 — 2026-11-08
55
+ ### 1.0.9 — 2026-11-22
58
56
 
59
- ### 安全
57
+ ### 修正
58
+
59
+ - 佇列 worker 停止時排空進行中的工作,並吞掉 Prisma `$disconnect` 之後的寫入,避免測試 teardown 變成未處理拒絕。共用核心(OTP 登入、Admin、佇列、API 金鑰、DDoS);GCtoAC 應一併移植。
60
60
 
61
- - 用 `overrides` 把傳遞依賴 `qs` 釘在 **6.16.2**(express 與 body-parser 宣告 `~6.16.0`)。lockfile 先前是 6.16.0,落在 GHSA-6pq8-jhm2-2vcw/CVE-2026-110816(中等,`qs.stringify` 配 `arrayFormat: 'comma'` 遇到不可呼叫的自有 `toString` 會拋錯;6.16.1 已修)同 GHSA-w4cr-vjpx-p82q/CVE-2026-110910(低,`allowEmptyArrays` 沒有編碼空陣列的 key;6.16.2 已修)。qs 6.17.1 是 6.x 最新版,同樣沒有已知公告;此釘選與 GCtoAC 一致。
62
- - Admin 內嵌的 DOMPurify 由 **3.2.4** 升到 **3.4.17**(`public/admin/vendor/purify.min.js`)。3.2.4 落在 CVE-2025-15599(3.2.7 已修)同 CVE-2026-0540(3.3.2 已修)範圍內。3.4.17 是目前 npm 上的 3.x,沒有已知公告。對話 markdown 仍用 `USE_PROFILES: { html: true }` 消毒。
61
+ ### 依賴升級
62
+
63
+ - `typescript-eslint` 8.72.2 → 8.73.0,連同對應的 `@typescript-eslint/*`(`consistent-type-imports` 報告位置收窄;新規則 `no-unsafe-class-instance-assignment`;`typescript-estree` 的 `projectService.EXPERIMENTAL_backend` 供 TypeScript 7.1 使用 — 未啟用)。其餘直接依賴在 lockfile 已是主版本內的最新版,沒有改動。
63
64
 
64
65
  ### 內部/CI
65
66
 
66
- - 將套件版本升至 1.0.7、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.7。
67
- - 維運文件(英文與中文)於 2026-11-08 再核對 Node 現行版本:仍是 22.23.4、24.22.2 與 26.13.0。生產下限維持 ≥22.23.4、≥24.22.1 或 ≥26.12.1。
67
+ - 將套件版本升至 1.0.9、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.9。
68
+ - 維運文件(英文與中文)於 2026-11-22 再核對 Node 現行版本:仍是 22.23.5、24.22.3 與 26.13.1。生產下限維持 ≥22.23.5、≥24.22.3 或 ≥26.13.1。`engines` 與 CI 的 Node 24 不變。
68
69
 
69
- ### 1.0.6 — 2026-11-01
70
+ ### 1.0.8 — 2026-11-15
70
71
 
71
72
  ### 安全
72
73
 
73
- - CI(`.github/workflows/ci.yml`)改在 Node 24 上跑測試,不再使用 Node 20。Node 20 已結束支援(最後版本 20.20.2),沒有 CVE-2026-111497(Brotli 越界寫入)的修補。發佈工作流程本來已在 Node 24 上發佈。套件 `engines` 維持 `>=20`。
74
- - 生產主機應使用 Node ≥22.23.4、≥24.22.1 或 ≥26.12.1。截至 2026-11-01,這些線上的現行版本是 22.23.4、24.22.2 與 26.13.0。
74
+ - 將 `vite` 由 6.4.5 升至 **6.4.6**,修復 GHSA-p4f5-76q4-ffq7(危急)。未跳脫的 `__vite-browser-external`/`__vite-optional-peer-dep` 虛擬模組 ID,在 Vite **開發**伺服器對外開放(`--host`/`server.host`)時可遠端執行程式碼。受影響範圍:Vite `>=4.0.0,<=6.4.5`。生產環境 Admin 是已建置的靜態檔;`dev:admin` 與 lockfile 中的 Vite 已修補。變更日誌:6.4.6(2026-11-09)「fix: escape ids in resolve virtual modules」。
75
+ - Admin 內嵌的 DOMPurify 由 **3.4.17** 升到 **3.4.18**(`public/admin/vendor/purify.min.js`,官方 3.4.18 壓縮檔)。3.4.18(2026-11-14)修復 `SAFE_FOR_TEMPLATES` 再解析繞過,以及 hook 把 config 物件交回 `sanitize()` 時允許清單外洩。對話 markdown 仍用 `USE_PROFILES: { html: true }` 消毒。
76
+ - 生產主機應使用 Node ≥22.23.5、≥24.22.3 或 ≥26.13.1(2026-11-11 安全版本:CVE-2026-123863、CVE-2026-123864 及同批)。套件 `engines` 維持 `>=20`。CI 仍用 Node 24。
75
77
 
76
78
  ### 依賴升級
77
79
 
78
- - `typescript-eslint` 8.72.0 → 8.72.1,連同對應的 `@typescript-eslint/*`。其餘直接依賴在 lockfile 已是主版本內的最新版,沒有改動。
80
+ - `vite` 6.4.5 → 6.4.6
81
+ - `typescript-eslint` 8.72.1 → 8.72.2,連同對應的 `@typescript-eslint/*`(外掛修正:prefer-string-starts-ends-with、no-deprecated 循環別名、no-unnecessary-type-assertion、prefer-nullish-coalescing)
82
+ - 傳遞依賴 `qs` 的 override 由 **6.16.2** 改為 **6.17.1**。6.16.2 已不在 GHSA-6pq8-jhm2-2vcw/CVE-2026-110816 與 GHSA-w4cr-vjpx-p82q/CVE-2026-110910 範圍內;6.17.1 是目前 6.x。與 GCtoAC 1.7.9 一致。
83
+ - 對齊 package.json 下限 `cors` `^2.8.6` 與 `@types/cors` `^2.8.19`(lockfile 本來已解析到這些版本)。
79
84
 
80
85
  ### 內部/CI
81
86
 
82
- - 將套件版本升至 1.0.6、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.6。
83
- - 快速開始、維運與開發文件(英文與中文)記錄 CI 使用 Node 24,以及生產環境的 Node 下限。
84
- - 將 Admin `formatApiError` 的後備錯誤本體標成錯誤物件,讓 `npm run typecheck:admin` 接受 `details.feature`、`details.flag` 與 `details.reason`。執行時期行為不變。
87
+ - 將套件版本升至 1.0.8、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.8。
88
+ - 快速開始與維運文件(英文與中文)記錄 2026-11-11 的生產 Node 下限。`engines` 與 CI 的 Node 24 不變。
85
89
 
86
90
  完整更新日誌:[CHANGELOG.zh.md](./CHANGELOG.zh.md)。
87
91
 
package/README.md CHANGED
@@ -34,54 +34,58 @@ Full CLI, API, Admin, Catalog, Runtimes, keys, and operations: **[Documentation]
34
34
 
35
35
  ## Changelog
36
36
 
37
- ### 1.0.8 — 2026-11-15
37
+ ### 1.0.10 — 2026-11-29
38
38
 
39
39
  ### Security
40
40
 
41
- - Upgrade `vite` 6.4.5 → **6.4.6** for GHSA-p4f5-76q4-ffq7 (Critical). Unescaped `__vite-browser-external` / `__vite-optional-peer-dep` virtual module IDs allowed RCE when the Vite **dev** server is exposed (`--host` / `server.host`). Affected: Vite `>=4.0.0,<=6.4.5`. Production Admin is a built static bundle; `dev:admin` and the locked Vite version are patched. Changelog: 6.4.6 (2026-11-09) “fix: escape ids in resolve virtual modules”.
42
- - Vendor Admin DOMPurify **3.4.17 → 3.4.18** (`public/admin/vendor/purify.min.js`, official minified 3.4.18 build). 3.4.18 (2026-11-14) fixes a `SAFE_FOR_TEMPLATES` reparse bypass and hook allow-list leakage when a hook passes the config object back to `sanitize()`. Chat markdown still sanitizes with `USE_PROFILES: { html: true }`.
43
- - Production hosts should run Node ≥22.23.5, ≥24.22.3, or ≥26.13.1 (2026-11-11 security releases: CVE-2026-123863, CVE-2026-123864 and siblings). Package `engines` stay `>=20`. CI stays on Node 24.
41
+ - Vendor Admin DOMPurify **3.4.18 → 3.5.0** (`public/admin/vendor/purify.min.js`, official minified 3.5.0 build). 3.5.0 (2026-11-22) is a security release; there will be no further 3.4.x. GHSA-hrxw-jjj6-2g2j (Low): further `SAFE_FOR_TEMPLATES` bypass where nested tags can reassemble template expressions when sanitized output is reparsed. Also hardens DOM-input template bypasses, `IN_PLACE` fail-closed / hook cases, custom-element namespace checks, and hook config isolation. Admin chat markdown still sanitizes **string** HTML from marked with `USE_PROFILES: { html: true }` — not `SAFE_FOR_TEMPLATES`, `IN_PLACE`, hooks, or `CUSTOM_ELEMENT_HANDLING`. DOMPurify 4 is held.
42
+ - Production hosts should run Node ≥22.23.5, ≥24.22.3, or ≥26.13.1. As of 2026-11-29 those are still the current builds on those lines (no newer 22/24/26 security release after 2026-11-11). Package `engines` stay `>=20`. CI stays on Node 24.
44
43
 
45
44
  ### Dependency upgrades
46
45
 
47
- - `vite` 6.4.5 → 6.4.6
48
- - `typescript-eslint` 8.72.1 → 8.72.2, including the matching `@typescript-eslint/*` packages (plugin bugfixes: prefer-string-starts-ends-with, no-deprecated circular aliases, no-unnecessary-type-assertion, prefer-nullish-coalescing)
49
- - Transitive `qs` override **6.16.2 → 6.17.1**. 6.16.2 is already OSV-clean for GHSA-6pq8-jhm2-2vcw / CVE-2026-110816 and GHSA-w4cr-vjpx-p82q / CVE-2026-110910; 6.17.1 is current 6.x. Matches GCtoAC 1.7.9.
50
- - Align package.json floors `cors` `^2.8.6` and `@types/cors` `^2.8.19` (lockfile already resolved those versions).
46
+ - `typescript-eslint` 8.73.0 → 8.74.0, including the matching `@typescript-eslint/*` packages (`adjacent-overload-signatures` `ignoreAccessors`; parser `jsxPragma` null for the automatic JSX runtime; plugin bugfixes: no-implied-eval switch discriminant, no-unsafe-enum-assignment, consistent-generic-constructors, no-deprecated union properties, array-type readonly autofix). This repo uses `tseslint.configs.recommended` (not type-checked). `no-unsafe-class-instance-assignment` is still not enabled. Canary 8.74.1-alpha.* is not taken.
47
+ - Lockfile `@types/node` 22.20.5 → 22.20.7 (latest 22.x; stay off 24/26). Other direct dependencies were already at the latest within-major version in the lockfile and were not changed.
51
48
 
52
49
  ### Internal/CI
53
50
 
54
- - Bump the package version to 1.0.8, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.8.
55
- - Getting started and operations docs (English and 中文) record the 2026-11-11 production Node floor. `engines` and CI Node 24 are unchanged.
51
+ - Bump the package version to 1.0.10, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.10.
52
+ - Operations docs (English and 中文) re-check the Node current builds as of 2026-11-29: still 22.23.5, 24.22.3, and 26.13.1. Production floor stays ≥22.23.5, ≥24.22.3, or ≥26.13.1. `engines` and CI Node 24 are unchanged.
53
+ - Admin DOMPurify 3.5.0 tests: official minified build identity, Admin `USE_PROFILES: { html: true }` sanitizer wiring, and confirmation that Admin does not use `SAFE_FOR_TEMPLATES`, `IN_PLACE`, hooks, or `CUSTOM_ELEMENT_HANDLING`.
56
54
 
57
- ### 1.0.7 — 2026-11-08
55
+ ### 1.0.9 — 2026-11-22
58
56
 
59
- ### Security
57
+ ### Fixes
58
+
59
+ - Drain in-flight chat-queue jobs when the worker stops, and swallow Prisma writes that happen after `$disconnect`, so test teardown does not become an unhandled rejection. Shared-core (OTP login, admin panel, queue, API keys, DDoS); GCtoAC should port.
60
60
 
61
- - Pin transitive `qs` at **6.16.2** via `overrides` (express and body-parser declare `~6.16.0`). Lockfile was 6.16.0, which is inside GHSA-6pq8-jhm2-2vcw / CVE-2026-110816 (moderate, `qs.stringify` with `arrayFormat: 'comma'` throws on a non-callable own `toString`; patched in 6.16.1) and GHSA-w4cr-vjpx-p82q / CVE-2026-110910 (low, `allowEmptyArrays` did not encode empty-array keys; patched in 6.16.2). qs 6.17.1 is the latest 6.x and is also clean; this pin matches GCtoAC.
62
- - Vendor Admin DOMPurify **3.2.4 → 3.4.17** (`public/admin/vendor/purify.min.js`). 3.2.4 is inside CVE-2025-15599 (fixed in 3.2.7) and CVE-2026-0540 (fixed in 3.3.2). 3.4.17 is the current npm 3.x with no known advisories. Chat markdown still sanitizes with `USE_PROFILES: { html: true }`.
61
+ ### Dependency upgrades
62
+
63
+ - `typescript-eslint` 8.72.2 → 8.73.0, including the matching `@typescript-eslint/*` packages (`consistent-type-imports` narrower report location; new rule `no-unsafe-class-instance-assignment`; `typescript-estree` `projectService.EXPERIMENTAL_backend` for TypeScript 7.1 — not enabled). Other direct dependencies were already at the latest within-major version in the lockfile and were not changed.
63
64
 
64
65
  ### Internal/CI
65
66
 
66
- - Bump the package version to 1.0.7, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.7.
67
- - Operations docs (English and 中文) re-check the Node current builds as of 2026-11-08: still 22.23.4, 24.22.2, and 26.13.0. Production floor stays ≥22.23.4, ≥24.22.1, or ≥26.12.1.
67
+ - Bump the package version to 1.0.9, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.9.
68
+ - Operations docs (English and 中文) re-check the Node current builds as of 2026-11-22: still 22.23.5, 24.22.3, and 26.13.1. Production floor stays ≥22.23.5, ≥24.22.3, or ≥26.13.1. `engines` and CI Node 24 are unchanged.
68
69
 
69
- ### 1.0.6 — 2026-11-01
70
+ ### 1.0.8 — 2026-11-15
70
71
 
71
72
  ### Security
72
73
 
73
- - CI (`.github/workflows/ci.yml`) runs the test job on Node 24 instead of Node 20. Node 20 is end of life (final release 20.20.2) and has no fix for CVE-2026-111497 (Brotli out-of-bounds write). The release workflow already publishes on Node 24. Package `engines` stay `>=20`.
74
- - Production hosts should run Node ≥22.23.4, ≥24.22.1, or ≥26.12.1. As of 2026-11-01 the current builds on those lines are 22.23.4, 24.22.2, and 26.13.0.
74
+ - Upgrade `vite` 6.4.5 → **6.4.6** for GHSA-p4f5-76q4-ffq7 (Critical). Unescaped `__vite-browser-external` / `__vite-optional-peer-dep` virtual module IDs allowed RCE when the Vite **dev** server is exposed (`--host` / `server.host`). Affected: Vite `>=4.0.0,<=6.4.5`. Production Admin is a built static bundle; `dev:admin` and the locked Vite version are patched. Changelog: 6.4.6 (2026-11-09) “fix: escape ids in resolve virtual modules”.
75
+ - Vendor Admin DOMPurify **3.4.17 → 3.4.18** (`public/admin/vendor/purify.min.js`, official minified 3.4.18 build). 3.4.18 (2026-11-14) fixes a `SAFE_FOR_TEMPLATES` reparse bypass and hook allow-list leakage when a hook passes the config object back to `sanitize()`. Chat markdown still sanitizes with `USE_PROFILES: { html: true }`.
76
+ - Production hosts should run Node ≥22.23.5, ≥24.22.3, or ≥26.13.1 (2026-11-11 security releases: CVE-2026-123863, CVE-2026-123864 and siblings). Package `engines` stay `>=20`. CI stays on Node 24.
75
77
 
76
78
  ### Dependency upgrades
77
79
 
78
- - `typescript-eslint` 8.72.0 → 8.72.1, including the matching `@typescript-eslint/*` packages. Other direct dependencies were already at the latest within-major version in the lockfile and were not changed.
80
+ - `vite` 6.4.5 → 6.4.6
81
+ - `typescript-eslint` 8.72.1 → 8.72.2, including the matching `@typescript-eslint/*` packages (plugin bugfixes: prefer-string-starts-ends-with, no-deprecated circular aliases, no-unnecessary-type-assertion, prefer-nullish-coalescing)
82
+ - Transitive `qs` override **6.16.2 → 6.17.1**. 6.16.2 is already OSV-clean for GHSA-6pq8-jhm2-2vcw / CVE-2026-110816 and GHSA-w4cr-vjpx-p82q / CVE-2026-110910; 6.17.1 is current 6.x. Matches GCtoAC 1.7.9.
83
+ - Align package.json floors `cors` `^2.8.6` and `@types/cors` `^2.8.19` (lockfile already resolved those versions).
79
84
 
80
85
  ### Internal/CI
81
86
 
82
- - Bump the package version to 1.0.6, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.6.
83
- - Getting started, operations, and development docs (English and 中文) record the Node 24 CI job and the production Node floor.
84
- - Type the Admin `formatApiError` fallback body as the error object so `npm run typecheck:admin` accepts `details.feature`, `details.flag`, and `details.reason`. Runtime behavior is unchanged.
87
+ - Bump the package version to 1.0.8, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.8.
88
+ - Getting started and operations docs (English and 中文) record the 2026-11-11 production Node floor. `engines` and CI Node 24 are unchanged.
85
89
 
86
90
  Full changelog: [CHANGELOG.md](./CHANGELOG.md).
87
91
 
@@ -4,6 +4,8 @@ export declare class ChatWorkerService {
4
4
  private timer;
5
5
  start(): void;
6
6
  stop(): void;
7
+ /** Wait until in-flight runJob calls finish (or timeout). */
8
+ drain(timeoutMs?: number): Promise<void>;
7
9
  private tick;
8
10
  private runJob;
9
11
  getActiveCount(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"chat-worker.service.d.ts","sourceRoot":"","sources":["../../../src/services/queue/chat-worker.service.ts"],"names":[],"mappings":"AA2CA,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,KAAK,CAA+C;IAE5D,KAAK,IAAI,IAAI;IAeb,IAAI,IAAI,IAAI;YAQE,IAAI;YAkBJ,MAAM;IAwEpB,cAAc,IAAI,MAAM;CAGzB;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
1
+ {"version":3,"file":"chat-worker.service.d.ts","sourceRoot":"","sources":["../../../src/services/queue/chat-worker.service.ts"],"names":[],"mappings":"AA2CA,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,KAAK,CAA+C;IAE5D,KAAK,IAAI,IAAI;IAeb,IAAI,IAAI,IAAI;IAQZ,6DAA6D;IACvD,KAAK,CAAC,SAAS,SAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;YAO/B,IAAI;YAsBJ,MAAM;IA+EpB,cAAc,IAAI,MAAM;CAGzB;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
@@ -47,6 +47,13 @@ class ChatWorkerService {
47
47
  this.timer = null;
48
48
  }
49
49
  }
50
+ /** Wait until in-flight runJob calls finish (or timeout). */
51
+ async drain(timeoutMs = 5_000) {
52
+ const start = Date.now();
53
+ while (this.active > 0 && Date.now() - start < timeoutMs) {
54
+ await new Promise((r) => setTimeout(r, 20));
55
+ }
56
+ }
50
57
  async tick() {
51
58
  if (!this.running)
52
59
  return;
@@ -59,7 +66,11 @@ class ChatWorkerService {
59
66
  if (!jobId)
60
67
  break;
61
68
  this.active += 1;
62
- void this.runJob(jobId).finally(() => {
69
+ void this.runJob(jobId)
70
+ .catch((err) => {
71
+ logger_1.logger.error({ err, jobId }, 'Chat job runner rejected');
72
+ })
73
+ .finally(() => {
63
74
  this.active -= 1;
64
75
  });
65
76
  }
@@ -115,12 +126,17 @@ class ChatWorkerService {
115
126
  catch (err) {
116
127
  const error = err instanceof Error ? err : new Error(String(err));
117
128
  logger_1.logger.error({ err: error, jobId }, 'Chat job failed');
118
- const row = await database_1.prisma.chatJob.findUnique({
119
- where: { id: jobId },
120
- select: { attempt: true, maxAttempts: true },
121
- });
122
- const dead = !row || row.attempt >= row.maxAttempts;
123
- await chat_queue_service_1.chatQueueService.markFailed(jobId, error, dead);
129
+ try {
130
+ const row = await database_1.prisma.chatJob.findUnique({
131
+ where: { id: jobId },
132
+ select: { attempt: true, maxAttempts: true },
133
+ });
134
+ const dead = !row || row.attempt >= row.maxAttempts;
135
+ await chat_queue_service_1.chatQueueService.markFailed(jobId, error, dead);
136
+ }
137
+ catch (markErr) {
138
+ logger_1.logger.error({ err: markErr, jobId }, 'Chat job failed and could not record failure');
139
+ }
124
140
  job_waiter_1.jobWaiterRegistry.emitError(jobId, error);
125
141
  }
126
142
  finally {
@@ -1 +1 @@
1
- {"version":3,"file":"chat-worker.service.js","sourceRoot":"","sources":["../../../src/services/queue/chat-worker.service.ts"],"names":[],"mappings":";;;AACA,+DAGoC;AACpC,+CAA4C;AAC5C,kDAA8C;AAC9C,6DAAwD;AACxD,6CAAiD;AACjD,iEAA4D;AAC5D,oDAA+C;AAE/C,SAAS,gBAAgB,CACvB,CAYC;IAED,MAAM,IAAI,GAAG,IAAA,oCAAmB,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB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AA,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"chat-worker.service.js","sourceRoot":"","sources":["../../../src/services/queue/chat-worker.service.ts"],"names":[],"mappings":";;;AACA,+DAGoC;AACpC,+CAA4C;AAC5C,kDAA8C;AAC9C,6DAAwD;AACxD,6CAAiD;AACjD,iEAA4D;AAC5D,oDAA+C;AAE/C,SAAS,gBAAgB,CACvB,CAYC;IAED,MAAM,IAAI,GAAG,IAAA,oCAAmB,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,IAAI;QACJ,IAAI,EAAE,IAAA,oCAAmB,EAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QACvC,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,EAAE;QAChC,aAAa,EAAE,CAAC,CAAC,aAAa,IAAI,EAAE;KACrC,CAAC;AACJ,CAAC;AAED,MAAa,iBAAiB;IACpB,OAAO,GAAG,KAAK,CAAC;IAChB,MAAM,GAAG,CAAC,CAAC;IACX,KAAK,GAA0C,IAAI,CAAC;IAE5D,KAAK;QACH,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,KAAK,qCAAgB,CAAC,wBAAwB,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YACzD,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;gBAC5B,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACnB,CAAC,EAAE,GAAG,CAAC,CAAC;YAC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:3850/ready
13
13
 
14
14
  ## Node.js runtime
15
15
 
16
- The package `engines` field is Node.js 20 or later. Node 20 is end of life (final release 20.20.2) and has no fix for the Brotli out-of-bounds write (CVE-2026-111497) or the 2026-11-11 runtime issues. Production hosts should run at least **22.23.5**, **24.22.3**, or **26.13.1** (2026-11-11 security releases: CVE-2026-123863, CVE-2026-123864 and siblings). As of 2026-11-15 those are the current builds on those lines.
16
+ The package `engines` field is Node.js 20 or later. Node 20 is end of life (final release 20.20.2) and has no fix for the Brotli out-of-bounds write (CVE-2026-111497) or the 2026-11-11 runtime issues. Production hosts should run at least **22.23.5**, **24.22.3**, or **26.13.1** (2026-11-11 security releases: CVE-2026-123863, CVE-2026-123864 and siblings). As of 2026-11-29 those are the current builds on those lines.
17
17
 
18
18
  GitHub Actions CI (`.github/workflows/ci.yml`) runs the suite on Node 24. The release workflow publishes on Node 24 as well.
19
19
 
@@ -13,7 +13,7 @@ curl -sS http://127.0.0.1:3850/ready
13
13
 
14
14
  ## Node.js 執行時期
15
15
 
16
- 套件 `engines` 為 Node.js 20 或以上。Node 20 已結束支援(最後版本 20.20.2),沒有 Brotli 越界寫入(CVE-2026-111497)或 2026-11-11 執行時期問題的修補。生產主機至少應使用 **22.23.5**、**24.22.3** 或 **26.13.1**(2026-11-11 安全版本:CVE-2026-123863、CVE-2026-123864 及同批)。截至 2026-11-15,這些就是各線上的現行版本。
16
+ 套件 `engines` 為 Node.js 20 或以上。Node 20 已結束支援(最後版本 20.20.2),沒有 Brotli 越界寫入(CVE-2026-111497)或 2026-11-11 執行時期問題的修補。生產主機至少應使用 **22.23.5**、**24.22.3** 或 **26.13.1**(2026-11-11 安全版本:CVE-2026-123863、CVE-2026-123864 及同批)。截至 2026-11-29,這些就是各線上的現行版本。
17
17
 
18
18
  GitHub Actions CI(`.github/workflows/ci.yml`)在 Node 24 上執行測試。發佈工作流程同樣在 Node 24 上發佈。
19
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ysk-omni",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "YSK Omni — local models behind an OpenAI-compatible gateway, with Admin panel and CLI",
5
5
  "keywords": [
6
6
  "openai",
@@ -93,14 +93,14 @@
93
93
  "@types/cors": "^2.8.19",
94
94
  "@types/express": "^4.17.21",
95
95
  "@types/multer": "^2.3.0",
96
- "@types/node": "^22.20.5",
96
+ "@types/node": "^22.20.7",
97
97
  "@vitest/coverage-v8": "^3.0.9",
98
98
  "eslint": "^9.39.5",
99
99
  "happy-dom": "^15.11.7",
100
100
  "pino-pretty": "^13.2.0",
101
101
  "tsx": "^4.23.15",
102
102
  "typescript": "5.8",
103
- "typescript-eslint": "^8.72.2",
103
+ "typescript-eslint": "^8.74.0",
104
104
  "vite": "^6.4.6",
105
105
  "vitest": "^3.0.9"
106
106
  },
@@ -28,7 +28,7 @@ const Vs="YSK Omni",Ws="Admin Panel",Qs="Admin",Js="API Key",Ys="One-time login
28
28
  <div class="lang-switch-heading">${dt(a)}</div>
29
29
  <ul class="lang-switch-list" role="listbox" aria-label="${dt(a)}">${i}</ul>
30
30
  </div>
31
- </div>`}function Ht(){document.querySelectorAll("[data-lang-switch]").forEach(a=>{a.classList.remove("is-open");const s=a.querySelector(".lang-switch-btn"),i=a.querySelector(".lang-switch-panel");s&&s.setAttribute("aria-expanded","false"),i&&i.setAttribute("hidden","")})}function cm(a){const s=a.querySelector(".lang-switch-btn"),i=a.querySelector(".lang-switch-panel");if(!s||!i)return;const o=s.getBoundingClientRect(),n=Math.min(280,Math.max(o.width,228)),d=Math.min(Math.max(8,o.left),Math.max(8,window.innerWidth-n-8));i.style.width=`${n}px`,i.style.left=`${d}px`;const r=window.innerHeight-o.bottom;r<260&&o.top>r?(i.style.top="auto",i.style.bottom=`${window.innerHeight-o.top+6}px`):(i.style.top=`${o.bottom+6}px`,i.style.bottom="auto")}function ns(a){document.querySelectorAll("[data-lang-switch]").forEach(s=>{const i=s.querySelector(".lang-switch-btn"),o=s.querySelector(".lang-switch-panel");if(!i||!o)return;const n=()=>{Ht(),s.classList.add("is-open"),i.setAttribute("aria-expanded","true"),o.removeAttribute("hidden"),cm(s)},d=()=>{s.classList.remove("is-open"),i.setAttribute("aria-expanded","false"),o.setAttribute("hidden","")};o.addEventListener("click",r=>r.stopPropagation()),i.addEventListener("click",r=>{r.stopPropagation(),s.classList.contains("is-open")?d():n()}),s.querySelectorAll("[data-lang]").forEach(r=>{r.addEventListener("click",u=>{u.stopPropagation();const m=r.getAttribute("data-lang")||"";if(!Ma(m)||m===ze){d();return}nm(m),a()})})}),window.__yskLangSwitchBound||(window.__yskLangSwitchBound=!0,document.addEventListener("click",()=>Ht()),document.addEventListener("keydown",s=>{s.key==="Escape"&&Ht()}),window.addEventListener("resize",()=>Ht()))}os(ze);const um="1.0.8",mm={version:um},pm=String(mm.version),rs=new Set([".txt",".md",".markdown",".csv",".json",".xml",".html",".htm",".js",".ts",".tsx",".jsx",".py",".java",".go",".rs",".c",".cpp",".h",".hpp",".css",".yml",".yaml",".toml",".ini",".env",".sh",".sql",".log",".pdf",".png",".jpg",".jpeg",".webp",".gif"]),gm=[...rs].join(","),ft="/admin/api",Vt="gog_admin_session";let Xe=null,Ze=!1;function Ia(a,s){const i=a?.error&&typeof a.error=="object"?a.error:a||{},o=typeof i.code=="string"?i.code:"",n=i.details&&typeof i.details=="object"?i.details:{},d=typeof n.feature=="string"?n.feature:typeof n.flag=="string"?n.flag:"",r=typeof n.reason=="string"?n.reason:"",u=String(i.message||a?.message||s||"");if(d&&(o==="feature_disabled"||o==="media_not_supported"||o==="forbidden")){const c=`errors.feature.${d}`;if(Pe(c))return e(c)}if(o==="feature_disabled"&&Pe("errors.feature_disabled")){const c=la(u);return c&&Pe(`errors.feature.${c}`)?e(`errors.feature.${c}`):e("errors.feature_disabled")}if(r&&Pe(`errors.media.${r}`))return e(`errors.media.${r}`);if(o==="media_generation_failed"&&r&&Pe(`errors.media.${r}`))return e(`errors.media.${r}`);if(o==="media_forbidden"&&Pe("errors.media_forbidden"))return e("errors.media_forbidden");const m=la(u);if(m&&Pe(`errors.feature.${m}`))return e(`errors.feature.${m}`);if(o){const c=`errors.${o}`;if(Pe(c))return e(c)}const g=la(u);return g&&Pe(`errors.feature.${g}`)?e(`errors.feature.${g}`):/agent-mode|agent mode|Safe keys cannot/i.test(u)?e("errors.media.agent_or_admin_required"):/no image file was found/i.test(u)?e("errors.media.no_image_in_sandbox"):/no video file was found/i.test(u)?e("errors.media.no_video_in_sandbox"):/does not support image edits/i.test(u)?e("errors.media.provider_no_edit"):/Provide an image file|sourceAssetId|sourceDocumentId/i.test(u)?e("errors.media.source_required"):/must be an image/i.test(u)?e("errors.media.source_must_be_image"):u||e("common.requestFailed")}function la(a){const s=String(a||"");return/videoApi/i.test(s)||/Video API is disabled/i.test(s)?"videoApi":/imagesApi/i.test(s)||/Images API is disabled/i.test(s)?"imagesApi":/audioApi/i.test(s)||/Audio API is disabled/i.test(s)?"audioApi":/filesOpenAiAlias/i.test(s)||/Files API alias/i.test(s)?"filesOpenAiAlias":/Tools are disabled/i.test(s)||/\btools\b/i.test(s)&&/disabled/i.test(s)&&/image/i.test(s)?"tools":""}const l={key:sessionStorage.getItem(Vt)||"",page:"dashboard",me:null,error:"",modal:null,chatFilter:{q:"",status:"",model:"",apiKeyId:"",from:"",to:"",policyMode:"",hasDocuments:"",sortBy:"createdAt",sortDir:"desc",limit:50,offset:0},docFilter:{q:"",apiKeyId:"",storageType:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",limit:20,offset:0},keyFilter:{q:"",role:"",mode:"",isActive:"",sortBy:"createdAt",sortDir:"desc",limit:20,offset:0},auditFilter:{q:"",action:"",apiKeyId:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",limit:50,offset:0},usageFilter:{tab:"model",modelQ:"",keyQ:"",keyActive:"",modelPage:0,keyPage:0,pageSize:10,sortBy:"lastUsedAt",sortDir:"desc",modelSortBy:"requests",modelSortDir:"desc"},ddosFilter:{tab:"policy",liveQ:"",banQ:"",banSource:"",livePage:0,banPage:0,pageSize:15,liveSortBy:"startedAt",liveSortDir:"desc",banSortBy:"createdAt",banSortDir:"desc",eventSortBy:"at",eventSortDir:"desc"},mediaFilter:{tab:"studio",q:"",kind:"",provider:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",jobSortBy:"createdAt",jobSortDir:"desc",limit:20,offset:0},systemTab:"software",sessionQ:"",pm2Tab:"runner",apiFeaturesTab:"protocols",catalogTab:"local",catalogModality:"",catalogPulling:"",catalogPull:{id:"",bytes:0,total:0},catalogQueue:[],catalogQueueRunning:!1,catalogHubQ:"",catalogHubHits:null,catalogHubNext:"",catalogHubBusy:!1,catalogPopularSyncedAt:"",runtimesOs:"host",runtimesMod:"",runtimesReport:null,runtimesInstall:null,models:[],catalogLocal:[],keys:[]},fm={login:"login",dashboard:"dashboard",chat:"chat",chats:"chats",keys:"keys",documents:"documents",media:"media",catalog:"catalog",runtimes:"runtimes",audit:"audit",settings:"settings","api-features":"apiFeatures",apifeatures:"apiFeatures",usage:"usage",ddos:"ddos",queue:"queue",pm2:"pm2",system:"system",support:"support",business:"business"};function bm(a){return a==="apiFeatures"?"api-features":a||"dashboard"}function wa(a){const s=String(a||"").replace(/^#\/?/,"").split("?")[0].split("/")[0].toLowerCase();return s?s==="runtime"||s==="engines"||s==="engine"?"runtimes":fm[s]||null:null}function Ta(a){const s=`#/${bm(a)}`;location.hash!==s&&history.pushState(null,"",s)}function hm(){const a=wa(location.hash);return a||(l.key?"dashboard":"login")}async function I(a,s={}){const i={...s.body?{"Content-Type":"application/json"}:{},...l.key?{Authorization:`Bearer ${l.key}`}:{},...s.headers||{}},o=await fetch(`${ft}${a}`,{...s,headers:i}),n=await o.text();let d=null;try{d=n?JSON.parse(n):null}catch{d={error:{message:n}}}if(!o.ok){const r=Ia(d,o.statusText),u=d?.error?.code||"";o.status===401?l.page!=="login"&&Wt(!1):o.status===403&&!["media_forbidden","feature_disabled","forbidden","media_not_supported"].includes(u)&&l.page!=="login"&&Wt(!1);const m=new Error(r);throw m.status=o.status,m.code=u,m.details=d?.error?.details,m}return d}async function Ft(a){const s=await a.text();let i=null;try{i=s?JSON.parse(s):null}catch{i={error:{message:s}}}if(!a.ok){const o=Ia(i,a.statusText),n=new Error(o);throw n.status=a.status,n.code=i?.error?.code,n.details=i?.error?.details,n}return i}function Wt(a=!0){const s=l.key;a&&s&&String(s).startsWith("gog_sess_")&&fetch("/admin/api/auth/logout",{method:"POST",headers:{Authorization:`Bearer ${s}`}}).catch(()=>{}),a&&sessionStorage.removeItem(Vt),l.key="",l.me=null,l.page="login",Ta("login"),oa()}function xa(a){Ca(a,{writeHash:!0})}function Ca(a,s={}){const i=a||"dashboard";l.page=i,l.modal=null,l.error="",i==="chats"&&(l.chatFilter.offset=0),i==="documents"&&(l.docFilter.offset=0),i==="keys"&&(l.keyFilter.offset=0),i==="audit"&&(l.auditFilter.offset=0),i==="media"&&(l.mediaFilter.offset=0),i!=="ddos"&&Xe&&(clearInterval(Xe),Xe=null),i!=="chat"&&document.body.classList.remove("chat-history-open"),s.writeHash!==!1&&Ta(i),oa()}function t(a){return String(a??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}let Le=null,Qt=null;function et(a){const s=Qt;Qt=null,Le&&(Le.remove(),Le=null),document.body.classList.remove("ui-dialog-open"),document.removeEventListener("keydown",Ea,!0),s&&s(a)}function Ea(a){if(Le&&a.key==="Escape"){a.preventDefault(),a.stopPropagation();const s=Le.dataset.cancelable!=="0";et(s?Le.dataset.prompt==="1"?null:!1:!0)}}function La(a){Le&&et(!1);const s=a.variant||(a.showCancel===!1?"info":"confirm"),i=a.showCancel!==!1,o=!!a.input,n=a.title||e(s==="danger"?"common.dangerTitle":i?"common.confirmTitle":"common.notice"),d=a.confirmText||e(i?"common.confirm":"common.ok"),r=a.cancelText||e("common.cancel"),u=s==="danger"?"!":s==="info"&&!i?"i":"?",m=document.createElement("div");m.className="ui-dialog-back",m.id="ui-dialog-back",m.dataset.cancelable=i||o?"1":"0",m.dataset.prompt=o?"1":"0",m.setAttribute("role","presentation"),m.innerHTML=`
31
+ </div>`}function Ht(){document.querySelectorAll("[data-lang-switch]").forEach(a=>{a.classList.remove("is-open");const s=a.querySelector(".lang-switch-btn"),i=a.querySelector(".lang-switch-panel");s&&s.setAttribute("aria-expanded","false"),i&&i.setAttribute("hidden","")})}function cm(a){const s=a.querySelector(".lang-switch-btn"),i=a.querySelector(".lang-switch-panel");if(!s||!i)return;const o=s.getBoundingClientRect(),n=Math.min(280,Math.max(o.width,228)),d=Math.min(Math.max(8,o.left),Math.max(8,window.innerWidth-n-8));i.style.width=`${n}px`,i.style.left=`${d}px`;const r=window.innerHeight-o.bottom;r<260&&o.top>r?(i.style.top="auto",i.style.bottom=`${window.innerHeight-o.top+6}px`):(i.style.top=`${o.bottom+6}px`,i.style.bottom="auto")}function ns(a){document.querySelectorAll("[data-lang-switch]").forEach(s=>{const i=s.querySelector(".lang-switch-btn"),o=s.querySelector(".lang-switch-panel");if(!i||!o)return;const n=()=>{Ht(),s.classList.add("is-open"),i.setAttribute("aria-expanded","true"),o.removeAttribute("hidden"),cm(s)},d=()=>{s.classList.remove("is-open"),i.setAttribute("aria-expanded","false"),o.setAttribute("hidden","")};o.addEventListener("click",r=>r.stopPropagation()),i.addEventListener("click",r=>{r.stopPropagation(),s.classList.contains("is-open")?d():n()}),s.querySelectorAll("[data-lang]").forEach(r=>{r.addEventListener("click",u=>{u.stopPropagation();const m=r.getAttribute("data-lang")||"";if(!Ma(m)||m===ze){d();return}nm(m),a()})})}),window.__yskLangSwitchBound||(window.__yskLangSwitchBound=!0,document.addEventListener("click",()=>Ht()),document.addEventListener("keydown",s=>{s.key==="Escape"&&Ht()}),window.addEventListener("resize",()=>Ht()))}os(ze);const um="1.0.10",mm={version:um},pm=String(mm.version),rs=new Set([".txt",".md",".markdown",".csv",".json",".xml",".html",".htm",".js",".ts",".tsx",".jsx",".py",".java",".go",".rs",".c",".cpp",".h",".hpp",".css",".yml",".yaml",".toml",".ini",".env",".sh",".sql",".log",".pdf",".png",".jpg",".jpeg",".webp",".gif"]),gm=[...rs].join(","),ft="/admin/api",Vt="gog_admin_session";let Xe=null,Ze=!1;function Ia(a,s){const i=a?.error&&typeof a.error=="object"?a.error:a||{},o=typeof i.code=="string"?i.code:"",n=i.details&&typeof i.details=="object"?i.details:{},d=typeof n.feature=="string"?n.feature:typeof n.flag=="string"?n.flag:"",r=typeof n.reason=="string"?n.reason:"",u=String(i.message||a?.message||s||"");if(d&&(o==="feature_disabled"||o==="media_not_supported"||o==="forbidden")){const c=`errors.feature.${d}`;if(Pe(c))return e(c)}if(o==="feature_disabled"&&Pe("errors.feature_disabled")){const c=la(u);return c&&Pe(`errors.feature.${c}`)?e(`errors.feature.${c}`):e("errors.feature_disabled")}if(r&&Pe(`errors.media.${r}`))return e(`errors.media.${r}`);if(o==="media_generation_failed"&&r&&Pe(`errors.media.${r}`))return e(`errors.media.${r}`);if(o==="media_forbidden"&&Pe("errors.media_forbidden"))return e("errors.media_forbidden");const m=la(u);if(m&&Pe(`errors.feature.${m}`))return e(`errors.feature.${m}`);if(o){const c=`errors.${o}`;if(Pe(c))return e(c)}const g=la(u);return g&&Pe(`errors.feature.${g}`)?e(`errors.feature.${g}`):/agent-mode|agent mode|Safe keys cannot/i.test(u)?e("errors.media.agent_or_admin_required"):/no image file was found/i.test(u)?e("errors.media.no_image_in_sandbox"):/no video file was found/i.test(u)?e("errors.media.no_video_in_sandbox"):/does not support image edits/i.test(u)?e("errors.media.provider_no_edit"):/Provide an image file|sourceAssetId|sourceDocumentId/i.test(u)?e("errors.media.source_required"):/must be an image/i.test(u)?e("errors.media.source_must_be_image"):u||e("common.requestFailed")}function la(a){const s=String(a||"");return/videoApi/i.test(s)||/Video API is disabled/i.test(s)?"videoApi":/imagesApi/i.test(s)||/Images API is disabled/i.test(s)?"imagesApi":/audioApi/i.test(s)||/Audio API is disabled/i.test(s)?"audioApi":/filesOpenAiAlias/i.test(s)||/Files API alias/i.test(s)?"filesOpenAiAlias":/Tools are disabled/i.test(s)||/\btools\b/i.test(s)&&/disabled/i.test(s)&&/image/i.test(s)?"tools":""}const l={key:sessionStorage.getItem(Vt)||"",page:"dashboard",me:null,error:"",modal:null,chatFilter:{q:"",status:"",model:"",apiKeyId:"",from:"",to:"",policyMode:"",hasDocuments:"",sortBy:"createdAt",sortDir:"desc",limit:50,offset:0},docFilter:{q:"",apiKeyId:"",storageType:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",limit:20,offset:0},keyFilter:{q:"",role:"",mode:"",isActive:"",sortBy:"createdAt",sortDir:"desc",limit:20,offset:0},auditFilter:{q:"",action:"",apiKeyId:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",limit:50,offset:0},usageFilter:{tab:"model",modelQ:"",keyQ:"",keyActive:"",modelPage:0,keyPage:0,pageSize:10,sortBy:"lastUsedAt",sortDir:"desc",modelSortBy:"requests",modelSortDir:"desc"},ddosFilter:{tab:"policy",liveQ:"",banQ:"",banSource:"",livePage:0,banPage:0,pageSize:15,liveSortBy:"startedAt",liveSortDir:"desc",banSortBy:"createdAt",banSortDir:"desc",eventSortBy:"at",eventSortDir:"desc"},mediaFilter:{tab:"studio",q:"",kind:"",provider:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",jobSortBy:"createdAt",jobSortDir:"desc",limit:20,offset:0},systemTab:"software",sessionQ:"",pm2Tab:"runner",apiFeaturesTab:"protocols",catalogTab:"local",catalogModality:"",catalogPulling:"",catalogPull:{id:"",bytes:0,total:0},catalogQueue:[],catalogQueueRunning:!1,catalogHubQ:"",catalogHubHits:null,catalogHubNext:"",catalogHubBusy:!1,catalogPopularSyncedAt:"",runtimesOs:"host",runtimesMod:"",runtimesReport:null,runtimesInstall:null,models:[],catalogLocal:[],keys:[]},fm={login:"login",dashboard:"dashboard",chat:"chat",chats:"chats",keys:"keys",documents:"documents",media:"media",catalog:"catalog",runtimes:"runtimes",audit:"audit",settings:"settings","api-features":"apiFeatures",apifeatures:"apiFeatures",usage:"usage",ddos:"ddos",queue:"queue",pm2:"pm2",system:"system",support:"support",business:"business"};function bm(a){return a==="apiFeatures"?"api-features":a||"dashboard"}function wa(a){const s=String(a||"").replace(/^#\/?/,"").split("?")[0].split("/")[0].toLowerCase();return s?s==="runtime"||s==="engines"||s==="engine"?"runtimes":fm[s]||null:null}function Ta(a){const s=`#/${bm(a)}`;location.hash!==s&&history.pushState(null,"",s)}function hm(){const a=wa(location.hash);return a||(l.key?"dashboard":"login")}async function I(a,s={}){const i={...s.body?{"Content-Type":"application/json"}:{},...l.key?{Authorization:`Bearer ${l.key}`}:{},...s.headers||{}},o=await fetch(`${ft}${a}`,{...s,headers:i}),n=await o.text();let d=null;try{d=n?JSON.parse(n):null}catch{d={error:{message:n}}}if(!o.ok){const r=Ia(d,o.statusText),u=d?.error?.code||"";o.status===401?l.page!=="login"&&Wt(!1):o.status===403&&!["media_forbidden","feature_disabled","forbidden","media_not_supported"].includes(u)&&l.page!=="login"&&Wt(!1);const m=new Error(r);throw m.status=o.status,m.code=u,m.details=d?.error?.details,m}return d}async function Ft(a){const s=await a.text();let i=null;try{i=s?JSON.parse(s):null}catch{i={error:{message:s}}}if(!a.ok){const o=Ia(i,a.statusText),n=new Error(o);throw n.status=a.status,n.code=i?.error?.code,n.details=i?.error?.details,n}return i}function Wt(a=!0){const s=l.key;a&&s&&String(s).startsWith("gog_sess_")&&fetch("/admin/api/auth/logout",{method:"POST",headers:{Authorization:`Bearer ${s}`}}).catch(()=>{}),a&&sessionStorage.removeItem(Vt),l.key="",l.me=null,l.page="login",Ta("login"),oa()}function xa(a){Ca(a,{writeHash:!0})}function Ca(a,s={}){const i=a||"dashboard";l.page=i,l.modal=null,l.error="",i==="chats"&&(l.chatFilter.offset=0),i==="documents"&&(l.docFilter.offset=0),i==="keys"&&(l.keyFilter.offset=0),i==="audit"&&(l.auditFilter.offset=0),i==="media"&&(l.mediaFilter.offset=0),i!=="ddos"&&Xe&&(clearInterval(Xe),Xe=null),i!=="chat"&&document.body.classList.remove("chat-history-open"),s.writeHash!==!1&&Ta(i),oa()}function t(a){return String(a??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}let Le=null,Qt=null;function et(a){const s=Qt;Qt=null,Le&&(Le.remove(),Le=null),document.body.classList.remove("ui-dialog-open"),document.removeEventListener("keydown",Ea,!0),s&&s(a)}function Ea(a){if(Le&&a.key==="Escape"){a.preventDefault(),a.stopPropagation();const s=Le.dataset.cancelable!=="0";et(s?Le.dataset.prompt==="1"?null:!1:!0)}}function La(a){Le&&et(!1);const s=a.variant||(a.showCancel===!1?"info":"confirm"),i=a.showCancel!==!1,o=!!a.input,n=a.title||e(s==="danger"?"common.dangerTitle":i?"common.confirmTitle":"common.notice"),d=a.confirmText||e(i?"common.confirm":"common.ok"),r=a.cancelText||e("common.cancel"),u=s==="danger"?"!":s==="info"&&!i?"i":"?",m=document.createElement("div");m.className="ui-dialog-back",m.id="ui-dialog-back",m.dataset.cancelable=i||o?"1":"0",m.dataset.prompt=o?"1":"0",m.setAttribute("role","presentation"),m.innerHTML=`
32
32
  <div class="ui-dialog ui-dialog--${t(s)}" role="alertdialog" aria-modal="true" aria-labelledby="ui-dialog-title" aria-describedby="ui-dialog-msg">
33
33
  <div class="ui-dialog-h">
34
34
  <div class="ui-dialog-icon" aria-hidden="true">${u}</div>