@actiondock/core 2.9.1 → 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.
Files changed (256) hide show
  1. package/README.md +1 -2
  2. package/dist/catalog/action-catalog.js +3 -33
  3. package/dist/catalog/discovery.d.ts +0 -3
  4. package/dist/catalog/discovery.js +4 -4
  5. package/dist/catalog/graph.d.ts +0 -4
  6. package/dist/catalog/graph.js +12 -15
  7. package/dist/{profile/client-actions.d.ts → client/actions.d.ts} +1 -1
  8. package/dist/{profile/client-actions.js → client/actions.js} +2 -8
  9. package/dist/{profile/client-config.d.ts → client/config.d.ts} +1 -1
  10. package/dist/{profile/client-config.js → client/config.js} +1 -1
  11. package/dist/client/dispatcher.d.ts +4 -0
  12. package/dist/client/dispatcher.js +21 -0
  13. package/dist/client/health.d.ts +38 -0
  14. package/dist/{profile/client-health.js → client/health.js} +9 -6
  15. package/dist/client/index.d.ts +16 -0
  16. package/dist/client/index.js +20 -0
  17. package/dist/{profile/client-playbooks.d.ts → client/playbooks.d.ts} +1 -1
  18. package/dist/{profile/client-playbooks.js → client/playbooks.js} +1 -1
  19. package/dist/{profile/client-runs.d.ts → client/runs.d.ts} +4 -2
  20. package/dist/{profile/client-runs.js → client/runs.js} +7 -1
  21. package/dist/{profile/client-state.d.ts → client/state.d.ts} +1 -1
  22. package/dist/{profile/client-state.js → client/state.js} +1 -1
  23. package/dist/{profile/client-transport.d.ts → client/transport.d.ts} +29 -10
  24. package/dist/{profile/client-transport.js → client/transport.js} +125 -35
  25. package/dist/doctor/checks/index.d.ts +1 -1
  26. package/dist/doctor/checks/index.js +1 -1
  27. package/dist/doctor/checks/project.js +24 -92
  28. package/dist/doctor/checks/registry.js +1 -1
  29. package/dist/doctor/checks/runtime.d.ts +0 -4
  30. package/dist/doctor/checks/runtime.js +0 -28
  31. package/dist/doctor/doctor.js +1 -2
  32. package/dist/errors.d.ts +85 -4
  33. package/dist/errors.js +114 -4
  34. package/dist/execution/service.d.ts +55 -37
  35. package/dist/execution/service.js +601 -212
  36. package/dist/execution/types.d.ts +24 -5
  37. package/dist/host/host.d.ts +42 -22
  38. package/dist/host/host.js +565 -150
  39. package/dist/host/routing.js +6 -6
  40. package/dist/host/types.d.ts +25 -13
  41. package/dist/index.d.ts +9 -4
  42. package/dist/index.js +5 -2
  43. package/dist/input/advice.d.ts +0 -44
  44. package/dist/input/advice.js +7 -141
  45. package/dist/input/describe.d.ts +6 -0
  46. package/dist/input/describe.js +26 -1
  47. package/dist/input/flat-materializer.js +1 -1
  48. package/dist/input/flat-parser.js +1 -1
  49. package/dist/input/index.d.ts +0 -1
  50. package/dist/input/index.js +0 -1
  51. package/dist/input/input-resolver.js +2 -2
  52. package/dist/input/validation-mapper.d.ts +1 -1
  53. package/dist/invocation/policy.js +2 -0
  54. package/dist/ipc/diagnostic.d.ts +8 -21
  55. package/dist/ipc/diagnostic.js +24 -57
  56. package/dist/ipc/host.js +21 -7
  57. package/dist/ipc/service.d.ts +14 -0
  58. package/dist/ipc/service.js +132 -26
  59. package/dist/ipc/types.d.ts +0 -4
  60. package/dist/package/index.d.ts +4 -5
  61. package/dist/package/index.js +1 -2
  62. package/dist/package/runtime.d.ts +94 -23
  63. package/dist/package/runtime.js +628 -274
  64. package/dist/package/static-index.d.ts +3 -6
  65. package/dist/package/static-index.js +11 -40
  66. package/dist/package/types.d.ts +19 -4
  67. package/dist/platform/index.d.ts +2 -1
  68. package/dist/platform/index.js +2 -1
  69. package/dist/platform/loader-hook.d.ts +32 -0
  70. package/dist/platform/loader-hook.js +90 -0
  71. package/dist/{node → platform}/module-loader.d.ts +13 -0
  72. package/dist/{node → platform}/module-loader.js +51 -4
  73. package/dist/platform/node.d.ts +19 -8
  74. package/dist/platform/node.js +50 -20
  75. package/dist/platform/types.d.ts +7 -47
  76. package/dist/process/context-process.d.ts +3 -18
  77. package/dist/process/context-process.js +3 -44
  78. package/dist/process/control.d.ts +21 -0
  79. package/dist/process/control.js +34 -0
  80. package/dist/process/converters.d.ts +23 -0
  81. package/dist/process/converters.js +92 -0
  82. package/dist/process/cursor.js +2 -22
  83. package/dist/process/{diagnostics-sink.d.ts → diagnostics.d.ts} +0 -7
  84. package/dist/process/{diagnostics-sink.js → diagnostics.js} +6 -8
  85. package/dist/process/index.d.ts +1 -3
  86. package/dist/process/index.js +1 -3
  87. package/dist/process/input-dispatcher.d.ts +4 -13
  88. package/dist/process/input-dispatcher.js +48 -69
  89. package/dist/process/managed-record.d.ts +3 -31
  90. package/dist/process/metadata-store.d.ts +0 -41
  91. package/dist/process/metadata-store.js +2 -341
  92. package/dist/process/process-driver.js +2 -2
  93. package/dist/process/process-manager.d.ts +8 -50
  94. package/dist/process/process-manager.js +28 -417
  95. package/dist/process/quotas.d.ts +14 -0
  96. package/dist/process/quotas.js +29 -0
  97. package/dist/process/run-executor.js +0 -1
  98. package/dist/process/terminal-output-cache.d.ts +20 -34
  99. package/dist/process/terminal-output-cache.js +43 -64
  100. package/dist/profile/index.d.ts +1 -2
  101. package/dist/profile/index.js +1 -2
  102. package/dist/profile/manager.d.ts +2 -4
  103. package/dist/profile/manager.js +10 -40
  104. package/dist/profile/types.d.ts +1 -17
  105. package/dist/project/digest.d.ts +5 -1
  106. package/dist/project/digest.js +81 -219
  107. package/dist/project/index.d.ts +4 -5
  108. package/dist/project/index.js +4 -5
  109. package/dist/project/init.js +2 -2
  110. package/dist/project/loader.d.ts +3 -3
  111. package/dist/project/loader.js +72 -50
  112. package/dist/project/lockfile.js +6 -5
  113. package/dist/project/manifest.js +5 -4
  114. package/dist/project/transactions.d.ts +4 -42
  115. package/dist/project/transactions.js +83 -138
  116. package/dist/project/types-generator.js +2 -1
  117. package/dist/project/types.d.ts +2 -0
  118. package/dist/registry/index.d.ts +0 -1
  119. package/dist/registry/index.js +0 -1
  120. package/dist/registry/lock.d.ts +2 -11
  121. package/dist/registry/lock.js +14 -183
  122. package/dist/registry/registry.d.ts +1 -6
  123. package/dist/registry/registry.js +5 -17
  124. package/dist/runtime/action-registry.d.ts +1 -5
  125. package/dist/runtime/action-registry.js +0 -12
  126. package/dist/runtime/context.js +2 -2
  127. package/dist/runtime/events.d.ts +11 -50
  128. package/dist/runtime/events.js +88 -368
  129. package/dist/runtime/index.d.ts +0 -4
  130. package/dist/runtime/index.js +0 -4
  131. package/dist/runtime/run-persistence.d.ts +2 -0
  132. package/dist/runtime/run-persistence.js +2 -1
  133. package/dist/runtime/standalone-commands.d.ts +18 -0
  134. package/dist/runtime/standalone-commands.js +466 -0
  135. package/dist/runtime/standalone-help.d.ts +20 -0
  136. package/dist/runtime/standalone-help.js +72 -0
  137. package/dist/runtime/standalone.d.ts +1 -44
  138. package/dist/runtime/standalone.js +31 -526
  139. package/dist/schema/validator.d.ts +2 -2
  140. package/dist/schema/validator.js +2 -9
  141. package/dist/server/index.d.ts +0 -2
  142. package/dist/server/index.js +0 -2
  143. package/dist/server/routes/actions.js +1 -1
  144. package/dist/server/routes/info.js +1 -1
  145. package/dist/server/routes/playbooks.js +1 -1
  146. package/dist/server/routes/runs.js +123 -16
  147. package/dist/server/routes/state.js +43 -18
  148. package/dist/server/security.d.ts +1 -1
  149. package/dist/server/security.js +2 -2
  150. package/dist/server/server.js +3 -7
  151. package/dist/service/factory.js +4 -3
  152. package/dist/service/index.d.ts +1 -1
  153. package/dist/service/index.js +1 -1
  154. package/dist/service/remote-errors.d.ts +1 -1
  155. package/dist/service/remote-errors.js +6 -6
  156. package/dist/service/remote-polling.d.ts +3 -0
  157. package/dist/service/remote-polling.js +10 -5
  158. package/dist/service/remote.d.ts +5 -1
  159. package/dist/service/remote.js +108 -17
  160. package/dist/service/sse-stream.js +2 -2
  161. package/dist/service/types.d.ts +22 -19
  162. package/dist/service/types.js +1 -24
  163. package/dist/storage/clock.d.ts +1 -1
  164. package/dist/storage/clock.js +1 -1
  165. package/dist/storage/data-dir-lock.d.ts +10 -22
  166. package/dist/storage/data-dir-lock.js +28 -56
  167. package/dist/storage/file-lock.d.ts +64 -0
  168. package/dist/storage/file-lock.js +447 -0
  169. package/dist/storage/index.d.ts +2 -2
  170. package/dist/storage/index.js +5 -4
  171. package/dist/storage/run-liveness.d.ts +48 -0
  172. package/dist/storage/run-liveness.js +44 -0
  173. package/dist/storage/sqlite-config.d.ts +16 -0
  174. package/dist/storage/sqlite-config.js +59 -0
  175. package/dist/storage/sqlite-driver.d.ts +3 -1
  176. package/dist/storage/sqlite-driver.js +14 -4
  177. package/dist/storage/sqlite-events.d.ts +13 -0
  178. package/dist/storage/sqlite-events.js +48 -0
  179. package/dist/storage/sqlite-runs.d.ts +107 -0
  180. package/dist/storage/sqlite-runs.js +622 -0
  181. package/dist/storage/sqlite-schema.d.ts +5 -0
  182. package/dist/storage/sqlite-schema.js +143 -0
  183. package/dist/storage/sqlite-state.d.ts +33 -0
  184. package/dist/storage/sqlite-state.js +270 -0
  185. package/dist/storage/sqlite.d.ts +30 -57
  186. package/dist/storage/sqlite.js +84 -741
  187. package/dist/storage/types.d.ts +35 -2
  188. package/dist/utils/index.d.ts +18 -14
  189. package/dist/utils/index.js +37 -29
  190. package/dist/utils/semver.d.ts +18 -0
  191. package/dist/utils/semver.js +19 -0
  192. package/dist/utils/warning.d.ts +1 -0
  193. package/dist/utils/warning.js +52 -0
  194. package/dist/{json/value-validator.d.ts → value-validator.d.ts} +9 -0
  195. package/dist/value-validator.js +330 -0
  196. package/dist/version.d.ts +1 -1
  197. package/dist/version.js +1 -1
  198. package/package.json +10 -12
  199. package/dist/execution/index.d.ts +0 -2
  200. package/dist/execution/index.js +0 -2
  201. package/dist/filter/index.d.ts +0 -1
  202. package/dist/filter/index.js +0 -1
  203. package/dist/graph/index.d.ts +0 -4
  204. package/dist/graph/index.js +0 -4
  205. package/dist/input/metadata.d.ts +0 -99
  206. package/dist/input/metadata.js +0 -99
  207. package/dist/invocation/index.d.ts +0 -2
  208. package/dist/invocation/index.js +0 -2
  209. package/dist/ipc/index.d.ts +0 -4
  210. package/dist/ipc/index.js +0 -4
  211. package/dist/json/index.d.ts +0 -1
  212. package/dist/json/index.js +0 -1
  213. package/dist/json/value-validator.js +0 -330
  214. package/dist/node/index.d.ts +0 -1
  215. package/dist/node/index.js +0 -1
  216. package/dist/platform/node-fs.d.ts +0 -37
  217. package/dist/platform/node-fs.js +0 -81
  218. package/dist/process/control-arbiter.d.ts +0 -108
  219. package/dist/process/control-arbiter.js +0 -250
  220. package/dist/process/process-executor.d.ts +0 -47
  221. package/dist/process/process-executor.js +0 -296
  222. package/dist/profile/client-health.d.ts +0 -14
  223. package/dist/profile/client-query.d.ts +0 -30
  224. package/dist/profile/client-query.js +0 -69
  225. package/dist/profile/client.d.ts +0 -26
  226. package/dist/profile/client.js +0 -31
  227. package/dist/project/closure.d.ts +0 -25
  228. package/dist/project/closure.js +0 -74
  229. package/dist/registry/store.d.ts +0 -42
  230. package/dist/registry/store.js +0 -43
  231. package/dist/runtime/clock.d.ts +0 -7
  232. package/dist/runtime/clock.js +0 -7
  233. package/dist/runtime/module-loader.d.ts +0 -2
  234. package/dist/runtime/module-loader.js +0 -1
  235. package/dist/runtime/process.d.ts +0 -8
  236. package/dist/runtime/process.js +0 -1
  237. package/dist/runtime/runner.d.ts +0 -234
  238. package/dist/runtime/runner.js +0 -609
  239. package/dist/schema/index.d.ts +0 -1
  240. package/dist/schema/index.js +0 -1
  241. package/dist/server/dispatcher.d.ts +0 -25
  242. package/dist/server/dispatcher.js +0 -54
  243. package/dist/service/local.d.ts +0 -27
  244. package/dist/service/local.js +0 -141
  245. package/dist/storage/driver.d.ts +0 -10
  246. package/dist/storage/driver.js +0 -10
  247. package/dist/storage/lazy.d.ts +0 -8
  248. package/dist/storage/lazy.js +0 -45
  249. package/dist/storage/lock-core.d.ts +0 -158
  250. package/dist/storage/lock-core.js +0 -872
  251. package/dist/utils/net.d.ts +0 -10
  252. package/dist/utils/net.js +0 -16
  253. package/dist/utils/process.d.ts +0 -10
  254. package/dist/utils/process.js +0 -21
  255. /package/dist/{filter → utils}/intent.d.ts +0 -0
  256. /package/dist/{filter → utils}/intent.js +0 -0
@@ -1,13 +1,59 @@
1
- import { isLoopbackHost } from "../utils/net.js";
2
- import { normalizeServerUrl } from "./manager.js";
3
- import { getInsecureDispatcher } from "../server/dispatcher.js";
4
- import { ActionDockError, INSECURE_TRANSPORT, INVALID_ARGUMENT } from "../errors.js";
1
+ import { isLoopbackHost } from "../utils/index.js";
2
+ import { getInsecureDispatcher } from "./dispatcher.js";
3
+ import { ActionDockError, INSECURE_TRANSPORT, INVALID_ARGUMENT, NOT_FOUND, REMOTE_REQUEST_FAILED, UNAUTHORIZED } from "../errors.js";
4
+ /**
5
+ * 格式化并规范化 Server URL 地址(若未指定协议,本地回环地址默认使用 http://,非本地回环地址默认使用 https://,并移除末尾斜杠)。
6
+ */
7
+ export function normalizeServerUrl(url) {
8
+ let cleaned = url.trim().replace(/\/+$/, "");
9
+ if (!cleaned || cleaned === "local") {
10
+ return cleaned;
11
+ }
12
+ if (!/^https?:\/\//i.test(cleaned)) {
13
+ let hostname = cleaned;
14
+ const slashIdx = hostname.indexOf("/");
15
+ if (slashIdx !== -1) {
16
+ hostname = hostname.slice(0, slashIdx);
17
+ }
18
+ if (hostname.startsWith("[")) {
19
+ const endBracket = hostname.indexOf("]");
20
+ if (endBracket !== -1) {
21
+ hostname = hostname.slice(1, endBracket);
22
+ }
23
+ }
24
+ else {
25
+ const colonIdx = hostname.indexOf(":");
26
+ if (colonIdx !== -1) {
27
+ hostname = hostname.slice(0, colonIdx);
28
+ }
29
+ }
30
+ const isLoopback = isLoopbackHost(hostname);
31
+ cleaned = `${isLoopback ? "http" : "https"}://${cleaned}`;
32
+ }
33
+ return cleaned;
34
+ }
35
+ /**
36
+ * 脱敏 URL:移除 userinfo 凭据与查询串后再返回;仅保留协议、主机与路径。
37
+ */
38
+ function redactUrl(url) {
39
+ let candidate = url;
40
+ try {
41
+ const u = new URL(candidate);
42
+ u.username = "";
43
+ u.password = "";
44
+ u.search = "";
45
+ return u.toString();
46
+ }
47
+ catch {
48
+ candidate = candidate.replace(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)[^\/@]+@/, "$1");
49
+ return candidate.length > 128 ? `${candidate.slice(0, 128)}...` : candidate;
50
+ }
51
+ }
5
52
  /**
6
53
  * 校验在携带认证 Token 时传输层协议与目标地址是否安全。
7
54
  * 若请求携带认证 Token 且目标为非本地回环的明文 http://,默认报错拒绝。
8
55
  * 可通过 allowInsecureHttp 选项、insecure 选项、环境变量或命令行参数豁免明文限制。
9
- * 目标 URL 无法解析时无论豁免与否均 fail-closed 抛 INVALID_ARGUMENT,
10
- * 杜绝携凭据请求发往不可控的畸形地址。
56
+ * 目标 URL 无法解析时无论豁免与否均 fail-closed 抛 INVALID_ARGUMENT。
11
57
  */
12
58
  export function assertSecureTransport(serverUrl, token, options) {
13
59
  if (!token || !token.trim()) {
@@ -23,9 +69,6 @@ export function assertSecureTransport(serverUrl, token, options) {
23
69
  process.env?.ACTIONDOCK_INSECURE === "true" ||
24
70
  process.env?.ACTIONDOCK_INSECURE === "1"));
25
71
  const base = normalizeServerUrl(serverUrl);
26
- // 目标地址可解析性前置校验(fail-closed):携带 token 时若目标 URL 无法解析,
27
- // 严禁继续放行——后续请求会携凭据发往不可控的畸形目标。错误信息仅携带
28
- // 脱敏地址与解析原因。allow 豁免仅作用于明文传输策略,不豁免地址合法性。
29
72
  if (base.startsWith("http://") || base.startsWith("https://")) {
30
73
  let parsed;
31
74
  try {
@@ -35,31 +78,10 @@ export function assertSecureTransport(serverUrl, token, options) {
35
78
  const reason = err instanceof Error ? err.message : String(err);
36
79
  throw new ActionDockError(INVALID_ARGUMENT, `Invalid server URL '${redactUrl(base)}' with authentication token: URL parse failed (${reason}). Fix the profile server URL before sending credentials.`);
37
80
  }
38
- // 明文传输策略:仅非回环明文 http 需要豁免,https 不受限制
39
81
  if (!allow && base.startsWith("http://") && !isLoopbackHost(parsed.hostname)) {
40
82
  throw new ActionDockError(INSECURE_TRANSPORT, `Insecure HTTP connection with authentication token to non-loopback host '${parsed.hostname}' is prohibited. Use HTTPS or pass --allow-insecure-http to override.`);
41
83
  }
42
84
  }
43
- // 非 http/https 协议形态(如 local):交给后续请求层处理,此处无从校验
44
- }
45
- /**
46
- * 脱敏 URL:移除 userinfo 凭据与查询串后再返回;仅保留协议、主机与路径。
47
- */
48
- function redactUrl(url) {
49
- let candidate = url;
50
- try {
51
- const u = new URL(candidate);
52
- u.username = "";
53
- u.password = "";
54
- u.search = "";
55
- return u.toString();
56
- }
57
- catch {
58
- // 解析失败的畸形地址:以正则剥离 userinfo 形态后截断长度,
59
- // 避免原始串携带敏感片段外泄到错误信息与日志
60
- candidate = candidate.replace(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)[^\/@]+@/, "$1");
61
- return candidate.length > 128 ? `${candidate.slice(0, 128)}...` : candidate;
62
- }
63
85
  }
64
86
  /**
65
87
  * 构造携带鉴权信息的标准请求头。
@@ -75,10 +97,6 @@ export function buildHeaders(token) {
75
97
  }
76
98
  /**
77
99
  * 构建绑定传输上下文(Token、安全选项与调度器)的远端请求函数。
78
- *
79
- * 单一事实源收敛所有 fetchRemoteXxx 端点的传输样板:
80
- * 调用方仅需声明 path 与查询参数,鉴权头拼装、明文传输校验与
81
- * insecure dispatcher 注入均在此统一处理。
82
100
  */
83
101
  export function createRemoteFetch(serverUrl, token, options) {
84
102
  assertSecureTransport(serverUrl, token, {
@@ -115,9 +133,81 @@ export function createRemoteFetch(serverUrl, token, options) {
115
133
  };
116
134
  }
117
135
  /**
118
- * 远端请求单一入口:执行目标协议路由请求。
136
+ * 远端请求底层入口:执行目标协议路由请求。
119
137
  */
120
138
  export async function fetchRemoteRoute(base, path, init) {
121
139
  const normalizedPath = path.startsWith("/") ? path : `/${path}`;
122
140
  return fetch(`${base}${normalizedPath}`, init);
123
141
  }
142
+ /**
143
+ * 执行远端请求并将响应解析为 JSON,统一处理错误信封透传。
144
+ */
145
+ export async function fetchRemoteJson(serverUrl, path, token, options = {}) {
146
+ const remoteFetch = createRemoteFetch(serverUrl, token, {
147
+ allowInsecureHttp: options.allowInsecureHttp,
148
+ insecure: options.insecure,
149
+ dispatcher: options.dispatcher,
150
+ });
151
+ const res = await remoteFetch(path, {
152
+ method: options.method,
153
+ body: options.body,
154
+ signal: options.signal,
155
+ });
156
+ const data = (await res.json().catch(() => ({})));
157
+ if (!res.ok || (options.method === "POST" && data && data.ok === false)) {
158
+ const errorPrefix = options.errorPrefix || "Remote request failed";
159
+ const msg = data?.error?.message || `${errorPrefix} (${res.status}): ${res.statusText}`;
160
+ const code = data?.error?.code ||
161
+ (res.status === 404 ? NOT_FOUND : res.status === 401 ? UNAUTHORIZED : REMOTE_REQUEST_FAILED);
162
+ const details = data?.error?.details ?? data?.error;
163
+ const err = new ActionDockError(code, msg, details, res.status);
164
+ err.errorData = data?.error;
165
+ throw err;
166
+ }
167
+ return data;
168
+ }
169
+ /**
170
+ * 由可选参数字典构造查询串(无参数时返回空串)。
171
+ * 过滤 undefined 与空串。
172
+ */
173
+ export function buildQueryString(params) {
174
+ const search = new URLSearchParams();
175
+ for (const [key, value] of Object.entries(params)) {
176
+ if (value === undefined || value === "") {
177
+ continue;
178
+ }
179
+ if (Array.isArray(value)) {
180
+ for (const item of value) {
181
+ if (item !== undefined && item !== "") {
182
+ search.append(key, String(item));
183
+ }
184
+ }
185
+ continue;
186
+ }
187
+ search.set(key, String(value));
188
+ }
189
+ const qs = search.toString();
190
+ return qs ? `?${qs}` : "";
191
+ }
192
+ /**
193
+ * 构造保留空串语义的查询串:仅跳过 undefined,保留空串。
194
+ */
195
+ export function buildQueryStringPreservingEmpty(params) {
196
+ const search = new URLSearchParams();
197
+ for (const [key, value] of Object.entries(params)) {
198
+ if (value === undefined) {
199
+ continue;
200
+ }
201
+ if (Array.isArray(value)) {
202
+ for (const item of value) {
203
+ if (item !== undefined) {
204
+ search.append(key, String(item));
205
+ }
206
+ }
207
+ continue;
208
+ }
209
+ search.set(key, String(value));
210
+ }
211
+ const qs = search.toString();
212
+ return qs ? `?${qs}` : "";
213
+ }
@@ -1,4 +1,4 @@
1
- export { checkBunRuntime, checkCliExecutable, checkNodeRuntime } from "./runtime.js";
1
+ export { checkCliExecutable, checkNodeRuntime } from "./runtime.js";
2
2
  export { checkGlobalStorage } from "./storage.js";
3
3
  export { checkGlobalRegistry, checkLinkedPackageDependencies, checkUsesClosure, } from "./registry.js";
4
4
  export { locateProject } from "./project-locate.js";
@@ -1,4 +1,4 @@
1
- export { checkBunRuntime, checkCliExecutable, checkNodeRuntime } from "./runtime.js";
1
+ export { checkCliExecutable, checkNodeRuntime } from "./runtime.js";
2
2
  export { checkGlobalStorage } from "./storage.js";
3
3
  export { checkGlobalRegistry, checkLinkedPackageDependencies, checkUsesClosure, } from "./registry.js";
4
4
  export { locateProject } from "./project-locate.js";
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync, rmSync, statSync } from "node:fs";
1
+ import { accessSync, constants, existsSync } from "node:fs";
2
2
  import { dirname, join, relative } from "node:path";
3
3
  import { discoverActionFiles, loadActions, loadPlaybooks, loadProjectConfig } from "../../project/loader.js";
4
4
  import { loadManifest, MANIFEST_FILE_NAME } from "../../project/manifest.js";
@@ -45,22 +45,21 @@ function checkProjectSdk(scope) {
45
45
  }
46
46
  }
47
47
  /**
48
- * 检查工程运行时数据库可写性。
49
- *
50
- * 探测写入独立临时数据库文件,避免对生产运行库产生写副作用:
51
- * 体检是诊断行为,不得在真实库上执行写加删事务引入额外写竞争。
48
+ * 检查工程运行时数据库可写性(纯只读检查,无写副作用)。
52
49
  */
53
- async function checkProjectStorage(scope) {
50
+ function checkProjectStorage(scope) {
54
51
  const { ctx, config } = scope;
55
52
  const dbPath = resolveDatabasePath(config.id, { customHome: ctx.customHome });
56
53
  const probeDir = dirname(dbPath);
57
- // 探测库:与生产库同目录但独立命名,结束后整体删除,不留探测残留
58
- const probeId = `doctor.probe.${Date.now()}`;
59
- const probePkgDir = dirname(resolveDatabasePath(probeId, { customHome: ctx.customHome }));
60
- const probeStorage = createStorage(probeId, { customHome: ctx.customHome });
61
54
  try {
62
- await probeStorage.setConfig("probe", "ok");
63
- probeStorage.close();
55
+ let checkDir = probeDir;
56
+ while (!existsSync(checkDir)) {
57
+ const parent = dirname(checkDir);
58
+ if (parent === checkDir)
59
+ break;
60
+ checkDir = parent;
61
+ }
62
+ accessSync(checkDir, constants.W_OK);
64
63
  ctx.checks.push({
65
64
  id: "project.storage",
66
65
  category: "project",
@@ -70,10 +69,6 @@ async function checkProjectStorage(scope) {
70
69
  });
71
70
  }
72
71
  catch (err) {
73
- try {
74
- probeStorage.close();
75
- }
76
- catch { }
77
72
  ctx.checks.push({
78
73
  id: "project.storage",
79
74
  category: "project",
@@ -83,15 +78,6 @@ async function checkProjectStorage(scope) {
83
78
  fix: `Check write permissions for '${probeDir}'`,
84
79
  });
85
80
  }
86
- finally {
87
- // 清理探测库目录(含 WAL/SHM 侧车文件)
88
- try {
89
- if (existsSync(probePkgDir)) {
90
- rmSync(probePkgDir, { recursive: true, force: true });
91
- }
92
- }
93
- catch { }
94
- }
95
81
  }
96
82
  /**
97
83
  * 检查工程 Actions 可加载性与数量。
@@ -115,7 +101,7 @@ async function checkProjectActions(scope) {
115
101
  name: "Actions",
116
102
  status: "warn",
117
103
  message: `No actions found in '${config.actionsDir || "actions"}'`,
118
- fix: "Run 'ad action new <id>' to create your first action",
104
+ fix: "Run 'ad action create <id>' to create your first action",
119
105
  });
120
106
  }
121
107
  else {
@@ -155,7 +141,7 @@ function checkProjectManifest(scope) {
155
141
  name: "Action Manifest",
156
142
  status: "warn",
157
143
  message: `${MANIFEST_FILE_NAME} not found (${actionFiles.length} action source file(s) exist)`,
158
- fix: "Run 'ad validate' to generate or check manifest",
144
+ fix: "Run 'ad init' to initialize project manifest, or manually create 'actiondock.json'",
159
145
  });
160
146
  }
161
147
  }
@@ -174,7 +160,7 @@ function checkProjectManifest(scope) {
174
160
  name: "Action Manifest",
175
161
  status: "warn",
176
162
  message: `${missingFiles.length} action(s) in manifest point to missing files: ${missingFiles.join(", ")}`,
177
- fix: "Run 'ad validate' to check or update actiondock.json",
163
+ fix: "Update actiondock.json or use 'ad action create <id>'",
178
164
  });
179
165
  }
180
166
  else if (untracked.length > 0) {
@@ -184,30 +170,17 @@ function checkProjectManifest(scope) {
184
170
  name: "Action Manifest",
185
171
  status: "warn",
186
172
  message: `${untracked.length} action file(s) not declared in manifest: ${untracked.join(", ")}`,
187
- fix: "Run 'ad validate' to check or update actiondock.json",
173
+ fix: "Update actiondock.json or use 'ad action create <id>'",
188
174
  });
189
175
  }
190
176
  else {
191
- const manifestStat = statSync(manifestPath);
192
- const newerFiles = actionFiles.filter((f) => statSync(f).mtimeMs > manifestStat.mtimeMs + 2000);
193
- if (newerFiles.length > 0) {
194
- ctx.checks.push({
195
- id: "project.manifest",
196
- category: "project",
197
- name: "Action Manifest",
198
- status: "ok",
199
- message: `Manifest valid (Note: ${newerFiles.length} action file(s) modified after manifest; run 'ad validate' if definitions changed)`,
200
- });
201
- }
202
- else {
203
- ctx.checks.push({
204
- id: "project.manifest",
205
- category: "project",
206
- name: "Action Manifest",
207
- status: "ok",
208
- message: "Manifest synchronized with action files",
209
- });
210
- }
177
+ ctx.checks.push({
178
+ id: "project.manifest",
179
+ category: "project",
180
+ name: "Action Manifest",
181
+ status: "ok",
182
+ message: "Manifest synchronized with action files",
183
+ });
211
184
  }
212
185
  }
213
186
  }
@@ -222,14 +195,12 @@ function checkProjectManifest(scope) {
222
195
  }
223
196
  }
224
197
  /**
225
- * 检查 files 声明边界与源码目录未声明引用。
198
+ * 检查 files 声明边界。
226
199
  */
227
200
  function checkProjectFiles(scope) {
228
201
  const { ctx, projectRoot, config } = scope;
229
202
  try {
230
203
  const declaredFiles = config.files || [];
231
- const hasSrc = existsSync(join(projectRoot, "src"));
232
- const hasLib = existsSync(join(projectRoot, "lib"));
233
204
  if (declaredFiles.length > 0) {
234
205
  const missingDeclared = declaredFiles.filter((f) => !existsSync(join(projectRoot, f)));
235
206
  if (missingDeclared.length > 0) {
@@ -252,45 +223,6 @@ function checkProjectFiles(scope) {
252
223
  });
253
224
  }
254
225
  }
255
- else if (hasSrc || hasLib) {
256
- const actionFiles = discoverActionFiles(projectRoot, config.actionsDir || "actions");
257
- let hasReferenceToSrcOrLib = false;
258
- const unreadableFiles = [];
259
- for (const actFile of actionFiles) {
260
- try {
261
- const src = readFileSync(actFile, "utf-8");
262
- if (/['"](?:\.\.\/(?:src|lib)|\.\/(?:src|lib))[^'"]*['"]/.test(src)) {
263
- hasReferenceToSrcOrLib = true;
264
- break;
265
- }
266
- }
267
- catch (err) {
268
- // 单文件读取失败:计入告警名单,边界检测结论不再基于无声缺失的数据
269
- unreadableFiles.push(`${actFile} (${err?.message || String(err)})`);
270
- }
271
- }
272
- if (hasReferenceToSrcOrLib) {
273
- ctx.checks.push({
274
- id: "project.files",
275
- category: "project",
276
- name: "Declared Files",
277
- status: "error",
278
- message: `Actions import modules from ${hasSrc ? "'src/'" : ""}${hasSrc && hasLib ? " and " : ""}${hasLib ? "'lib/'" : ""}, but 'files' is not declared in ${MANIFEST_FILE_NAME}`,
279
- fix: `Add "files": [${hasSrc ? '"src"' : ""}${hasSrc && hasLib ? ', "lib"' : hasLib && !hasSrc ? '"lib"' : ""}] to ${MANIFEST_FILE_NAME}`,
280
- });
281
- }
282
- else {
283
- ctx.checks.push({
284
- id: "project.files",
285
- category: "project",
286
- name: "Declared Files",
287
- status: unreadableFiles.length > 0 ? "warn" : "ok",
288
- message: unreadableFiles.length > 0
289
- ? `Project source directories clean, but ${unreadableFiles.length} action file(s) unreadable during boundary scan: ${unreadableFiles.join(", ")}`
290
- : `Project source directories clean (no undeclared references to ${hasSrc ? "src/" : "lib/"})`,
291
- });
292
- }
293
- }
294
226
  }
295
227
  catch (err) {
296
228
  // 文件边界检测整体失败:转为 error 检查项呈现在报告中,而非无声跳过
@@ -299,7 +231,7 @@ function checkProjectFiles(scope) {
299
231
  category: "project",
300
232
  name: "Declared Files",
301
233
  status: "error",
302
- message: `Failed to inspect declared files and source boundaries: ${err?.message || String(err)}`,
234
+ message: `Failed to inspect declared files: ${err?.message || String(err)}`,
303
235
  });
304
236
  }
305
237
  }
@@ -88,7 +88,7 @@ export const checkLinkedPackageDependencies = {
88
88
  name: "Linked Package Dependencies",
89
89
  status: "warn",
90
90
  message: `${missingNodeModules.length} linked package(s) declare dependencies but miss node_modules: ${missingNodeModules.join(", ")}`,
91
- fix: "Run 'npm install' in the affected package directories, or execute 'ad run' to auto-install",
91
+ fix: "Run 'npm install --omit=dev' in the affected package directories",
92
92
  });
93
93
  }
94
94
  else {
@@ -3,10 +3,6 @@ import type { DoctorCheck } from "../context.js";
3
3
  * 检查 Node.js 运行时版本是否满足最低要求(>= 24.12.0)。
4
4
  */
5
5
  export declare const checkNodeRuntime: DoctorCheck;
6
- /**
7
- * 检查 Bun 运行时可用性(可选环境,用于跨运行时兼容性测试)。
8
- */
9
- export declare const checkBunRuntime: DoctorCheck;
10
6
  /**
11
7
  * 检查 CLI 可执行文件(ad)是否在 PATH 中。
12
8
  */
@@ -65,34 +65,6 @@ export const checkNodeRuntime = {
65
65
  }
66
66
  },
67
67
  };
68
- /**
69
- * 检查 Bun 运行时可用性(可选环境,用于跨运行时兼容性测试)。
70
- */
71
- export const checkBunRuntime = {
72
- id: "runtime.bun",
73
- run: (ctx) => {
74
- const bunVersion = (typeof globalThis.Bun !== "undefined" && globalThis.Bun.version) ||
75
- process.versions.bun;
76
- if (bunVersion) {
77
- ctx.checks.push({
78
- id: "runtime.bun",
79
- category: "runtime",
80
- name: "Bun Runtime",
81
- status: "ok",
82
- message: `v${bunVersion} (available for cross-environment testing)`,
83
- });
84
- }
85
- else {
86
- ctx.checks.push({
87
- id: "runtime.bun",
88
- category: "runtime",
89
- name: "Bun Runtime",
90
- status: "ok",
91
- message: "Bun runtime not detected (optional, used for cross-environment compatibility testing)",
92
- });
93
- }
94
- },
95
- };
96
68
  /**
97
69
  * 检查 CLI 可执行文件(ad)是否在 PATH 中。
98
70
  */
@@ -1,12 +1,11 @@
1
1
  import { createDoctorCheckContext } from "./context.js";
2
- import { checkBunRuntime, checkCliExecutable, checkGlobalRegistry, checkGlobalStorage, checkLinkedPackageDependencies, checkNodeRuntime, checkProject, checkUsesClosure, locateProject, } from "./checks/index.js";
2
+ import { checkCliExecutable, checkGlobalRegistry, checkGlobalStorage, checkLinkedPackageDependencies, checkNodeRuntime, checkProject, checkUsesClosure, locateProject, } from "./checks/index.js";
3
3
  /**
4
4
  * 检查注册表:按诊断执行顺序排列的检查阶段。
5
5
  * 运行时 → 存储 → 注册表 → 工程定位 → 工程级详情,与报告展示顺序一一对应。
6
6
  */
7
7
  const doctorCheckRegistry = [
8
8
  checkNodeRuntime,
9
- checkBunRuntime,
10
9
  checkCliExecutable,
11
10
  checkGlobalStorage,
12
11
  checkGlobalRegistry,
package/dist/errors.d.ts CHANGED
@@ -75,8 +75,6 @@ export declare const STORAGE_BUSY = "STORAGE_BUSY";
75
75
  export declare const PROJECT_BUSY = "PROJECT_BUSY";
76
76
  /** 工程存在未恢复的崩溃事务,需要执行恢复流程 */
77
77
  export declare const PROJECT_RECOVERY_REQUIRED = "PROJECT_RECOVERY_REQUIRED";
78
- /** SQLite 工作线程已退出 */
79
- export declare const STORAGE_WORKER_EXITED = "STORAGE_WORKER_EXITED";
80
78
  /** 事件订阅队列积压超过背压上限 */
81
79
  export declare const EVENT_BACKPRESSURE_LIMIT = "EVENT_BACKPRESSURE_LIMIT";
82
80
  export declare const EVENT_CURSOR_EXPIRED = "EVENT_CURSOR_EXPIRED";
@@ -254,6 +252,58 @@ export declare const AMBIGUOUS_STATE_KEY = "AMBIGUOUS_STATE_KEY";
254
252
  export declare const RUN_NOT_FOUND = "RUN_NOT_FOUND";
255
253
  /** 目标运行已进入终态不可操作 */
256
254
  export declare const RUN_ALREADY_FINISHED = "RUN_ALREADY_FINISHED";
255
+ /** 目标环境配置 Profile 未找到 */
256
+ export declare const PROFILE_NOT_FOUND = "PROFILE_NOT_FOUND";
257
+ /** 锁文件读取失败 */
258
+ export declare const LOCKFILE_READ_FAILED = "LOCKFILE_READ_FAILED";
259
+ /** 锁文件内容损坏或存在重复键 */
260
+ export declare const LOCKFILE_CORRUPTED = "LOCKFILE_CORRUPTED";
261
+ /** 锁文件结构或格式非法 */
262
+ export declare const LOCKFILE_INVALID = "LOCKFILE_INVALID";
263
+ /** 不受支持的锁文件版本 */
264
+ export declare const UNSUPPORTED_LOCKFILE_VERSION = "UNSUPPORTED_LOCKFILE_VERSION";
265
+ /** 项目清单读取失败 */
266
+ export declare const MANIFEST_READ_FAILED = "MANIFEST_READ_FAILED";
267
+ /** 项目清单 JSON 解析失败或内容损坏 */
268
+ export declare const MANIFEST_CORRUPTED = "MANIFEST_CORRUPTED";
269
+ /** 项目清单结构或格式非法 */
270
+ export declare const MANIFEST_INVALID = "MANIFEST_INVALID";
271
+ /** 不受支持的项目清单 Schema 版本 */
272
+ export declare const UNSUPPORTED_MANIFEST_SCHEMA = "UNSUPPORTED_MANIFEST_SCHEMA";
273
+ /** 项目清单文件 actiondock.json 未找到 */
274
+ export declare const MANIFEST_NOT_FOUND = "MANIFEST_NOT_FOUND";
275
+ /** 清单确定性摘要与锁文件记录不一致 */
276
+ export declare const MANIFEST_DIGEST_MISMATCH = "MANIFEST_DIGEST_MISMATCH";
277
+ /** 全局注册表文件损坏或格式非法 */
278
+ export declare const REGISTRY_CORRUPTED = "REGISTRY_CORRUPTED";
279
+ /** 底层 SQLite 存储不支持异步事务 */
280
+ export declare const ASYNC_TRANSACTION_UNSUPPORTED = "ASYNC_TRANSACTION_UNSUPPORTED";
281
+ /** 底层存储或数据库连接已关闭 */
282
+ export declare const STORAGE_CLOSED = "STORAGE_CLOSED";
283
+ /** 多个不同物理路径声明了相同的包标识冲突 */
284
+ export declare const PACKAGE_ID_CONFLICT = "PACKAGE_ID_CONFLICT";
285
+ /** 路径参数非法(含空字节或非字符串) */
286
+ export declare const INVALID_PATH = "INVALID_PATH";
287
+ /** 存储数据目录初始化失败 */
288
+ export declare const STORAGE_INIT_FAILED = "STORAGE_INIT_FAILED";
289
+ /** 对象处于非法状态或缺少必要内部资源 */
290
+ export declare const INVALID_STATE = "INVALID_STATE";
291
+ /** 目标进程未找到或不存在 */
292
+ export declare const PROCESS_NOT_FOUND = "PROCESS_NOT_FOUND";
293
+ /** 模块标识符解析失败 */
294
+ export declare const MODULE_RESOLVE_FAILED = "MODULE_RESOLVE_FAILED";
295
+ /** 执行并发达到上限 */
296
+ export declare const EXECUTION_CONCURRENCY_LIMIT = "EXECUTION_CONCURRENCY_LIMIT";
297
+ /** 项目配置文件 actiondock.json 未找到 */
298
+ export declare const PROJECT_CONFIG_NOT_FOUND = "PROJECT_CONFIG_NOT_FOUND";
299
+ /** 项目清单加载失败 */
300
+ export declare const MANIFEST_LOAD_FAILED = "MANIFEST_LOAD_FAILED";
301
+ /** 动作标识符不符合命名规范 */
302
+ export declare const INVALID_ACTION_ID = "INVALID_ACTION_ID";
303
+ /** 规程标识符不符合命名规范 */
304
+ export declare const INVALID_PLAYBOOK_ID = "INVALID_PLAYBOOK_ID";
305
+ /** 项目根目录未找到或不是合法的 ActionDock 包 */
306
+ export declare const PROJECT_ROOT_NOT_FOUND = "PROJECT_ROOT_NOT_FOUND";
257
307
  /**
258
308
  * ActionDock 统一基础结构化异常类。
259
309
  * 全仓各领域异常与跨层透传异常的统一事实源基类。
@@ -262,12 +312,43 @@ export declare class ActionDockError<T = any> extends Error {
262
312
  readonly code: ErrorCode;
263
313
  readonly details?: T;
264
314
  readonly status?: number;
265
- constructor(code: ErrorCode, message: string, details?: T, status?: number);
315
+ readonly hint?: string;
316
+ constructor(code: ErrorCode, message: string, details?: T, status?: number, hint?: string);
266
317
  }
318
+ /**
319
+ * 结构化机器错误信封。
320
+ */
321
+ export interface ErrorEnvelope {
322
+ ok: false;
323
+ error: {
324
+ code: string;
325
+ message: string;
326
+ details?: unknown;
327
+ };
328
+ hint?: string;
329
+ meta?: Record<string, unknown>;
330
+ }
331
+ /**
332
+ * 统一构造机器错误信封。
333
+ */
334
+ export declare function createErrorEnvelope(code: string, message: string, details?: unknown, meta?: Record<string, unknown>, hint?: string): ErrorEnvelope;
335
+ /**
336
+ * 根据 Action 执行失败错误解析自愈指引提示文案。
337
+ *
338
+ * 作为 CLI 与独立分发器(StandaloneDispatcher)执行失败时提示解析的单一事实源。
339
+ *
340
+ * @param targetRef 目标 Action 引用标识(如 "greet" 或 "pkg/greet")
341
+ * @param error 执行失败错误对象
342
+ */
343
+ export declare function resolveExecutionHint(targetRef: string, error?: {
344
+ code?: string;
345
+ details?: unknown;
346
+ hint?: string;
347
+ }): string | undefined;
267
348
  /**
268
349
  * 集中定义的标准结构化错误码联合类型。
269
350
  */
270
- export type ErrorCode = typeof PACKAGE_NOT_FOUND | typeof ACTION_PACKAGE_VERSION_CONFLICT | typeof ACTION_NOT_FOUND | typeof ACTION_LOAD_FAILED | typeof ACTION_FAILED | typeof ACTION_TIMEOUT | typeof ACTION_CANCELLED | typeof INPUT_VALIDATION_FAILED | typeof OUTPUT_VALIDATION_FAILED | typeof INPUT_NOT_JSON | typeof OUTPUT_NOT_JSON | typeof ACTION_SUBRUN_LIMIT | typeof ACTION_CALL_CYCLE | typeof UNDECLARED_ACTION_DEPENDENCY | typeof INVALID_ACTION_REF | typeof IDEMPOTENCY_CONFLICT | typeof EXECUTION_FAILED | typeof UNHANDLED_EXECUTION_ERROR | typeof RUN_REPOSITORY_UNAVAILABLE | typeof RUN_PERSISTENCE_FAILED | typeof STANDALONE_ASYNC_UNSUPPORTED | typeof INVOCATION_UNSUPPORTED | typeof HOST_PROCESS_EXITED | typeof EXECUTION_ABORTED | typeof TIMEOUT | typeof SERVICE_CLOSED | typeof NETWORK_ERROR | typeof INSECURE_TRANSPORT | typeof REMOTE_REQUEST_FAILED | typeof REMOTE_STREAM_UNAVAILABLE | typeof CAPABILITY_UNAVAILABLE | typeof STATE_KEY_NOT_FOUND | typeof STORAGE_BUSY | typeof PROJECT_BUSY | typeof PROJECT_RECOVERY_REQUIRED | typeof STORAGE_WORKER_EXITED | typeof EVENT_BACKPRESSURE_LIMIT | typeof EVENT_CURSOR_EXPIRED | typeof PROCESS_OUTPUT_LIMIT | typeof PROCESS_SPAWN_ERROR | typeof PROCESS_CANCELLED | typeof PROCESS_TIMEOUT | typeof UNAUTHORIZED | typeof NOT_FOUND | typeof SERVER_ERROR | typeof BAD_REQUEST | typeof PACKAGE_FORBIDDEN | typeof ACTION_FORBIDDEN | typeof PLAYBOOK_NOT_FOUND | typeof REQUEST_TOO_LARGE | typeof ACTION_START_FAILED | typeof ACTION_EXECUTION_ERROR | typeof ACTIONS_LIST_ERROR | typeof PLAYBOOKS_LIST_ERROR | typeof RUNS_LIST_ERROR | typeof RUNS_CLEAR_ERROR | typeof INFO_ERROR | typeof PACKAGES_INFO_ERROR | typeof DOCTOR_ERROR | typeof RUN_INTERRUPTED | typeof CONFIG_ENV_ERROR | typeof CONFIG_LIST_ERROR | typeof CONFIG_SET_ERROR | typeof CONFIG_DELETE_ERROR | typeof STATE_LIST_ERROR | typeof STATE_CLEAR_ERROR | typeof STATE_KEY_ERROR | typeof DATA_DIR_IN_USE | typeof DATA_DIR_RECOVERY_REQUIRED | typeof UNSUPPORTED_STORAGE_SCHEMA | typeof STORED_ERROR_DECODE_FAILED | typeof PROCESS_FAILED | typeof GENERATED_TYPES_OUTDATED | typeof PROTOCOL_UNSUPPORTED | typeof SERVICE_RESULT_UNKNOWN | typeof MCP_TOOL_NAME_COLLISION | typeof ACCESS_DENIED | typeof UNSUPPORTED_CAPABILITY | typeof CONTROL_BUSY | typeof CONTROL_EXPIRED | typeof CONTROL_REVOKED | typeof PROCESS_QUARANTINED | typeof PROCESS_LOST | typeof REQUEST_CONFLICT | typeof INPUT_OUTCOME_UNKNOWN | typeof OUTPUT_GAP | typeof OUTPUT_UNAVAILABLE | typeof INVALID_CURSOR | typeof QUEUE_FULL | typeof QUOTA_EXCEEDED | typeof INPUT_CLOSED | typeof INVALID_FLAT_ARGUMENT | typeof INVALID_JSON | typeof INVALID_JSON_LITERAL | typeof INPUT_PATH_CONFLICT | typeof FLAT_INPUT_LIMIT_EXCEEDED | typeof INPUT_LIMIT_EXCEEDED | typeof INPUT_POLICY_VIOLATION | typeof INPUT_CONFLICT | typeof INPUT_FILE_NOT_FOUND | typeof INPUT_FILE_READ_FAILED | typeof INVALID_ARGUMENT | typeof PACKAGE_NOT_ALLOWED | typeof INVALID_PACKAGE_ID | typeof PATH_TRAVERSAL | typeof AMBIGUOUS_STATE_KEY | typeof RUN_NOT_FOUND | typeof RUN_ALREADY_FINISHED | typeof IPC_ERROR | typeof SERVICE_ERROR;
351
+ export type ErrorCode = typeof PACKAGE_NOT_FOUND | typeof ACTION_PACKAGE_VERSION_CONFLICT | typeof ACTION_NOT_FOUND | typeof ACTION_LOAD_FAILED | typeof ACTION_FAILED | typeof ACTION_TIMEOUT | typeof ACTION_CANCELLED | typeof INPUT_VALIDATION_FAILED | typeof OUTPUT_VALIDATION_FAILED | typeof INPUT_NOT_JSON | typeof OUTPUT_NOT_JSON | typeof ACTION_SUBRUN_LIMIT | typeof ACTION_CALL_CYCLE | typeof UNDECLARED_ACTION_DEPENDENCY | typeof INVALID_ACTION_REF | typeof IDEMPOTENCY_CONFLICT | typeof EXECUTION_FAILED | typeof UNHANDLED_EXECUTION_ERROR | typeof RUN_REPOSITORY_UNAVAILABLE | typeof RUN_PERSISTENCE_FAILED | typeof STANDALONE_ASYNC_UNSUPPORTED | typeof INVOCATION_UNSUPPORTED | typeof HOST_PROCESS_EXITED | typeof EXECUTION_ABORTED | typeof TIMEOUT | typeof SERVICE_CLOSED | typeof NETWORK_ERROR | typeof INSECURE_TRANSPORT | typeof REMOTE_REQUEST_FAILED | typeof REMOTE_STREAM_UNAVAILABLE | typeof CAPABILITY_UNAVAILABLE | typeof STATE_KEY_NOT_FOUND | typeof STORAGE_BUSY | typeof PROJECT_BUSY | typeof PROJECT_RECOVERY_REQUIRED | typeof EVENT_BACKPRESSURE_LIMIT | typeof EVENT_CURSOR_EXPIRED | typeof PROCESS_OUTPUT_LIMIT | typeof PROCESS_SPAWN_ERROR | typeof PROCESS_CANCELLED | typeof PROCESS_TIMEOUT | typeof UNAUTHORIZED | typeof NOT_FOUND | typeof SERVER_ERROR | typeof BAD_REQUEST | typeof PACKAGE_FORBIDDEN | typeof ACTION_FORBIDDEN | typeof PLAYBOOK_NOT_FOUND | typeof REQUEST_TOO_LARGE | typeof ACTION_START_FAILED | typeof ACTION_EXECUTION_ERROR | typeof ACTIONS_LIST_ERROR | typeof PLAYBOOKS_LIST_ERROR | typeof RUNS_LIST_ERROR | typeof RUNS_CLEAR_ERROR | typeof INFO_ERROR | typeof PACKAGES_INFO_ERROR | typeof DOCTOR_ERROR | typeof RUN_INTERRUPTED | typeof CONFIG_ENV_ERROR | typeof CONFIG_LIST_ERROR | typeof CONFIG_SET_ERROR | typeof CONFIG_DELETE_ERROR | typeof STATE_LIST_ERROR | typeof STATE_CLEAR_ERROR | typeof STATE_KEY_ERROR | typeof DATA_DIR_IN_USE | typeof DATA_DIR_RECOVERY_REQUIRED | typeof UNSUPPORTED_STORAGE_SCHEMA | typeof STORED_ERROR_DECODE_FAILED | typeof PROCESS_FAILED | typeof GENERATED_TYPES_OUTDATED | typeof PROTOCOL_UNSUPPORTED | typeof SERVICE_RESULT_UNKNOWN | typeof MCP_TOOL_NAME_COLLISION | typeof ACCESS_DENIED | typeof UNSUPPORTED_CAPABILITY | typeof CONTROL_BUSY | typeof CONTROL_EXPIRED | typeof CONTROL_REVOKED | typeof PROCESS_QUARANTINED | typeof PROCESS_LOST | typeof REQUEST_CONFLICT | typeof INPUT_OUTCOME_UNKNOWN | typeof OUTPUT_GAP | typeof OUTPUT_UNAVAILABLE | typeof INVALID_CURSOR | typeof QUEUE_FULL | typeof QUOTA_EXCEEDED | typeof INPUT_CLOSED | typeof INVALID_FLAT_ARGUMENT | typeof INVALID_JSON | typeof INVALID_JSON_LITERAL | typeof INPUT_PATH_CONFLICT | typeof FLAT_INPUT_LIMIT_EXCEEDED | typeof INPUT_LIMIT_EXCEEDED | typeof INPUT_POLICY_VIOLATION | typeof INPUT_CONFLICT | typeof INPUT_FILE_NOT_FOUND | typeof INPUT_FILE_READ_FAILED | typeof INVALID_ARGUMENT | typeof PACKAGE_NOT_ALLOWED | typeof INVALID_PACKAGE_ID | typeof PATH_TRAVERSAL | typeof AMBIGUOUS_STATE_KEY | typeof RUN_NOT_FOUND | typeof RUN_ALREADY_FINISHED | typeof IPC_ERROR | typeof SERVICE_ERROR | typeof PROFILE_NOT_FOUND | typeof LOCKFILE_READ_FAILED | typeof LOCKFILE_CORRUPTED | typeof LOCKFILE_INVALID | typeof UNSUPPORTED_LOCKFILE_VERSION | typeof MANIFEST_READ_FAILED | typeof MANIFEST_CORRUPTED | typeof MANIFEST_INVALID | typeof UNSUPPORTED_MANIFEST_SCHEMA | typeof MANIFEST_NOT_FOUND | typeof MANIFEST_DIGEST_MISMATCH | typeof REGISTRY_CORRUPTED | typeof ASYNC_TRANSACTION_UNSUPPORTED | typeof STORAGE_CLOSED | typeof PACKAGE_ID_CONFLICT | typeof INVALID_PATH | typeof STORAGE_INIT_FAILED | typeof INVALID_STATE | typeof PROCESS_NOT_FOUND | typeof MODULE_RESOLVE_FAILED | typeof EXECUTION_CONCURRENCY_LIMIT | typeof PROJECT_CONFIG_NOT_FOUND | typeof MANIFEST_LOAD_FAILED | typeof INVALID_ACTION_ID | typeof INVALID_PLAYBOOK_ID | typeof PROJECT_ROOT_NOT_FOUND;
271
352
  /** 全仓统一错误码类型别名 */
272
353
  export type ActionDockErrorCode = ErrorCode;
273
354
  /**