@synopackageland/cli 0.52.16 → 0.52.18

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.52.18 (2026-11-10)
4
+
5
+ - Add `install.recommended_memory_mb`: below it, the install wizard shows a warning page the administrator can continue past, with the NAS memory, the recommendation and the App's optional `install.recommended_memory_message` catalog text in each wizard language. Preinst, upgrades and CLI installations never check it.
6
+ - Report `recommendedMemoryMb` in `inspect --json` and verify the generated install wizards against the packaged declaration.
7
+ - Add the `INSTALL_RECOMMENDED_MEMORY_INVALID` explanation.
8
+
9
+ ## 0.52.17 (2026-11-09)
10
+
11
+ - Use SDK 0.53.26 by default.
12
+ - Ship the SDK initializer for Compose services that declare `console` (the container init for interactive console Apps), not only for `storage_init`.
13
+ - Refuse `console` and `run_as.sudo` with an older Compose SDK (`SDK_COMPOSE_UNSUPPORTED`: SDK 0.53.26 or later).
14
+ - Show Compose services that opt into `run_as.sudo` in `inspect` (`Container privilege: <service>: sudo inside container (<reason>)`) and in the inspect JSON, and write them to INFO `synopkgland_container_sudo` (JSON service and reason) for catalogs; `inspect` refuses an SPK whose INFO differs from its Compose plan.
15
+ - Add the `COMPOSE_SUDO_INVALID`, `COMPOSE_CONSOLE_INVALID` and `COMPOSE_CONSOLE_SUDO_UNAVAILABLE` explanations.
16
+
3
17
  ## 0.52.16 (2026-11-09)
4
18
 
5
19
  - Pin SDK 0.53.25 for Compose planning.
package/README.md CHANGED
@@ -691,7 +691,9 @@ absence of a GPU produces no device mapping. See the matching SDK's Compose GPU
691
691
  documentation for the security boundary and hardware validation limits.
692
692
 
693
693
  DSM's native provider adds NET_BIND_SERVICE to the bounding set for Compose
694
- packages. The SDK still emits `cap_drop: [ALL]` and requests no `cap_add`; the
694
+ packages. The SDK still emits `cap_drop: [ALL]` and requests no `cap_add` unless
695
+ a console service declares `run_as.sudo` (see the SDK Compose documentation on
696
+ interactive console services); the
695
697
  nonroot package process with no-new-privileges has zero effective, permitted and
696
698
  ambient capabilities on the tested provider. This general platform behavior is
697
699
  not a GPU blocker. Plan metadata describes SDK policy, not an attestation of the
@@ -1,5 +1,6 @@
1
1
  import { type Locale } from "../standalone/i18n.js";
2
2
  import { type Translate } from "./wizard-i18n.js";
3
+ import { type MemoryAdvice } from "../standalone/install-memory.js";
3
4
  /** One step of a DSM install wizard; `items` are rendered verbatim as JSON. */
4
5
  export interface InstallWizardStep {
5
6
  step_title: string;
@@ -18,9 +19,13 @@ export interface InstallWizardFiles {
18
19
  * versions and flows that do not run the dynamic script; both carry the same
19
20
  * items, and only the dynamic one adds the reuse notice when data exists.
20
21
  */
21
- export declare function renderInstallWizardFiles(packageName: string, render: (t: Translate) => InstallWizardStep[], minMemoryMb?: number): InstallWizardFiles;
22
- /** Prepend to an existing dynamic wizard; retain its normal pages when memory is sufficient. */
23
- export declare function renderMemoryWizardCheck(minMemoryMb: number | undefined, locale: Locale): string;
22
+ export declare function renderInstallWizardFiles(packageName: string, render: (t: Translate) => InstallWizardStep[], minMemoryMb?: number, advice?: MemoryAdvice): InstallWizardFiles;
23
+ /**
24
+ * Prepend to an existing dynamic wizard; retain its normal pages when memory is sufficient.
25
+ * With `advice`, it also defines the filter that puts a warning page before
26
+ * those pages; the warning has no validator, so Next stays available.
27
+ */
28
+ export declare function renderMemoryWizardCheck(minMemoryMb: number | undefined, locale: Locale, advice?: MemoryAdvice): string;
24
29
  /** Lists the App's unauthenticated service callbacks for the administrator. */
25
30
  export declare function integrationWizardSteps(t: Translate, methods?: readonly string[]): InstallWizardStep[];
26
31
  /** The native-go install step: no parameters, only the app-space consent. */
@@ -1,6 +1,6 @@
1
1
  import { DSM_LANGS, LOCALES } from "../standalone/i18n.js";
2
2
  import { renderWizardFiles, translator } from "./wizard-i18n.js";
3
- import { memoryReason, renderMemoryProbe } from "../standalone/install-memory.js";
3
+ import { memoryAdviceTexts, memoryReason, renderMemoryProbe } from "../standalone/install-memory.js";
4
4
  const BASE = "install_uifile";
5
5
  function shellQuote(value) {
6
6
  return `'${value.replaceAll("'", "'\\''")}'`;
@@ -27,7 +27,7 @@ function withReuseNotice(steps, packageName, t) {
27
27
  * is chosen after the wizard on some flows). The wizard JSON is written to
28
28
  * `SYNOPKG_TEMP_LOGFILE`, DSM's documented channel, or stdout without it.
29
29
  */
30
- function renderDynamicScript(packageName, withData, withoutData, memoryCheck = "") {
30
+ function renderDynamicScript(packageName, withData, withoutData, memoryCheck = "", advice = false) {
31
31
  return `#!/bin/sh
32
32
  # Generated by synopkgland. Read-only: it checks whether this package already
33
33
  # has App Data on a volume, then prints the install wizard for this language.
@@ -42,7 +42,7 @@ done
42
42
  if [ -n "\${SYNOPKG_TEMP_LOGFILE:-}" ]; then
43
43
  exec > "$SYNOPKG_TEMP_LOGFILE"
44
44
  fi
45
- if [ -n "$existing" ]; then
45
+ ${advice ? "{\n" : ""}if [ -n "$existing" ]; then
46
46
  cat <<'SYNOPKGLAND_WIZARD'
47
47
  ${withData}
48
48
  SYNOPKGLAND_WIZARD
@@ -51,7 +51,7 @@ else
51
51
  ${withoutData}
52
52
  SYNOPKGLAND_WIZARD
53
53
  fi
54
- `;
54
+ ${advice ? "} | synopkgland_memory_advice_page\n" : ""}`;
55
55
  }
56
56
  /**
57
57
  * Builds the static `<base>` wizard files and one dynamic `<base>.sh` script
@@ -59,7 +59,7 @@ fi
59
59
  * versions and flows that do not run the dynamic script; both carry the same
60
60
  * items, and only the dynamic one adds the reuse notice when data exists.
61
61
  */
62
- export function renderInstallWizardFiles(packageName, render, minMemoryMb) {
62
+ export function renderInstallWizardFiles(packageName, render, minMemoryMb, advice) {
63
63
  const staticFiles = renderWizardFiles(BASE, render);
64
64
  const dynamic = {};
65
65
  for (const locale of LOCALES) {
@@ -67,14 +67,18 @@ export function renderInstallWizardFiles(packageName, render, minMemoryMb) {
67
67
  const steps = render(t);
68
68
  const withData = JSON.stringify(withReuseNotice(steps, packageName, t), null, 2);
69
69
  const withoutData = JSON.stringify(steps, null, 2);
70
- dynamic[localeName(locale, ".sh")] = renderDynamicScript(packageName, withData, withoutData, renderMemoryWizardCheck(minMemoryMb, locale));
70
+ dynamic[localeName(locale, ".sh")] = renderDynamicScript(packageName, withData, withoutData, renderMemoryWizardCheck(minMemoryMb, locale, advice), Boolean(advice));
71
71
  }
72
72
  return { static: staticFiles, dynamic };
73
73
  }
74
- /** Prepend to an existing dynamic wizard; retain its normal pages when memory is sufficient. */
75
- export function renderMemoryWizardCheck(minMemoryMb, locale) {
74
+ /**
75
+ * Prepend to an existing dynamic wizard; retain its normal pages when memory is sufficient.
76
+ * With `advice`, it also defines the filter that puts a warning page before
77
+ * those pages; the warning has no validator, so Next stays available.
78
+ */
79
+ export function renderMemoryWizardCheck(minMemoryMb, locale, advice) {
76
80
  if (minMemoryMb === undefined)
77
- return "";
81
+ return advice ? renderMemoryProbe(undefined, advice.mb) + renderMemoryAdvicePage(advice, locale) : "";
78
82
  const reason = memoryReason(minMemoryMb, locale, "__SYNOPKGLAND_MEMORY_GB__");
79
83
  const page = [{
80
84
  step_title: translator(locale)("memory.title"),
@@ -86,7 +90,7 @@ export function renderMemoryWizardCheck(minMemoryMb, locale) {
86
90
  }];
87
91
  // Only a formatted numeric value enters JSON, never shell or meminfo text.
88
92
  const json = JSON.stringify(page, null, 2);
89
- return `${renderMemoryProbe(minMemoryMb)}if [ -n "$synopkgland_memory_low" ]; then
93
+ return `${renderMemoryProbe(minMemoryMb, advice?.mb)}if [ -n "$synopkgland_memory_low" ]; then
90
94
  if [ -n "\${SYNOPKG_TEMP_LOGFILE:-}" ]; then
91
95
  exec > "$SYNOPKG_TEMP_LOGFILE"
92
96
  fi
@@ -95,6 +99,30 @@ ${json}
95
99
  SYNOPKGLAND_MEMORY_WIZARD
96
100
  exit 0
97
101
  fi
102
+ ${advice ? renderMemoryAdvicePage(advice, locale) : ""}`;
103
+ }
104
+ /**
105
+ * A shell filter over the wizard's JSON array (pretty-printed, so its first
106
+ * line is \`[\` or \`[]\`): below the recommendation it emits the warning
107
+ * page first; otherwise it passes the wizard through unchanged.
108
+ */
109
+ function renderMemoryAdvicePage(advice, locale) {
110
+ const page = {
111
+ step_title: translator(locale)("memory.recommendedTitle"),
112
+ items: memoryAdviceTexts(advice, locale, "__SYNOPKGLAND_MEMORY_GB__").map(desc => ({ desc })),
113
+ };
114
+ // Only a formatted numeric value enters JSON, never shell or meminfo text.
115
+ return `synopkgland_memory_advice_page() {
116
+ if [ -z "$synopkgland_memory_advice" ]; then
117
+ cat
118
+ return
119
+ fi
120
+ printf '[\\n'
121
+ sed "s/__SYNOPKGLAND_MEMORY_GB__/$synopkgland_memory_gb/g" <<'SYNOPKGLAND_MEMORY_ADVICE'
122
+ ${JSON.stringify(page, null, 2)}
123
+ SYNOPKGLAND_MEMORY_ADVICE
124
+ sed -e '1s/^\\[\\]$/]/' -e '1s/^\\[$/,/'
125
+ }
98
126
  `;
99
127
  }
100
128
  /** Lists the App's unauthenticated service callbacks for the administrator. */
@@ -21,6 +21,28 @@ export declare const WIZARD_MESSAGES: {
21
21
  es: string;
22
22
  it: string;
23
23
  };
24
+ "memory.recommendedTitle": {
25
+ en: string;
26
+ "zh-TW": string;
27
+ "zh-CN": string;
28
+ ja: string;
29
+ ko: string;
30
+ de: string;
31
+ fr: string;
32
+ es: string;
33
+ it: string;
34
+ };
35
+ "memory.recommended": {
36
+ en: string;
37
+ "zh-TW": string;
38
+ "zh-CN": string;
39
+ ja: string;
40
+ ko: string;
41
+ de: string;
42
+ fr: string;
43
+ es: string;
44
+ it: string;
45
+ };
24
46
  "ports.http": {
25
47
  en: string;
26
48
  "zh-TW": string;
@@ -21,6 +21,28 @@ export const WIZARD_MESSAGES = {
21
21
  "es": "Esta aplicación requiere al menos {required} GB de RAM; este NAS tiene {actual} GB",
22
22
  "it": "Questa app richiede almeno {required} GB di RAM; questo NAS dispone di {actual} GB"
23
23
  },
24
+ "memory.recommendedTitle": {
25
+ "en": "Memory recommendation",
26
+ "zh-TW": "記憶體建議",
27
+ "zh-CN": "内存建议",
28
+ "ja": "推奨メモリ",
29
+ "ko": "권장 메모리",
30
+ "de": "Arbeitsspeicherempfehlung",
31
+ "fr": "Mémoire recommandée",
32
+ "es": "Memoria recomendada",
33
+ "it": "Memoria consigliata"
34
+ },
35
+ "memory.recommended": {
36
+ "en": "This App recommends at least {recommended} GB of RAM; this NAS has {actual} GB. Installation can continue, but the App may run slowly",
37
+ "zh-TW": "此應用程式建議至少 {recommended} GB 記憶體,此 NAS 有 {actual} GB。仍可繼續安裝,但應用程式可能執行緩慢",
38
+ "zh-CN": "此应用程序建议至少 {recommended} GB 内存,此 NAS 有 {actual} GB。仍可继续安装,但应用程序可能运行缓慢",
39
+ "ja": "このアプリには {recommended} GB 以上の RAM を推奨します。この NAS のメモリは {actual} GB です。インストールは続行できますが、アプリの動作が遅くなる場合があります",
40
+ "ko": "이 앱에는 {recommended} GB 이상의 RAM을 권장합니다. 이 NAS의 메모리는 {actual} GB입니다. 설치는 계속할 수 있지만 앱이 느리게 실행될 수 있습니다",
41
+ "de": "Diese App empfiehlt mindestens {recommended} GB RAM; dieses NAS verfügt über {actual} GB. Die Installation kann fortgesetzt werden, aber die App läuft möglicherweise langsam",
42
+ "fr": "Cette application recommande au moins {recommended} Go de RAM ; ce NAS dispose de {actual} Go. L'installation peut continuer, mais l'application risque d'être lente",
43
+ "es": "Esta aplicación recomienda al menos {recommended} GB de RAM; este NAS tiene {actual} GB. La instalación puede continuar, pero la aplicación podría funcionar con lentitud",
44
+ "it": "Questa app consiglia almeno {recommended} GB di RAM; questo NAS dispone di {actual} GB. L'installazione può continuare, ma l'app potrebbe essere lenta"
45
+ },
24
46
  "ports.http": {
25
47
  "en": "HTTP port",
26
48
  "zh-TW": "HTTP 連接埠",
package/dist/cli.js CHANGED
@@ -156,6 +156,7 @@ function formatSpkReport(spk, report) {
156
156
  ...(report.compose.hostUdp?.length
157
157
  ? [`Host UDP listeners: ${report.compose.hostUdp.map(l => `${l.port} (${l.purpose})`).join(", ")}`]
158
158
  : []),
159
+ ...(report.compose.containerSudo ?? []).map((s) => `Container privilege: ${s.service}: sudo inside container (${s.reason}). It starts as the package account; sudo commands run as container root, which is root on the NAS for mounted folders.`),
159
160
  report.compose.readiness.limitation,
160
161
  ]
161
162
  : []),
@@ -51,6 +51,7 @@ export const ERROR_REGISTRY = {
51
51
  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' },
52
52
  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." },
53
53
  INSTALL_MIN_MEMORY_INVALID: { code: "INSTALL_MIN_MEMORY_INVALID", description: "The physical memory requirement or its packaged check is invalid.", suggestion: "Set install.min_memory_mb to a positive integer in MiB, at most 2147483647, and rebuild with the generated package-account hooks and wizards." },
54
+ INSTALL_RECOMMENDED_MEMORY_INVALID: { code: "INSTALL_RECOMMENDED_MEMORY_INVALID", description: "The recommended physical memory, its App message or its packaged install wizard warning is invalid.", suggestion: "Set install.recommended_memory_mb to a positive integer in MiB above install.min_memory_mb, keep the App's install.recommended_memory_message catalog text plain and single-line (1-300 characters, without <, > or &) with an English entry, and rebuild with the generated wizards." },
54
55
  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" },
55
56
  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" },
56
57
  SDK_INSTALL_SETTINGS_UNSUPPORTED: { "code": "SDK_INSTALL_SETTINGS_UNSUPPORTED", "description": "The selected SDK does not provide native installation settings.", "suggestion": "Pin SDK 0.24.0 or a matching supported release with installsettings/cmd/control, then rebuild with the matching CLI." },
@@ -1 +1 @@
1
- {"module":"github.com/synopackageland/syno-pkg-land-sdk","version":"development","local":true}
1
+ {"module":"github.com/synopackageland/syno-pkg-land-sdk","version":"0.53.26","local":false}
@@ -1,7 +1,7 @@
1
1
  export { goPrivateCovers } from './go-env.js';
2
2
  import { type ExecutorManifest } from './sdk-executor-manifest.js';
3
3
  /** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
4
- export declare const DEFAULT_SDK_VERSION = "0.53.23";
4
+ export declare const DEFAULT_SDK_VERSION = "0.53.26";
5
5
  export declare const SDK_PACKAGE = "@synopackageland/sdk";
6
6
  export declare const SDK_MODULE = "github.com/synopackageland/syno-pkg-land-sdk";
7
7
  export declare const EXECUTOR_MODULE = "github.com/synopackageland/syno-pkg-land-sdk/executor";
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os';
5
5
  import { join } from 'node:path';
6
6
  import { readExecutorManifest, predatesExecutorManifest } from './sdk-executor-manifest.js';
7
7
  /** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
8
- export const DEFAULT_SDK_VERSION = '0.53.23';
8
+ export const DEFAULT_SDK_VERSION = '0.53.26';
9
9
  export const SDK_PACKAGE = '@synopackageland/sdk';
10
10
  export const SDK_MODULE = 'github.com/synopackageland/syno-pkg-land-sdk';
11
11
  export const EXECUTOR_MODULE = `${SDK_MODULE}/executor`;
@@ -12,7 +12,7 @@ export declare const OPTIONAL_INFO_FIELDS: readonly ["displayname", "maintainer_
12
12
  * shown by Package Center and used by first-party packages; the others are
13
13
  * SDK metadata, including the native layout's declared Portal alias.
14
14
  */
15
- export declare const EXTRA_INFO_FIELDS: readonly ["changelog", "synopkgland_executor_sha256", "synopkgland_portal_alias", "spk_land_metadata"];
15
+ export declare const EXTRA_INFO_FIELDS: readonly ["changelog", "synopkgland_executor_sha256", "synopkgland_portal_alias", "spk_land_metadata", "synopkgland_container_sudo"];
16
16
  /** Optional fields whose value is "yes" or "no". */
17
17
  export declare const BOOLEAN_INFO_FIELDS: readonly ["support_center", "checkport", "startable", "ctl_stop", "ctl_uninstall", "precheckstartstop", "beta", "install_reboot", "support_conf_folder", "silent_install", "silent_upgrade", "silent_uninstall", "offline_install", "thirdparty", "support_move", "use_deprecated_replace_mechanism", "install_on_cold_storage"];
18
18
  /** Language codes of `displayname_<lang>` and `description_<lang>`. */
@@ -22,7 +22,7 @@ export const OPTIONAL_INFO_FIELDS = [
22
22
  * shown by Package Center and used by first-party packages; the others are
23
23
  * SDK metadata, including the native layout's declared Portal alias.
24
24
  */
25
- export const EXTRA_INFO_FIELDS = ["changelog", "synopkgland_executor_sha256", "synopkgland_portal_alias", "spk_land_metadata"];
25
+ export const EXTRA_INFO_FIELDS = ["changelog", "synopkgland_executor_sha256", "synopkgland_portal_alias", "spk_land_metadata", "synopkgland_container_sudo"];
26
26
  /** Optional fields whose value is "yes" or "no". */
27
27
  export const BOOLEAN_INFO_FIELDS = [
28
28
  "support_center", "checkport", "startable", "ctl_stop", "ctl_uninstall", "precheckstartstop", "beta",
@@ -25,15 +25,40 @@ export const COMPOSE_ERRORS = {
25
25
  description: "Container readiness exhausted its declared startup budget.",
26
26
  suggestion: "Inspect the safe phase code in daemon/daemon.log and upstream migration/bootstrap health. Declare a sufficient bounded startup_timeout_seconds and rebuild; keep ingress closed until ready.",
27
27
  },
28
+ COMPOSE_TMPFS_UNDECLARED: {
29
+ code: "COMPOSE_TMPFS_UNDECLARED",
30
+ description: "A Compose service mounts a memory tmpfs that the package did not declare.",
31
+ suggestion: "Put temporary files on disk: declare compose.services.<service>.scratch: [<target>] and set TMPDIR to it if the App reads it. Use compose.services.<service>.tmpfs only for small memory data; the SDK bounds it to 64 MiB unless you give a size.",
32
+ },
33
+ COMPOSE_TMPFS_UNBOUNDED: {
34
+ code: "COMPOSE_TMPFS_UNBOUNDED",
35
+ description: "A tmpfs size of 0 means unlimited memory.",
36
+ suggestion: "Omit size for the SDK default of 64 MiB, or give a positive size such as 16m. Use disk scratch for larger temporary data.",
37
+ },
38
+ COMPOSE_TMPFS_INVALID: {
39
+ code: "COMPOSE_TMPFS_INVALID",
40
+ description: "The tmpfs or scratch declaration is malformed, duplicated or conflicts with another mount.",
41
+ suggestion: "Declare each clean absolute container target once, outside /synopkgland, as either scratch or tmpfs (at most 8 scratch and 16 tmpfs targets per service).",
42
+ },
43
+ COMPOSE_SCRATCH_INVALID: {
44
+ code: "COMPOSE_SCRATCH_INVALID",
45
+ description: "The disk scratch declaration is invalid.",
46
+ suggestion: "Declare clean absolute targets that no volume, Share or package data already uses; a Compose tmpfs at the same target is replaced. Keep the service nonroot and declare explicit entrypoint/command argv so the SDK can empty scratch before the App starts.",
47
+ },
48
+ COMPOSE_SCRATCH_NOT_READY: {
49
+ code: "COMPOSE_SCRATCH_NOT_READY",
50
+ description: "The disk scratch directory is missing, not owned by the package UID, or not writable.",
51
+ suggestion: "Reinstall or upgrade with the matching SDK so preinst creates scratch as the package account; inspect free space and quota. Do not add root or chown hooks.",
52
+ },
28
53
  COMPOSE_STORAGE_INIT_INVALID: {
29
54
  code: "COMPOSE_STORAGE_INIT_INVALID",
30
55
  description: "The container storage initialization declaration is invalid.",
31
- suggestion: "Declare private subdirectories on writable mounts and explicit upstream entrypoint/command argv; keep the service nonroot. The SDK initializer is supplied by the SPK.",
56
+ suggestion: "Declare subdirectories on writable mounts (package storage or a read/write Shared Folder), or only runtime environment, with explicit upstream entrypoint/command argv; keep the service nonroot. Runtime files stay on package storage. The SDK initializer is supplied by the SPK.",
32
57
  },
33
58
  COMPOSE_STORAGE_NOT_WRITABLE: {
34
59
  code: "COMPOSE_STORAGE_NOT_WRITABLE",
35
60
  description: "The package UID cannot initialize or write its private container data.",
36
- suggestion: "Use a writable mount base with a package-owned private subtree; inspect ownership, permissions, read-only storage, quota and free space. Do not add root or chown hooks.",
61
+ suggestion: "Use a writable mount base with a package-owned private subtree, or a Shared Folder that DSM grants read/write to the package; inspect ownership, permissions, read-only storage, quota and free space. Do not add root or chown hooks.",
37
62
  },
38
63
  COMPOSE_STORAGE_COMMAND_INVALID: {
39
64
  code: "COMPOSE_STORAGE_COMMAND_INVALID",
@@ -205,6 +230,21 @@ export const COMPOSE_ERRORS = {
205
230
  description: "Container-root service the declared value cannot bind host files or Shares.",
206
231
  suggestion: "Use the package identity; container-root requires explicit reason, bridge and no host bind. Never elevate the App on the host.",
207
232
  },
233
+ COMPOSE_SUDO_INVALID: {
234
+ code: "COMPOSE_SUDO_INVALID",
235
+ description: "The sudo opt-in of a console service is invalid.",
236
+ suggestion: "Use run_as: {mode: package, sudo: {reason: <one line>}} with console, bridge networking, no run_as.capabilities, no GPU and scratch outside /tmp.",
237
+ },
238
+ COMPOSE_CONSOLE_INVALID: {
239
+ code: "COMPOSE_CONSOLE_INVALID",
240
+ description: "The console container init declaration is invalid.",
241
+ suggestion: "Give console.home at or below a writable mount, an explicit entrypoint, the package identity, and tmp at or below a scratch target.",
242
+ },
243
+ COMPOSE_CONSOLE_SUDO_UNAVAILABLE: {
244
+ code: "COMPOSE_CONSOLE_SUDO_UNAVAILABLE",
245
+ description: "The image does not meet the sudo contract.",
246
+ suggestion: "Install setuid sudo, add a NOPASSWD sudoers rule for console.user and let the package UID append /etc/passwd and /etc/group; or remove run_as.sudo.",
247
+ },
208
248
  COMPOSE_ROOT_OPT_IN_INVALID: {
209
249
  code: "COMPOSE_ROOT_OPT_IN_INVALID",
210
250
  description: "Container root needs a reason and bridge networking.",
@@ -42,14 +42,32 @@ export interface ComposePlan {
42
42
  acceptance_blockers: string[];
43
43
  services: Array<{
44
44
  storage_init?: {
45
- directories: Array<{
45
+ directories?: Array<{
46
46
  base: string;
47
47
  path: string;
48
+ share?: boolean;
48
49
  }>;
50
+ scratch?: string[];
49
51
  };
52
+ scratch?: string[];
53
+ tmpfs?: Array<{
54
+ target: string;
55
+ bytes: number;
56
+ }>;
50
57
  service: string;
51
58
  user: string;
52
59
  container_root: boolean;
60
+ /** SDK container init for interactive console services. */
61
+ console?: {
62
+ home: string;
63
+ user?: string;
64
+ tmp?: string;
65
+ };
66
+ /** Explicit per-command sudo inside the container, with its reason. */
67
+ sudo?: {
68
+ reason: string;
69
+ };
70
+ cap_add?: string[] | null;
53
71
  egress: string;
54
72
  network: string;
55
73
  mounts: unknown[] | null;
@@ -145,6 +163,15 @@ export declare function writeComposePayload(c: ComposeApp, root: string, target:
145
163
  export declare function renderComposeInstall(pkg: string): string;
146
164
  /** The same SDK entry point supplies the package-account install materializer. */
147
165
  export declare function buildComposeControl(m: StandaloneManifest, arch: NativeArchFamily, work: string, run: import("./build.js").CommandRunner): Promise<string | undefined>;
166
+ /** The SDK binary serves storage_init and the console container init. */
167
+ export declare const usesStorageInit: (s: ComposePlan["services"][number]) => boolean;
168
+ /** INFO key listing sudo services and reasons, as JSON, for catalogs. */
169
+ export declare const CONTAINER_SUDO_INFO = "synopkgland_container_sudo";
170
+ /** Services that may run single commands as container root through sudo. */
171
+ export declare function containerSudo(plan: ComposePlan): Array<{
172
+ service: string;
173
+ reason: string;
174
+ }>;
148
175
  /** The SPK supplies this read-only binary; upstream registry images stay unchanged. */
149
176
  export declare function buildComposeStorageInit(m: StandaloneManifest, arch: NativeArchFamily, work: string, run: import("./build.js").CommandRunner): Promise<string | undefined>;
150
177
  /** Only the build resolves registry metadata; check and inspect remain offline. */
@@ -113,6 +113,16 @@ export function readComposeApp(value, root, arches, fail, context = {}) {
113
113
  if (major === 0 && (minor < 53 || minor === 53 && patch < minimumPatch))
114
114
  return invalid(`Folder selection requires SDK 0.53.${minimumPatch} or later.`, 'SDK_COMPOSE_UNSUPPORTED');
115
115
  }
116
+ if (record(value.services) && Object.values(value.services).some((s) => record(s) && (s.scratch !== undefined || s.tmpfs !== undefined))) {
117
+ const [major, minor, patch] = sdk.split('.').map(Number);
118
+ if (major === 0 && (minor < 53 || minor === 53 && patch < 25))
119
+ return invalid('Disk scratch and declared tmpfs require SDK 0.53.25 or later.', 'SDK_COMPOSE_UNSUPPORTED');
120
+ }
121
+ if (record(value.services) && Object.values(value.services).some((s) => record(s) && (s.console !== undefined || (record(s.run_as) && s.run_as.sudo !== undefined)))) {
122
+ const [major, minor, patch] = sdk.split('.').map(Number);
123
+ if (major === 0 && (minor < 53 || minor === 53 && patch < 26))
124
+ return invalid('The console container init and run_as.sudo require SDK 0.53.26 or later.', 'SDK_COMPOSE_UNSUPPORTED');
125
+ }
116
126
  let targets = {};
117
127
  if (value.helpers !== undefined) {
118
128
  const d = readDaemon({ exec: "_sso/gateway", targets: value.helpers }, root, arches, fail, context.package);
@@ -261,9 +271,19 @@ export async function buildComposeControl(m, arch, work, run) {
261
271
  return;
262
272
  return buildComposeTool(m, arch, work, run, "plan");
263
273
  }
274
+ /** The SDK binary serves storage_init and the console container init. */
275
+ export const usesStorageInit = (s) => !!s.storage_init || !!s.console;
276
+ /** INFO key listing sudo services and reasons, as JSON, for catalogs. */
277
+ export const CONTAINER_SUDO_INFO = "synopkgland_container_sudo";
278
+ /** Services that may run single commands as container root through sudo. */
279
+ export function containerSudo(plan) {
280
+ return plan.services
281
+ .filter((s) => s.sudo)
282
+ .map((s) => ({ service: s.service, reason: s.sudo.reason }));
283
+ }
264
284
  /** The SPK supplies this read-only binary; upstream registry images stay unchanged. */
265
285
  export async function buildComposeStorageInit(m, arch, work, run) {
266
- if (!m.compose?.plan.services.some((s) => s.storage_init))
286
+ if (!m.compose?.plan.services.some(usesStorageInit))
267
287
  return;
268
288
  return buildComposeTool(m, arch, work, run, "storage-init");
269
289
  }
@@ -21,6 +21,8 @@ export interface SpkInspection {
21
21
  dependencies?: PackageDependencies;
22
22
  installSettings?: InstallSettings;
23
23
  minMemoryMb?: number;
24
+ /** `install.recommended_memory_mb`: the non-blocking install wizard warning threshold. */
25
+ recommendedMemoryMb?: number;
24
26
  /** Hyper Backup application backup, as sdk-package.json records it. */
25
27
  hyperBackup?: HyperBackup;
26
28
  identityGateway?: GatewayAdmissionReport;
@@ -47,6 +49,11 @@ export interface SpkInspection {
47
49
  compose?: {
48
50
  projectName?: string;
49
51
  hostUdp?: ComposeApp["plan"]["host_udp"];
52
+ /** Services that run single commands as container root through sudo. */
53
+ containerSudo?: Array<{
54
+ service: string;
55
+ reason: string;
56
+ }>;
50
57
  devices?: ComposeApp["plan"]["devices"];
51
58
  ingress?: ComposeApp["plan"]["ingress"];
52
59
  images: unknown[];
@@ -6,7 +6,7 @@ import { DAEMON_NOFILE_UNSUPPORTED, DAEMON_NOFILE_ACTIVATION_PROBLEM, readNoFile
6
6
  import { gatewayIngressPathProblem, gatewayIngressOwnershipSupported } from './gateway-ingress.js';
7
7
  import { renderGatewayIngressCheck } from './native-gateway.js';
8
8
  import { portDefaults, portInstallSteps } from "./install-ports.js";
9
- import { readMinMemoryMb, renderMemoryHook } from "./install-memory.js";
9
+ import { readMemoryAdviceRecord, readMinMemoryMb, renderMemoryHook } from "./install-memory.js";
10
10
  import { inspectPackageDependencies, dependencyInfo } from "./package-dependencies.js";
11
11
  import { readInstallSettings, settingsInstallSteps, settingsConfig, renderSettingsHook, renderNativeFolderHook, nativeFolderConfig } from './install-settings.js';
12
12
  import { MODULE_UI_ENTRY, uiTreeDigest } from "./ui-assets.js";
@@ -19,7 +19,7 @@ import { inspectCtlArtifacts } from './native-http-inspect.js';
19
19
  import { dsmLauncherType } from "../contract/app-launch.js";
20
20
  import { isWebLaunchMode, resolvedWebLaunch, trustedAppEntryPath, usesAuthGateway, } from "../contract/web-launch.js";
21
21
  import { loadContract } from "../contract/load.js";
22
- import { readComposeApp, composeSource, dsmComposeProblem, COMPOSE_READINESS_LIMITATION, COMPOSE_HOST_READINESS_LIMITATION, } from "./compose.js";
22
+ import { readComposeApp, usesStorageInit, containerSudo, CONTAINER_SUDO_INFO, composeSource, dsmComposeProblem, COMPOSE_READINESS_LIMITATION, COMPOSE_HOST_READINESS_LIMITATION, } from "./compose.js";
23
23
  import { gatewayReviewReport } from "./gateway-review.js";
24
24
  import { createHash } from "node:crypto";
25
25
  import { inspectNativeLayout } from "./native-layout.js";
@@ -189,6 +189,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
189
189
  const { identityGateway, gateway } = await inspectGatewayAdmission(dir, paths, metadata.provider_only_oidc, findings);
190
190
  await inspectExternalGateway(dir, paths, payload, metadata.gateway_external, findings);
191
191
  const minMemoryMb = inspectMemoryRequirement(dir, metadata.minMemoryMb, findings);
192
+ const memoryAdvice = readMemoryAdviceRecord(metadata.recommendedMemory, minMemoryMb, e => findings.push(`${e.code} ${e.message}`));
192
193
  const installSettings = await inspectInstallSettings(dir, payload, metadata, findings);
193
194
  const hyperBackup = metadataText === undefined ? undefined : await inspectHyperBackup(dir, async () => {
194
195
  const root = join(dir, "backup-inspection");
@@ -202,7 +203,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
202
203
  const integrations = metadata.integrations ?? [];
203
204
  await inspectCtlArtifacts(dir, paths, metadata.ctl, metadata.entry, findings);
204
205
  if (metadata.compose !== undefined) {
205
- const result = await inspectUnifiedCompose(dir, payload, { ...metadata, installSettings, minMemoryMb }, findings, options.baseline);
206
+ const result = await inspectUnifiedCompose(dir, payload, { ...metadata, installSettings, minMemoryMb, memoryAdvice }, findings, options.baseline);
206
207
  if (dependencies) {
207
208
  result.dependencies = dependencies;
208
209
  }
@@ -210,6 +211,8 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
210
211
  result.installSettings = installSettings;
211
212
  if (minMemoryMb !== undefined)
212
213
  result.minMemoryMb = minMemoryMb;
214
+ if (memoryAdvice)
215
+ result.recommendedMemoryMb = memoryAdvice.mb;
213
216
  if (hyperBackup)
214
217
  result.hyperBackup = hyperBackup;
215
218
  if (identityGateway)
@@ -351,7 +354,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
351
354
  ? await inspectLoginStyle(dir, info.package, Boolean(portal || executor?.policy.portal), findings)
352
355
  : undefined;
353
356
  if (standalone)
354
- checkSharedFolder(dir, findings, info.package, sharedFolder, executor?.policy.scope === "install-selected", portal, hasExecutor, nativeGateway, info.os_min_ver, installSettings, integrations, metadata.installPorts, minMemoryMb, options.baseline);
357
+ checkSharedFolder(dir, findings, info.package, sharedFolder, executor?.policy.scope === "install-selected", portal, hasExecutor, nativeGateway, info.os_min_ver, installSettings, integrations, metadata.installPorts, minMemoryMb, memoryAdvice, options.baseline);
355
358
  const icon = inspectPackageIcons(dir, findings);
356
359
  const cgiEntry = payload.find((entry) => entry.path === CGI_PAYLOAD_PATH);
357
360
  if (standalone && !cgiEntry) {
@@ -369,6 +372,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
369
372
  ...(gateway ? { gateway } : {}),
370
373
  ...(installSettings ? { installSettings } : {}),
371
374
  ...(minMemoryMb !== undefined ? { minMemoryMb } : {}),
375
+ ...(memoryAdvice ? { recommendedMemoryMb: memoryAdvice.mb } : {}),
372
376
  ...(hyperBackup ? { hyperBackup } : {}),
373
377
  ...(launch ? { launch } : {}),
374
378
  icon,
@@ -860,8 +864,8 @@ async function inspectUnifiedCompose(dir, payload, metadata, findings, baseline
860
864
  throw new Error("gateway configuration differs from the declared package contract");
861
865
  if (readOptional(join(dir, "conf/privilege")) !== renderNativePrivilege())
862
866
  throw new Error("Compose hooks must run as the package account");
863
- if (!baseline && (manifest.sharedFolder || metadata.installSettings || metadata.installPorts || metadata.minMemoryMb !== undefined)) {
864
- for (const [name, text] of Object.entries(expectedWizardFiles(info.package, manifest.sharedFolder, false, undefined, metadata.installSettings, [], manifest.identityGateway?.listen.https, metadata.installPorts, metadata.minMemoryMb)))
867
+ if (!baseline && (manifest.sharedFolder || metadata.installSettings || metadata.installPorts || metadata.minMemoryMb !== undefined || metadata.memoryAdvice)) {
868
+ for (const [name, text] of Object.entries(expectedWizardFiles(info.package, manifest.sharedFolder, false, undefined, metadata.installSettings, [], manifest.identityGateway?.listen.https, metadata.installPorts, metadata.minMemoryMb, metadata.memoryAdvice)))
865
869
  if (readOptional(join(dir, "WIZARD_UIFILES", name)) !== text)
866
870
  throw new Error(`unexpected WIZARD_UIFILES/${name}; native share selection must match the declaration`);
867
871
  }
@@ -906,7 +910,7 @@ async function inspectUnifiedCompose(dir, payload, metadata, findings, baseline
906
910
  if (payload.find((p) => p.path === "compose/control")?.mode !== "0755")
907
911
  throw new Error("Compose materializer must be executable");
908
912
  const initializer = join(root, "compose/storage-init");
909
- if (c.plan.services.some((s) => s.storage_init)) {
913
+ if (c.plan.services.some(usesStorageInit)) {
910
914
  const error = checkCgiBinary(root, initializer, arch);
911
915
  if (error)
912
916
  throw new Error(error.message);
@@ -933,12 +937,18 @@ async function inspectUnifiedCompose(dir, payload, metadata, findings, baseline
933
937
  throw new Error("daemon configuration differs from the SDK profile");
934
938
  if (!isDsmAtLeast(info.os_min_ver, CONTAINER_MIN_DSM))
935
939
  throw new Error("Compose requires DSM >= 7.2.1");
940
+ // Catalogs read sudo services from INFO; it must state exactly the plan.
941
+ const sudoInfo = info[CONTAINER_SUDO_INFO]?.replace(/\\([\\"$`])/g, "$1");
942
+ const sudo = containerSudo(c.plan);
943
+ if ((sudo.length ? JSON.stringify(sudo) : undefined) !== sudoInfo)
944
+ throw new Error(`INFO ${CONTAINER_SUDO_INFO} differs from the Compose plan`);
936
945
  const storageProblem = dsmComposeProblem(c);
937
946
  if (storageProblem)
938
947
  throw new Error(`[${storageProblem.code}] ${storageProblem.message}`);
939
948
  base.compose = {
940
949
  projectName: c.plan.project_name,
941
950
  ...(c.plan.host_udp?.length ? { hostUdp: c.plan.host_udp } : {}),
951
+ ...(containerSudo(c.plan).length ? { containerSudo: containerSudo(c.plan) } : {}),
942
952
  ...(c.plan.devices ? { devices: c.plan.devices } : {}),
943
953
  ...(c.plan.ingress ? { ingress: c.plan.ingress } : {}),
944
954
  images: c.plan.images,
@@ -1516,7 +1526,7 @@ function checkBackground(dir, info, payload, findings, executor, daemon, bridge
1516
1526
  * declaration (without one, any present file must be the default native
1517
1527
  * install wizard), and no other install/upgrade wizard file may exist.
1518
1528
  */
1519
- function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal, executor = false, nativeGateway, osMinVer, installSettings, integrations = [], installPortDefinitions = {}, minMemoryMb, baseline = false) {
1529
+ function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal, executor = false, nativeGateway, osMinVer, installSettings, integrations = [], installPortDefinitions = {}, minMemoryMb, memoryAdvice, baseline = false) {
1520
1530
  const wizardDir = join(dir, "WIZARD_UIFILES");
1521
1531
  const present = (existsSync(wizardDir) ? readdirSync(wizardDir) : [])
1522
1532
  .filter((name) => /^(install|upgrade)_uifile(_|\.|$)/.test(name))
@@ -1543,7 +1553,7 @@ function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal,
1543
1553
  : {}),
1544
1554
  ...portalManifest(portal),
1545
1555
  };
1546
- const wizards = expectedWizardFiles(pkg, folder, selected, portal, installSettings, integrations, nativeGateway?.listen.https, installPortDefinitions, minMemoryMb);
1556
+ const wizards = expectedWizardFiles(pkg, folder, selected, portal, installSettings, integrations, nativeGateway?.listen.https, installPortDefinitions, minMemoryMb, memoryAdvice);
1547
1557
  const source = selected
1548
1558
  ? "the install-selected policy"
1549
1559
  : folder
@@ -1554,7 +1564,7 @@ function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal,
1554
1564
  ? "the integrations declaration"
1555
1565
  : "the native-go default install wizard";
1556
1566
  // The default native wizard is optional; a declared shared folder or portal needs all of its files.
1557
- for (const name of baseline ? [] : folder || selected || portal || installSettings || Object.keys(installPortDefinitions).length || integrations.length || minMemoryMb !== undefined
1567
+ for (const name of baseline ? [] : folder || selected || portal || installSettings || Object.keys(installPortDefinitions).length || integrations.length || minMemoryMb !== undefined || memoryAdvice
1558
1568
  ? Object.keys(wizards)
1559
1569
  : present.filter((n) => n in wizards)) {
1560
1570
  if (readOptional(join(wizardDir, name)) !== wizards[name])
@@ -1662,7 +1672,7 @@ async function inspectInstallSettings(dir, payload, metadata, findings) {
1662
1672
  }
1663
1673
  return settings;
1664
1674
  }
1665
- function expectedWizardFiles(pkg, folder, selected = false, portal, installSettings, integrations = [], settingsPort = 0, installPortDefinitions = {}, minMemoryMb) {
1675
+ function expectedWizardFiles(pkg, folder, selected = false, portal, installSettings, integrations = [], settingsPort = 0, installPortDefinitions = {}, minMemoryMb, memoryAdvice) {
1666
1676
  const steps = selected
1667
1677
  ? (t) => [
1668
1678
  ...renderDelegateScopeSteps(t),
@@ -1671,7 +1681,7 @@ function expectedWizardFiles(pkg, folder, selected = false, portal, installSetti
1671
1681
  : folder
1672
1682
  ? sharedFolderInstallSteps(pkg, folder)
1673
1683
  : renderNativeInstallWizard;
1674
- const install = renderInstallWizardFiles(pkg, t => [...steps(t), ...portInstallSteps({ package: pkg, ...(Object.keys(installPortDefinitions).length ? { installPorts: true } : {}) }, installPortDefinitions)(t), ...settingsInstallSteps(installSettings, settingsPort, Object.keys(installPortDefinitions).length ? pkg : undefined)(t), ...(portal ? [renderPortalWizardStep(t, portal.alias)] : []), ...integrationWizardSteps(t, integrations)], minMemoryMb);
1684
+ const install = renderInstallWizardFiles(pkg, t => [...steps(t), ...portInstallSteps({ package: pkg, ...(Object.keys(installPortDefinitions).length ? { installPorts: true } : {}) }, installPortDefinitions)(t), ...settingsInstallSteps(installSettings, settingsPort, Object.keys(installPortDefinitions).length ? pkg : undefined)(t), ...(portal ? [renderPortalWizardStep(t, portal.alias)] : []), ...integrationWizardSteps(t, integrations)], minMemoryMb, memoryAdvice);
1675
1685
  return folderPickerWizardFiles(pkg, folder, {
1676
1686
  ...install.static,
1677
1687
  ...install.dynamic,
@@ -1,9 +1,32 @@
1
1
  import type { StandaloneError } from "./manifest.js";
2
- import { type Locale } from "./i18n.js";
2
+ import { type Catalogs, type Locale } from "./i18n.js";
3
3
  /** MiB of physical MemTotal, not free/available memory or a model allowlist. */
4
4
  export declare function readMinMemoryMb(value: unknown, fail: (error: StandaloneError) => void): number | undefined;
5
+ /** The App's optional catalog text shown under the recommended-memory warning. */
6
+ export declare const RECOMMENDED_MEMORY_MESSAGE_KEY = "install.recommended_memory_message";
7
+ /**
8
+ * `install.recommended_memory_mb`: below it the install wizard shows a
9
+ * warning page the administrator can continue past; nothing is enforced.
10
+ * `messages` are the App's own localized text, English as the fallback.
11
+ */
12
+ export interface MemoryAdvice {
13
+ mb: number;
14
+ messages?: {
15
+ en: string;
16
+ } & Partial<Record<Locale, string>>;
17
+ }
18
+ /** MiB of physical MemTotal, above `install.min_memory_mb` when both are declared. */
19
+ export declare function readRecommendedMemoryMb(value: unknown, minMemoryMb: number | undefined, fail: (error: StandaloneError) => void): number | undefined;
20
+ /** The App message from its catalogs (or a packaged record); undefined when absent, null after reporting. */
21
+ export declare function readMemoryAdviceMessages(catalogs: Partial<Record<string, Record<string, unknown>>> | undefined, fail: (error: StandaloneError) => void): MemoryAdvice["messages"] | undefined | null;
22
+ /** Reads `install.recommended_memory_mb` with the App message from its catalogs. */
23
+ export declare function readMemoryAdvice(value: unknown, minMemoryMb: number | undefined, catalogs: Catalogs | undefined, fail: (error: StandaloneError) => void): MemoryAdvice | undefined;
24
+ /** The `sdk-package.json` record read back for inspect; undefined after reporting. */
25
+ export declare function readMemoryAdviceRecord(value: unknown, minMemoryMb: number | undefined, fail: (error: StandaloneError) => void): MemoryAdvice | undefined;
5
26
  /** Shared by wizard and preinst. A missing, malformed or unreadable read allows installation. */
6
- export declare function renderMemoryProbe(minMemoryMb: number): string;
27
+ export declare function renderMemoryProbe(minMemoryMb: number | undefined, recommendedMemoryMb?: number): string;
28
+ /** The SDK warning, then the App's own text in the same language when it has one. */
29
+ export declare function memoryAdviceTexts(advice: MemoryAdvice, locale: Locale, actual: string): string[];
7
30
  export declare function memoryReason(minMemoryMb: number, locale: Locale, actual: string): string;
8
31
  /** Runs in preinst for both install and upgrade, before other SDK or App work, as the package account. */
9
32
  export declare function renderMemoryHook(minMemoryMb?: number): string;
@@ -11,23 +11,107 @@ export function readMinMemoryMb(value, fail) {
11
11
  }
12
12
  return value;
13
13
  }
14
+ /** The App's optional catalog text shown under the recommended-memory warning. */
15
+ export const RECOMMENDED_MEMORY_MESSAGE_KEY = "install.recommended_memory_message";
16
+ const invalidRecommendation = (message) => ({ code: "INSTALL_RECOMMENDED_MEMORY_INVALID", message });
17
+ /** MiB of physical MemTotal, above `install.min_memory_mb` when both are declared. */
18
+ export function readRecommendedMemoryMb(value, minMemoryMb, fail) {
19
+ if (value === undefined)
20
+ return undefined;
21
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1 || value > 2147483647) {
22
+ fail(invalidRecommendation("install.recommended_memory_mb must be a positive integer in MiB, at most 2147483647"));
23
+ return undefined;
24
+ }
25
+ if (minMemoryMb !== undefined && value <= minMemoryMb) {
26
+ fail(invalidRecommendation("install.recommended_memory_mb must be greater than install.min_memory_mb"));
27
+ return undefined;
28
+ }
29
+ return value;
30
+ }
31
+ /** Plain single-line wizard text: DSM renders `desc` as markup, so no tags or entities. */
32
+ function adviceText(text) {
33
+ return typeof text === "string" && text.trim() !== "" && text.length <= 300 && !/[\x00-\x1f\x7f<>&]/.test(text);
34
+ }
35
+ /** The App message from its catalogs (or a packaged record); undefined when absent, null after reporting. */
36
+ export function readMemoryAdviceMessages(catalogs, fail) {
37
+ const found = LOCALES.flatMap(locale => catalogs?.[locale]?.[RECOMMENDED_MEMORY_MESSAGE_KEY] === undefined ? [] : [[locale, catalogs[locale][RECOMMENDED_MEMORY_MESSAGE_KEY]]]);
38
+ if (!found.length)
39
+ return undefined;
40
+ const bad = found.filter(([, text]) => !adviceText(text)).map(([locale]) => locale);
41
+ if (bad.length || !found.some(([locale]) => locale === "en")) {
42
+ fail(invalidRecommendation(`${RECOMMENDED_MEMORY_MESSAGE_KEY} must be plain single-line text (1-300 characters, without <, > or &) with an English text${bad.length ? `; invalid in ${bad.join(", ")}` : ""}`));
43
+ return null;
44
+ }
45
+ return Object.fromEntries(found);
46
+ }
47
+ /** Reads `install.recommended_memory_mb` with the App message from its catalogs. */
48
+ export function readMemoryAdvice(value, minMemoryMb, catalogs, fail) {
49
+ const mb = readRecommendedMemoryMb(value, minMemoryMb, fail);
50
+ if (mb === undefined)
51
+ return undefined;
52
+ const messages = readMemoryAdviceMessages(catalogs, fail);
53
+ if (messages === null)
54
+ return undefined;
55
+ return { mb, ...(messages ? { messages } : {}) };
56
+ }
57
+ /** The `sdk-package.json` record read back for inspect; undefined after reporting. */
58
+ export function readMemoryAdviceRecord(value, minMemoryMb, fail) {
59
+ if (value === undefined)
60
+ return undefined;
61
+ if (typeof value !== "object" || value === null || Array.isArray(value) || Object.keys(value).some(key => key !== "mb" && key !== "messages")) {
62
+ fail(invalidRecommendation("the recommended memory record is malformed"));
63
+ return undefined;
64
+ }
65
+ const record = value;
66
+ const mb = readRecommendedMemoryMb(record.mb, minMemoryMb, fail);
67
+ if (mb === undefined) {
68
+ if (record.mb === undefined)
69
+ fail(invalidRecommendation("the recommended memory record has no threshold"));
70
+ return undefined;
71
+ }
72
+ if (record.messages === undefined)
73
+ return { mb };
74
+ const messages = record.messages;
75
+ if (typeof messages !== "object" || messages === null || Array.isArray(messages) || Object.keys(messages).some(locale => !LOCALES.includes(locale))) {
76
+ fail(invalidRecommendation("the recommended memory messages are malformed"));
77
+ return undefined;
78
+ }
79
+ const read = readMemoryAdviceMessages(Object.fromEntries(Object.entries(messages).map(([locale, text]) => [locale, { [RECOMMENDED_MEMORY_MESSAGE_KEY]: text }])), fail);
80
+ if (read === null)
81
+ return undefined;
82
+ if (read === undefined) {
83
+ fail(invalidRecommendation("the recommended memory messages are empty"));
84
+ return undefined;
85
+ }
86
+ return { mb, messages: read };
87
+ }
14
88
  /** Shared by wizard and preinst. A missing, malformed or unreadable read allows installation. */
15
- export function renderMemoryProbe(minMemoryMb) {
89
+ export function renderMemoryProbe(minMemoryMb, recommendedMemoryMb) {
90
+ const low = minMemoryMb === undefined ? "" : ` if LC_ALL=C awk -v kb="$synopkgland_memory_kb" 'BEGIN { exit !(kb < ${minMemoryMb * 1024}) }'; then
91
+ synopkgland_memory_low=1
92
+ fi
93
+ `;
94
+ const advice = recommendedMemoryMb === undefined ? "" : ` if [ -z "$synopkgland_memory_low" ] && LC_ALL=C awk -v kb="$synopkgland_memory_kb" 'BEGIN { exit !(kb < ${recommendedMemoryMb * 1024}) }'; then
95
+ synopkgland_memory_advice=1
96
+ fi
97
+ `;
16
98
  return `synopkgland_memory_kb=$(LC_ALL=C awk '
17
99
  $1 == "MemTotal:" { count++; if (NF == 3 && $2 ~ /^[0-9]+$/ && $2 > 0 && $3 == "kB") total = $2 }
18
100
  END { if (count == 1 && total > 0) printf "%.0f", total; else exit 1 }
19
101
  ' /proc/meminfo 2>/dev/null) || synopkgland_memory_kb=
20
102
  synopkgland_memory_low=
21
- if [ -n "$synopkgland_memory_kb" ]; then
103
+ ${recommendedMemoryMb === undefined ? "" : "synopkgland_memory_advice=\n"}if [ -n "$synopkgland_memory_kb" ]; then
22
104
  synopkgland_memory_gb=$(LC_ALL=C awk -v kb="$synopkgland_memory_kb" 'BEGIN { printf "%.2f", kb / 1048576 }')
23
- if LC_ALL=C awk -v kb="$synopkgland_memory_kb" 'BEGIN { exit !(kb < ${minMemoryMb * 1024}) }'; then
24
- synopkgland_memory_low=1
25
- fi
26
- else
105
+ ${low}${advice}else
27
106
  printf '%s\\n' '[INSTALL_MEMORY_READ_WARNING] Cannot read physical MemTotal; continuing installation' >&2
28
107
  fi
29
108
  `;
30
109
  }
110
+ /** The SDK warning, then the App's own text in the same language when it has one. */
111
+ export function memoryAdviceTexts(advice, locale, actual) {
112
+ const app = advice.messages?.[locale] ?? advice.messages?.en;
113
+ return [translator(locale)("memory.recommended", { recommended: String(Math.ceil(advice.mb / 1024)), actual }), ...(app ? [app] : [])];
114
+ }
31
115
  export function memoryReason(minMemoryMb, locale, actual) {
32
116
  return translator(locale)("memory.required", { required: String(Math.ceil(minMemoryMb / 1024)), actual });
33
117
  }
@@ -1,6 +1,7 @@
1
1
  import { type NativeTexts } from "./dsm-texts.js";
2
2
  import { type TCPListeners } from "./tcp-listeners.js";
3
3
  import { type MobileDeclaration } from './mobile.js';
4
+ import { type MemoryAdvice } from "./install-memory.js";
4
5
  import { type PackageDependencies } from "./package-dependencies.js";
5
6
  import { type InstallSettings } from './install-settings.js';
6
7
  import { type WebLaunchMode } from "../contract/web-launch.js";
@@ -118,6 +119,8 @@ export interface StandaloneManifest {
118
119
  installPorts?: true;
119
120
  /** `install.min_memory_mb`: minimum physical MemTotal in MiB at install and upgrade. */
120
121
  minMemoryMb?: number;
122
+ /** `install.recommended_memory_mb` and the App message: a non-blocking install wizard warning. */
123
+ memoryAdvice?: MemoryAdvice;
121
124
  /** `backup`: Hyper Backup application backup; on by default for native Apps, absent when opted out. */
122
125
  hyperBackup?: HyperBackup;
123
126
  /** Who may use the app at all; absent keeps the route policy alone. */
@@ -9,7 +9,7 @@ import { readRegistry, registryFile } from '../ctl/registry.js';
9
9
  import { gatewayIngressPathProblem, gatewayIngressOwnershipSupported } from './gateway-ingress.js';
10
10
  import { nativeGatewaySdk } from "./native-gateway.js";
11
11
  import { portDefaults } from "./install-ports.js";
12
- import { readMinMemoryMb } from "./install-memory.js";
12
+ import { readMemoryAdvice, readMinMemoryMb } from "./install-memory.js";
13
13
  import { readPackageDependencies, packageDependencies, dependencyError } from "./package-dependencies.js";
14
14
  import { readInstallSettings } from './install-settings.js';
15
15
  import { auditGoRoutes } from './route-audit.js';
@@ -537,6 +537,7 @@ function readManifest(raw, c) {
537
537
  c.fail(problem.code, problem.message);
538
538
  }
539
539
  const i18n = raw.i18n === undefined ? undefined : readI18n(raw.i18n, c);
540
+ const memoryAdvice = readMemoryAdvice(isRecord(raw.install) ? raw.install.recommended_memory_mb : undefined, minMemoryMb, i18n?.catalogs, e => c.fail(e.code, e.message));
540
541
  const icon = raw.icon === undefined ? undefined : readIcon(raw.icon, c);
541
542
  let mobile;
542
543
  if (raw.mobile !== undefined) {
@@ -691,6 +692,7 @@ function readManifest(raw, c) {
691
692
  ...(installSettings ? { installSettings } : {}),
692
693
  ...(installPorts ? { installPorts } : {}),
693
694
  ...(minMemoryMb !== undefined ? { minMemoryMb } : {}),
695
+ ...(memoryAdvice ? { memoryAdvice } : {}),
694
696
  ...(hyperBackup ? { hyperBackup } : {}),
695
697
  ...(entry ? { entry } : {}),
696
698
  ...(integrations?.length ? { integrations } : {}),
@@ -17,10 +17,10 @@ export function readSharedFolder(value, fail) {
17
17
  fail({ code: "STANDALONE_SHARED_FOLDER_INVALID", message: `install.sharedFolder ${why}` });
18
18
  return undefined;
19
19
  };
20
- if (!isRecord(value) || Object.keys(value).some((key) => !["sharedFolder", "settings", "ports", "min_memory_mb"].includes(key))) {
21
- return refuse(": only sharedFolder, settings, ports and min_memory_mb are allowed.");
20
+ if (!isRecord(value) || Object.keys(value).some((key) => !["sharedFolder", "settings", "ports", "min_memory_mb", "recommended_memory_mb"].includes(key))) {
21
+ return refuse(": only sharedFolder, settings, ports, min_memory_mb and recommended_memory_mb are allowed.");
22
22
  }
23
- if (value.sharedFolder === undefined && (value.settings !== undefined || value.ports !== undefined || value.min_memory_mb !== undefined))
23
+ if (value.sharedFolder === undefined && (value.settings !== undefined || value.ports !== undefined || value.min_memory_mb !== undefined || value.recommended_memory_mb !== undefined))
24
24
  return undefined;
25
25
  const folder = value.sharedFolder;
26
26
  if (!isRecord(folder) || Object.keys(folder).some((key) => !FIELDS.has(key))) {
@@ -39,7 +39,7 @@ import { copyStandaloneNotices, copyNoticeTree } from "../build-spk/notices.js";
39
39
  import { copyAppTree } from "./bridge-app.js";
40
40
  import { isBridgeBackend } from "./bridge-backend.js";
41
41
  import { hostScriptName, renderHostAdapterScript } from "./host-adapter.js";
42
- import { writeComposePayload } from "./compose.js";
42
+ import { CONTAINER_SUDO_INFO, containerSudo, usesStorageInit, writeComposePayload } from "./compose.js";
43
43
  import { daemonConfig, copyDaemonPayload, daemonSdkVersion } from "./daemon.js";
44
44
  import { DAEMON_INGRESS_CONFIG, renderDaemonIngressConfig } from "./daemon-ingress.js";
45
45
  import { gatewayCgiPaths, gatewayExternalAccess, GATEWAY_CONFIG_PATH, GATEWAY_EXEC, identityGatewayConfig, identityGatewayDeclaration, } from "./identity-gateway.js";
@@ -237,7 +237,7 @@ export async function assembleStandaloneSpk(options) {
237
237
  throw new StandaloneBuildError("SDK_COMPOSE_BUILD_FAILED", "Compose runtime artifact required.");
238
238
  copyFileSync(options.composeControl, join(target, "control"));
239
239
  chmodSync(join(target, "control"), EXEC_MODE);
240
- if (manifest.compose.plan.services.some((s) => s.storage_init)) {
240
+ if (manifest.compose.plan.services.some(usesStorageInit)) {
241
241
  if (!options.composeStorageInit)
242
242
  throw new StandaloneBuildError("SDK_COMPOSE_BUILD_FAILED", "Compose storage initializer required.");
243
243
  copyFileSync(options.composeStorageInit, join(target, "storage-init"));
@@ -307,6 +307,7 @@ export async function assembleStandaloneSpk(options) {
307
307
  ...(manifest.installSettings ? { installSettings: manifest.installSettings } : {}),
308
308
  ...(manifest.installPorts ? { installPorts: portDefaults(manifest) } : {}),
309
309
  ...(manifest.minMemoryMb !== undefined ? { minMemoryMb: manifest.minMemoryMb } : {}),
310
+ ...(manifest.memoryAdvice ? { recommendedMemory: manifest.memoryAdvice } : {}),
310
311
  ...(backup ? { hyperBackup: backupRecord(backup) } : {}),
311
312
  ...(manifest.integrations ? { integrations: manifest.integrations } : {}),
312
313
  ...(manifest.lifecycleTimeouts ? { lifecycleTimeouts: manifest.lifecycleTimeouts } : {}),
@@ -378,7 +379,7 @@ export async function assembleStandaloneSpk(options) {
378
379
  : folder
379
380
  ? sharedFolderInstallSteps(manifest.package, folder)
380
381
  : renderNativeInstallWizard;
381
- const install = renderInstallWizardFiles(manifest.package, (t) => [...steps(t), ...portInstallSteps(manifest)(t), ...settingsInstallSteps(manifest.installSettings, manifest.identityGateway?.listen.https, manifest.installPorts ? manifest.package : undefined)(t), ...(portal ? [renderPortalWizardStep(t, portal.alias)] : []), ...integrationWizardSteps(t, manifest.integrations)], manifest.minMemoryMb);
382
+ const install = renderInstallWizardFiles(manifest.package, (t) => [...steps(t), ...portInstallSteps(manifest)(t), ...settingsInstallSteps(manifest.installSettings, manifest.identityGateway?.listen.https, manifest.installPorts ? manifest.package : undefined)(t), ...(portal ? [renderPortalWizardStep(t, portal.alias)] : []), ...integrationWizardSteps(t, manifest.integrations)], manifest.minMemoryMb, manifest.memoryAdvice);
382
383
  writeWizardUiFiles(staging, {
383
384
  ...folderPickerWizardFiles(manifest.package, folder, {
384
385
  ...install.static,
@@ -462,6 +463,10 @@ export function renderInfo(manifest, arch, checksum, executorDigest) {
462
463
  if (dependencies)
463
464
  fields.push(["install_dep_packages", dependencies]);
464
465
  fields.push(...metadataInfoFields(manifest.metadata));
466
+ // Catalog-facing: services that run single commands as container root via sudo.
467
+ const sudo = manifest.compose ? containerSudo(manifest.compose.plan) : [];
468
+ if (sudo.length)
469
+ fields.push([CONTAINER_SUDO_INFO, JSON.stringify(sudo)]);
465
470
  // Background packages need prestart: it runs before DSM's systemd-user-unit acquire.
466
471
  if (manifest.daemon || manifest.compose || manifest.capabilities.jobs)
467
472
  fields.push(["precheckstartstop", "yes"]);
@@ -1,4 +1,4 @@
1
- # Minimum physical memory
1
+ # Minimum and recommended physical memory
2
2
 
3
3
  Declare a physical RAM requirement in `dsm-package.yaml`:
4
4
 
@@ -18,3 +18,31 @@ The generated **package-account preinst** checks the same threshold before other
18
18
  An unreadable, missing or malformed MemTotal emits `INSTALL_MEMORY_READ_WARNING` to stderr and **allows installation**. This requirement stops clearly undersized machines; it does not reject an unfamiliar memory-reporting environment. Omitting the field preserves the existing installation behavior. `synopkgland inspect <spk> --json` reports `minMemoryMb` and verifies the generated memory check and wizard files against the packaged declaration.
19
19
 
20
20
  See Synology's [wizard contract](https://help.synology.com/developer-guide/synology_package/wizard/WIZARD_UIFILES_v2.html) for dynamic wizard scripts and the `SYNOPKG_TEMP_LOGFILE` output channel.
21
+
22
+ ## Recommended memory
23
+
24
+ Declare a softer threshold with `recommended_memory_mb`, either alone or above `min_memory_mb`:
25
+
26
+ ```yaml
27
+ install:
28
+ min_memory_mb: 1700
29
+ recommended_memory_mb: 3400
30
+ ```
31
+
32
+ `recommended_memory_mb` is also a positive integer in **MiB** of MemTotal (1–2147483647), and it must be greater than `min_memory_mb` when both are declared. It never blocks anything: below it the dynamic **install** wizard adds a warning page before its usual pages, without a validator, so the administrator can continue. The page states the recommendation (rounded up to a whole GB, as for the minimum) and the NAS's detected capacity with two decimals, both in DSM's 1024-based GB. Below `min_memory_mb` the blocking memory page is shown instead; at or above the recommendation, or when MemTotal is unreadable, the wizard is unchanged.
33
+
34
+ Upgrade wizards, preinst, CLI installations and silent upgrades do not check the recommendation and cannot fail on it. Static fallback wizards cannot know the NAS memory and show no warning.
35
+
36
+ Pick the value with the same allowance for firmware and kernel reservations as the minimum: MemTotal is below the nominal size (a 2 GB model reports about 1.75 GB, a 4 GB model about 3.7–3.8 GB). Use about **85% of the nominal capacity** that should not see the warning: **3400 MiB means 4 GB machines and larger install without a warning**, while 2 GB and 3 GB machines see it. 4096 MiB would warn on every real 4 GB NAS.
37
+
38
+ ### App message
39
+
40
+ The warning page can show the App's own text under the SDK's sentence, for example where to run heavy work instead. Put it in the App's message catalogs (`i18n.messages`) under the key `install.recommended_memory_message`:
41
+
42
+ ```json
43
+ { "install.recommended_memory_message": "Run heavy jobs on another computer instead" }
44
+ ```
45
+
46
+ Each language uses its catalog's text, and languages without one use English. The text is plain single-line text of 1–300 characters, without `<`, `>` or `&` (the DSM wizard renders markup); like other wizard strings, it has no trailing period. Invalid values and messages are reported as `INSTALL_RECOMMENDED_MEMORY_INVALID`. Without the key, only the SDK's sentence is shown.
47
+
48
+ `synopkgland inspect <spk> --json` reports `recommendedMemoryMb` and verifies the install wizard files, including the App message, against the declaration recorded in the package.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.52.16",
3
+ "version": "0.52.18",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,6 +16,12 @@
16
16
  "maximum": 2147483647,
17
17
  "description": "Minimum physical /proc/meminfo MemTotal in MiB, checked dynamically on install and upgrade as the package account. Allow for firmware reservations: use about 85% of nominal RAM (1700 for a 2 GB NAS). Read failures warn and allow installation. No runtime check."
18
18
  },
19
+ "recommended_memory_mb": {
20
+ "type": "integer",
21
+ "minimum": 1,
22
+ "maximum": 2147483647,
23
+ "description": "Recommended physical /proc/meminfo MemTotal in MiB, above min_memory_mb. Below it the install wizard shows a warning the administrator can continue past, with the App's optional install.recommended_memory_message catalog text. Never blocks installation, upgrade or preinst. Use about 85% of nominal RAM (3400 for a 4 GB NAS)."
24
+ },
19
25
  "sharedFolder": {"type": "object"},
20
26
  "settings": {"type": "object"},
21
27
  "ports": {"const": true}
package/skills/SKILL.md CHANGED
@@ -40,7 +40,7 @@ Query published releases with `npm view @synopackageland/cli version`,
40
40
  `npm view @synopackageland/templates version` and `npm view @synopackageland/sdk version`;
41
41
  keep the installed dependency tree and generated pins consistent.
42
42
 
43
- For Apps with a physical RAM requirement, set `install.min_memory_mb` (MemTotal in MiB; use 1700 for 2 GB machines). The generated install/upgrade wizards and package-account preinst check it dynamically; read failures warn and allow installation, with no runtime check. See [minimum physical memory](../docs/install-memory.md).
43
+ For Apps with a physical RAM requirement, set `install.min_memory_mb` (MemTotal in MiB; use 1700 for 2 GB machines). The generated install/upgrade wizards and package-account preinst check it dynamically; read failures warn and allow installation, with no runtime check. For a softer threshold, set `install.recommended_memory_mb` (3400 for 4 GB machines): the install wizard warns but never blocks, with the App's optional `install.recommended_memory_message` catalog text. See [minimum and recommended physical memory](../docs/install-memory.md).
44
44
 
45
45
  For Apps with data folders or gateway listeners, read [reference/install.md](reference/install.md). Native Go/Node/Python Apps may use `picker: folder` (matching current CLI/SDK releases (see the changelog)) and must obtain the selected path through the SDK shared-folder API. 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.
46
46
 
@@ -137,6 +137,7 @@ a build operator trust decision. `check`/`inspect` remain offline.
137
137
  | Egress | isolated internal networks, or explicit internet outbound bridge; fine allowlist declarations fail |
138
138
  | Public ports | All upstream publishes removed; the host gateway dials the declared web service on its fixed bridge IP; auxiliary ingress is unsupported |
139
139
  | Root | Fixed package UID/GID by default; per-service container-root requires reason, bridge and no host binds; only CHOWN/FOWNER/SETUID/SETGID opt-ins |
140
+ | Sudo inside the container | Interactive console services only (`console` + `run_as: {mode: package, sudo: {reason}}`); starts as the package UID, Shares stay bound and are writable as root through sudo; fixed capability set; `inspect` prints `Container privilege: <service>: sudo inside container (<reason>)` |
140
141
  | Build, hooks, privileged, host PID/IPC, devices, sockets | Rejected; no host root workaround |
141
142
  | Secret/config file resources, plugins, replicas/deploy | Rejected until their bounded delivery/runtime contract exists |
142
143
  | Subpath hosting | Unsupported; use the app's dedicated origin at / |
@@ -7,6 +7,7 @@ Use matching CLI, SDK/App and templates releases, preserving the pins generated
7
7
  ```yaml
8
8
  install:
9
9
  min_memory_mb: 1700
10
+ recommended_memory_mb: 3400
10
11
  ports: true
11
12
  sharedFolder:
12
13
  mode: dedicated
@@ -18,7 +19,7 @@ identity_gateway:
18
19
  listen: {https: 28443}
19
20
  ```
20
21
 
21
- Use `install.min_memory_mb` for a physical RAM requirement checked dynamically on the NAS during install and upgrade. The value is MemTotal in MiB, so allow for firmware reservations: 1700 MiB admits 2 GB machines. All wizard locales show a low-memory page; package-account preinst enforces the same threshold through Package Center. Unreadable MemTotal warns and allows installation; no runtime check is added. See [minimum physical memory](../../docs/install-memory.md).
22
+ Use `install.min_memory_mb` for a physical RAM requirement checked dynamically on the NAS during install and upgrade. The value is MemTotal in MiB, so allow for firmware reservations: 1700 MiB admits 2 GB machines. All wizard locales show a low-memory page; package-account preinst enforces the same threshold through Package Center. Unreadable MemTotal warns and allows installation; no runtime check is added. Add `install.recommended_memory_mb` (above the minimum, or alone) for a non-blocking install wizard warning: 3400 MiB warns 2–3 GB machines but not 4 GB ones. The App's `install.recommended_memory_message` catalog key adds its own localized advice under the warning; preinst, upgrades and CLI installs never check the recommendation. See [minimum and recommended physical memory](../../docs/install-memory.md).
22
23
 
23
24
  For every App needing shared data, name the dedicated share after the package. The wizard defaults to that name, keeps it when the share list loads, and reuses the matching share if it exists. It also accepts a supported existing share. `mode: select` starts empty and requires an explicit choice; `mode: create` has no picker. Selecting a folder authorizes DSM's `data-share` worker to grant the declared RO/RW to the package account on install, upgrade/repair and starts. No pre-existing account or permission grant is required. Validation checks the name, existence and supported local mounted folder type, never package-account access. Local tiered/S2S shares are accepted; remote/C2, tiering buckets, WORM, unmounted, unavailable, moving, external and forced-read-only shares are refused. Runtime kernel checks still report the share, required access and recovery action when permission is revoked. No App root or ACL writer is generated.
24
25