@actiondock/core 2.10.0 → 2.11.0
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/README.md +1 -2
- package/dist/catalog/action-catalog.js +3 -33
- package/dist/catalog/discovery.d.ts +0 -3
- package/dist/catalog/discovery.js +4 -4
- package/dist/catalog/graph.d.ts +0 -4
- package/dist/catalog/graph.js +8 -14
- package/dist/{profile/client-actions.d.ts → client/actions.d.ts} +1 -1
- package/dist/{profile/client-actions.js → client/actions.js} +2 -8
- package/dist/{profile/client-config.d.ts → client/config.d.ts} +1 -1
- package/dist/{profile/client-config.js → client/config.js} +1 -1
- package/dist/client/dispatcher.d.ts +4 -0
- package/dist/client/dispatcher.js +21 -0
- package/dist/client/health.d.ts +38 -0
- package/dist/{profile/client-health.js → client/health.js} +9 -6
- package/dist/client/index.d.ts +16 -0
- package/dist/client/index.js +20 -0
- package/dist/{profile/client-playbooks.d.ts → client/playbooks.d.ts} +1 -1
- package/dist/{profile/client-playbooks.js → client/playbooks.js} +1 -1
- package/dist/{profile/client-runs.d.ts → client/runs.d.ts} +4 -2
- package/dist/{profile/client-runs.js → client/runs.js} +7 -1
- package/dist/{profile/client-state.d.ts → client/state.d.ts} +1 -1
- package/dist/{profile/client-state.js → client/state.js} +1 -1
- package/dist/{profile/client-transport.d.ts → client/transport.d.ts} +29 -10
- package/dist/{profile/client-transport.js → client/transport.js} +125 -35
- package/dist/doctor/checks/index.d.ts +1 -1
- package/dist/doctor/checks/index.js +1 -1
- package/dist/doctor/checks/project.js +20 -88
- package/dist/doctor/checks/runtime.d.ts +0 -4
- package/dist/doctor/checks/runtime.js +0 -28
- package/dist/doctor/doctor.js +1 -2
- package/dist/errors.d.ts +53 -3
- package/dist/errors.js +53 -3
- package/dist/execution/service.d.ts +55 -37
- package/dist/execution/service.js +601 -212
- package/dist/execution/types.d.ts +24 -5
- package/dist/host/host.d.ts +42 -22
- package/dist/host/host.js +562 -149
- package/dist/host/routing.js +6 -6
- package/dist/host/types.d.ts +25 -13
- package/dist/index.d.ts +9 -4
- package/dist/index.js +5 -2
- package/dist/input/advice.d.ts +0 -44
- package/dist/input/advice.js +7 -141
- package/dist/input/flat-materializer.js +1 -1
- package/dist/input/flat-parser.js +1 -1
- package/dist/input/index.d.ts +0 -1
- package/dist/input/index.js +0 -1
- package/dist/input/input-resolver.js +1 -1
- package/dist/input/validation-mapper.d.ts +1 -1
- package/dist/ipc/diagnostic.d.ts +8 -21
- package/dist/ipc/diagnostic.js +24 -57
- package/dist/ipc/host.js +21 -7
- package/dist/ipc/service.d.ts +14 -0
- package/dist/ipc/service.js +132 -26
- package/dist/ipc/types.d.ts +0 -4
- package/dist/package/index.d.ts +4 -5
- package/dist/package/index.js +1 -2
- package/dist/package/runtime.d.ts +94 -23
- package/dist/package/runtime.js +628 -274
- package/dist/package/static-index.d.ts +3 -6
- package/dist/package/static-index.js +11 -40
- package/dist/package/types.d.ts +19 -4
- package/dist/platform/index.d.ts +2 -1
- package/dist/platform/index.js +2 -1
- package/dist/platform/loader-hook.d.ts +32 -0
- package/dist/platform/loader-hook.js +90 -0
- package/dist/{node → platform}/module-loader.d.ts +13 -0
- package/dist/{node → platform}/module-loader.js +51 -4
- package/dist/platform/node.d.ts +19 -8
- package/dist/platform/node.js +50 -20
- package/dist/platform/types.d.ts +7 -47
- package/dist/process/context-process.d.ts +3 -18
- package/dist/process/context-process.js +3 -44
- package/dist/process/control.d.ts +21 -0
- package/dist/process/control.js +34 -0
- package/dist/process/converters.d.ts +23 -0
- package/dist/process/converters.js +92 -0
- package/dist/process/cursor.js +2 -22
- package/dist/process/{diagnostics-sink.d.ts → diagnostics.d.ts} +0 -7
- package/dist/process/{diagnostics-sink.js → diagnostics.js} +6 -8
- package/dist/process/index.d.ts +1 -3
- package/dist/process/index.js +1 -3
- package/dist/process/input-dispatcher.d.ts +4 -13
- package/dist/process/input-dispatcher.js +48 -69
- package/dist/process/managed-record.d.ts +3 -31
- package/dist/process/metadata-store.d.ts +0 -41
- package/dist/process/metadata-store.js +2 -341
- package/dist/process/process-driver.js +2 -2
- package/dist/process/process-manager.d.ts +8 -50
- package/dist/process/process-manager.js +28 -417
- package/dist/process/quotas.d.ts +14 -0
- package/dist/process/quotas.js +29 -0
- package/dist/process/run-executor.js +0 -1
- package/dist/process/terminal-output-cache.d.ts +20 -34
- package/dist/process/terminal-output-cache.js +43 -64
- package/dist/profile/index.d.ts +1 -2
- package/dist/profile/index.js +1 -2
- package/dist/profile/manager.d.ts +2 -4
- package/dist/profile/manager.js +10 -40
- package/dist/profile/types.d.ts +1 -17
- package/dist/project/digest.d.ts +5 -1
- package/dist/project/digest.js +81 -219
- package/dist/project/index.d.ts +4 -5
- package/dist/project/index.js +4 -5
- package/dist/project/init.js +2 -2
- package/dist/project/loader.d.ts +3 -3
- package/dist/project/loader.js +72 -50
- package/dist/project/lockfile.js +6 -5
- package/dist/project/manifest.js +5 -4
- package/dist/project/transactions.d.ts +4 -42
- package/dist/project/transactions.js +83 -138
- package/dist/project/types-generator.js +2 -1
- package/dist/project/types.d.ts +2 -0
- package/dist/registry/index.d.ts +0 -1
- package/dist/registry/index.js +0 -1
- package/dist/registry/lock.d.ts +2 -11
- package/dist/registry/lock.js +14 -183
- package/dist/registry/registry.d.ts +1 -6
- package/dist/registry/registry.js +5 -17
- package/dist/runtime/action-registry.d.ts +1 -5
- package/dist/runtime/action-registry.js +0 -12
- package/dist/runtime/context.js +2 -2
- package/dist/runtime/events.d.ts +11 -50
- package/dist/runtime/events.js +88 -368
- package/dist/runtime/index.d.ts +0 -4
- package/dist/runtime/index.js +0 -4
- package/dist/runtime/run-persistence.d.ts +2 -0
- package/dist/runtime/run-persistence.js +2 -1
- package/dist/runtime/standalone-commands.d.ts +18 -0
- package/dist/runtime/standalone-commands.js +466 -0
- package/dist/runtime/standalone-help.d.ts +20 -0
- package/dist/runtime/standalone-help.js +72 -0
- package/dist/runtime/standalone.d.ts +1 -44
- package/dist/runtime/standalone.js +32 -573
- package/dist/schema/validator.d.ts +2 -2
- package/dist/schema/validator.js +2 -9
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.js +0 -2
- package/dist/server/routes/actions.js +1 -1
- package/dist/server/routes/info.js +1 -1
- package/dist/server/routes/playbooks.js +1 -1
- package/dist/server/routes/runs.js +123 -16
- package/dist/server/routes/state.js +43 -18
- package/dist/server/security.d.ts +1 -1
- package/dist/server/security.js +2 -2
- package/dist/server/server.js +3 -7
- package/dist/service/factory.js +4 -3
- package/dist/service/index.d.ts +1 -1
- package/dist/service/index.js +1 -1
- package/dist/service/remote-errors.d.ts +1 -1
- package/dist/service/remote-errors.js +6 -6
- package/dist/service/remote-polling.d.ts +3 -0
- package/dist/service/remote-polling.js +10 -5
- package/dist/service/remote.d.ts +5 -1
- package/dist/service/remote.js +108 -17
- package/dist/service/sse-stream.js +2 -2
- package/dist/service/types.d.ts +22 -19
- package/dist/service/types.js +1 -24
- package/dist/storage/clock.d.ts +1 -1
- package/dist/storage/clock.js +1 -1
- package/dist/storage/data-dir-lock.d.ts +10 -22
- package/dist/storage/data-dir-lock.js +28 -56
- package/dist/storage/file-lock.d.ts +64 -0
- package/dist/storage/file-lock.js +447 -0
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.js +5 -4
- package/dist/storage/run-liveness.d.ts +48 -0
- package/dist/storage/run-liveness.js +44 -0
- package/dist/storage/sqlite-config.d.ts +16 -0
- package/dist/storage/sqlite-config.js +59 -0
- package/dist/storage/sqlite-driver.d.ts +3 -1
- package/dist/storage/sqlite-driver.js +14 -4
- package/dist/storage/sqlite-events.d.ts +13 -0
- package/dist/storage/sqlite-events.js +48 -0
- package/dist/storage/sqlite-runs.d.ts +107 -0
- package/dist/storage/sqlite-runs.js +622 -0
- package/dist/storage/sqlite-schema.d.ts +5 -0
- package/dist/storage/sqlite-schema.js +143 -0
- package/dist/storage/sqlite-state.d.ts +33 -0
- package/dist/storage/sqlite-state.js +270 -0
- package/dist/storage/sqlite.d.ts +30 -57
- package/dist/storage/sqlite.js +84 -741
- package/dist/storage/types.d.ts +35 -2
- package/dist/utils/index.d.ts +18 -14
- package/dist/utils/index.js +37 -29
- package/dist/utils/semver.d.ts +18 -0
- package/dist/utils/semver.js +19 -0
- package/dist/utils/warning.d.ts +1 -0
- package/dist/utils/warning.js +52 -0
- package/dist/{json/value-validator.d.ts → value-validator.d.ts} +9 -0
- package/dist/value-validator.js +330 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +10 -12
- package/dist/execution/index.d.ts +0 -2
- package/dist/execution/index.js +0 -2
- package/dist/filter/index.d.ts +0 -1
- package/dist/filter/index.js +0 -1
- package/dist/graph/index.d.ts +0 -4
- package/dist/graph/index.js +0 -4
- package/dist/input/metadata.d.ts +0 -99
- package/dist/input/metadata.js +0 -99
- package/dist/invocation/index.d.ts +0 -2
- package/dist/invocation/index.js +0 -2
- package/dist/ipc/index.d.ts +0 -4
- package/dist/ipc/index.js +0 -4
- package/dist/json/index.d.ts +0 -1
- package/dist/json/index.js +0 -1
- package/dist/json/value-validator.js +0 -330
- package/dist/node/index.d.ts +0 -1
- package/dist/node/index.js +0 -1
- package/dist/platform/node-fs.d.ts +0 -37
- package/dist/platform/node-fs.js +0 -81
- package/dist/process/control-arbiter.d.ts +0 -108
- package/dist/process/control-arbiter.js +0 -250
- package/dist/process/process-executor.d.ts +0 -47
- package/dist/process/process-executor.js +0 -296
- package/dist/profile/client-health.d.ts +0 -14
- package/dist/profile/client-query.d.ts +0 -30
- package/dist/profile/client-query.js +0 -69
- package/dist/profile/client.d.ts +0 -26
- package/dist/profile/client.js +0 -31
- package/dist/project/closure.d.ts +0 -25
- package/dist/project/closure.js +0 -74
- package/dist/registry/store.d.ts +0 -42
- package/dist/registry/store.js +0 -43
- package/dist/runtime/clock.d.ts +0 -7
- package/dist/runtime/clock.js +0 -7
- package/dist/runtime/module-loader.d.ts +0 -2
- package/dist/runtime/module-loader.js +0 -1
- package/dist/runtime/process.d.ts +0 -8
- package/dist/runtime/process.js +0 -1
- package/dist/runtime/runner.d.ts +0 -234
- package/dist/runtime/runner.js +0 -609
- package/dist/schema/index.d.ts +0 -1
- package/dist/schema/index.js +0 -1
- package/dist/server/dispatcher.d.ts +0 -25
- package/dist/server/dispatcher.js +0 -54
- package/dist/service/local.d.ts +0 -27
- package/dist/service/local.js +0 -141
- package/dist/storage/driver.d.ts +0 -10
- package/dist/storage/driver.js +0 -10
- package/dist/storage/lazy.d.ts +0 -8
- package/dist/storage/lazy.js +0 -45
- package/dist/storage/lock-core.d.ts +0 -158
- package/dist/storage/lock-core.js +0 -872
- package/dist/utils/net.d.ts +0 -10
- package/dist/utils/net.js +0 -16
- package/dist/utils/process.d.ts +0 -10
- package/dist/utils/process.js +0 -21
- /package/dist/{filter → utils}/intent.d.ts +0 -0
- /package/dist/{filter → utils}/intent.js +0 -0
|
@@ -1,36 +1,56 @@
|
|
|
1
|
-
import type { ActionDefinition, ActionRef, ExecutionEvent, ExecutionResult,
|
|
1
|
+
import type { ActionDefinition, ActionRef, ExecutionEvent, ExecutionResult, RunRecord } from "@actiondock/sdk";
|
|
2
2
|
import { type EventSink } from "../runtime/events.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type RuntimeStorage } from "../storage/types.js";
|
|
4
4
|
import { type PackageIdentity } from "../runtime/identity.js";
|
|
5
|
-
import type { ActionInvoker, CancelResult, ExecutionService, ExecutionServiceOptions, ExecutionTicket
|
|
5
|
+
import type { ActionInvoker, CancelResult, ExecutionHandle, ExecutionService, ExecutionServiceOptions, ExecutionTicket } from "./types.js";
|
|
6
|
+
import { type InvocationContext, type RunOptions } from "../invocation/types.js";
|
|
6
7
|
export type { ExecutionServiceOptions };
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* 在途运行心跳刷新间隔(毫秒)。
|
|
10
|
+
*
|
|
11
|
+
* 必须显著小于存活判定的宽限期(见 run-liveness 的 RUN_LIVENESS_GRACE_MS),
|
|
12
|
+
* 保证心跳正常的宿主绝不被误判过期;间隔内崩溃由进程探测兜底,
|
|
13
|
+
* 心跳只服务无进程标识的遗留记录收敛判定。
|
|
14
|
+
*/
|
|
15
|
+
export declare const RUN_HEARTBEAT_INTERVAL_MS = 30000;
|
|
16
|
+
/**
|
|
17
|
+
* 统一执行引擎(融合原协调服务与运行器)。
|
|
18
|
+
* 消除双层 AbortController 与重复参数透传,收敛唯一生命周期与存储落库。
|
|
9
19
|
*/
|
|
10
20
|
export declare class DefaultExecutionService implements ExecutionService {
|
|
11
21
|
readonly identity: PackageIdentity;
|
|
12
22
|
readonly packageId: string;
|
|
23
|
+
readonly packageInstanceId: string;
|
|
24
|
+
readonly generationId: string;
|
|
25
|
+
hostSessionId?: string;
|
|
26
|
+
/** 宿主进程标识:落库到运行记录供跨进程存活判定(并发打开同一数据目录时不误收割) */
|
|
27
|
+
readonly hostPid: number;
|
|
28
|
+
readonly eventSink: EventSink;
|
|
13
29
|
private storage;
|
|
30
|
+
private globalStorage?;
|
|
14
31
|
private projectConfig?;
|
|
15
32
|
private projectRoot?;
|
|
33
|
+
private configOverrides;
|
|
16
34
|
private moduleLoader?;
|
|
17
|
-
readonly eventSink: EventSink;
|
|
18
|
-
readonly packageInstanceId: string;
|
|
19
|
-
readonly generationId: string;
|
|
20
35
|
private maxActiveRuns;
|
|
21
36
|
private ownerId;
|
|
22
|
-
|
|
23
|
-
private _runner;
|
|
37
|
+
private actionResolver?;
|
|
24
38
|
private logger?;
|
|
25
|
-
private clock
|
|
39
|
+
private clock;
|
|
26
40
|
private process?;
|
|
27
|
-
private actionResolver?;
|
|
28
|
-
private activeRuns;
|
|
29
|
-
private globalStorage?;
|
|
30
41
|
private actionInvoker?;
|
|
42
|
+
private registry;
|
|
43
|
+
private activeRuns;
|
|
44
|
+
/** 在途运行心跳定时器:周期性刷新心跳时间戳,支撑无进程标识判定路径的兜底收敛 */
|
|
45
|
+
private heartbeatTimer?;
|
|
31
46
|
private isClosing;
|
|
32
47
|
private reservedSlots;
|
|
33
48
|
constructor(options: ExecutionServiceOptions);
|
|
49
|
+
/** 获取运行底层存储实例 */
|
|
50
|
+
getStorage(): RuntimeStorage;
|
|
51
|
+
/** 兼容性引用,执行引擎即执行器自身 */
|
|
52
|
+
get _runner(): this;
|
|
53
|
+
get activeRunsCount(): number;
|
|
34
54
|
setActionInvoker(invoker?: ActionInvoker): void;
|
|
35
55
|
registerAction(id: string, action: ActionDefinition): void;
|
|
36
56
|
registerAction(action: ({
|
|
@@ -40,35 +60,21 @@ export declare class DefaultExecutionService implements ExecutionService {
|
|
|
40
60
|
getAction(id: string): ActionDefinition | undefined;
|
|
41
61
|
listActions(): ActionDefinition[];
|
|
42
62
|
getActiveHandle(runId: string): ExecutionHandle | undefined;
|
|
43
|
-
execute(ref: ActionRef | string, input
|
|
44
|
-
run(ref: ActionRef | string, input
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
execute(ref: ActionDefinition | ActionRef | string, input?: unknown, contextOrOptions?: InvocationContext | RunOptions | Record<string, unknown>): Promise<ExecutionResult>;
|
|
64
|
+
run(ref: ActionDefinition | ActionRef | string, input?: unknown, contextOrOptions?: InvocationContext | RunOptions | Record<string, unknown>): Promise<ExecutionResult>;
|
|
65
|
+
start(ref: ActionDefinition | ActionRef | string, input?: unknown, contextOrOptions?: InvocationContext | RunOptions | Record<string, unknown>): Promise<ExecutionTicket & ExecutionHandle>;
|
|
66
|
+
private normalizeContext;
|
|
67
|
+
private raceExecution;
|
|
68
|
+
private classifyExecutionError;
|
|
69
|
+
private invokeChildAction;
|
|
50
70
|
private checkIdempotencyGate;
|
|
51
|
-
/**
|
|
52
|
-
* 解析执行目标:确定目标 Action 定义。
|
|
53
|
-
* 铁律 4:Runner 不找 Package,ExecutionService 仅执行本 Package 的 Action。
|
|
54
|
-
*/
|
|
55
71
|
private resolveExecutionTarget;
|
|
56
|
-
/**
|
|
57
|
-
* 解析指定 Action 定义(供 PackageRuntime 或内部使用)。
|
|
58
|
-
*/
|
|
59
72
|
resolveAction(ref: ActionRef | string): Promise<ActionDefinition | undefined>;
|
|
60
|
-
/**
|
|
61
|
-
* 目标 Action 缺失时的失败票据:落库 failed 记录并补发 status 与 finish 事件。
|
|
62
|
-
*/
|
|
63
73
|
private failTicketForMissingAction;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
private buildPersistenceInput;
|
|
75
|
+
private checkActionInputSchema;
|
|
76
|
+
private checkActionOutputSchema;
|
|
67
77
|
private createEventBridge;
|
|
68
|
-
/**
|
|
69
|
-
* 监听执行句柄终态:映射终态状态、补发 status 与 finish 事件并注销活跃运行。
|
|
70
|
-
*/
|
|
71
|
-
private watchHandleCompletion;
|
|
72
78
|
get(runId: string): Promise<RunRecord | undefined>;
|
|
73
79
|
cancel(runId: string, reason?: string): Promise<CancelResult>;
|
|
74
80
|
events(runId: string, options?: {
|
|
@@ -76,8 +82,20 @@ export declare class DefaultExecutionService implements ExecutionService {
|
|
|
76
82
|
signal?: AbortSignal;
|
|
77
83
|
maxQueueSize?: number;
|
|
78
84
|
}): AsyncIterable<ExecutionEvent>;
|
|
85
|
+
/**
|
|
86
|
+
* 确保在途运行心跳定时器存在。
|
|
87
|
+
*
|
|
88
|
+
* 存活判定的第一依据是进程探测(运行记录已落库宿主进程标识),
|
|
89
|
+
* 心跳是对遗留记录(无进程标识)与其他协作场景的兜底信号:
|
|
90
|
+
* 持有进程周期性刷新在途记录的心跳时间戳,收割方仅对心跳过期的
|
|
91
|
+
* 遗留记录做宽限期判定,正常运行中的记录绝不会被误判过期。
|
|
92
|
+
* 定时器不阻塞进程退出(unref),无在途运行时不产生任何调度。
|
|
93
|
+
*/
|
|
94
|
+
private ensureHeartbeatTimer;
|
|
79
95
|
close(options?: {
|
|
80
96
|
graceMs?: number;
|
|
81
97
|
}): Promise<void>;
|
|
98
|
+
dispose(): Promise<void>;
|
|
82
99
|
}
|
|
83
100
|
export { DefaultExecutionService as ExecutionService };
|
|
101
|
+
export { DefaultExecutionService as ActionRunner };
|