@synopackageland/cli 0.54.0 → 0.54.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,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.54.1 (2026-11-14)
4
+
5
+ - `identity_gateway.upstream: unix:<name>.sock` points the gateway at the App's private SDK IPC socket (`/var/packages/<package>/var/run/<name>.sock`, dialed with the SDK's package-socket checks), so an App can expose one App-authenticated route, such as a WebSocket, under DSM's own origin with no TCP port and no TCP listener. It needs `ingress`, no `listen`, no Compose and an SDK whose `idgateway` has `UnixUpstreamVersion = 1` (checked at `check` and `build`). The gateway binary now also binds `ipc.packageID`.
6
+ - On an App with an SDK window, a unix-upstream gateway is ingress only (`mode: none`): the DSM window, launcher type, default launch mode, Package Center Open, portal and mobile entry stay as without the gateway, and the smoke entry stays the window. The gateway daemon, the native ingress web-config location (WebSocket headers, 3600 s read timeout), `ingress-check` and the mTLS socket are still generated. `console` and `mobile.entry: gateway` are refused with it.
7
+
3
8
  ## 0.54.0 (2026-11-14)
4
9
 
5
10
  - `init` defaults to native-go with Vue. Explicit `-t` still selects any of the six templates.
@@ -7,7 +7,7 @@ export declare function isAppLaunchMode(value: unknown): value is AppLaunchMode;
7
7
  /** Both Compose routes use the same web default; a valid explicit choice wins. */
8
8
  export declare function resolveAppLaunch(value: unknown, webService: boolean): AppLaunchMode | undefined;
9
9
  /** A console always opens the SDK UI in a DSM window. */
10
- export declare function resolvedSdkLaunch(manifest: Pick<StandaloneManifest, 'ui' | 'compose' | 'identityGateway'> & {
10
+ export declare function resolvedSdkLaunch(manifest: Pick<StandaloneManifest, 'ui' | 'compose' | 'identityGateway' | 'sdkWindow'> & {
11
11
  console?: unknown;
12
12
  }): AppLaunchMode;
13
13
  /** DSM rewrites standalone URLs to launchApp; only SDK wrappers provide that class. */
@@ -1,3 +1,4 @@
1
+ import { gatewayIngressOnly } from '../standalone/gateway-ingress-only.js';
1
2
  export const APP_LAUNCH_MODES = ['dsm-window', 'new-page'];
2
3
  export const DEFAULT_NATIVE_LAUNCH = 'dsm-window';
3
4
  export const DEFAULT_WEB_LAUNCH = 'new-page';
@@ -11,7 +12,7 @@ export function resolveAppLaunch(value, webService) {
11
12
  }
12
13
  /** A console always opens the SDK UI in a DSM window. */
13
14
  export function resolvedSdkLaunch(manifest) {
14
- return resolveAppLaunch(manifest.console ? 'dsm-window' : manifest.ui.launch, Boolean(manifest.compose || manifest.identityGateway));
15
+ return resolveAppLaunch(manifest.console ? 'dsm-window' : manifest.ui.launch, Boolean(manifest.compose || manifest.identityGateway && !gatewayIngressOnly(manifest)));
15
16
  }
16
17
  /** DSM rewrites standalone URLs to launchApp; only SDK wrappers provide that class. */
17
18
  export function dsmLauncherType(launch, sdkWindow) {
@@ -1,6 +1,7 @@
1
1
  import { gatewayIngressPathProblem } from '../standalone/gateway-ingress.js';
2
2
  import { readFileSync } from 'node:fs';
3
3
  import { parse } from 'yaml';
4
+ import { unixUpstreamSocket } from '../standalone/gateway-ingress-only.js';
4
5
  import { resolveAppLaunch } from '../contract/app-launch.js';
5
6
  import { trustedAppEntryPath } from '../contract/web-launch.js';
6
7
  import { readDaemonIngress } from '../standalone/daemon-ingress.js';
@@ -19,7 +20,9 @@ export function deriveSmokeEntry(raw, entry) {
19
20
  }
20
21
  const native = raw.schema === 2;
21
22
  const gateway = raw.identity_gateway;
22
- const web = Boolean(gateway || raw.compose || (!native && raw.adminport));
23
+ // A unix-upstream gateway on an SDK-window App is ingress only: the window stays the entry.
24
+ const ingressOnly = Boolean(unixUpstreamSocket(gateway?.upstream) && !raw.compose && raw.ui !== false);
25
+ const web = Boolean((gateway && !ingressOnly) || raw.compose || (!native && raw.adminport));
23
26
  if ((!native && !raw.adminport) || (raw.ui === false && !gateway))
24
27
  throw new Error('This package has no app entry to smoke test.');
25
28
  const appId = native ? `SYNO.SDS.${raw.package}.Instance` : raw.package;
@@ -33,7 +36,7 @@ export function deriveSmokeEntry(raw, entry) {
33
36
  const gatewayIngress = gateway?.ingress && !gatewayIngressPathProblem(raw.package, gateway.ingress.path) ? gateway.ingress : undefined;
34
37
  if (gateway?.ingress !== undefined && !gatewayIngress)
35
38
  throw new Error("Invalid gateway ingress namespace");
36
- const derived = ingress?.path ?? gatewayIngress?.path ?? (gateway
39
+ const derived = ingress?.path ?? (ingressOnly ? undefined : gatewayIngress?.path) ?? (gateway && !ingressOnly
37
40
  ? `/webman/3rdparty/${raw.package}/sso/open.cgi`
38
41
  : native ? `/?launchApp=${encodeURIComponent(appId)}`
39
42
  : trustedAppEntryPath(raw));
@@ -1,6 +1,7 @@
1
1
  import { renderExecutorApproval } from './executor-approval.js';
2
2
  import { CALL_RETRY_RUNTIME } from './call-retry.js';
3
3
  import { oidcResumeRuntime } from "./oidc-resume.js";
4
+ import { gatewayIngressOnly } from './gateway-ingress-only.js';
4
5
  import { gatewayEntryPath } from './native-gateway.js';
5
6
  import { resolvedSdkLaunch, dsmLauncherType } from "../contract/app-launch.js";
6
7
  import { REOPEN_EVENTS_RUNTIME } from "./reopen-events.js";
@@ -124,7 +125,7 @@ export function windowAppId(manifest) {
124
125
  }
125
126
  /** Whether the window itself resumes a cold DSM sign-in; with a console the url launcher does. */
126
127
  function windowResumesOIDC(manifest) {
127
- return Boolean(manifest.identityGateway && !manifest.console);
128
+ return Boolean(manifest.identityGateway && !manifest.console && !gatewayIngressOnly(manifest));
128
129
  }
129
130
  /**
130
131
  * `ui/config`: registers the DSM main-menu app and its window class. With a
@@ -0,0 +1,15 @@
1
+ export declare const unixUpstreamSocket: (upstream: unknown) => string | undefined;
2
+ /**
3
+ * An SDK-window App whose gateway only carries path ingress (a unix upstream
4
+ * for the App's own WebSocket route). The gateway is infrastructure there: it
5
+ * never launches a web UI, so the DSM window, menu, Package Center Open,
6
+ * portal and mobile entry stay exactly as without the gateway. A unix
7
+ * upstream is new, so no existing App is inferred ingress-only.
8
+ */
9
+ export declare function gatewayIngressOnly(m: {
10
+ compose?: unknown;
11
+ sdkWindow?: false;
12
+ identityGateway?: {
13
+ upstream: number | string;
14
+ };
15
+ }): boolean;
@@ -0,0 +1,13 @@
1
+ /** `unix:<name>.sock`: a direct socket name; the gateway dials /var/packages/<package>/var/run/<name>.sock. */
2
+ const UNIX_UPSTREAM = /^unix:([a-z0-9][a-z0-9-]{0,58}\.sock)$/;
3
+ export const unixUpstreamSocket = (upstream) => typeof upstream === "string" ? UNIX_UPSTREAM.exec(upstream)?.[1] : undefined;
4
+ /**
5
+ * An SDK-window App whose gateway only carries path ingress (a unix upstream
6
+ * for the App's own WebSocket route). The gateway is infrastructure there: it
7
+ * never launches a web UI, so the DSM window, menu, Package Center Open,
8
+ * portal and mobile entry stay exactly as without the gateway. A unix
9
+ * upstream is new, so no existing App is inferred ingress-only.
10
+ */
11
+ export function gatewayIngressOnly(m) {
12
+ return Boolean(m.identityGateway && unixUpstreamSocket(m.identityGateway.upstream) && !m.compose && m.sdkWindow !== false);
13
+ }
@@ -63,8 +63,8 @@ export interface IdentityGateway {
63
63
  groups?: string[];
64
64
  max_upload_bytes?: number;
65
65
  response_header_timeout_seconds?: number;
66
- /** The App's loopback port. */
67
- upstream: number;
66
+ /** The App's loopback port, or `unix:<name>.sock`: its private SDK IPC socket under var/run. */
67
+ upstream: number | string;
68
68
  listen: {
69
69
  http?: number;
70
70
  https?: number;
@@ -6,7 +6,8 @@ import { existsSync, lstatSync, readFileSync } from "node:fs";
6
6
  import { join } from "node:path";
7
7
  import { PINNED_GO_HINT, pinnedGoBuildEnv, pinnedGoProblem, } from "../build-spk/go-toolchain.js";
8
8
  import { goChildEnv } from "../runtime/go-env.js";
9
- import { sdkSource } from "../runtime/sdk-source.js";
9
+ import { unixUpstreamSocket } from "./gateway-ingress-only.js";
10
+ import { SDK_MODULE, sdkSource } from "../runtime/sdk-source.js";
10
11
  import { checkCgiBinary } from "./binary.js";
11
12
  import { isWebAccessMode, DSM_GROUP_NAME, } from "../contract/web-launch.js";
12
13
  import { relativeExec, runtimeBudgetSource, token } from "./daemon.js";
@@ -59,6 +60,10 @@ function secureContextSdkSupported(dir) {
59
60
  const source = join(dir, "idgateway/secure_context.go");
60
61
  return existsSync(source) && /const SecureContextVersion = 1\b/.test(readFileSync(source, "utf8"));
61
62
  }
63
+ function unixUpstreamSdkSupported(dir) {
64
+ const source = join(dir, "idgateway/unix_upstream.go");
65
+ return existsSync(source) && /const UnixUpstreamVersion = 1\b/.test(readFileSync(source, "utf8"));
66
+ }
62
67
  function upstreamAuthSdkSupported(dir) {
63
68
  const source = join(dir, "idgateway/upstream_auth.go");
64
69
  return existsSync(source) && /const UpstreamAuthPathsVersion = 1\b/.test(readFileSync(source, "utf8"));
@@ -264,8 +269,26 @@ export function readIdentityGateway(value, daemon, fail, packagedPayload = false
264
269
  v.mode !== "header" &&
265
270
  v.mode !== "token")
266
271
  return invalid("mode must be none, oidc, header or token.");
267
- if (!port(v.upstream))
268
- return invalid("upstream must be the App's loopback port.");
272
+ const unixSocket = unixUpstreamSocket(v.upstream);
273
+ if (typeof v.upstream === "string") {
274
+ if (!unixSocket)
275
+ return invalid("upstream must be the App's loopback port or unix:<name>.sock (lowercase letters, digits and hyphens, at most 59 characters before .sock).");
276
+ if (composeBridge)
277
+ return invalid("a unix upstream cannot be combined with compose.");
278
+ if (v.ingress === undefined)
279
+ return invalid("a unix upstream requires ingress: the gateway has no TCP listener to serve it.");
280
+ if (record(v.listen) && Object.keys(v.listen).length)
281
+ return invalid("a unix upstream cannot combine with listen ports; use ingress only.");
282
+ try {
283
+ if (!unixUpstreamSdkSupported(sdkSource(v.sdk).goDir))
284
+ return invalid("The selected SDK lacks unix upstream support (UnixUpstreamVersion); use a matching SDK release or an explicit development source override.");
285
+ }
286
+ catch {
287
+ return invalid("The SDK unix upstream source is unavailable; use matching SDK sources.");
288
+ }
289
+ }
290
+ else if (!port(v.upstream))
291
+ return invalid("upstream must be the App's loopback port or unix:<name>.sock.");
269
292
  const ingress = v.ingress;
270
293
  if (ingress !== undefined && (!record(ingress) || !only(ingress, ["path"]) || typeof ingress.path !== "string" || gatewayIngressPathProblem(undefined, ingress.path) !== undefined))
271
294
  return invalid(gatewayIngressPathProblem(undefined, record(ingress) ? ingress.path : undefined) ?? "ingress accepts only {path: /my-app/}.");
@@ -281,7 +304,7 @@ export function readIdentityGateway(value, daemon, fail, packagedPayload = false
281
304
  const ports = [
282
305
  listen.http,
283
306
  listen.https,
284
- ...(composeBridge ? [] : [v.upstream]),
307
+ ...(composeBridge || unixSocket ? [] : [v.upstream]),
285
308
  issuer,
286
309
  ].filter((p) => p !== undefined);
287
310
  if (new Set(ports).size !== ports.length ||
@@ -527,7 +550,9 @@ export function identityGatewayConfig(m) {
527
550
  : {}),
528
551
  upstream: m.compose?.plan.ingress
529
552
  ? `http://${m.compose.plan.ingress.address}:${m.compose.plan.ingress.port}`
530
- : `http://127.0.0.1:${g.upstream}`,
553
+ : unixUpstreamSocket(g.upstream)
554
+ ? `unix:/var/packages/${m.package}/var/run/${unixUpstreamSocket(g.upstream)}`
555
+ : `http://127.0.0.1:${g.upstream}`,
531
556
  ...(m.compose?.plan.ingress
532
557
  ? { compose_ingress: { candidate: m.compose.plan.ingress.candidate } }
533
558
  : {}),
@@ -598,6 +623,8 @@ export async function buildIdentityGateway(m, arch, work, run) {
598
623
  runtimeBudgetSource(sdk.goDir, m);
599
624
  if (m.identityGateway.secure_context && !secureContextSdkSupported(sdk.goDir))
600
625
  throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "secure_context requires an SDK with HTTPS guidance support; upgrade the selected SDK and use matching SDK sources.");
626
+ if (unixUpstreamSocket(m.identityGateway.upstream) && !unixUpstreamSdkSupported(sdk.goDir))
627
+ throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "The selected SDK lacks unix upstream support (UnixUpstreamVersion); use a matching SDK release or an explicit development source override.");
601
628
  if (m.identityGateway.upstream_auth_paths && !upstreamAuthSdkSupported(sdk.goDir))
602
629
  throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "The selected SDK lacks upstream_auth_paths and its build-bound entry policy; use matching SDK sources.");
603
630
  if (gatewayExternalAccess(m.identityGateway)) {
@@ -637,7 +664,7 @@ export async function buildIdentityGateway(m, arch, work, run) {
637
664
  const policyFlag = upstreamAuthSdkSupported(sdk.goDir)
638
665
  ? ` -X github.com/synopackageland/syno-pkg-land-sdk/idgateway.expectedEntryPolicyDigest=${gatewayEntryPolicyDigest(JSON.parse(identityGatewayConfig(m)))}`
639
666
  : "";
640
- const ldflags = `-s -w -buildid= -X main.configPath=${packageDest(m)}/${GATEWAY_CONFIG_PATH}${policyFlag}`;
667
+ const ldflags = `-s -w -buildid= -X main.configPath=${packageDest(m)}/${GATEWAY_CONFIG_PATH} -X ${SDK_MODULE}/ipc.packageID=${m.package}${policyFlag}`;
641
668
  const result = await run("go", [
642
669
  "build",
643
670
  "-trimpath",
@@ -31,6 +31,7 @@ import { daemonSdkVersion, readDaemon, readLifecycleTimeouts } from "./daemon.js
31
31
  import { daemonRestartSdkProblem } from "./daemon-restart.js";
32
32
  import { daemonIngressMinDsmProblem } from "./daemon-ingress.js";
33
33
  import { readIdentityGateway, } from "./identity-gateway.js";
34
+ import { gatewayIngressOnly, unixUpstreamSocket } from "./gateway-ingress-only.js";
34
35
  import { readUninstall } from "./uninstall.js";
35
36
  import { readHyperBackup } from "./hyper-backup.js";
36
37
  import { readAppScripts } from "./app-scripts.js";
@@ -511,6 +512,14 @@ function readManifest(raw, c) {
511
512
  const noWindow = raw.compose === undefined && raw.ui === false;
512
513
  if (noWindow)
513
514
  readNoWindow(raw, capabilities, c);
515
+ if (identityGateway && unixUpstreamSocket(identityGateway.upstream)) {
516
+ const why = raw.compose !== undefined ? "cannot be combined with compose"
517
+ : raw.console !== undefined ? "cannot be combined with console: the gateway serves no web UI"
518
+ : !noWindow && identityGateway.mode !== "none" ? "on an App with an SDK window requires mode: none: the window stays the App's entry"
519
+ : undefined;
520
+ if (why)
521
+ c.fail("STANDALONE_IDENTITY_GATEWAY_INVALID", `identity_gateway: a unix upstream ${why}.`);
522
+ }
514
523
  const ui = raw.compose !== undefined || noWindow
515
524
  ? {
516
525
  dir: c.root,
@@ -553,6 +562,8 @@ function readManifest(raw, c) {
553
562
  c.fail('STANDALONE_MOBILE_INVALID', 'mobile.entry: app needs a UI');
554
563
  if (mobile.entry === 'gateway' && !identityGateway)
555
564
  c.fail('STANDALONE_MOBILE_INVALID', 'mobile.entry: gateway needs identity_gateway');
565
+ if (mobile.entry === 'gateway' && gatewayIngressOnly({ sdkWindow: noWindow ? false : undefined, identityGateway }))
566
+ c.fail('STANDALONE_MOBILE_INVALID', 'mobile.entry: gateway needs a gateway web UI; a unix-upstream gateway only carries ingress. Use mobile.entry: app.');
556
567
  if (mobile.icon)
557
568
  renderPackageIcons(mobileIconPath(c.root, mobile.icon));
558
569
  }
@@ -37,6 +37,28 @@ identity_gateway:
37
37
  headers: {user: Remote-User}
38
38
  ```
39
39
 
40
+ ### Ingress only, with no TCP port
41
+
42
+ An App with an SDK window that needs one App-authenticated route (for example a
43
+ WebSocket) on DSM's origin can point the gateway at its private SDK IPC socket:
44
+
45
+ ```yaml
46
+ identity_gateway:
47
+ sdk: <sdk-with-UnixUpstreamVersion>
48
+ mode: none
49
+ upstream: unix:reverse-ingress.sock # /var/packages/<package>/var/run/<name>.sock
50
+ ingress: {path: /synopkgland/ExampleApp/}
51
+ upstream_auth_paths: [/reverse]
52
+ ```
53
+
54
+ The name is `[a-z0-9][a-z0-9-]{0,58}\.sock`, a direct name. The App serves it with
55
+ the SDK's `ipc.ServeUnix`; no TCP listener is involved. The form needs `ingress`,
56
+ no `listen`, no Compose and an SDK whose `idgateway` declares
57
+ `UnixUpstreamVersion = 1`. With an SDK window the gateway is ingress only: the
58
+ DSM window, menu, Package Center Open, portal and mobile entry are unchanged
59
+ (`console` and `mobile.entry: gateway` are refused). Without a window the
60
+ gateway opens its web UI as usual.
61
+
40
62
  Replace `listen` with `ingress`. The default is `/synopkgland/<exact-package-ID>/` (case sensitive).
41
63
  The SDK and CLI also accept an explicit custom path:
42
64
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.54.0",
3
+ "version": "0.54.1",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {