@synopackageland/cli 0.48.20 → 0.48.22

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/docs/daemon.md ADDED
@@ -0,0 +1,288 @@
1
+ # Package daemon: Node runtime and same-origin ingress
2
+
3
+ A native App's `daemon` is one foreground process that the SDK's
4
+ `daemon/control` supervises as the package account. Two optional keys extend it:
5
+
6
+ ```yaml
7
+ package: MyApp
8
+ os_min_ver: 7.2-64570 # needed by ingress
9
+ daemon:
10
+ exec: server.mjs # with node: a JavaScript entry inside the payload
11
+ targets: {x86_64: daemon, aarch64: daemon}
12
+ args: [--serve]
13
+ node:
14
+ package: Node.js_v22 # Node.js_v18, Node.js_v20 or Node.js_v22
15
+ min_version: 22.19.0 # optional, same major as the package
16
+ ingress:
17
+ path: /synopkgland/MyApp/ # exact, case-sensitive package namespace
18
+ timeout: 3600 # optional; proxy read/send timeout in seconds
19
+ ```
20
+
21
+ `check` validates both keys. `daemon.backend` (below) runs the App's Go
22
+ backend itself. None of them can be combined with
23
+ `identity_gateway`, which runs its own gateway as the daemon.
24
+
25
+ ## Runtime environment and launchers
26
+
27
+ `daemon.env` contains fixed string values. Only `${SYNOPKG_PKGDEST}` and
28
+ `${SYNOPKG_PKGVAR}` expand, in environment values and arguments; shell commands,
29
+ `$(...)`, `$HOME` and arbitrary `${NAME}` substitutions are not evaluated.
30
+ The runtime supplies `PATH=/usr/bin:/bin`, `HOME=${SYNOPKG_PKGVAR}` and a private
31
+ `TMPDIR`. The manifest cannot override `HOME`, `PATH`, `TMPDIR`, loader/shell
32
+ variables or `SYNOPKG_*` system variables. Do not assume the daemon inherits
33
+ the installer's environment.
34
+
35
+ For values computed at startup, package a small native env launcher in
36
+ `daemon.targets` and select it as `daemon.exec`. It computes the required
37
+ application variables, preserves the runtime environment, then replaces itself
38
+ with the upstream using `exec` (for Go, `syscall.Exec` with explicit argv/env).
39
+ For example, a public URL may need the default-route interface rather than a
40
+ loopback or container bridge address. Use the upstream's supported env/config
41
+ contract and keep the launcher under `synology/` in a fork. Replacing the process
42
+ preserves the supervised PID and normal stop/signal behavior.
43
+
44
+ The supervisor's SHA-256 digest covers the bytes of `daemon/config.json`.
45
+ It binds its control record/socket protocol to that configuration; it does not
46
+ hash the launcher, upstream executable or payload tree at runtime. Build/SPK
47
+ inspection digests are separate. Replacing an upstream binary through its own
48
+ updater is therefore not detected by this supervisor digest. Follow
49
+ [self-updating upstream guidance](../skills/reference/upstream-fork.md#self-updating-upstreams).
50
+
51
+ ## `daemon.restart`: bounded native crash recovery
52
+
53
+ `daemon.restart` is optional. Use `mode: off` to disable crash recovery.
54
+ Omitting the object leaves restart policy to the selected SDK controller. The SDK
55
+ defaults to `always` with its shared supervision limits.
56
+
57
+ ```yaml
58
+ daemon:
59
+ exec: service
60
+ targets: {x86_64: daemon}
61
+ restart:
62
+ mode: on-failure
63
+ initial_seconds: 1
64
+ max_seconds: 30
65
+ max_attempts: 5
66
+ window_seconds: 300
67
+ ```
68
+
69
+ Only `mode` is required. Numeric limits omitted or set to zero use the defaults
70
+ shown. Delays accept 1–3600 seconds; the normalized maximum must be at least the
71
+ initial delay. Attempts accept 1–100, and the window accepts 1–86400 seconds.
72
+ Other fields, modes, nulls, strings and fractional limits are rejected. The
73
+ published fragment `schema/daemon-restart.v1.schema.json` supplies the same
74
+ shape/bounds to the CLI reader; the reader also checks the normalized delay
75
+ relationship. The schema-2 manifest continues to use its existing reader.
76
+
77
+ `check` rejects a selected controller SDK without restart support, with an upgrade message.
78
+ The controller SDK is selected from `identity_gateway.sdk`, then a Go
79
+ backend's SDK requirement, then the CLI's fixed SDK pin.
80
+ `build` additionally checks the selected SDK
81
+ source for the restart implementation and config decoder, so an old local
82
+ `SYNOPKGLAND_SDK_DIR` override cannot produce a controller that rejects the new
83
+ JSON field. A source override does not bypass the minimum declared SDK version.
84
+
85
+ The normalized object is retained in `daemon/config.json` and the SPK build
86
+ record (`daemon_restart`, `daemon_sdk`). `inspect` checks the recorded minimum
87
+ version and exact policy/config equality, rejecting a changed or missing policy
88
+ or an unrecorded injection. Legacy SPKs without a policy retain their previous
89
+ inspection contract. Inspection validates the build record, not a cryptographic
90
+ attestation of arbitrary controller binaries.
91
+
92
+ The SDK doubles the delay up to the ceiling, reserving at most five attempts
93
+ within a sliding 300-second window by default. A full window stops recovery
94
+ with `DAEMON_RESTART_LIMIT` and requires an explicit start/restart. Clean child
95
+ exits, package stop, upgrade stop, uninstall and supervisor TERM/INT do not
96
+ restart. Initial package startup remains fail-fast within its original deadline;
97
+ the policy starts after the first successful launch. Compose supervision does
98
+ not accept this declaration. Native gateway argv adaptation and Node ingress
99
+ preserve it without adding another App retry loop.
100
+
101
+ The existing package status action is nonzero during recovery/failure. An App
102
+ backend can expose the SDK's fixed `control status-json <target> <var>` result
103
+ through its authenticated status API, mapping `state`, `reason`, `restarts` and
104
+ `retry_at` to the existing UI. No UI adapter is generated here. Keep raw daemon
105
+ logs and process inventory private. See the SDK's
106
+ [runtime policy](https://github.com/synopackageland/syno-pkg-land-sdk/blob/main/docs/native-daemon-restart.md)
107
+ for the stop fence, state semantics and DSM user-unit assessment.
108
+
109
+ ## `daemon.node`: run on DSM's Node.js package
110
+
111
+ Use `daemon.node` only when `daemon.exec` is a JavaScript entry: it selects
112
+ Node as the supervised interpreter. A native Go daemon that starts Node
113
+ children instead declares a [generic package dependency](manifest.md):
114
+
115
+ ```yaml
116
+ dependencies:
117
+ packages:
118
+ - name: Node.js_v22
119
+ min_version: "22.19.0"
120
+ daemon:
121
+ exec: bin/service
122
+ targets: {x86_64: daemon}
123
+ ```
124
+
125
+ This leaves the ELF executable, arguments, environment and process model
126
+ unchanged. The daemon can start children using
127
+ `/var/packages/Node.js_v22/target/usr/local/bin/node`. Any DSM package can be
128
+ declared this way; its target is `/var/packages/<name>/target`. Explicit and
129
+ inferred requirements merge into one INFO field; different specified minimum
130
+ versions for the same name fail validation.
131
+
132
+ The SPK does not bundle Node. The build:
133
+
134
+ - adds `install_dep_packages="Node.js_v22>=22.19.0"` to INFO (just the package
135
+ name when `min_version` is absent);
136
+ - writes the launcher `daemon/payload/_synopkgland/node`, which runs
137
+ `/var/packages/<package>/target/usr/local/bin/node` in place of the shell, so
138
+ `daemon/control` supervises node itself. The payload must not contain its own
139
+ `_synopkgland/` directory;
140
+ - writes `daemon/config.json` with `exec: _synopkgland/node` and the argv
141
+ `${SYNOPKG_PKGDEST}/daemon/payload/<exec> <args…>`. `uninstall_args` get the
142
+ same entry in front.
143
+
144
+ `exec` doesn't have to be a static binary here. Without `node`, `exec` must
145
+ still be a statically linked ELF.
146
+
147
+ The node path is the one the SDK bridge runtime already uses
148
+ (`bridge/runtime.go`, `<PackagesDir>/<package>/target/usr/local/bin/node`). It
149
+ was observed on a DSM 7.4-90069 x86_64 NAS with Node.js_v22 22.22.3 (SDK
150
+ `docs/multilang/design.md`). A DSM 7.3.2 x86_64 NAS runs Node.js_v22
151
+ 22.22.3. Confidence: high for x86_64; not observed on ARM.
152
+
153
+ ### Availability of Node.js_v22 (checked 2026-10-22)
154
+
155
+ Source: <https://archive.synology.com/download/Package/Node.js_v22>.
156
+
157
+ | Version | Date | Platforms in the archive |
158
+ |---|---|---|
159
+ | 22.13.1-1004 | — | x86_64, armv8, armv7, armada38x, alpine, monaco |
160
+ | 22.19.0-1006 | 2025-09-10 | same six |
161
+ | 22.22.0-2007 | 2026-02-11 | only `BSM` (BeeStation) x86_64 and armv8 builds |
162
+ | 22.22.3-1010 | 2026-05-29 | x86_64, armv8, armv7, armada38x, alpine, monaco |
163
+
164
+ - **x86_64 and aarch64 (`armv8`).** Both have 22.22.3, which meets
165
+ `min_version: 22.19.0` (high).
166
+ - **Minimum DSM version.** The archive does not show the minimum DSM version of
167
+ each Node.js_v22 build: the SPKs are signed containers whose INFO cannot be
168
+ read offline. DSM 7.3 x86_64 was confirmed during bounded hardware validation.
169
+ - DSM 7.2 is likely, but this is not verified (moderate). Node.js_v20 already
170
+ states "requires DSM 7.2-60085 or onward".
171
+ - Package Center shows the package per model, and a forum report says some
172
+ older models don't get v22 (low).
173
+ - **If the package is missing.** On a model or DSM version without the package,
174
+ Package Center refuses to install the App. It does not install a broken App.
175
+
176
+ ### When the dependency is stopped, upgraded or removed
177
+
178
+ From the DSM 7 Developer Guide, INFO `install_dep_packages`:
179
+
180
+ > Before a package is installed or upgraded, these packages must be installed
181
+ > first. In addition, the order of starting or stopping packages is also
182
+ > dependent on it.
183
+
184
+ The guide's version syntax supports `=`, `<`, `>`, `>=`, `<=`. Its release notes
185
+ list "synopkg start starts a package with its dependees", "Be able to stop a
186
+ package with its dependers" and "Be able to uninstall a package with its
187
+ dependers".
188
+
189
+ | Event | What happens to the daemon |
190
+ |---|---|
191
+ | Install or upgrade the App without Node.js_v22 (or older than `min_version`) | The dependency "must be installed first" (high, documented). Whether Package Center offers to install it or only refuses is not verified (moderate). |
192
+ | Start the App while Node.js_v22 is stopped | DSM starts the dependency first (high, documented). |
193
+ | Stop Node.js_v22 | Package Center stops dependents with it (documented as possible). Whether it warns first is not verified on a NAS (moderate). The node binary stays in place, so a still-running daemon is unaffected. |
194
+ | Upgrade Node.js_v22 | A running daemon keeps the old process image. The next start uses the new node. |
195
+ | Uninstall Node.js_v22 | Package Center uninstalls or blocks on dependents. The exact UI isn't verified (moderate). If node is nevertheless missing, the launcher exits 127 with "Node.js_v22 is not installed or is incomplete; install it in Package Center.", and `daemon/control start` fails, so DSM reports the App failed to start. |
196
+
197
+ ## `daemon.ingress`: a same-origin path through DSM's nginx
198
+
199
+ The build adds DSM's `web-config` resource:
200
+
201
+ ```json
202
+ {"web-config":{"nginx-static-config":{"enable":[{"type":"dsm","relpath":"daemon/ingress-nginx.conf"}]}}}
203
+ ```
204
+
205
+ `daemon.ingress.path` must be exactly `/synopkgland/<package>/`, where
206
+ `<package>` is the manifest's case-sensitive package ID. For `package: MyApp`,
207
+ the only accepted path is `/synopkgland/MyApp/`. Build, SPK inspection and App
208
+ smoke entry validation enforce the same package binding. Encoded names,
209
+ additional path segments, query strings and missing trailing slashes are refused.
210
+ The SDK's `api.ServeIngress` validates this
211
+ same namespace against the package ID in the ingress socket.
212
+
213
+ `daemon/ingress-nginx.conf` is a fixed `location ^~ /synopkgland/<package>/` block. DSM includes
214
+ it in its own 5000/5001 server blocks and custom domains, so the browser sends
215
+ its DSM cookie and the page stays same-origin. The block sets:
216
+
217
+ - `proxy_pass http://unix:/tmp/synopkgland-ingress-<package>.sock:` (nginx
218
+ forwards the full request path, prefix included);
219
+ - `proxy_buffering off`, `proxy_request_buffering off`, `proxy_cache off` and
220
+ `gzip off`, so server-sent events arrive as they are written;
221
+ - `proxy_read_timeout` and `proxy_send_timeout` set to `timeout` (default
222
+ 3600 s);
223
+ - `Host` from the request and `X-Real-IP` from the TCP peer, overriding any
224
+ client value;
225
+ - `client_max_body_size 8m`.
226
+
227
+ INFO gets `instuninst_restart_services` and `startstop_restart_services` set to
228
+ `nginx.service`. DSM reloads nginx when the package is installed, uninstalled,
229
+ started or stopped, so a stopped App's path returns 404.
230
+
231
+ The daemon receives:
232
+
233
+ - `SYNOPKGLAND_INGRESS_SOCKET`: the socket it must listen on. Remove a stale
234
+ socket before binding, and make it connectable by nginx's `http` user. The
235
+ probe used mode 0666; any local process can then connect, so the daemon must
236
+ never trust the socket alone.
237
+ - `SYNOPKGLAND_INGRESS_PATH`: the fixed package path. Mount backend routes at
238
+ this prefix and use it as the base for client URLs.
239
+
240
+ The daemon must check DSM sign-in itself. nginx only proxies.
241
+
242
+ `ingress` needs `os_min_ver` 7.2-64570 or later
243
+ (`STANDALONE_DAEMON_INGRESS_MIN_DSM`). DSM 7.1 lists `web-config` as a
244
+ Synology-only worker and rejects it in unsigned packages, the same floor as
245
+ `portal`. Each package owns only its fixed namespace.
246
+
247
+ Measured on DSM 7.3.2 x86_64: on HTTP 5000 and HTTPS 5001, a 100-second SSE
248
+ stream arrived unbuffered with no gaps.
249
+
250
+ ## `daemon.backend`: the App's own backend as the daemon
251
+
252
+ A native App can run its backend, the same `ui/cgi/api.cgi` the CGI path
253
+ uses, as the daemon instead of a separate executable:
254
+
255
+ ```yaml
256
+ package: MyApp
257
+ daemon:
258
+ backend: true
259
+ args: [serve] # the backend's own daemon mode
260
+ ingress:
261
+ path: /synopkgland/MyApp/
262
+ node: # optional: a runtime for the backend's children
263
+ package: Node.js_v22
264
+ targets: {x86_64: build/children, aarch64: build/children} # optional payload
265
+ ```
266
+
267
+ - `exec` is refused; `daemon/control` runs `${SYNOPKG_PKGDEST}/ui/cgi/api.cgi`
268
+ with `args`. The binary keeps the route audit and build-time digests of the
269
+ CGI build, so no second binary needs the same checks.
270
+ - Only native backends (Go or a prebuilt binary) take a daemon. The SDK must
271
+ contain backend support in its daemon controller
272
+ (`STANDALONE_DAEMON_BUILD_FAILED` otherwise).
273
+ - `targets` is optional and is copied to `daemon/payload` for the backend's
274
+ child processes.
275
+ - With `node`, the CLI writes its launcher but does not run Node itself. The
276
+ backend gets `SYNOPKGLAND_NODE` (the launcher) and
277
+ `SYNOPKGLAND_DAEMON_PAYLOAD` and decides which children to start.
278
+ - With `ingress`, the backend serves it with `api.ServeIngress`, which the
279
+ route audit treats like `cgi.Serve`: called directly in `main` with a handler
280
+ built for it.
281
+
282
+ ## Upgrades that introduce the daemon
283
+
284
+ DSM runs the new package's `preupgrade` before replacing the payload, so the
285
+ hook sees the old package. When that payload has no `daemon/` at all, the hook
286
+ now exits 0 instead of running a missing `daemon/control` (DSM error 4541). A
287
+ partial or symlinked `daemon/` still stops or fails closed. `inspect` also
288
+ accepts the earlier unguarded `preupgrade` of released packages.
@@ -0,0 +1,70 @@
1
+ # Installer-selected host ports
2
+
3
+ `<sdk-version>` is a placeholder, not manifest syntax. `synopkgland init` copies compatible SDK pins from the locally installed templates. For a manual configuration, query `npm view @synopackageland/sdk version`, replace the placeholder with that exact release, and keep all App SDK declarations (including Go, Rust and frontend dependencies) aligned. Run `synopkgland check` with an up-to-date CLI before building.
4
+
5
+ ```yaml
6
+ install:
7
+ ports: true
8
+ identity_gateway:
9
+ sdk: <sdk-version>
10
+ listen: {https: 28443}
11
+ ```
12
+
13
+ The manifest's gateway HTTP/HTTPS listeners and optional local OIDC issuer port
14
+ are the defaults. The install wizard shows each port with a localized label and
15
+ reason. It refuses values outside 1024–65535, reserved DSM/discovery ports,
16
+ duplicates and conflicts returned by DSM's `SYNO.Core.Service.PortInfo` listing.
17
+ The listing includes DSM and installed-package service definitions. An unreadable,
18
+ empty or malformed listing blocks Next; the wizard never assumes a port is free.
19
+
20
+ The SDK repeats the check with DSM's `servicetool --conf-port-conflict-check` as
21
+ the package account. It parses the documented `IsConflict` output and allows
22
+ only its exact existing service ID during upgrade. A successful command exit
23
+ alone does not mean a port is free. A concurrent change can still race a check;
24
+ DSM's native resource acquisition and the listener bind remain final checks.
25
+
26
+ The package-account preinst controller materializes the selected values into all
27
+ generated consumers: gateway configuration, nginx ingress, DSM window launcher,
28
+ daemon listener inventory and environment, required-origin validation settings,
29
+ and the package-specific `install/<package>.sc` service definition. The official
30
+ `port-config` resource registers that file with DSM's firewall/service listing.
31
+ Managed nginx resources omit stale fixed port reservations. No root App or
32
+ manual DSM configuration write is used.
33
+
34
+ Native subprocesses receive `SYNOPKGLAND_PORT_GATEWAY_HTTP`,
35
+ `SYNOPKGLAND_PORT_GATEWAY_HTTPS` and, when applicable,
36
+ `SYNOPKGLAND_PORT_OIDC_ISSUER`. Go Apps may also call
37
+ `installsettings.PortValues(payloadRoot)`. Compose's generated `.env` contains
38
+ the same values. When upstream configuration needs a selected public port, bind
39
+ it explicitly through the existing runtime configuration mechanism:
40
+
41
+ ```yaml
42
+ compose:
43
+ services:
44
+ web:
45
+ storage_init:
46
+ directories: [{base: /data, path: app}]
47
+ runtime:
48
+ environment:
49
+ PUBLIC_PORT: {port: gateway_https}
50
+ ```
51
+
52
+ The selected value is mounted read-only and supplied as a literal environment
53
+ value to the upstream process. Existing runtime file templates can use that
54
+ variable in the upstream's own configuration. Container-internal ports and
55
+ fixed protocol discovery ports keep their upstream contract; changing a public
56
+ host listener does not change the container's internal listening port.
57
+
58
+ Upgrade retains the saved port selection and ignores new wizard environment
59
+ values. To change ports, reinstall the same package and choose the new values
60
+ in its installation wizard; shared data is retained by default. Re-enter any
61
+ required HTTPS origin with the newly selected HTTPS port. The UI never copies
62
+ private retained settings into a package or report.
63
+
64
+ Use `--param pkgwizard_port_gateway_https=29443` for a first CLI deployment;
65
+ programmatic upgrades reject port changes. Apps must adopt `install.ports: true`
66
+ and declare upstream runtime bindings where their own configuration needs the
67
+ public port. Templates enable this for the Compose gateway by default.
68
+
69
+ DSM references: [service port definitions and conflict checks](https://help.synology.com/developer-guide/integrate_dsm/ports.html)
70
+ and [Port Config resource](https://help.synology.com/developer-guide/resource_acquisition/port_config.html).
@@ -0,0 +1,141 @@
1
+ # DSM path ingress
2
+
3
+ DSM-managed HTTPS on a dedicated App port and a path in DSM's own server are
4
+ separate ingress mechanisms. Gateway JSON `native_ingress` selects DSM-managed
5
+ nginx; the path route also declares `ingress_path`.
6
+
7
+ ## Choose an entry route
8
+
9
+ Prefer a native DSM URL when the upstream can serve the selected path. Audit
10
+ root-absolute asset/API URLs, redirects and WebSockets before choosing:
11
+
12
+ | Route | Manifest selection | Use when |
13
+ | --- | --- | --- |
14
+ | Per-package path ingress | `ingress: {path: /synopkgland/ExampleApp/}` | The upstream supports a configurable base path, including its asset/API URLs and redirects. This keeps the DSM origin without a public App port. |
15
+ | Custom top-level path ingress | `ingress: {path: /my-app/}` | The upstream hard-codes a nonreserved subpath and all its routes fit under it. The CLI validates the path; installation checks ownership and conflicts on the NAS. |
16
+ | Dedicated HTTPS port | `listen: {https: 28443}` | The upstream requires `/`, or root-absolute routes span paths that cannot fit one supported base. DSM nginx serves the App at that port with DSM's certificate; the App does not copy certificate keys. |
17
+
18
+ `listen` and `ingress` are mutually exclusive. The gateway forwards the full
19
+ path; it does not rewrite arbitrary upstream HTML, JavaScript or API payloads.
20
+ A custom path does not capture unrelated root routes such as `/api`.
21
+ With `install.ports: true`, `listen` supplies defaults for installer selection;
22
+ DSM's `port-config` resource owns port registration, and the nginx `web-config`
23
+ resource omits its own `ports` list. See [installer-selected ports](install-ports.md).
24
+
25
+ ## Configure path ingress
26
+
27
+ For a prefix-aware upstream, a CLI and SDK with path ingress support accept:
28
+
29
+ ```yaml
30
+ package: ExampleApp
31
+ os_min_ver: "7.2.1-69057"
32
+ identity_gateway:
33
+ sdk: <matching-sdk-version>
34
+ mode: header # Keep the existing none, header, token or oidc mode
35
+ upstream: 18000 # Native daemon only; Compose derives its upstream
36
+ ingress: {path: /synopkgland/ExampleApp/}
37
+ headers: {user: Remote-User}
38
+ ```
39
+
40
+ Replace `listen` with `ingress`. The default is `/synopkgland/<exact-package-ID>/` (case sensitive).
41
+ The SDK and CLI also accept an explicit custom path:
42
+
43
+ `<sdk-version>` is a placeholder, not manifest syntax. `synopkgland init` copies compatible SDK pins from the locally installed templates. For a manual configuration, query `npm view @synopackageland/sdk version`, replace the placeholder with that exact release, and keep all App SDK declarations (including Go, Rust and frontend dependencies) aligned. Run `synopkgland check` with an up-to-date CLI before building.
44
+
45
+ ```yaml
46
+ identity_gateway:
47
+ sdk: <sdk-version>
48
+ mode: none
49
+ upstream: 18000
50
+ ingress: {path: /my-app/} # Or /my-app/ui/
51
+ ```
52
+
53
+ Custom paths have one or more lowercase segments, leading and trailing slashes,
54
+ and at most 255 characters total and 64 per segment. Segments contain lowercase
55
+ letters, digits and internal hyphens. Empty segments, dot segments, escapes,
56
+ queries, fragments, uppercase and `/` are refused. DSM/native prefixes (including
57
+ `webman`, `webapi`, `scripts`, `synohdpack`, `drive`, `photo` and `synopkgland`)
58
+ are reserved; only the package's exact default namespace is allowed under
59
+ `/synopkgland/`. Apps requiring the origin root `/` cannot use path ingress.
60
+
61
+ `check` validates the syntax and static reserved prefixes. Availability depends
62
+ on the target NAS: installation checks native document-root entries, saved Portal
63
+ aliases, installed SDK gateways (including stopped ones), and DSM nginx locations.
64
+ An overlap with another route, or an unreadable/unknown inventory, fails installation
65
+ with a readable error. Choose an unused path and rebuild; do not remove another
66
+ App's config. The checker only reads inventory and runs as the package account.
67
+ DSM's `web-config` worker registers and removes its own configuration. Upgrade
68
+ replaces that owned resource, including namespace-to-custom and custom-to-namespace
69
+ changes; uninstall never deletes a different owner's route. No shared registry is
70
+ written. The menu CGI stays stable and launches the selected path.
71
+
72
+ A non-slash request redirects to that path,
73
+ retaining its query. DSM's `web-config` worker registers a `type: dsm` location;
74
+ INFO requests nginx reload on lifecycle transitions. No App public port or
75
+ manually maintained reverse proxy rule is created. The existing private,
76
+ mutually authenticated Unix socket still protects the nginx-to-gateway hop.
77
+ DSM 7.2 or newer is required. An SDK source capability check prevents building
78
+ against a released SDK that cannot interpret `ingress_path`.
79
+
80
+ Remove `install.ports` for header/none/token gateways. For OIDC, keep it if the
81
+ upstream uses a runtime `{port: oidc_issuer}` binding: only the loopback issuer
82
+ port remains configurable. Remove old public gateway port bindings from runtime
83
+ configuration. Keep `entry`, access policies, roles and native-client exceptions.
84
+
85
+ All gateway manifest paths remain relative to the selected ingress base: `redirects`,
86
+ `passthrough`, `upstream_auth_paths`, optional passthrough prefixes, OIDC callback
87
+ paths, browser paths and `launch_path`. The SDK scopes these once. For example,
88
+ `redirect_paths: [/callback]` allows only
89
+ `/synopkgland/ExampleApp/callback` on the same DSM origin. Login return paths,
90
+ cold-login resume and gateway cookies are scoped to the same package. The menu
91
+ CGI continues to support DSM launch parameters; E2E smoke derives the selected
92
+ path when ingress is declared.
93
+
94
+ The upstream receives the full prefixed path, including on WebSocket requests.
95
+ Configure its native base URL/router base path accordingly, along with native
96
+ OAuth callback configuration. Health probes run directly against the upstream;
97
+ choose a path that it actually serves. The gateway does not rewrite arbitrary
98
+ application HTML, JavaScript or API payloads. An App with a hardcoded subpath can select that custom ingress base. An App
99
+ requiring `/` cannot use ingress. Existing wrappers with
100
+ hard-coded API, logout or bootstrap URLs also need a base-path audit.
101
+
102
+ Path ingress uses the DSM request origin. Remove the dedicated-port
103
+ `external_access.single_origin` setting; dedicated-port Connect projection
104
+ routing is not applied to path ingress. Do not claim external-provider or
105
+ QuickConnect acceptance until the actual provider has been tested.
106
+
107
+ For a native App that already owns its HTTP server and SDK authentication,
108
+ use the existing `daemon.ingress: {path: /synopkgland/ExampleApp/}` instead.
109
+ That daemon must listen on `SYNOPKGLAND_INGRESS_SOCKET` and serve
110
+ `SYNOPKGLAND_INGRESS_PATH`. Do not combine daemon ingress with an identity gateway.
111
+
112
+ Validate with `check`, `build`, and `inspect`, then upgrade the installed test
113
+ package and check both the active nginx location and an authenticated browser
114
+ navigation. Include anonymous denial, the original entry policy and upstream
115
+ assets/API calls; a successful install response alone is insufficient.
116
+
117
+ ## Apps requiring HTTPS
118
+
119
+ With the latest CLI and SDK, declare `identity_gateway.secure_context: required`
120
+ for an App that needs WebCrypto or another secure context feature. The same
121
+ field works for Compose and standalone gateways. Omission preserves HTTP
122
+ behavior; any value other than the string `required` is rejected by `check`.
123
+ `check` and `build` also verify that the selected SDK source implements HTTPS
124
+ guidance and report an explicit error when it does not.
125
+
126
+ The gateway serves a localized DSM light page for HTTP top-level navigations,
127
+ with a user-operated HTTPS link and no automatic redirect. HTTP API, resource
128
+ and iframe requests receive status 403 with `https_required`; HTTPS behavior
129
+ is unchanged. The package readiness ping remains available.
130
+
131
+ Path ingress uses the browser scheme supplied by DSM's authenticated ingress.
132
+ The HTTPS link uses the current hostname and an actual DSM HTTPS port
133
+ declaration, opening the HTTPS DSM desktop with the App's `launchApp`. Direct
134
+ gateways use their declared HTTPS listener. Request queries and fragments are
135
+ not forwarded. When no reliable HTTPS port is available, the page shows
136
+ instructions instead of guessing a port. No administrator API or DSM settings
137
+ change is needed.
138
+
139
+ Editors can use `schema/dsm-package.schema.json`, which references the focused
140
+ `schema/identity-gateway.v1.schema.json` HTTPS policy fragment. These editor
141
+ schemas supplement the complete manifest validation performed by `check`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.48.20",
3
+ "version": "0.48.22",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,6 +15,10 @@
15
15
  "CHANGELOG.md",
16
16
  "schema",
17
17
  "docs/ctl-external.md",
18
+ "docs/app-entry.md",
19
+ "docs/daemon.md",
20
+ "docs/install-ports.md",
21
+ "docs/path-ingress.md",
18
22
  "skills",
19
23
  "docs/shared-folders.md",
20
24
  "docs/daemon-nofile.md"
package/skills/SKILL.md CHANGED
@@ -333,11 +333,15 @@ Application Portal 是獨立 opt-in:不想要別名就省略 `portal`,不生
333
333
  compose App、沒有 gateway 的 App、`ui.launch` 或 `portal` 都會被 check 拒絕。
334
334
  冷登入由 url 圖示經 `open.cgi` 續接,`oidc.browser` 需要支援此續接的 SDK。
335
335
 
336
- 原生 App 搭配 `identity_gateway`、而且唯一的 UI 就是包裝的網頁時,宣告 `ui: false` 取代 `ui.dir`。
336
+ ### Upstream-web-only Apps
337
+
338
+ 原生 App 搭配 `identity_gateway`、而且唯一的 UI 就是包裝的網頁時,宣告 `ui: false` 取代整個 `ui` 區塊。
337
339
  沒有 SDK 視窗:主選單只有一個 `displayname` 圖示,是 `type: "url"`,經 `sso/open.cgi` 在新分頁開原生 UI;
338
340
  套件中心「開啟」經 INFO `adminurl` 開同一個入口,與 compose App 相同。backend 與 ctl 指令不受影響。
339
341
  沒有 `identity_gateway`、搭配 `console` 或 `portal`、或使用 `capabilities.rootOps`、`delegate`、`webapi`、`identity`
340
342
  (這些的核准或登入畫面在 SDK 視窗裡)都會被 check 以 `STANDALONE_UI_NO_WINDOW_INVALID` 拒絕。省略 `ui` 仍是錯誤。
343
+ 保留 entry gate 使用的 backend 與 `i18n/messages`,刪除不用的 UI/UI e2e;
344
+ 檔案與設定清理細節見 [upstream-fork](reference/upstream-fork.md#upstream-web-only-apps)。
341
345
 
342
346
  Schema 2 Compose 使用 `dsm-package.yaml` 的 `compose.files`、`compose.web` 與
343
347
  `identity_gateway`;不使用 file/targets/address_env 或手寫 upstream。
@@ -253,11 +253,11 @@ until the existing API proves that work stopped.
253
253
 
254
254
  ## Sensitive parameters
255
255
 
256
- App authors must mark passkeys, tokens, private URLs, torrent/base64 and upload content with standard JSON Schema `writeOnly: true`, including nested objects, array items and local references. Mark sensitive response fields in resultSchema too. Do not embed real secrets in schema defaults/enums/examples or command examples.
256
+ App authors must mark passkeys, tokens, private URLs, torrent/base64 and upload content with standard JSON Schema `writeOnly: true`, including nested objects, array items and local references. Do not embed real secrets in schema defaults/enums/examples or command examples.
257
257
 
258
258
  Parameter and result schema `pattern` and `patternProperties` use the linear RE2 engine, with at most 4096 characters per pattern. Backreferences, lookarounds and other unsupported syntax are rejected during description validation. If an unvalidated or cached privacy pattern cannot be compiled, redaction conservatively applies that pattern's annotations to every property.
259
259
 
260
- CLI plans, dry-run, missing-yes errors, JSON/multi-host output and known input values repeated by the App use the fixed string `<redacted>`. Schema validation errors never echo instance values or paths. This changes presentation only: authorized requests still send the original values. The CLI does not log or cache business parameters. Sensitive description examples/defaults are masked in list/help and disk caches; a cache altered by redaction requires a fresh authenticated description/hash check before execution. Fill placeholders locally; never paste secrets into AI messages or logs.
260
+ Request previews (plans, dry-run and missing-yes plans) mask schema-marked input values with `<redacted>`. Operation results, errors and ctl/MCP responses are returned unchanged, including public keys and schema-marked response values. Logs redact only exact secret field names; they never replace values or keys merely because they match a secret value. Schema validation errors never echo instance values or paths. This changes presentation only: authorized requests still send the original values. The CLI does not log or cache business parameters. Sensitive description examples/defaults are masked in list/help and disk caches; a cache altered by redaction requires a fresh authenticated description/hash check before execution. Fill placeholders locally; never paste secrets into AI messages or logs.
261
261
 
262
262
  ## Command naming recommendations
263
263
 
@@ -11,6 +11,10 @@ manifest package ID's case. The backend mounts routes at
11
11
  `SYNOPKGLAND_INGRESS_PATH`; build, inspect and smoke entry checks bind this path
12
12
  to the package.
13
13
 
14
+ For `daemon.env` expansion, runtime-owned `HOME`, startup env launchers and the
15
+ supervisor configuration digest, read
16
+ [the runtime environment contract](../../docs/daemon.md#runtime-environment-and-launchers).
17
+
14
18
  Daemon mode is not the default recommendation. It removes work that repeats
15
19
  on every request. It does not make a single expensive request cheaper, and it
16
20
  costs memory for as long as the package runs. Measure first, then decide.
@@ -6,6 +6,29 @@ The independent container path uses resource-worker lifecycle. Unsupported Compo
6
6
 
7
7
  Never work around a failed permission check by running the package as root. Native CGI authentication and root-operation administrator approval are separate checks.
8
8
 
9
+ ## Blank frames or broken images
10
+
11
+ A frame is blank or images are broken behind the gateway → compare
12
+ `fetch(url, {credentials: 'include'})` with `fetch(url, {credentials: 'omit'})`
13
+ from the signed-in panel page, using the same failing resource URL:
14
+
15
+ ```js
16
+ const url = "/synopkgland/ExampleApp/_app/plugin/icon.png";
17
+ for (const credentials of ["include", "omit"]) {
18
+ const response = await fetch(url, {credentials});
19
+ console.log(credentials, response.status);
20
+ }
21
+ ```
22
+
23
+ If `include` returns 200 but `omit` returns 401 `dsm_sign_in_required`, inspect
24
+ the iframe sandbox and request cookies. A sandboxed plugin with an opaque origin
25
+ may omit DSM cookies; symptoms include "Opening…", `naturalWidth === 0` and
26
+ an undefined upstream global without a CSP violation. Only when the upstream
27
+ authenticates those resources itself, add the narrow plugin prefix to
28
+ `identity_gateway.upstream_auth_paths` and rebuild. Keep its token checks and
29
+ CSP sandbox, and verify both valid access and invalid-token denial. See
30
+ [upstream-authenticated paths](identity-gateway.md#upstream-authenticated-paths).
31
+
9
32
  ## Native HTTPS fails before the App starts
10
33
 
11
34
  For a package using DSM-managed native gateway HTTPS (including Compose Apps),