@synopackageland/cli 0.54.10 → 0.54.12
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 +9 -0
- package/README.md +1 -1
- package/dist/bin.js +3 -1
- package/dist/ctl/generate.js +1 -1
- package/dist/error-registry.js +10 -0
- package/dist/native-http-schema/source.json +1 -1
- package/dist/runtime/sdk-source.d.ts +1 -1
- package/dist/runtime/sdk-source.js +1 -1
- package/dist/standalone/daemon-log.d.ts +10 -0
- package/dist/standalone/daemon-log.js +48 -0
- package/dist/standalone/daemon.js +3 -0
- package/dist/standalone/inspect-spk.js +21 -2
- package/dist/standalone/manifest.d.ts +11 -1
- package/dist/standalone/manifest.js +36 -11
- package/dist/standalone/spk.js +1 -0
- package/docs/catalog-text.md +2 -1
- package/docs/daemon.md +25 -0
- package/package.json +15 -17
- package/schema/dsm-package.schema.json +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.54.12 (2026-11-23)
|
|
4
|
+
|
|
5
|
+
- Configure SDK-managed daemon logs with `daemon.log_max_mb` and `daemon.log_keep_files` in `dsm-package.yaml`. Native daemons and Compose web gateways support both settings.
|
|
6
|
+
- Use SDK 0.53.58 for CLI-owned daemon controllers and Compose planning by default.
|
|
7
|
+
|
|
8
|
+
## 0.54.11 (2026-11-22)
|
|
9
|
+
|
|
10
|
+
- `ctl generate` (and `--check`) no longer needs store text: it does not read the project `.env`, ignores `--catalog`/`SYNOPKGLAND_CATALOG`, and accepts a manifest without `description`. It previously failed when the catalog had no release notes for the current version, or when no `.env` supplied the catalog. `check`, `build` and `inspect` still require the catalog text as before.
|
|
11
|
+
|
|
3
12
|
## 0.54.10 (2026-11-21)
|
|
4
13
|
|
|
5
14
|
- `check <spk>` and `inspect` scan public `ui/` files over 64 MiB instead of rejecting them with `SPK_UI_UNSAFE`: a larger file (such as a Go CGI) is streamed in 16 MiB windows with 1 MiB overlap, so a match longer than 1 MiB is still flagged but reported by its first 1 MiB. Executables keep their binary-pattern scanning.
|
package/README.md
CHANGED
|
@@ -594,7 +594,7 @@ Use `synopkgland host add nas --url https://nas.example:5001 --username alice`
|
|
|
594
594
|
to register and authenticate a NAS in OS secure storage. A bare host name uses
|
|
595
595
|
`https://<host>:5001`; provide a full URL for a different scheme or port.
|
|
596
596
|
The CLI loads only `DSM_*` and `SYNOPKGLAND_*` variables from `.env`; set other
|
|
597
|
-
process variables in the shell. `host list --json`
|
|
597
|
+
process variables in the shell. `ctl generate` does not read `.env`. `host list --json`
|
|
598
598
|
checks sessions; `ctl list --host nas --json` discovers all approved task-level
|
|
599
599
|
commands and their schemas. Run the listed alias/command with typed flags,
|
|
600
600
|
`--help` and `--dry-run`; writes require `--yes`. There is no mutable current
|
package/dist/bin.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { loadDotEnv } from "./load-env.js";
|
|
3
3
|
import { runCli } from "./cli.js";
|
|
4
4
|
import { terminalSafe } from "./terminal-text.js";
|
|
5
|
-
|
|
5
|
+
// `ctl generate` is an offline gate: it must not depend on a local secret file.
|
|
6
|
+
if (!(process.argv[2] === "ctl" && process.argv[3] === "generate"))
|
|
7
|
+
loadDotEnv();
|
|
6
8
|
// Package deployment is explicit; this CLI does not publish releases.
|
|
7
9
|
// Successful completion leaves Node's default 0 or the command's exitCode intact.
|
|
8
10
|
runCli(process.argv).catch((error) => {
|
package/dist/ctl/generate.js
CHANGED
|
@@ -5,7 +5,7 @@ export async function generateCommand(args) {
|
|
|
5
5
|
const check = args.includes('--check'), rest = args.filter(a => a !== '--check' && a !== '--json');
|
|
6
6
|
if (rest.length)
|
|
7
7
|
throw Error('Usage: synopkgland ctl generate [--check] [--json]');
|
|
8
|
-
const loaded = loadStandaloneManifest(process.cwd());
|
|
8
|
+
const loaded = loadStandaloneManifest(process.cwd(), { storeText: false });
|
|
9
9
|
if (!loaded.ok)
|
|
10
10
|
throw Error(loaded.errors.map(e => e.message).join('\n'));
|
|
11
11
|
const result = await generateOperations(loaded.manifest, async (command, argv, options) => {
|
package/dist/error-registry.js
CHANGED
|
@@ -424,6 +424,16 @@ export const ERROR_REGISTRY = {
|
|
|
424
424
|
description: "The daemon file-descriptor limit or package account is invalid.",
|
|
425
425
|
suggestion: "Use an integer daemon.nofile from 1024 to 1048576 and a valid non-root package ID; new builds currently require omitting daemon.nofile because activation is unsupported.",
|
|
426
426
|
},
|
|
427
|
+
STANDALONE_DAEMON_LOG_INVALID: {
|
|
428
|
+
code: "STANDALONE_DAEMON_LOG_INVALID",
|
|
429
|
+
description: "The daemon log settings are invalid or the package has no SDK-managed daemon.",
|
|
430
|
+
suggestion: "Use integer daemon.log_max_mb from 1 to 2048 MiB and daemon.log_keep_files from 1 to 20 with a native daemon or Compose web gateway.",
|
|
431
|
+
},
|
|
432
|
+
STANDALONE_DAEMON_LOG_SDK_REQUIRED: {
|
|
433
|
+
code: "STANDALONE_DAEMON_LOG_SDK_REQUIRED",
|
|
434
|
+
description: "The selected controller SDK does not support configurable daemon log retention.",
|
|
435
|
+
suggestion: "Upgrade the App or gateway SDK pin, or upgrade the CLI if it supplies the default controller SDK. Use matching SDK sources.",
|
|
436
|
+
},
|
|
427
437
|
STANDALONE_DAEMON_NOFILE_DSM_REQUIRED: {
|
|
428
438
|
code: "STANDALONE_DAEMON_NOFILE_DSM_REQUIRED",
|
|
429
439
|
description: "The declared DSM minimum does not support the daemon file-descriptor limit contract.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"module":"github.com/synopackageland/syno-pkg-land-sdk","version":"0.53.
|
|
1
|
+
{"module":"github.com/synopackageland/syno-pkg-land-sdk","version":"0.53.58","local":false}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { goPrivateCovers } from './go-env.js';
|
|
2
2
|
import { type ExecutorManifest } from './sdk-executor-manifest.js';
|
|
3
3
|
/** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
|
|
4
|
-
export declare const DEFAULT_SDK_VERSION = "0.53.
|
|
4
|
+
export declare const DEFAULT_SDK_VERSION = "0.53.58";
|
|
5
5
|
export declare const SDK_PACKAGE = "@synopackageland/sdk";
|
|
6
6
|
export declare const SDK_MODULE = "github.com/synopackageland/syno-pkg-land-sdk";
|
|
7
7
|
export declare const EXECUTOR_MODULE = "github.com/synopackageland/syno-pkg-land-sdk/executor";
|
|
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os';
|
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { readExecutorManifest, predatesExecutorManifest } from './sdk-executor-manifest.js';
|
|
7
7
|
/** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
|
|
8
|
-
export const DEFAULT_SDK_VERSION = '0.53.
|
|
8
|
+
export const DEFAULT_SDK_VERSION = '0.53.58';
|
|
9
9
|
export const SDK_PACKAGE = '@synopackageland/sdk';
|
|
10
10
|
export const SDK_MODULE = 'github.com/synopackageland/syno-pkg-land-sdk';
|
|
11
11
|
export const EXECUTOR_MODULE = `${SDK_MODULE}/executor`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StandaloneError } from "./manifest.js";
|
|
2
|
+
declare const bounds: {
|
|
3
|
+
readonly log_max_mb: 2048;
|
|
4
|
+
readonly log_keep_files: 20;
|
|
5
|
+
};
|
|
6
|
+
export type DaemonLog = Partial<Record<keyof typeof bounds, number>>;
|
|
7
|
+
export declare function readDaemonLog(value: unknown, fail: (error: StandaloneError) => void): DaemonLog | undefined;
|
|
8
|
+
export declare function daemonLogSdkProblem(sdk: string): string | undefined;
|
|
9
|
+
export declare function requireDaemonLogSource(source: string, sdk: string, settings?: DaemonLog): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { gte, valid } from "semver";
|
|
4
|
+
import { StandaloneBuildError } from "./spk.js";
|
|
5
|
+
const minSdk = "0.53.58";
|
|
6
|
+
const bounds = { log_max_mb: 2048, log_keep_files: 20 };
|
|
7
|
+
export function readDaemonLog(value, fail) {
|
|
8
|
+
if (value === undefined)
|
|
9
|
+
return;
|
|
10
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) ||
|
|
11
|
+
Object.keys(value).some(key => !Object.hasOwn(bounds, key))) {
|
|
12
|
+
fail({ code: "STANDALONE_DAEMON_LOG_INVALID", message: "Daemon log settings accept only log_max_mb and log_keep_files." });
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const settings = {};
|
|
16
|
+
for (const key of Object.keys(bounds)) {
|
|
17
|
+
const number = value[key];
|
|
18
|
+
if (number === undefined)
|
|
19
|
+
continue;
|
|
20
|
+
if (typeof number !== "number" || !Number.isInteger(number) || number < 1 || number > bounds[key]) {
|
|
21
|
+
fail({
|
|
22
|
+
code: "STANDALONE_DAEMON_LOG_INVALID",
|
|
23
|
+
message: `daemon.${key} must be an integer from 1 to ${bounds[key]}${key === "log_max_mb" ? " MiB" : ""}.`,
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
settings[key] = number;
|
|
28
|
+
}
|
|
29
|
+
return Object.keys(settings).length ? settings : undefined;
|
|
30
|
+
}
|
|
31
|
+
export function daemonLogSdkProblem(sdk) {
|
|
32
|
+
if (!valid(sdk) || !gte(sdk, minSdk))
|
|
33
|
+
return `daemon.log_max_mb and daemon.log_keep_files require SDK ${minSdk} or later; selected SDK ${sdk}.`;
|
|
34
|
+
}
|
|
35
|
+
export function requireDaemonLogSource(source, sdk, settings) {
|
|
36
|
+
if (!settings)
|
|
37
|
+
return;
|
|
38
|
+
const problem = daemonLogSdkProblem(sdk);
|
|
39
|
+
if (problem)
|
|
40
|
+
throw new StandaloneBuildError("STANDALONE_DAEMON_LOG_SDK_REQUIRED", problem);
|
|
41
|
+
let main = "";
|
|
42
|
+
try {
|
|
43
|
+
main = readFileSync(join(source, "daemonctl/main.go"), "utf8");
|
|
44
|
+
}
|
|
45
|
+
catch { /* Report the missing controller support below. */ }
|
|
46
|
+
if (Object.keys(settings).some(key => !main.includes(`json:"${key},omitempty"`)))
|
|
47
|
+
throw new StandaloneBuildError("STANDALONE_DAEMON_LOG_SDK_REQUIRED", "The selected SDK source does not support the declared daemon log settings. Use matching SDK sources.");
|
|
48
|
+
}
|
|
@@ -11,6 +11,7 @@ import { checkCgiBinary } from "./binary.js";
|
|
|
11
11
|
import { NODE_PACKAGES } from "./bridge-backend.js";
|
|
12
12
|
import { readDaemonIngress, ingressEnv } from "./daemon-ingress.js";
|
|
13
13
|
import { readDaemonRestart, requireDaemonRestartSource } from "./daemon-restart.js";
|
|
14
|
+
import { requireDaemonLogSource } from "./daemon-log.js";
|
|
14
15
|
import { composeDaemon, composeNetwork } from "./compose.js";
|
|
15
16
|
import { gatewayDaemon } from "./identity-gateway.js";
|
|
16
17
|
import { StandaloneBuildError } from "./spk.js";
|
|
@@ -189,6 +190,7 @@ export function daemonConfig(manifest) {
|
|
|
189
190
|
return (JSON.stringify({
|
|
190
191
|
package: manifest.package,
|
|
191
192
|
...(manifest.daemon?.nofile !== undefined ? { nofile: manifest.daemon.nofile } : {}),
|
|
193
|
+
...manifest.daemonLog,
|
|
192
194
|
...(!manifest.compose && manifest.daemon?.backend ? { backend: true } : { exec }),
|
|
193
195
|
args,
|
|
194
196
|
...(uninstall_args ? { uninstall_args } : {}),
|
|
@@ -238,6 +240,7 @@ export async function buildDaemonControl(manifest, arch, work, run) {
|
|
|
238
240
|
const out = join(work, `daemon-control-${arch}`);
|
|
239
241
|
const sdk = daemonSdkVersion(manifest);
|
|
240
242
|
const source = runtimeBudgetSource(sdkSource(sdk).goDir, manifest);
|
|
243
|
+
requireDaemonLogSource(source, sdk, manifest.daemonLog);
|
|
241
244
|
requireDaemonRestartSource(source, sdk, manifest.daemon?.restart);
|
|
242
245
|
requireBackendDaemonSource(source, manifest.daemon);
|
|
243
246
|
const result = await run("go", [
|
|
@@ -8,6 +8,7 @@ import { inspectStablePages } from './stable-pages.js';
|
|
|
8
8
|
import { LIFECYCLE_SCRIPTS } from '../spk/dsm-spec.js';
|
|
9
9
|
import { SHORT_PATHS_CONFIG, renderShortPathsCheck, renderShortPathsConfig, shortPathIngressProblem, shortPathsMinDsmProblem, shortPathsProblem, withoutShortPathsCheck } from './short-paths.js';
|
|
10
10
|
import { DAEMON_NOFILE_UNSUPPORTED, DAEMON_NOFILE_ACTIVATION_PROBLEM, readNoFile, daemonSystemUnitName, renderDaemonSystemUnit, daemonNoFileSdkProblem, daemonNoFileIdentityProblem, DAEMON_NOFILE_MIN_DSM } from "./daemon-nofile.js";
|
|
11
|
+
import { daemonLogSdkProblem, readDaemonLog } from "./daemon-log.js";
|
|
11
12
|
import { gatewayIngressPathProblem, gatewayIngressOwnershipSupported } from './gateway-ingress.js';
|
|
12
13
|
import { renderGatewayIngressCheck } from './native-gateway.js';
|
|
13
14
|
import { portDefaults, portInstallSteps } from "./install-ports.js";
|
|
@@ -188,6 +189,9 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
188
189
|
}
|
|
189
190
|
const dependencies = inspectPackageDependencies(metadata.dependencies, findings);
|
|
190
191
|
const daemonNoFile = readNoFile(metadata.daemon_nofile, e => findings.push(e.message));
|
|
192
|
+
const daemonLog = readDaemonLog(metadata.daemon_log, e => findings.push(`${e.code} ${e.message}`));
|
|
193
|
+
if (metadata.daemon_log !== undefined && (!daemonLog || !paths.has("daemon/control")))
|
|
194
|
+
findings.push("STANDALONE_DAEMON_LOG_INVALID daemon_log requires valid settings and daemon/control.");
|
|
191
195
|
if (metadata.daemon_nofile !== undefined)
|
|
192
196
|
findings.push(`[${DAEMON_NOFILE_UNSUPPORTED}] ${DAEMON_NOFILE_ACTIVATION_PROBLEM}`);
|
|
193
197
|
if (daemonNoFile !== undefined) {
|
|
@@ -219,7 +223,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
219
223
|
const integrations = metadata.integrations ?? [];
|
|
220
224
|
await inspectCtlArtifacts(dir, paths, metadata.ctl, metadata.entry, findings);
|
|
221
225
|
if (metadata.compose !== undefined) {
|
|
222
|
-
const result = await inspectUnifiedCompose(dir, payload, { ...metadata, installSettings, minMemoryMb, memoryAdvice }, findings, options.baseline);
|
|
226
|
+
const result = await inspectUnifiedCompose(dir, payload, { ...metadata, installSettings, minMemoryMb, memoryAdvice, daemonLog }, findings, options.baseline);
|
|
223
227
|
if (dependencies) {
|
|
224
228
|
result.dependencies = dependencies;
|
|
225
229
|
}
|
|
@@ -304,7 +308,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
304
308
|
if (standalone && portal)
|
|
305
309
|
findings.push(...inspectPortalInfo(info, hasExecutor));
|
|
306
310
|
const daemon = standalone
|
|
307
|
-
? await checkDaemon(dir, info, paths, payload, findings, hasExecutor, background, combined, nativeGateway, uninstallHook?.uninstall, { ingress: daemonIngress, node: daemonNode, restart: daemonRestart, nofile: daemonNoFile, installPorts: Boolean(metadata.installPorts) })
|
|
311
|
+
? await checkDaemon(dir, info, paths, payload, findings, hasExecutor, background, combined, nativeGateway, uninstallHook?.uninstall, { ingress: daemonIngress, node: daemonNode, restart: daemonRestart, nofile: daemonNoFile, log: daemonLog, installPorts: Boolean(metadata.installPorts) })
|
|
308
312
|
: undefined;
|
|
309
313
|
if (background)
|
|
310
314
|
checkBackground(dir, info, payload, findings, hasExecutor, daemon, kind !== "native-go", metadata.lifecycleTimeouts, nativeGateway, Boolean(metadata.installPorts));
|
|
@@ -887,6 +891,7 @@ async function inspectUnifiedCompose(dir, payload, metadata, findings, baseline
|
|
|
887
891
|
build: Number(info.version?.split("-").pop()),
|
|
888
892
|
arches: [arch],
|
|
889
893
|
backend: { kind: "binary", files: {}, ...(metadata.operationSeconds ? { timeoutSeconds: metadata.operationSeconds } : {}) },
|
|
894
|
+
daemonLog: metadata.daemonLog,
|
|
890
895
|
lifecycleTimeouts: metadata.lifecycleTimeouts,
|
|
891
896
|
ui: { dir: root, launch: metadata.launch },
|
|
892
897
|
capabilities: {
|
|
@@ -902,6 +907,13 @@ async function inspectUnifiedCompose(dir, payload, metadata, findings, baseline
|
|
|
902
907
|
};
|
|
903
908
|
if (Boolean(c.web) !== Boolean(g))
|
|
904
909
|
throw new Error("Web ingress must have a complete identity gateway");
|
|
910
|
+
if (metadata.daemonLog && !g)
|
|
911
|
+
throw new Error("daemon log settings require a Compose web gateway");
|
|
912
|
+
if (metadata.daemonLog && g) {
|
|
913
|
+
const problem = daemonLogSdkProblem(g.sdk);
|
|
914
|
+
if (problem)
|
|
915
|
+
throw new Error(problem);
|
|
916
|
+
}
|
|
905
917
|
if (gateway && !matchesGatewayConfig(gateway, manifest))
|
|
906
918
|
throw new Error("gateway configuration differs from the declared package contract");
|
|
907
919
|
if (readOptional(join(dir, "conf/privilege")) !== renderNativePrivilege())
|
|
@@ -1090,11 +1102,17 @@ async function checkDaemon(dir, info, paths, payload, findings, executor, backgr
|
|
|
1090
1102
|
"uninstall_args",
|
|
1091
1103
|
"restart",
|
|
1092
1104
|
"nofile",
|
|
1105
|
+
"log_max_mb",
|
|
1106
|
+
"log_keep_files",
|
|
1093
1107
|
...(combined ? ["network"] : []),
|
|
1094
1108
|
].includes(key)))
|
|
1095
1109
|
throw new Error("package/config mismatch");
|
|
1096
1110
|
if (config.nofile !== extras.nofile)
|
|
1097
1111
|
throw new Error("daemon nofile differs from its build declaration");
|
|
1112
|
+
if (config.log_max_mb !== extras.log?.log_max_mb || config.log_keep_files !== extras.log?.log_keep_files) {
|
|
1113
|
+
findings.push("STANDALONE_DAEMON_LOG_INVALID daemon log settings differ from their build declaration.");
|
|
1114
|
+
return undefined;
|
|
1115
|
+
}
|
|
1098
1116
|
if (!isDeepStrictEqual(config.restart, extras.restart))
|
|
1099
1117
|
throw new Error("daemon restart differs from its build declaration");
|
|
1100
1118
|
const backend = config.backend === true;
|
|
@@ -1144,6 +1162,7 @@ async function checkDaemon(dir, info, paths, payload, findings, executor, backgr
|
|
|
1144
1162
|
root: dir,
|
|
1145
1163
|
...(combined ? { lifecycleTimeouts: daemon.timeouts } : {}),
|
|
1146
1164
|
daemon,
|
|
1165
|
+
daemonLog: extras.log,
|
|
1147
1166
|
uninstall,
|
|
1148
1167
|
...combined,
|
|
1149
1168
|
capabilities: {
|
|
@@ -17,6 +17,7 @@ import { type RootOp } from "./root-ops.js";
|
|
|
17
17
|
import type { RootSettings } from "../runtime/root-programs.js";
|
|
18
18
|
import { type ComposeApp } from "./compose.js";
|
|
19
19
|
import { type Daemon } from "./daemon.js";
|
|
20
|
+
import { type DaemonLog } from "./daemon-log.js";
|
|
20
21
|
import { type IdentityGateway } from "./identity-gateway.js";
|
|
21
22
|
import { type Uninstall } from "./uninstall.js";
|
|
22
23
|
import { type HyperBackup } from "./hyper-backup.js";
|
|
@@ -113,6 +114,7 @@ export interface StandaloneManifest {
|
|
|
113
114
|
tasks: ExecutorTask[];
|
|
114
115
|
};
|
|
115
116
|
daemon?: Daemon;
|
|
117
|
+
daemonLog?: DaemonLog;
|
|
116
118
|
lifecycleTimeouts?: Daemon["timeouts"];
|
|
117
119
|
/** Author-supplied overrides, before daemon supervision defaults are filled. */
|
|
118
120
|
declaredLifecycleTimeouts?: Partial<Daemon["timeouts"]>;
|
|
@@ -190,7 +192,15 @@ export type ManifestResult = {
|
|
|
190
192
|
errors: StandaloneError[];
|
|
191
193
|
};
|
|
192
194
|
export declare const KNOWN_FIELDS: Set<string>;
|
|
193
|
-
export
|
|
195
|
+
export interface ManifestLoadOptions {
|
|
196
|
+
/**
|
|
197
|
+
* false skips store text: no catalog is read (so no release notes are
|
|
198
|
+
* required) and description may be absent. For commands, such as
|
|
199
|
+
* `ctl generate`, that never write INFO or SPK metadata.
|
|
200
|
+
*/
|
|
201
|
+
storeText?: boolean;
|
|
202
|
+
}
|
|
203
|
+
export declare function loadStandaloneManifest(root: string, options?: ManifestLoadOptions): ManifestResult;
|
|
194
204
|
/**
|
|
195
205
|
* The runtime registers routes from the manifest's methods: a policy for
|
|
196
206
|
* another method, or an App method with an SDK name, would refuse to start.
|
|
@@ -31,6 +31,7 @@ import { loadRootOps, readRootSettings, rootBinaryProblem, ROOT_OPS_DIR, } from
|
|
|
31
31
|
import { composeManifestContext, readComposeApp } from "./compose.js";
|
|
32
32
|
import { daemonSdkVersion, readDaemon, readLifecycleTimeouts } from "./daemon.js";
|
|
33
33
|
import { daemonRestartSdkProblem } from "./daemon-restart.js";
|
|
34
|
+
import { daemonLogSdkProblem, readDaemonLog } from "./daemon-log.js";
|
|
34
35
|
import { daemonIngressMinDsmProblem } from "./daemon-ingress.js";
|
|
35
36
|
import { readIdentityGateway, } from "./identity-gateway.js";
|
|
36
37
|
import { gatewayIngressOnly, unixUpstreamSocket } from "./gateway-ingress-only.js";
|
|
@@ -133,7 +134,7 @@ class Collector {
|
|
|
133
134
|
return value;
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
|
-
export function loadStandaloneManifest(root) {
|
|
137
|
+
export function loadStandaloneManifest(root, options = {}) {
|
|
137
138
|
const file = join(root, STANDALONE_MANIFEST);
|
|
138
139
|
if (!existsSync(file)) {
|
|
139
140
|
return {
|
|
@@ -164,12 +165,12 @@ export function loadStandaloneManifest(root) {
|
|
|
164
165
|
c.fail("STANDALONE_MANIFEST_YAML", `${STANDALONE_MANIFEST} must be a YAML object.`);
|
|
165
166
|
return { ok: false, errors: c.errors };
|
|
166
167
|
}
|
|
167
|
-
const manifest = readManifest(raw, c);
|
|
168
|
+
const manifest = readManifest(raw, c, options.storeText !== false);
|
|
168
169
|
return manifest && c.errors.length === 0
|
|
169
170
|
? { ok: true, manifest }
|
|
170
171
|
: { ok: false, errors: c.errors };
|
|
171
172
|
}
|
|
172
|
-
function readManifest(raw, c) {
|
|
173
|
+
function readManifest(raw, c, storeText) {
|
|
173
174
|
let uiSecretIgnores = [];
|
|
174
175
|
try {
|
|
175
176
|
uiSecretIgnores = readUiSecretIgnores(raw.ui_secret_ignores);
|
|
@@ -229,11 +230,13 @@ function readManifest(raw, c) {
|
|
|
229
230
|
c.fail("STANDALONE_OS_MIN_VER_INVALID", `root templates require DSM ${DEFAULT_MIN_DSM} or later.`);
|
|
230
231
|
}
|
|
231
232
|
const displayname = c.text(raw.displayname, "displayname");
|
|
232
|
-
const catalogPath = activeCatalogPath();
|
|
233
|
+
const catalogPath = storeText ? activeCatalogPath() : undefined;
|
|
233
234
|
// With a catalog, its entry is the only source of store text; the manifest must not repeat it.
|
|
234
235
|
const description = catalogPath
|
|
235
236
|
? catalogOwnedFields(raw, c, catalogPath)
|
|
236
|
-
:
|
|
237
|
+
: storeText || raw.description !== undefined
|
|
238
|
+
? c.text(raw.description, "description")
|
|
239
|
+
: STORE_TEXT_SKIPPED;
|
|
237
240
|
const maintainer = c.text(raw.maintainer, "maintainer");
|
|
238
241
|
let metadata;
|
|
239
242
|
if (raw.metadata !== undefined)
|
|
@@ -288,10 +291,19 @@ function readManifest(raw, c) {
|
|
|
288
291
|
c.fail("STANDALONE_API_PERMISSIONS_INVALID", `backend/${API_PERMISSIONS_FILE[backend.kind]} must define the centralized API policy: ${String(error)}`);
|
|
289
292
|
}
|
|
290
293
|
}
|
|
291
|
-
const
|
|
292
|
-
const
|
|
294
|
+
const { log_max_mb, log_keep_files, ...daemonBody } = isRecord(raw.daemon) ? raw.daemon : {};
|
|
295
|
+
const hasLogSettings = log_max_mb !== undefined || log_keep_files !== undefined;
|
|
296
|
+
const daemonLog = hasLogSettings
|
|
297
|
+
? readDaemonLog({ log_max_mb, log_keep_files }, e => c.fail(e.code, e.message))
|
|
298
|
+
: undefined;
|
|
299
|
+
const daemonSettingsOnly = isRecord(raw.daemon) &&
|
|
300
|
+
(hasLogSettings || "timeouts" in daemonBody) &&
|
|
301
|
+
Object.keys(daemonBody).every(key => key === "timeouts");
|
|
302
|
+
const lifecycleTimeouts = daemonSettingsOnly && "timeouts" in daemonBody
|
|
303
|
+
? readLifecycleTimeouts(daemonBody.timeouts, e => c.fail(e.code, e.message))
|
|
304
|
+
: undefined;
|
|
293
305
|
const daemon = arches &&
|
|
294
|
-
readDaemon(
|
|
306
|
+
readDaemon(daemonSettingsOnly ? undefined : isRecord(raw.daemon) ? daemonBody : raw.daemon, c.root, arches, (e) => c.fail(e.code, e.message), packageId);
|
|
295
307
|
let dependencies;
|
|
296
308
|
try {
|
|
297
309
|
const explicit = readPackageDependencies(raw.dependencies);
|
|
@@ -339,7 +351,7 @@ function readManifest(raw, c) {
|
|
|
339
351
|
installPorts,
|
|
340
352
|
}));
|
|
341
353
|
if (raw.compose !== undefined &&
|
|
342
|
-
((raw.daemon !== undefined && !
|
|
354
|
+
((raw.daemon !== undefined && !daemonSettingsOnly) ||
|
|
343
355
|
Object.keys(capabilities).some((k) => k !== "composeMounts") ||
|
|
344
356
|
!osMinVer ||
|
|
345
357
|
!isDsmAtLeast(osMinVer, "7.2.1-69057")))
|
|
@@ -412,6 +424,16 @@ function readManifest(raw, c) {
|
|
|
412
424
|
if (problem)
|
|
413
425
|
c.fail("STANDALONE_DAEMON_RESTART_SDK_REQUIRED", problem);
|
|
414
426
|
}
|
|
427
|
+
if (daemonLog) {
|
|
428
|
+
if (!daemon && !(compose && identityGateway)) {
|
|
429
|
+
c.fail("STANDALONE_DAEMON_LOG_INVALID", "Daemon log settings require a native daemon or a Compose web gateway managed by the SDK.");
|
|
430
|
+
}
|
|
431
|
+
else if (backend) {
|
|
432
|
+
const problem = daemonLogSdkProblem(daemonSdkVersion({ backend, identityGateway }));
|
|
433
|
+
if (problem)
|
|
434
|
+
c.fail("STANDALONE_DAEMON_LOG_SDK_REQUIRED", problem);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
415
437
|
if ((daemon?.ingress || daemon?.node || daemon?.backend) && raw.identity_gateway !== undefined)
|
|
416
438
|
c.fail("STANDALONE_DAEMON_INVALID", "daemon.backend, daemon.node and daemon.ingress run the App's own daemon; identity_gateway runs its gateway as the daemon. Use one or the other.");
|
|
417
439
|
if (compose && identityGateway && compose.sdk !== identityGateway.sdk)
|
|
@@ -430,7 +452,7 @@ function readManifest(raw, c) {
|
|
|
430
452
|
s.port === identityGateway.oidc?.issuer_port))))
|
|
431
453
|
c.fail("STANDALONE_IDENTITY_GATEWAY_INVALID", "compose service ports must contain upstream and not overlap gateway or issuer ports.");
|
|
432
454
|
if (capabilities.jobs &&
|
|
433
|
-
raw.daemon !== undefined && !
|
|
455
|
+
raw.daemon !== undefined && !daemonSettingsOnly &&
|
|
434
456
|
capabilities.delegate?.lifetime !== "until-revoked") {
|
|
435
457
|
c.fail("CAPABILITY_COMBINATION_INVALID", "daemon can only coexist with an explicit until-revoked delegate fixed worker; plain capabilities.jobs stays mutually exclusive.");
|
|
436
458
|
}
|
|
@@ -449,7 +471,7 @@ function readManifest(raw, c) {
|
|
|
449
471
|
delegate.destinations?.length)) {
|
|
450
472
|
c.fail("CAPABILITY_UNSUPPORTED", `For backend.runtime: ${backend.kind}, capabilities.delegate supports only operations: [files.moveFromStaging], destinations and lifetime: until-revoked.`);
|
|
451
473
|
}
|
|
452
|
-
if (raw.daemon !== undefined && !
|
|
474
|
+
if (raw.daemon !== undefined && !daemonSettingsOnly)
|
|
453
475
|
c.fail("CAPABILITY_UNSUPPORTED", `backend.runtime: ${backend.kind} does not support daemon; a v1 App runs once per request (exec mode).`);
|
|
454
476
|
if (permissions)
|
|
455
477
|
checkBridgeMethods(backend, permissions, c);
|
|
@@ -718,6 +740,7 @@ function readManifest(raw, c) {
|
|
|
718
740
|
...(rootOps ? { rootOps } : {}),
|
|
719
741
|
...(rootPrograms ? { rootPrograms } : {}),
|
|
720
742
|
...(daemon ? { daemon } : {}),
|
|
743
|
+
...(daemonLog ? { daemonLog } : {}),
|
|
721
744
|
...(dependencies ? { dependencies } : {}),
|
|
722
745
|
...(lifecycleTimeouts ? { lifecycleTimeouts } : {}),
|
|
723
746
|
declaredLifecycleTimeouts: isRecord(raw.daemon) && isRecord(raw.daemon.timeouts)
|
|
@@ -754,6 +777,8 @@ function readManifest(raw, c) {
|
|
|
754
777
|
}
|
|
755
778
|
return manifest;
|
|
756
779
|
}
|
|
780
|
+
/** Description placeholder when store text is not loaded; never written to INFO. */
|
|
781
|
+
const STORE_TEXT_SKIPPED = "(store text not loaded)";
|
|
757
782
|
/** Reports hand-written store text next to a catalog; returns the placeholder the catalog replaces. */
|
|
758
783
|
function catalogOwnedFields(raw, c, catalogPath) {
|
|
759
784
|
const found = [];
|
package/dist/standalone/spk.js
CHANGED
|
@@ -350,6 +350,7 @@ export async function assembleStandaloneSpk(options) {
|
|
|
350
350
|
...(manifest.daemon?.ingress ? { daemon_ingress: manifest.daemon.ingress } : {}),
|
|
351
351
|
...(manifest.daemon?.node ? { daemon_node: manifest.daemon.node } : {}),
|
|
352
352
|
...(manifest.daemon?.nofile !== undefined ? { daemon_nofile: manifest.daemon.nofile } : {}),
|
|
353
|
+
...(manifest.daemonLog ? { daemon_log: manifest.daemonLog } : {}),
|
|
353
354
|
...(manifest.daemon?.restart ? { daemon_restart: manifest.daemon.restart } : {}),
|
|
354
355
|
...(manifest.daemon?.restart || manifest.daemon?.nofile !== undefined ? { daemon_sdk: daemonSdkVersion(manifest) } : {}),
|
|
355
356
|
launch: resolvedSdkLaunch(manifest),
|
package/docs/catalog-text.md
CHANGED
|
@@ -23,7 +23,8 @@ packages:
|
|
|
23
23
|
Pass the file to `check`, `build` and `inspect` with `--catalog <catalog.yaml>`,
|
|
24
24
|
or set `SYNOPKGLAND_CATALOG` (also in the project `.env`; a relative path is
|
|
25
25
|
resolved from the current directory). Without either, the manifest's own text is
|
|
26
|
-
used as before.
|
|
26
|
+
used as before. `ctl generate` reads no store text: it ignores the catalog and
|
|
27
|
+
needs neither release notes nor `description`.
|
|
27
28
|
|
|
28
29
|
## What the build writes
|
|
29
30
|
|
package/docs/daemon.md
CHANGED
|
@@ -48,6 +48,31 @@ inspection digests are separate. Replacing an upstream binary through its own
|
|
|
48
48
|
updater is therefore not detected by this supervisor digest. Follow
|
|
49
49
|
[self-updating upstream guidance](../skills/reference/upstream-fork.md#self-updating-upstreams).
|
|
50
50
|
|
|
51
|
+
## Daemon log retention
|
|
52
|
+
|
|
53
|
+
Configure either limit in `dsm-package.yaml` and rebuild with a CLI and SDK
|
|
54
|
+
that support these settings.
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
daemon:
|
|
58
|
+
log_max_mb: 100
|
|
59
|
+
log_keep_files: 7
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`log_max_mb` is the uncompressed active `daemon/daemon.log` limit in MiB.
|
|
63
|
+
It accepts integers from 1 to 2048 and defaults to 100. `log_keep_files`
|
|
64
|
+
counts rotated files in addition to the active log. It accepts integers from
|
|
65
|
+
1 to 20 and defaults to 7. Add the settings to the existing native `daemon`
|
|
66
|
+
block, or use them with optional `daemon.timeouts` for a Compose web gateway.
|
|
67
|
+
The CLI rejects invalid limits before compiling.
|
|
68
|
+
|
|
69
|
+
`daemon/control status-json` reports `log` and the configured `log_archives`
|
|
70
|
+
paths. The default archives run from `daemon/daemon.log.1.gz` (newest) through
|
|
71
|
+
`daemon/daemon.log.7.gz` (oldest). Use `zcat` or `zgrep` to read them. An
|
|
72
|
+
archive waiting for background compression or a retry has the same path
|
|
73
|
+
without `.gz`. The supervisor also migrates an existing `daemon/daemon.log.1`
|
|
74
|
+
on start.
|
|
75
|
+
|
|
51
76
|
## `daemon.restart`: bounded native crash recovery
|
|
52
77
|
|
|
53
78
|
`daemon.restart` is optional. Use `mode: off` to disable crash recovery.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/cli",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.12",
|
|
4
4
|
"description": "Syno Package Land Developer Kit CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,20 +26,6 @@
|
|
|
26
26
|
"docs/install-memory.md",
|
|
27
27
|
"docs/catalog-text.md"
|
|
28
28
|
],
|
|
29
|
-
"scripts": {
|
|
30
|
-
"check:docs": "node --test scripts/check-doc-versions.test.mjs && node scripts/check-doc-versions.mjs",
|
|
31
|
-
"build": "rm -rf dist && node scripts/prepare-native-http.mjs && tsc",
|
|
32
|
-
"test": "pnpm run build && node --import tsx --import ./test/helpers/strict-dsm-setup.ts --test --test-concurrency=${SYNOPKGLAND_GATE_JOBS:-3} test/*.test.ts test/ctl/*.test.ts",
|
|
33
|
-
"test:glossary": "node --test scripts/test/glossary-drift.test.mjs",
|
|
34
|
-
"test:scripts": "node --test scripts/test/gate.test.mjs scripts/test/release.test.mjs scripts/test/pack-docker.test.mjs scripts/test/npm-pack.test.mjs scripts/test/executor-bump.test.mjs scripts/test/smoke-exports.test.mjs scripts/test/parallel.test.mjs scripts/test/scaffold-matrix.test.mjs scripts/test/frontend-deps.test.mjs scripts/test/docker-gate.test.mjs scripts/test/gate-plan.test.mjs scripts/test/gates.test.mjs && python3 scripts/test/npm-publish.py",
|
|
35
|
-
"gates": "bash scripts/ci/gates.sh",
|
|
36
|
-
"gates:fast": "bash scripts/ci/gates.sh",
|
|
37
|
-
"prepublishOnly": "pnpm run build && node --input-type=module -e 'import {enforceRepositorySecrets} from \"./dist/secret-files.js\"; enforceRepositorySecrets(process.cwd())'",
|
|
38
|
-
"gates:full": "bash scripts/ci/gates.sh --full",
|
|
39
|
-
"test:basic": "node --import tsx --test test/schema.test.ts test/standalone-manifest.test.ts test/native-arch.test.ts test/archive-inventory.test.ts test/secret-files.test.ts",
|
|
40
|
-
"check:dsm-contract": "node scripts/check-dsm-api-contract.mjs",
|
|
41
|
-
"check:dsm-hub": "node scripts/check-dsm-api-hub.mjs"
|
|
42
|
-
},
|
|
43
29
|
"dependencies": {
|
|
44
30
|
"@napi-rs/keyring": "^2.1.1",
|
|
45
31
|
"@synopackageland/templates": "~0.44.1",
|
|
@@ -102,5 +88,17 @@
|
|
|
102
88
|
"./native-layout": "./dist/standalone/native-layout.js",
|
|
103
89
|
"./e2e": "./dist/e2e/dsm.js"
|
|
104
90
|
},
|
|
105
|
-
"
|
|
106
|
-
|
|
91
|
+
"scripts": {
|
|
92
|
+
"check:docs": "node --test scripts/check-doc-versions.test.mjs && node scripts/check-doc-versions.mjs",
|
|
93
|
+
"build": "rm -rf dist && node scripts/prepare-native-http.mjs && tsc",
|
|
94
|
+
"test": "pnpm run build && node --import tsx --import ./test/helpers/strict-dsm-setup.ts --test --test-concurrency=${SYNOPKGLAND_GATE_JOBS:-3} test/*.test.ts test/ctl/*.test.ts",
|
|
95
|
+
"test:glossary": "node --test scripts/test/glossary-drift.test.mjs",
|
|
96
|
+
"test:scripts": "node --test scripts/test/gate.test.mjs scripts/test/release.test.mjs scripts/test/pack-docker.test.mjs scripts/test/npm-pack.test.mjs scripts/test/executor-bump.test.mjs scripts/test/smoke-exports.test.mjs scripts/test/parallel.test.mjs scripts/test/scaffold-matrix.test.mjs scripts/test/frontend-deps.test.mjs scripts/test/docker-gate.test.mjs scripts/test/gate-plan.test.mjs scripts/test/gates.test.mjs && python3 scripts/test/npm-publish.py",
|
|
97
|
+
"gates": "bash scripts/ci/gates.sh",
|
|
98
|
+
"gates:fast": "bash scripts/ci/gates.sh",
|
|
99
|
+
"gates:full": "bash scripts/ci/gates.sh --full",
|
|
100
|
+
"test:basic": "node --import tsx --test test/schema.test.ts test/standalone-manifest.test.ts test/native-arch.test.ts test/archive-inventory.test.ts test/secret-files.test.ts",
|
|
101
|
+
"check:dsm-contract": "node scripts/check-dsm-api-contract.mjs",
|
|
102
|
+
"check:dsm-hub": "node scripts/check-dsm-api-hub.mjs"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -2,11 +2,24 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "dsm-package.schema.json",
|
|
4
4
|
"title": "DSM package manifest",
|
|
5
|
-
"description": "Editor schema for schema 2
|
|
5
|
+
"description": "Editor schema for selected schema 2 package settings; CLI check validates the complete package manifest",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"required": ["schema"],
|
|
8
8
|
"properties": {
|
|
9
9
|
"schema": {"type": "integer", "const": 2},
|
|
10
|
+
"daemon": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"log_max_mb": {
|
|
14
|
+
"type": "integer", "minimum": 1, "maximum": 2048, "default": 100,
|
|
15
|
+
"description": "Uncompressed active daemon.log limit in MiB."
|
|
16
|
+
},
|
|
17
|
+
"log_keep_files": {
|
|
18
|
+
"type": "integer", "minimum": 1, "maximum": 20, "default": 7,
|
|
19
|
+
"description": "Rotated gzip archives to retain, in addition to daemon.log."
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
10
23
|
"install": {
|
|
11
24
|
"type": "object",
|
|
12
25
|
"properties": {
|