@actiondock/core 2.7.0 → 2.9.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 +77 -64
- package/dist/catalog/action-catalog.d.ts +56 -0
- package/dist/catalog/action-catalog.js +202 -0
- package/dist/catalog/discovery.d.ts +60 -0
- package/dist/catalog/discovery.js +119 -0
- package/dist/catalog/graph.d.ts +190 -0
- package/dist/catalog/graph.js +589 -0
- package/dist/catalog/index.d.ts +5 -5
- package/dist/catalog/index.js +5 -5
- package/dist/catalog/resolve-action.d.ts +43 -0
- package/dist/catalog/resolve-action.js +119 -0
- package/dist/catalog/resolve-playbook.d.ts +26 -0
- package/dist/catalog/resolve-playbook.js +114 -0
- package/dist/doctor/checks/project.js +27 -8
- package/dist/doctor/checks/registry.js +2 -2
- package/dist/doctor/checks/runtime.js +34 -1
- package/dist/errors.d.ts +106 -10
- package/dist/errors.js +105 -10
- package/dist/execution/service.d.ts +18 -16
- package/dist/execution/service.js +183 -252
- package/dist/execution/types.d.ts +25 -69
- package/dist/execution/types.js +2 -1
- package/dist/filter/intent.d.ts +8 -9
- package/dist/filter/intent.js +49 -10
- package/dist/graph/index.d.ts +4 -0
- package/dist/graph/index.js +4 -0
- package/dist/host/host.d.ts +74 -32
- package/dist/host/host.js +585 -336
- package/dist/host/routing.d.ts +15 -48
- package/dist/host/routing.js +90 -153
- package/dist/host/types.d.ts +50 -17
- package/dist/index.d.ts +21 -24
- package/dist/index.js +19 -23
- package/dist/input/advice.d.ts +5 -1
- package/dist/input/advice.js +163 -214
- package/dist/input/describe.d.ts +1 -1
- package/dist/input/flat-errors.d.ts +5 -6
- package/dist/input/flat-errors.js +6 -6
- package/dist/input/flat-materializer.js +42 -44
- package/dist/invocation/index.d.ts +2 -0
- package/dist/invocation/index.js +2 -0
- package/dist/invocation/policy.d.ts +157 -0
- package/dist/invocation/policy.js +231 -0
- package/dist/invocation/types.d.ts +172 -0
- package/dist/invocation/types.js +97 -0
- package/dist/ipc/diagnostic.d.ts +0 -12
- package/dist/ipc/diagnostic.js +0 -21
- package/dist/ipc/host.d.ts +4 -4
- package/dist/ipc/host.js +44 -47
- package/dist/ipc/index.d.ts +1 -1
- package/dist/ipc/index.js +1 -1
- package/dist/ipc/service.d.ts +40 -0
- package/dist/ipc/service.js +349 -0
- package/dist/ipc/types.d.ts +21 -15
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +1 -0
- package/dist/node/module-loader.d.ts +63 -0
- package/dist/node/module-loader.js +112 -0
- package/dist/package/index.d.ts +23 -0
- package/dist/package/index.js +18 -0
- package/dist/{app/app.d.ts → package/runtime.d.ts} +41 -20
- package/dist/{app/app.js → package/runtime.js} +140 -95
- package/dist/{app → package}/static-index.js +58 -41
- package/dist/package/storage-view.d.ts +13 -0
- package/dist/package/storage-view.js +22 -0
- package/dist/{app → package}/types.d.ts +76 -57
- package/dist/package/types.js +22 -0
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.js +1 -1
- package/dist/platform/node.d.ts +48 -0
- package/dist/platform/node.js +96 -0
- package/dist/platform/types.d.ts +0 -9
- package/dist/process/control-arbiter.d.ts +2 -1
- package/dist/process/control-arbiter.js +1 -2
- package/dist/process/driver.d.ts +9 -8
- package/dist/process/driver.js +11 -22
- package/dist/process/index.d.ts +2 -0
- package/dist/process/index.js +2 -0
- package/dist/process/managed-record.d.ts +2 -2
- package/dist/process/process-driver.d.ts +109 -0
- package/dist/process/process-driver.js +650 -0
- package/dist/process/process-executor.d.ts +47 -0
- package/dist/process/process-executor.js +296 -0
- package/dist/process/process-manager.js +48 -26
- package/dist/process/run-executor.js +12 -12
- package/dist/profile/client-actions.js +2 -2
- package/dist/profile/client-health.js +2 -2
- package/dist/profile/client-query.js +5 -6
- package/dist/profile/client-transport.d.ts +19 -17
- package/dist/profile/client-transport.js +47 -80
- package/dist/profile/client.d.ts +2 -2
- package/dist/profile/client.js +1 -1
- package/dist/profile/index.d.ts +1 -0
- package/dist/profile/index.js +1 -0
- package/dist/profile/manager.d.ts +5 -0
- package/dist/profile/manager.js +41 -6
- package/dist/project/closure.js +2 -2
- package/dist/project/index.d.ts +8 -1
- package/dist/project/index.js +10 -1
- package/dist/project/init.js +2 -2
- package/dist/project/loader.d.ts +1 -1
- package/dist/project/loader.js +26 -29
- package/dist/project/transactions.js +5 -10
- package/dist/project/types.d.ts +5 -0
- package/dist/registry/index.d.ts +3 -1
- package/dist/registry/index.js +2 -1
- package/dist/registry/lock.d.ts +28 -7
- package/dist/registry/lock.js +136 -16
- package/dist/registry/registry.d.ts +1 -5
- package/dist/registry/registry.js +1 -53
- package/dist/registry/scan.d.ts +0 -15
- package/dist/registry/scan.js +0 -59
- package/dist/registry/store.d.ts +42 -0
- package/dist/registry/store.js +43 -0
- package/dist/registry/types.d.ts +0 -24
- package/dist/runtime/action-collection.d.ts +1 -1
- package/dist/runtime/action-registry.d.ts +0 -4
- package/dist/runtime/action-registry.js +0 -7
- package/dist/runtime/context.js +5 -11
- package/dist/runtime/events.js +3 -6
- package/dist/runtime/identity.d.ts +22 -0
- package/dist/runtime/identity.js +10 -0
- package/dist/runtime/index.d.ts +1 -2
- package/dist/runtime/index.js +1 -2
- package/dist/runtime/module-loader.d.ts +2 -34
- package/dist/runtime/module-loader.js +1 -16
- package/dist/runtime/process.d.ts +6 -24
- package/dist/runtime/process.js +1 -118
- package/dist/runtime/run-persistence.js +2 -5
- package/dist/runtime/runner.d.ts +33 -93
- package/dist/runtime/runner.js +132 -364
- package/dist/runtime/standalone.d.ts +23 -8
- package/dist/runtime/standalone.js +100 -147
- package/dist/server/body.d.ts +16 -8
- package/dist/server/body.js +33 -16
- package/dist/server/dispatcher.d.ts +6 -10
- package/dist/server/dispatcher.js +24 -32
- package/dist/server/http-server.d.ts +87 -0
- package/dist/server/http-server.js +304 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/index.js +11 -0
- package/dist/server/mcp-endpoint.d.ts +61 -0
- package/dist/server/mcp-endpoint.js +118 -0
- package/dist/server/policy.d.ts +138 -0
- package/dist/server/policy.js +368 -0
- package/dist/server/routes/actions.js +114 -64
- package/dist/server/routes/common.d.ts +18 -33
- package/dist/server/routes/common.js +45 -65
- package/dist/server/routes/config.d.ts +1 -1
- package/dist/server/routes/config.js +55 -65
- package/dist/server/routes/doctor.d.ts +1 -1
- package/dist/server/routes/doctor.js +13 -21
- package/dist/server/routes/health.d.ts +1 -1
- package/dist/server/routes/health.js +4 -5
- package/dist/server/routes/info.d.ts +2 -2
- package/dist/server/routes/info.js +17 -24
- package/dist/server/routes/playbooks.js +23 -36
- package/dist/server/routes/runs.js +151 -141
- package/dist/server/routes/state.d.ts +1 -1
- package/dist/server/routes/state.js +64 -63
- package/dist/server/security.d.ts +11 -0
- package/dist/server/security.js +36 -19
- package/dist/server/server.d.ts +2 -2
- package/dist/server/server.js +224 -238
- package/dist/server/types.d.ts +68 -21
- package/dist/service/factory.d.ts +12 -0
- package/dist/service/factory.js +85 -0
- package/dist/{target → service}/index.d.ts +1 -1
- package/dist/{target → service}/index.js +1 -1
- package/dist/service/local.d.ts +27 -0
- package/dist/service/local.js +138 -0
- package/dist/{target → service}/remote-errors.d.ts +3 -6
- package/dist/service/remote-errors.js +38 -0
- package/dist/{target → service}/remote-polling.d.ts +2 -2
- package/dist/{target → service}/remote-polling.js +8 -8
- package/dist/service/remote.d.ts +34 -0
- package/dist/service/remote.js +634 -0
- package/dist/service/sse-stream.d.ts +24 -0
- package/dist/service/sse-stream.js +139 -0
- package/dist/service/types.d.ts +272 -0
- package/dist/service/types.js +32 -0
- package/dist/storage/data-dir-lock.js +10 -5
- package/dist/storage/driver.d.ts +2 -1
- package/dist/storage/driver.js +3 -52
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +1 -0
- package/dist/storage/lock-core.d.ts +2 -6
- package/dist/storage/lock-core.js +4 -17
- package/dist/storage/params.d.ts +2 -8
- package/dist/storage/params.js +2 -8
- package/dist/storage/sqlite-driver.d.ts +40 -0
- package/dist/storage/sqlite-driver.js +116 -0
- package/dist/storage/sqlite.js +21 -6
- package/dist/storage/types.d.ts +4 -4
- package/dist/storage/types.js +2 -2
- package/dist/utils/index.d.ts +53 -0
- package/dist/utils/index.js +99 -4
- package/dist/utils/process.d.ts +10 -0
- package/dist/utils/process.js +21 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +41 -3
- package/dist/app/index.d.ts +0 -2
- package/dist/app/index.js +0 -2
- package/dist/app/types.js +0 -1
- package/dist/catalog/action-index.d.ts +0 -9
- package/dist/catalog/action-index.js +0 -95
- package/dist/catalog/action-resolver.d.ts +0 -20
- package/dist/catalog/action-resolver.js +0 -95
- package/dist/catalog/location-registry.d.ts +0 -15
- package/dist/catalog/location-registry.js +0 -138
- package/dist/catalog/package-catalog.d.ts +0 -7
- package/dist/catalog/package-catalog.js +0 -77
- package/dist/catalog/types.d.ts +0 -68
- package/dist/catalog/types.js +0 -1
- package/dist/export/index.d.ts +0 -1
- package/dist/export/index.js +0 -1
- package/dist/export/templates.d.ts +0 -71
- package/dist/export/templates.js +0 -635
- package/dist/ipc/target.d.ts +0 -74
- package/dist/ipc/target.js +0 -365
- package/dist/platform/default.d.ts +0 -38
- package/dist/platform/default.js +0 -78
- package/dist/project/resolver.d.ts +0 -116
- package/dist/project/resolver.js +0 -376
- package/dist/registry/resolve.d.ts +0 -62
- package/dist/registry/resolve.js +0 -195
- package/dist/runtime/execution-manager.d.ts +0 -48
- package/dist/runtime/execution-manager.js +0 -66
- package/dist/runtime/package-runner-factory.d.ts +0 -82
- package/dist/runtime/package-runner-factory.js +0 -186
- package/dist/target/local.d.ts +0 -53
- package/dist/target/local.js +0 -349
- package/dist/target/remote-errors.js +0 -51
- package/dist/target/remote.d.ts +0 -86
- package/dist/target/remote.js +0 -818
- package/dist/target/target.d.ts +0 -6
- package/dist/target/target.js +0 -37
- package/dist/target/types.d.ts +0 -261
- package/dist/target/types.js +0 -35
- /package/dist/{app → package}/static-index.d.ts +0 -0
- /package/dist/{target → service}/sse-parser.d.ts +0 -0
- /package/dist/{target → service}/sse-parser.js +0 -0
package/dist/errors.js
CHANGED
|
@@ -29,14 +29,8 @@ export const INPUT_NOT_JSON = "INPUT_NOT_JSON";
|
|
|
29
29
|
export const OUTPUT_NOT_JSON = "OUTPUT_NOT_JSON";
|
|
30
30
|
/** 根运行并发子任务数达到上限 */
|
|
31
31
|
export const ACTION_SUBRUN_LIMIT = "ACTION_SUBRUN_LIMIT";
|
|
32
|
-
/** 子任务数达限错误的别名标记(details.alias 专用,非独立错误码) */
|
|
33
|
-
export const MAX_SUBRUNS_REACHED = "MAX_SUBRUNS_REACHED";
|
|
34
32
|
/** Action 调用链出现环路 */
|
|
35
33
|
export const ACTION_CALL_CYCLE = "ACTION_CALL_CYCLE";
|
|
36
|
-
/** 调用链环路检测的别名标记(details.alias 专用,非独立错误码) */
|
|
37
|
-
export const ACTION_CYCLE_DETECTED = "ACTION_CYCLE_DETECTED";
|
|
38
|
-
/** 调用链深度超限的别名标记(details.alias 专用,非独立错误码) */
|
|
39
|
-
export const ACTION_MAX_DEPTH_EXCEEDED = "ACTION_MAX_DEPTH_EXCEEDED";
|
|
40
34
|
/** 跨包调用未在 uses 中声明依赖 */
|
|
41
35
|
export const UNDECLARED_ACTION_DEPENDENCY = "UNDECLARED_ACTION_DEPENDENCY";
|
|
42
36
|
/** Action 引用存在多包歧义 */
|
|
@@ -53,14 +47,22 @@ export const RUN_REPOSITORY_UNAVAILABLE = "RUN_REPOSITORY_UNAVAILABLE";
|
|
|
53
47
|
export const RUN_PERSISTENCE_FAILED = "RUN_PERSISTENCE_FAILED";
|
|
54
48
|
/** 独立单执行二进制拒绝异步启动语义 */
|
|
55
49
|
export const STANDALONE_ASYNC_UNSUPPORTED = "STANDALONE_ASYNC_UNSUPPORTED";
|
|
50
|
+
/** 独立运行模式不支持级联调用 */
|
|
51
|
+
export const INVOCATION_UNSUPPORTED = "INVOCATION_UNSUPPORTED";
|
|
56
52
|
/** 宿主子进程已退出,调用无法送达 */
|
|
57
53
|
export const HOST_PROCESS_EXITED = "HOST_PROCESS_EXITED";
|
|
58
54
|
/** 调用在启动前已被取消 */
|
|
59
55
|
export const EXECUTION_ABORTED = "EXECUTION_ABORTED";
|
|
60
56
|
/** 远程运行等待超时 */
|
|
61
57
|
export const TIMEOUT = "TIMEOUT";
|
|
58
|
+
/** 服务已关闭拒绝继续调用 */
|
|
59
|
+
export const SERVICE_CLOSED = "SERVICE_CLOSED";
|
|
62
60
|
/** 远程服务器网络连接失败 */
|
|
63
61
|
export const NETWORK_ERROR = "NETWORK_ERROR";
|
|
62
|
+
/** 非本地明文 HTTP 传输违规 */
|
|
63
|
+
export const INSECURE_TRANSPORT = "INSECURE_TRANSPORT";
|
|
64
|
+
/** 远程 HTTP 请求失败 */
|
|
65
|
+
export const REMOTE_REQUEST_FAILED = "REMOTE_REQUEST_FAILED";
|
|
64
66
|
/** 远程事件流全部候选路由均不可用 */
|
|
65
67
|
export const REMOTE_STREAM_UNAVAILABLE = "REMOTE_STREAM_UNAVAILABLE";
|
|
66
68
|
/** 远程目标未启用管理接口能力 */
|
|
@@ -92,6 +94,72 @@ export const UNAUTHORIZED = "UNAUTHORIZED";
|
|
|
92
94
|
export const NOT_FOUND = "NOT_FOUND";
|
|
93
95
|
/** HTTP 服务内部错误 */
|
|
94
96
|
export const SERVER_ERROR = "SERVER_ERROR";
|
|
97
|
+
/** HTTP 服务请求非法 */
|
|
98
|
+
export const BAD_REQUEST = "BAD_REQUEST";
|
|
99
|
+
/** 目标包未列入允许白名单(403 禁止访问) */
|
|
100
|
+
export const PACKAGE_FORBIDDEN = "PACKAGE_FORBIDDEN";
|
|
101
|
+
/** 目标动作未列入允许白名单(403 禁止访问) */
|
|
102
|
+
export const ACTION_FORBIDDEN = "ACTION_FORBIDDEN";
|
|
103
|
+
/** 目标规程未找到 */
|
|
104
|
+
export const PLAYBOOK_NOT_FOUND = "PLAYBOOK_NOT_FOUND";
|
|
105
|
+
/** 请求体体积超出安全限制 */
|
|
106
|
+
export const REQUEST_TOO_LARGE = "REQUEST_TOO_LARGE";
|
|
107
|
+
/** 动作异步启动失败 */
|
|
108
|
+
export const ACTION_START_FAILED = "ACTION_START_FAILED";
|
|
109
|
+
/** 动作执行发生内部错误 */
|
|
110
|
+
export const ACTION_EXECUTION_ERROR = "ACTION_EXECUTION_ERROR";
|
|
111
|
+
/** 动作列表检索失败 */
|
|
112
|
+
export const ACTIONS_LIST_ERROR = "ACTIONS_LIST_ERROR";
|
|
113
|
+
/** 规程列表检索失败 */
|
|
114
|
+
export const PLAYBOOKS_LIST_ERROR = "PLAYBOOKS_LIST_ERROR";
|
|
115
|
+
/** 运行记录列表检索失败 */
|
|
116
|
+
export const RUNS_LIST_ERROR = "RUNS_LIST_ERROR";
|
|
117
|
+
/** 运行记录清空操作失败 */
|
|
118
|
+
export const RUNS_CLEAR_ERROR = "RUNS_CLEAR_ERROR";
|
|
119
|
+
/** 服务大纲信息自省失败 */
|
|
120
|
+
export const INFO_ERROR = "INFO_ERROR";
|
|
121
|
+
/** 包信息检索失败 */
|
|
122
|
+
export const PACKAGES_INFO_ERROR = "PACKAGES_INFO_ERROR";
|
|
123
|
+
/** 环境诊断体检执行失败 */
|
|
124
|
+
export const DOCTOR_ERROR = "DOCTOR_ERROR";
|
|
125
|
+
/** 运行由于服务中断或异常退出被置为中断态 */
|
|
126
|
+
export const RUN_INTERRUPTED = "RUN_INTERRUPTED";
|
|
127
|
+
/** 配置项环境变量生成失败 */
|
|
128
|
+
export const CONFIG_ENV_ERROR = "CONFIG_ENV_ERROR";
|
|
129
|
+
/** 配置项列表检索失败 */
|
|
130
|
+
export const CONFIG_LIST_ERROR = "CONFIG_LIST_ERROR";
|
|
131
|
+
/** 配置项写入失败 */
|
|
132
|
+
export const CONFIG_SET_ERROR = "CONFIG_SET_ERROR";
|
|
133
|
+
/** 配置项删除失败 */
|
|
134
|
+
export const CONFIG_DELETE_ERROR = "CONFIG_DELETE_ERROR";
|
|
135
|
+
/** 状态条目列表检索失败 */
|
|
136
|
+
export const STATE_LIST_ERROR = "STATE_LIST_ERROR";
|
|
137
|
+
/** 状态清空操作失败 */
|
|
138
|
+
export const STATE_CLEAR_ERROR = "STATE_CLEAR_ERROR";
|
|
139
|
+
/** 状态键操作异常 */
|
|
140
|
+
export const STATE_KEY_ERROR = "STATE_KEY_ERROR";
|
|
141
|
+
/** 数据目录已被其他活跃会话持有 */
|
|
142
|
+
export const DATA_DIR_IN_USE = "DATA_DIR_IN_USE";
|
|
143
|
+
/** 数据目录存在未完成的事务,需执行恢复 */
|
|
144
|
+
export const DATA_DIR_RECOVERY_REQUIRED = "DATA_DIR_RECOVERY_REQUIRED";
|
|
145
|
+
/** 存储底层 Schema 版本不受支持 */
|
|
146
|
+
export const UNSUPPORTED_STORAGE_SCHEMA = "UNSUPPORTED_STORAGE_SCHEMA";
|
|
147
|
+
/** 持久化运行错误对象反序列化解码失败 */
|
|
148
|
+
export const STORED_ERROR_DECODE_FAILED = "STORED_ERROR_DECODE_FAILED";
|
|
149
|
+
/** 子进程执行失败终结 */
|
|
150
|
+
export const PROCESS_FAILED = "PROCESS_FAILED";
|
|
151
|
+
/** 生成的类型定义已过期 */
|
|
152
|
+
export const GENERATED_TYPES_OUTDATED = "GENERATED_TYPES_OUTDATED";
|
|
153
|
+
/** 通信协议版本或格式不受支持 */
|
|
154
|
+
export const PROTOCOL_UNSUPPORTED = "PROTOCOL_UNSUPPORTED";
|
|
155
|
+
/** 服务调用结果未知 */
|
|
156
|
+
export const SERVICE_RESULT_UNKNOWN = "SERVICE_RESULT_UNKNOWN";
|
|
157
|
+
/** MCP 工具命名发生冲突 */
|
|
158
|
+
export const MCP_TOOL_NAME_COLLISION = "MCP_TOOL_NAME_COLLISION";
|
|
159
|
+
/** 跨进程 IPC 通信或调用异常 */
|
|
160
|
+
export const IPC_ERROR = "IPC_ERROR";
|
|
161
|
+
/** 服务调用层内部异常回退错误码 */
|
|
162
|
+
export const SERVICE_ERROR = "SERVICE_ERROR";
|
|
95
163
|
/**
|
|
96
164
|
* 判定错误消息根因是否为依赖模块缺失。
|
|
97
165
|
* 兼容 Node.js 与打包器(Bun 等)两类加载器的报错文案。
|
|
@@ -173,17 +241,44 @@ export const INPUT_CONFLICT = "INPUT_CONFLICT";
|
|
|
173
241
|
export const INPUT_FILE_NOT_FOUND = "INPUT_FILE_NOT_FOUND";
|
|
174
242
|
/** 输入文件或流读取失败 */
|
|
175
243
|
export const INPUT_FILE_READ_FAILED = "INPUT_FILE_READ_FAILED";
|
|
244
|
+
/** 命令参数或选项非法 */
|
|
245
|
+
export const INVALID_ARGUMENT = "INVALID_ARGUMENT";
|
|
246
|
+
/** 目标包未列入白名单 */
|
|
247
|
+
export const PACKAGE_NOT_ALLOWED = "PACKAGE_NOT_ALLOWED";
|
|
248
|
+
/** 包标识符格式非法或包含越界字符 */
|
|
249
|
+
export const INVALID_PACKAGE_ID = "INVALID_PACKAGE_ID";
|
|
250
|
+
/** 路径越界违规访问 */
|
|
251
|
+
export const PATH_TRAVERSAL = "PATH_TRAVERSAL";
|
|
252
|
+
/** 状态键存在多命名空间歧义 */
|
|
253
|
+
export const AMBIGUOUS_STATE_KEY = "AMBIGUOUS_STATE_KEY";
|
|
254
|
+
/** 目标运行记录未找到 */
|
|
255
|
+
export const RUN_NOT_FOUND = "RUN_NOT_FOUND";
|
|
256
|
+
/** 目标运行已进入终态不可操作 */
|
|
257
|
+
export const RUN_ALREADY_FINISHED = "RUN_ALREADY_FINISHED";
|
|
176
258
|
/**
|
|
177
|
-
*
|
|
259
|
+
* ActionDock 统一基础结构化异常类。
|
|
260
|
+
* 全仓各领域异常与跨层透传异常的统一事实源基类。
|
|
178
261
|
*/
|
|
179
|
-
export class
|
|
262
|
+
export class ActionDockError extends Error {
|
|
180
263
|
code;
|
|
181
264
|
details;
|
|
182
|
-
|
|
265
|
+
status;
|
|
266
|
+
constructor(code, message, details, status) {
|
|
183
267
|
super(message);
|
|
184
|
-
this.name = "
|
|
268
|
+
this.name = "ActionDockError";
|
|
185
269
|
this.code = code;
|
|
186
270
|
this.details = details;
|
|
271
|
+
this.status = status;
|
|
272
|
+
Object.setPrototypeOf(this, ActionDockError.prototype);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* 进程领域结构化异常类。
|
|
277
|
+
*/
|
|
278
|
+
export class ProcessError extends ActionDockError {
|
|
279
|
+
constructor(code, message, details) {
|
|
280
|
+
super(code, message, details);
|
|
281
|
+
this.name = "ProcessError";
|
|
187
282
|
Object.setPrototypeOf(this, ProcessError.prototype);
|
|
188
283
|
}
|
|
189
284
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import type { ActionDefinition, ActionRef, ExecutionEvent, ExecutionResult, JsonValue, RunRecord } from "@actiondock/sdk";
|
|
2
2
|
import { type EventSink } from "../runtime/events.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { type ExecutionHandle } from "../runtime/runner.js";
|
|
4
|
+
import { type PackageIdentity } from "../runtime/identity.js";
|
|
5
|
+
import type { ActionInvoker, CancelResult, ExecutionService, ExecutionServiceOptions, ExecutionTicket, InvocationContext } from "./types.js";
|
|
5
6
|
export type { ExecutionServiceOptions };
|
|
6
7
|
/**
|
|
7
8
|
* 统一执行协调服务实现。
|
|
8
9
|
*/
|
|
9
10
|
export declare class DefaultExecutionService implements ExecutionService {
|
|
10
|
-
|
|
11
|
+
readonly identity: PackageIdentity;
|
|
12
|
+
readonly packageId: string;
|
|
11
13
|
private storage;
|
|
12
14
|
private projectConfig?;
|
|
15
|
+
private projectRoot?;
|
|
16
|
+
private moduleLoader?;
|
|
13
17
|
readonly eventSink: EventSink;
|
|
14
18
|
readonly packageInstanceId: string;
|
|
15
19
|
readonly generationId: string;
|
|
@@ -20,16 +24,14 @@ export declare class DefaultExecutionService implements ExecutionService {
|
|
|
20
24
|
private logger?;
|
|
21
25
|
private clock?;
|
|
22
26
|
private process?;
|
|
23
|
-
private platform?;
|
|
24
27
|
private actionResolver?;
|
|
25
28
|
private activeRuns;
|
|
26
|
-
private reservedSlots;
|
|
27
|
-
private isClosing;
|
|
28
|
-
private ownsStorage;
|
|
29
|
-
private ownsGlobalStorage;
|
|
30
29
|
private globalStorage?;
|
|
30
|
+
private actionInvoker?;
|
|
31
|
+
private isClosing;
|
|
32
|
+
private reservedSlots;
|
|
31
33
|
constructor(options: ExecutionServiceOptions);
|
|
32
|
-
|
|
34
|
+
setActionInvoker(invoker?: ActionInvoker): void;
|
|
33
35
|
registerAction(id: string, action: ActionDefinition): void;
|
|
34
36
|
registerAction(action: ({
|
|
35
37
|
id: string;
|
|
@@ -38,23 +40,23 @@ export declare class DefaultExecutionService implements ExecutionService {
|
|
|
38
40
|
getAction(id: string): ActionDefinition | undefined;
|
|
39
41
|
listActions(): ActionDefinition[];
|
|
40
42
|
getActiveHandle(runId: string): ExecutionHandle | undefined;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
execute(ref: ActionRef | string, input: JsonValue, options?: ExecuteOptions): Promise<ExecutionResult>;
|
|
43
|
+
execute(ref: ActionRef | string, input: JsonValue, context: InvocationContext): Promise<ExecutionResult>;
|
|
44
|
+
run(ref: ActionRef | string, input: JsonValue, context: InvocationContext): Promise<ExecutionResult>;
|
|
44
45
|
get activeRunsCount(): number;
|
|
45
|
-
start(ref: ActionRef | string, input: JsonValue,
|
|
46
|
+
start(ref: ActionRef | string, input: JsonValue, context: InvocationContext): Promise<ExecutionTicket>;
|
|
46
47
|
/**
|
|
47
48
|
* 幂等门检查:digest 计算与冲突/重复分流(重复命中时直接返回已有票据)。
|
|
48
49
|
*/
|
|
49
50
|
private checkIdempotencyGate;
|
|
50
51
|
/**
|
|
51
|
-
* 解析执行目标:确定目标
|
|
52
|
+
* 解析执行目标:确定目标 Action 定义。
|
|
53
|
+
* 铁律 4:Runner 不找 Package,ExecutionService 仅执行本 Package 的 Action。
|
|
52
54
|
*/
|
|
53
55
|
private resolveExecutionTarget;
|
|
54
56
|
/**
|
|
55
|
-
*
|
|
57
|
+
* 解析指定 Action 定义(供 PackageRuntime 或内部使用)。
|
|
56
58
|
*/
|
|
57
|
-
|
|
59
|
+
resolveAction(ref: ActionRef | string): Promise<ActionDefinition | undefined>;
|
|
58
60
|
/**
|
|
59
61
|
* 目标 Action 缺失时的失败票据:落库 failed 记录并补发 status 与 finish 事件。
|
|
60
62
|
*/
|