@synopackageland/cli 0.48.3 → 0.48.5
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 +11 -0
- package/README.md +12 -6
- package/dist/cli.js +1 -1
- package/dist/ctl/registry.js +2 -2
- package/dist/error-registry.js +1 -0
- package/dist/nas/transport.js +3 -1
- package/dist/runtime/executor-policy.d.ts +6 -0
- package/dist/runtime/executor-policy.js +10 -6
- package/dist/runtime/operation-budget.d.ts +1 -0
- package/dist/runtime/operation-budget.js +1 -0
- package/dist/runtime/runtime-budgets.d.ts +1 -1
- package/dist/runtime/runtime-budgets.js +3 -2
- package/dist/standalone/api-description.js +58 -1
- package/dist/standalone/manifest.d.ts +2 -0
- package/dist/standalone/manifest.js +2 -0
- package/dist/validate.js +7 -1
- package/package.json +6 -4
- package/skills/SKILL.md +10 -2
- package/skills/reference/compose.md +3 -3
- package/skills/reference/create.md +3 -3
- package/skills/reference/ctl.md +8 -3
- package/skills/reference/identity-gateway.md +5 -5
- package/skills/reference/install.md +2 -2
- package/skills/reference/lifecycle.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.48.5
|
|
4
|
+
|
|
5
|
+
- Require templates ~0.40.0: new scaffolds pin SDK/App 0.50.0 and UI 0.20.0, whose AppShell pages show no visible title and scroll only their content; the CLI controller SDK default stays 0.49.5
|
|
6
|
+
|
|
7
|
+
## 0.48.4
|
|
8
|
+
|
|
9
|
+
- Derive executor policy and runtime operation defaults from the SDK shared operation contract; preserve explicit App overrides without inheriting shorter implicit daemon lifecycle defaults
|
|
10
|
+
|
|
11
|
+
- Restore check and build support for legacy v1 ctl.commands Apps, with one nonblocking deprecation warning during check
|
|
12
|
+
- Remove byte-size caps from App-authored operation registry files and authenticated description reads; retain validation, route equality and ordinary request limits
|
|
13
|
+
|
|
3
14
|
## 0.48.3
|
|
4
15
|
|
|
5
16
|
- Make v2 job flow timeoutMs optional in commands and operations, matching v1: shared per-request budgets and no total polling deadline; retain explicit bounds and preserve omission through generation
|
package/README.md
CHANGED
|
@@ -89,9 +89,9 @@ alongside npm lockfiles. Do not disable checksum verification for public SDK
|
|
|
89
89
|
packages. Private mirrors can use explicitly configured Go authentication and
|
|
90
90
|
checksum settings; a failed fetch reports `SDK_DOWNLOAD_FAILED`.
|
|
91
91
|
|
|
92
|
-
The CLI pins SDK
|
|
93
|
-
context. Explicit App SDK declarations take precedence. Templates
|
|
94
|
-
and retain their own scaffold SDK pins; none declare daemon ingress.
|
|
92
|
+
The CLI pins one SDK release for its daemon controllers, Compose planning and installer
|
|
93
|
+
context. Explicit App SDK declarations take precedence. Templates come from the
|
|
94
|
+
installed templates package and retain their own scaffold SDK pins; none declare daemon ingress.
|
|
95
95
|
Every App method is declared once in operations.json; ctl generate writes the
|
|
96
96
|
permissions table and runtime bindings. Dynamic names and custom HTTP dispatchers
|
|
97
97
|
are rejected. Use fixed
|
|
@@ -102,8 +102,8 @@ unimported development commands are excluded. Use
|
|
|
102
102
|
authentication. See [App entry and registration](docs/app-entry.md).
|
|
103
103
|
|
|
104
104
|
`init` and `add` read their templates from the locally installed
|
|
105
|
-
`@synopackageland/templates`. CLI
|
|
106
|
-
update can select the latest templates patch in
|
|
105
|
+
`@synopackageland/templates`. The CLI depends on one templates minor line: npm installation or
|
|
106
|
+
update can select the latest templates patch in that line. Templates
|
|
107
107
|
patches need only a templates release; update the npm installation to receive them.
|
|
108
108
|
The CLI never fetches templates at runtime, so offline use works after installation;
|
|
109
109
|
commit a lockfile and use `npm ci` to reproduce a chosen dependency tree.
|
|
@@ -629,7 +629,7 @@ package start activates nginx.
|
|
|
629
629
|
|
|
630
630
|
Older SDK/DSM targets retain the direct listener and explain its certificate or
|
|
631
631
|
unencrypted-HTTP limitations before opening it. Native resource/startup failures
|
|
632
|
-
fail closed; they do not silently expose a direct listener. The native runtime uses the resolved SDK release; new scaffolds pin SDK
|
|
632
|
+
fail closed; they do not silently expose a direct listener. The native runtime uses the resolved SDK release; new scaffolds pin the SDK release of the installed templates.
|
|
633
633
|
|
|
634
634
|
Compose Apps may opt in to Intel render devices with
|
|
635
635
|
`compose.devices.gpu.services: [media]`. The matching SDK discovers exact devices
|
|
@@ -649,3 +649,9 @@ not a GPU blocker. Plan metadata describes SDK policy, not an attestation of the
|
|
|
649
649
|
provider's final container configuration; see the SDK Compose security boundary.
|
|
650
650
|
|
|
651
651
|
For same-origin App URLs, see [DSM path ingress](docs/path-ingress.md).
|
|
652
|
+
|
|
653
|
+
### CLI release checks
|
|
654
|
+
|
|
655
|
+
`npm run gates` runs basic checks and is the default for release packaging and CI.
|
|
656
|
+
Use `npm run gates:full` only when explicitly requested. See
|
|
657
|
+
[release entry points and checks](docs/release-checks.md) for the complete inventory.
|
package/dist/cli.js
CHANGED
|
@@ -391,7 +391,7 @@ async function runCliWithin(argv) {
|
|
|
391
391
|
: loadStandaloneManifest(standalone);
|
|
392
392
|
if (!loaded.ok)
|
|
393
393
|
throw failure(loaded.errors[0].code, loaded.errors.map((e) => `[${e.code}] ${e.message}`).join("\n"), "Update dsm-package.yaml to schema: 2, fix the declaration and retry.");
|
|
394
|
-
if ('ctl' in loaded.manifest &&
|
|
394
|
+
if ('ctl' in loaded.manifest && loaded.manifest.ctl?.registry) {
|
|
395
395
|
const { generateOperations } = await import('./standalone/operation-registry.js');
|
|
396
396
|
const { spawnSync } = await import('node:child_process');
|
|
397
397
|
await generateOperations(loaded.manifest, (command, args, options) => {
|
package/dist/ctl/registry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
2
2
|
import { dirname, join, resolve, relative, isAbsolute } from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { strictJson } from './json.js';
|
|
4
4
|
import { ajv, safeSchema, validateFlow } from './descriptor.js';
|
|
5
5
|
export const AI_CLASSES = ['read', 'preview', 'draft', 'human-only', 'hidden'];
|
|
6
6
|
export const INFRASTRUCTURE_METHODS = new Set(['synopkgland.describe', 'identity.status', 'identity.login', 'identity.session', 'identity.logout']);
|
|
@@ -12,7 +12,7 @@ export function registryFile(root, file) {
|
|
|
12
12
|
return path;
|
|
13
13
|
}
|
|
14
14
|
export function readRegistry(path) {
|
|
15
|
-
const raw =
|
|
15
|
+
const raw = readFileSync(path);
|
|
16
16
|
const value = strictJson(raw);
|
|
17
17
|
validateRegistry(value);
|
|
18
18
|
return value;
|
package/dist/error-registry.js
CHANGED
|
@@ -35,6 +35,7 @@ export const ERROR_REGISTRY = {
|
|
|
35
35
|
INIT_UPSTREAM_IMAGE_INVALID: { code: "INIT_UPSTREAM_IMAGE_INVALID", description: "The upstream image repository is invalid.", suggestion: "Supply the official repository without a tag or digest; upgrade.sh selects the matching release and resolves its digest." },
|
|
36
36
|
CTL_APP_NEEDS_APPROVAL: { "code": "CTL_APP_NEEDS_APPROVAL", "description": "The installed App needs approval or re-approval.", "suggestion": "Run synopkgland ctl list --app <package-id> --approve-installed --host <host>." },
|
|
37
37
|
COMPOSE_HEALTH_REQUIRED: { code: "COMPOSE_HEALTH_REQUIRED", description: "Compose web readiness was not selected.", suggestion: "Set compose.web.health.path and expected 2xx status for the actual App; redirects are not followed." },
|
|
38
|
+
CTL_LEGACY_COMMANDS_DEPRECATED: { code: 'CTL_LEGACY_COMMANDS_DEPRECATED', description: 'The App uses the supported legacy ctl.commands declaration.', suggestion: 'Plan migration to ctl.registry when ready; check and build continue to support v1.' },
|
|
38
39
|
CTL_REGISTRY_REQUIRED: { code: 'CTL_REGISTRY_REQUIRED', description: 'The App needs a single operation registry.', suggestion: 'Replace ctl.commands with ctl.registry and run synopkgland ctl generate.' },
|
|
39
40
|
CTL_REGISTRY_INVALID: { code: 'CTL_REGISTRY_INVALID', description: 'The operation registry is invalid.', suggestion: 'Declare every method with its required ai class, schemas, effect, permission and fixed flow.' },
|
|
40
41
|
CTL_ROUTE_MISMATCH: { code: 'CTL_ROUTE_MISMATCH', description: 'Operation specs and registered handlers differ.', suggestion: 'Match all method names and permissions in both directions, including hidden methods.' },
|
package/dist/nas/transport.js
CHANGED
|
@@ -34,6 +34,8 @@ export function createRequest(origin, timeoutMs = undefined, ca, trust) {
|
|
|
34
34
|
if (url.origin !== origin || (session && session.origin !== origin))
|
|
35
35
|
throw new CtlError('CTL_ORIGIN_MISMATCH', 'Credentials cannot cross NAS origins.', 'run: synopkgland host list', 4);
|
|
36
36
|
const form = body instanceof URLSearchParams;
|
|
37
|
+
// Discovery returns the trusted App-authored registry, rather than operation input.
|
|
38
|
+
const description = !(body instanceof URLSearchParams) && body.method === 'synopkgland.describe' && path.startsWith('/webman/3rdparty/') && path.endsWith('/cgi/api.cgi');
|
|
37
39
|
const payload = Buffer.from(form ? body.toString() : JSON.stringify(body));
|
|
38
40
|
if (payload.length > 1048576)
|
|
39
41
|
throw new CtlError('CTL_INPUT_TOO_LARGE', 'Request exceeds 1 MiB.', 'Reduce the input.');
|
|
@@ -56,7 +58,7 @@ export function createRequest(origin, timeoutMs = undefined, ca, trust) {
|
|
|
56
58
|
}
|
|
57
59
|
const chunks = [];
|
|
58
60
|
let length = 0;
|
|
59
|
-
res.on('data', (c) => { length += c.length; if (length > 1048576) {
|
|
61
|
+
res.on('data', (c) => { length += c.length; if (!description && length > 1048576) {
|
|
60
62
|
res.destroy();
|
|
61
63
|
reject(new CtlError('CTL_RESPONSE_TOO_LARGE', 'Response exceeds 1 MiB.', 'Use a smaller operation.', 5));
|
|
62
64
|
}
|
|
@@ -76,6 +76,12 @@ export declare function executorPolicy(m: {
|
|
|
76
76
|
status: number;
|
|
77
77
|
uninstall: number;
|
|
78
78
|
};
|
|
79
|
+
declaredLifecycleTimeouts?: Partial<{
|
|
80
|
+
start: number;
|
|
81
|
+
stop: number;
|
|
82
|
+
status: number;
|
|
83
|
+
uninstall: number;
|
|
84
|
+
}>;
|
|
79
85
|
backend?: {
|
|
80
86
|
kind: string;
|
|
81
87
|
timeoutSeconds?: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_OPERATION_TIMEOUT_SECONDS } from './operation-budget.js';
|
|
1
2
|
import { operationBudgetSeconds } from "./runtime-budgets.js";
|
|
2
3
|
import { validWebAPIProfiles, sortedWebAPIProfiles } from './webapi-profile.js';
|
|
3
4
|
import { createHash } from 'node:crypto';
|
|
@@ -51,6 +52,9 @@ export function executorPolicy(m, arch) {
|
|
|
51
52
|
root[op.name] = rootEntry(op, settings?.programs?.[op.name], arch);
|
|
52
53
|
operations.push(...rootOperations(root));
|
|
53
54
|
}
|
|
55
|
+
// Loaded manifests retain only author-declared lifecycle overrides here.
|
|
56
|
+
// Direct callers can still supply normalized settings explicitly.
|
|
57
|
+
const lifecycle = m.declaredLifecycleTimeouts ?? m.lifecycleTimeouts ?? m.daemon?.timeouts;
|
|
54
58
|
const d = m.capabilities.delegate;
|
|
55
59
|
const purge = m.capabilities.rootOps ? m.uninstall?.purge.root : undefined;
|
|
56
60
|
return { v: 1, package: m.package, app: `SYNO.SDS.${m.package}.Instance`, ...(m.entry ? { entry: m.entry } : {}), ...(d ? { scope: d.scope } : {}),
|
|
@@ -58,12 +62,12 @@ export function executorPolicy(m, arch) {
|
|
|
58
62
|
operations: [...new Set(operations)].sort(), ...(portal ? { portal } : {}), ...(purge ? { purge } : {}), ...(settings?.stop ? { stop: settings.stop } : {}),
|
|
59
63
|
...(settings?.start ? { start: settings.start } : {}),
|
|
60
64
|
...(m.capabilities.webapi ? { webapi: sortedWebAPIProfiles(m.capabilities.webapi) } : {}),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
timeouts: {
|
|
66
|
+
start: lifecycle?.start ?? DEFAULT_OPERATION_TIMEOUT_SECONDS,
|
|
67
|
+
stop: lifecycle?.stop ?? DEFAULT_OPERATION_TIMEOUT_SECONDS,
|
|
68
|
+
purge: lifecycle?.uninstall ?? Math.min(3600, Math.max(DEFAULT_OPERATION_TIMEOUT_SECONDS, m.uninstall?.purge.timeout ?? 0)),
|
|
69
|
+
operation: operationBudgetSeconds(m),
|
|
70
|
+
},
|
|
67
71
|
root, ...(settings?.state ? { root_state: true } : {}) };
|
|
68
72
|
}
|
|
69
73
|
/** A script without settings keeps the bare digest; a binary pins the bytes built for this architecture. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
// Build-time snapshot of the SDK timeout contract, shipped in schema/.
|
|
3
3
|
const budget = JSON.parse(readFileSync(new URL('../../schema/sdk-timeouts.json', import.meta.url), 'utf8'));
|
|
4
|
+
export const DEFAULT_OPERATION_TIMEOUT_SECONDS = budget.executor.op_s;
|
|
4
5
|
export const DEFAULT_OPERATION_TIMEOUT_MS = budget.request.default_s * 1000;
|
|
5
6
|
export const RESPONSE_RESERVE_MS = budget.browser.margin_ms;
|
|
@@ -16,7 +16,7 @@ interface OperationBudgetSource {
|
|
|
16
16
|
/**
|
|
17
17
|
* A CGI's declared request budget owns operation work. Binary and Compose Apps
|
|
18
18
|
* have no compiled CGI deadline to configure, so their existing status allowance
|
|
19
|
-
* can enlarge the shared operation budget above
|
|
19
|
+
* can enlarge the shared operation budget above the SDK shared default.
|
|
20
20
|
*/
|
|
21
21
|
export declare function operationBudgetSeconds(source: OperationBudgetSource): number;
|
|
22
22
|
/** First released SDK that decodes operation/lifecycle budget config fields. */
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { DEFAULT_OPERATION_TIMEOUT_SECONDS } from './operation-budget.js';
|
|
1
2
|
/**
|
|
2
3
|
* A CGI's declared request budget owns operation work. Binary and Compose Apps
|
|
3
4
|
* have no compiled CGI deadline to configure, so their existing status allowance
|
|
4
|
-
* can enlarge the shared operation budget above
|
|
5
|
+
* can enlarge the shared operation budget above the SDK shared default.
|
|
5
6
|
*/
|
|
6
7
|
export function operationBudgetSeconds(source) {
|
|
7
|
-
return source.backend?.timeoutSeconds ?? Math.max(
|
|
8
|
+
return source.backend?.timeoutSeconds ?? Math.max(DEFAULT_OPERATION_TIMEOUT_SECONDS, source.lifecycleTimeouts?.status ?? source.daemon?.timeouts?.status ?? 5);
|
|
8
9
|
}
|
|
9
10
|
/** First released SDK that decodes operation/lifecycle budget config fields. */
|
|
10
11
|
export function runtimeBudgetSdkSupported(sdk) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { portalByExecutor } from '../build-spk/dsm-version.js';
|
|
2
2
|
import { generateOperations } from './operation-registry.js';
|
|
3
3
|
import { readFileSync, mkdtempSync, writeFileSync, rmSync } from 'node:fs';
|
|
4
|
+
import { makeDescriptor, validateDescriptor, flowMethods } from '../ctl/descriptor.js';
|
|
4
5
|
import { tmpdir } from 'node:os';
|
|
5
6
|
import { requiredSdk } from '../runtime/sdk-source.js';
|
|
6
7
|
import { renderBridgeJson } from './bridge-json.js';
|
|
@@ -21,7 +22,7 @@ export async function buildApiDescription(m, bridgeMethods, run) {
|
|
|
21
22
|
return undefined;
|
|
22
23
|
if (m.backend.kind === 'binary' || m.compose)
|
|
23
24
|
throw new StandaloneBuildError('CTL_UNSUPPORTED_BACKEND', 'Automatic API descriptions require a standard SDK native App.');
|
|
24
|
-
|
|
25
|
+
return buildLegacyApiDescription(m, await describeApiRoutes(m, bridgeMethods, run));
|
|
25
26
|
}
|
|
26
27
|
export async function describeApiRoutes(m, bridgeMethods, run) {
|
|
27
28
|
if (m.backend.kind === 'binary')
|
|
@@ -63,3 +64,59 @@ export async function describeApiRoutes(m, bridgeMethods, run) {
|
|
|
63
64
|
throw new StandaloneBuildError('CTL_DESCRIBE_FAILED', 'Invalid registry snapshot.');
|
|
64
65
|
return methods.map(route => m.entry === 'admin-only' && !['identity.status', 'identity.login', 'identity.session', 'identity.logout'].includes(route.method) ? { ...route, permission: 'administrators' } : route);
|
|
65
66
|
}
|
|
67
|
+
/** Retain the v1 protocol for existing Apps; new registries use the v2 path above. */
|
|
68
|
+
function buildLegacyApiDescription(m, methods) {
|
|
69
|
+
const ctl = m.ctl;
|
|
70
|
+
const registry = new Map(methods.map(item => [item.method, item.permission]));
|
|
71
|
+
const rawHTTP = new Set(methods.filter(item => item.kind === 'http').map(item => item.method));
|
|
72
|
+
const nonRPC = new Set(methods.filter(item => item.kind && item.kind !== 'json').map(item => item.method));
|
|
73
|
+
// Identity transport routes are outside the business registry but have immutable SDK ownership.
|
|
74
|
+
if (m.capabilities.identity) {
|
|
75
|
+
registry.set('identity.session', 'public');
|
|
76
|
+
registry.set('identity.logout', 'public');
|
|
77
|
+
}
|
|
78
|
+
const bindings = {};
|
|
79
|
+
const commands = {};
|
|
80
|
+
if (ctl.external) {
|
|
81
|
+
if (m.capabilities.identity)
|
|
82
|
+
throw new StandaloneBuildError('CTL_EXTERNAL_TRANSPORT', 'External entries require the DSM session transport.');
|
|
83
|
+
for (const entry of Object.values(ctl.external)) {
|
|
84
|
+
if (!entry || typeof entry.method !== 'string' || !registry.has(entry.method) || nonRPC.has(entry.method) || m.entry !== 'admin-only' && registry.get(entry.method) !== 'administrators')
|
|
85
|
+
throw new StandaloneBuildError('CTL_EXTERNAL_ENTRY', 'External entries require registered administrator RPC methods.');
|
|
86
|
+
registry.set(entry.method, 'administrators');
|
|
87
|
+
bindings[entry.method] = { permission: 'administrators', effect: 'destructive' };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const weights = { read: 0, write: 1, destructive: 2 };
|
|
91
|
+
for (const [id, declared] of Object.entries(ctl.commands)) {
|
|
92
|
+
const command = structuredClone(declared);
|
|
93
|
+
const names = flowMethods(command.flow);
|
|
94
|
+
let permission = 'public';
|
|
95
|
+
for (const name of names) {
|
|
96
|
+
if (rawHTTP.has(name))
|
|
97
|
+
throw new StandaloneBuildError('CTL_COMMAND_UNREGISTERED', `Command ${id} references raw HTTP route ${name}; ctl commands require RPC methods.`);
|
|
98
|
+
if (!registry.has(name))
|
|
99
|
+
throw new StandaloneBuildError('CTL_COMMAND_UNREGISTERED', `Command ${id} references unregistered method ${name}.`);
|
|
100
|
+
const effective = m.entry === 'admin-only' ? 'administrators' : registry.get(name);
|
|
101
|
+
registry.set(name, effective);
|
|
102
|
+
const effect = command.flow.type === 'job' && name !== command.flow.start ? 'read' : command.effect;
|
|
103
|
+
const previous = bindings[name];
|
|
104
|
+
if (!previous || weights[effect] > weights[previous.effect])
|
|
105
|
+
bindings[name] = { permission: effective, effect };
|
|
106
|
+
if (effective === 'administrators' || effective === 'authenticated' && permission === 'public')
|
|
107
|
+
permission = effective;
|
|
108
|
+
}
|
|
109
|
+
commands[id] = { ...command, permission };
|
|
110
|
+
}
|
|
111
|
+
if (m.capabilities.identity) {
|
|
112
|
+
for (const method of ['identity.session', 'identity.logout'])
|
|
113
|
+
bindings[method] = { permission: 'public', effect: 'write' };
|
|
114
|
+
}
|
|
115
|
+
const description = makeDescriptor({ package: { id: m.package, version: m.spkVersion, displayName: m.displayname }, aliases: ctl.aliases ?? [m.package.toLowerCase()], provenance: { developedBy: ctl.developedBy ?? 'unknown', generator: 'synopkgland-cli' }, entry: m.entry ?? 'policy', transport: { path: `/webman/3rdparty/${m.package}/cgi/api.cgi`, auth: m.capabilities.identity ? 'dsm-app-session' : 'dsm-session' }, commands, bindings, ...(ctl.external ? { external: ctl.external } : {}) });
|
|
116
|
+
try {
|
|
117
|
+
return { description: validateDescriptor(description, m.package, m.spkVersion), registry: Object.fromEntries(registry) };
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
throw new StandaloneBuildError('CTL_DESCRIPTOR_INVALID', error.message);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -95,6 +95,8 @@ export interface StandaloneManifest {
|
|
|
95
95
|
};
|
|
96
96
|
daemon?: Daemon;
|
|
97
97
|
lifecycleTimeouts?: Daemon["timeouts"];
|
|
98
|
+
/** Author-supplied overrides, before daemon supervision defaults are filled. */
|
|
99
|
+
declaredLifecycleTimeouts?: Partial<Daemon["timeouts"]>;
|
|
98
100
|
/** `identity_gateway`: signs DSM users in to the daemon's own web UI. */
|
|
99
101
|
identityGateway?: IdentityGateway;
|
|
100
102
|
compose?: ComposeApp;
|
|
@@ -607,6 +607,8 @@ function readManifest(raw, c) {
|
|
|
607
607
|
...(daemon ? { daemon } : {}),
|
|
608
608
|
...(dependencies ? { dependencies } : {}),
|
|
609
609
|
...(lifecycleTimeouts ? { lifecycleTimeouts } : {}),
|
|
610
|
+
declaredLifecycleTimeouts: isRecord(raw.daemon) && isRecord(raw.daemon.timeouts)
|
|
611
|
+
? { ...raw.daemon.timeouts } : {},
|
|
610
612
|
...(identityGateway ? { identityGateway } : {}),
|
|
611
613
|
...(compose ? { compose } : {}),
|
|
612
614
|
...(uninstall ? { uninstall } : {}),
|
package/dist/validate.js
CHANGED
|
@@ -37,6 +37,12 @@ export function validateProject(project, _options = {}) {
|
|
|
37
37
|
"Correct the schema-2 declaration; see the SDK Compose support matrix.",
|
|
38
38
|
})),
|
|
39
39
|
}
|
|
40
|
-
: { ok: true, errors: [], warnings: upstreamAttributionWarnings(project.root)
|
|
40
|
+
: { ok: true, errors: [], warnings: [...upstreamAttributionWarnings(project.root),
|
|
41
|
+
...(loaded.ok && 'ctl' in loaded.manifest && loaded.manifest.ctl?.enabled && !loaded.manifest.ctl.registry ? [{
|
|
42
|
+
code: 'CTL_LEGACY_COMMANDS_DEPRECATED', severity: 'warning',
|
|
43
|
+
span: { file, line: 1, column: 1 },
|
|
44
|
+
message: 'Legacy ctl.commands is deprecated and remains supported for check and build.',
|
|
45
|
+
suggestion: 'Plan migration to ctl.registry when ready; this warning does not block existing Apps.',
|
|
46
|
+
}] : [])] };
|
|
41
47
|
}
|
|
42
48
|
export { findProjectRoot } from "./discovery.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/cli",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.5",
|
|
4
4
|
"description": "Syno Package Land Developer Kit CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,12 +24,14 @@
|
|
|
24
24
|
"test:glossary": "node --test scripts/test/glossary-drift.test.mjs",
|
|
25
25
|
"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",
|
|
26
26
|
"gates": "bash scripts/ci/gates.sh",
|
|
27
|
-
"gates:fast": "bash scripts/ci/gates.sh
|
|
28
|
-
"prepublishOnly": "npm run build"
|
|
27
|
+
"gates:fast": "bash scripts/ci/gates.sh",
|
|
28
|
+
"prepublishOnly": "npm run build",
|
|
29
|
+
"gates:full": "bash scripts/ci/gates.sh --full",
|
|
30
|
+
"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"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|
|
31
33
|
"@napi-rs/keyring": "^2.1.1",
|
|
32
|
-
"@synopackageland/templates": "~0.
|
|
34
|
+
"@synopackageland/templates": "~0.40.0",
|
|
33
35
|
"ajv": "^8.17.1",
|
|
34
36
|
"commander": "^13.1.0",
|
|
35
37
|
"json-canonicalize": "^3.0.1",
|
package/skills/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Initialize, extend, check, build, inspect, and deploy Synology appl
|
|
|
5
5
|
|
|
6
6
|
# Independent Synology SPKs
|
|
7
7
|
|
|
8
|
-
The CLI installs templates through
|
|
8
|
+
The CLI installs templates through one minor line. A templates patch needs only a
|
|
9
9
|
templates release; npm install/update selects a patch in that minor line. The CLI
|
|
10
10
|
uses the locally installed templates and reads their SDK pin for defaults; it
|
|
11
11
|
never downloads templates at runtime. Preserve the lockfile and use `npm ci` for
|
|
@@ -14,7 +14,7 @@ the CLI: executor manifest format 1 in the resolved SDK pins the executor releas
|
|
|
14
14
|
Go toolchain and six payload digests. Preserve npm integrity and Go module sums.
|
|
15
15
|
The CLI verifies bytes before packaging and never fetches a manifest at NAS runtime.
|
|
16
16
|
Unsupported formats require a CLI update; invalid manifests fail closed.
|
|
17
|
-
Current scaffolds pin SDK/App
|
|
17
|
+
Current scaffolds pin one SDK/App release and declare operations in one v2 registry.
|
|
18
18
|
|
|
19
19
|
For Apps with data folders or gateway listeners, read [reference/install.md](reference/install.md). Default to an App-named dedicated DSM data share and installer-selected ports. Existing-folder access, port number format/range and required HTTPS origins use localized wizard validation before Next; detected port conflicts are nonblocking inline warnings, and an unavailable DSM port inventory does not block installation; upgrades retain port selections.
|
|
20
20
|
|
|
@@ -356,3 +356,11 @@ Use opt-in `identity_gateway.ingress: {path: /my-app/}` for
|
|
|
356
356
|
upstreams with a hardcoded base path. Read [reference/identity-gateway.md](reference/identity-gateway.md)
|
|
357
357
|
for reserved paths, install-time ownership checks and unchanged auth policy.
|
|
358
358
|
Apps requiring `/` cannot use ingress.
|
|
359
|
+
|
|
360
|
+
## Maintaining this CLI
|
|
361
|
+
|
|
362
|
+
For CLI releases, `npm run gates` runs basic build/typecheck, core unit checks,
|
|
363
|
+
npm pack and tarball content checks. Run `npm run gates:full` only when the user
|
|
364
|
+
explicitly requests extended matrices and integration checks. Publishing does
|
|
365
|
+
not require a full-gate result. Application fixture acceptance remains scoped
|
|
366
|
+
to the application task's authorization.
|
|
@@ -26,7 +26,7 @@ compose:
|
|
|
26
26
|
network: {egress: isolated}
|
|
27
27
|
# Private package binds are rejected by DSM build; keep compatible upstream named volumes.
|
|
28
28
|
identity_gateway:
|
|
29
|
-
sdk:
|
|
29
|
+
sdk: <sdk-version>
|
|
30
30
|
mode: none
|
|
31
31
|
access: dsm-users
|
|
32
32
|
listen: {http: 28000}
|
|
@@ -39,7 +39,7 @@ architecture-specific native payloads for token/account adapters. All lifecycle
|
|
|
39
39
|
scripts run as the package account; containers are managed by Container Manager.
|
|
40
40
|
|
|
41
41
|
For external access, pin both `compose.sdk` and `identity_gateway.sdk` to
|
|
42
|
-
|
|
42
|
+
the scaffold's SDK release and use the gateway's
|
|
43
43
|
[`external_access` policy and DSM settings entry](identity-gateway.md#external-access).
|
|
44
44
|
Declare required HTTPS origins through `install.settings`; wizard validation checks the selected HTTPS port before Next. See [install.md](install.md).
|
|
45
45
|
Manual URL configuration does not require Connect. The SDK resolves the public
|
|
@@ -260,7 +260,7 @@ declared availability readiness, LAN isolation/egress, protected grant lifecycle
|
|
|
260
260
|
ACLs, two-user visibility and clean install/upgrade/reboot/stop/uninstall before
|
|
261
261
|
calling the package supported on a NAS. No NAS is accessed by the build gate.
|
|
262
262
|
|
|
263
|
-
The unified Compose contract uses SDK defaults from locally installed templates
|
|
263
|
+
The unified Compose contract uses SDK defaults from the locally installed templates. Templates patches can ship independently; npm install/update resolves them, and SDK defaults come from the installed templates. SDK minor upgrades do not require a CLI release when they declare supported executor manifest format 1; the resolved SDK owns the release mapping and verified payload digests. The CLI does not fetch templates at runtime. The legacy packaging route and bridge publish mode are removed.
|
|
264
264
|
|
|
265
265
|
Primary override files, and each included override set, must share a directory. Cross-directory override bases are rejected before loader I/O. Included implicit .env files are confined, inventoried and preserved; symlinks are rejected.
|
|
266
266
|
|
|
@@ -46,8 +46,8 @@ rootOps 與 delegate 已共用管理員 PasswordConfirm 核准的 protected exec
|
|
|
46
46
|
backend 寫 `runtime: python|node|rust`(`runtime: go` 等同 `kind: go`)。CGI 是 SDK 的 Go runtime(`bridge/cmd/runtime`),它驗證 DSM session、entry 與 `permissions.json` 後,以套件帳號(不是 root)每個請求啟動一次 App。App 放在 ui 以外的目錄,打包成 `target/app/`,build 寫入 `bridge.json`(spec/bridge/v1)並把它與 `permissions.json` 的 sha256 編進 runtime。
|
|
47
47
|
|
|
48
48
|
```yaml
|
|
49
|
-
backend: {runtime: python, dir: app, entry: main.py, sdk:
|
|
50
|
-
backend: {runtime: node, dir: app, entry: main.mjs, sdk:
|
|
49
|
+
backend: {runtime: python, dir: app, entry: main.py, sdk: <sdk-version>}
|
|
50
|
+
backend: {runtime: node, dir: app, entry: main.mjs, sdk: <sdk-version>, node: {package: Node.js_v22}}
|
|
51
51
|
backend: {runtime: rust, dir: app, entry: hello, methods: [hello.greet]}
|
|
52
52
|
```
|
|
53
53
|
|
|
@@ -93,7 +93,7 @@ func deadline() api.DeadlineOption {
|
|
|
93
93
|
|
|
94
94
|
直接 File Station 瀏覽器讀取預設也為 302 秒;identity gateway 等候 upstream headers 預設 310 秒,自訂期限需對齊 gateway 與外部 proxy。這些預設不保證所有 DSM/proxy 都能完成五分鐘請求。executor batch 的 60 秒上限、已核准 root policy/program budget 與 credential lifetime 維持原契約;長 root 工作使用既有 `root.start` / `root.jobs.*`。
|
|
95
95
|
|
|
96
|
-
`ctl` transport 採 SDK 共用的五分鐘操作預算與回覆保留時間;job flow 不以累計時間中止存活工作。長工作必須映射既有 job flow,不以延長同步等待取代非同步 API;參考 [ctl](ctl.md)。完整契約見 SDK 的 [request deadlines](https://github.com/synopackageland/syno-pkg-land-sdk/blob/
|
|
96
|
+
`ctl` transport 採 SDK 共用的五分鐘操作預算與回覆保留時間;job flow 不以累計時間中止存活工作。長工作必須映射既有 job flow,不以延長同步等待取代非同步 API;參考 [ctl](ctl.md)。完整契約見 SDK 的 [request deadlines](https://github.com/synopackageland/syno-pkg-land-sdk/blob/main/docs/request-deadlines.md)。
|
|
97
97
|
|
|
98
98
|
DSM 視窗預設 960×640、最小 700×420;`ui.window` 只寫要改的欄位:
|
|
99
99
|
|
package/skills/reference/ctl.md
CHANGED
|
@@ -121,10 +121,15 @@ actual upstream token/header/API-password mapping and shared-account semantics.
|
|
|
121
121
|
|
|
122
122
|
## Designing commands for AI
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
New Apps have one `synopkgland.api` v2 operation spec (`operations.json`; OSS
|
|
125
125
|
wrappers keep it under `synology/`). Set `ctl: {enabled: true, registry:
|
|
126
126
|
operations.json}` relative to the packaging manifest. Do not maintain a second
|
|
127
|
-
list of summaries or command schemas.
|
|
127
|
+
list of summaries or command schemas. Existing v1 `ctl.commands` Apps continue
|
|
128
|
+
passing check and build; check emits one nonblocking deprecation warning.
|
|
129
|
+
Migrate them deliberately, keeping their registered methods and permissions.
|
|
130
|
+
App-authored registry files and authenticated discovery responses have no byte-size
|
|
131
|
+
cap. Runtime description/registry loading also needs the matching SDK metadata fix;
|
|
132
|
+
ordinary operation input limits continue to apply.
|
|
128
133
|
Each real method has one English `summary`, `paramsSchema`, `resultSchema`,
|
|
129
134
|
`effect`, `permission`, fixed `flow`, `cli` path and required `ai` class:
|
|
130
135
|
|
|
@@ -152,7 +157,7 @@ direction, including hidden routes. The only infrastructure exceptions are the
|
|
|
152
157
|
fixed describe and identity ceremony methods. SDK capability metadata comes from
|
|
153
158
|
the SDK's own hidden catalog and can be explicitly overridden in the App spec.
|
|
154
159
|
Never hand-edit generated operation descriptions or add them to a skill manually.
|
|
155
|
-
Current scaffolds
|
|
160
|
+
Current scaffolds pin the SDK release of the installed templates.
|
|
156
161
|
|
|
157
162
|
For installed Apps, use `ctl tools <app> --host <profile>` and
|
|
158
163
|
`ctl tool <app> <method> --input <file|-> --host <profile>`. These require the
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Upstream-authenticated paths
|
|
4
4
|
|
|
5
|
-
Build with SDK
|
|
5
|
+
Build with the SDK the scaffold pins. Use `upstream_auth_paths` for client API
|
|
6
6
|
paths that use upstream authentication.
|
|
7
7
|
|
|
8
8
|
Keep browser routes behind `entry: admin-only` or `entry: app-privilege`; list
|
|
@@ -22,12 +22,12 @@ See `docs/app-entry.md` for the complete contract.
|
|
|
22
22
|
|
|
23
23
|
## External access
|
|
24
24
|
|
|
25
|
-
Use SDK
|
|
25
|
+
Use the scaffold's SDK release with matching gateway sources. Add this to the existing
|
|
26
26
|
complete gateway declaration; keep the App's upstream, listener and auth policy:
|
|
27
27
|
|
|
28
28
|
```yaml
|
|
29
29
|
identity_gateway:
|
|
30
|
-
sdk:
|
|
30
|
+
sdk: <sdk-version>
|
|
31
31
|
external_access:
|
|
32
32
|
connect: optional # optional | none
|
|
33
33
|
origin_change: none # none | confirm
|
|
@@ -191,7 +191,7 @@ For user-controlled mobile API or WebDAV access, declare fixed prefixes:
|
|
|
191
191
|
```yaml
|
|
192
192
|
identity_gateway:
|
|
193
193
|
# Add to the existing complete identity_gateway declaration.
|
|
194
|
-
sdk:
|
|
194
|
+
sdk: <sdk-version>
|
|
195
195
|
optional_passthrough:
|
|
196
196
|
mobile:
|
|
197
197
|
prefixes: [/dav, /api/mobile]
|
|
@@ -231,7 +231,7 @@ An upstream with its own OIDC login can opt into a generic browser bridge:
|
|
|
231
231
|
install:
|
|
232
232
|
ports: true
|
|
233
233
|
identity_gateway:
|
|
234
|
-
sdk:
|
|
234
|
+
sdk: <sdk-version>
|
|
235
235
|
mode: oidc
|
|
236
236
|
access: dsm-admins
|
|
237
237
|
upstream: 8000
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Native installation settings
|
|
2
2
|
|
|
3
|
-
Use CLI
|
|
3
|
+
Use the CLI with the SDK/App release its templates pin. Configure installation through the manifest and generated wizard; do not add App ACL writers, root hooks or independent port state.
|
|
4
4
|
|
|
5
5
|
```yaml
|
|
6
6
|
install:
|
|
@@ -11,7 +11,7 @@ install:
|
|
|
11
11
|
name: MyApp
|
|
12
12
|
permission: rw
|
|
13
13
|
identity_gateway:
|
|
14
|
-
sdk:
|
|
14
|
+
sdk: <sdk-version>
|
|
15
15
|
listen: {https: 28443}
|
|
16
16
|
```
|
|
17
17
|
|
|
@@ -121,7 +121,7 @@ allowance with `KillMode=control-group`.
|
|
|
121
121
|
|
|
122
122
|
`backend.timeout_seconds` owns request/operation work. Binary and Compose Apps
|
|
123
123
|
without a CGI request setting can enlarge the shared operation allowance through
|
|
124
|
-
`daemon.timeouts.status` above
|
|
124
|
+
`daemon.timeouts.status` above the SDK shared operation default. Generated gateway and
|
|
125
125
|
approved executor configurations inherit it; nested calls use remaining time and
|
|
126
126
|
leave response reserve. Budget changes in the protected policy require renewed
|
|
127
127
|
approval and do not change token/session/grant lifetimes.
|