@synopackageland/cli 0.53.13 → 0.53.14

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.53.14 (2026-11-12)
4
+
5
+ - `check`, `build` and `inspect` (also `check <spk>`) project the size of the installed `/var/packages/<package>/INFO`. At install DSM adds `package_icon="<base64>"` and `package_icon_256="<base64>"` lines with PACKAGE_ICON.PNG and PACKAGE_ICON_256.PNG, and the SDK executor reads at most 65536 bytes of that file. A larger INFO makes the executor log "cannot read package INFO" and DSM approval wait at APP_STARTING, although the SPK's own INFO is small. The projection is the SPK INFO plus both base64 lines, byte for byte; 65536 bytes pass and 65537 fail.
6
+ - Over 65536 bytes, `build` stops before writing the SPK and `check` fails, both with `INSTALLED_INFO_TOO_LARGE`; `inspect` reports `SPK_INSTALLED_INFO_TOO_LARGE`. Above 56 KiB they warn (`SPK_INSTALLED_INFO_NEAR_LIMIT` in `inspect`). The message gives the projected bytes and each part, names the icon file (the project's `icon`, `icon_256.png` in an icon directory, or the SPK's PACKAGE_ICON_256.PNG) and its size, and suggests recompressing it with fewer colours and less detail; the 256 px icon typically needs to be under about 40 KB.
7
+ - The build re-encodes project icons as 8-bit RGBA PNGs, so `check` and `build` measure the re-encoded PNG, not the source file. `check` renders the INFO each architecture would get, with placeholders as long as the build's checksum and digests. A native layout's own PACKAGE_ICON files are measured as packed.
8
+
3
9
  ## 0.53.13 (2026-11-11)
4
10
 
5
11
  - `backup.exclude` lists up to 64 globs of data-folder paths (letters, digits, `.`, `_`, `-`, `*`, `?`, `/` between folders) that Hyper Backup application backup leaves out, such as scratch folders and SQLite files still being written. The CLI validates it, writes it into `backup/config.json` and records it in `sdk-package.json`. It takes effect with SDK 0.53.35 or later; an older SDK control ignores it.
package/dist/cli.js CHANGED
@@ -35,7 +35,8 @@ import { followProjectLogs, followStandaloneLogs } from "./log.js";
35
35
  import { formatSkillList, readSkill, resolveSkillsRoot } from "./skill.js";
36
36
  import { resolveInstallParameterExtraValues } from "./deploy/param-values.js";
37
37
  import { findStandaloneRoot, loadStandaloneManifest, } from "./standalone/manifest.js";
38
- import { buildNativeLayout, isNativeLayout, loadNativeLayout, LAYOUT_ARCHES, } from "./standalone/native-layout.js";
38
+ import { standaloneInstalledInfoIssue } from "./standalone/spk.js";
39
+ import { buildNativeLayout, isNativeLayout, loadNativeLayout, LAYOUT_ARCHES, nativeLayoutInstalledInfoIssue, } from "./standalone/native-layout.js";
39
40
  import { buildStandalone, runnerFor } from "./standalone/build.js";
40
41
  import { checkJobs, commitOutputs, forEachArch, } from "./standalone/arch-jobs.js";
41
42
  import { checkReproducible } from "./reproducible.js";
@@ -487,6 +488,13 @@ async function runCliWithin(argv) {
487
488
  const iconText = formatIconReport(icon, "dsm-package.yaml");
488
489
  if (iconText.warning)
489
490
  console.error(iconText.warning);
491
+ const installedInfo = isNativeLayout(standalone)
492
+ ? nativeLayoutInstalledInfoIssue(loaded.manifest)
493
+ : standaloneInstalledInfoIssue(loaded.manifest);
494
+ if (installedInfo?.severity === "error")
495
+ throw failure("INSTALLED_INFO_TOO_LARGE", installedInfo.message);
496
+ if (installedInfo)
497
+ console.error(`warning: ${installedInfo.message}`);
490
498
  // A portal build carries the login style; a native layout keeps its own ui/config.
491
499
  const loginStyle = !isNativeLayout(standalone) &&
492
500
  "portal" in loaded.manifest &&
@@ -2,6 +2,7 @@ import { COMPOSE_ERRORS } from "./standalone/compose-errors.js";
2
2
  import { SECRET_FILE_FIX } from "./secret-files.js";
3
3
  export const ERROR_REGISTRY = {
4
4
  ...COMPOSE_ERRORS,
5
+ INSTALLED_INFO_TOO_LARGE: { code: 'INSTALLED_INFO_TOO_LARGE', description: 'The installed INFO, with the base64 icon lines DSM adds at install, would exceed the 65536 bytes the SDK executor reads', suggestion: 'Recompress the icon PNG with fewer colours and less detail (posterize or quantize it); the 256 px icon typically needs to be under about 40 KB' },
5
6
  STANDALONE_MOBILE_INVALID: { code: 'STANDALONE_MOBILE_INVALID', description: 'The mobile declaration or its UI/gateway dependency is invalid', suggestion: 'Check mobile against the manifest schema and read the mobile skill' },
6
7
  MOBILE_SDK_ENTRY_MISSING: { code: 'MOBILE_SDK_ENTRY_MISSING', description: 'The installed frontend SDK has no entry export', suggestion: 'Install an SDK with /entry in the UI build directory or project root' },
7
8
  MOBILE_INVALID: { code: 'MOBILE_INVALID', description: 'Packaged mobile assets differ from their build declaration', suggestion: 'Rebuild the SPK and inspect it again' },
@@ -0,0 +1,74 @@
1
+ /**
2
+ * At install, DSM embeds PACKAGE_ICON.PNG and PACKAGE_ICON_256.PNG into
3
+ * /var/packages/<package>/INFO as base64 lines:
4
+ *
5
+ * package_icon="<base64>"
6
+ * package_icon_256="<base64>"
7
+ *
8
+ * The SDK executor reads that installed INFO with a 65536-byte cap: a file of
9
+ * 65536 bytes is read, one of 65537 bytes fails ("cannot read package INFO"),
10
+ * and DSM approval then waits at APP_STARTING. The SPK's own INFO is a small
11
+ * part of it; the icons decide whether the package can start.
12
+ */
13
+ /** The SDK executor's read cap for the installed INFO; at most this many bytes are accepted. */
14
+ export declare const INSTALLED_INFO_LIMIT = 65536;
15
+ /** Above this, warn: little room is left for longer texts or a changed icon. */
16
+ export declare const INSTALLED_INFO_WARN: number;
17
+ /** The INFO keys DSM writes for the two Package Center icons, in that order. */
18
+ export declare const INSTALLED_ICON_KEYS: readonly [readonly ["package_icon", "PACKAGE_ICON.PNG"], readonly ["package_icon_256", "PACKAGE_ICON_256.PNG"]];
19
+ /** Bytes of one `key="<base64>"\n` line DSM adds for an icon of `bytes` bytes. */
20
+ export declare function installedIconLineBytes(key: string, bytes: number): number;
21
+ export interface InstalledInfoEstimate {
22
+ /** Projected size of /var/packages/<package>/INFO after install. */
23
+ bytes: number;
24
+ /** The SPK INFO bytes that stay, after the icon lines DSM replaces. */
25
+ infoBytes: number;
26
+ icons: Array<{
27
+ key: string;
28
+ file: string;
29
+ bytes: number;
30
+ lineBytes: number;
31
+ }>;
32
+ }
33
+ /**
34
+ * Projects the installed INFO: the SPK INFO (with a final newline, and without
35
+ * any package_icon lines DSM replaces), plus one base64 line per icon.
36
+ */
37
+ export declare function estimateInstalledInfo(info: string | Buffer, icon: Buffer | undefined, icon256: Buffer | undefined): InstalledInfoEstimate;
38
+ export interface InstalledInfoIssue {
39
+ severity: "error" | "warning";
40
+ message: string;
41
+ }
42
+ /**
43
+ * Over the cap is an error, above 56 KiB a warning. `source` names the file the
44
+ * icon came from (the project's icon, or the SPK entry); `reencoded` says the
45
+ * build re-encodes it, so the measured PNG is not the source file's bytes.
46
+ */
47
+ export declare function installedInfoIssue(estimate: InstalledInfoEstimate, options?: {
48
+ source?: string;
49
+ reencoded?: boolean;
50
+ }): InstalledInfoIssue | undefined;
51
+ /** The project file an icon of `size` px comes from: icon_<size>.png in an icon directory, else the icon itself. */
52
+ export declare function iconSourceFile(icon: string | undefined, root: string, size: 64 | 256): string | undefined;
53
+ /** The issue for an estimate whose icons the build made from the project's `icon` (a PNG or an icon directory). */
54
+ export declare function projectInstalledInfoIssue(estimate: InstalledInfoEstimate, icon?: {
55
+ path: string;
56
+ root: string;
57
+ }): InstalledInfoIssue | undefined;
58
+ /** The installed INFO issue of a staged SPK directory, just before it is packed. */
59
+ export declare function stagedInstalledInfoIssue(stage: string, icon?: {
60
+ path: string;
61
+ root: string;
62
+ }): InstalledInfoIssue | undefined;
63
+ /**
64
+ * `check` before a build: the largest installed INFO over the INFO the build
65
+ * would write per architecture (with placeholders as long as the build's
66
+ * digests) and the Package Center icons the build would pack.
67
+ */
68
+ export declare function largestInstalledInfo(infos: string[], icons: {
69
+ packageIcon?: Buffer;
70
+ packageIcon256?: Buffer;
71
+ }): InstalledInfoEstimate;
72
+ /** Placeholders as long as the build's MD5 checksum and SHA-256 digests. */
73
+ export declare const CHECKSUM_PLACEHOLDER: string;
74
+ export declare const DIGEST_PLACEHOLDER: string;
@@ -0,0 +1,98 @@
1
+ import { existsSync, readFileSync, statSync } from "node:fs";
2
+ import { join, relative } from "node:path";
3
+ /**
4
+ * At install, DSM embeds PACKAGE_ICON.PNG and PACKAGE_ICON_256.PNG into
5
+ * /var/packages/<package>/INFO as base64 lines:
6
+ *
7
+ * package_icon="<base64>"
8
+ * package_icon_256="<base64>"
9
+ *
10
+ * The SDK executor reads that installed INFO with a 65536-byte cap: a file of
11
+ * 65536 bytes is read, one of 65537 bytes fails ("cannot read package INFO"),
12
+ * and DSM approval then waits at APP_STARTING. The SPK's own INFO is a small
13
+ * part of it; the icons decide whether the package can start.
14
+ */
15
+ /** The SDK executor's read cap for the installed INFO; at most this many bytes are accepted. */
16
+ export const INSTALLED_INFO_LIMIT = 65536;
17
+ /** Above this, warn: little room is left for longer texts or a changed icon. */
18
+ export const INSTALLED_INFO_WARN = 56 * 1024;
19
+ /** The INFO keys DSM writes for the two Package Center icons, in that order. */
20
+ export const INSTALLED_ICON_KEYS = [["package_icon", "PACKAGE_ICON.PNG"], ["package_icon_256", "PACKAGE_ICON_256.PNG"]];
21
+ const base64Length = (bytes) => 4 * Math.ceil(bytes / 3);
22
+ /** Bytes of one `key="<base64>"\n` line DSM adds for an icon of `bytes` bytes. */
23
+ export function installedIconLineBytes(key, bytes) {
24
+ return key.length + 2 + base64Length(bytes) + 2;
25
+ }
26
+ /**
27
+ * Projects the installed INFO: the SPK INFO (with a final newline, and without
28
+ * any package_icon lines DSM replaces), plus one base64 line per icon.
29
+ */
30
+ export function estimateInstalledInfo(info, icon, icon256) {
31
+ let text = Buffer.isBuffer(info) ? info.toString("latin1") : Buffer.from(info, "utf8").toString("latin1");
32
+ const replaced = new Set(INSTALLED_ICON_KEYS.map(([key]) => key));
33
+ text = text.split("\n").filter((line) => !replaced.has(line.split("=")[0].trim())).join("\n");
34
+ if (text.length && !text.endsWith("\n"))
35
+ text += "\n";
36
+ const infoBytes = text.length;
37
+ const icons = INSTALLED_ICON_KEYS.flatMap(([key, file], index) => {
38
+ const png = index === 0 ? icon : icon256;
39
+ return png ? [{ key, file, bytes: png.length, lineBytes: installedIconLineBytes(key, png.length) }] : [];
40
+ });
41
+ return { bytes: infoBytes + icons.reduce((sum, item) => sum + item.lineBytes, 0), infoBytes, icons };
42
+ }
43
+ /**
44
+ * Over the cap is an error, above 56 KiB a warning. `source` names the file the
45
+ * icon came from (the project's icon, or the SPK entry); `reencoded` says the
46
+ * build re-encodes it, so the measured PNG is not the source file's bytes.
47
+ */
48
+ export function installedInfoIssue(estimate, options = {}) {
49
+ if (estimate.bytes <= INSTALLED_INFO_WARN)
50
+ return undefined;
51
+ const big = [...estimate.icons].sort((a, b) => b.bytes - a.bytes)[0];
52
+ const parts = [`SPK INFO ${estimate.infoBytes}`, ...estimate.icons.map((item) => `${item.key} ${item.lineBytes}`)].join(" + ");
53
+ const over = estimate.bytes > INSTALLED_INFO_LIMIT;
54
+ const head = over
55
+ ? `The installed INFO would be ${estimate.bytes} bytes, over the ${INSTALLED_INFO_LIMIT}-byte limit the SDK executor reads; the package would not start (approval waits at APP_STARTING).`
56
+ : `The installed INFO would be ${estimate.bytes} bytes, close to the ${INSTALLED_INFO_LIMIT}-byte limit the SDK executor reads.`;
57
+ const cause = big
58
+ ? ` DSM embeds the icons into /var/packages/<package>/INFO as base64 (${parts} bytes); ${options.source ?? big.file}` +
59
+ (options.reencoded ? ` is packaged as ${big.file} of ${big.bytes} bytes after the build re-encodes it as 8-bit RGBA.` : ` is ${big.bytes} bytes.`)
60
+ : ` (${parts} bytes)`;
61
+ const fix = big
62
+ ? ` Recompress the PNG with fewer colours and less detail (for example posterize it or quantize it to a 256-colour palette, and avoid noise and gradients); ${big.file === "PACKAGE_ICON_256.PNG" ? "PACKAGE_ICON_256.PNG" : "the icon"} typically needs to be under about 40 KB.`
63
+ : " Shorten INFO.";
64
+ return { severity: over ? "error" : "warning", message: head + cause + fix };
65
+ }
66
+ /** The project file an icon of `size` px comes from: icon_<size>.png in an icon directory, else the icon itself. */
67
+ export function iconSourceFile(icon, root, size) {
68
+ if (!icon)
69
+ return undefined;
70
+ if (statSync(icon).isDirectory()) {
71
+ const drawn = join(icon, `icon_${size}.png`);
72
+ return relative(root, existsSync(drawn) ? drawn : join(icon, "icon_256.png"));
73
+ }
74
+ return relative(root, icon);
75
+ }
76
+ /** The issue for an estimate whose icons the build made from the project's `icon` (a PNG or an icon directory). */
77
+ export function projectInstalledInfoIssue(estimate, icon) {
78
+ const big = [...estimate.icons].sort((a, b) => b.bytes - a.bytes)[0];
79
+ const source = icon && big ? iconSourceFile(icon.path, icon.root, big.key === "package_icon" ? 64 : 256) : undefined;
80
+ return installedInfoIssue(estimate, { ...(source ? { source } : {}), reencoded: Boolean(source) });
81
+ }
82
+ /** The installed INFO issue of a staged SPK directory, just before it is packed. */
83
+ export function stagedInstalledInfoIssue(stage, icon) {
84
+ const read = (name) => existsSync(join(stage, name)) ? readFileSync(join(stage, name)) : undefined;
85
+ return projectInstalledInfoIssue(estimateInstalledInfo(read("INFO") ?? "", read("PACKAGE_ICON.PNG"), read("PACKAGE_ICON_256.PNG")), icon);
86
+ }
87
+ /**
88
+ * `check` before a build: the largest installed INFO over the INFO the build
89
+ * would write per architecture (with placeholders as long as the build's
90
+ * digests) and the Package Center icons the build would pack.
91
+ */
92
+ export function largestInstalledInfo(infos, icons) {
93
+ return infos.map((info) => estimateInstalledInfo(info, icons.packageIcon, icons.packageIcon256)).sort((a, b) => b.bytes - a.bytes)[0]
94
+ ?? estimateInstalledInfo("", icons.packageIcon, icons.packageIcon256);
95
+ }
96
+ /** Placeholders as long as the build's MD5 checksum and SHA-256 digests. */
97
+ export const CHECKSUM_PLACEHOLDER = "0".repeat(32);
98
+ export const DIGEST_PLACEHOLDER = "0".repeat(64);
@@ -251,6 +251,16 @@ export declare const SPK_RULES: {
251
251
  readonly description: "PACKAGE_ICON.PNG is not 64x64, or PACKAGE_ICON_256.PNG is not 256x256.";
252
252
  readonly source: "DSM 7 Developer Guide: Package Structure";
253
253
  };
254
+ readonly SPK_INSTALLED_INFO_TOO_LARGE: {
255
+ readonly severity: "error";
256
+ readonly description: "The installed INFO (SPK INFO plus the base64 package_icon and package_icon_256 lines DSM adds) would exceed the 65536 bytes the SDK executor reads, so the package cannot start.";
257
+ readonly source: "DSM install behavior; SDK executor";
258
+ };
259
+ readonly SPK_INSTALLED_INFO_NEAR_LIMIT: {
260
+ readonly severity: "warning";
261
+ readonly description: "The installed INFO (SPK INFO plus the base64 icon lines DSM adds) would be over 56 KiB, close to the 65536 bytes the SDK executor reads.";
262
+ readonly source: "DSM install behavior; SDK executor";
263
+ };
254
264
  readonly SPK_LICENSE_TOO_LARGE: {
255
265
  readonly severity: "error";
256
266
  readonly description: "LICENSE is 1 MB or larger.";
package/dist/spk/rules.js CHANGED
@@ -48,6 +48,8 @@ export const SPK_RULES = {
48
48
  SPK_ICON_MISSING: { severity: "error", description: "PACKAGE_ICON.PNG or PACKAGE_ICON_256.PNG is missing.", source: `${GUIDE}: Package Structure` },
49
49
  SPK_ICON_INVALID: { severity: "error", description: "PACKAGE_ICON.PNG or PACKAGE_ICON_256.PNG is not a PNG.", source: `${GUIDE}: Package Structure` },
50
50
  SPK_ICON_SIZE: { severity: "warning", description: "PACKAGE_ICON.PNG is not 64x64, or PACKAGE_ICON_256.PNG is not 256x256.", source: `${GUIDE}: Package Structure` },
51
+ SPK_INSTALLED_INFO_TOO_LARGE: { severity: "error", description: "The installed INFO (SPK INFO plus the base64 package_icon and package_icon_256 lines DSM adds) would exceed the 65536 bytes the SDK executor reads, so the package cannot start.", source: "DSM install behavior; SDK executor" },
52
+ SPK_INSTALLED_INFO_NEAR_LIMIT: { severity: "warning", description: "The installed INFO (SPK INFO plus the base64 icon lines DSM adds) would be over 56 KiB, close to the 65536 bytes the SDK executor reads.", source: "DSM install behavior; SDK executor" },
51
53
  SPK_LICENSE_TOO_LARGE: { severity: "error", description: "LICENSE is 1 MB or larger.", source: `${GUIDE}: Package Structure` },
52
54
  SPK_WIZARD_INVALID: { severity: "warning", description: "A WIZARD_UIFILES wizard file is not a JSON array.", source: `${GUIDE}: Package Structure (WIZARD_UIFILES)` },
53
55
  SPK_WIZARD_SCRIPT_NOT_EXECUTABLE: { severity: "warning", description: "A WIZARD_UIFILES .sh wizard generator is not executable.", source: `${GUIDE}: Package Structure (WIZARD_UIFILES)` },
@@ -5,6 +5,7 @@ import { join } from "node:path";
5
5
  import * as tar from "tar";
6
6
  import { checkInfoFields, parseInfo } from "./check-info.js";
7
7
  import { checkMetadata } from "./check-metadata.js";
8
+ import { estimateInstalledInfo, installedInfoIssue } from "./installed-info.js";
8
9
  import { checkPayload } from "./check-payload.js";
9
10
  import { KNOWN_TOP_LEVEL } from "./dsm-spec.js";
10
11
  import { Findings } from "./findings.js";
@@ -57,6 +58,7 @@ export async function validateSpk(spkPath, options = {}) {
57
58
  publicUi = await checkPayload(outer.payloadPath, info, findings, { ignores, moduleVersion, sourceMaps: options.sourceMaps });
58
59
  }
59
60
  checkMetadata({ files: outer.files, modes: new Map(outer.entries.map((entry) => [normalize(entry.path), entry.mode])) }, findings);
61
+ checkInstalledInfo(outer.files, findings);
60
62
  }
61
63
  }
62
64
  finally {
@@ -138,3 +140,12 @@ function checkInfo(outer, findings) {
138
140
  checkInfoFields(fields, outer.payloadPath, findings);
139
141
  return Object.fromEntries(fields);
140
142
  }
143
+ /** DSM adds both icons to the installed INFO as base64; the SDK executor reads at most 65536 bytes of it. */
144
+ function checkInstalledInfo(files, findings) {
145
+ const info = files.get("INFO");
146
+ if (!info)
147
+ return;
148
+ const issue = installedInfoIssue(estimateInstalledInfo(info, files.get("PACKAGE_ICON.PNG"), files.get("PACKAGE_ICON_256.PNG")));
149
+ if (issue)
150
+ findings.add(issue.severity === "error" ? "SPK_INSTALLED_INFO_TOO_LARGE" : "SPK_INSTALLED_INFO_NEAR_LIMIT", issue.message, "INFO");
151
+ }
@@ -173,6 +173,7 @@ export async function buildStandalone(options) {
173
173
  ? portalCatalogs(sdkSource(executor?.sdk ?? portalSdkVersion(manifest)).goDir)
174
174
  : undefined;
175
175
  await assembleStandaloneSpk({
176
+ warn: (warning) => warnings.add(warning),
176
177
  manifest: builtManifest,
177
178
  arch,
178
179
  cgiPath,
@@ -4,6 +4,7 @@ import { type UiSecretIgnore } from './public-ui.js';
4
4
  import type { CommandRunner } from './build.js';
5
5
  import { type Toolkit } from './toolkit.js';
6
6
  import { type PortalDeclaration } from '../portal/alias.js';
7
+ import { type InstalledInfoEstimate, type InstalledInfoIssue } from '../spk/installed-info.js';
7
8
  export declare const LAYOUT_ARCHES: {
8
9
  readonly x86_64: readonly [2, 62];
9
10
  readonly aarch64: readonly [2, 183];
@@ -85,6 +86,10 @@ export declare function buildNativeLayout(options: {
85
86
  run?: CommandRunner;
86
87
  }): Promise<{
87
88
  outputs: string[];
89
+ warnings: string[];
88
90
  }>;
91
+ /** `check`: the installed INFO the layout's SPKs would have, with the icon or the layout's PACKAGE_ICON files. */
92
+ export declare function nativeLayoutInstalledInfo(m: NativeLayout): InstalledInfoEstimate;
93
+ export declare function nativeLayoutInstalledInfoIssue(m: NativeLayout): InstalledInfoIssue | undefined;
89
94
  export declare function inspectNativeLayout(dir: string, payload: string, info: Record<string, string>): string[];
90
95
  export {};
@@ -19,6 +19,7 @@ import { portalEntryProblem, readPortalDeclaration } from '../portal/alias.js';
19
19
  import { infoArchValue } from '../build-spk/dsm-arch.js';
20
20
  import { LIFECYCLE_SCRIPTS, REPLACE_SCRIPTS } from '../spk/dsm-spec.js';
21
21
  import { renderPackageIcons, writePackageCenterIcons } from '../build-spk/dsm-icons.js';
22
+ import { CHECKSUM_PLACEHOLDER, DIGEST_PLACEHOLDER, largestInstalledInfo, projectInstalledInfoIssue, stagedInstalledInfoIssue } from '../spk/installed-info.js';
22
23
  export const LAYOUT_ARCHES = { x86_64: [2, 62], aarch64: [2, 183], armv8: [2, 183], armv7: [1, 40] };
23
24
  /** INFO arch: aarch64 is not an Appendix A value, so it lists the platforms as native-go and binary do. */
24
25
  const layoutInfoArch = (arch) => arch === 'aarch64' ? infoArchValue('aarch64') : arch;
@@ -323,6 +324,7 @@ export async function buildNativeLayout(options) {
323
324
  fail('architecture not declared');
324
325
  const icons = m.icon === undefined ? undefined : renderPackageIcons(inside(m.root, m.icon));
325
326
  const jobs = checkJobs(options.jobs);
327
+ const warnings = new Set();
326
328
  if (jobs > 1 && !m.layout.payload.includes('{arch}'))
327
329
  fail('--jobs above 1 needs a layout.payload path with {arch}, so architectures do not overwrite one payload folder');
328
330
  const version = `${m.version}-${String(m.build).padStart(4, '0')}`;
@@ -360,15 +362,18 @@ export async function buildNativeLayout(options) {
360
362
  const ignoredUi = uiFiles(join(target, 'ui')).filter(file => uiIgnores.some(ignore => ignore.file === file)).map(file => `ui/${file}`);
361
363
  await createReproducibleTar(target, join(stage, 'package.tgz'), { gzip: true, rejectSecrets: true, allowSecretFiles: [...new Set([...(m.allowSecretFiles ?? []), ...ignoredUi])] });
362
364
  rmSync(target, { recursive: true });
363
- const fields = { package: m.package, version, arch: layoutInfoArch(arch), os_min_ver: m.os_min_ver, displayname: m.displayname, description: m.description, maintainer: m.maintainer, dsmuidir: 'ui', dsmappname: `SYNO.SDS.${m.package}.Instance`, startable: 'yes', thirdparty: 'yes', checksum: createHash('md5').update(readFileSync(join(stage, 'package.tgz'))).digest('hex') };
364
- const deps = dependencyInfo(m.dependencies ?? { packages: [] });
365
- const info = portalInfoFields([...Object.entries(fields), ...(deps ? [["install_dep_packages", deps]] : []), ...metadataInfoFields(m.metadata), ...anchorFields(m.layout.anchors ?? {}, files), ...portalFields(m.portal)], Boolean(m.portal));
365
+ const info = layoutInfoFields(m, arch, version, createHash('md5').update(readFileSync(join(stage, 'package.tgz'))).digest('hex'), anchorFields(m.layout.anchors ?? {}, files));
366
366
  if (new Set(info.map(([k]) => k)).size !== info.length)
367
367
  fail('INFO anchor collides with an INFO field');
368
- writeFileSync(join(stage, 'INFO'), info.map(([k, v]) => `${k}="${v.replace(/([\\"$`])/g, '\\$1')}"\n`).join(''));
368
+ writeFileSync(join(stage, 'INFO'), renderLayoutInfo(info));
369
369
  writeFileSync(join(stage, 'native-layout.json'), JSON.stringify({ format: 1, arch, dependencies: m.dependencies ?? { packages: [] }, ...(uiIgnores.length ? { ui_secret_ignores: storedUiSecretIgnores(uiIgnores) } : {}), binaries: binaries.map(({ path, linkage }) => ({ path, linkage })), files, ...(m.layout.anchors ? { anchors: m.layout.anchors } : {}), ...(m.portal ? { portal: m.portal } : {}) }));
370
370
  for (const name of ['INFO', 'native-layout.json'])
371
371
  chmodSync(join(stage, name), 0o644);
372
+ const installedInfo = stagedInstalledInfoIssue(stage, m.icon === undefined ? undefined : { path: inside(m.root, m.icon), root: m.root });
373
+ if (installedInfo?.severity === 'error')
374
+ throw Object.assign(new Error(`INSTALLED_INFO_TOO_LARGE: ${installedInfo.message}`), { code: 'INSTALLED_INFO_TOO_LARGE' });
375
+ if (installedInfo)
376
+ warnings.add(installedInfo.message);
372
377
  const output = join(outDir, `${m.package}-${version}-${arch}.spk`);
373
378
  await createReproducibleTar(stage, output, { rejectSecrets: true });
374
379
  return output;
@@ -379,7 +384,29 @@ export async function buildNativeLayout(options) {
379
384
  rmSync(dir, { recursive: true, force: true });
380
385
  }
381
386
  }));
382
- return { outputs };
387
+ return { outputs, warnings: [...warnings] };
388
+ }
389
+ function layoutInfoFields(m, arch, version, checksum, anchors) {
390
+ const fields = { package: m.package, version, arch: layoutInfoArch(arch), os_min_ver: m.os_min_ver, displayname: m.displayname, description: m.description, maintainer: m.maintainer, dsmuidir: 'ui', dsmappname: `SYNO.SDS.${m.package}.Instance`, startable: 'yes', thirdparty: 'yes', checksum };
391
+ const deps = dependencyInfo(m.dependencies ?? { packages: [] });
392
+ return portalInfoFields([...Object.entries(fields), ...(deps ? [["install_dep_packages", deps]] : []), ...metadataInfoFields(m.metadata), ...anchors, ...portalFields(m.portal)], Boolean(m.portal));
393
+ }
394
+ function renderLayoutInfo(info) {
395
+ return info.map(([k, v]) => `${k}="${v.replace(/([\\"$`])/g, '\\$1')}"\n`).join('');
396
+ }
397
+ /** `check`: the installed INFO the layout's SPKs would have, with the icon or the layout's PACKAGE_ICON files. */
398
+ export function nativeLayoutInstalledInfo(m) {
399
+ const version = `${m.version}-${String(m.build).padStart(4, '0')}`;
400
+ const anchors = Object.keys(m.layout.anchors ?? {}).map((key) => [key, DIGEST_PLACEHOLDER]);
401
+ const infos = m.arches.map(arch => renderLayoutInfo(layoutInfoFields(m, arch, version, CHECKSUM_PLACEHOLDER, anchors)));
402
+ if (m.icon !== undefined)
403
+ return largestInstalledInfo(infos, renderPackageIcons(inside(m.root, m.icon)));
404
+ const metadata = inside(m.root, m.layout.metadata);
405
+ const read = (name) => existsSync(join(metadata, name)) ? readFileSync(join(metadata, name)) : undefined;
406
+ return largestInstalledInfo(infos, { packageIcon: read('PACKAGE_ICON.PNG'), packageIcon256: read('PACKAGE_ICON_256.PNG') });
407
+ }
408
+ export function nativeLayoutInstalledInfoIssue(m) {
409
+ return projectInstalledInfoIssue(nativeLayoutInstalledInfo(m), m.icon === undefined ? undefined : { path: inside(m.root, m.icon), root: m.root });
383
410
  }
384
411
  export function inspectNativeLayout(dir, payload, info) {
385
412
  try {
@@ -1,4 +1,5 @@
1
1
  import { type NativeArchFamily } from "../build-spk/dsm-arch.js";
2
+ import { type InstalledInfoEstimate, type InstalledInfoIssue } from "../spk/installed-info.js";
2
3
  import type { StandaloneManifest } from "./manifest.js";
3
4
  import { type ExecutorArtifact } from "../runtime/executor-build.js";
4
5
  import type { PortalCatalogs } from "./portal-window.js";
@@ -8,6 +9,8 @@ export declare class StandaloneBuildError extends Error {
8
9
  constructor(code: string, message: string);
9
10
  }
10
11
  export interface AssembleOptions {
12
+ /** Receives build warnings, such as an installed INFO close to the executor's read limit. */
13
+ warn?: (warning: string) => void;
11
14
  manifest: StandaloneManifest;
12
15
  arch: NativeArchFamily;
13
16
  /** The compiled or prebuilt CGI executable, already checked. */
@@ -44,4 +47,7 @@ export declare function assembleStandaloneSpk(options: AssembleOptions): Promise
44
47
  * Package Center's Open (`dsmapplaunchname`) opens the console window.
45
48
  */
46
49
  export declare function consoleInfo(manifest: Pick<StandaloneManifest, "package" | "console">): Array<[string, string]>;
50
+ /** `check`: the installed INFO this manifest's SPKs would have, for its largest architecture INFO. */
51
+ export declare function standaloneInstalledInfo(manifest: StandaloneManifest): InstalledInfoEstimate;
52
+ export declare function standaloneInstalledInfoIssue(manifest: StandaloneManifest): InstalledInfoIssue | undefined;
47
53
  export declare function renderInfo(manifest: StandaloneManifest, arch: NativeArchFamily, checksum: string, executorDigest?: string): string;
@@ -31,6 +31,7 @@ import { APP_SCRIPTS_DIR, APP_SCRIPTS_SPK_DIR } from "./app-scripts.js";
31
31
  import { MODULE_UI_ENTRY, uiTreeDigest } from "./ui-assets.js";
32
32
  import { enforcePublicUi, isUiBundle, logicalUiFile, minifyUi, minifyUiTree, storedUiSecretIgnores, uiFiles } from "./public-ui.js";
33
33
  import { codedMessage } from "../errors.js";
34
+ import { CHECKSUM_PLACEHOLDER, DIGEST_PLACEHOLDER, largestInstalledInfo, projectInstalledInfoIssue, stagedInstalledInfoIssue } from "../spk/installed-info.js";
34
35
  import { DSM_LANGS, LOCALES } from "./i18n.js";
35
36
  import { appTitle, CGI_PAYLOAD_PATH, hasSdkWindow, renderUiConfig, renderWindowScript, windowScriptName, } from "./dsm-window.js";
36
37
  import { writeUiTexts } from "../build-spk/ui-texts.js";
@@ -403,6 +404,11 @@ export async function assembleStandaloneSpk(options) {
403
404
  }),
404
405
  });
405
406
  writePackageCenterIcons(staging, icons);
407
+ const installedInfo = stagedInstalledInfoIssue(staging, manifest.icon ? { path: manifest.icon, root: manifest.root } : undefined);
408
+ if (installedInfo?.severity === "error")
409
+ throw new StandaloneBuildError("INSTALLED_INFO_TOO_LARGE", installedInfo.message);
410
+ if (installedInfo)
411
+ options.warn?.(installedInfo.message);
406
412
  mkdirSync(dirname(options.outputPath), { recursive: true });
407
413
  await createReproducibleTar(staging, options.outputPath, { rejectSecrets: true });
408
414
  }
@@ -434,6 +440,14 @@ export function consoleInfo(manifest) {
434
440
  ? [["dsmappname", `${ns}.Instance ${ns}.Console`], ["dsmapplaunchname", `${ns}.Console`]]
435
441
  : [["dsmappname", `${ns}.Instance`]];
436
442
  }
443
+ /** `check`: the installed INFO this manifest's SPKs would have, for its largest architecture INFO. */
444
+ export function standaloneInstalledInfo(manifest) {
445
+ const executor = manifest.capabilities.rootOps || manifest.capabilities.delegate || manifest.capabilities.webapi ? DIGEST_PLACEHOLDER : undefined;
446
+ return largestInstalledInfo(manifest.arches.map((arch) => renderInfo(manifest, arch, CHECKSUM_PLACEHOLDER, executor)), packageIcons(manifest.icon));
447
+ }
448
+ export function standaloneInstalledInfoIssue(manifest) {
449
+ return projectInstalledInfoIssue(standaloneInstalledInfo(manifest), manifest.icon ? { path: manifest.icon, root: manifest.root } : undefined);
450
+ }
437
451
  export function renderInfo(manifest, arch, checksum, executorDigest) {
438
452
  const fields = [
439
453
  ["package", manifest.package],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.53.13",
3
+ "version": "0.53.14",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -168,6 +168,10 @@ Store a square PNG of at least 256 pixels at `synology/assets/icon.png` and set
168
168
  that manifest, not the upstream root. The CLI resizes it for DSM menu/window
169
169
  icons and Package Center's 64- and 256-pixel icons; no hand-made size set is
170
170
  required. Omitting `icon` uses the bundled default.
171
+ DSM embeds both Package Center icons into the installed INFO as base64, and
172
+ the SDK executor reads at most 65536 bytes of it, so `check` and `build` fail
173
+ an icon whose re-encoded 256 px PNG is too large (typically above about 40 KB).
174
+ Use flat colours and little noise, or posterize the PNG.
171
175
 
172
176
  Prefer [DSM path ingress](../../docs/path-ingress.md#choose-an-entry-route) when
173
177
  the upstream supports a base path. For an upstream that needs `/`, declare