@synopackageland/cli 0.48.24 → 0.49.1

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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.49.1
4
+
5
+ - Pass the same build-stamped App bundle URL to SDK entry preload and mount for every generated mobile App entry
6
+ - Require templates ~0.41.1 with SDK/App 0.51.1 defaults and frontend SDK range ~0.51.1
7
+ - Preserve classic script loading and Apps without mobile registration
8
+
9
+ ## 0.49.0
10
+
11
+ - Add the `mobile` declaration for native and gateway Apps, with localized registration, generated icons, intake rules and build-consistency checks during inspection
12
+ - Bundle the installed SDK entry runtime and generate entry pages that share the DSM window session, language and privileged adapters
13
+ - Require the matching templates minor so fresh installations use the updated SDK/App scaffolds
14
+ - Resolve frontend SDK tilde ranges through the installed package or matching lockfile, retaining exact backend/frontend version checks
15
+ - Add `synopkgland skill show mobile` with registration, entry-page and mobile-shell guidance
16
+ - Include `lang` and `locale` in generated Go `app.status` responses, using trusted DSM language hints and browser-locale fallback
17
+
3
18
  ## 0.48.24
4
19
 
5
20
  - Check tracked secret files only inside the App project directory, and warn about untracked local secrets across the repository without clone-safe ignore rules
@@ -38,3 +38,5 @@ export declare function windowIconFile(icons: PackageIcons, size: number): strin
38
38
  export declare function readDsmWindowIcons(uiDir: string): PackageIcons;
39
39
  export declare function writeDsmWindowIcons(uiDir: string, icons: PackageIcons): void;
40
40
  export declare function writePackageCenterIcons(spkRoot: string, icons: PackageIcons): void;
41
+ /** Reuse the package PNG pipeline for the mobile launcher sizes. */
42
+ export declare function mobileIcons(path: string | undefined): Map<number, Buffer>;
@@ -188,3 +188,8 @@ export function writePackageCenterIcons(spkRoot, icons) {
188
188
  writeIcon(join(spkRoot, "PACKAGE_ICON.PNG"), icons.packageIcon);
189
189
  writeIcon(join(spkRoot, "PACKAGE_ICON_256.PNG"), icons.packageIcon256);
190
190
  }
191
+ /** Reuse the package PNG pipeline for the mobile launcher sizes. */
192
+ export function mobileIcons(path) {
193
+ const image = decodePng(packageIcons(path).packageIcon256);
194
+ return new Map([192, 512].map(size => [size, encodePng(size, size, scale(image, size).rgba)]));
195
+ }
@@ -52,7 +52,7 @@ export declare function registrySessionRetry(registry: OperationRegistry, routes
52
52
  }[]): {
53
53
  [k: string]: {
54
54
  effect: "read" | "write" | "destructive";
55
- kind: "rpc" | "ai" | "stream" | "unknown";
55
+ kind: "unknown" | "rpc" | "ai" | "stream";
56
56
  };
57
57
  };
58
58
  export declare function registryArtifacts(root: string, registry: OperationRegistry, check: boolean, routes?: readonly {
@@ -2,6 +2,9 @@ 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
+ 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
+ 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
+ MOBILE_INVALID: { code: 'MOBILE_INVALID', description: 'Packaged mobile assets differ from their build declaration', suggestion: 'Rebuild the SPK and inspect it again' },
5
8
  SECRET_FILE_TRACKED: { code: "SECRET_FILE_TRACKED", description: "Git tracks a local secret file.", suggestion: SECRET_FILE_FIX },
6
9
  SECRET_FILE_UNIGNORED: { code: "SECRET_FILE_UNIGNORED", description: "A local secret file lacks a repository ignore rule.", suggestion: SECRET_FILE_FIX },
7
10
  SECRET_FILE_PACKED: { code: "SECRET_FILE_PACKED", description: "An SPK input contains a local secret file.", suggestion: "Remove the secret from packaged UI, payload and metadata inputs; provide it at runtime." },
package/dist/init.js CHANGED
@@ -247,6 +247,27 @@ export function initFromTemplate(template, targetDir, options = {}) {
247
247
  }
248
248
  for (const file of capability.removed)
249
249
  rmSync(join(targetDir, file));
250
+ // Older templates omit the entry language hints. Empty hints deliberately
251
+ // select the SDK's browser-locale fallback until the App reads DSM preferences.
252
+ if (template === 'native-go') {
253
+ const routes = join(targetDir, 'backend/internal/app/routes.go');
254
+ if (existsSync(routes)) {
255
+ const source = readFileSync(routes, 'utf8');
256
+ if (!source.includes('"locale"') && source.includes('"admin": caller.Admin(),'))
257
+ writeFileSync(routes, source.replace('"admin": caller.Admin(),', '"admin": caller.Admin(),\n\t\t"lang": "",\n\t\t"locale": "",'));
258
+ }
259
+ }
260
+ const bridgeStatus = {
261
+ 'native-python': { file: 'backend/app/routes.py', from: '"admin": ctx.admin,', to: '"admin": ctx.admin,\n "lang": "",\n "locale": ctx.locale,' },
262
+ 'native-node': { file: 'backend/src/routes.ts', from: 'admin: ctx.admin,', to: 'admin: ctx.admin,\n lang: \'\',\n locale: ctx.locale,' },
263
+ 'native-rust': { file: 'backend/src/routes.rs', from: '"admin": ctx.admin,', to: '"admin": ctx.admin,\n "lang": "",\n "locale": ctx.locale,' },
264
+ }[template];
265
+ if (bridgeStatus) {
266
+ const path = join(targetDir, bridgeStatus.file);
267
+ const source = readFileSync(path, 'utf8');
268
+ if (!source.includes('locale'))
269
+ writeFileSync(path, source.replace(bridgeStatus.from, bridgeStatus.to));
270
+ }
250
271
  if (isNativeTemplate(template)) {
251
272
  const path = join(targetDir, PERMISSIONS_FILE[template]);
252
273
  const policy = JSON.parse(readFileSync(path, "utf8"));
package/dist/skill.js CHANGED
@@ -32,6 +32,7 @@ const SKILL_CATALOG = [
32
32
  file: "reference/identity.md",
33
33
  when: "Needs a DSM sign-in",
34
34
  },
35
+ { id: "mobile", file: "reference/mobile.md", when: "Register an App for the mobile shell and generate its SDK entry page" },
35
36
  { id: "files", file: "reference/files.md", when: "Needs NAS files" },
36
37
  {
37
38
  id: "portal",
@@ -404,7 +404,34 @@ ${root ? root.definitions : ""}${manifest.portal ? renderPortalDefinition(ns, po
404
404
  // registered. Reuse it only when this build loaded it; an older loader records
405
405
  // no build, so its app is replaced as well.
406
406
  ${ns}.loadApp = function (done) {
407
- var apps = window.DsmPackageApps || {};
407
+ ${manifest.mobile?.entry === 'app' ? ` var deliver = done;
408
+ done = function (app, error) {
409
+ if (!app || error) { deliver(app, error); return; }
410
+ import(new URL("webman/3rdparty/${pkg}/app/entry-context.js?v=${assetVersion}", document.baseURI).href).then(function (entry) {
411
+ deliver({mount: function (root, ctx) {
412
+ var options = Ext.apply({}, ctx);
413
+ options.packageId = ${p};
414
+ options.build = "${assetVersion}";
415
+ options.session = ${ns}.session;
416
+ options.token = SYNO.SDS.Session && SYNO.SDS.Session.SynoToken;
417
+ options.portalAccess = ctx.portal;
418
+ delete options.portal;
419
+ delete options.uiUpdate;
420
+ var shared = entry.createAppContext(options);
421
+ try {
422
+ var mounted = app.mount(root, shared) || {};
423
+ var wrapped = Ext.apply({}, mounted);
424
+ wrapped.unmount = function () {
425
+ try { if (mounted.unmount) mounted.unmount(); }
426
+ finally { shared.host.dispose(); }
427
+ };
428
+ return wrapped;
429
+ }
430
+ catch (error) { shared.host.dispose(); throw error; }
431
+ }}, null);
432
+ }, function (error) { deliver(null, error); });
433
+ };
434
+ ` : ""} var apps = window.DsmPackageApps || {};
408
435
  var versions = window.DsmPackageAppVersions = window.DsmPackageAppVersions || {};
409
436
  if (apps[${p}] && versions[${p}] === "${assetVersion}") {
410
437
  done(apps[${p}]);
@@ -418,7 +445,7 @@ ${moduleVersion ? ` var loads = window.DsmPackageAppLoads = window.DsmPackageAp
418
445
  css.rel = "stylesheet";
419
446
  css.href = base + "app.css?v=${assetVersion}";
420
447
  document.head.appendChild(css);
421
- ${moduleVersion ? ` loads[key] = import(new URL(base + "app.module.js", document.baseURI).href).then(function (app) {
448
+ ${moduleVersion ? ` loads[key] = import(new URL(base + "app.module.js${manifest.mobile ? `?v=${assetVersion}` : ""}", document.baseURI).href).then(function (app) {
422
449
  if (typeof app.mount !== "function") throw new Error("The UI module must export mount(root, ctx)");
423
450
  window.DsmPackageApps = window.DsmPackageApps || {};
424
451
  window.DsmPackageApps[${p}] = app;
@@ -20,6 +20,7 @@ export type CatalogsResult = {
20
20
  };
21
21
  export interface InfoText {
22
22
  displayname?: string;
23
+ mobile_name?: string;
23
24
  description?: string;
24
25
  }
25
26
  /** INFO `displayname_<dsm lang>` / `description_<dsm lang>`; English stays top level. */
@@ -17,7 +17,7 @@ export const DSM_LANGS = {
17
17
  es: "spn",
18
18
  it: "ita",
19
19
  };
20
- const INFO_TEXT_FIELDS = new Set(["displayname", "description"]);
20
+ const INFO_TEXT_FIELDS = new Set(["displayname", "description", "mobile_name"]);
21
21
  export function readInfoTranslations(value, check) {
22
22
  if (value === undefined) {
23
23
  return {};
@@ -31,7 +31,7 @@ export function readInfoTranslations(value, check) {
31
31
  return check.invalid(`"${locale}" is not a supported translation language; English goes in the top-level displayname / description.`);
32
32
  }
33
33
  if (!isRecord(text) || Object.keys(text).some((key) => !INFO_TEXT_FIELDS.has(key))) {
34
- return check.invalid(`.${locale} accepts only displayname and description.`);
34
+ return check.invalid(`.${locale} accepts only displayname, description and mobile_name.`);
35
35
  }
36
36
  const entry = {};
37
37
  for (const field of INFO_TEXT_FIELDS) {
@@ -1,3 +1,4 @@
1
+ import { inspectMobileFiles, mobileRecordProblem } from './mobile.js';
1
2
  import { DAEMON_NOFILE_UNSUPPORTED, DAEMON_NOFILE_ACTIVATION_PROBLEM, readNoFile, daemonSystemUnitName, renderDaemonSystemUnit, daemonNoFileSdkProblem, daemonNoFileIdentityProblem, DAEMON_NOFILE_MIN_DSM } from "./daemon-nofile.js";
2
3
  import { gatewayIngressPathProblem, gatewayIngressOwnershipSupported } from './gateway-ingress.js';
3
4
  import { renderGatewayIngressCheck } from './native-gateway.js';
@@ -166,7 +167,7 @@ export async function inspectSpk(spkPath, expectedKind) {
166
167
  if (metadata.daemon_nofile !== undefined && (!paths.has("daemon/control") || metadata.compose !== undefined))
167
168
  findings.push("daemon.nofile requires a native daemon controller");
168
169
  const daemonRestart = recoverDaemonRestart(metadata.daemon_restart, metadata.daemon_restart === undefined && daemonNoFile !== undefined ? undefined : metadata.daemon_sdk, findings);
169
- await inspectModuleUi(dir, paths, metadata.ui_module, findings);
170
+ await inspectModuleUi(dir, paths, metadata.ui_module, findings, metadata.mobile);
170
171
  if (metadata.daemon_restart !== undefined && (metadata.compose !== undefined || !paths.has("daemon/control")))
171
172
  findings.push("DAEMON_RESTART_INVALID daemon restart requires a native daemon controller, without Compose supervision");
172
173
  const { identityGateway, gateway } = await inspectGatewayAdmission(dir, paths, metadata.provider_only_oidc, findings);
@@ -218,6 +219,7 @@ export async function inspectSpk(spkPath, expectedKind) {
218
219
  : await recoverCompose(dir, metadata.compose, findings);
219
220
  const daemonNode = recoverDaemonNode(metadata.daemon_node, findings);
220
221
  const info = readInfo(join(dir, "INFO"), findings, kind, Boolean(combined), daemonNode, dependencies);
222
+ await inspectMobile(dir, paths, metadata.mobile, info, findings);
221
223
  if (combined &&
222
224
  (!info.os_min_ver || !isDsmAtLeast(info.os_min_ver, CONTAINER_MIN_DSM)))
223
225
  findings.push("compose identity_gateway requires DSM >= 7.2.1");
@@ -402,7 +404,7 @@ export async function inspectSpk(spkPath, expectedKind) {
402
404
  rmSync(dir, { recursive: true, force: true });
403
405
  }
404
406
  }
405
- async function inspectModuleUi(dir, paths, version, findings) {
407
+ async function inspectModuleUi(dir, paths, version, findings, mobile) {
406
408
  if (version === undefined) {
407
409
  if ([...paths].some(path => /^ui\/app\/[a-f0-9]{64}\/app\.module\.js$/.test(path)))
408
410
  findings.push("UI_MODULE_INVALID module UI requires its build record");
@@ -415,7 +417,7 @@ async function inspectModuleUi(dir, paths, version, findings) {
415
417
  for (const entry of [MODULE_UI_ENTRY, "app.css"])
416
418
  if (!paths.has(prefix + entry))
417
419
  throw new Error(`missing ${entry}`);
418
- if ([...paths].some(path => path.startsWith("ui/app/") && path !== `ui/app/${version}` && !path.startsWith(prefix)))
420
+ if ([...paths].some(path => path.startsWith("ui/app/") && path !== `ui/app/${version}` && !path.startsWith(prefix) && !(mobile && !mobileRecordProblem(mobile) && Object.hasOwn(mobile.files, path.slice("ui/app/".length)))))
419
421
  throw new Error("module UI assets must all belong to the recorded tree");
420
422
  const root = join(dir, "module-ui-inspection");
421
423
  mkdirSync(root);
@@ -1824,3 +1826,28 @@ function matchesGatewayConfig(actual, manifest) {
1824
1826
  delete expected[key];
1825
1827
  return actual === JSON.stringify(expected) + '\n';
1826
1828
  }
1829
+ async function inspectMobile(dir, paths, record, info, findings) {
1830
+ const MOBILE_INVALID = 'MOBILE_INVALID';
1831
+ const hasRegistration = paths.has('ui/app/mobile.json');
1832
+ if (!record) {
1833
+ if (hasRegistration)
1834
+ findings.push(`${MOBILE_INVALID} mobile.json has no build declaration`);
1835
+ return;
1836
+ }
1837
+ try {
1838
+ const invalid = mobileRecordProblem(record);
1839
+ if (invalid)
1840
+ throw new Error(invalid);
1841
+ if (record.package !== info.package || record.version !== info.version)
1842
+ throw new Error('registration package or version differs from INFO');
1843
+ const target = join(dir, 'mobile-inspection');
1844
+ mkdirSync(target);
1845
+ await tar.x({ file: join(dir, 'package.tgz'), cwd: target, filter: path => path.replace(/^\.\//, '').startsWith('ui/app/') });
1846
+ const problem = inspectMobileFiles(join(target, 'ui/app'), record);
1847
+ if (problem)
1848
+ throw new Error(problem);
1849
+ }
1850
+ catch (error) {
1851
+ findings.push(`${MOBILE_INVALID} ${error.message}`);
1852
+ }
1853
+ }
@@ -1,3 +1,4 @@
1
+ import { type MobileDeclaration } from './mobile.js';
1
2
  import { type PackageDependencies } from "./package-dependencies.js";
2
3
  import { type InstallSettings } from './install-settings.js';
3
4
  import { type WebLaunchMode } from "../contract/web-launch.js";
@@ -120,6 +121,7 @@ export interface StandaloneManifest {
120
121
  integrations?: string[];
121
122
  /** `portal`: registers the DSM Application Portal entry; an administrator activates it. */
122
123
  portal?: PortalDeclaration;
124
+ mobile?: MobileDeclaration;
123
125
  /**
124
126
  * `ui: false`: a native identity_gateway App with no SDK window. Its one
125
127
  * main-menu icon and Package Center's Open both go to the gateway's web UI,
@@ -1,3 +1,4 @@
1
+ import { readMobile, mobileIconPath } from './mobile.js';
1
2
  import { daemonNoFileSdkProblem, daemonNoFileIdentityProblem, DAEMON_NOFILE_MIN_DSM, DAEMON_NOFILE_UNSUPPORTED, DAEMON_NOFILE_ACTIVATION_PROBLEM } from './daemon-nofile.js';
2
3
  import { readAllowedSecretFiles } from "../secret-files.js";
3
4
  import { readRegistry, registryFile } from '../ctl/registry.js';
@@ -73,6 +74,7 @@ export const KNOWN_FIELDS = new Set([
73
74
  "entry",
74
75
  "integrations",
75
76
  "portal",
77
+ "mobile",
76
78
  "console",
77
79
  "icon",
78
80
  "reproducible",
@@ -498,6 +500,21 @@ function readManifest(raw, c) {
498
500
  }
499
501
  const i18n = raw.i18n === undefined ? undefined : readI18n(raw.i18n, c);
500
502
  const icon = raw.icon === undefined ? undefined : readIcon(raw.icon, c);
503
+ let mobile;
504
+ if (raw.mobile !== undefined) {
505
+ try {
506
+ mobile = readMobile(raw.mobile);
507
+ if (mobile.entry === 'app' && (!ui || noWindow || raw.compose !== undefined))
508
+ c.fail('STANDALONE_MOBILE_INVALID', 'mobile.entry: app needs a UI');
509
+ if (mobile.entry === 'gateway' && !identityGateway)
510
+ c.fail('STANDALONE_MOBILE_INVALID', 'mobile.entry: gateway needs identity_gateway');
511
+ if (mobile.icon)
512
+ renderPackageIcons(mobileIconPath(c.root, mobile.icon));
513
+ }
514
+ catch (error) {
515
+ c.fail('STANDALONE_MOBILE_INVALID', error.message);
516
+ }
517
+ }
501
518
  if (capabilities.webapi && backend) {
502
519
  const sdk = sdkVersionOrUndefined(backend);
503
520
  if (!sdk ||
@@ -631,6 +648,7 @@ function readManifest(raw, c) {
631
648
  ...(entry ? { entry } : {}),
632
649
  ...(integrations?.length ? { integrations } : {}),
633
650
  ...(portal ? { portal } : {}),
651
+ ...(mobile ? { mobile } : {}),
634
652
  ...(dsmConsole ? { console: dsmConsole } : {}),
635
653
  ...(noWindow ? { sdkWindow: false } : {}),
636
654
  ...(icon ? { icon } : {}),
@@ -0,0 +1,50 @@
1
+ import type { StandaloneManifest } from './manifest.js';
2
+ export interface MobileDeclaration {
3
+ entry: 'app' | 'gateway';
4
+ name?: string;
5
+ icon?: string;
6
+ start?: string;
7
+ capabilities?: Array<'download' | 'open-external' | 'camera'>;
8
+ intake?: {
9
+ route: string;
10
+ accept: Array<{
11
+ kind: 'text';
12
+ } | {
13
+ kind: 'url';
14
+ schemes: string[];
15
+ } | {
16
+ kind: 'file';
17
+ types: string[];
18
+ max_bytes?: number;
19
+ }>;
20
+ };
21
+ status?: boolean;
22
+ min_shell?: number;
23
+ }
24
+ /** The editor and check use the same complete declaration, including reserved post-v1 fields. */
25
+ export declare function readMobile(value: unknown): MobileDeclaration;
26
+ export declare function mobileIconPath(root: string, path: string): string;
27
+ export interface MobileRecord {
28
+ declaration: MobileDeclaration;
29
+ package: string;
30
+ version: string;
31
+ build: string;
32
+ name: Record<string, string>;
33
+ portal?: {
34
+ defaultAlias: string;
35
+ };
36
+ gatewayEntry?: string;
37
+ files: Record<string, string>;
38
+ }
39
+ /** Replayed by inspect from the packaged declaration, rather than copied JSON. */
40
+ export declare function mobileRegistration(record: MobileRecord): Record<string, unknown>;
41
+ export interface MobileAssets {
42
+ build: string;
43
+ files: Map<string, Buffer>;
44
+ record: MobileRecord;
45
+ }
46
+ /** Pure packaging glue; login, cache, portal and host behavior stay in the bundled SDK. */
47
+ export declare function renderMobileAssets(manifest: StandaloneManifest, uiDigest: string, moduleVersion?: string): Promise<MobileAssets | undefined>;
48
+ /** Validate the replay inventory before using any of its paths. */
49
+ export declare function mobileRecordProblem(record: unknown): string | undefined;
50
+ export declare function inspectMobileFiles(root: string, record: MobileRecord): string | undefined;
@@ -0,0 +1,154 @@
1
+ import { Ajv } from 'ajv';
2
+ import { createHash } from 'node:crypto';
3
+ import { existsSync, readFileSync } from 'node:fs';
4
+ import { createRequire } from 'node:module';
5
+ import { isAbsolute, join, relative, resolve } from 'node:path';
6
+ import { build } from 'esbuild';
7
+ import { mobileIcons } from '../build-spk/dsm-icons.js';
8
+ import { appSdkTimeouts } from '../runtime/sdk-timeouts.js';
9
+ import { requestTimeoutSeconds } from './request-timeout.js';
10
+ import { MODULE_UI_ENTRY } from './ui-assets.js';
11
+ import { gatewayEntryPath } from './native-gateway.js';
12
+ import { CLI_VERSION } from '../cli-version.js';
13
+ import { isPortalAlias } from '../portal/alias.js';
14
+ const schema = JSON.parse(readFileSync(new URL('../../schema/mobile.v1.schema.json', import.meta.url), 'utf8'));
15
+ const ajv = new Ajv({ allErrors: true });
16
+ const validate = ajv.compile(schema);
17
+ /** The editor and check use the same complete declaration, including reserved post-v1 fields. */
18
+ export function readMobile(value) {
19
+ if (!validate(value))
20
+ throw new Error(`mobile ${ajv.errorsText(validate.errors)}`);
21
+ return value;
22
+ }
23
+ export function mobileIconPath(root, path) {
24
+ const rel = relative(root, resolve(root, path));
25
+ if (isAbsolute(path) || rel.startsWith('..') || isAbsolute(rel))
26
+ throw new Error('mobile.icon must stay inside the project');
27
+ return resolve(root, path);
28
+ }
29
+ /** Replayed by inspect from the packaged declaration, rather than copied JSON. */
30
+ export function mobileRegistration(record) {
31
+ const mobile = readMobile(record.declaration);
32
+ return {
33
+ schema: 1, package: record.package, version: record.version, build: record.build,
34
+ name: record.name, icon: `./icons/mobile-192.png?v=${record.build}`,
35
+ entry: mobile.entry === 'app' ? 'entry.html' : record.gatewayEntry,
36
+ ...(record.portal ? { portal: record.portal } : {}),
37
+ start: mobile.start ?? '/', capabilities: mobile.capabilities ?? [],
38
+ ...(mobile.intake ? { intake: mobile.intake } : {}), status: mobile.status ?? false, minShell: mobile.min_shell ?? 1,
39
+ };
40
+ }
41
+ const digest = (bytes) => createHash('sha256').update(bytes).digest('hex');
42
+ const json = (value) => JSON.stringify(value).replaceAll('<', '\\u003c');
43
+ const html = (value) => value.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('"', '&quot;');
44
+ function entryModule(manifest) {
45
+ const roots = [manifest.ui.build?.cwd, manifest.root].filter((x) => !!x);
46
+ for (const root of roots) {
47
+ for (const modules of createRequire(join(root, 'package.json')).resolve.paths('@synopackageland/sdk') ?? []) {
48
+ try {
49
+ const dir = join(modules, '@synopackageland/sdk');
50
+ const pkg = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8'));
51
+ const entry = pkg.exports?.['./entry'];
52
+ const path = typeof entry === 'string' ? entry : entry?.import;
53
+ if (typeof path === 'string' && path.startsWith('./') && existsSync(join(dir, path)))
54
+ return join(dir, path);
55
+ }
56
+ catch { /* Try the next installed package */ }
57
+ }
58
+ }
59
+ throw new Error('[MOBILE_SDK_ENTRY_MISSING] install @synopackageland/sdk with the /entry export in the UI build directory or project root');
60
+ }
61
+ /** Pure packaging glue; login, cache, portal and host behavior stay in the bundled SDK. */
62
+ export async function renderMobileAssets(manifest, uiDigest, moduleVersion) {
63
+ const mobile = manifest.mobile;
64
+ if (!mobile)
65
+ return undefined;
66
+ const icons = mobileIcons(mobile.icon ? mobileIconPath(manifest.root, mobile.icon) : manifest.icon);
67
+ const name = { en: mobile.name ?? manifest.displayname };
68
+ for (const [locale, text] of Object.entries(manifest.i18n?.info ?? {}))
69
+ if (text?.mobile_name || text?.displayname)
70
+ name[locale] = text.mobile_name ?? text.displayname;
71
+ const record = {
72
+ declaration: mobile, package: manifest.package, version: manifest.spkVersion, build: '', name,
73
+ ...(manifest.portal ? { portal: { defaultAlias: manifest.portal.alias } } : {}),
74
+ ...(mobile.entry === 'gateway' ? { gatewayEntry: gatewayEntryPath(manifest) } : {}), files: {},
75
+ };
76
+ const files = new Map();
77
+ for (const [size, png] of icons)
78
+ files.set(`icons/mobile-${size}.png`, png);
79
+ let runtime = '';
80
+ const requestTimeout = requestTimeoutSeconds(manifest.backend) * 1000 + appSdkTimeouts(manifest.backend).browserMarginMs;
81
+ if (mobile.entry === 'app') {
82
+ const result = await build({ entryPoints: [entryModule(manifest)], bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, legalComments: 'inline' });
83
+ runtime = result.outputFiles[0].text;
84
+ }
85
+ // Hash both runtime and declaration, as well as the original UI and all icons.
86
+ const hash = createHash('sha256').update(readFileSync(new URL(import.meta.url))).update(uiDigest).update(json(mobileRegistration(record))).update(runtime)
87
+ .update(json({ generator: CLI_VERSION, requestTimeout, messages: manifest.i18n?.catalogs }));
88
+ for (const [path, bytes] of files)
89
+ hash.update(path).update(bytes);
90
+ const version = hash.digest('hex');
91
+ if (mobile.entry === 'app') {
92
+ const appBundle = `${moduleVersion ? `./${moduleVersion}/${MODULE_UI_ENTRY}` : './app.js'}?v=${version}`;
93
+ const options = {
94
+ packageId: manifest.package, build: version, displayName: name.en,
95
+ appIcon: `./icons/mobile-192.png?v=${version}`, appBundle,
96
+ ...(manifest.portal ? { portal: { defaultAlias: manifest.portal.alias } } : {}),
97
+ requestTimeout,
98
+ ...(manifest.i18n?.catalogs ? { messages: manifest.i18n.catalogs } : {}),
99
+ };
100
+ // Classic bundles rely on document.currentScript.dataset.package; keep
101
+ // their script carrier rather than evaluating them as an ES module.
102
+ const loadApp = moduleVersion
103
+ ? `import(${json(appBundle)})`
104
+ : `new Promise((resolve,reject)=>{const script=document.createElement('script');script.src=new URL(${json(appBundle)},import.meta.url).href;script.dataset.package=${json(manifest.package)};script.onload=()=>resolve(window.DsmPackageApps?.[${json(manifest.package)}]);script.onerror=reject;document.head.appendChild(script)})`;
105
+ const source = `import {bootEntryPage} from ${json(entryModule(manifest))};\nbootEntryPage({...${json(options)},root:document.querySelector('.dsmapp-root'),mount:async(root,ctx)=>{const app=await ${loadApp};if(typeof app?.mount!=='function')throw new Error('The UI must export mount(root, ctx)');return app.mount(root,ctx)}});`;
106
+ const bundled = await build({ stdin: { contents: source, resolveDir: manifest.root, sourcefile: 'synopkgland-entry.generated.js' }, bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, plugins: [{ name: 'app-import', setup(api) { api.onResolve({ filter: /[?]v=/ }, args => ({ path: args.path, external: true })); } }], legalComments: 'inline' });
107
+ files.set('entry.js', Buffer.from(bundled.outputFiles[0].text));
108
+ const context = await build({ stdin: { contents: `export {createAppContext} from ${json(entryModule(manifest))}`, resolveDir: manifest.root, sourcefile: 'synopkgland-context.generated.js' }, bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, legalComments: 'inline' });
109
+ files.set('entry-context.js', Buffer.from(context.outputFiles[0].text));
110
+ const css = moduleVersion ? `./${moduleVersion}/app.css` : './app.css';
111
+ files.set('entry.html', Buffer.from(`<!doctype html>\n<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"><meta name="synopkgland-build" content="${version}"><title>${html(name.en)}</title><link rel="icon" href="./icons/mobile-192.png?v=${version}"><link rel="stylesheet" href="${css}?v=${version}"><style>html,body,.dsmapp-root{margin:0;height:100%;min-height:100%}</style></head><body><div class="dsmapp-root"></div><script type="module" src="./entry.js?v=${version}"></script></body></html>\n`));
112
+ }
113
+ record.build = version;
114
+ const registered = mobileRegistration(record);
115
+ files.set('mobile.json', Buffer.from(JSON.stringify(registered, null, 2) + '\n'));
116
+ record.files = Object.fromEntries([...files].map(([path, bytes]) => [path, digest(bytes)]));
117
+ return { build: version, files, record };
118
+ }
119
+ /** Validate the replay inventory before using any of its paths. */
120
+ export function mobileRecordProblem(record) {
121
+ const r = record;
122
+ if (!r || typeof r !== 'object' || !r.files || typeof r.files !== 'object' || !r.name || typeof r.name !== 'object' || !r.name.en || Object.values(r.name).some(name => typeof name !== 'string'))
123
+ return 'invalid build record';
124
+ try {
125
+ readMobile(r.declaration);
126
+ }
127
+ catch {
128
+ return 'invalid mobile declaration';
129
+ }
130
+ if (typeof r.build !== 'string' || !/^[a-f0-9]{64}$/.test(r.build))
131
+ return 'invalid registration build';
132
+ if (r.declaration.entry === 'gateway' && ![`/webman/3rdparty/${r.package}/sso/open.cgi`, `/webman/3rdparty/${r.package}/sso/open.html`].includes(r.gatewayEntry ?? ''))
133
+ return 'invalid gateway entry';
134
+ if (r.portal && !isPortalAlias(r.portal.defaultAlias))
135
+ return 'invalid portal alias';
136
+ if (!r.files['mobile.json'] || !r.files['icons/mobile-192.png'] || !r.files['icons/mobile-512.png'] || (r.declaration.entry === 'app' && (!r.files['entry.html'] || !r.files['entry.js'] || !r.files['entry-context.js'])))
137
+ return 'missing registration or icon inventory';
138
+ for (const [path, hash] of Object.entries(r.files))
139
+ if (!/^(entry\.(?:html|js)|entry-context\.js|mobile\.json|icons\/mobile-(?:192|512)\.png)$/.test(path) || typeof hash !== 'string' || !/^[a-f0-9]{64}$/.test(hash))
140
+ return 'invalid asset inventory';
141
+ return undefined;
142
+ }
143
+ export function inspectMobileFiles(root, record) {
144
+ const invalid = mobileRecordProblem(record);
145
+ if (invalid)
146
+ return invalid;
147
+ for (const [path, hash] of Object.entries(record.files)) {
148
+ if (!existsSync(join(root, path)) || digest(readFileSync(join(root, path))) !== hash)
149
+ return `${path} differs from the generated build`;
150
+ }
151
+ if (JSON.stringify(JSON.parse(readFileSync(join(root, 'mobile.json'), 'utf8'))) !== JSON.stringify(mobileRegistration(record)))
152
+ return 'mobile.json differs from its declaration';
153
+ return undefined;
154
+ }
@@ -52,12 +52,23 @@ export function sdkProblems(backend, frontendDir, needsSdk, cliVersion = CLI_VER
52
52
  }
53
53
  return problems;
54
54
  }
55
- /** The SDK the frontend depends on: a version, or a file: checkout read through its package.json. */
55
+ /** Resolve tilde pins from installed bytes or a matching lockfile; file: reads its package.json. */
56
56
  function frontendSdkVersion(frontendDir) {
57
57
  const pkg = readJson(join(frontendDir, "package.json"));
58
58
  const spec = pkg?.dependencies?.[SDK_PACKAGE] ?? pkg?.devDependencies?.[SDK_PACKAGE];
59
59
  if (typeof spec !== "string")
60
60
  return undefined;
61
+ const tilde = /^~(\d+)\.(\d+)\.(\d+)$/.exec(spec);
62
+ if (tilde) {
63
+ const installed = readJson(join(frontendDir, "node_modules", SDK_PACKAGE, "package.json"));
64
+ const lock = readJson(join(frontendDir, "package-lock.json"));
65
+ const declared = lock?.packages?.[""];
66
+ const lockedSpec = declared?.dependencies?.[SDK_PACKAGE] ?? declared?.devDependencies?.[SDK_PACKAGE];
67
+ const version = installed?.version ?? (lockedSpec === spec ? lock?.packages?.[`node_modules/${SDK_PACKAGE}`]?.version : undefined);
68
+ const resolved = typeof version === "string" ? /^(\d+)\.(\d+)\.(\d+)$/.exec(version) : null;
69
+ return { spec, version: resolved && resolved[1] === tilde[1] && resolved[2] === tilde[2] &&
70
+ Number(resolved[3]) >= Number(tilde[3]) ? version : undefined };
71
+ }
61
72
  if (!spec.startsWith("file:"))
62
73
  return { spec, version: spec };
63
74
  const version = readJson(join(resolve(frontendDir, spec.slice("file:".length)), "package.json"))?.version;
@@ -1,3 +1,4 @@
1
+ import { renderMobileAssets } from './mobile.js';
1
2
  import { requireDaemonNoFileActivation } from "./daemon-nofile.js";
2
3
  import { gatewayIngressOwnershipSupported } from './gateway-ingress.js';
3
4
  import { portDefaults, portInstallSteps, writePortPayload } from "./install-ports.js";
@@ -90,7 +91,8 @@ export async function assembleStandaloneSpk(options) {
90
91
  mkdirSync(appDir, { recursive: true });
91
92
  const moduleUi = hasSdkWindow(manifest) && existsSync(join(appDir, MODULE_UI_ENTRY));
92
93
  const uiDigest = uiTreeDigest(appDir, moduleUi);
93
- const assetVersion = uiDigest.slice(0, 12);
94
+ const mobile = await renderMobileAssets(manifest, uiDigest, moduleUi ? uiDigest : undefined);
95
+ const assetVersion = mobile?.build ?? uiDigest.slice(0, 12);
94
96
  const moduleVersion = moduleUi ? uiDigest : undefined;
95
97
  if (moduleVersion) {
96
98
  const snapshot = join(uiRoot, "app-snapshot");
@@ -98,6 +100,8 @@ export async function assembleStandaloneSpk(options) {
98
100
  mkdirSync(appDir);
99
101
  renameSync(snapshot, join(appDir, moduleVersion));
100
102
  }
103
+ for (const [path, bytes] of mobile?.files ?? [])
104
+ writeFile(join(appDir, path), bytes);
101
105
  const login = manifest.portal
102
106
  ? loginStyleAssets(manifest.loginStyle)
103
107
  : undefined;
@@ -260,6 +264,7 @@ export async function assembleStandaloneSpk(options) {
260
264
  .digest("hex");
261
265
  writeFile(join(staging, "sdk-package.json"), JSON.stringify({
262
266
  schema: 2,
267
+ ...(mobile ? { mobile: mobile.record } : {}),
263
268
  dependencies: packageDependencies(manifest),
264
269
  ...(moduleVersion ? { ui_module: moduleVersion } : {}),
265
270
  ...(manifest.installSettings ? { installSettings: manifest.installSettings } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.48.24",
3
+ "version": "0.49.1",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,9 +39,10 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@napi-rs/keyring": "^2.1.1",
42
- "@synopackageland/templates": "~0.40.0",
42
+ "@synopackageland/templates": "~0.41.1",
43
43
  "ajv": "^8.17.1",
44
44
  "commander": "^13.1.0",
45
+ "esbuild": "^0.28.2",
45
46
  "json-canonicalize": "^3.0.1",
46
47
  "re2js": "2.9.1",
47
48
  "tar": "^7.4.3",
@@ -1112,18 +1112,18 @@
1112
1112
  "sourceAudit": {
1113
1113
  "build-spk/share-combobox.ts": "797cd3eea347e7fe57946f9584f725d6faef79fe9c56b690e1199ea7489fa973",
1114
1114
  "build-spk/share-validation.ts": "a51b160cea9bea096e6efb45879abbf6d0dfecf21c761dca7cd06647d44cef62",
1115
- "cli.ts": "9c93b2e61971fa57167cb9a7b7e7917c953b7ee09d382ad5af648e140110c421",
1115
+ "cli.ts": "d45c74e012a6953ad17cd0135f97f3ba98b37d4ff8b2fb60ef0a894f15ce0d64",
1116
1116
  "ctl/cli.ts": "a582aff3a048c14884b4ffae03efdb50142ca7d769feae97f0f9b0d11d66d6da",
1117
- "ctl/external.ts": "b2da38ba89fcda1a82cf5caeaa2a3e6e2bf8a340600d1b6a41238eab9bf29147",
1117
+ "ctl/external.ts": "f66490ded838f934a0cf373f284418d4d02441edc8c8365066fc45b898ba81dc",
1118
1118
  "ctl/flows.ts": "76a7b8c2e3991687e693797b7e02aae5c7e35d9a2f07220f1d223354c38e3469",
1119
- "ctl/service.ts": "97bb151b02d9a5925c078ee1daad0aad676d22574a889af82a2dd05f88b2eb5e",
1119
+ "ctl/service.ts": "c5bb01257db9f65f31db3fcd3d0b78c4a84a967cb96de43fa587934ea175826c",
1120
1120
  "deploy/deploy.ts": "3f593232e8e95d029f1389d16a13127baf51ef1f381211d8be2fde5c46759f1b",
1121
1121
  "deploy/identity.ts": "4822596d8b6e170f8aa4293bd877eb27bc549cb16f720b364e543d8037bd8071",
1122
1122
  "deploy/plan.ts": "1f772811ca963bdf863462a256d8e810c151e096a55a91a753bd5bf855921536",
1123
1123
  "deploy/spk-version.ts": "407a79491ffac8d00ecb9b056ab0b352e08bf6142871fa46f302fd217f98fc24",
1124
1124
  "e2e/certificates.ts": "e9801e5f4d326d31c3c281e5106f34138493e26cd7f0ad2b1dd3f6a566832389",
1125
- "e2e/dsm.ts": "407fa489a7fa44a5fa851e4acc019acec582dd3bb02fa4f0e4c6f2f82d1d92da",
1126
- "error-registry.ts": "4c34a6e4c229ddc067a8ca9344cdd52b64a9a6352570600657260d6a55967125",
1125
+ "e2e/dsm.ts": "66c9b3f6d907a8069202c5f88f13f8051c07b099de66d3ebce5de51c6374201f",
1126
+ "error-registry.ts": "ca7e717532a97d1bcd3a27018c2f036e8b19691338679f2651e49cf7e19e6e57",
1127
1127
  "host/catalog-install.ts": "df27409d835a901658dae7c2048c9028c2dc886e17575fe9189e88ae705c0fd2",
1128
1128
  "host/compose-project-recovery.ts": "c76efa505f8ba14f50a8705b63d0f9f8a022b70505fe6a5f5976146afae17532",
1129
1129
  "host/container-pull.ts": "d85314dd265f7609ab1fda87e23cce0fa81165baeeaf79a792d7bb6dc10338e3",
@@ -1152,7 +1152,7 @@
1152
1152
  "runtime/operation-budget.ts": "126a43530d9c659f2667ba10b2c7f718373f1e6a3b97374c2eaa8b75b942ce06",
1153
1153
  "runtime/sdk-timeouts.ts": "1b56ac9717d10d604b110120149e363b5bcb57218796acf98a64b6b4fba68339",
1154
1154
  "standalone/install-ports.ts": "1b317071803f127b600a5324ac7952d28db9910af25210f139bbf430a3c135ee",
1155
- "standalone/manifest.ts": "cd386c0d54129f61d9f20aaf919d7d8cc63061ce5ef120553c1cd31ff3ddb077",
1155
+ "standalone/manifest.ts": "09682c938fb308df95c2da0dfac88578c54237b9fb38b98d0a950f9da4f0407b",
1156
1156
  "standalone/portal-window.ts": "bc0a16a73ff4de4acee5f5820dbad48c709a6c53d48670a98d8b23f9009650c9",
1157
1157
  "standalone/root-window.ts": "2b3f8f3dd1c77963d9485b16739a953ecedf2019939b4b5b608cd7ac61232231"
1158
1158
  },
@@ -16,7 +16,8 @@
16
16
  "pattern": "^(?![\\s\\S]*(?:^|/)\\.{1,2}(?:/|$))[^/\\\\*?\\[\\]{}:\\u0000-\\u001f\\u007f]+(?:/[^/\\\\*?\\[\\]{}:\\u0000-\\u001f\\u007f]+)*$(?![\\s\\S])"
17
17
  }
18
18
  },
19
- "identity_gateway": {"$ref": "identity-gateway.v1.schema.json"}
19
+ "identity_gateway": {"$ref": "identity-gateway.v1.schema.json"},
20
+ "mobile": {"$ref": "mobile.v1.schema.json"}
20
21
  },
21
22
  "additionalProperties": true
22
23
  }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "mobile.v1.schema.json",
4
+ "title": "Mobile registration",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["entry"],
8
+ "properties": {
9
+ "entry": {"enum": ["app", "gateway"]},
10
+ "name": {"type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[^\\u0000-\\u001f\\u007f]+$"},
11
+ "icon": {"type": "string", "minLength": 1},
12
+ "start": {"$ref": "#/definitions/route"},
13
+ "capabilities": {"type": "array", "uniqueItems": true, "items": {"enum": ["download", "open-external", "camera"]}},
14
+ "intake": {
15
+ "type": "object", "additionalProperties": false, "required": ["route", "accept"],
16
+ "properties": {
17
+ "route": {"$ref": "#/definitions/route"},
18
+ "accept": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"oneOf": [
19
+ {"type": "object", "additionalProperties": false, "required": ["kind"], "properties": {"kind": {"const": "text"}}},
20
+ {"type": "object", "additionalProperties": false, "required": ["kind", "schemes"], "properties": {
21
+ "kind": {"const": "url"}, "schemes": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "pattern": "^[a-z][a-z0-9+.-]*$"}}
22
+ }},
23
+ {"type": "object", "additionalProperties": false, "required": ["kind", "types"], "properties": {
24
+ "kind": {"const": "file"}, "types": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "pattern": "^(?:[a-zA-Z0-9!#$&^_.+-]+/(?:[a-zA-Z0-9!#$&^_.+-]+|\\*)|\\.[a-zA-Z0-9][a-zA-Z0-9._+-]*)$"}},
25
+ "max_bytes": {"type": "integer", "minimum": 1, "maximum": 8388608}
26
+ }}
27
+ ]}}
28
+ }
29
+ },
30
+ "status": {"type": "boolean"},
31
+ "min_shell": {"type": "integer", "minimum": 1}
32
+ },
33
+ "definitions": {"route": {"type": "string", "pattern": "^/(?!/)[^\\u0000-\\u0020\\u007f\\\\]*$"}}
34
+ }
package/skills/SKILL.md CHANGED
@@ -5,6 +5,9 @@ description: Initialize, extend, check, build, inspect, and deploy Synology appl
5
5
 
6
6
  # Independent Synology SPKs
7
7
 
8
+ For mobile registration, entry pages and native-shell capabilities, read
9
+ [reference/mobile.md](reference/mobile.md).
10
+
8
11
  Keep own-App local secrets in root `.env`, protected by the generated
9
12
  `.gitignore`. Upstream forks use `synology/.env`, never the fork root.
10
13
  Commit only `.env.example`. Run `synopkgland check`: tracked secrets inside the
@@ -0,0 +1,68 @@
1
+ # Mobile Apps
2
+
3
+ Declare `mobile` in `dsm-package.yaml`. Both `admin-only` and `app-privilege`
4
+ Apps may register. DSM entry and backend permissions still apply to every request.
5
+ A portal is optional; without it the App stays on its entry URL.
6
+
7
+ ```yaml
8
+ mobile:
9
+ entry: app
10
+ name: Download Hub
11
+ # icon: assets/mobile.png # package icon by default
12
+ start: /
13
+ capabilities: [download, open-external]
14
+ intake:
15
+ route: /add
16
+ accept:
17
+ - {kind: url, schemes: [http, https, magnet, ed2k]}
18
+ - {kind: text}
19
+ - {kind: file, types: [application/x-bittorrent, .torrent], max_bytes: 524288}
20
+ status: false
21
+ min_shell: 1
22
+ ```
23
+
24
+ `entry: app` requires an SDK UI exporting `mount(root, ctx)` as `app.module.js`,
25
+ or a classic `app.js` registering `window.DsmPackageApps[packageId]`.
26
+ Install the current `@synopackageland/sdk` with its `/entry` export in the UI
27
+ build directory or project root. The CLI bundles this installed SDK into `entry.js`; the NAS
28
+ never loads npm or a CDN. Plain UI Apps can install the SDK at the project root.
29
+ Run the normal UI build before `synopkgland check` and `synopkgland build`.
30
+
31
+ `entry: gateway` requires `identity_gateway` and registers the existing gateway
32
+ entry URL for upstream UIs that support phones. It generates registration and
33
+ icons; it keeps the gateway's sign-in flow and does not generate an SDK entry page.
34
+
35
+ `name` defaults to `displayname`. Localize it with
36
+ `i18n.info.<locale>.mobile_name`; localized `displayname` is the fallback.
37
+ `icon` follows the package icon rules: a square PNG of at least 256 px, or a
38
+ directory with `icon_256.png`. Build generates 192 and 512 px mobile PNGs.
39
+ `start` and `intake.route` must be local routes beginning with a single `/`.
40
+ Capabilities are `download`, `open-external`, and `camera`. Intake accepts `url`
41
+ (with schemes), `text`, and `file` (with MIME types or extensions). Optional file
42
+ `max_bytes` must be between 1 and 8 MiB. Unknown fields, kinds and capabilities fail
43
+ check. `status` is accepted for the later launcher-status protocol; v1 does not
44
+ invoke it. `min_shell` is a positive integer, default 1.
45
+
46
+ Build writes `ui/app/mobile.json`, mobile icons and, for SDK Apps, `entry.html`
47
+ and bundled `entry.js` into the SPK only. The generated DSM window loads
48
+ `entry-context.js` and passes its existing session, host and privileged adapters
49
+ to the same SDK context builder. One immutable content hash appears in
50
+ the entry build meta tag, `bootEntryPage.build`, registration, and every generated
51
+ entry script, stylesheet and icon URL. Module UI assets retain their immutable
52
+ snapshot directory. The generated `bootEntryPage.appBundle` is the exact URL
53
+ loaded by `mount`, including its build query. SDK boot preloads same-origin App
54
+ assets while token/identity requests run; App execution still waits for verified
55
+ identity. Classic bundles retain their script carrier and package dataset.
56
+ SDK boot owns token acquisition, non-aborting hedges, portal
57
+ probing, language fallback and the package-specific identity cache.
58
+
59
+ App-owned `app.status` should use SDK Go `api.AppStatusHandler`, registered via
60
+ `api.HandleRequest`, or return `package`, `version`, `user`, `admin`, `lang` and
61
+ `locale`. Supply trusted DSM language hints when available. Empty hints use the
62
+ browser locale; generated Go handlers include these fallback fields.
63
+
64
+ Run `synopkgland inspect dist/<package>-<version>-<arch>.spk`. It replays the
65
+ recorded registration and asset digests; a changed or missing `mobile.json`,
66
+ entry page, bundle or icon produces `MOBILE_INVALID`. This checks build consistency,
67
+ not authenticity of an unsigned SPK. The mobile shell discovers the registration;
68
+ real-device and APK validation are separate from CLI checks.