@synopackageland/cli 0.48.1 → 0.48.2
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 +8 -0
- package/README.md +10 -7
- package/dist/ctl/descriptor.d.ts +1 -1
- package/dist/ctl/descriptor.js +1 -1
- package/dist/ctl/flows.d.ts +2 -1
- package/dist/ctl/flows.js +19 -5
- package/dist/ctl/service.d.ts +2 -0
- package/dist/ctl/service.js +9 -5
- package/dist/nas/transport.d.ts +2 -2
- package/dist/nas/transport.js +4 -3
- package/dist/runtime/operation-budget.d.ts +2 -0
- package/dist/runtime/operation-budget.js +5 -0
- package/dist/runtime/sdk-source.d.ts +1 -1
- package/dist/runtime/sdk-source.js +1 -1
- package/dist/runtime/sdk-timeouts.js +2 -1
- package/dist/standalone/manifest.js +3 -1
- package/package.json +1 -1
- package/schema/bridge-manifest.v1.schema.json +1 -1
- package/schema/sdk-timeouts.json +24 -0
- package/schema/synopkgland-api-v1.schema.json +1 -2
- package/skills/SKILL.md +1 -1
- package/skills/reference/create.md +1 -1
- package/skills/reference/ctl.md +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.48.2
|
|
4
|
+
|
|
5
|
+
- Pin SDK 0.49.5 for CLI-owned controllers and planning so they inherit the shared operation policy
|
|
6
|
+
- Make job flow timeoutMs optional; use the SDK operation allowance for each query and keep live jobs polling until completion or cancellation
|
|
7
|
+
- Preserve job IDs and dispatch start once; abort pending JSON reads when local waiting is canceled
|
|
8
|
+
- Use the SDK timeout contract for ctl defaults and allow unconfigured root programs to share the parent request budget
|
|
9
|
+
- Build CLI-owned controllers against the published SDK 0.49.5 and its protected executor inventory; retain explicit App SDK pins and templates ~0.39.2
|
|
10
|
+
|
|
3
11
|
## 0.48.1
|
|
4
12
|
|
|
5
13
|
- Align Go requirement messages, native build guidance and fixtures with Go 1.26.10 (#130)
|
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ 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 0.
|
|
92
|
+
The CLI pins SDK 0.49.5 for its daemon controllers, Compose planning and installer
|
|
93
93
|
context. Explicit App SDK declarations take precedence. Templates use ~0.39.2
|
|
94
94
|
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
|
|
@@ -364,7 +364,7 @@ contract for the complete transport and CGI validation rules.
|
|
|
364
364
|
|
|
365
365
|
`webapi.call` request parameters are JSON-only; it has no request upload field.
|
|
366
366
|
Use streaming `files.write` for uploads, up to 100 MiB per file. Reads and URL
|
|
367
|
-
downloads retain their separate 64 MiB limit. Rebuild with SDK 0.
|
|
367
|
+
downloads retain their separate 64 MiB limit. Rebuild with SDK 0.49.5 and approve
|
|
368
368
|
the refreshed executor payload.
|
|
369
369
|
|
|
370
370
|
## App launch mode
|
|
@@ -570,11 +570,14 @@ such as `CTL_DESCRIPTOR_INVALID`, remain specific errors (exit 5).
|
|
|
570
570
|
`host list/show` can also succeed while reporting `authenticated:false` and
|
|
571
571
|
exit 0. Check discovery `apps`/`diagnostics` and session fields as well as the exit
|
|
572
572
|
code when deciding whether an App is ready.
|
|
573
|
-
`ctl --timeout <seconds>` applies to discovery, JSON calls
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
573
|
+
`ctl --timeout <seconds>` applies to discovery, JSON calls and transfer inactivity.
|
|
574
|
+
The default is the SDK's shared five-minute work allowance plus its two-second
|
|
575
|
+
response reserve. Synchronous flows consume one remaining allowance. Job flows
|
|
576
|
+
refresh that allowance for each status/result request and keep polling a live job
|
|
577
|
+
until a terminal state or cancellation. `flow.timeoutMs` is optional; an explicit
|
|
578
|
+
value changes per-request waiting, never the elapsed job lifetime. A failed status
|
|
579
|
+
read does not fail or restart the remote job: query its original ID before retrying.
|
|
580
|
+
|
|
578
581
|
|
|
579
582
|
Read `synopkgland skill show ctl` for the AI workflow, batch discovery approval,
|
|
580
583
|
cache refresh, host removal/revocation and `ctl.registry` authoring with `synopkgland.api` v2. Run `ctl generate`,
|
package/dist/ctl/descriptor.d.ts
CHANGED
package/dist/ctl/descriptor.js
CHANGED
|
@@ -113,7 +113,7 @@ export function validateFlow(op, bindings) {
|
|
|
113
113
|
throw Error('binding/effect');
|
|
114
114
|
}
|
|
115
115
|
if (flow.type === 'job') {
|
|
116
|
-
if (!flow.jobId || !flow.idParam || !flow.state || !Array.isArray(flow.done) || !flow.done.length || !Array.isArray(flow.failed) || !Number.isInteger(flow.intervalMs) || flow.intervalMs < 10 || flow.intervalMs > 60000 || !Number.isInteger(flow.timeoutMs) || flow.timeoutMs < flow.intervalMs || flow.timeoutMs > 3600000 || bindings[flow.poll].effect !== 'read' || flow.result && bindings[flow.result].effect !== 'read')
|
|
116
|
+
if (!flow.jobId || !flow.idParam || !flow.state || !Array.isArray(flow.done) || !flow.done.length || !Array.isArray(flow.failed) || !Number.isInteger(flow.intervalMs) || flow.intervalMs < 10 || flow.intervalMs > 60000 || flow.timeoutMs !== undefined && (!Number.isInteger(flow.timeoutMs) || flow.timeoutMs < flow.intervalMs || flow.timeoutMs > 3600000) || bindings[flow.poll].effect !== 'read' || flow.result && bindings[flow.result].effect !== 'read')
|
|
117
117
|
throw Error('job contract');
|
|
118
118
|
}
|
|
119
119
|
if (flow.type === 'paginate' && (!flow.items || !flow.offsetParam || !flow.limitParam || !Number.isInteger(flow.pageSize) || flow.pageSize < 1 || flow.pageSize > 1000 || !Number.isInteger(flow.maxPages) || flow.maxPages < 1 || flow.maxPages > 1000 || op.effect !== 'read'))
|
package/dist/ctl/flows.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ export type Invoke = (method: string, params: Record<string, unknown>) => Promis
|
|
|
3
3
|
export interface FlowOptions {
|
|
4
4
|
wait?: boolean;
|
|
5
5
|
timeoutMs?: number;
|
|
6
|
+
signal?: AbortSignal;
|
|
6
7
|
upload?: (method: string, params: Record<string, unknown>, flow: Extract<Flow, {
|
|
7
8
|
type: 'upload';
|
|
8
9
|
}>) => Promise<unknown>;
|
|
9
10
|
ndjson?: (method: string, params: Record<string, unknown>) => Promise<unknown>;
|
|
10
11
|
}
|
|
11
|
-
export declare function runFlow(flow: Flow, params: Record<string, unknown>,
|
|
12
|
+
export declare function runFlow(flow: Flow, params: Record<string, unknown>, send: Invoke, options: FlowOptions): Promise<any>;
|
package/dist/ctl/flows.js
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
1
2
|
import { CtlError } from './errors.js';
|
|
3
|
+
function canceled() { return new CtlError('CTL_CANCELED', 'Stopped waiting for the job.', 'Query the original job; start was not repeated.', 130); }
|
|
4
|
+
function cancelable(work, signal) {
|
|
5
|
+
if (signal?.aborted)
|
|
6
|
+
return Promise.reject(canceled());
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const abort = () => { signal?.removeEventListener('abort', abort); reject(canceled()); };
|
|
9
|
+
signal?.addEventListener('abort', abort, { once: true });
|
|
10
|
+
const finish = () => signal?.removeEventListener('abort', abort);
|
|
11
|
+
Promise.resolve().then(() => { if (signal?.aborted)
|
|
12
|
+
throw canceled(); return work(); }).then(value => { finish(); resolve(value); }, error => { finish(); reject(error); });
|
|
13
|
+
});
|
|
14
|
+
}
|
|
2
15
|
function field(value, path) { for (const key of path.split('.')) {
|
|
3
16
|
if (!value || typeof value !== 'object' || !Object.hasOwn(value, key))
|
|
4
17
|
return undefined;
|
|
5
18
|
value = value[key];
|
|
6
19
|
} return value; }
|
|
7
|
-
export async function runFlow(flow, params,
|
|
20
|
+
export async function runFlow(flow, params, send, options) {
|
|
21
|
+
const invoke = (method, input) => cancelable(() => send(method, input), options.signal);
|
|
8
22
|
if (flow.type === 'invoke')
|
|
9
23
|
return invoke(flow.method, params);
|
|
10
24
|
if (flow.type === 'upload') {
|
|
@@ -32,21 +46,21 @@ export async function runFlow(flow, params, invoke, options) {
|
|
|
32
46
|
}
|
|
33
47
|
throw new CtlError('CTL_FLOW_LIMIT', 'Pagination page limit reached; result is incomplete.', 'Narrow the query.', 5);
|
|
34
48
|
}
|
|
35
|
-
const until = performance.now() + Math.min(options.timeoutMs ?? flow.timeoutMs, 3600000);
|
|
36
49
|
const accepted = await invoke(flow.start, params);
|
|
37
50
|
if (options.wait === false)
|
|
38
51
|
return { accepted: true, job: accepted };
|
|
39
52
|
const id = field(accepted, flow.jobId);
|
|
40
53
|
if (!['string', 'number'].includes(typeof id))
|
|
41
54
|
throw new CtlError('CTL_FLOW_RESPONSE', 'Start response has no job ID.', 'Check command metadata; start is not retried.', 5);
|
|
42
|
-
while (
|
|
55
|
+
while (true) {
|
|
43
56
|
const poll = await invoke(flow.poll, { [flow.idParam]: id });
|
|
44
57
|
const state = field(poll, flow.state);
|
|
58
|
+
if (typeof state !== 'string')
|
|
59
|
+
throw new CtlError('CTL_FLOW_RESPONSE', 'Job status has no state.', 'Query the original job; start was not repeated.', 5);
|
|
45
60
|
if (flow.failed.includes(state))
|
|
46
61
|
throw new CtlError('CTL_JOB_FAILED', `Job ${id} failed (${state}).`, 'Inspect the job in the App; start was not retried.', 5);
|
|
47
62
|
if (flow.done.includes(state))
|
|
48
63
|
return flow.result ? invoke(flow.result, { [flow.idParam]: id }) : poll;
|
|
49
|
-
await
|
|
64
|
+
await delay(flow.intervalMs, undefined, { signal: options.signal }).catch(() => { throw canceled(); });
|
|
50
65
|
}
|
|
51
|
-
throw new CtlError('CTL_JOB_TIMEOUT', `Wait timed out; job ${id} may still be running.`, 'Query the job status; do not repeat the start blindly.', 6);
|
|
52
66
|
}
|
package/dist/ctl/service.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare class CtlClient {
|
|
|
30
30
|
request: JsonRequest;
|
|
31
31
|
constructor(store: CtlStore, host: Host, request?: JsonRequest, timeoutMs?: number);
|
|
32
32
|
private until?;
|
|
33
|
+
private jobRequestBudget?;
|
|
33
34
|
private remaining;
|
|
34
35
|
valid(): Promise<boolean>;
|
|
35
36
|
inventory(session: DsmSession): Promise<{
|
|
@@ -46,6 +47,7 @@ export declare class CtlClient {
|
|
|
46
47
|
stdin?: string;
|
|
47
48
|
wait?: boolean;
|
|
48
49
|
timeoutMs?: number;
|
|
50
|
+
signal?: AbortSignal;
|
|
49
51
|
}): Promise<any>;
|
|
50
52
|
private executeWithin;
|
|
51
53
|
private appCookieSession;
|
package/dist/ctl/service.js
CHANGED
|
@@ -19,7 +19,8 @@ export class CtlClient {
|
|
|
19
19
|
this.request = request ?? createRequest(host.origin, () => this.remaining(timeoutMs), undefined, store.trust(host));
|
|
20
20
|
}
|
|
21
21
|
until;
|
|
22
|
-
|
|
22
|
+
jobRequestBudget;
|
|
23
|
+
remaining(fallback) { return this.jobRequestBudget ?? (this.until === undefined ? fallback : Math.max(0, this.until - performance.now())); }
|
|
23
24
|
async valid() { try {
|
|
24
25
|
await this.inventory(await this.store.session(this.host));
|
|
25
26
|
return true;
|
|
@@ -121,6 +122,7 @@ export class CtlClient {
|
|
|
121
122
|
}
|
|
122
123
|
finally {
|
|
123
124
|
this.until = undefined;
|
|
125
|
+
this.jobRequestBudget = undefined;
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
128
|
async executeWithin(name, path, args, options = {}) {
|
|
@@ -131,8 +133,10 @@ export class CtlClient {
|
|
|
131
133
|
const { id, operation } = selectOperation(app, path);
|
|
132
134
|
const params = operationInput(operation, args, options.stdin, `run: synopkgland ctl ${name} ${operation.cli.join(' ')} --host ${this.host.name} --help`);
|
|
133
135
|
const output = new SensitiveOutput(params, operation.paramsSchema);
|
|
134
|
-
if (
|
|
135
|
-
this.until =
|
|
136
|
+
if (operation.flow.type === 'job') {
|
|
137
|
+
this.until = undefined;
|
|
138
|
+
this.jobRequestBudget = options.timeoutMs ?? operation.flow.timeoutMs ?? CTL_TIMEOUT_MS;
|
|
139
|
+
}
|
|
136
140
|
try {
|
|
137
141
|
const plan = requestPlan(app, id, params);
|
|
138
142
|
if (operation.flow.type === 'upload')
|
|
@@ -153,14 +157,14 @@ export class CtlClient {
|
|
|
153
157
|
const invoke = async (method, input) => {
|
|
154
158
|
if (!app.payload.bindings[method])
|
|
155
159
|
throw new CtlError('CTL_METHOD_NOT_ALLOWED', 'Flow method is not allowlisted.', 'Refresh the API description.', 4);
|
|
156
|
-
const response = await this.request(app.payload.transport.path, { method, params: input }, appSession);
|
|
160
|
+
const response = await this.request(app.payload.transport.path, { method, params: input }, appSession, options.signal);
|
|
157
161
|
if (response?.success !== true) {
|
|
158
162
|
const code = String(response?.error?.code ?? 'invalid_response');
|
|
159
163
|
throw new CtlError(['admin_required', 'app_privilege_denied'].includes(code) ? 'CTL_PERMISSION_DENIED' : 'CTL_APP_ERROR', `App rejected operation (${code}).`, 'Check command permissions and App state.', ['admin_required', 'app_privilege_denied'].includes(code) ? 4 : 5);
|
|
160
164
|
}
|
|
161
165
|
return response.data;
|
|
162
166
|
};
|
|
163
|
-
const result = await runFlow(operation.flow, params, invoke, { wait: options.wait, timeoutMs: this.remaining(options.timeoutMs ?? CTL_TIMEOUT_MS),
|
|
167
|
+
const result = await runFlow(operation.flow, params, invoke, { wait: options.wait, signal: options.signal, timeoutMs: this.remaining(options.timeoutMs ?? CTL_TIMEOUT_MS),
|
|
164
168
|
ndjson: (method, input) => transferRequest(appSession, app.payload.transport.path, method, input, { trust: this.store.trust(this.host), timeoutMs: this.remaining(options.timeoutMs ?? CTL_TIMEOUT_MS) }),
|
|
165
169
|
upload: (method, input, flow) => transferRequest(appSession, app.payload.transport.path, method, {}, { trust: this.store.trust(this.host), timeoutMs: this.remaining(options.timeoutMs ?? CTL_TIMEOUT_MS), file: { path: String(input[flow.fileParam]), parent: String(input[flow.parentParam]), name: String(input[flow.nameParam]) } }) });
|
|
166
170
|
if (operation.resultSchema && !ajv.validate(operation.resultSchema, result))
|
package/dist/nas/transport.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type HostTls } from './tls.js';
|
|
2
2
|
import http from 'node:http';
|
|
3
|
-
export declare const CTL_TIMEOUT_MS
|
|
3
|
+
export declare const CTL_TIMEOUT_MS: number;
|
|
4
4
|
export declare const APP_COOKIE: unique symbol;
|
|
5
5
|
export interface DsmSession {
|
|
6
6
|
origin: string;
|
|
@@ -9,7 +9,7 @@ export interface DsmSession {
|
|
|
9
9
|
token: string;
|
|
10
10
|
deviceId?: string;
|
|
11
11
|
}
|
|
12
|
-
export type JsonRequest = (path: string, body: URLSearchParams | Record<string, unknown>, session?: DsmSession) => Promise<any>;
|
|
12
|
+
export type JsonRequest = (path: string, body: URLSearchParams | Record<string, unknown>, session?: DsmSession, signal?: AbortSignal) => Promise<any>;
|
|
13
13
|
export declare function canonicalOrigin(input: string, tunnel?: boolean): string;
|
|
14
14
|
export declare function createRequest(origin: string, timeoutMs?: number | (() => number) | undefined, ca?: string, trust?: HostTls): JsonRequest;
|
|
15
15
|
export declare function sessionFetch(url: string, init: RequestInit, session: DsmSession | undefined, ca?: string, trust?: HostTls, timeoutMs?: number): Promise<Response>;
|
package/dist/nas/transport.js
CHANGED
|
@@ -7,7 +7,8 @@ import { nasOptions } from './options.js';
|
|
|
7
7
|
import { readFileSync } from 'node:fs';
|
|
8
8
|
import { CtlError } from '../ctl/errors.js';
|
|
9
9
|
import { dsmRequestTimeoutMs, dsmApiTimeoutMs } from './timeouts.js';
|
|
10
|
-
|
|
10
|
+
import { DEFAULT_OPERATION_TIMEOUT_MS, RESPONSE_RESERVE_MS } from '../runtime/operation-budget.js';
|
|
11
|
+
export const CTL_TIMEOUT_MS = DEFAULT_OPERATION_TIMEOUT_MS + RESPONSE_RESERVE_MS;
|
|
11
12
|
export const APP_COOKIE = Symbol("ctlAppCookie");
|
|
12
13
|
export function canonicalOrigin(input, tunnel = false) {
|
|
13
14
|
let url;
|
|
@@ -22,7 +23,7 @@ export function canonicalOrigin(input, tunnel = false) {
|
|
|
22
23
|
return url.origin;
|
|
23
24
|
}
|
|
24
25
|
export function createRequest(origin, timeoutMs = undefined, ca, trust) {
|
|
25
|
-
return async (path, body, session) => {
|
|
26
|
+
return async (path, body, session, signal) => {
|
|
26
27
|
if (!path.startsWith('/') || path.startsWith('//') || path.includes('?') || path.includes('#') || path.includes('\\') || path.includes('%') || path.split('/').some(p => p === '.' || p === '..'))
|
|
27
28
|
throw new CtlError('CTL_PATH_INVALID', 'Unsafe request path.', 'run: synopkgland ctl list --refresh');
|
|
28
29
|
const params = body instanceof URLSearchParams ? body : undefined;
|
|
@@ -42,7 +43,7 @@ export function createRequest(origin, timeoutMs = undefined, ca, trust) {
|
|
|
42
43
|
headers.cookie = session.cookie;
|
|
43
44
|
headers['X-SYNO-TOKEN'] = session.token;
|
|
44
45
|
}
|
|
45
|
-
const req = nasHttpRequest(url, { method: 'POST', headers }, remaining, trustWithCa(trust, ca), res => {
|
|
46
|
+
const req = nasHttpRequest(url, { method: 'POST', headers, signal }, remaining, trustWithCa(trust, ca), res => {
|
|
46
47
|
if (!res.statusCode || res.statusCode < 200 || res.statusCode >= 300) {
|
|
47
48
|
res.resume();
|
|
48
49
|
reject(new CtlError('CTL_HTTP_ERROR', `HTTP ${res.statusCode}; redirects are never followed.`, 'Check the NAS URL and connection.', 6));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
// Build-time snapshot of the SDK timeout contract, shipped in schema/.
|
|
3
|
+
const budget = JSON.parse(readFileSync(new URL('../../schema/sdk-timeouts.json', import.meta.url), 'utf8'));
|
|
4
|
+
export const DEFAULT_OPERATION_TIMEOUT_MS = budget.request.default_s * 1000;
|
|
5
|
+
export const RESPONSE_RESERVE_MS = budget.browser.margin_ms;
|
|
@@ -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.
|
|
4
|
+
export declare const DEFAULT_SDK_VERSION = "0.49.5";
|
|
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.
|
|
8
|
+
export const DEFAULT_SDK_VERSION = '0.49.5';
|
|
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`;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { DEFAULT_OPERATION_TIMEOUT_MS } from './operation-budget.js';
|
|
1
2
|
import { readFileSync } from 'node:fs';
|
|
2
3
|
import { join } from 'node:path';
|
|
3
4
|
import { appSdkVersion, sdkBelowFloor, sdkSource } from './sdk-source.js';
|
|
4
5
|
/** The SDK's timeouts on the call chain to the executor (spec/protocol/v1, Timeouts). */
|
|
5
6
|
export const SDK_TIMEOUTS_FILE = join('spec', 'protocol', 'v1', 'timeouts.json');
|
|
6
7
|
/** What an App without the SDK waits. */
|
|
7
|
-
export const NO_SDK_TIMEOUTS = { requestDefaultSeconds:
|
|
8
|
+
export const NO_SDK_TIMEOUTS = { requestDefaultSeconds: DEFAULT_OPERATION_TIMEOUT_MS / 1000, browserMarginMs: 2000, rootRunDefaultSeconds: DEFAULT_OPERATION_TIMEOUT_MS / 1000, rootRunRequestMarginSeconds: 20 };
|
|
8
9
|
const read = new Map();
|
|
9
10
|
/** The timeouts of the SDK checkout or module at goDir. */
|
|
10
11
|
export function sdkTimeouts(goDir) {
|
|
@@ -226,7 +226,9 @@ function readManifest(raw, c) {
|
|
|
226
226
|
.filter(({ setting }) => !setting || setting.run)
|
|
227
227
|
.map(({ op, setting }) => ({
|
|
228
228
|
name: op.name,
|
|
229
|
-
timeoutSeconds: setting?.run?.timeout_s ?? timeouts.rootRunDefaultSeconds
|
|
229
|
+
timeoutSeconds: setting?.run?.timeout_s ?? (timeouts.rootRunDefaultSeconds === timeouts.requestDefaultSeconds
|
|
230
|
+
? Math.min(timeouts.rootRunDefaultSeconds, Math.max(1, requestTimeoutSeconds(backend) - timeouts.rootRunRequestMarginSeconds))
|
|
231
|
+
: timeouts.rootRunDefaultSeconds),
|
|
230
232
|
}));
|
|
231
233
|
const problem = rootRunDeadlineProblem(runnable, requestTimeoutSeconds(backend), timeouts.rootRunRequestMarginSeconds);
|
|
232
234
|
if (problem)
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"$comment": "The App's methods. The App's hello MUST list exactly these. They MUST NOT be SDK methods (api/sdk-permissions.json)."
|
|
26
26
|
},
|
|
27
27
|
"access": { "enum": ["admin-only", "app-privilege"], "$comment": "Entry restriction (dsm.NewEntryGate). Absent: permissions.json alone decides." },
|
|
28
|
-
"timeout_seconds": { "type": "integer", "minimum": 1, "maximum": 3600, "$comment": "Request deadline. Absent: api.DefaultRequestTimeout (
|
|
28
|
+
"timeout_seconds": { "type": "integer", "minimum": 1, "maximum": 3600, "$comment": "Request deadline. Absent: api.DefaultRequestTimeout (300 s). The browser client must wait longer." },
|
|
29
29
|
"max_request_bytes": { "type": "integer", "minimum": 1, "maximum": 16777216, "$comment": "JSON request body limit. Absent: api.MaxRequestBytes." },
|
|
30
30
|
"env": {
|
|
31
31
|
"type": "object",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "Timeouts on the call chain to the executor, in seconds unless the name says ms. Each layer waits margin_s longer than the layer it calls, so the inner answer arrives first; README.md, Timeouts.",
|
|
3
|
+
"margin_s": 10,
|
|
4
|
+
"executor": {
|
|
5
|
+
"op_s": 300,
|
|
6
|
+
"webapi_raw_execution_s": 300,
|
|
7
|
+
"webapi_raw_answer_s": 310,
|
|
8
|
+
"root_run_program_default_s": 300,
|
|
9
|
+
"root_run_program_max_s": 3600,
|
|
10
|
+
"root_run_answer_s": 3610,
|
|
11
|
+
"start_step_s": 300
|
|
12
|
+
},
|
|
13
|
+
"client": {
|
|
14
|
+
"op_s": 310,
|
|
15
|
+
"webapi_raw_s": 320,
|
|
16
|
+
"root_run_s": 3620
|
|
17
|
+
},
|
|
18
|
+
"request": {
|
|
19
|
+
"default_s": 300
|
|
20
|
+
},
|
|
21
|
+
"browser": {
|
|
22
|
+
"margin_ms": 2000
|
|
23
|
+
}
|
|
24
|
+
}
|
package/skills/SKILL.md
CHANGED
|
@@ -53,7 +53,7 @@ progress and authorized status/result polling by the original ID. A timed-out
|
|
|
53
53
|
status read does not fail a queued/running job; reuse the same key/input after
|
|
54
54
|
a lost admission reply. Read [reference/create.md](reference/create.md) for
|
|
55
55
|
the deadline and background-job contract. The independent ctl transport keeps
|
|
56
|
-
|
|
56
|
+
the shared SDK operation default; use existing jobs for long work and poll until terminal state or cancellation.
|
|
57
57
|
|
|
58
58
|
Use `ipc.StartUnix(ctx, path, handler)` for multiple private data-plane sockets.
|
|
59
59
|
Each direct `.sock` child of the package `var/run` gets an independent handle
|
|
@@ -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
|
-
|
|
96
|
+
`ctl` transport 採 SDK 共用的五分鐘操作預算與回覆保留時間;job flow 不以累計時間中止存活工作。長工作必須映射既有 job flow,不以延長同步等待取代非同步 API;參考 [ctl](ctl.md)。完整契約見 SDK 的 [request deadlines](https://github.com/synopackageland/syno-pkg-land-sdk/blob/v0.47.1/docs/request-deadlines.md)。
|
|
97
97
|
|
|
98
98
|
DSM 視窗預設 960×640、最小 700×420;`ui.window` 只寫要改的欄位:
|
|
99
99
|
|
package/skills/reference/ctl.md
CHANGED
|
@@ -208,16 +208,17 @@ list, get, result, cancel, pause and resume capabilities. Only declare capabilit
|
|
|
208
208
|
that the selected SDK and enabled backend actually provide. Never fabricate ETA,
|
|
209
209
|
cancellation, deduplication or "return existing ID" behavior.
|
|
210
210
|
|
|
211
|
-
The
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
The ctl transport uses the shared five-minute SDK operation default plus response
|
|
212
|
+
reserve. Job flow `timeoutMs` is optional and sets a per-request allowance. Keep
|
|
213
|
+
polling while the App reports a live job; elapsed time never fails it. Cancellation
|
|
214
|
+
ends the local wait. Preserve the original ID after a failed status read or lost
|
|
215
|
+
admission reply, and never repeat a dispatched mutation merely because it was slow.
|
|
216
|
+
|
|
216
217
|
|
|
217
218
|
For AI tools, a draft always returns a non-mutating preview and plan. Obtain
|
|
218
219
|
human authorization before the normal ctl command executes with --yes. Report
|
|
219
220
|
acceptance separately from completion; preparation is not download or save
|
|
220
|
-
completion. If
|
|
221
|
+
completion. If a status request times out, return the original ID and the exact
|
|
221
222
|
existing status command. A timeout does not prove failure or cancellation.
|
|
222
223
|
Cancellation also requires its declared preview/confirmation policy and readback
|
|
223
224
|
until the existing API proves that work stopped.
|