@actiondock/core 2.0.12 → 2.2.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.
Files changed (192) hide show
  1. package/README.md +61 -30
  2. package/dist/app/app.d.ts +73 -0
  3. package/dist/app/app.js +700 -0
  4. package/dist/app/index.d.ts +2 -0
  5. package/dist/app/index.js +2 -0
  6. package/dist/app/types.d.ts +283 -0
  7. package/dist/app/types.js +1 -0
  8. package/dist/catalog/action-index.d.ts +1 -1
  9. package/dist/catalog/action-index.js +93 -0
  10. package/dist/catalog/action-resolver.d.ts +2 -2
  11. package/dist/catalog/action-resolver.js +95 -0
  12. package/dist/catalog/index.d.ts +5 -5
  13. package/dist/catalog/index.js +5 -0
  14. package/dist/catalog/location-registry.d.ts +5 -5
  15. package/dist/catalog/location-registry.js +138 -0
  16. package/dist/catalog/package-catalog.d.ts +2 -2
  17. package/dist/catalog/package-catalog.js +76 -0
  18. package/dist/catalog/types.d.ts +2 -2
  19. package/dist/catalog/types.js +1 -0
  20. package/dist/doctor/doctor.d.ts +2 -1
  21. package/dist/doctor/doctor.js +613 -0
  22. package/dist/doctor/index.d.ts +2 -2
  23. package/dist/doctor/index.js +2 -0
  24. package/dist/doctor/types.js +1 -0
  25. package/dist/errors.d.ts +122 -0
  26. package/dist/errors.js +123 -0
  27. package/dist/execution/index.d.ts +2 -2
  28. package/dist/execution/index.js +2 -0
  29. package/dist/execution/service.d.ts +46 -41
  30. package/dist/execution/service.js +633 -0
  31. package/dist/execution/types.d.ts +59 -2
  32. package/dist/execution/types.js +1 -0
  33. package/dist/export/index.d.ts +1 -1
  34. package/dist/export/index.js +1 -0
  35. package/dist/export/templates.d.ts +45 -7
  36. package/dist/export/templates.js +621 -0
  37. package/dist/filter/index.d.ts +1 -1
  38. package/dist/filter/index.js +1 -0
  39. package/dist/filter/intent.js +123 -0
  40. package/dist/host/host.d.ts +55 -0
  41. package/dist/host/host.js +740 -0
  42. package/dist/host/index.d.ts +2 -0
  43. package/dist/host/index.js +2 -0
  44. package/dist/host/types.d.ts +81 -0
  45. package/dist/host/types.js +1 -0
  46. package/dist/index.d.ts +21 -16
  47. package/dist/index.js +20 -8458
  48. package/dist/ipc/diagnostic.d.ts +65 -0
  49. package/dist/ipc/diagnostic.js +129 -0
  50. package/dist/ipc/host.d.ts +7 -0
  51. package/dist/ipc/host.js +93 -0
  52. package/dist/ipc/index.d.ts +4 -0
  53. package/dist/ipc/index.js +4 -0
  54. package/dist/ipc/target.d.ts +56 -0
  55. package/dist/ipc/target.js +297 -0
  56. package/dist/ipc/types.d.ts +42 -0
  57. package/dist/ipc/types.js +1 -0
  58. package/dist/platform/default.d.ts +32 -0
  59. package/dist/platform/default.js +40 -0
  60. package/dist/platform/index.d.ts +3 -0
  61. package/dist/platform/index.js +3 -0
  62. package/dist/platform/node-fs.d.ts +37 -0
  63. package/dist/platform/node-fs.js +81 -0
  64. package/dist/platform/types.d.ts +104 -0
  65. package/dist/platform/types.js +1 -0
  66. package/dist/profile/client.d.ts +58 -12
  67. package/dist/profile/client.js +467 -0
  68. package/dist/profile/index.d.ts +3 -3
  69. package/dist/profile/index.js +3 -0
  70. package/dist/profile/manager.d.ts +2 -2
  71. package/dist/profile/manager.js +294 -0
  72. package/dist/profile/types.d.ts +1 -1
  73. package/dist/profile/types.js +1 -0
  74. package/dist/project/closure.js +68 -0
  75. package/dist/project/digest.d.ts +29 -0
  76. package/dist/project/digest.js +324 -0
  77. package/dist/project/index.d.ts +10 -5
  78. package/dist/project/index.js +10 -0
  79. package/dist/project/init.d.ts +3 -4
  80. package/dist/project/init.js +175 -0
  81. package/dist/project/loader.d.ts +21 -27
  82. package/dist/project/loader.js +484 -0
  83. package/dist/project/lockfile.d.ts +55 -0
  84. package/dist/project/lockfile.js +175 -0
  85. package/dist/project/manifest.d.ts +6 -28
  86. package/dist/project/manifest.js +220 -0
  87. package/dist/project/resolver.d.ts +116 -0
  88. package/dist/project/resolver.js +376 -0
  89. package/dist/project/transactions.d.ts +103 -0
  90. package/dist/project/transactions.js +1203 -0
  91. package/dist/project/types-generator.d.ts +33 -0
  92. package/dist/project/types-generator.js +168 -0
  93. package/dist/project/types.d.ts +58 -82
  94. package/dist/project/types.js +1 -0
  95. package/dist/registry/index.d.ts +5 -2
  96. package/dist/registry/index.js +5 -0
  97. package/dist/registry/lock.d.ts +27 -0
  98. package/dist/registry/lock.js +93 -0
  99. package/dist/registry/registry.d.ts +32 -11
  100. package/dist/registry/registry.js +611 -0
  101. package/dist/registry/resolve.d.ts +62 -0
  102. package/dist/registry/resolve.js +195 -0
  103. package/dist/registry/scan.d.ts +38 -0
  104. package/dist/registry/scan.js +135 -0
  105. package/dist/registry/types.d.ts +1 -1
  106. package/dist/registry/types.js +1 -0
  107. package/dist/runtime/action-collection.d.ts +27 -0
  108. package/dist/runtime/action-collection.js +57 -0
  109. package/dist/runtime/clock.d.ts +0 -2
  110. package/dist/runtime/clock.js +17 -0
  111. package/dist/runtime/context.d.ts +16 -5
  112. package/dist/runtime/context.js +242 -0
  113. package/dist/runtime/env.d.ts +3 -1
  114. package/dist/runtime/env.js +159 -0
  115. package/dist/runtime/events.d.ts +46 -14
  116. package/dist/runtime/events.js +604 -0
  117. package/dist/runtime/execution-manager.d.ts +1 -1
  118. package/dist/runtime/execution-manager.js +66 -0
  119. package/dist/runtime/index.d.ts +10 -9
  120. package/dist/runtime/index.js +10 -0
  121. package/dist/runtime/module-loader.d.ts +0 -8
  122. package/dist/runtime/module-loader.js +16 -0
  123. package/dist/runtime/process.d.ts +2 -4
  124. package/dist/runtime/process.js +146 -0
  125. package/dist/runtime/runner.d.ts +117 -10
  126. package/dist/runtime/runner.js +984 -0
  127. package/dist/runtime/standalone.d.ts +68 -19
  128. package/dist/runtime/standalone.js +536 -0
  129. package/dist/schema/validator.js +116 -0
  130. package/dist/server/body.js +93 -0
  131. package/dist/server/index.d.ts +5 -6
  132. package/dist/server/index.js +5 -0
  133. package/dist/server/routes/actions.d.ts +2 -2
  134. package/dist/server/routes/actions.js +298 -0
  135. package/dist/server/routes/common.d.ts +28 -17
  136. package/dist/server/routes/common.js +104 -0
  137. package/dist/server/routes/config.d.ts +2 -1
  138. package/dist/server/routes/config.js +173 -0
  139. package/dist/server/routes/doctor.d.ts +2 -2
  140. package/dist/server/routes/doctor.js +63 -0
  141. package/dist/server/routes/health.d.ts +2 -2
  142. package/dist/server/routes/health.js +35 -0
  143. package/dist/server/routes/index.d.ts +9 -9
  144. package/dist/server/routes/index.js +9 -0
  145. package/dist/server/routes/info.d.ts +4 -2
  146. package/dist/server/routes/info.js +158 -0
  147. package/dist/server/routes/playbooks.d.ts +2 -2
  148. package/dist/server/routes/playbooks.js +134 -0
  149. package/dist/server/routes/runs.d.ts +2 -2
  150. package/dist/server/routes/runs.js +343 -0
  151. package/dist/server/routes/state.d.ts +2 -1
  152. package/dist/server/routes/state.js +169 -0
  153. package/dist/server/security.d.ts +11 -4
  154. package/dist/server/security.js +101 -0
  155. package/dist/server/server.d.ts +6 -6
  156. package/dist/server/server.js +355 -0
  157. package/dist/server/types.d.ts +27 -8
  158. package/dist/server/types.js +1 -0
  159. package/dist/storage/data-dir-lock.d.ts +119 -0
  160. package/dist/storage/data-dir-lock.js +1016 -0
  161. package/dist/storage/driver.d.ts +4 -10
  162. package/dist/storage/driver.js +59 -0
  163. package/dist/storage/index.d.ts +30 -10
  164. package/dist/storage/index.js +98 -0
  165. package/dist/storage/lazy.d.ts +8 -0
  166. package/dist/storage/lazy.js +44 -0
  167. package/dist/storage/mask.d.ts +12 -5
  168. package/dist/storage/mask.js +48 -0
  169. package/dist/storage/params.d.ts +13 -0
  170. package/dist/storage/params.js +32 -0
  171. package/dist/storage/sqlite.d.ts +19 -6
  172. package/dist/storage/sqlite.js +689 -0
  173. package/dist/storage/types.d.ts +57 -6
  174. package/dist/storage/types.js +14 -0
  175. package/dist/target/index.d.ts +4 -0
  176. package/dist/target/index.js +4 -0
  177. package/dist/target/local.d.ts +52 -0
  178. package/dist/target/local.js +343 -0
  179. package/dist/target/remote.d.ts +76 -0
  180. package/dist/target/remote.js +839 -0
  181. package/dist/target/target.d.ts +6 -0
  182. package/dist/target/target.js +35 -0
  183. package/dist/target/types.d.ts +246 -0
  184. package/dist/target/types.js +34 -0
  185. package/dist/utils/index.d.ts +22 -2
  186. package/dist/utils/index.js +180 -0
  187. package/dist/version.d.ts +1 -1
  188. package/dist/version.js +4 -0
  189. package/package.json +6 -7
  190. package/dist/build/index.d.ts +0 -1
  191. package/dist/build/templates.d.ts +0 -19
  192. package/dist/server/runtime-registry.d.ts +0 -78
@@ -0,0 +1,10 @@
1
+ export * from "./context.js";
2
+ export * from "./action-collection.js";
3
+ export * from "./runner.js";
4
+ export * from "./execution-manager.js";
5
+ export * from "./standalone.js";
6
+ export * from "./env.js";
7
+ export * from "./clock.js";
8
+ export * from "./process.js";
9
+ export * from "./events.js";
10
+ export * from "./module-loader.js";
@@ -32,11 +32,3 @@ export declare class DefaultModuleLoader implements ModuleLoader {
32
32
  load<T = any>(specifier: string, _parentPath?: string): Promise<T>;
33
33
  loadDefault<T = any>(specifier: string, parentPath?: string): Promise<T>;
34
34
  }
35
- /**
36
- * 注册全局模块加载器实现。
37
- */
38
- export declare function setModuleLoader(loader: ModuleLoader): void;
39
- /**
40
- * 获取当前全局模块加载器,若未显式注册则回退使用 DefaultModuleLoader。
41
- */
42
- export declare function getModuleLoader(): ModuleLoader;
@@ -0,0 +1,16 @@
1
+ import { pathToFileURL } from "node:url";
2
+ /**
3
+ * 基于标准 ECMAScript 动态 import 的默认模块加载器。
4
+ */
5
+ export class DefaultModuleLoader {
6
+ async load(specifier, _parentPath) {
7
+ const importSpecifier = specifier.startsWith("file://")
8
+ ? specifier
9
+ : pathToFileURL(specifier).href;
10
+ return (await import(importSpecifier));
11
+ }
12
+ async loadDefault(specifier, parentPath) {
13
+ const mod = await this.load(specifier, parentPath);
14
+ return (mod?.default !== undefined ? mod.default : mod?.action !== undefined ? mod.action : mod);
15
+ }
16
+ }
@@ -1,11 +1,9 @@
1
- import type { DetachedProcessOptions, DetachedProcessResult, ProcessAPI, ProcessExecOptions, ProcessResult } from "@actiondock/sdk";
1
+ import type { ProcessAPI, ProcessExecOptions, ProcessResult } from "@actiondock/sdk";
2
2
  export type ProcessExecutor = ProcessAPI;
3
- export declare function setProcessExecutor(executor: ProcessExecutor): void;
4
- export declare function getProcessExecutor(): ProcessExecutor;
5
3
  /**
6
4
  * 基于 Node.js 标准 child_process 实现的基础进程执行器。
7
5
  */
8
6
  export declare class DefaultProcessExecutor implements ProcessExecutor {
9
7
  exec(command: string, args?: string[], options?: ProcessExecOptions): Promise<ProcessResult>;
10
- spawnDetached(options: DetachedProcessOptions): Promise<DetachedProcessResult>;
8
+ spawn(command: string, args?: string[], options?: ProcessExecOptions): Promise<ProcessResult>;
11
9
  }
@@ -0,0 +1,146 @@
1
+ import { spawn } from "node:child_process";
2
+ import { PROCESS_OUTPUT_LIMIT, PROCESS_SPAWN_ERROR } from "../errors.js";
3
+ /**
4
+ * 基于 Node.js 标准 child_process 实现的基础进程执行器。
5
+ */
6
+ export class DefaultProcessExecutor {
7
+ async exec(command, args = [], options = {}) {
8
+ const startTime = Date.now();
9
+ const maxOutputBytes = options.maxOutputBytes ?? 10 * 1024 * 1024;
10
+ return new Promise((resolve, reject) => {
11
+ let stdoutBuf = "";
12
+ let stderrBuf = "";
13
+ let totalBytes = 0;
14
+ let timedOut = false;
15
+ let cancelled = false;
16
+ let error;
17
+ const cp = spawn(command, args, {
18
+ cwd: options.cwd,
19
+ env: options.env ? { ...process.env, ...options.env } : process.env,
20
+ stdio: ["pipe", "pipe", "pipe"],
21
+ });
22
+ if (options.input) {
23
+ cp.stdin.write(options.input);
24
+ cp.stdin.end();
25
+ }
26
+ else {
27
+ cp.stdin.end();
28
+ }
29
+ let timer;
30
+ let forceKillTimer;
31
+ if (options.timeoutMs && options.timeoutMs > 0) {
32
+ timer = setTimeout(() => {
33
+ timedOut = true;
34
+ cp.kill("SIGTERM");
35
+ forceKillTimer = setTimeout(() => {
36
+ if (!cp.killed)
37
+ cp.kill("SIGKILL");
38
+ }, 1000);
39
+ }, options.timeoutMs);
40
+ }
41
+ const onAbort = () => {
42
+ cancelled = true;
43
+ cp.kill("SIGTERM");
44
+ forceKillTimer = setTimeout(() => {
45
+ if (!cp.killed)
46
+ cp.kill("SIGKILL");
47
+ }, 1000);
48
+ };
49
+ if (options.signal) {
50
+ if (options.signal.aborted) {
51
+ onAbort();
52
+ }
53
+ else {
54
+ options.signal.addEventListener("abort", onAbort, { once: true });
55
+ }
56
+ }
57
+ const cleanup = () => {
58
+ if (timer) {
59
+ clearTimeout(timer);
60
+ timer = undefined;
61
+ }
62
+ if (forceKillTimer) {
63
+ clearTimeout(forceKillTimer);
64
+ forceKillTimer = undefined;
65
+ }
66
+ if (options.signal) {
67
+ options.signal.removeEventListener("abort", onAbort);
68
+ }
69
+ };
70
+ cp.stdout?.on("data", (chunk) => {
71
+ totalBytes += chunk.length;
72
+ if (totalBytes > maxOutputBytes) {
73
+ error = {
74
+ code: PROCESS_OUTPUT_LIMIT,
75
+ message: `Process output exceeded limit of ${maxOutputBytes} bytes`,
76
+ };
77
+ cp.kill("SIGKILL");
78
+ return;
79
+ }
80
+ stdoutBuf += chunk.toString("utf-8");
81
+ });
82
+ cp.stderr?.on("data", (chunk) => {
83
+ totalBytes += chunk.length;
84
+ if (totalBytes > maxOutputBytes) {
85
+ error = {
86
+ code: PROCESS_OUTPUT_LIMIT,
87
+ message: `Process output exceeded limit of ${maxOutputBytes} bytes`,
88
+ };
89
+ cp.kill("SIGKILL");
90
+ return;
91
+ }
92
+ stderrBuf += chunk.toString("utf-8");
93
+ });
94
+ cp.on("error", (err) => {
95
+ cleanup();
96
+ const durationMs = Date.now() - startTime;
97
+ const res = {
98
+ ok: false,
99
+ exitCode: null,
100
+ stdout: stdoutBuf.trim(),
101
+ stderr: stderrBuf.trim() || err.message,
102
+ raw: new TextEncoder().encode(stdoutBuf),
103
+ timedOut,
104
+ cancelled,
105
+ durationMs,
106
+ error: error || {
107
+ code: PROCESS_SPAWN_ERROR,
108
+ message: err.message,
109
+ },
110
+ };
111
+ if (options.throwOnError) {
112
+ reject(new Error(err.message));
113
+ }
114
+ else {
115
+ resolve(res);
116
+ }
117
+ });
118
+ cp.on("close", (exitCode, signal) => {
119
+ cleanup();
120
+ const durationMs = Date.now() - startTime;
121
+ const ok = exitCode === 0 && !timedOut && !cancelled && !error;
122
+ const res = {
123
+ ok,
124
+ exitCode,
125
+ signal: signal || undefined,
126
+ stdout: stdoutBuf.trim(),
127
+ stderr: stderrBuf.trim(),
128
+ raw: new TextEncoder().encode(stdoutBuf),
129
+ timedOut,
130
+ cancelled,
131
+ durationMs,
132
+ error,
133
+ };
134
+ if (!ok && options.throwOnError) {
135
+ reject(new Error(stderrBuf.trim() || `Process exited with code ${exitCode}`));
136
+ }
137
+ else {
138
+ resolve(res);
139
+ }
140
+ });
141
+ });
142
+ }
143
+ async spawn(command, args = [], options = {}) {
144
+ return this.exec(command, args, options);
145
+ }
146
+ }
@@ -1,7 +1,18 @@
1
1
  import type { ActionDefinition, ActionRef, ExecutionResult, Logger, ProcessAPI, ProgressReporter } from "@actiondock/sdk";
2
- import type { ProjectConfig } from "../project/types";
3
- import type { RuntimeStorage } from "../storage/types";
4
- import type { Clock } from "./clock";
2
+ import type { ProjectConfig } from "../project/types.js";
3
+ import type { RuntimeStorage } from "../storage/types.js";
4
+ import type { Clock } from "./clock.js";
5
+ import type { RuntimePlatform } from "../platform/types.js";
6
+ export { RUN_REPOSITORY_UNAVAILABLE, RUN_PERSISTENCE_FAILED, INPUT_NOT_JSON, OUTPUT_NOT_JSON, ACTION_SUBRUN_LIMIT, MAX_SUBRUNS_REACHED, ACTION_CALL_CYCLE, ACTION_CYCLE_DETECTED, ACTION_MAX_DEPTH_EXCEEDED, } from "../errors.js";
7
+ /**
8
+ * 校验值是否为合法的 JSON 兼容结构,严禁 NaN、Infinity、循环引用及不可序列化类型。
9
+ */
10
+ export declare function validateJsonValue(val: unknown, seen?: WeakSet<object>): {
11
+ valid: true;
12
+ } | {
13
+ valid: false;
14
+ reason: string;
15
+ };
5
16
  /**
6
17
  * ActionRunner 初始化配置选项。
7
18
  */
@@ -9,7 +20,7 @@ export interface RunnerOptions {
9
20
  /** 运行所属的 Package ID */
10
21
  packageId: string;
11
22
  /** 持久化运行时存储实例(SQLite) */
12
- storage: RuntimeStorage;
23
+ storage?: RuntimeStorage;
13
24
  /** 全局共享持久化存储实例(SQLite,用于单例池化避免泄漏) */
14
25
  globalStorage?: RuntimeStorage;
15
26
  /** 项目根目录绝对路径 */
@@ -24,6 +35,8 @@ export interface RunnerOptions {
24
35
  process?: ProcessAPI;
25
36
  /** 可选的时间与时钟源(默认使用存储内嵌时钟或系统时间) */
26
37
  clock?: Clock;
38
+ /** 可选的底层运行时平台契约 */
39
+ platform?: RuntimePlatform;
27
40
  /** 动态解析跨包或未注册 Action 的委托函数 */
28
41
  actionResolver?: (ref: ActionRef | string, currentPackageId?: string) => ActionDefinition | undefined | Promise<ActionDefinition | undefined>;
29
42
  /** 最大调用嵌套深度限制(防死循环/过深调用链,默认 16) */
@@ -46,6 +59,8 @@ export interface RunnerOptions {
46
59
  } | undefined;
47
60
  /** 自定义 ActionDock 用户家目录(用于测试隔离与多租户环境) */
48
61
  customHome?: string;
62
+ /** 执行宿主会话标识 */
63
+ hostSessionId?: string;
49
64
  }
50
65
  /** ActionRunnerOptions 别名兼容 */
51
66
  export type ActionRunnerOptions = RunnerOptions;
@@ -65,6 +80,8 @@ export interface ExecutionStartOptions {
65
80
  generationId?: string;
66
81
  /** 执行所有者标识 */
67
82
  ownerId?: string;
83
+ /** 执行宿主会话标识 */
84
+ hostSessionId?: string;
68
85
  /** 调用栈数组(用于检测 A -> B -> A 环路死锁) */
69
86
  callStack?: string[];
70
87
  /** 外部传入的 AbortSignal 取消信号 */
@@ -75,6 +92,8 @@ export interface ExecutionStartOptions {
75
92
  maxCallDepth?: number;
76
93
  /** 外部注入的进程执行器 */
77
94
  process?: ProcessAPI;
95
+ /** 可选的底层运行时平台契约 */
96
+ platform?: RuntimePlatform;
78
97
  /** 外部注入的进度报告器 */
79
98
  progress?: ProgressReporter;
80
99
  /** 外部注入的日志记录器 */
@@ -116,11 +135,11 @@ export type ActionResolution = {
116
135
  * ActionDock 核心执行引擎(ActionRunner)。
117
136
  *
118
137
  * 职责:
119
- * 1. 负责 Action 执行的全生命周期管理(校验、隔离、跟踪、落库)。
120
- * 2. 入参 (inputSchema) 与出参 (outputSchema) 的 JSON Schema 严格校验。
121
- * 3. 嵌套 Action 相互调用的环路检测(Cycle Detection)。
122
- * 4. 超时 (Timeout) 与中断信号 (AbortSignal) 竞态控制。
123
- * 5. 自动记录并持久化 RunRecord 运行记录至 SQLite 存储。
138
+ * - 负责 Action 执行的全生命周期管理(校验、隔离、跟踪、落库)。
139
+ * - 入参 (inputSchema) 与出参 (outputSchema) 的 JSON Schema 严格校验。
140
+ * - 嵌套 Action 相互调用的环路检测(Cycle Detection)。
141
+ * - 超时 (Timeout) 与中断信号 (AbortSignal) 竞态控制。
142
+ * - 自动记录并持久化 RunRecord 运行记录至 SQLite 存储。
124
143
  */
125
144
  export declare class ActionRunner {
126
145
  private packageId;
@@ -132,6 +151,7 @@ export declare class ActionRunner {
132
151
  private actions;
133
152
  private clock?;
134
153
  private process?;
154
+ private platform?;
135
155
  private maxCallDepth;
136
156
  private maxSubRuns;
137
157
  private activeSubRuns;
@@ -140,13 +160,18 @@ export declare class ActionRunner {
140
160
  private getStorageForPackage?;
141
161
  private packageContextResolver?;
142
162
  private customHome?;
163
+ private hostSessionId?;
143
164
  constructor(options: RunnerOptions);
144
165
  getStorage(): RuntimeStorage;
145
166
  getPackageRunners(): Map<string, ActionRunner>;
146
167
  /**
147
168
  * 注册单个 Action 到当前 Runner。
148
169
  */
149
- registerAction(action: ActionDefinition): void;
170
+ registerAction(id: string, action: ActionDefinition): void;
171
+ registerAction(action: ({
172
+ id: string;
173
+ action?: ActionDefinition;
174
+ } & Partial<ActionDefinition>) | ActionDefinition): void;
150
175
  /**
151
176
  * 根据 ID 检索注册的 Action。
152
177
  */
@@ -162,6 +187,20 @@ export declare class ActionRunner {
162
187
  * 获取当前 Runner 已注册的所有 Action 列表。
163
188
  */
164
189
  listActions(): ActionDefinition[];
190
+ /**
191
+ * 注入或更新跨包运行上下文解析委托。
192
+ */
193
+ setPackageContextResolver(resolver: (packageId: string) => Promise<{
194
+ projectRoot?: string;
195
+ projectConfig?: ProjectConfig;
196
+ storage: RuntimeStorage;
197
+ actions?: Map<string, ActionDefinition>;
198
+ } | undefined> | {
199
+ projectRoot?: string;
200
+ projectConfig?: ProjectConfig;
201
+ storage: RuntimeStorage;
202
+ actions?: Map<string, ActionDefinition>;
203
+ } | undefined): void;
165
204
  /**
166
205
  * 跨包运行时解析与获取(确保跨包执行具备独立的配置、存储、状态与 Action 注册表)。
167
206
  */
@@ -175,6 +214,74 @@ export declare class ActionRunner {
175
214
  * @returns 包含 runId、result Promise 和 cancel 方法的执行句柄
176
215
  */
177
216
  start(actionOrId: ActionDefinition | ActionRef | string, input?: unknown, options?: ExecutionStartOptions): ExecutionHandle;
217
+ /**
218
+ * 计算根运行标识(优先显式 rootRunId,其次 parentRunId,最后自身 runId)。
219
+ */
220
+ private computeRootRunId;
221
+ /**
222
+ * 预解析执行目标并装配运行期共享上下文对象(runId、目标标识、时钟源与调用栈快照)。
223
+ */
224
+ private prepareRunContext;
225
+ /**
226
+ * 为匿名传入的 Action 定义对象解析或分配稳定标识。
227
+ */
228
+ private resolveAnonymousActionId;
229
+ /**
230
+ * 尝试将 failed 终态初始记录写入存储(非法输入场景,存储异常静默忽略)。
231
+ */
232
+ private tryPersistInitialRun;
233
+ /**
234
+ * 构建 running 初始记录并强制写入存储(存储不可用时抛出 RUN_REPOSITORY_UNAVAILABLE)。
235
+ */
236
+ private persistInitialRun;
237
+ /**
238
+ * 依据运行期上下文构造 RunRecord 初始记录。
239
+ */
240
+ private buildInitialRunRecord;
241
+ /**
242
+ * 创建运行终态收敛器:封装终态去重、超时定时器清理与落库异常捕获。
243
+ */
244
+ private createRunFinalizer;
245
+ /**
246
+ * 调用嵌套深度限制检测(超限时返回 ACTION_CALL_CYCLE 错误)。
247
+ */
248
+ private checkCallDepth;
249
+ /**
250
+ * 计算调用键并执行环路死锁检测(命中时返回携带错误的调用键结果)。
251
+ */
252
+ private computeCallKey;
253
+ /**
254
+ * 输入参数 JSON Schema 校验(若 action 已就绪,返回校验错误或 undefined)。
255
+ */
256
+ private checkActionInputSchema;
257
+ /**
258
+ * 构建 ActionContext 运行时上下文(内嵌子 Action 调用委托提为私有方法)。
259
+ */
260
+ private buildActionContext;
261
+ /**
262
+ * 子 Action 调用委托:并发上限守卫、uses 跨包声明校验与子执行派发。
263
+ */
264
+ private invokeChildAction;
265
+ /**
266
+ * 校验跨包子调用是否已在 uses 声明中授权(未声明时抛出 UNDECLARED_ACTION_DEPENDENCY)。
267
+ */
268
+ private assertDeclaredUses;
269
+ /**
270
+ * 解析子调用应使用的 Runner(本包或已解析的目标包 Runner)。
271
+ */
272
+ private resolveChildRunner;
273
+ /**
274
+ * 执行 Action 业务逻辑并与取消/超时信号进行竞态,返回执行结果信封 Promise。
275
+ */
276
+ private raceExecutionAndAbort;
277
+ /**
278
+ * 输出结果 Schema 校验(返回校验错误或 undefined)。
279
+ */
280
+ private checkActionOutputSchema;
281
+ /**
282
+ * 异常分类收敛:超时、取消与业务失败分别映射为对应终态与错误码。
283
+ */
284
+ private classifyExecutionError;
178
285
  /**
179
286
  * 同步等待方式执行指定 Action,直接返回 ExecutionResult 信封结果。
180
287
  *