@synopackageland/cli 0.52.5 → 0.52.7

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
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.52.7
4
+
5
+ - Throttle NAS image pull progress, retain phase changes and completion, and omit the unverified byte count
6
+ - Show the requested registry once per image and keep URL punctuation intact in diagnostics
7
+ - Include an Open URL in installed package status when DSM declares an unambiguous App entry
8
+
9
+ ## 0.52.6
10
+
11
+ - Report executor approval as not-required in build and inspect for SDK packages without an executor (#192)
12
+ - Warn when DSM-window Vue sources combine OS color-scheme detection with a dynamic color-scheme binding
13
+ - Warn when standalone identity is enabled without an Application Portal declaration
14
+ - Clarify that standalone login and DSM-cookie reuse require HTTPS and belong outside DSM windows; document HTTP recovery and light DSM window themes
15
+
3
16
  ## 0.52.5
4
17
 
5
18
  - Fix first executor approval from mobile App entries by resuming DSM's native Noise session and signing protected requests
package/README.md CHANGED
@@ -506,7 +506,7 @@ variables also work in `.env`; timeout/interval values accept integer seconds fr
506
506
  | `DSM_INSTALL_MAX_POLLS` | 10000 | Per-package polling attempts across initial checks, pre-pull and install/start verification |
507
507
  | `DSM_UNINSTALL_TIMEOUT_SECONDS` | 1800 | State check, stop and uninstall together |
508
508
  | `DSM_POLL_INTERVAL_SECONDS` | 5 | Package-state polling interval |
509
- | `DSM_IMAGE_PULL_STALL_TIMEOUT_SECONDS` | 1200 | No increase in NAS pull bytes; status heartbeats do not reset this budget |
509
+ | `DSM_IMAGE_PULL_STALL_TIMEOUT_SECONDS` | 1200 | No increase in the NAS pull progress counter; status heartbeats do not reset this budget |
510
510
 
511
511
  Install/upgrade waiting has no default elapsed-time deadline. Slow successful work
512
512
  continues until the polling limit (an integer from 1 to 1000000), cancellation or a DSM failure.
@@ -515,7 +515,10 @@ requests retain their timeouts; timed-out status requests count toward the polli
515
515
  Press Ctrl-C to stop waiting; this does not cancel the NAS operation.
516
516
  Container Apps pre-pull their inspected, locked image references on the NAS before
517
517
  SPK upload. An exact local repository digest skips the registry pull; an image
518
- configuration ID or a remote update digest is not sufficient proof. Progress includes bytes; failures name the image, requested registry
518
+ configuration ID or a remote update digest is not sufficient proof. Pull progress reports phase changes, updates at most once every five seconds within
519
+ a phase, and always reports completion. The DSM `downloaded` counter has no verified
520
+ byte unit and is used only for stall detection. The requested registry is shown once
521
+ per image; failures name the image, requested registry
519
522
  and daemon cause/endpoint when DSM provides them. Configure a reachable mirror,
520
523
  trust an inspecting CA in Container Manager, or use `images pin` and preload the
521
524
  pinned image. Pinning alone does not download layers onto the NAS. Pull tasks
@@ -546,6 +549,9 @@ unknown; a generic `install_corruption` does not prove a registry failure.
546
549
  Stopping/removal reports `state: "stopping"` or `"uninstalling"` until DSM verifies completion.
547
550
  It never reports `installed:false` for those transitions: an upgrade retains
548
551
  `installed:true`; a fresh install without a verified payload uses `installed:null`.
552
+ `status <package-id>` includes `openUrl` when DSM supplies a primary App launch
553
+ name or one unambiguous App entry. It opens on the configured DSM origin, preserving
554
+ HTTPS and its port. Missing, denied or ambiguous launch metadata leaves the field absent.
549
555
  `status` carries the effective DSM/CLI status. The result contract is
550
556
  [schema/package-state.schema.json](schema/package-state.schema.json).
551
557
 
@@ -46,6 +46,8 @@ export const ERROR_REGISTRY = {
46
46
  INIT_UPSTREAM_INVALID: { code: "INIT_UPSTREAM_INVALID", description: "The upstream repository URL is invalid.", suggestion: "Supply --upstream with an HTTPS repository URL without credentials." },
47
47
  INIT_PUBLISHER_INVALID: { code: "INIT_PUBLISHER_INVALID", description: "The attribution name or publisher URL is invalid.", suggestion: "Use plain single-line project/publisher names and an http(s) publisher URL without credentials." },
48
48
  UPSTREAM_ATTRIBUTION: { code: "UPSTREAM_ATTRIBUTION", description: "Upstream App attribution is incomplete or names the distributor as maintainer.", suggestion: "Name the original project/team or owner as maintainer; set metadata.maintainer_url to the upstream repository and metadata.distributor/distributor_url to your publisher; resolve TODOs before release." },
49
+ DSM_WINDOW_COLOR_SCHEME: { code: 'DSM_WINDOW_COLOR_SCHEME', description: 'A DSM-window Vue component combines OS theme detection with a dynamic color-scheme binding', suggestion: 'Leave color-scheme unset in DSM windows; follow OS preferences only on the App\'s own full page' },
50
+ STANDALONE_IDENTITY_WITHOUT_PORTAL: { code: 'STANDALONE_IDENTITY_WITHOUT_PORTAL', description: 'Standalone identity is enabled without an Application Portal declaration', suggestion: 'Use HTTPS-only standalone login outside DSM windows; declare portal only when an alias is needed' },
49
51
  INSTALL_SETTINGS_INVALID: { "code": "INSTALL_SETTINGS_INVALID", "description": "The installation setting declaration is invalid.", "suggestion": "Declare 1–32 lowercase identifier keys in install.settings, each with type https-origin, a plain label and an explicit boolean required; omit defaults and values." },
50
52
  INSTALL_PORT_INVALID: { code: "INSTALL_PORT_INVALID", description: "The installation port declaration or selected value is invalid", suggestion: "Enable install.ports for a declared identity gateway and choose distinct available non-reserved ports between 1024 and 65535" },
51
53
  SDK_PORT_SETTINGS_UNSUPPORTED: { code: "SDK_PORT_SETTINGS_UNSUPPORTED", description: "The selected SDK does not provide installer-selected ports", suggestion: "Pin SDK 0.38.2 or a matching supported release and rebuild with the matching CLI" },
@@ -17,6 +17,11 @@ export function containerImageReferences(report) {
17
17
  }
18
18
  const hint = 'Configure a reachable registry mirror, trust the inspecting CA in Container Manager, or use images pin on a trusted host and preload the pinned image on the NAS. Check Container Manager before retrying; pull tasks may still be running.';
19
19
  const causePattern = /error|fail|denied|forbidden|unauthorized|x509|certificate|tls|timeout|timed out|refused|no such host|not found|too many requests|429|403|unexpected.*status/i;
20
+ const progressIntervalMs = 5_000;
21
+ function pullPhase(detail) {
22
+ // Layer IDs, counters and heartbeat text are not phase changes.
23
+ return /\b(pulling fs layer|waiting|downloading|verifying checksum|download complete|extracting|pull complete|already exists)\b/i.exec(detail)?.[1].toLowerCase() ?? 'pulling';
24
+ }
20
25
  /** Pull on the NAS, before Package Center can turn a registry failure into broken/150. */
21
26
  export async function pullContainerImages(options) {
22
27
  const deadline = options.deadlineMs === undefined ? Infinity : Date.now() + options.deadlineMs;
@@ -30,9 +35,21 @@ export async function pullContainerImages(options) {
30
35
  throw new CtlError('CONTAINER_PULL_FAILED', 'Invalid container image reference', hint);
31
36
  // Do not apply build-host mirror overrides here: the inspected reference is authoritative.
32
37
  const requested = registryBaseUrl(parsed.registry, {});
33
- const context = `Image ${image} (requested registry ${requested}; actual endpoint appears in the daemon detail when available)`;
34
- const fail = (code, detail) => new CtlError(code, maskDiagnostic(`${context}: ${detail}`), hint);
38
+ const context = `Image ${image}`;
39
+ // Separate punctuation from the URL so diagnostic URL normalization cannot
40
+ // interpret a semicolon as part of the registry hostname.
41
+ const registryNote = `requested registry ${requested} — the actual endpoint appears in the daemon detail when available`;
42
+ const fail = (code, detail) => new CtlError(code, maskDiagnostic(`${context} (${registryNote}): ${detail}`), hint);
35
43
  let lastAdvance = Date.now(), downloaded = -1;
44
+ let lastPhase, lastReport = -Infinity;
45
+ const report = (phase, detail, finished = false) => {
46
+ const now = Date.now();
47
+ if (!finished && phase === lastPhase && now - lastReport < progressIntervalMs)
48
+ return;
49
+ lastPhase = phase;
50
+ lastReport = now;
51
+ progress(maskDiagnostic(`${context}: ${detail}`));
52
+ };
36
53
  const remaining = () => {
37
54
  if (options.signal?.aborted)
38
55
  throw installCanceled();
@@ -57,7 +74,7 @@ export async function pullContainerImages(options) {
57
74
  }
58
75
  return body.data;
59
76
  };
60
- progress(`${context}: starting NAS image pull…`);
77
+ progress(maskDiagnostic(`${context}: starting NAS image pull… (${registryNote})`));
61
78
  try {
62
79
  if (parsed.digest) {
63
80
  const inventory = await call('list', { offset: '0', limit: '-1' });
@@ -103,7 +120,7 @@ export async function pullContainerImages(options) {
103
120
  catch (error) {
104
121
  if (!isHostTimeout(error))
105
122
  throw error;
106
- progress(`${context}: status request timed out; checking existing pull task…`);
123
+ report('status timeout', 'status request timed out; checking existing pull task…');
107
124
  }
108
125
  if (state !== undefined) {
109
126
  if (typeof state?.finished !== 'boolean')
@@ -115,7 +132,9 @@ export async function pullContainerImages(options) {
115
132
  downloaded = state.downloaded;
116
133
  lastAdvance = Date.now();
117
134
  }
118
- progress(maskDiagnostic(`${context}: ${state.finished ? 'pull complete' : 'pulling'} (${Math.max(0, downloaded)} bytes)${detail ? ` — ${detail}` : ''}`));
135
+ // DSM supplies an advancing downloaded counter, but its contract does
136
+ // not establish a byte unit or total. Use it for liveness only.
137
+ report(pullPhase(detail), `${state.finished ? 'pull complete' : 'pulling'}${detail ? ` — ${detail}` : ''}`, state.finished);
119
138
  remaining();
120
139
  if (state.finished)
121
140
  break;
@@ -1,3 +1,5 @@
1
+ /** Use DSM's declared entry, without guessing a package's app name or port. */
2
+ export declare function appUrlFromPackageInfo(dsmOrigin: string, packageId: string, info: unknown): string | undefined;
1
3
  export declare function appOriginFromContract(dsmOrigin: string, contract: {
2
4
  package?: unknown;
3
5
  adminprotocol?: unknown;
@@ -1,4 +1,29 @@
1
1
  import { gatewayEntryPath, usesAuthGateway, webStationAlias } from "../contract/web-launch.js";
2
+ /** Use DSM's declared entry, without guessing a package's app name or port. */
3
+ export function appUrlFromPackageInfo(dsmOrigin, packageId, info) {
4
+ if (!info || typeof info !== 'object' || Array.isArray(info))
5
+ return undefined;
6
+ const data = info;
7
+ if (data.id !== packageId)
8
+ return undefined;
9
+ const primary = data.additional?.dsm_app_launch_name;
10
+ const apps = typeof data.additional?.dsm_apps === 'string' ? data.additional.dsm_apps.trim().split(/\s+/) : [];
11
+ // Multiple entries may include portals or auxiliary windows. Only fall back
12
+ // when DSM reports one unambiguous entry.
13
+ const app = typeof primary === 'string' && primary.trim() ? primary.trim() : apps.length === 1 ? apps[0] : undefined;
14
+ if (!app || !/^[A-Za-z][A-Za-z0-9_.-]*$/.test(app))
15
+ return undefined;
16
+ try {
17
+ const url = new URL('/', dsmOrigin);
18
+ if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password)
19
+ return undefined;
20
+ url.searchParams.set('launchApp', app);
21
+ return url.href;
22
+ }
23
+ catch {
24
+ return undefined;
25
+ }
26
+ }
2
27
  export function appOriginFromContract(dsmOrigin, contract) {
3
28
  if (contract.adminport === undefined || contract.adminport === null || contract.adminport === "") {
4
29
  return undefined;
@@ -76,6 +76,7 @@ export declare function uninstallPackage(id: string, options?: {
76
76
  export declare function packageStatus(id: string, host?: string, connection?: NasConnection): Promise<{
77
77
  recommendedCommand?: string | undefined;
78
78
  message?: string | undefined;
79
+ openUrl?: string | undefined;
79
80
  broken: boolean;
80
81
  installed: boolean | null;
81
82
  state?: "installing" | "upgrading" | "starting" | "stopping" | "uninstalling" | "unknown";
@@ -5,6 +5,7 @@ import { createInterface } from "node:readline/promises";
5
5
  import { CtlError } from "../ctl/errors.js";
6
6
  import { inspectAnySpk } from "../spk/inspect.js";
7
7
  import { containerImageReferences } from './container-pull.js';
8
+ import { appUrlFromPackageInfo } from './open-url.js';
8
9
  import { connectNas, requireAdministrator, } from "./connection.js";
9
10
  import { fetchPackageSource } from "../package-source.js";
10
11
  import { fetchInstalledPackageState, packageStateFromRecord, packageIsBroken, installPackageFromLocalSpk, uninstallPackageFromDsm, } from "./catalog-install.js";
@@ -241,8 +242,20 @@ export async function packageStatus(id, host, connection) {
241
242
  if (!state)
242
243
  throw fail("PACKAGE_STATUS_UNKNOWN", "DSM did not return a verifiable package state");
243
244
  const broken = packageIsBroken(state);
245
+ let openUrl;
246
+ if (state.installed === true) {
247
+ try {
248
+ const info = await nas.call('SYNO.Core.Package', 'get', 1, {
249
+ id,
250
+ additional: JSON.stringify(['dsm_app_launch_name', 'dsm_apps']),
251
+ });
252
+ openUrl = appUrlFromPackageInfo(nas.session.origin, id, info);
253
+ }
254
+ catch { /* Optional launch metadata must not hide a verified package status. */ }
255
+ }
244
256
  const quotedHost = "'" + nas.name.replace(/'/g, "'\\''") + "'";
245
257
  return { host: nas.name, package: id, ...state, broken,
258
+ ...(openUrl ? { openUrl } : {}),
246
259
  ...(broken && state.version && /^[0-9][0-9._-]*$/.test(state.version) && !state.state ? {
247
260
  recommendedCommand: `synopkgland install ${id}@${state.version}${nas.name === "env" ? "" : ` --host ${quotedHost}`} --yes`,
248
261
  message: "Package is broken; reinstall the same release to repair it while retaining data",
@@ -14,7 +14,7 @@ export interface ApprovalInventory {
14
14
  }>;
15
15
  }
16
16
  export interface ApprovalDifference {
17
- retention: 'unknown' | 'eligible' | 'required';
17
+ retention: 'unknown' | 'eligible' | 'required' | 'not-required';
18
18
  permissions: 'unknown' | 'unchanged' | 'expanded' | 'review-required';
19
19
  executor_only: boolean;
20
20
  task_template_changed: boolean | null;
@@ -41,13 +41,22 @@ function inventory(r) {
41
41
  return;
42
42
  return { package: r.package, arch: r.arch, ...r.executor, anchored: true }; // inspect verifies the INFO anchor and every root payload digest.
43
43
  }
44
+ function noApproval(r) {
45
+ return r.synopkgland && r.dsm.ok && r.findings.length === 0 && Boolean(r.package && r.arch) && !r.executor && r.capabilities.every(cap => !cap.requiresAdminApproval);
46
+ }
47
+ function notRequired() {
48
+ return { retention: 'not-required', permissions: 'unchanged', executor_only: false, task_template_changed: false, root_programs: [], policy_changes: [], reason: 'No SDK administrator approval is required: this verified package has no executor or approval-requiring capability.' };
49
+ }
44
50
  export async function spkApprovalDiff(current, baseline, report) {
51
+ const nextReport = report ?? await inspectAnySpk(current);
45
52
  if (!baseline)
46
- return approvalDiff(undefined, undefined);
47
- const next = inventory(report ?? await inspectAnySpk(current));
53
+ return noApproval(nextReport) ? notRequired() : approvalDiff(undefined, undefined);
54
+ const next = inventory(nextReport);
48
55
  const old = await inspectAnySpk(baseline);
49
56
  if (!old.dsm.ok || old.findings.length)
50
57
  throw new Error('[APPROVAL_BASELINE_INVALID] Baseline SPK failed inspection: ' + [...old.findings, ...old.dsm.errors.map(e => e.message)].join('; '));
58
+ if (old.package === nextReport.package && old.arch === nextReport.arch && noApproval(old) && noApproval(nextReport))
59
+ return notRequired();
51
60
  return approvalDiff(inventory(old), next);
52
61
  }
53
62
  export function formatApprovalDiff(d) {
@@ -0,0 +1,4 @@
1
+ import type { ValidationError } from '../types.js';
2
+ import type { StandaloneManifest } from './manifest.js';
3
+ /** Advisory source heuristic, not Vue compilation or cross-file data-flow analysis. */
4
+ export declare function uiGuidanceWarnings(manifest: StandaloneManifest): ValidationError[];
@@ -0,0 +1,77 @@
1
+ import { lstatSync, readFileSync, readdirSync } from 'node:fs';
2
+ import { join, relative } from 'node:path';
3
+ import { resolvedSdkLaunch } from '../contract/app-launch.js';
4
+ import { hasSdkWindow } from './dsm-window.js';
5
+ const SKIP_DIRECTORIES = new Set(['node_modules', 'dist', 'build', 'coverage', 'vendor', 'test', 'tests', '__tests__']);
6
+ /** Advisory source heuristic, not Vue compilation or cross-file data-flow analysis. */
7
+ export function uiGuidanceWarnings(manifest) {
8
+ const warnings = [];
9
+ if (manifest.capabilities.identity === 'standalone' && !manifest.portal) {
10
+ warnings.push({
11
+ code: 'STANDALONE_IDENTITY_WITHOUT_PORTAL', severity: 'warning',
12
+ span: { file: 'dsm-package.yaml', line: 1, column: 1 },
13
+ message: 'capabilities.identity: standalone is enabled without portal; standalone sign-in requires HTTPS, including DSM-cookie reuse',
14
+ suggestion: 'Use standalone identity / --with login only for Apps opened outside a DSM window (a portal or their own tab). Remove login from DSM-window Apps; declare portal only if an alias is needed',
15
+ });
16
+ }
17
+ if (!hasSdkWindow(manifest) || resolvedSdkLaunch(manifest) !== 'dsm-window')
18
+ return warnings;
19
+ // Build cwd is the frontend source root, not the generated ui.dir output.
20
+ const sourceRoot = manifest.ui.build?.cwd ?? manifest.ui.dir;
21
+ const walk = (dir) => {
22
+ let entries;
23
+ try {
24
+ if (!lstatSync(dir).isDirectory() || lstatSync(dir).isSymbolicLink())
25
+ return;
26
+ entries = readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
27
+ }
28
+ catch {
29
+ return;
30
+ } // The source may not have been generated yet.
31
+ for (const entry of entries) {
32
+ if (entry.isSymbolicLink() || entry.name.startsWith('.'))
33
+ continue;
34
+ const path = join(dir, entry.name);
35
+ if (entry.isDirectory()) {
36
+ if (!SKIP_DIRECTORIES.has(entry.name) && path !== manifest.ui.dir)
37
+ walk(path);
38
+ }
39
+ else if (entry.isFile() && entry.name.endsWith('.vue')) {
40
+ let source;
41
+ try {
42
+ source = readFileSync(path, 'utf8');
43
+ }
44
+ catch {
45
+ continue;
46
+ }
47
+ const binding = schemeBinding(source);
48
+ if (binding === undefined)
49
+ continue;
50
+ const before = source.slice(0, binding);
51
+ warnings.push({
52
+ code: 'DSM_WINDOW_COLOR_SCHEME', severity: 'warning',
53
+ span: { file: relative(manifest.root, path).replaceAll('\\', '/'), line: before.split('\n').length, column: binding - before.lastIndexOf('\n') },
54
+ message: 'This Vue component combines a dynamic color-scheme/colorScheme binding with matchMedia(prefers-color-scheme); review it for the DSM window',
55
+ suggestion: 'Leave color-scheme unset in DSM windows: DSM draws them light. Follow prefers-color-scheme only on the App\'s own full page (portal or own tab)',
56
+ });
57
+ }
58
+ }
59
+ };
60
+ walk(sourceRoot);
61
+ return warnings;
62
+ }
63
+ function schemeBinding(source) {
64
+ // Preserve offsets for file/line diagnostics, including multiline comments.
65
+ const blank = (text) => text.replace(/[^\r\n]/g, ' ');
66
+ const uncommented = source.replace(/<!--[\s\S]*?-->/g, blank)
67
+ .replace(/(["'`])(?:\\[\s\S]|(?!\1)[^\\])*?\1|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*/g, token => token.startsWith('/') ? blank(token) : token);
68
+ if (!/\bmatchMedia\s*\(\s*(["'`])\s*\(\s*prefers-color-scheme\s*:[^"'`]*\1/.test(uncommented))
69
+ return undefined;
70
+ for (const binding of uncommented.matchAll(/(?:v-bind:|:)(?:color-scheme|colorScheme)\s*=\s*(["'])([\s\S]*?)\1/g)) {
71
+ // A constant light theme does not follow the OS preference.
72
+ if (/^\s*(["'`])[\s\S]*\1\s*$/.test(binding[2]))
73
+ continue;
74
+ return binding.index;
75
+ }
76
+ return undefined;
77
+ }
package/dist/validate.js CHANGED
@@ -6,6 +6,7 @@ import { getErrorCode } from "./error-registry.js";
6
6
  import { loadStandaloneManifest } from "./standalone/manifest.js";
7
7
  import { applyUiIgnores, scanUiTree } from "./standalone/public-ui.js";
8
8
  import { hasSdkWindow } from "./standalone/dsm-window.js";
9
+ import { uiGuidanceWarnings } from "./standalone/ui-guidance.js";
9
10
  import { isNativeLayout, loadNativeLayout, } from "./standalone/native-layout.js";
10
11
  import { manifestPolicyProblem } from "./runtime/executor-policy-check.js";
11
12
  /** All shipped Compose and native projects use the schema-2 build path. */
@@ -43,6 +44,8 @@ export function validateProject(project, _options = {}) {
43
44
  ];
44
45
  if (loaded.ok) {
45
46
  const manifest = loaded.manifest;
47
+ if ('ui' in manifest)
48
+ warnings.push(...uiGuidanceWarnings(manifest));
46
49
  const roots = "ui" in manifest
47
50
  ? hasSdkWindow(manifest) ? [{ dir: manifest.ui.dir, prefix: "app/" }] : []
48
51
  : manifest.arches.map(arch => ({ dir: join(manifest.root, manifest.layout.payload.replaceAll("{arch}", arch), "ui"), prefix: "" }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.52.5",
3
+ "version": "0.52.7",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -156,11 +156,13 @@
156
156
  "arrayEnums": {
157
157
  "additional": [
158
158
  "status",
159
- "dsm_apps"
159
+ "dsm_apps",
160
+ "dsm_app_launch_name"
160
161
  ]
161
162
  },
162
163
  "sources": [
163
- "host/catalog-install.ts"
164
+ "host/catalog-install.ts",
165
+ "host/package-commands.ts"
164
166
  ],
165
167
  "hubConfirmed": [
166
168
  "7.4"
@@ -1127,11 +1129,11 @@
1127
1129
  "error-registry.ts": "91f2de89bf98750a09fce54420e3a25e3527980be175ed704890a520181f1dc9",
1128
1130
  "host/catalog-install.ts": "df27409d835a901658dae7c2048c9028c2dc886e17575fe9189e88ae705c0fd2",
1129
1131
  "host/compose-project-recovery.ts": "c76efa505f8ba14f50a8705b63d0f9f8a022b70505fe6a5f5976146afae17532",
1130
- "host/container-pull.ts": "d85314dd265f7609ab1fda87e23cce0fa81165baeeaf79a792d7bb6dc10338e3",
1132
+ "host/container-pull.ts": "09908f48133ecc2580001afb4f7f0b6a949e4f35df1229e1e0860e37f2aa9a46",
1131
1133
  "host/dsm-client.ts": "52c34d520154e43d823a64dbb0ff7f3ae40e427fb835a5136ab6d847827a4b7a",
1132
1134
  "host/dsm-compound.ts": "5674b6f11d2b36a86a97ac7edf590abb34bd72f441c1f43ab057a43cfb5d7e88",
1133
1135
  "host/dsm-port-profile.ts": "9ebd06bbbc918267ef2d8a4ff9737b9d35579e45224dd4de362389921446ae8d",
1134
- "host/package-commands.ts": "ba1debaee82b19f310efe59eb0692a6495282e0e5e2ac2b474a8b85465eadafc",
1136
+ "host/package-commands.ts": "2e54eeea40cdf3221d277697ab9b02b43377e58bd81b64d4507f85d4039a08e8",
1135
1137
  "host/port-info-lookup.ts": "b7af19dd8194bc424eb2100ce5953cf0737e8158da373e93b66627c6a7028c8e",
1136
1138
  "host/port-info.ts": "9ab70c37860df681bee70039aebda9ad974fbd2e200fc2741daf9aacf7943905",
1137
1139
  "host/share-lookup.ts": "c158baffc774cb7b5b36a82b633bc48f7b8522f67972ef09ab1a15a8b4609196",
package/skills/SKILL.md CHANGED
@@ -416,11 +416,16 @@ Apps requiring `/` cannot use ingress.
416
416
 
417
417
  ## HTTPS 與舊 DSM token
418
418
 
419
- 不是每個 App 都需要 HTTPS,很多 App 用 HTTP 就夠。一般 CRUD、設定或檔案類
420
- App 不要預設強制 HTTPS。只有使用 secure context 能力(`getUserMedia`、
419
+ 使用 DSM session、未啟用 standalone identity 的 DSM 視窗 App,一般 CRUD、設定或檔案操作
420
+ 可以使用 HTTP,不要預設強制 HTTPS。只有使用 secure context 能力(`getUserMedia`、
421
421
  剪貼簿讀寫、Service Worker、WebCrypto `subtle` 等)、瀏覽器 Extension 或外部
422
422
  裝置配對,或 App 的嚴格 Origin 驗證確實要求 HTTPS 時,才明確啟用限制。
423
423
 
424
+ `identity: standalone`/`--with login` 則只給 DSM 視窗外開啟的 App(portal 或自己的分頁),
425
+ 密碼/OTP 登入與 DSM cookie 重用一律只走 HTTPS,App session cookie 保持 Secure。
426
+ DSM 視窗 App 不要加 login。HTTP 頁面仍可開啟,以可關閉的 Callout 說明限制,
427
+ 並用 `readDsmHttpsURL` 提供一鍵前往 HTTPS;詳見 [identity](reference/identity.md)。
428
+
424
429
  要求 HTTPS 的 App 應回專屬碼 `https_required`,不可混成 `NOT_AUTHENTICATED`
425
430
  或 `session_required`,否則重新登入也無法解決。可選用 Go
426
431
  `api.RequireSecureOrigin(request)`;它不取代 session、同源或權限檢查。
@@ -9,7 +9,7 @@ common reads and writes, rather than stopping at status commands.
9
9
  先選擇 `native-go`(Go CGI + DSM 視窗)、`native-python`/`native-node`/`native-rust`(同一個 App,backend 換成 Python、Node.js(TypeScript)或 Rust)、`binary`(預建服務程式)或 `compose`(上游容器)。`compose` 產生 schema-2 的上游 Compose 範例與 DSM 差異宣告,`--from <compose.yaml>` 匯入現有 Compose。
10
10
 
11
11
  ```sh
12
- synopkgland init -t native-go --with files,jobs,login --package MyApp my-app
12
+ synopkgland init -t native-go --with files,jobs --package MyApp my-app
13
13
  synopkgland init -t native-python --with jobs,delegate my-py-app
14
14
  synopkgland init -t binary service
15
15
  synopkgland init -t compose --from ./compose.yaml upstream-app
@@ -54,7 +54,9 @@ To deliberately package a file blocked by the SPK secret guard, declare top-leve
54
54
 
55
55
  native-go 與 binary 使用 `dsm-package.yaml` 的 `schema: 2`,backend 寫 `kind: go, dir: backend` 或 `kind: binary, files: {x86_64: prebuilt/api-x86_64}`。
56
56
  `--with files,jobs,login,root-ops,delegate` 分別宣告 `capabilities.files: session`、`jobs: true`、`identity: standalone`、`rootOps: true`、`delegate: {operations: [files.moveFromStaging], destinations: [save], lifetime: until-revoked, scope: install-selected}`。jobs 可寫 `{worker: sha256-v1}`,與 daemon 互斥;delegate 隱含 worker 並可與 daemon 共存;admin/normal 都以本人 UID 執行。binary/compose 不支援 files/jobs/login/delegate。
57
- 既有 native-go 專案用 `synopkgland add files jobs login`;已存在能力回報 no-op。overlay 檔案已有不同內容或 stub 被改動時,add 拒絕並列出衝突;不修改業務 routes 或 App.vue。
57
+ `--with login`/`add login` 宣告 `capabilities.identity: standalone`,只適用於在 DSM 視窗外開啟的 App(portal 或自己的分頁);DSM 視窗 App 不要加。Standalone identity 的密碼/OTP 登入及 DSM cookie 重用都只走 HTTPS,App session cookie 必須保持 Secure。HTTP 頁面可以開啟,但須以可關閉的 Callout 說明原因,並用 `readDsmHttpsURL` 提供一鍵前往 HTTPS,不要靜默停用登入控制項。需要 Application Portal 別名時才宣告 `portal`;自己的分頁不強制需要別名。
58
+
59
+ 既有 native-go 專案用 `synopkgland add files jobs`;已存在能力回報 no-op。overlay 檔案已有不同內容或 stub 被改動時,add 拒絕並列出衝突;不修改業務 routes 或 App.vue。
58
60
  check、inspect、build、deploy、status 支援 `--json`,stdout 只有單一 JSON 物件,錯誤包含 code、message、hint;進度在 stderr。
59
61
 
60
62
  rootOps 與 delegate 已共用管理員 PasswordConfirm 核准的 protected executor、boot/control tasks;精確 task readback 與 digest health 一致才 ready;policy(operations、scope、root 腳本)變更須重核准,policy 不變的 executor 更新會自動 repin,install-selected 的 scope 需管理員確認一次。Vue App 只在 SDK 的 ExecutorSettings 核准;plain UI 由 DSM 視窗面板核准,兩者都在面板內輸入密碼並走 PasswordConfirm。native 產品另可明確 opt-in `@synopackageland/sdk/native` 的 runtime,不與 generated executor tasks 混用。SDK off stub 與 routes_test.go 的預設 policy scaffold 只有內容仍等於 bundled base 時才會替換;App 自訂版本拒絕。
@@ -11,18 +11,25 @@ for migration and build binding.
11
11
 
12
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.
13
13
 
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.
14
+ I capability: `init --with login` or `add login` declares `capabilities.identity: standalone` and enables Go-native standalone identity and Vue login. Use it only for Apps opened outside a DSM window (a portal or their own tab); DSM-window Apps must not add login. Standalone identity is HTTPS-only: both DSM-cookie bootstrap (including Continue with DSM) and account/password/OTP sign-in require HTTPS. The App session cookie is Secure. Same-host DSM cookies can be reused across ports only over HTTPS after backend verification. Missing cookies use the 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.
15
15
 
16
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.
17
17
 
18
18
  ## HTTPS and stale DSM tokens
19
19
 
20
- HTTP is sufficient for many CRUD, settings and file Apps. Require HTTPS only
21
- when the App needs secure context browser features, pairing or a strict secure
22
- Origin policy. Return `https_required`, separate from authentication failures,
23
- and render `identityCopy(locale).httpsTitle` / `errors.https_required` with a
24
- way to reopen through HTTPS. Go `api.RequireSecureOrigin(request)` is opt-in
25
- and supplements the existing origin/session/permission checks.
20
+ Apps using the DSM session inside a DSM window can use HTTP for CRUD, settings
21
+ and files unless they need secure context browser features, pairing or a strict
22
+ secure Origin policy. Go `api.RequireSecureOrigin(request)` is opt-in for these
23
+ Apps and supplements the existing origin/session/permission checks.
24
+
25
+ Standalone identity (`identity: standalone` / `--with login`) always requires
26
+ HTTPS for sign-in and DSM-cookie reuse; this does not depend on
27
+ `RequireSecureOrigin`. Never send passwords over HTTP or relax the Secure
28
+ session cookie. Allow the HTTP page to open and explain `https_required` in a
29
+ dismissible Callout, with a one-click HTTPS action using `readDsmHttpsURL`;
30
+ do not silently disable all sign-in controls. Keep this separate from
31
+ authentication failures and use `identityCopy(locale).httpsTitle` /
32
+ `errors.https_required`.
26
33
 
27
34
  Only administrators may call `readDsmPorts(ctx)` to find `dms_https`;
28
35
  `readDsmHttpsURL(ctx, location.href)` provides this guard and a DSM link.
@@ -58,6 +58,7 @@ do not guess APIs or copy a version-specific component inventory.
58
58
  front. Below 600px of viewport width the UI turns them into bottom sheets.
59
59
  Keep the default `app` bounds outside DSM windows (standalone web, Portal,
60
60
  previews).
61
+ - In a DSM window, leave `color-scheme` / `colorScheme` unset: DSM draws it light. Follow `prefers-color-scheme` only on the App's own full page (portal or own tab).
61
62
  - Import only `@synopackageland/ui/themes/dsm7-embedded.css` for the template.
62
63
  The standalone `theme.css` and `dsm7.css` entrypoints affect the host page.
63
64
  - Set a unique `app.config.idPrefix` for every independent Vue app before