@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.
Files changed (243) hide show
  1. package/README.md +77 -64
  2. package/dist/catalog/action-catalog.d.ts +56 -0
  3. package/dist/catalog/action-catalog.js +202 -0
  4. package/dist/catalog/discovery.d.ts +60 -0
  5. package/dist/catalog/discovery.js +119 -0
  6. package/dist/catalog/graph.d.ts +190 -0
  7. package/dist/catalog/graph.js +589 -0
  8. package/dist/catalog/index.d.ts +5 -5
  9. package/dist/catalog/index.js +5 -5
  10. package/dist/catalog/resolve-action.d.ts +43 -0
  11. package/dist/catalog/resolve-action.js +119 -0
  12. package/dist/catalog/resolve-playbook.d.ts +26 -0
  13. package/dist/catalog/resolve-playbook.js +114 -0
  14. package/dist/doctor/checks/project.js +27 -8
  15. package/dist/doctor/checks/registry.js +2 -2
  16. package/dist/doctor/checks/runtime.js +34 -1
  17. package/dist/errors.d.ts +106 -10
  18. package/dist/errors.js +105 -10
  19. package/dist/execution/service.d.ts +18 -16
  20. package/dist/execution/service.js +183 -252
  21. package/dist/execution/types.d.ts +25 -69
  22. package/dist/execution/types.js +2 -1
  23. package/dist/filter/intent.d.ts +8 -9
  24. package/dist/filter/intent.js +49 -10
  25. package/dist/graph/index.d.ts +4 -0
  26. package/dist/graph/index.js +4 -0
  27. package/dist/host/host.d.ts +74 -32
  28. package/dist/host/host.js +585 -336
  29. package/dist/host/routing.d.ts +15 -48
  30. package/dist/host/routing.js +90 -153
  31. package/dist/host/types.d.ts +50 -17
  32. package/dist/index.d.ts +21 -24
  33. package/dist/index.js +19 -23
  34. package/dist/input/advice.d.ts +5 -1
  35. package/dist/input/advice.js +163 -214
  36. package/dist/input/describe.d.ts +1 -1
  37. package/dist/input/flat-errors.d.ts +5 -6
  38. package/dist/input/flat-errors.js +6 -6
  39. package/dist/input/flat-materializer.js +42 -44
  40. package/dist/invocation/index.d.ts +2 -0
  41. package/dist/invocation/index.js +2 -0
  42. package/dist/invocation/policy.d.ts +157 -0
  43. package/dist/invocation/policy.js +231 -0
  44. package/dist/invocation/types.d.ts +172 -0
  45. package/dist/invocation/types.js +97 -0
  46. package/dist/ipc/diagnostic.d.ts +0 -12
  47. package/dist/ipc/diagnostic.js +0 -21
  48. package/dist/ipc/host.d.ts +4 -4
  49. package/dist/ipc/host.js +44 -47
  50. package/dist/ipc/index.d.ts +1 -1
  51. package/dist/ipc/index.js +1 -1
  52. package/dist/ipc/service.d.ts +40 -0
  53. package/dist/ipc/service.js +349 -0
  54. package/dist/ipc/types.d.ts +21 -15
  55. package/dist/node/index.d.ts +1 -0
  56. package/dist/node/index.js +1 -0
  57. package/dist/node/module-loader.d.ts +63 -0
  58. package/dist/node/module-loader.js +112 -0
  59. package/dist/package/index.d.ts +23 -0
  60. package/dist/package/index.js +18 -0
  61. package/dist/{app/app.d.ts → package/runtime.d.ts} +41 -20
  62. package/dist/{app/app.js → package/runtime.js} +140 -95
  63. package/dist/{app → package}/static-index.js +58 -41
  64. package/dist/package/storage-view.d.ts +13 -0
  65. package/dist/package/storage-view.js +22 -0
  66. package/dist/{app → package}/types.d.ts +76 -57
  67. package/dist/package/types.js +22 -0
  68. package/dist/platform/index.d.ts +1 -1
  69. package/dist/platform/index.js +1 -1
  70. package/dist/platform/node.d.ts +48 -0
  71. package/dist/platform/node.js +96 -0
  72. package/dist/platform/types.d.ts +0 -9
  73. package/dist/process/control-arbiter.d.ts +2 -1
  74. package/dist/process/control-arbiter.js +1 -2
  75. package/dist/process/driver.d.ts +9 -8
  76. package/dist/process/driver.js +11 -22
  77. package/dist/process/index.d.ts +2 -0
  78. package/dist/process/index.js +2 -0
  79. package/dist/process/managed-record.d.ts +2 -2
  80. package/dist/process/process-driver.d.ts +109 -0
  81. package/dist/process/process-driver.js +650 -0
  82. package/dist/process/process-executor.d.ts +47 -0
  83. package/dist/process/process-executor.js +296 -0
  84. package/dist/process/process-manager.js +48 -26
  85. package/dist/process/run-executor.js +12 -12
  86. package/dist/profile/client-actions.js +2 -2
  87. package/dist/profile/client-health.js +2 -2
  88. package/dist/profile/client-query.js +5 -6
  89. package/dist/profile/client-transport.d.ts +19 -17
  90. package/dist/profile/client-transport.js +47 -80
  91. package/dist/profile/client.d.ts +2 -2
  92. package/dist/profile/client.js +1 -1
  93. package/dist/profile/index.d.ts +1 -0
  94. package/dist/profile/index.js +1 -0
  95. package/dist/profile/manager.d.ts +5 -0
  96. package/dist/profile/manager.js +41 -6
  97. package/dist/project/closure.js +2 -2
  98. package/dist/project/index.d.ts +8 -1
  99. package/dist/project/index.js +10 -1
  100. package/dist/project/init.js +2 -2
  101. package/dist/project/loader.d.ts +1 -1
  102. package/dist/project/loader.js +26 -29
  103. package/dist/project/transactions.js +5 -10
  104. package/dist/project/types.d.ts +5 -0
  105. package/dist/registry/index.d.ts +3 -1
  106. package/dist/registry/index.js +2 -1
  107. package/dist/registry/lock.d.ts +28 -7
  108. package/dist/registry/lock.js +136 -16
  109. package/dist/registry/registry.d.ts +1 -5
  110. package/dist/registry/registry.js +1 -53
  111. package/dist/registry/scan.d.ts +0 -15
  112. package/dist/registry/scan.js +0 -59
  113. package/dist/registry/store.d.ts +42 -0
  114. package/dist/registry/store.js +43 -0
  115. package/dist/registry/types.d.ts +0 -24
  116. package/dist/runtime/action-collection.d.ts +1 -1
  117. package/dist/runtime/action-registry.d.ts +0 -4
  118. package/dist/runtime/action-registry.js +0 -7
  119. package/dist/runtime/context.js +5 -11
  120. package/dist/runtime/events.js +3 -6
  121. package/dist/runtime/identity.d.ts +22 -0
  122. package/dist/runtime/identity.js +10 -0
  123. package/dist/runtime/index.d.ts +1 -2
  124. package/dist/runtime/index.js +1 -2
  125. package/dist/runtime/module-loader.d.ts +2 -34
  126. package/dist/runtime/module-loader.js +1 -16
  127. package/dist/runtime/process.d.ts +6 -24
  128. package/dist/runtime/process.js +1 -118
  129. package/dist/runtime/run-persistence.js +2 -5
  130. package/dist/runtime/runner.d.ts +33 -93
  131. package/dist/runtime/runner.js +132 -364
  132. package/dist/runtime/standalone.d.ts +23 -8
  133. package/dist/runtime/standalone.js +100 -147
  134. package/dist/server/body.d.ts +16 -8
  135. package/dist/server/body.js +33 -16
  136. package/dist/server/dispatcher.d.ts +6 -10
  137. package/dist/server/dispatcher.js +24 -32
  138. package/dist/server/http-server.d.ts +87 -0
  139. package/dist/server/http-server.js +304 -0
  140. package/dist/server/index.d.ts +12 -0
  141. package/dist/server/index.js +11 -0
  142. package/dist/server/mcp-endpoint.d.ts +61 -0
  143. package/dist/server/mcp-endpoint.js +118 -0
  144. package/dist/server/policy.d.ts +138 -0
  145. package/dist/server/policy.js +368 -0
  146. package/dist/server/routes/actions.js +114 -64
  147. package/dist/server/routes/common.d.ts +18 -33
  148. package/dist/server/routes/common.js +45 -65
  149. package/dist/server/routes/config.d.ts +1 -1
  150. package/dist/server/routes/config.js +55 -65
  151. package/dist/server/routes/doctor.d.ts +1 -1
  152. package/dist/server/routes/doctor.js +13 -21
  153. package/dist/server/routes/health.d.ts +1 -1
  154. package/dist/server/routes/health.js +4 -5
  155. package/dist/server/routes/info.d.ts +2 -2
  156. package/dist/server/routes/info.js +17 -24
  157. package/dist/server/routes/playbooks.js +23 -36
  158. package/dist/server/routes/runs.js +151 -141
  159. package/dist/server/routes/state.d.ts +1 -1
  160. package/dist/server/routes/state.js +64 -63
  161. package/dist/server/security.d.ts +11 -0
  162. package/dist/server/security.js +36 -19
  163. package/dist/server/server.d.ts +2 -2
  164. package/dist/server/server.js +224 -238
  165. package/dist/server/types.d.ts +68 -21
  166. package/dist/service/factory.d.ts +12 -0
  167. package/dist/service/factory.js +85 -0
  168. package/dist/{target → service}/index.d.ts +1 -1
  169. package/dist/{target → service}/index.js +1 -1
  170. package/dist/service/local.d.ts +27 -0
  171. package/dist/service/local.js +138 -0
  172. package/dist/{target → service}/remote-errors.d.ts +3 -6
  173. package/dist/service/remote-errors.js +38 -0
  174. package/dist/{target → service}/remote-polling.d.ts +2 -2
  175. package/dist/{target → service}/remote-polling.js +8 -8
  176. package/dist/service/remote.d.ts +34 -0
  177. package/dist/service/remote.js +634 -0
  178. package/dist/service/sse-stream.d.ts +24 -0
  179. package/dist/service/sse-stream.js +139 -0
  180. package/dist/service/types.d.ts +272 -0
  181. package/dist/service/types.js +32 -0
  182. package/dist/storage/data-dir-lock.js +10 -5
  183. package/dist/storage/driver.d.ts +2 -1
  184. package/dist/storage/driver.js +3 -52
  185. package/dist/storage/index.d.ts +1 -0
  186. package/dist/storage/index.js +1 -0
  187. package/dist/storage/lock-core.d.ts +2 -6
  188. package/dist/storage/lock-core.js +4 -17
  189. package/dist/storage/params.d.ts +2 -8
  190. package/dist/storage/params.js +2 -8
  191. package/dist/storage/sqlite-driver.d.ts +40 -0
  192. package/dist/storage/sqlite-driver.js +116 -0
  193. package/dist/storage/sqlite.js +21 -6
  194. package/dist/storage/types.d.ts +4 -4
  195. package/dist/storage/types.js +2 -2
  196. package/dist/utils/index.d.ts +53 -0
  197. package/dist/utils/index.js +99 -4
  198. package/dist/utils/process.d.ts +10 -0
  199. package/dist/utils/process.js +21 -0
  200. package/dist/version.d.ts +1 -1
  201. package/dist/version.js +1 -1
  202. package/package.json +41 -3
  203. package/dist/app/index.d.ts +0 -2
  204. package/dist/app/index.js +0 -2
  205. package/dist/app/types.js +0 -1
  206. package/dist/catalog/action-index.d.ts +0 -9
  207. package/dist/catalog/action-index.js +0 -95
  208. package/dist/catalog/action-resolver.d.ts +0 -20
  209. package/dist/catalog/action-resolver.js +0 -95
  210. package/dist/catalog/location-registry.d.ts +0 -15
  211. package/dist/catalog/location-registry.js +0 -138
  212. package/dist/catalog/package-catalog.d.ts +0 -7
  213. package/dist/catalog/package-catalog.js +0 -77
  214. package/dist/catalog/types.d.ts +0 -68
  215. package/dist/catalog/types.js +0 -1
  216. package/dist/export/index.d.ts +0 -1
  217. package/dist/export/index.js +0 -1
  218. package/dist/export/templates.d.ts +0 -71
  219. package/dist/export/templates.js +0 -635
  220. package/dist/ipc/target.d.ts +0 -74
  221. package/dist/ipc/target.js +0 -365
  222. package/dist/platform/default.d.ts +0 -38
  223. package/dist/platform/default.js +0 -78
  224. package/dist/project/resolver.d.ts +0 -116
  225. package/dist/project/resolver.js +0 -376
  226. package/dist/registry/resolve.d.ts +0 -62
  227. package/dist/registry/resolve.js +0 -195
  228. package/dist/runtime/execution-manager.d.ts +0 -48
  229. package/dist/runtime/execution-manager.js +0 -66
  230. package/dist/runtime/package-runner-factory.d.ts +0 -82
  231. package/dist/runtime/package-runner-factory.js +0 -186
  232. package/dist/target/local.d.ts +0 -53
  233. package/dist/target/local.js +0 -349
  234. package/dist/target/remote-errors.js +0 -51
  235. package/dist/target/remote.d.ts +0 -86
  236. package/dist/target/remote.js +0 -818
  237. package/dist/target/target.d.ts +0 -6
  238. package/dist/target/target.js +0 -37
  239. package/dist/target/types.d.ts +0 -261
  240. package/dist/target/types.js +0 -35
  241. /package/dist/{app → package}/static-index.d.ts +0 -0
  242. /package/dist/{target → service}/sse-parser.d.ts +0 -0
  243. /package/dist/{target → service}/sse-parser.js +0 -0
@@ -1,6 +0,0 @@
1
- import type { ActionDockTarget, TargetOptions } from "./types.js";
2
- /**
3
- * 工厂函数:统一创建 ActionDockTarget 实例。
4
- * 依据传入参数自动决策创建 LocalActionDockTarget 或 RemoteActionDockTarget。
5
- */
6
- export declare function createActionDockTarget(options?: TargetOptions): Promise<ActionDockTarget>;
@@ -1,37 +0,0 @@
1
- import { createActionDockApp } from "../app/app.js";
2
- import { createActionDockHost } from "../host/host.js";
3
- import { LocalActionDockTarget } from "./local.js";
4
- import { RemoteActionDockTarget } from "./remote.js";
5
- /**
6
- * 工厂函数:统一创建 ActionDockTarget 实例。
7
- * 依据传入参数自动决策创建 LocalActionDockTarget 或 RemoteActionDockTarget。
8
- */
9
- export async function createActionDockTarget(options = {}) {
10
- if (options.type === "ipc") {
11
- const { IpcActionDockTarget } = await import("../ipc/target.js");
12
- return new IpcActionDockTarget(options);
13
- }
14
- if (options.type === "remote" ||
15
- ("serverUrl" in options && Boolean(options.serverUrl))) {
16
- return new RemoteActionDockTarget(options);
17
- }
18
- const localOpts = options;
19
- if (localOpts.host) {
20
- return new LocalActionDockTarget(localOpts.host);
21
- }
22
- if (localOpts.app) {
23
- return new LocalActionDockTarget(localOpts.app);
24
- }
25
- if (localOpts.appOptions) {
26
- const app = await createActionDockApp(localOpts.appOptions);
27
- return new LocalActionDockTarget(app);
28
- }
29
- const host = await createActionDockHost({
30
- scanLinkedPackages: localOpts.scanLinkedPackages ?? true,
31
- ...localOpts,
32
- // CLI 查询命令缺省旁观打开;显式声明 recoverOrphans 的执行命令透传持有者语义
33
- recoverOrphans: localOpts.recoverOrphans === true,
34
- ...(localOpts.hostOptions || {}),
35
- });
36
- return new LocalActionDockTarget(host);
37
- }
@@ -1,261 +0,0 @@
1
- import type { ActionRef, ExecutionEvent, ExecutionResult, JsonValue, RunRecord } from "@actiondock/sdk";
2
- import type { ActionDockApp, ActionDockAppOptions, ActionSpec, ActionSummary, ListActionsOptions, PackageInfo, PlaybookSpec, PlaybookSummary } from "../app/types.js";
3
- import type { CancelResult, ExecuteOptions, ExecutionTicket } from "../execution/types.js";
4
- import type { ActionDockHost, ActionDockHostOptions } from "../host/types.js";
5
- import type { RuntimePlatform } from "../platform/types.js";
6
- import type { StateEntry } from "../storage/types.js";
7
- /**
8
- * 统一协议版本常量。
9
- */
10
- export declare const ACTIONDOCK_PROTOCOL_VERSION = "2.0";
11
- /**
12
- * Target 错误码常量。
13
- */
14
- export declare const TARGET_PROTOCOL_UNSUPPORTED = "TARGET_PROTOCOL_UNSUPPORTED";
15
- export declare const TARGET_CAPABILITY_UNAVAILABLE = "TARGET_CAPABILITY_UNAVAILABLE";
16
- export declare const TARGET_RESULT_UNKNOWN = "TARGET_RESULT_UNKNOWN";
17
- export declare const TARGET_CLOSED = "TARGET_CLOSED";
18
- /**
19
- * 结构化 Target 异常类。
20
- */
21
- export declare class TargetError extends Error {
22
- readonly code: string;
23
- readonly details?: Record<string, unknown>;
24
- constructor(code: string, message: string, details?: Record<string, unknown>);
25
- }
26
- /**
27
- * 关闭超时异常类。
28
- */
29
- export declare class CloseTimeoutError extends Error {
30
- readonly runIds?: string[];
31
- constructor(message?: string, runIds?: string[]);
32
- }
33
- /**
34
- * 幂等性保留策略。
35
- */
36
- export interface IdempotencyPolicy {
37
- /** 去重记录保留时长(毫秒) */
38
- retentionMs?: number;
39
- /** 去重请求头标识字段名 */
40
- header?: string;
41
- [key: string]: unknown;
42
- }
43
- /**
44
- * 统一目标自省元数据信息。
45
- */
46
- export interface TargetInfo {
47
- /** 目标宿主唯一标识 */
48
- id: string;
49
- /** 目标宿主名称 */
50
- name: string;
51
- /** 统一通信协议版本 */
52
- protocolVersion: string;
53
- /** 已加载或已发现的包清单 */
54
- packages: PackageInfo[];
55
- /** 服务端声明的能力集合 */
56
- capabilities: string[];
57
- /** 去重记录保留与幂等策略 */
58
- idempotencyPolicy?: IdempotencyPolicy;
59
- [key: string]: unknown;
60
- }
61
- /**
62
- * 配置项安全视图契约。
63
- * 屏蔽敏感配置原文,仅暴露是否已配置、是否为秘密及实际解析来源。
64
- */
65
- export interface ConfigValueView {
66
- /** 配置项键名 */
67
- key: string;
68
- /** 是否已显式配置或存在有效值 */
69
- configured: boolean;
70
- /** 是否为秘密敏感配置 */
71
- secret: boolean;
72
- /** 配置值实际解析来源 */
73
- source: string;
74
- /** 非秘密配置的实际数据值 */
75
- value?: JsonValue;
76
- }
77
- /**
78
- * 状态作用域与筛选控制选项。
79
- */
80
- export interface StateScopeOptions {
81
- /** 显式绑定的 Action 标识(可选,用于在扁平调用时直接定位 Action 命名空间) */
82
- actionId?: string;
83
- /** 显式子命名空间(相对于 Action 根命名空间) */
84
- namespace?: string;
85
- /** 存活有效期(秒),仅在写入状态时生效 */
86
- ttl?: number;
87
- /** 键名前缀过滤匹配 */
88
- prefix?: string;
89
- /** 是否清空所有条目 */
90
- all?: boolean;
91
- /** 是否返回完整条目详情 */
92
- detail?: boolean;
93
- }
94
- /**
95
- * ActionDockTarget 统一调用门面契约。
96
- * 为 CLI、SDK 及扩展系统屏蔽本地执行与远程调用的物理拓扑差异。
97
- */
98
- export interface ActionDockTarget {
99
- /** 获取统一目标自省元数据信息 */
100
- info(): Promise<TargetInfo>;
101
- /** 列出目标所有已加载的包清单 */
102
- listPackages(): Promise<PackageInfo[]>;
103
- /** 静态列出目标所有可用的 Action 摘要 */
104
- listActions(options?: ListActionsOptions): Promise<ActionSummary[]>;
105
- /** 静态查询并返回指定 Action 的规范结构与模式定义 */
106
- describeAction(ref: ActionRef | string): Promise<ActionSpec>;
107
- /** 静态列出目标所有可用的 Playbook 规程摘要 */
108
- listPlaybooks(options?: {
109
- intent?: string;
110
- package?: string;
111
- }): Promise<PlaybookSummary[]>;
112
- /** 静态查询并返回指定 Playbook 的规范内容与操作指南 */
113
- describePlaybook(id: string): Promise<PlaybookSpec>;
114
- /** 同步执行指定 Action 并等待终态结果 */
115
- runAction(ref: ActionRef | string, input: JsonValue, options?: ExecuteOptions): Promise<ExecutionResult>;
116
- /** 异步启动指定 Action 并立即返回任务执行票据 */
117
- startAction(ref: ActionRef | string, input: JsonValue, options?: ExecuteOptions): Promise<ExecutionTicket>;
118
- /** 查询最近的任务执行记录列表 */
119
- listRuns(options?: ListRunsOptions): Promise<RunRecord[]>;
120
- /** 查询指定运行标识的记录详情 */
121
- getRun(runId: string): Promise<RunRecord | undefined>;
122
- /** 取消指定在运行的任务 */
123
- cancelRun(runId: string, reason?: string): Promise<CancelResult>;
124
- /** 清空历史任务运行记录 */
125
- clearRuns?(options?: {
126
- packageId?: string;
127
- actionId?: string;
128
- status?: string;
129
- }): Promise<number>;
130
- /** 订阅指定运行的事件流 */
131
- events(runId: string, options?: {
132
- after?: number | string;
133
- signal?: AbortSignal;
134
- maxQueueSize?: number;
135
- }): AsyncIterable<ExecutionEvent>;
136
- /** 获取指定包的单项配置安全视图 */
137
- getConfig(packageId: string, key: string): Promise<ConfigValueView>;
138
- /** 写入或覆盖指定包的配置项 */
139
- setConfig(packageId: string, key: string, value: JsonValue): Promise<void>;
140
- /** 删除指定包的指定配置项 */
141
- deleteConfig(packageId: string, key: string): Promise<boolean>;
142
- /** 列出指定包所有配置项的安全视图列表 */
143
- listConfig(packageId: string): Promise<ConfigValueView[]>;
144
- /** 获取指定包指定动作的作用域状态值 */
145
- getState<T extends JsonValue = JsonValue>(packageId: string, actionId: string, key: string, options?: StateScopeOptions): Promise<T | undefined>;
146
- /** 写入指定包指定动作的作用域状态值 */
147
- setState<T extends JsonValue = JsonValue>(packageId: string, actionId: string, key: string, value: T, options?: StateScopeOptions): Promise<void>;
148
- /** 删除指定包指定动作的作用域状态项 */
149
- deleteState(packageId: string, actionId: string, key: string, options?: StateScopeOptions): Promise<boolean>;
150
- /** 列出指定包指定动作在存储中的状态键名列表 */
151
- listStateKeys(packageId: string, actionId: string, options?: StateScopeOptions): Promise<string[]>;
152
- /** 清空指定包指定动作在存储中的状态条目 */
153
- clearState(packageId: string, actionId: string, options?: StateScopeOptions): Promise<number>;
154
- /** 列出指定包在存储中的状态条目(含完整元数据) */
155
- listStateEntries?(packageId: string, options?: any): Promise<StateEntry[]>;
156
- /** 解包被包装的内部宿主或应用实例(仅本地包装型目标存在) */
157
- unwrap?(): ActionDockHost | ActionDockApp | undefined;
158
- /** 关闭目标连接并清理底层资源 */
159
- close(options?: {
160
- timeoutMs?: number;
161
- }): Promise<void>;
162
- }
163
- /**
164
- * 历史任务执行记录检索查询选项。
165
- */
166
- export interface ListRunsOptions {
167
- /** 目标包唯一标识 */
168
- packageId?: string;
169
- /** Action 动作唯一标识 */
170
- actionId?: string;
171
- /** 运行终态状态筛选 */
172
- status?: string;
173
- /** 模糊意图检索模式 */
174
- intent?: string;
175
- /** 最大返回记录条数限制 */
176
- limit?: number;
177
- }
178
- /**
179
- * 本地 Target 初始化选项。
180
- */
181
- export interface LocalTargetOptions {
182
- type?: "local";
183
- /** 包装的 ActionDockHost 实例 */
184
- host?: ActionDockHost;
185
- /** 包装的 ActionDockApp 实例 */
186
- app?: ActionDockApp;
187
- /** 单包 App 初始化配置(若未提供 host/app) */
188
- appOptions?: ActionDockAppOptions;
189
- /** 宿主 Host 初始化配置 */
190
- hostOptions?: ActionDockHostOptions;
191
- /** 当前工程根目录绝对路径 */
192
- projectRoot?: string;
193
- /** 预注册包配置列表 */
194
- packages?: Array<ActionDockApp | ActionDockAppOptions>;
195
- /** 自定义 ActionDock 家目录 */
196
- customHome?: string;
197
- /** 是否采用纯内存运行模式 */
198
- inMemory?: boolean;
199
- /** 自定义全局数据存储目录 */
200
- dataDir?: string;
201
- /** 是否扫描已软链接的外部包 */
202
- scanLinkedPackages?: boolean;
203
- /** 运行时平台适配 */
204
- platform?: RuntimePlatform;
205
- /**
206
- * 是否以数据目录持有者身份打开本地存储:true 时 App 存储在打开阶段收割
207
- * 遗留非终态运行记录。默认 false(旁观查询语义),供 CLI 查询命令与
208
- * 运行中的 serve 进程并发访问同一库文件。
209
- */
210
- recoverOrphans?: boolean;
211
- }
212
- /**
213
- * 远程 Target 初始化选项。
214
- */
215
- export interface RemoteTargetOptions {
216
- type?: "remote";
217
- /** 远端 ActionDock 服务 HTTP 根地址 */
218
- serverUrl: string;
219
- /** 鉴权 Bearer Token(可选) */
220
- token?: string;
221
- /** 是否允许向非回环地址发送明文 HTTP 请求(默认 false) */
222
- allowInsecureHttp?: boolean;
223
- /** 是否跳过 TLS 证书合法性校验(用于局域网自签证书) */
224
- insecure?: boolean;
225
- /** 自定义底层 HTTP 调度器(平台中立) */
226
- dispatcher?: unknown;
227
- /** 请求超时时间(毫秒) */
228
- timeoutMs?: number;
229
- /** 轮询等待基准底线超时时间(毫秒,默认 60000ms) */
230
- baseTimeoutMs?: number;
231
- }
232
- /**
233
- * 远程 ActionDockTarget 选项别名契约。
234
- */
235
- export type RemoteActionDockTargetOptions = RemoteTargetOptions;
236
- /**
237
- * 监督进程 IPC 目标初始化选项。
238
- */
239
- export interface IpcTargetOptions {
240
- type?: "ipc";
241
- /** 已启动的子进程实例(需具备 IPC 通道) */
242
- childProcess?: any;
243
- /** 待启动的脚本物理路径 */
244
- scriptPath?: string;
245
- /** 启动参数 */
246
- scriptArgs?: string[];
247
- /** 工作目录 */
248
- cwd?: string;
249
- /** 环境变量 */
250
- env?: Record<string, string | undefined>;
251
- /** 诊断流单流最大转发字节数 */
252
- maxDiagnosticBytes?: number;
253
- /** 诊断流每秒最大字节速率 */
254
- maxDiagnosticRate?: number;
255
- /** 诊断流目标输出 */
256
- diagnosticTarget?: any;
257
- }
258
- /**
259
- * Target 统一工厂选项参数。
260
- */
261
- export type TargetOptions = LocalTargetOptions | RemoteTargetOptions | IpcTargetOptions;
@@ -1,35 +0,0 @@
1
- /**
2
- * 统一协议版本常量。
3
- */
4
- export const ACTIONDOCK_PROTOCOL_VERSION = "2.0";
5
- /**
6
- * Target 错误码常量。
7
- */
8
- export const TARGET_PROTOCOL_UNSUPPORTED = "TARGET_PROTOCOL_UNSUPPORTED";
9
- export const TARGET_CAPABILITY_UNAVAILABLE = "TARGET_CAPABILITY_UNAVAILABLE";
10
- export const TARGET_RESULT_UNKNOWN = "TARGET_RESULT_UNKNOWN";
11
- export const TARGET_CLOSED = "TARGET_CLOSED";
12
- /**
13
- * 结构化 Target 异常类。
14
- */
15
- export class TargetError extends Error {
16
- code;
17
- details;
18
- constructor(code, message, details) {
19
- super(message);
20
- this.name = "TargetError";
21
- this.code = code;
22
- this.details = details;
23
- }
24
- }
25
- /**
26
- * 关闭超时异常类。
27
- */
28
- export class CloseTimeoutError extends Error {
29
- runIds;
30
- constructor(message = "Target close operation timed out", runIds) {
31
- super(message);
32
- this.name = "CloseTimeoutError";
33
- this.runIds = runIds;
34
- }
35
- }
File without changes
File without changes
File without changes