@synopackageland/cli 0.47.4 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +19 -19
  3. package/assets/go/route-audit/main.go +1 -1
  4. package/assets/init-compose.md +1 -1
  5. package/dist/add.js +10 -0
  6. package/dist/cli.js +9 -1
  7. package/dist/ctl/ai-tools.d.ts +29 -0
  8. package/dist/ctl/ai-tools.js +28 -0
  9. package/dist/ctl/cli.d.ts +5 -2
  10. package/dist/ctl/cli.js +34 -1
  11. package/dist/ctl/descriptor.d.ts +7 -3
  12. package/dist/ctl/descriptor.js +24 -4
  13. package/dist/ctl/generate.d.ts +1 -0
  14. package/dist/ctl/generate.js +16 -0
  15. package/dist/ctl/import-openapi.d.ts +8 -0
  16. package/dist/ctl/import-openapi.js +149 -0
  17. package/dist/ctl/registry.d.ts +47 -0
  18. package/dist/ctl/registry.js +119 -0
  19. package/dist/error-registry.js +6 -3
  20. package/dist/init-upstream.js +3 -2
  21. package/dist/init.js +22 -4
  22. package/dist/runtime/sdk-source.d.ts +1 -1
  23. package/dist/runtime/sdk-source.js +1 -1
  24. package/dist/standalone/api-description-inspect.js +3 -0
  25. package/dist/standalone/api-description.d.ts +6 -1
  26. package/dist/standalone/api-description.js +35 -57
  27. package/dist/standalone/api-permissions.d.ts +3 -1
  28. package/dist/standalone/api-permissions.js +14 -6
  29. package/dist/standalone/bridge-build.js +8 -2
  30. package/dist/standalone/bridge-runtime.d.ts +1 -0
  31. package/dist/standalone/bridge-runtime.js +1 -0
  32. package/dist/standalone/build.js +1 -0
  33. package/dist/standalone/manifest.d.ts +1 -0
  34. package/dist/standalone/manifest.js +17 -3
  35. package/dist/standalone/operation-registry.d.ts +13 -0
  36. package/dist/standalone/operation-registry.js +83 -0
  37. package/docs/ctl-external.md +5 -2
  38. package/package.json +2 -2
  39. package/schema/synopkgland-api-v2.schema.json +504 -0
  40. package/skills/SKILL.md +11 -10
  41. package/skills/reference/compose.md +3 -3
  42. package/skills/reference/create.md +8 -8
  43. package/skills/reference/ctl.md +81 -40
  44. package/skills/reference/files.md +1 -1
  45. package/skills/reference/identity-gateway.md +13 -19
  46. package/skills/reference/identity.md +3 -4
  47. package/skills/reference/install.md +2 -2
  48. package/skills/reference/portal.md +1 -1
  49. package/skills/reference/upstream-fork.md +11 -7
package/skills/SKILL.md CHANGED
@@ -5,7 +5,7 @@ description: Initialize, extend, check, build, inspect, and deploy Synology appl
5
5
 
6
6
  # Independent Synology SPKs
7
7
 
8
- The CLI installs templates through `~0.38.0`. A templates patch needs only a
8
+ The CLI installs templates through `~0.39.0`. A templates patch needs only a
9
9
  templates release; npm install/update selects a patch in that minor line. The CLI
10
10
  uses the locally installed templates and reads their SDK pin for defaults; it
11
11
  never downloads templates at runtime. Preserve the lockfile and use `npm ci` for
@@ -13,8 +13,8 @@ reproducible offline-ready installations. SDK minor releases are independent of
13
13
  the CLI: executor manifest format 1 in the resolved SDK pins the executor release,
14
14
  Go toolchain and six payload digests. Preserve npm integrity and Go module sums.
15
15
  The CLI verifies bytes before packaging and never fetches a manifest at NAS runtime.
16
- Unsupported formats require a CLI update; invalid manifests fail closed. Existing
17
- SDK 0.26.0/0.27.0 use the frozen legacy inventory.
16
+ Unsupported formats require a CLI update; invalid manifests fail closed.
17
+ Current scaffolds pin SDK/App 0.47.0 and declare operations in one v2 registry.
18
18
 
19
19
  For Apps with data folders or gateway listeners, read [reference/install.md](reference/install.md). Default to an App-named dedicated DSM data share and installer-selected ports. Existing-folder access, port number format/range and required HTTPS origins use localized wizard validation before Next; detected port conflicts are nonblocking inline warnings, and an unavailable DSM port inventory does not block installation; upgrades retain port selections.
20
20
 
@@ -24,12 +24,13 @@ Before releasing an executor App, read [reference/approval-upgrades.md](referenc
24
24
 
25
25
  Use this guide to initialize, build and inspect own applications or upstream OSS as independent packages. 依已實作能力區分 DSM session 檔案、私有 jobs 與 App 登入;delegate 已實作並隨 CLI 提供固定操作的離線委託(預設 `files.moveFromStaging`);共用 delegate/rootOps executor 的完整裝置生命週期驗收仍待完成,不得宣稱已通過;支援邊界依 delegate guide/support matrix,禁止發明新的身分平台。
26
26
 
27
- For an existing open-source App, first read [reference/upstream-fork.md](reference/upstream-fork.md): upstream fork/history + untouched upstream files + all packaging in `synology/`, official container images pinned by tag/index digest, native official release binaries pinned by SHA-256 or a source build hook, and a single tag-merge upgrade command. Use `init --upstream-fork`; never rewrite the App as a component. Integrated upstream Apps require direct DSM administrator entry without a separate App password or an OIDC/SSO server: supported trusted headers first, disabling native login second; the shipped OpenList pattern uses the existing SDK 0.17.3 token adapter (`mode: token`, `access: dsm-admins`, `entry: admin-only`) with server-side Authorization injection. All DSM admins share one upstream admin; token reset requires package restart; WebDAV retains its native credentials.
27
+ For an existing open-source App, first read [reference/upstream-fork.md](reference/upstream-fork.md): upstream fork/history + untouched upstream files + all packaging in `synology/`, official container images pinned by tag/index digest, native official release binaries pinned by SHA-256 or a source build hook, and a single tag-merge upgrade command. Use `init --upstream-fork`; never rewrite the App as a component. Integrated upstream Apps require direct DSM administrator entry without a separate App password or an OIDC/SSO server: supported trusted headers first, disabling native login second; the shipped OpenList pattern uses the SDK token adapter (`mode: token`, `access: dsm-admins`, `entry: admin-only`) with server-side Authorization injection. All DSM admins share one upstream admin; token reset requires package restart; WebDAV retains its native credentials.
28
28
 
29
29
  Shared-folder selection authorizes DSM `data-share` to grant the manifest's RO/RW on install, upgrade and repair; never require package-account access before installation. Validate only names and supported mounted local folder types. Uninstall retains the folder, data and package account's ACL; administrator revocation uses Control Panel > Shared Folder > Edit > Permissions > System internal user. See [reference/install.md](reference/install.md).
30
30
 
31
- Use SDK/App 0.38.6 and CLI 0.41.12 for App entry enforcement. Declare every App method
32
- in the permissions table; dynamic names and unregistered HTTP dispatchers are rejected.
31
+ App entry is enforced by the resolved SDK. Declare each method once in
32
+ operations.json; ctl generate writes permissions and bindings. Dynamic names and
33
+ unregistered HTTP dispatchers are rejected.
33
34
  Use fixed SDK routes and `identity_gateway.upstream_auth_paths` for client API
34
35
  paths that rely on upstream authentication. Read
35
36
  [reference/identity.md](reference/identity.md) and
@@ -45,7 +46,7 @@ cannot upgrade a connection; use an existing upgrade-capable deployment
45
46
  transport. The audit follows each configured Go binary's Linux import graph,
46
47
  including declared workers; unshipped dev commands are excluded.
47
48
 
48
- SDK/App 0.38.2 allows 300 seconds for requests by default, with the browser
49
+ The SDK allows 300 seconds for requests by default, with the browser
49
50
  waiting 302 seconds. Explicit budgets and earlier parent deadlines still win.
50
51
  For long work, use existing independent workers with prompt job admission,
51
52
  progress and authorized status/result polling by the original ID. A timed-out
@@ -66,7 +67,7 @@ retaining it. Check child readiness and retry bind conflicts: release-to-bind
66
67
  is inherently racy. Never replace these with custom listeners or fixed ports.
67
68
 
68
69
  For nonroot cross-package control protocols, use
69
- `ipc.StartPackagePeerUnix(ctx, path, authorize, handler)` (SDK/CLI 0.46.0).
70
+ `ipc.StartPackagePeerUnix(ctx, path, authorize, handler)`.
70
71
  The SDK pins a dedicated package-owned 0711 directory, binds an owned 0666
71
72
  socket and reads SO_PEERCRED before invoking the caller's authorization
72
73
  callback. A nil callback denies every peer. Keep bounded frame decoding and
@@ -327,7 +328,7 @@ Schema 2 Compose 使用 `dsm-package.yaml` 的 `compose.files`、`compose.web`
327
328
  Headless Compose 不產生 launcher。health 必須選實際 endpoint 與 2xx status;
328
329
  readiness 不跟隨 redirect,check 不會發 HTTP。Compose 不支援 ctl。
329
330
 
330
- For controlling installed Apps or designing task-level AI commands, read [reference/ctl.md](reference/ctl.md). Use ctl host list, register/renew explicitly, discover all commands, and always name the host when agents may operate multiple NAS machines.
331
+ For controlling installed Apps or designing task-level AI commands, read [reference/ctl.md](reference/ctl.md). Declare operations once in a synopkgland.api v2 registry with a required ai class; run `ctl generate`, `ctl generate --check` and `check`. Operation descriptions belong only in that registry; read the generated per-App reference. Import OSS APIs hidden and obtain explicit per-API opt-in grouped by area before exposing them. Use ctl host list, register/renew explicitly, discover all commands, and always name the host when agents may operate multiple NAS machines.
331
332
 
332
333
  ## App-open smoke
333
334
 
@@ -351,7 +352,7 @@ Only a manifest-declared upstream-authenticated entry may use `publicLogin`.
351
352
  Keep `.env` and `.e2e/` untracked; never add NAS details to source.
352
353
 
353
354
  For DSM same-origin gateway URLs, keep the default `/synopkgland/<package>/`.
354
- SDK/CLI 0.44.0 adds opt-in `identity_gateway.ingress: {path: /my-app/}` for
355
+ Use opt-in `identity_gateway.ingress: {path: /my-app/}` for
355
356
  upstreams with a hardcoded base path. Read [reference/identity-gateway.md](reference/identity-gateway.md)
356
357
  for reserved paths, install-time ownership checks and unchanged auth policy.
357
358
  Apps requiring `/` cannot use ingress.
@@ -26,7 +26,7 @@ compose:
26
26
  network: {egress: isolated}
27
27
  # Private package binds are rejected by DSM build; keep compatible upstream named volumes.
28
28
  identity_gateway:
29
- sdk: 0.38.2
29
+ sdk: 0.47.0
30
30
  mode: none
31
31
  access: dsm-users
32
32
  listen: {http: 28000}
@@ -39,7 +39,7 @@ architecture-specific native payloads for token/account adapters. All lifecycle
39
39
  scripts run as the package account; containers are managed by Container Manager.
40
40
 
41
41
  For external access, pin both `compose.sdk` and `identity_gateway.sdk` to
42
- 0.38.2 and use the gateway's
42
+ 0.47.0 and use the gateway's
43
43
  [`external_access` policy and DSM settings entry](identity-gateway.md#external-access).
44
44
  Declare required HTTPS origins through `install.settings`; wizard validation checks the selected HTTPS port before Next. See [install.md](install.md).
45
45
  Manual URL configuration does not require Connect. The SDK resolves the public
@@ -260,7 +260,7 @@ declared availability readiness, LAN isolation/egress, protected grant lifecycle
260
260
  ACLs, two-user visibility and clean install/upgrade/reboot/stop/uninstall before
261
261
  calling the package supported on a NAS. No NAS is accessed by the build gate.
262
262
 
263
- The unified Compose contract uses SDK defaults from locally installed templates `~0.31.0` with CLI 0.32.1. Templates patches can ship independently; npm install/update resolves them, and SDK defaults come from the installed templates. SDK minor upgrades do not require a CLI release when they declare supported executor manifest format 1; the resolved SDK owns the release mapping and verified payload digests. The CLI does not fetch templates at runtime. The legacy packaging route and bridge publish mode are removed.
263
+ The unified Compose contract uses SDK defaults from locally installed templates `~0.39.0` with CLI 0.48.0. Templates patches can ship independently; npm install/update resolves them, and SDK defaults come from the installed templates. SDK minor upgrades do not require a CLI release when they declare supported executor manifest format 1; the resolved SDK owns the release mapping and verified payload digests. The CLI does not fetch templates at runtime. The legacy packaging route and bridge publish mode are removed.
264
264
 
265
265
  Primary override files, and each included override set, must share a directory. Cross-directory override bases are rejected before loader I/O. Included implicit .env files are confined, inventoried and preserved; symlinks are rejected.
266
266
 
@@ -1,7 +1,7 @@
1
1
  # 建立(Create)
2
2
 
3
- For upstream OSS Apps, ask whether AI control is needed and omit `ctl` from the
4
- manifest unless explicitly requested. Own Apps retain the template's ctl defaults.
3
+ For upstream OSS Apps, inventory APIs and omit `ctl` from the
4
+ manifest until the user explicitly opts in to each API. Import upstream OpenAPI into `synology/operations.json` with `ctl import-openapi`; new entries are hidden. Group APIs by area and recommend a set, then ask per API. Own Apps retain the template's ctl defaults.
5
5
  When designing commands for either kind, follow [ctl-plan and the coverage
6
6
  checklist](ctl.md#plan-command-coverage): cover existing main features, including
7
7
  common reads and writes, rather than stopping at status commands.
@@ -46,8 +46,8 @@ rootOps 與 delegate 已共用管理員 PasswordConfirm 核准的 protected exec
46
46
  backend 寫 `runtime: python|node|rust`(`runtime: go` 等同 `kind: go`)。CGI 是 SDK 的 Go runtime(`bridge/cmd/runtime`),它驗證 DSM session、entry 與 `permissions.json` 後,以套件帳號(不是 root)每個請求啟動一次 App。App 放在 ui 以外的目錄,打包成 `target/app/`,build 寫入 `bridge.json`(spec/bridge/v1)並把它與 `permissions.json` 的 sha256 編進 runtime。
47
47
 
48
48
  ```yaml
49
- backend: {runtime: python, dir: app, entry: main.py, sdk: 0.17.3}
50
- backend: {runtime: node, dir: app, entry: main.mjs, sdk: 0.17.3, node: {package: Node.js_v20}}
49
+ backend: {runtime: python, dir: app, entry: main.py, sdk: 0.47.0}
50
+ backend: {runtime: node, dir: app, entry: main.mjs, sdk: 0.47.0, node: {package: Node.js_v22}}
51
51
  backend: {runtime: rust, dir: app, entry: hello, methods: [hello.greet]}
52
52
  ```
53
53
 
@@ -56,13 +56,13 @@ backend: {runtime: rust, dir: app, entry: hello, methods: [hello.greet]}
56
56
  - Python:DSM 的 `/usr/bin/python3`;SDK 放進 `app/vendor/synopkgland_app/`,`PYTHONPATH=vendor`。
57
57
  - Node:Package Center 的 Node.js_v18/v20/v22 成為 INFO `install_dep_packages`;SDK 的 `package.json` 與 `dist/` 放進 `node_modules/@synopackageland/app`,其他 dependencies 先在 App 目錄 `npm ci --omit=dev`。
58
58
  - Rust:Cargo.toml 以 git+tag 相依 `syno-pkg-land-app`;`cargo zigbuild` 交叉編譯(x86_64/aarch64 musl、armv7 glibc),`panic = "unwind"`;binary 在 `app/bin/<entry>`。需要 rustup 的 cargo、三個 target、cargo-zigbuild 與 zig。
59
- - methods:沒寫時 build 在建置機執行 `<entry> --describe`;Rust 必須寫。每個 App method 都必須明列於 `permissions.json`,且表內只能設定 methods 內的 method。動態名稱與自訂 HTTP dispatcher 會被拒絕;請使用固定 SDK routes。
59
+ - methods:沒寫時 build 在建置機執行 `<entry> --describe`;Rust 必須寫。每個 App method 都必須明列於 `operations.json` 並指定 AI class;`ctl generate` 產生 `permissions.json` 與 runtime bindings,且表內只能設定 methods 內的 method。動態名稱與自訂 HTTP dispatcher 會被拒絕;請使用固定 SDK routes。
60
60
  - capabilities:`files`、`identity`、`jobs`、`rootOps`、`delegate`(僅 `until-revoked`+`files.moveFromStaging`+destinations)與 `portal`;daemon 需要 Go。jobs 或 delegate 時,同一個 runtime 另裝為 `target/background/worker`,DSM 以套件帳號執行 `worker --worker`;rootOps、delegate 附 executor,`bridge.json` 的 delegate digest 必須等於 SPK 的 executor。
61
61
  - transfers:`backend.transfers: {<method>: upload|download}`(method 必須在 methods 內),`backend.max_upload_bytes` 上限 16 GiB。
62
62
 
63
63
  ## 請求期限與視窗尺寸
64
64
 
65
- SDK/App 0.38.1 的 backend 請求期限預設 300 秒,DSM 視窗與 TS client 預設等候 302 秒。CLI 從 App 所選 SDK 的 timeout spec 讀取預設;`backend.timeout_seconds`(1–3600 的整數)可明確覆寫,go、python、node、rust 都適用,較早的 parent deadline 仍優先。到期時 App 回 `request_timeout`;DSM 視窗把工作期限放進 `ctx.requestTimeout`(毫秒),`ctx.call` 與 SDK 瀏覽器 client 多等 2 秒,讓 backend 的回覆先到。已安裝的 App、舊 SDK 或既有明確 timeout 不會自動改變;需使用匹配的 Go/TS SDK 重建。
65
+ SDK 的 backend 請求期限預設 300 秒,DSM 視窗與 TS client 預設等候 302 秒。CLI 從 App 所選 SDK 的 timeout spec 讀取預設;`backend.timeout_seconds`(1–3600 的整數)可明確覆寫,go、python、node、rust 都適用,較早的 parent deadline 仍優先。到期時 App 回 `request_timeout`;DSM 視窗把工作期限放進 `ctx.requestTimeout`(毫秒),`ctx.call` 與 SDK 瀏覽器 client 多等 2 秒,讓 backend 的回覆先到。既有明確 timeout 保留;使用匹配的 Go/TS SDK 重建。
66
66
 
67
67
  - python、node、rust:build 把它寫進 `bridge.json` 的 `timeout_seconds`;runtime 以它為期限,傳給 App 的 `deadline_ms` 是送出呼叫時剩下的時間。
68
68
  - go:build 以 `-X main.requestTimeout=<秒>` 傳入。要寫 `timeout_seconds`,`main.go` 必須讀這個變數,否則 check 回 `STANDALONE_TIMEOUT_UNSUPPORTED`;未設定時使用所選 SDK 的 `api.DefaultRequestTimeout`:
@@ -93,7 +93,7 @@ func deadline() api.DeadlineOption {
93
93
 
94
94
  直接 File Station 瀏覽器讀取預設也為 302 秒;identity gateway 等候 upstream headers 預設 310 秒,自訂期限需對齊 gateway 與外部 proxy。這些預設不保證所有 DSM/proxy 都能完成五分鐘請求。executor batch 的 60 秒上限、已核准 root policy/program budget 與 credential lifetime 維持原契約;長 root 工作使用既有 `root.start` / `root.jobs.*`。
95
95
 
96
- 獨立 `ctl` transport 預設仍是 62 秒。長同步呼叫須明確指定 `--timeout`,或使用既有 nonblocking job flow;參考 [ctl](ctl.md)。完整契約見 SDK 的 [request deadlines](https://github.com/synopackageland/syno-pkg-land-sdk/blob/v0.38.1/docs/request-deadlines.md)。
96
+ 獨立 `ctl` transport 預設仍是 62 秒。長工作必須映射既有 job flow,不以延長同步等待取代非同步 API;參考 [ctl](ctl.md)。完整契約見 SDK 的 [request deadlines](https://github.com/synopackageland/syno-pkg-land-sdk/blob/v0.47.0/docs/request-deadlines.md)。
97
97
 
98
98
  DSM 視窗預設 960×640、最小 700×420;`ui.window` 只寫要改的欄位:
99
99
 
@@ -130,7 +130,7 @@ root:
130
130
  migrate: {} # 沒有 run、job:只作為 start 步驟
131
131
  ```
132
132
 
133
- start、stop 步驟與 `uninstall.purge.root` 都以 root、無 session 執行,只在管理員核准有效時跑;這些程式不能宣告 run 或 job(session 要用時以另一個名稱設定,可指向同一份內容)。start 步驟在新版本第一次啟動、executor 開 socket 並回讀核准任務之後執行,預設最多 60 秒;若宣告 lifecycle budget,則從核准的 start 剩餘預算扣除收尾餘裕;執行期間 executor 只回應 `status`(`state: "starting"`),其他請求回可重試的 `EXECUTOR_STARTING`,DSM 視窗的核准會等它結束,狀態讀取則立即回 `executor_starting`、由 SDK 面板自行重試,失敗只寫進 executor log,不擋啟動;同一版本不重跑,程式要能重複執行。結果由 executor `status` 的 `start_step` 讀取(`pending`、`ok`、`failed`,含 exit 與 output)。DSM 的 start 只寫入要求就返回,所以 `dsm-scripts/postinst`、`postupgrade`、`start` 看不到它的結果;root 的清理或遷移放 `root.start`,非特權的收尾放 `dsm-scripts/`。宣告 `root.start` 會改變 policy digest,需要管理員重新核准;沒有宣告的 App policy 不變。需要 SDK 0.10.3 以上。
133
+ start、stop 步驟與 `uninstall.purge.root` 都以 root、無 session 執行,只在管理員核准有效時跑;這些程式不能宣告 run 或 job(session 要用時以另一個名稱設定,可指向同一份內容)。start 步驟在新版本第一次啟動、executor 開 socket 並回讀核准任務之後執行,預設最多 60 秒;若宣告 lifecycle budget,則從核准的 start 剩餘預算扣除收尾餘裕;執行期間 executor 只回應 `status`(`state: "starting"`),其他請求回可重試的 `EXECUTOR_STARTING`,DSM 視窗的核准會等它結束,狀態讀取則立即回 `executor_starting`、由 SDK 面板自行重試,失敗只寫進 executor log,不擋啟動;同一版本不重跑,程式要能重複執行。結果由 executor `status` 的 `start_step` 讀取(`pending`、`ok`、`failed`,含 exit 與 output)。DSM 的 start 只寫入要求就返回,所以 `dsm-scripts/postinst`、`postupgrade`、`start` 看不到它的結果;root 的清理或遷移放 `root.start`,非特權的收尾放 `dsm-scripts/`。宣告 `root.start` 會改變 policy digest,需要管理員重新核准;沒有宣告的 App policy 不變。
134
134
 
135
135
  schema 是 executor 的封閉子集(每個 object 都要 `additionalProperties: false`,key `[a-z0-9_]`,pattern 為 RE2)。這些設定需要支援它們的 SDK executor(`EXECUTOR_ROOT_PROGRAMS_UNSUPPORTED`)。preupgrade 呼叫 `executor/lifecycle stop --upgrade`;舊 SDK 的 helper 不認得此旗標時改用一般 stop。
136
136
 
@@ -62,8 +62,12 @@ works as a declared protocol; the CLI has no App-specific protocol branch.
62
62
  ## Plan command coverage
63
63
 
64
64
  For packaging an upstream open-source App (including forks with `synology/`),
65
- ask whether the user needs AI control unless it was already explicitly requested.
66
- Without that opt-in, omit the manifest's `ctl` block and do not build ctl adapters.
65
+ inventory APIs first with `synopkgland ctl import-openapi <file|https-url>
66
+ --output synology/operations.json`, or import a hand-written v2 registry. Every
67
+ new imported API defaults to `ai: hidden`. Group APIs by area, recommend a useful
68
+ set with reasons, and ask the user about each API. Existing explicit per-API
69
+ authorization persists. Never offer all-or-nothing exposure. Without per-API
70
+ opt-in, omit the manifest's `ctl` block and do not build exposed ctl adapters.
67
71
  Own Apps retain their native template ctl defaults and the command guidance below.
68
72
  For both kinds, commands must cover the App's existing main features, including
69
73
  common reads and writes; `status` / `service status` alone are incomplete.
@@ -117,7 +121,56 @@ actual upstream token/header/API-password mapping and shared-account semantics.
117
121
 
118
122
  ## Designing commands for AI
119
123
 
120
- Declare explicit `ctl.commands` in dsm-package.yaml; build/inspect compare references with actual route registrations and permissions. Internal bindings are not CLI commands. Each command needs a stable cli path, description, parameter JSON Schema (descriptions/enums/defaults/examples), effect and examples. The build derives permissions; don't duplicate authorization. Missing schema means --input file/- only.
124
+ Each App has one `synopkgland.api` v2 operation spec (`operations.json`; OSS
125
+ wrappers keep it under `synology/`). Set `ctl: {enabled: true, registry:
126
+ operations.json}` relative to the packaging manifest. Do not maintain a second
127
+ list of summaries or command schemas.
128
+ Each real method has one English `summary`, `paramsSchema`, `resultSchema`,
129
+ `effect`, `permission`, fixed `flow`, `cli` path and required `ai` class:
130
+
131
+ | Class | Exposure and behavior |
132
+ | --- | --- |
133
+ | `read` | Read-only ctl and AI tool |
134
+ | `preview` | Non-mutating preview/dry-run ctl and AI tool |
135
+ | `draft` | Write/destructive tool produces preview plus plan; a human confirms separately |
136
+ | `human-only` | ctl with normal confirmation; absent from AI tools |
137
+ | `hidden` | Runtime spec only; absent from ctl and AI tools |
138
+
139
+ A draft names its non-mutating `preview` method; both handlers must accept the
140
+ tool input. Class never replaces backend authentication, App admission, upstream
141
+ identity or resource ownership. `read`/`preview` with a mutating effect fail.
142
+ Mark long operations `longRunning: true` and use a `job` flow; synchronous long
143
+ operations fail. The AI layer runs whole fixed flows, including polling and
144
+ pagination, rather than making the model drive individual steps.
145
+
146
+ Register the real handler, then run `synopkgland ctl generate`,
147
+ `synopkgland ctl generate --check`, and `synopkgland check`. Generation writes the
148
+ runtime permissions/route binding, `generated/synopkgland-api.json`,
149
+ `generated/ctl.json`, `generated/tools.json` and `generated/operations.md`. Commit
150
+ the generated files. Check/build refuse drift and route/spec inequality in either
151
+ direction, including hidden routes. The only infrastructure exceptions are the
152
+ fixed describe and identity ceremony methods. SDK capability metadata comes from
153
+ the SDK's own hidden catalog and can be explicitly overridden in the App spec.
154
+ Never hand-edit generated operation descriptions or add them to a skill manually.
155
+ Current scaffolds use SDK 0.47.0, templates 0.39.1 and CLI 0.48.0.
156
+
157
+ For installed Apps, use `ctl tools <app> --host <profile>` and
158
+ `ctl tool <app> <method> --input <file|-> --host <profile>`. These require the
159
+ normal approved package/descriptor pin. A draft tool returns a non-mutating
160
+ preview and plan; this interface has no write-confirmation parameter. Obtain
161
+ human authorization, inspect the same normal ctl command with `--dry-run`, then
162
+ execute with `--yes` and read back the result. Never forward a model-supplied
163
+ confirmation as human authorization.
164
+
165
+ The OpenAPI helper accepts 3.0/3.1 JSON or YAML, local documents or credential-free
166
+ HTTPS URLs. It inventories method/path and parameter locations, expands bounded
167
+ local references, defaults mutations to destructive, and refuses unsupported
168
+ references/body transports. Reimport preserves reviewed entries; review upstream
169
+ diffs explicitly. Importing creates no handler, transport, credentials or authority.
170
+ Implement selected adapters through the existing external/ingress transport;
171
+ never patch upstream source or add a second proxy. Hidden imported entries still
172
+ need real handlers before enabling ctl/building a complete registry. Treat
173
+ unsupported async/auth/transport capabilities as blockers in ctl-plan.
121
174
 
122
175
  Wrap existing high-level backend methods when sequencing is App-specific. Download Hub's immediate acceptance/background preparation, owner-bound search resultId, destination grants and BT file selection must not become a raw gopeed.request proxy. Map its existing download/task/search APIs with stable responses. search.stream uses NDJSON; use the fixed ndjson flow, not the JSON method adapter. Use the existing high-level torrent contract; if one is missing, record the gap for discussion rather than inventing a CLI-specific sequence.
123
176
 
@@ -143,43 +196,31 @@ If the only existing API is a synchronous long call, stop that command's
143
196
  implementation and report the blocker for discussion. Do not create a job layer,
144
197
  new cancellation mechanism or background worker just to expose it through ctl.
145
198
 
146
- Reuse the fixed `job` flow for existing compatible start/poll/result APIs. It
147
- waits by default: AI consumers must pass `--no-wait` for long operations, then
148
- call the discovered status/result commands by the returned ID. Native Apps
149
- already using the SDK `background` module and `bg.jobs.*` routes can map those
150
- existing submit/list/get/result/cancel/pause/resume capabilities. Check the
151
- installed SDK/template contract and enabled capability first: these routes are
152
- not automatic ctl commands, a generic ETA/paged-result service, or proof that
153
- every App supports cancellation or singleton deduplication.
154
-
155
- For AI consumers:
156
-
157
- The independent ctl transport defaults to 62 seconds even with SDK/App 0.38.1.
158
- For a long synchronous call, set `--timeout` explicitly; for an existing job
159
- flow, use `--no-wait` and the original ID. A status read timeout leaves the last
160
- known queued/running state intact. If the App's admission API supports an
161
- idempotency key, reuse the same key and input after a lost reply; never invent
162
- that support or issue a new mutation key to work around a timeout.
163
-
164
- 1. Discover the real command schema and current jobs if listing is supported.
165
- Dry-run mutations, obtain authorization, then submit once with `--yes` and
166
- `--no-wait` when using a job flow. Keep host, App and original operation ID.
167
- 2. Poll its existing status API using the server's retry interval; otherwise use
168
- 2 seconds, then 5, 10 and at most 30 seconds between polls. Do not invent a
169
- polling method if the API has none. Reconnect by the same ID after a lost
170
- connection; never repeat start merely because a reply was lost.
171
- 3. Report acceptance promptly, then report meaningful phase/progress changes or
172
- about every 30–60 seconds while observing. Use a bounded observation window
173
- (default two minutes per turn); when it expires, return the ID, latest state
174
- and exact follow-up command. Do not wait indefinitely or call a timeout a
175
- failed/canceled job. A completion notification is available only if the App
176
- already supplies it.
177
- 4. On a terminal state, fetch the existing result with bounded pagination where
178
- supported. Preserve partial/error states; preparation is not download or save
179
- completion. If cancellation exists and is authorized, dry-run and confirm
180
- before calling it; read status back until the existing API proves it stopped.
181
-
182
- For AI consumers: execute commands that describe a complete task. Do not manually concatenate hidden API methods, invent job polling, or treat accepted as completed. Let the fixed command adapter handle the declared flow and surface its timeout/partial state.
199
+ Use the fixed `job` flow for existing compatible start/poll/result APIs. The
200
+ AI tool adapter owns its bounded polling and result collection; the model calls
201
+ one complete tool and never hand-drives polling or concatenates hidden helpers.
202
+ The same rule applies to paginate and NDJSON flows. Human ctl callers may choose
203
+ `--no-wait` to receive acceptance immediately and resume through an existing
204
+ status command by the original ID.
205
+
206
+ Native Apps using the SDK background module may map existing bg.jobs.* submit,
207
+ list, get, result, cancel, pause and resume capabilities. Only declare capabilities
208
+ that the selected SDK and enabled backend actually provide. Never fabricate ETA,
209
+ cancellation, deduplication or "return existing ID" behavior.
210
+
211
+ The independent ctl transport has a 62-second default. Job flows use their
212
+ bounded declared wait budget; this never turns a long synchronous backend API
213
+ into an asynchronous one. On a lost admission reply or timeout, keep the original
214
+ ID and known state. If the App supports an idempotency key, preserve the same key
215
+ and exact input; never invent a new mutation key to work around uncertainty.
216
+
217
+ For AI tools, a draft always returns a non-mutating preview and plan. Obtain
218
+ human authorization before the normal ctl command executes with --yes. Report
219
+ acceptance separately from completion; preparation is not download or save
220
+ completion. If the declared flow times out, return the original ID and the exact
221
+ existing status command. A timeout does not prove failure or cancellation.
222
+ Cancellation also requires its declared preview/confirmation policy and readback
223
+ until the existing API proves that work stopped.
183
224
 
184
225
  ## Sensitive parameters
185
226
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Native-go 的 B 能力使用 `init --with files` 或 `add files`,對應 schema 2 `capabilities.files: session`。File tree 與共用 NasPicker 以 TreeView/DataGrid 顯示本人可見內容;一般選取不建立授權;delegate destination 選取例外,確認即授權。FilePicker 選瀏覽器本機檔案。上傳/下載使用 streaming transport,不把內容放進 JSON。每次以呼叫者有效 DSM session 由 File Station 判權,不需管理員進行能力設定。
4
4
 
5
- SDK 0.32.0 的 delegated `files.write` 逐檔上限為 100 MiB;`files.read` 與
5
+ SDK 的 delegated `files.write` 逐檔上限為 100 MiB;`files.read` 與
6
6
  URL 下載另維持 64 MiB 上限。`webapi.call` 的 request params 只接受 JSON,
7
7
  不提供 request upload;檔案上傳使用串流 `files.write`。更新後重建套件,
8
8
  並重新核准變更的 executor payload。
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Upstream-authenticated paths
4
4
 
5
- Build with SDK 0.32.0 and CLI 0.34.0. Use `upstream_auth_paths` for client API
5
+ Build with SDK 0.47.0 and CLI 0.48.0. Use `upstream_auth_paths` for client API
6
6
  paths that use upstream authentication.
7
7
 
8
8
  Keep browser routes behind `entry: admin-only` or `entry: app-privilege`; list
@@ -22,12 +22,12 @@ See `docs/app-entry.md` for the complete contract.
22
22
 
23
23
  ## External access
24
24
 
25
- Use SDK 0.30.0 or later with matching gateway sources. Add this to the existing
25
+ Use SDK 0.47.0 with matching gateway sources. Add this to the existing
26
26
  complete gateway declaration; keep the App's upstream, listener and auth policy:
27
27
 
28
28
  ```yaml
29
29
  identity_gateway:
30
- sdk: 0.30.0
30
+ sdk: 0.47.0
31
31
  external_access:
32
32
  connect: optional # optional | none
33
33
  origin_change: none # none | confirm
@@ -36,15 +36,13 @@ identity_gateway:
36
36
 
37
37
  Omitting the block or either member uses `connect: optional` and
38
38
  `origin_change: none`. `connect: required`, unknown members and other values
39
- are rejected. SDKs below 0.29.0 reject an explicit block, including an empty
40
- one. SDK 0.28.0 supplies the diagnostic ping without external access. On
39
+ are rejected. On
41
40
  Compose Apps, `compose.sdk` and `identity_gateway.sdk` must name the same
42
41
  release. Build also rejects a development SDK override without the external
43
42
  configuration and settings CGI dispatch support.
44
43
 
45
44
  The generated `target/sso/gateway.json` uses
46
- `"external":{"connect":"optional","origin_change":"none"}`. Older SDK targets
47
- omit this member and the settings entry. The SPK packages the gateway
45
+ `"external":{"connect":"optional","origin_change":"none"}`. The SPK packages the gateway
48
46
  executable as `ui/sso/settings.cgi` with mode 0755, alongside `open.cgi` and
49
47
  `authorize.cgi`; it runs as the package account. `inspect` checks the policy
50
48
  inventory, executable mode and matching gateway bytes.
@@ -125,9 +123,7 @@ old releases selected without a development source override.
125
123
 
126
124
  For an upstream with native authentication for browsers and native clients,
127
125
  declare `mode: oidc`, `upstream_access: public`, and retain `access: dsm-users`,
128
- `dsm-admins` or `dsm-groups` for the issuer. This capability requires
129
- SDK/CLI 0.23.0 or later. A build with an old SDK
130
- without that capability fails rather than claiming support.
126
+ `dsm-admins` or `dsm-groups` for the issuer. Build checks that the selected SDK provides this capability.
131
127
 
132
128
  The gateway does not require DSM cookies or browser Origin on upstream requests.
133
129
  The upstream owns authentication, authorization, CSRF, CORS and WebSocket policy;
@@ -195,14 +191,13 @@ For user-controlled mobile API or WebDAV access, declare fixed prefixes:
195
191
  ```yaml
196
192
  identity_gateway:
197
193
  # Add to the existing complete identity_gateway declaration.
198
- sdk: 0.18.0
194
+ sdk: 0.47.0
199
195
  optional_passthrough:
200
196
  mobile:
201
197
  prefixes: [/dav, /api/mobile]
202
198
  ```
203
199
 
204
- This unreleased capability requires the next minor SDK (0.18.0+); do not adopt
205
- it in an App until an approved release exists. There are at most 16 entries,
200
+ There are at most 16 entries,
206
201
  each with 1–16 prefixes and no default-enabled option. Root, `/_sso`, encoded or
207
202
  ambiguous prefixes and overlaps with optional/permanent passthrough are invalid.
208
203
  Generated `gateway.json` carries the same declaration. Other paths still use the
@@ -228,7 +223,7 @@ closing with a valid admin session, traversal/encoded paths and WebDAV COPY/MOVE
228
223
  Destination headers. Upstream App authentication and permissions remain the
229
224
  App's responsibility.
230
225
 
231
- ### Native OIDC browser entry (SDK 0.18.0)
226
+ ### Native OIDC browser entry
232
227
 
233
228
  An upstream with its own OIDC login can opt into a generic browser bridge:
234
229
 
@@ -236,7 +231,7 @@ An upstream with its own OIDC login can opt into a generic browser bridge:
236
231
  install:
237
232
  ports: true
238
233
  identity_gateway:
239
- sdk: 0.38.2
234
+ sdk: 0.47.0
240
235
  mode: oidc
241
236
  access: dsm-admins
242
237
  upstream: 8000
@@ -274,7 +269,7 @@ For an upstream that automatically starts OIDC (for example a native web-server
274
269
  authentication module), leave `oidc.browser` unset and declare
275
270
  `oidc.native_login: true`. This reuses native DSM cold-login/resume without
276
271
  injecting an HTML/SPA bridge into the upstream. It requires the matching SDK
277
- capability; released SDK 0.18.0 does not yet implement this field. Native Compose
272
+ capability. Native Compose
278
273
  URL entries resume only a bounded transaction and declared public gateway port.
279
274
  Normal menu entry remains the classless SDK CGI. Existing browser consumers keep
280
275
  their previous behavior. Never invent fake login paths just to enable DSM login.
@@ -291,14 +286,13 @@ Use the upstream's supported entry route; this does not modify upstream UI,
291
286
  produce an App session, or unlock encrypted data. HTTPS and App-specific
292
287
  fragment/query semantics still require deployment acceptance.
293
288
 
294
- Single-origin Apps require SDK 0.30.0 or later. Their `manual_origin` may include an explicit HTTPS port (for example, `https://example.ts.net:29443`). The DSM launcher resolves the destination for the provider used to open DSM, probes `/_spl/ping` for up to eight seconds, and offers **Open anyway** if the probe fails. A single-origin App always uses its configured primary origin. Other Apps and the `external-origin` install setting continue to require HTTPS DNS origins on port 443.
289
+ A single-origin App's `manual_origin` may include an explicit HTTPS port (for example, `https://example.ts.net:29443`). The DSM launcher resolves the destination for the provider used to open DSM, probes `/_spl/ping` for up to eight seconds, and offers **Open anyway** if the probe fails. A single-origin App always uses its configured primary origin. Other Apps and the `external-origin` install setting continue to require HTTPS DNS origins on port 443.
295
290
 
296
291
  Configurable gateway ports use `install.ports: true`; read [install.md](install.md) for field validation, retained selections and upstream runtime bindings. Do not repeat the manifest defaults in App configuration.
297
292
 
298
293
  ## DSM same-origin path ingress
299
294
 
300
- Keep `/synopkgland/<exact-package-ID>/` as the default. With SDK/CLI 0.44.0 or
301
- later, an upstream with a fixed base path may opt in to
295
+ Keep `/synopkgland/<exact-package-ID>/` as the default. An upstream with a fixed base path may opt in to
302
296
  `identity_gateway.ingress: {path: /my-app/}` (nested lowercase segments also work).
303
297
  Use leading/trailing slashes, lowercase letters/digits/internal hyphens, at most
304
298
  64 characters per segment and 255 total. Root `/`, DSM/native prefixes and other
@@ -1,9 +1,8 @@
1
1
  # Identity and authorization
2
2
 
3
- Native-go validates the caller's DSM session per package. Business route permissions come from backend/internal/api/permissions.json; SDK-owned route policy is protected separately. Capabilities describe execution/resources and do not grant business route access. Never trust a request username as owner.
3
+ Native-go validates the caller's DSM session per package. Business route permissions are generated from operations.json into backend/internal/api/permissions.json; SDK-owned route policy is protected separately. Capabilities describe execution/resources and do not grant business route access. Never trust a request username as owner.
4
4
 
5
- With SDK 0.32.0 and CLI 0.34.0, every App method must appear in the permissions
6
- table, including administrator-default methods. Dynamic names and custom HTTP
5
+ Every App method must appear in the operation registry with a required AI class; `ctl generate` emits its permissions and runtime bindings, including administrator-default methods. Dynamic names and custom HTTP
7
6
  dispatchers are rejected. Use fixed SDK route constructors and declare
8
7
  `identity_gateway.upstream_auth_paths` for client API paths authenticated by the
9
8
  upstream. These paths never exempt SDK RPC methods from their own permissions.
@@ -12,7 +11,7 @@ for migration and build binding.
12
11
 
13
12
  Entry: omit `entry` for legacy access; `entry: admin-only` admits administrators only and is the floor of every route: SDK routes a capability adds (files, jobs, portal, delegate, rootOps) refuse ordinary users with `admin_required`, the launcher is hidden, and an app route marked `authenticated` or `public` in permissions.json fails validate/build with `STANDALONE_ENTRY_WIDENED` (only the public `identity: standalone` login routes stay public; they admit no one by themselves). The SPK records the mode in `sdk-package.json`; `inspect` prints it and flags `ENTRY_LAUNCHER_MISMATCH`; `entry: app-privilege` also admits accounts DSM Application Privileges allows for `SYNO.SDS.<package>.Instance` (native-go only, needs an `authenticated` route). DSM evaluates user/group/everyone rules, allow/deny precedence and IP ranges; one CGI check covers every route, failures refuse with `app_privilege_denied`, and decisions are cached at most 30 seconds. DSM's install default allows administrators only, so declaring or upgrading never opens the app to everyone. DSM keeps those rules after uninstall and applies them again to a later install under the same name: an App with the executor (rootOps or delegate) removes them automatically at uninstall (failures go to the system log entry `synopkgland-executor`); a no-privilege App never uses root, so an administrator removes them in Control Panel > Application Privileges. The delegate executor applies the same entry rule to every protected and producer move: once DSM no longer allows a user, new moves under that user's still-valid grant are refused (`APP_DENIED`, grant invalidated); files already saved stay. Guard global settings in shared routes with Go `api.RequireAdmin(caller)` (`admin_required`); the frontend `ctx.user?.isAdmin` only hides controls.
14
13
 
15
- I capability: init --with login or add login enables Go-native standalone identity and Vue login. Same-host DSM cookies can be reused across ports after backend verification. Missing cookies use an HTTPS DSM account/password/OTP fallback; passwords and DSM credentials are not persisted. Plain UI is unsupported. App sessions last at most 15 minutes; sensitive operations revalidate live DSM cookies and local UID. Password-only sessions permit only basic app.status/greeting.get reads. Missing revalidation returns session_revalidation_required; files return dsm_session_required. Sign in to DSM on the same hostname. Web Station portal/proxy acceptance remains pending.
14
+ I capability: init --with login or add login enables Go-native standalone identity and Vue login. Same-host DSM cookies can be reused across ports after backend verification. Missing cookies use an HTTPS DSM account/password/OTP fallback; passwords and DSM credentials are not persisted. Plain UI is unsupported. App sessions last at most 15 minutes; sensitive operations revalidate live DSM cookies and local UID. Password-only sessions permit only basic app.status reads. Missing revalidation returns session_revalidation_required; files return dsm_session_required. Sign in to DSM on the same hostname. Web Station portal/proxy acceptance remains pending.
16
15
 
17
16
  B files needs the current user's DSM session. A jobs processes owner-bound private copies as the package account without administrator setup. Neither App identity nor login alone grants offline File Station access.
18
17
 
@@ -1,6 +1,6 @@
1
1
  # Native installation settings
2
2
 
3
- Use CLI 0.47.3 with the existing supported SDK/App and templates pins. Configure installation through the manifest and generated wizard; do not add App ACL writers, root hooks or independent port state.
3
+ Use CLI 0.48.0 with SDK/App 0.47.0 and templates ~0.39.0. Configure installation through the manifest and generated wizard; do not add App ACL writers, root hooks or independent port state.
4
4
 
5
5
  ```yaml
6
6
  install:
@@ -11,7 +11,7 @@ install:
11
11
  name: MyApp
12
12
  permission: rw
13
13
  identity_gateway:
14
- sdk: 0.38.2
14
+ sdk: 0.47.0
15
15
  listen: {https: 28443}
16
16
  ```
17
17
 
@@ -26,7 +26,7 @@ Activate: DSM owns the saved setting. Administrators use the app's portal panel
26
26
 
27
27
  Read: ordinary users call the Go backend's `portal.status` (`authenticated`), which reads `/var/packages/<package>/etc/AppPortal.json` read-only, bounded (64 KiB, no symlinks, one JSON object, matching app id). Anything else is `unavailable` and the UI shows "ask an administrator". A binary CGI must implement the same `{state, alias}` answer itself or ordinary users never see the link.
28
28
 
29
- Executor mode (7.1-42661 ≤ os_min_ver < 7.2-64570): no web-config resource, no `etc/portal.*`, no alias wizard step or alias lifecycle. The executor policy carries `portal: {application: <displayname>, alias}` and the operations `portal.register` and `portal.unregister`; the executor writes `/usr/syno/etc/www/app.d/<package>.{json,mustache}`. The package name must match `^[A-Za-z0-9]+(?:[._-][A-Za-z0-9]+)*$` (≤ 64) and displayname be 1–64 characters without control characters, or build fails with `STANDALONE_PORTAL_ENTRY_INVALID`. The native Go CGI is built with `-X main.portal=executor`; the Python/Node/Rust bridge CGI uses `-X main.portalMode=executor`: `portal.status` adds `entry` (`registered`, `unregistered`, `cleanup-required`; an unreadable executor is `unavailable`), and `portal.register` / `portal.unregister` take the administrator's DSM session and return the fresh status. `ctx.portal.register()` / `unregister()` call them; the plain panel shows text and "Enable entry" while unregistered, the alias form and "Remove entry" once registered, text and "Remove entry" when cleanup is required, and no entry buttons for non-administrators. Executor refusals keep their code (`PORTAL_FAILED`). Needs templates with the executor portal routes (after 0.9.4) and an SDK with the `portal` entry API (after 0.9.5).
29
+ Executor mode (7.1-42661 ≤ os_min_ver < 7.2-64570): no web-config resource, no `etc/portal.*`, no alias wizard step or alias lifecycle. The executor policy carries `portal: {application: <displayname>, alias}` and the operations `portal.register` and `portal.unregister`; the executor writes `/usr/syno/etc/www/app.d/<package>.{json,mustache}`. The package name must match `^[A-Za-z0-9]+(?:[._-][A-Za-z0-9]+)*$` (≤ 64) and displayname be 1–64 characters without control characters, or build fails with `STANDALONE_PORTAL_ENTRY_INVALID`. The native Go CGI is built with `-X main.portal=executor`; the Python/Node/Rust bridge CGI uses `-X main.portalMode=executor`: `portal.status` adds `entry` (`registered`, `unregistered`, `cleanup-required`; an unreadable executor is `unavailable`), and `portal.register` / `portal.unregister` take the administrator's DSM session and return the fresh status. `ctx.portal.register()` / `unregister()` call them; the plain panel shows text and "Enable entry" while unregistered, the alias form and "Remove entry" once registered, text and "Remove entry" when cleanup is required, and no entry buttons for non-administrators. Executor refusals keep their code (`PORTAL_FAILED`). The released templates and SDK provide the executor portal routes and `portal` entry API.
30
30
 
31
31
  DSM floor: os_min_ver must be 7.1-42661 or later; below 7.2-64570 the executor registers the entry (above). DSM 7.1 marks the web-config worker Synology-only, so it refuses an unsigned SPK whose conf/resource carries web-config (Package Center error 320, "non-synology-signed package should not use internal worker"; seen on 7.1.1-42962). synopkg from DSM 7.2 on drops that mark, the only change to its worker table; the 7.2 floor comes from that source and is not yet verified on a 7.2 NAS. 7.3.2-86009 and 7.4 install it. Below 7.1 validate/build fail with `STANDALONE_PORTAL_MIN_DSM`, `--min-dsm` cannot go below 7.1, with an executor, `add portal` raises a lower os_min_ver to 7.1-42661; a no-executor target below 7.2-64570 is refused, and inspect flags an INFO os_min_ver below the floor of the SPK's mode. Fix: raise os_min_ver or remove the portal.
32
32
 
@@ -36,11 +36,15 @@ These metadata fields become standard SPK INFO fields; upstream source stays
36
36
  unchanged. Catalog attribution may change before rebuilding; installed INFO
37
37
  changes only after an SPK upgrade.
38
38
 
39
- ## Decide whether to expose AI control
40
-
41
- Ask whether the user needs AI control unless they have already explicitly requested it.
42
- Leave the manifest without a `ctl` block when they have not opted in; packaging an
43
- upstream App does not itself request ctl. If requested, follow
39
+ ## Review AI exposure per API
40
+
41
+ Inventory APIs with `ctl import-openapi <file|https-url> --output
42
+ synology/operations.json` or a handwritten v2 registry. Every new entry is hidden.
43
+ Group APIs by area, recommend a small useful set, then ask the user about each API;
44
+ never use an all-or-nothing opt-in. Keep the manifest without a `ctl` block until
45
+ selected APIs have explicit authorization and real adapters. Reuse the existing
46
+ external/ingress transport. Run `ctl generate`, `ctl generate --check` and `check`.
47
+ Follow
44
48
  [the ctl coverage checklist](ctl.md#plan-command-coverage) and produce `ctl-plan`.
45
49
  Cover common reads and writes through existing native APIs, including the main
46
50
  UI tasks; `status` and `service status` alone are incomplete. Keep upstream code
@@ -149,7 +153,7 @@ upstream mechanisms in order:
149
153
  If manual App login is still necessary, label bootstrap incomplete. Verify
150
154
  subsequent DSM entry, restart and upgrade all retain password-free access,
151
155
  while anonymous/nonadmin requests and direct upstream ports remain blocked.
152
- 3. **Existing SDK token adapter**: SDK **0.17.3** supports `mode: token`, with
156
+ 3. **Existing SDK token adapter**: The SDK supports `mode: token`, with
153
157
  `access: dsm-admins` and `entry: admin-only`. OpenList uses its unmodified
154
158
  upstream `admin token` CLI while the server is stopped to obtain the native
155
159
  administrator API token. The package stores it in a package-private **0600**
@@ -187,7 +191,7 @@ is undecided. Never copy credentials into generated projects.
187
191
 
188
192
  | Prototype | Reusable lesson and remaining boundary |
189
193
  | --- | --- |
190
- | OpenList | Official release binary pinned by SHA-256, `/ping` and SDK 0.17.3 server-side token adapter; shared upstream admin, restart after token reset, native WebDAV credentials. Share selection does not grant package ACL/register Local storage. |
194
+ | OpenList | Official release binary pinned by SHA-256, `/ping` and SDK server-side token adapter; shared upstream admin, restart after token reset, native WebDAV credentials. Share selection does not grant package ACL/register Local storage. |
191
195
  | FreshRSS | Official image, package-UID Apache/config adapter in `synology/`, explicit health; supported proxy authentication with fixed admin mapping and header clearing. |
192
196
  | Uptime Kuma | Official image, writable-path adapter, nonredirecting health and `disableAuth` after first bootstrap; WebSocket expiry/revocation need separate tests. |
193
197