@actiondock/core 2.10.0 → 2.12.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 +1 -2
- package/dist/catalog/action-catalog.js +3 -33
- package/dist/catalog/discovery.d.ts +0 -3
- package/dist/catalog/discovery.js +4 -4
- package/dist/catalog/graph.d.ts +0 -4
- package/dist/catalog/graph.js +8 -14
- package/dist/{profile/client-actions.d.ts → client/actions.d.ts} +1 -1
- package/dist/{profile/client-actions.js → client/actions.js} +2 -8
- package/dist/{profile/client-config.d.ts → client/config.d.ts} +1 -1
- package/dist/{profile/client-config.js → client/config.js} +1 -1
- package/dist/client/dispatcher.d.ts +4 -0
- package/dist/client/dispatcher.js +21 -0
- package/dist/client/health.d.ts +38 -0
- package/dist/{profile/client-health.js → client/health.js} +9 -6
- package/dist/client/index.d.ts +16 -0
- package/dist/client/index.js +20 -0
- package/dist/{profile/client-playbooks.d.ts → client/playbooks.d.ts} +1 -1
- package/dist/{profile/client-playbooks.js → client/playbooks.js} +1 -1
- package/dist/{profile/client-runs.d.ts → client/runs.d.ts} +4 -2
- package/dist/{profile/client-runs.js → client/runs.js} +7 -1
- package/dist/{profile/client-state.d.ts → client/state.d.ts} +1 -1
- package/dist/{profile/client-state.js → client/state.js} +1 -1
- package/dist/{profile/client-transport.d.ts → client/transport.d.ts} +29 -10
- package/dist/{profile/client-transport.js → client/transport.js} +125 -35
- package/dist/doctor/checks/index.d.ts +1 -1
- package/dist/doctor/checks/index.js +1 -1
- package/dist/doctor/checks/project.js +20 -88
- package/dist/doctor/checks/runtime.d.ts +0 -4
- package/dist/doctor/checks/runtime.js +0 -28
- package/dist/doctor/doctor.js +1 -2
- package/dist/errors.d.ts +53 -3
- package/dist/errors.js +53 -3
- package/dist/execution/service.d.ts +55 -37
- package/dist/execution/service.js +601 -212
- package/dist/execution/types.d.ts +24 -5
- package/dist/host/host.d.ts +42 -22
- package/dist/host/host.js +562 -149
- package/dist/host/routing.js +6 -6
- package/dist/host/types.d.ts +25 -13
- package/dist/index.d.ts +9 -4
- package/dist/index.js +5 -2
- package/dist/input/advice.d.ts +0 -44
- package/dist/input/advice.js +7 -141
- package/dist/input/flat-materializer.js +1 -1
- package/dist/input/flat-parser.js +1 -1
- package/dist/input/index.d.ts +0 -1
- package/dist/input/index.js +0 -1
- package/dist/input/input-resolver.js +1 -1
- package/dist/input/validation-mapper.d.ts +1 -1
- package/dist/ipc/diagnostic.d.ts +8 -21
- package/dist/ipc/diagnostic.js +24 -57
- package/dist/ipc/host.js +21 -7
- package/dist/ipc/service.d.ts +14 -0
- package/dist/ipc/service.js +132 -26
- package/dist/ipc/types.d.ts +0 -4
- package/dist/package/index.d.ts +4 -5
- package/dist/package/index.js +1 -2
- package/dist/package/runtime.d.ts +94 -23
- package/dist/package/runtime.js +628 -274
- package/dist/package/static-index.d.ts +3 -6
- package/dist/package/static-index.js +11 -40
- package/dist/package/types.d.ts +19 -4
- package/dist/platform/index.d.ts +2 -1
- package/dist/platform/index.js +2 -1
- package/dist/platform/loader-hook.d.ts +32 -0
- package/dist/platform/loader-hook.js +90 -0
- package/dist/{node → platform}/module-loader.d.ts +13 -0
- package/dist/{node → platform}/module-loader.js +51 -4
- package/dist/platform/node.d.ts +19 -8
- package/dist/platform/node.js +50 -20
- package/dist/platform/types.d.ts +7 -47
- package/dist/process/context-process.d.ts +3 -18
- package/dist/process/context-process.js +3 -44
- package/dist/process/control.d.ts +21 -0
- package/dist/process/control.js +34 -0
- package/dist/process/converters.d.ts +23 -0
- package/dist/process/converters.js +92 -0
- package/dist/process/cursor.js +2 -22
- package/dist/process/{diagnostics-sink.d.ts → diagnostics.d.ts} +0 -7
- package/dist/process/{diagnostics-sink.js → diagnostics.js} +6 -8
- package/dist/process/index.d.ts +1 -3
- package/dist/process/index.js +1 -3
- package/dist/process/input-dispatcher.d.ts +4 -13
- package/dist/process/input-dispatcher.js +48 -69
- package/dist/process/managed-record.d.ts +3 -31
- package/dist/process/metadata-store.d.ts +0 -41
- package/dist/process/metadata-store.js +2 -341
- package/dist/process/process-driver.js +2 -2
- package/dist/process/process-manager.d.ts +8 -50
- package/dist/process/process-manager.js +28 -417
- package/dist/process/quotas.d.ts +14 -0
- package/dist/process/quotas.js +29 -0
- package/dist/process/run-executor.js +0 -1
- package/dist/process/terminal-output-cache.d.ts +20 -34
- package/dist/process/terminal-output-cache.js +43 -64
- package/dist/profile/index.d.ts +1 -2
- package/dist/profile/index.js +1 -2
- package/dist/profile/manager.d.ts +2 -4
- package/dist/profile/manager.js +10 -40
- package/dist/profile/types.d.ts +1 -17
- package/dist/project/digest.d.ts +5 -1
- package/dist/project/digest.js +81 -219
- package/dist/project/index.d.ts +4 -5
- package/dist/project/index.js +4 -5
- package/dist/project/init.js +2 -2
- package/dist/project/loader.d.ts +3 -3
- package/dist/project/loader.js +72 -50
- package/dist/project/lockfile.js +6 -5
- package/dist/project/manifest.js +5 -4
- package/dist/project/transactions.d.ts +4 -42
- package/dist/project/transactions.js +83 -138
- package/dist/project/types-generator.js +2 -1
- package/dist/project/types.d.ts +2 -0
- package/dist/registry/index.d.ts +0 -1
- package/dist/registry/index.js +0 -1
- package/dist/registry/lock.d.ts +2 -11
- package/dist/registry/lock.js +14 -183
- package/dist/registry/registry.d.ts +1 -6
- package/dist/registry/registry.js +5 -17
- package/dist/runtime/action-registry.d.ts +1 -5
- package/dist/runtime/action-registry.js +0 -12
- package/dist/runtime/context.js +2 -2
- package/dist/runtime/events.d.ts +11 -50
- package/dist/runtime/events.js +88 -368
- package/dist/runtime/index.d.ts +0 -4
- package/dist/runtime/index.js +0 -4
- package/dist/runtime/run-persistence.d.ts +2 -0
- package/dist/runtime/run-persistence.js +2 -1
- package/dist/runtime/standalone-commands.d.ts +18 -0
- package/dist/runtime/standalone-commands.js +466 -0
- package/dist/runtime/standalone-help.d.ts +20 -0
- package/dist/runtime/standalone-help.js +72 -0
- package/dist/runtime/standalone.d.ts +1 -44
- package/dist/runtime/standalone.js +32 -573
- package/dist/schema/validator.d.ts +2 -2
- package/dist/schema/validator.js +2 -9
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.js +0 -2
- package/dist/server/routes/actions.js +1 -1
- package/dist/server/routes/info.js +1 -1
- package/dist/server/routes/playbooks.js +1 -1
- package/dist/server/routes/runs.js +123 -16
- package/dist/server/routes/state.js +43 -18
- package/dist/server/security.d.ts +1 -1
- package/dist/server/security.js +2 -2
- package/dist/server/server.js +3 -7
- package/dist/service/factory.js +4 -3
- package/dist/service/index.d.ts +1 -1
- package/dist/service/index.js +1 -1
- package/dist/service/remote-errors.d.ts +1 -1
- package/dist/service/remote-errors.js +6 -6
- package/dist/service/remote-polling.d.ts +3 -0
- package/dist/service/remote-polling.js +10 -5
- package/dist/service/remote.d.ts +5 -1
- package/dist/service/remote.js +108 -17
- package/dist/service/sse-stream.js +2 -2
- package/dist/service/types.d.ts +22 -19
- package/dist/service/types.js +1 -24
- package/dist/storage/clock.d.ts +1 -1
- package/dist/storage/clock.js +1 -1
- package/dist/storage/data-dir-lock.d.ts +10 -22
- package/dist/storage/data-dir-lock.js +28 -56
- package/dist/storage/file-lock.d.ts +64 -0
- package/dist/storage/file-lock.js +447 -0
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.js +5 -4
- package/dist/storage/run-liveness.d.ts +48 -0
- package/dist/storage/run-liveness.js +44 -0
- package/dist/storage/sqlite-config.d.ts +16 -0
- package/dist/storage/sqlite-config.js +59 -0
- package/dist/storage/sqlite-driver.d.ts +3 -1
- package/dist/storage/sqlite-driver.js +14 -4
- package/dist/storage/sqlite-events.d.ts +13 -0
- package/dist/storage/sqlite-events.js +48 -0
- package/dist/storage/sqlite-runs.d.ts +107 -0
- package/dist/storage/sqlite-runs.js +622 -0
- package/dist/storage/sqlite-schema.d.ts +5 -0
- package/dist/storage/sqlite-schema.js +143 -0
- package/dist/storage/sqlite-state.d.ts +33 -0
- package/dist/storage/sqlite-state.js +270 -0
- package/dist/storage/sqlite.d.ts +30 -57
- package/dist/storage/sqlite.js +84 -741
- package/dist/storage/types.d.ts +35 -2
- package/dist/utils/index.d.ts +18 -14
- package/dist/utils/index.js +37 -29
- package/dist/utils/semver.d.ts +18 -0
- package/dist/utils/semver.js +19 -0
- package/dist/utils/warning.d.ts +1 -0
- package/dist/utils/warning.js +52 -0
- package/dist/{json/value-validator.d.ts → value-validator.d.ts} +9 -0
- package/dist/value-validator.js +330 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +10 -12
- package/dist/execution/index.d.ts +0 -2
- package/dist/execution/index.js +0 -2
- package/dist/filter/index.d.ts +0 -1
- package/dist/filter/index.js +0 -1
- package/dist/graph/index.d.ts +0 -4
- package/dist/graph/index.js +0 -4
- package/dist/input/metadata.d.ts +0 -99
- package/dist/input/metadata.js +0 -99
- package/dist/invocation/index.d.ts +0 -2
- package/dist/invocation/index.js +0 -2
- package/dist/ipc/index.d.ts +0 -4
- package/dist/ipc/index.js +0 -4
- package/dist/json/index.d.ts +0 -1
- package/dist/json/index.js +0 -1
- package/dist/json/value-validator.js +0 -330
- package/dist/node/index.d.ts +0 -1
- package/dist/node/index.js +0 -1
- package/dist/platform/node-fs.d.ts +0 -37
- package/dist/platform/node-fs.js +0 -81
- package/dist/process/control-arbiter.d.ts +0 -108
- package/dist/process/control-arbiter.js +0 -250
- package/dist/process/process-executor.d.ts +0 -47
- package/dist/process/process-executor.js +0 -296
- package/dist/profile/client-health.d.ts +0 -14
- package/dist/profile/client-query.d.ts +0 -30
- package/dist/profile/client-query.js +0 -69
- package/dist/profile/client.d.ts +0 -26
- package/dist/profile/client.js +0 -31
- package/dist/project/closure.d.ts +0 -25
- package/dist/project/closure.js +0 -74
- package/dist/registry/store.d.ts +0 -42
- package/dist/registry/store.js +0 -43
- package/dist/runtime/clock.d.ts +0 -7
- package/dist/runtime/clock.js +0 -7
- package/dist/runtime/module-loader.d.ts +0 -2
- package/dist/runtime/module-loader.js +0 -1
- package/dist/runtime/process.d.ts +0 -8
- package/dist/runtime/process.js +0 -1
- package/dist/runtime/runner.d.ts +0 -234
- package/dist/runtime/runner.js +0 -609
- package/dist/schema/index.d.ts +0 -1
- package/dist/schema/index.js +0 -1
- package/dist/server/dispatcher.d.ts +0 -25
- package/dist/server/dispatcher.js +0 -54
- package/dist/service/local.d.ts +0 -27
- package/dist/service/local.js +0 -141
- package/dist/storage/driver.d.ts +0 -10
- package/dist/storage/driver.js +0 -10
- package/dist/storage/lazy.d.ts +0 -8
- package/dist/storage/lazy.js +0 -45
- package/dist/storage/lock-core.d.ts +0 -158
- package/dist/storage/lock-core.js +0 -872
- package/dist/utils/net.d.ts +0 -10
- package/dist/utils/net.js +0 -16
- package/dist/utils/process.d.ts +0 -10
- package/dist/utils/process.js +0 -21
- /package/dist/{filter → utils}/intent.d.ts +0 -0
- /package/dist/{filter → utils}/intent.js +0 -0
|
@@ -1,13 +1,59 @@
|
|
|
1
|
-
import { isLoopbackHost } from "../utils/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
63
|
-
|
|
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 可加载性与数量。
|
|
@@ -188,26 +174,13 @@ function checkProjectManifest(scope) {
|
|
|
188
174
|
});
|
|
189
175
|
}
|
|
190
176
|
else {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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
|
|
234
|
+
message: `Failed to inspect declared files: ${err?.message || String(err)}`,
|
|
303
235
|
});
|
|
304
236
|
}
|
|
305
237
|
}
|
|
@@ -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
|
*/
|
package/dist/doctor/doctor.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { createDoctorCheckContext } from "./context.js";
|
|
2
|
-
import {
|
|
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
|
* 全仓各领域异常与跨层透传异常的统一事实源基类。
|
|
@@ -298,7 +348,7 @@ export declare function resolveExecutionHint(targetRef: string, error?: {
|
|
|
298
348
|
/**
|
|
299
349
|
* 集中定义的标准结构化错误码联合类型。
|
|
300
350
|
*/
|
|
301
|
-
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
|
|
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;
|
|
302
352
|
/** 全仓统一错误码类型别名 */
|
|
303
353
|
export type ActionDockErrorCode = ErrorCode;
|
|
304
354
|
/**
|
package/dist/errors.js
CHANGED
|
@@ -75,8 +75,6 @@ export const STORAGE_BUSY = "STORAGE_BUSY";
|
|
|
75
75
|
export const PROJECT_BUSY = "PROJECT_BUSY";
|
|
76
76
|
/** 工程存在未恢复的崩溃事务,需要执行恢复流程 */
|
|
77
77
|
export const PROJECT_RECOVERY_REQUIRED = "PROJECT_RECOVERY_REQUIRED";
|
|
78
|
-
/** SQLite 工作线程已退出 */
|
|
79
|
-
export const STORAGE_WORKER_EXITED = "STORAGE_WORKER_EXITED";
|
|
80
78
|
/** 事件订阅队列积压超过背压上限 */
|
|
81
79
|
export const EVENT_BACKPRESSURE_LIMIT = "EVENT_BACKPRESSURE_LIMIT";
|
|
82
80
|
export const EVENT_CURSOR_EXPIRED = "EVENT_CURSOR_EXPIRED";
|
|
@@ -178,7 +176,7 @@ export function describeActionLoadFailure(err, context) {
|
|
|
178
176
|
const rootCause = err instanceof Error ? err.message : String(err ?? "");
|
|
179
177
|
const isMissingModule = isMissingModuleError(rootCause);
|
|
180
178
|
const hint = isMissingModule
|
|
181
|
-
?
|
|
179
|
+
? `Project dependencies are missing. Run 'npm install --omit=dev' in '${context.projectRoot}' and try again.`
|
|
182
180
|
: undefined;
|
|
183
181
|
return {
|
|
184
182
|
code: ACTION_LOAD_FAILED,
|
|
@@ -255,6 +253,58 @@ export const AMBIGUOUS_STATE_KEY = "AMBIGUOUS_STATE_KEY";
|
|
|
255
253
|
export const RUN_NOT_FOUND = "RUN_NOT_FOUND";
|
|
256
254
|
/** 目标运行已进入终态不可操作 */
|
|
257
255
|
export const RUN_ALREADY_FINISHED = "RUN_ALREADY_FINISHED";
|
|
256
|
+
/** 目标环境配置 Profile 未找到 */
|
|
257
|
+
export const PROFILE_NOT_FOUND = "PROFILE_NOT_FOUND";
|
|
258
|
+
/** 锁文件读取失败 */
|
|
259
|
+
export const LOCKFILE_READ_FAILED = "LOCKFILE_READ_FAILED";
|
|
260
|
+
/** 锁文件内容损坏或存在重复键 */
|
|
261
|
+
export const LOCKFILE_CORRUPTED = "LOCKFILE_CORRUPTED";
|
|
262
|
+
/** 锁文件结构或格式非法 */
|
|
263
|
+
export const LOCKFILE_INVALID = "LOCKFILE_INVALID";
|
|
264
|
+
/** 不受支持的锁文件版本 */
|
|
265
|
+
export const UNSUPPORTED_LOCKFILE_VERSION = "UNSUPPORTED_LOCKFILE_VERSION";
|
|
266
|
+
/** 项目清单读取失败 */
|
|
267
|
+
export const MANIFEST_READ_FAILED = "MANIFEST_READ_FAILED";
|
|
268
|
+
/** 项目清单 JSON 解析失败或内容损坏 */
|
|
269
|
+
export const MANIFEST_CORRUPTED = "MANIFEST_CORRUPTED";
|
|
270
|
+
/** 项目清单结构或格式非法 */
|
|
271
|
+
export const MANIFEST_INVALID = "MANIFEST_INVALID";
|
|
272
|
+
/** 不受支持的项目清单 Schema 版本 */
|
|
273
|
+
export const UNSUPPORTED_MANIFEST_SCHEMA = "UNSUPPORTED_MANIFEST_SCHEMA";
|
|
274
|
+
/** 项目清单文件 actiondock.json 未找到 */
|
|
275
|
+
export const MANIFEST_NOT_FOUND = "MANIFEST_NOT_FOUND";
|
|
276
|
+
/** 清单确定性摘要与锁文件记录不一致 */
|
|
277
|
+
export const MANIFEST_DIGEST_MISMATCH = "MANIFEST_DIGEST_MISMATCH";
|
|
278
|
+
/** 全局注册表文件损坏或格式非法 */
|
|
279
|
+
export const REGISTRY_CORRUPTED = "REGISTRY_CORRUPTED";
|
|
280
|
+
/** 底层 SQLite 存储不支持异步事务 */
|
|
281
|
+
export const ASYNC_TRANSACTION_UNSUPPORTED = "ASYNC_TRANSACTION_UNSUPPORTED";
|
|
282
|
+
/** 底层存储或数据库连接已关闭 */
|
|
283
|
+
export const STORAGE_CLOSED = "STORAGE_CLOSED";
|
|
284
|
+
/** 多个不同物理路径声明了相同的包标识冲突 */
|
|
285
|
+
export const PACKAGE_ID_CONFLICT = "PACKAGE_ID_CONFLICT";
|
|
286
|
+
/** 路径参数非法(含空字节或非字符串) */
|
|
287
|
+
export const INVALID_PATH = "INVALID_PATH";
|
|
288
|
+
/** 存储数据目录初始化失败 */
|
|
289
|
+
export const STORAGE_INIT_FAILED = "STORAGE_INIT_FAILED";
|
|
290
|
+
/** 对象处于非法状态或缺少必要内部资源 */
|
|
291
|
+
export const INVALID_STATE = "INVALID_STATE";
|
|
292
|
+
/** 目标进程未找到或不存在 */
|
|
293
|
+
export const PROCESS_NOT_FOUND = "PROCESS_NOT_FOUND";
|
|
294
|
+
/** 模块标识符解析失败 */
|
|
295
|
+
export const MODULE_RESOLVE_FAILED = "MODULE_RESOLVE_FAILED";
|
|
296
|
+
/** 执行并发达到上限 */
|
|
297
|
+
export const EXECUTION_CONCURRENCY_LIMIT = "EXECUTION_CONCURRENCY_LIMIT";
|
|
298
|
+
/** 项目配置文件 actiondock.json 未找到 */
|
|
299
|
+
export const PROJECT_CONFIG_NOT_FOUND = "PROJECT_CONFIG_NOT_FOUND";
|
|
300
|
+
/** 项目清单加载失败 */
|
|
301
|
+
export const MANIFEST_LOAD_FAILED = "MANIFEST_LOAD_FAILED";
|
|
302
|
+
/** 动作标识符不符合命名规范 */
|
|
303
|
+
export const INVALID_ACTION_ID = "INVALID_ACTION_ID";
|
|
304
|
+
/** 规程标识符不符合命名规范 */
|
|
305
|
+
export const INVALID_PLAYBOOK_ID = "INVALID_PLAYBOOK_ID";
|
|
306
|
+
/** 项目根目录未找到或不是合法的 ActionDock 包 */
|
|
307
|
+
export const PROJECT_ROOT_NOT_FOUND = "PROJECT_ROOT_NOT_FOUND";
|
|
258
308
|
/**
|
|
259
309
|
* ActionDock 统一基础结构化异常类。
|
|
260
310
|
* 全仓各领域异常与跨层透传异常的统一事实源基类。
|