@actiondock/core 2.7.0 → 2.8.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 (236) hide show
  1. package/README.md +61 -68
  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 +102 -10
  18. package/dist/errors.js +103 -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/registry/index.d.ts +3 -1
  105. package/dist/registry/index.js +2 -1
  106. package/dist/registry/lock.d.ts +28 -7
  107. package/dist/registry/lock.js +136 -16
  108. package/dist/registry/registry.d.ts +1 -5
  109. package/dist/registry/registry.js +1 -53
  110. package/dist/registry/scan.d.ts +0 -15
  111. package/dist/registry/scan.js +0 -59
  112. package/dist/registry/store.d.ts +42 -0
  113. package/dist/registry/store.js +43 -0
  114. package/dist/registry/types.d.ts +0 -24
  115. package/dist/runtime/action-collection.d.ts +1 -1
  116. package/dist/runtime/action-registry.d.ts +0 -4
  117. package/dist/runtime/action-registry.js +0 -7
  118. package/dist/runtime/context.js +5 -11
  119. package/dist/runtime/events.js +3 -6
  120. package/dist/runtime/identity.d.ts +22 -0
  121. package/dist/runtime/identity.js +10 -0
  122. package/dist/runtime/index.d.ts +1 -2
  123. package/dist/runtime/index.js +1 -2
  124. package/dist/runtime/module-loader.d.ts +2 -34
  125. package/dist/runtime/module-loader.js +1 -16
  126. package/dist/runtime/process.d.ts +6 -24
  127. package/dist/runtime/process.js +1 -118
  128. package/dist/runtime/run-persistence.js +2 -5
  129. package/dist/runtime/runner.d.ts +33 -93
  130. package/dist/runtime/runner.js +132 -364
  131. package/dist/runtime/standalone.d.ts +23 -8
  132. package/dist/runtime/standalone.js +100 -147
  133. package/dist/server/body.d.ts +16 -8
  134. package/dist/server/body.js +33 -16
  135. package/dist/server/dispatcher.d.ts +6 -10
  136. package/dist/server/dispatcher.js +24 -32
  137. package/dist/server/http-server.d.ts +87 -0
  138. package/dist/server/http-server.js +304 -0
  139. package/dist/server/index.d.ts +11 -0
  140. package/dist/server/index.js +10 -0
  141. package/dist/server/mcp-endpoint.d.ts +61 -0
  142. package/dist/server/mcp-endpoint.js +118 -0
  143. package/dist/server/routes/actions.js +34 -28
  144. package/dist/server/routes/common.d.ts +10 -14
  145. package/dist/server/routes/common.js +32 -56
  146. package/dist/server/routes/config.js +54 -64
  147. package/dist/server/routes/doctor.d.ts +1 -1
  148. package/dist/server/routes/doctor.js +10 -18
  149. package/dist/server/routes/health.d.ts +1 -1
  150. package/dist/server/routes/health.js +2 -3
  151. package/dist/server/routes/info.d.ts +2 -2
  152. package/dist/server/routes/info.js +12 -13
  153. package/dist/server/routes/playbooks.js +16 -29
  154. package/dist/server/routes/runs.js +95 -117
  155. package/dist/server/routes/state.js +63 -62
  156. package/dist/server/server.d.ts +2 -2
  157. package/dist/server/server.js +43 -227
  158. package/dist/server/types.d.ts +8 -19
  159. package/dist/service/factory.d.ts +12 -0
  160. package/dist/service/factory.js +85 -0
  161. package/dist/{target → service}/index.d.ts +1 -1
  162. package/dist/{target → service}/index.js +1 -1
  163. package/dist/service/local.d.ts +27 -0
  164. package/dist/service/local.js +138 -0
  165. package/dist/{target → service}/remote-errors.d.ts +3 -6
  166. package/dist/service/remote-errors.js +38 -0
  167. package/dist/{target → service}/remote-polling.d.ts +2 -2
  168. package/dist/{target → service}/remote-polling.js +8 -8
  169. package/dist/service/remote.d.ts +34 -0
  170. package/dist/service/remote.js +634 -0
  171. package/dist/service/sse-stream.d.ts +24 -0
  172. package/dist/service/sse-stream.js +139 -0
  173. package/dist/service/types.d.ts +272 -0
  174. package/dist/service/types.js +32 -0
  175. package/dist/storage/data-dir-lock.js +10 -5
  176. package/dist/storage/driver.d.ts +2 -1
  177. package/dist/storage/driver.js +3 -52
  178. package/dist/storage/index.d.ts +1 -0
  179. package/dist/storage/index.js +1 -0
  180. package/dist/storage/lock-core.d.ts +2 -6
  181. package/dist/storage/lock-core.js +4 -17
  182. package/dist/storage/params.d.ts +2 -8
  183. package/dist/storage/params.js +2 -8
  184. package/dist/storage/sqlite-driver.d.ts +40 -0
  185. package/dist/storage/sqlite-driver.js +116 -0
  186. package/dist/storage/sqlite.js +21 -6
  187. package/dist/storage/types.d.ts +4 -4
  188. package/dist/storage/types.js +2 -2
  189. package/dist/utils/index.d.ts +53 -0
  190. package/dist/utils/index.js +99 -4
  191. package/dist/utils/process.d.ts +10 -0
  192. package/dist/utils/process.js +21 -0
  193. package/dist/version.d.ts +1 -1
  194. package/dist/version.js +1 -1
  195. package/package.json +41 -3
  196. package/dist/app/index.d.ts +0 -2
  197. package/dist/app/index.js +0 -2
  198. package/dist/app/types.js +0 -1
  199. package/dist/catalog/action-index.d.ts +0 -9
  200. package/dist/catalog/action-index.js +0 -95
  201. package/dist/catalog/action-resolver.d.ts +0 -20
  202. package/dist/catalog/action-resolver.js +0 -95
  203. package/dist/catalog/location-registry.d.ts +0 -15
  204. package/dist/catalog/location-registry.js +0 -138
  205. package/dist/catalog/package-catalog.d.ts +0 -7
  206. package/dist/catalog/package-catalog.js +0 -77
  207. package/dist/catalog/types.d.ts +0 -68
  208. package/dist/catalog/types.js +0 -1
  209. package/dist/export/index.d.ts +0 -1
  210. package/dist/export/index.js +0 -1
  211. package/dist/export/templates.d.ts +0 -71
  212. package/dist/export/templates.js +0 -635
  213. package/dist/ipc/target.d.ts +0 -74
  214. package/dist/ipc/target.js +0 -365
  215. package/dist/platform/default.d.ts +0 -38
  216. package/dist/platform/default.js +0 -78
  217. package/dist/project/resolver.d.ts +0 -116
  218. package/dist/project/resolver.js +0 -376
  219. package/dist/registry/resolve.d.ts +0 -62
  220. package/dist/registry/resolve.js +0 -195
  221. package/dist/runtime/execution-manager.d.ts +0 -48
  222. package/dist/runtime/execution-manager.js +0 -66
  223. package/dist/runtime/package-runner-factory.d.ts +0 -82
  224. package/dist/runtime/package-runner-factory.js +0 -186
  225. package/dist/target/local.d.ts +0 -53
  226. package/dist/target/local.js +0 -349
  227. package/dist/target/remote-errors.js +0 -51
  228. package/dist/target/remote.d.ts +0 -86
  229. package/dist/target/remote.js +0 -818
  230. package/dist/target/target.d.ts +0 -6
  231. package/dist/target/target.js +0 -37
  232. package/dist/target/types.d.ts +0 -261
  233. package/dist/target/types.js +0 -35
  234. /package/dist/{app → package}/static-index.d.ts +0 -0
  235. /package/dist/{target → service}/sse-parser.d.ts +0 -0
  236. /package/dist/{target → service}/sse-parser.js +0 -0
@@ -0,0 +1,190 @@
1
+ import { ActionDockError } from "../errors.js";
2
+ import { type ActionDockLockfile } from "../project/lockfile.js";
3
+ import type { ActionDockManifest, PlaybookDefinition } from "../project/types.js";
4
+ import { type PackageIdentity } from "../runtime/identity.js";
5
+ import { parseSemVer, type SemVer } from "../utils/index.js";
6
+ import { type DiscoveredPackage, type PackageDiscoveryOptions } from "./discovery.js";
7
+ export type { SemVer };
8
+ export { parseSemVer };
9
+ /**
10
+ * 校验两个语义化版本范围是否兼容并能收敛为单一解析版本。
11
+ * 遵循设计规范:直接或传递版本范围无法收敛时拒绝并抛出 ACTION_PACKAGE_VERSION_CONFLICT。
12
+ */
13
+ export declare function areVersionsCompatible(v1: string, v2: string): boolean;
14
+ /**
15
+ * 版本冲突错误。
16
+ */
17
+ export declare class ActionPackageVersionConflictError extends ActionDockError {
18
+ readonly packageId: string;
19
+ readonly conflicts: Array<{
20
+ requester: string;
21
+ rangeOrVersion: string;
22
+ }>;
23
+ constructor(packageId: string, conflicts: Array<{
24
+ requester: string;
25
+ rangeOrVersion: string;
26
+ }>);
27
+ }
28
+ /**
29
+ * 未声明依赖调用拦截错误。
30
+ */
31
+ export declare class UndeclaredActionDependencyError extends ActionDockError {
32
+ readonly targetRef: string;
33
+ readonly caller?: string;
34
+ constructor(targetRef: string, caller?: string, reason?: string);
35
+ }
36
+ /**
37
+ * 判定单一 uses 声明项是否命中目标 Action(跨包调用授权单一事实源)。
38
+ *
39
+ * 匹配语义(安全铁律,逐字不变):
40
+ * - 完全限定名:`<targetPackageId>/<targetActionId>`;
41
+ * - 包级通配符:`<targetPackageId>/*`;
42
+ * - 裸包名:`<targetPackageId>`。
43
+ *
44
+ * DefaultPackageGraph.canCascadeCall 与 InvocationPolicy.checkUsesAuthorization
45
+ * 必须统一经由本谓词判定,禁止在调用点另建重复表达式分叉。
46
+ */
47
+ export declare function isUsesDeclared(use: string, targetPackageId: string, targetActionId: string): boolean;
48
+ /**
49
+ * 包图拓扑节点定义。
50
+ */
51
+ export interface PackageNode {
52
+ /** 包唯一身份标识值对象 */
53
+ readonly identity: PackageIdentity;
54
+ /** 逻辑包唯一标识符(等同于 identity.id) */
55
+ readonly packageId: string;
56
+ /** 包根目录绝对物理路径 */
57
+ readonly root: string;
58
+ /** 包清单规范 */
59
+ readonly manifest: ActionDockManifest;
60
+ /** 包清单摘要哈希 */
61
+ readonly manifestDigest: string;
62
+ /** 包版本号 */
63
+ readonly version: string;
64
+ /** npm 包名或引用规格 */
65
+ readonly npmPackage: string;
66
+ /** 直接依赖包标识集合 */
67
+ readonly directDependencies: Set<string>;
68
+ /** 传递依赖闭包标识集合 */
69
+ readonly transitiveDependencies: Set<string>;
70
+ /** 是否为直接依赖 */
71
+ readonly isDirect?: boolean;
72
+ /** 是否为当前工程根包 */
73
+ readonly isRoot?: boolean;
74
+ }
75
+ /**
76
+ * 完整包依赖拓扑图 PackageGraph 契约。
77
+ */
78
+ export interface PackageGraph {
79
+ /** 当前工程根包身份(若存在) */
80
+ readonly root?: PackageIdentity;
81
+ /** 根包标识(快捷访问) */
82
+ readonly rootPackageId?: string;
83
+ /** 全局或当前工程全部包节点映射(按 packageId 索引) */
84
+ readonly packages: Map<string, PackageNode>;
85
+ /** 根包直接依赖包标识集合 */
86
+ readonly directDependencyIds: ReadonlySet<string>;
87
+ /** 根包传递依赖闭包标识集合 */
88
+ readonly transitiveDependencyIds: ReadonlySet<string>;
89
+ /** 可见 Playbook 映射 */
90
+ readonly visiblePlaybooks: Map<string, PlaybookDefinition>;
91
+ /** 可见 Playbook 委托点名的 Action 集合 */
92
+ readonly delegatedActions: ReadonlySet<string>;
93
+ /**
94
+ * 按包标识获取指定节点。
95
+ */
96
+ getPackage(id: string): PackageNode | undefined;
97
+ /**
98
+ * 按包标识获取指定节点(统一契约)。
99
+ */
100
+ getNode(id: string): PackageNode | undefined;
101
+ /**
102
+ * 判定是否存在指定包节点。
103
+ */
104
+ hasPackage(id: string): boolean;
105
+ /**
106
+ * 判定目标 Action 是否允许作为根调用发起。
107
+ */
108
+ canRootCall(targetPackageId: string, targetActionId: string): boolean;
109
+ /**
110
+ * 校验根调用权限,不合法时抛出 UndeclaredActionDependencyError。
111
+ */
112
+ assertRootCallAllowed(targetPackageId: string, targetActionId: string): void;
113
+ /**
114
+ * 判定跨包级联调用是否合法。
115
+ */
116
+ canCascadeCall(callerPackageId: string, callerActionId: string, targetPackageId: string, targetActionId: string): boolean;
117
+ /**
118
+ * 校验跨包级联调用权限,不合法时抛出 UndeclaredActionDependencyError。
119
+ */
120
+ assertCascadeCallAllowed(callerPackageId: string, callerActionId: string, targetPackageId: string, targetActionId: string): void;
121
+ }
122
+ /**
123
+ * 默认包依赖图实现。
124
+ */
125
+ export declare class DefaultPackageGraph implements PackageGraph {
126
+ readonly packages: Map<string, PackageNode>;
127
+ readonly root?: PackageIdentity;
128
+ readonly visiblePlaybooks: Map<string, PlaybookDefinition>;
129
+ readonly delegatedActions: ReadonlySet<string>;
130
+ constructor(packages: Map<string, PackageNode>, root?: PackageIdentity, visiblePlaybooks?: Map<string, PlaybookDefinition>, delegatedActions?: ReadonlySet<string>);
131
+ get rootPackageId(): string | undefined;
132
+ get directDependencyIds(): ReadonlySet<string>;
133
+ get transitiveDependencyIds(): ReadonlySet<string>;
134
+ getPackage(id: string): PackageNode | undefined;
135
+ getNode(id: string): PackageNode | undefined;
136
+ hasPackage(id: string): boolean;
137
+ canRootCall(targetPackageId: string, targetActionId: string): boolean;
138
+ assertRootCallAllowed(targetPackageId: string, targetActionId: string): void;
139
+ canCascadeCall(callerPackageId: string, callerActionId: string, targetPackageId: string, targetActionId: string): boolean;
140
+ assertCascadeCallAllowed(callerPackageId: string, callerActionId: string, targetPackageId: string, targetActionId: string): void;
141
+ }
142
+ /**
143
+ * 包图构建器配置选项。
144
+ */
145
+ export interface PackageGraphBuilderOptions {
146
+ /** 预先发现的包集合,若未提供则通过 PackageDiscovery 自动发现 */
147
+ packages?: DiscoveredPackage[];
148
+ /** 根工程根目录或根包标识(与 projectRoot 互为别名) */
149
+ root?: string;
150
+ /** 当前工程根目录绝对或相对物理路径 */
151
+ projectRoot?: string;
152
+ /** 显式根清单 */
153
+ manifest?: ActionDockManifest;
154
+ /** 锁文件规范对象(若未显式提供且 projectRoot 存在,则尝试自动读取 actiondock.lock.json) */
155
+ lockfile?: ActionDockLockfile;
156
+ /** 是否允许扫描与链接开发软链接包(默认根据 discoveryOptions 判定) */
157
+ allowDevLinks?: boolean;
158
+ /** 自定义 ActionDock 主目录路径(用于定位全局链接注册表) */
159
+ customHome?: string;
160
+ /** 显式包根目录映射字典或数组 */
161
+ packageRoots?: Record<string, string> | string[];
162
+ /** 包发现配置(构建器内部调用 PackageDiscovery 时生效) */
163
+ discoveryOptions?: PackageDiscoveryOptions;
164
+ /** 快照代次唯一标识(可选,默认生成 UUID) */
165
+ generationId?: string;
166
+ }
167
+ /**
168
+ * 包依赖拓扑图构建器 PackageGraphBuilder。
169
+ * 输入发现的包集合或工程根目录,统一实施版本冲突检测、lockfile 校验与拓扑图构建。
170
+ */
171
+ export declare class PackageGraphBuilder {
172
+ private readonly options;
173
+ constructor(options?: PackageGraphBuilderOptions);
174
+ /**
175
+ * 同步构建包依赖拓扑图(模式 A:显式包集合)。
176
+ */
177
+ private buildFromPackages;
178
+ /**
179
+ * 同步构建包依赖拓扑图(模式 C:全局包发现)。
180
+ */
181
+ private buildFromGlobalDiscovery;
182
+ /**
183
+ * 同步构建包依赖拓扑图。
184
+ */
185
+ buildSync(): PackageGraph;
186
+ /**
187
+ * 异步构建包依赖拓扑图。
188
+ */
189
+ build(): Promise<PackageGraph>;
190
+ }