@actiondock/core 2.13.0 → 2.15.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/dist/catalog/discovery.d.ts +3 -3
- package/dist/catalog/graph.d.ts +6 -8
- package/dist/catalog/graph.js +197 -62
- package/dist/catalog/resolve-playbook.d.ts +2 -2
- package/dist/catalog/resolve-playbook.js +12 -53
- package/dist/execution/types.d.ts +2 -2
- package/dist/host/routing.d.ts +1 -1
- package/dist/host/routing.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/package/runtime.d.ts +2 -2
- package/dist/package/runtime.js +3 -1
- package/dist/package/static-index.d.ts +4 -6
- package/dist/package/static-index.js +12 -60
- package/dist/package/types.d.ts +5 -5
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +1 -0
- package/dist/project/init.js +2 -2
- package/dist/project/loader.d.ts +4 -2
- package/dist/project/loader.js +38 -34
- package/dist/project/manifest.d.ts +2 -0
- package/dist/project/manifest.js +17 -1
- package/dist/project/skill-dir.d.ts +72 -0
- package/dist/project/skill-dir.js +244 -0
- package/dist/project/types.d.ts +31 -0
- package/dist/registry/registry.js +27 -15
- package/dist/runtime/context.d.ts +3 -3
- package/dist/runtime/standalone-commands.js +8 -2
- package/dist/runtime/standalone.d.ts +2 -0
- package/dist/storage/sqlite-driver.d.ts +0 -1
- package/dist/storage/sqlite-driver.js +0 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/semver.d.ts +2 -1
- package/dist/utils/semver.js +11 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -7
- package/dist/utils/warning.d.ts +0 -1
- package/dist/utils/warning.js +0 -52
package/dist/project/types.d.ts
CHANGED
|
@@ -53,6 +53,25 @@ export interface PlaybookManifestEntry {
|
|
|
53
53
|
/** 该 Playbook 所依赖/调用的 Action ID 列表 */
|
|
54
54
|
actions?: string[];
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* 内存运行时或测试中使用的内联 Playbook 声明项。
|
|
58
|
+
*/
|
|
59
|
+
export interface InlinePlaybookSourceEntry {
|
|
60
|
+
/** Playbook Markdown 正文内容(纯 Markdown 规程内容,含空字符串) */
|
|
61
|
+
content: string;
|
|
62
|
+
/** 可选的虚拟入口相对路径(如 "playbooks/calc-sop.md") */
|
|
63
|
+
entry?: string;
|
|
64
|
+
/** Playbook 展示名称,缺省回落文件名派生 */
|
|
65
|
+
name?: string;
|
|
66
|
+
/** Playbook 任务描述 */
|
|
67
|
+
description?: string;
|
|
68
|
+
/** 该 Playbook 所依赖/调用的 Action ID 列表 */
|
|
69
|
+
actions?: string[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Playbook 来源定义条目(支持磁盘清单声明项与内存内联正文声明项)。
|
|
73
|
+
*/
|
|
74
|
+
export type PlaybookSourceEntry = PlaybookManifestEntry | InlinePlaybookSourceEntry;
|
|
56
75
|
/**
|
|
57
76
|
* ActionDock 声明式元数据清单契约(actiondock.json 为唯一事实源)。
|
|
58
77
|
*/
|
|
@@ -75,6 +94,8 @@ export interface ActionDockManifest {
|
|
|
75
94
|
actions?: Record<string, ActionManifestEntry>;
|
|
76
95
|
/** 声明的 Playbooks 集合(唯一事实源) */
|
|
77
96
|
playbooks?: Record<string, PlaybookManifestEntry>;
|
|
97
|
+
/** 包级静态依赖引用,与 Action 的 uses 共用引用语义。 */
|
|
98
|
+
uses?: string[];
|
|
78
99
|
/** 跨包外部依赖映射(逻辑包 ID 到 npm 包名) */
|
|
79
100
|
dependencies?: Record<string, string>;
|
|
80
101
|
/** 框架导出与分发边界文件列表 */
|
|
@@ -91,10 +112,20 @@ export interface ActionDockManifest {
|
|
|
91
112
|
[key: string]: unknown;
|
|
92
113
|
};
|
|
93
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* 内存运行时或图模型中支持内联正文的规程来源清单契约。
|
|
117
|
+
*/
|
|
118
|
+
export type PlaybookSourceManifest = Omit<ActionDockManifest, "playbooks"> & {
|
|
119
|
+
playbooks?: Record<string, PlaybookSourceEntry>;
|
|
120
|
+
};
|
|
94
121
|
/**
|
|
95
122
|
* ActionDock 项目根配置文件契约(等同于 ActionDockManifest,actiondock.json 为单一事实源)。
|
|
96
123
|
*/
|
|
97
124
|
export type ProjectConfig = ActionDockManifest;
|
|
125
|
+
/**
|
|
126
|
+
* 内存运行时或图模型中支持内联正文的项目配置契约。
|
|
127
|
+
*/
|
|
128
|
+
export type RuntimeProjectConfig = PlaybookSourceManifest;
|
|
98
129
|
/**
|
|
99
130
|
* 解析后的完整 Playbook 定义对象。
|
|
100
131
|
*/
|
|
@@ -2,6 +2,7 @@ import { existsSync, mkdirSync, readFileSync, renameSync, statSync } from "node:
|
|
|
2
2
|
import { readFile, rename, writeFile } from "node:fs/promises";
|
|
3
3
|
import { basename, dirname, join, resolve, sep } from "node:path";
|
|
4
4
|
import { findProjectRoot, loadProjectConfig } from "../project/loader.js";
|
|
5
|
+
import { inspectLocalPackageDirectory, isExplicitPath } from "../project/skill-dir.js";
|
|
5
6
|
import { getActionDockHome, getPackageSlug } from "../utils/index.js";
|
|
6
7
|
import { ActionDockError, MANIFEST_NOT_FOUND, REGISTRY_CORRUPTED } from "../errors.js";
|
|
7
8
|
import { withRegistryLock } from "./lock.js";
|
|
@@ -399,31 +400,42 @@ export function resolvePackageRoot(packageIdOrPath, cwd, customHome) {
|
|
|
399
400
|
const resolvedPath = resolve(baseDir, packageIdOrPath);
|
|
400
401
|
// 检查 packageIdOrPath 是否为磁盘上现存的目录或文件路径
|
|
401
402
|
if (existsSync(resolvedPath)) {
|
|
403
|
+
let info;
|
|
402
404
|
try {
|
|
403
|
-
|
|
405
|
+
info = statSync(resolvedPath);
|
|
406
|
+
}
|
|
407
|
+
catch (err) {
|
|
408
|
+
if (err?.code !== "ENOENT" && err?.code !== "ENOTDIR") {
|
|
409
|
+
throw err;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (info) {
|
|
404
413
|
const targetDir = info.isDirectory() ? resolvedPath : dirname(resolvedPath);
|
|
414
|
+
// 普通开发包根目录:直接包含 actiondock.json 清单。
|
|
415
|
+
// 普通清单根目录定位与封闭 Skill 执行校验分离,不能被当成只含一个包的 Skill 闭包拒绝。
|
|
405
416
|
if (existsSync(join(targetDir, "actiondock.json"))) {
|
|
417
|
+
loadProjectConfig(targetDir);
|
|
406
418
|
return targetDir;
|
|
407
419
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
420
|
+
// 复合技能布局:根目录下存在 packages/ 目录且包含有效子包。
|
|
421
|
+
const localSkill = inspectLocalPackageDirectory(targetDir);
|
|
422
|
+
if (localSkill) {
|
|
423
|
+
return localSkill.root;
|
|
424
|
+
}
|
|
425
|
+
// 具体文件查找所属工程根目录:仅当 packageIdOrPath 指向具体文件(非目录)时,
|
|
426
|
+
// 才尝试向上查找所属工程根目录;目录形态绝不向上回退,防止显式目录越界命中父级工程。
|
|
427
|
+
if (!info.isDirectory()) {
|
|
428
|
+
const parentRoot = findProjectRoot(targetDir);
|
|
429
|
+
if (parentRoot) {
|
|
430
|
+
loadProjectConfig(parentRoot);
|
|
431
|
+
return parentRoot;
|
|
432
|
+
}
|
|
411
433
|
}
|
|
412
|
-
}
|
|
413
|
-
catch {
|
|
414
|
-
// stat 失败(如并发删除):忽略并继续走标识符解析路径
|
|
415
434
|
}
|
|
416
435
|
}
|
|
417
436
|
// 显式路径形态但未解析成功的场景:
|
|
418
437
|
// scoped package 标识符(如 @team/tools)虽含 '/' 但属于包 ID 而非文件路径
|
|
419
|
-
|
|
420
|
-
const isExplicitPath = !isScopedPackage &&
|
|
421
|
-
(packageIdOrPath.startsWith(".") ||
|
|
422
|
-
packageIdOrPath.startsWith("/") ||
|
|
423
|
-
packageIdOrPath.startsWith("~") ||
|
|
424
|
-
packageIdOrPath.includes("/") ||
|
|
425
|
-
packageIdOrPath.includes("\\"));
|
|
426
|
-
if (isExplicitPath) {
|
|
438
|
+
if (isExplicitPath(packageIdOrPath)) {
|
|
427
439
|
// 显式路径不存在或不是 ActionDock 项目时必须失败,禁止静默回退
|
|
428
440
|
return null;
|
|
429
441
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ActionContext, ActionRef, Config, Logger, ProcessAPI, ProgressReporter, StateStore } from "@actiondock/sdk";
|
|
2
|
-
import type { ProjectConfig } from "../project/types.js";
|
|
2
|
+
import type { ProjectConfig, RuntimeProjectConfig } from "../project/types.js";
|
|
3
3
|
import type { RuntimeStorage } from "../storage/types.js";
|
|
4
4
|
import { ProcessManager, type ProcessOwner } from "../process/index.js";
|
|
5
5
|
/**
|
|
@@ -17,7 +17,7 @@ export declare class RuntimeConfig implements Config {
|
|
|
17
17
|
private storage;
|
|
18
18
|
private projectConfig?;
|
|
19
19
|
private globalStorage?;
|
|
20
|
-
constructor(storage: RuntimeStorage, overrides?: Record<string, unknown>, projectConfig?: ProjectConfig, globalStorage?: RuntimeStorage);
|
|
20
|
+
constructor(storage: RuntimeStorage, overrides?: Record<string, unknown>, projectConfig?: ProjectConfig | RuntimeProjectConfig, globalStorage?: RuntimeStorage);
|
|
21
21
|
get<T = unknown>(key: string): T | undefined;
|
|
22
22
|
get<T = unknown>(key: string, defaultValue: T): T;
|
|
23
23
|
has(key: string): boolean;
|
|
@@ -70,7 +70,7 @@ export interface ContextOptions {
|
|
|
70
70
|
storage: RuntimeStorage;
|
|
71
71
|
globalStorage?: RuntimeStorage;
|
|
72
72
|
overrides?: Record<string, unknown>;
|
|
73
|
-
projectConfig?: ProjectConfig;
|
|
73
|
+
projectConfig?: ProjectConfig | RuntimeProjectConfig;
|
|
74
74
|
parentRunId?: string;
|
|
75
75
|
runId?: string;
|
|
76
76
|
rootRunId?: string;
|
|
@@ -29,7 +29,7 @@ export async function handleList(ctx, subArgs) {
|
|
|
29
29
|
const effectiveIntent = intent || (positionalPatterns.length > 0 ? positionalPatterns.join("|") : undefined);
|
|
30
30
|
const actions = await ctx.service.discovery.listActions();
|
|
31
31
|
const list = actions.map((a) => ({
|
|
32
|
-
id: a.id,
|
|
32
|
+
id: ctx.options.multiPackage && a.packageId && !a.id.includes("/") ? `${a.packageId}/${a.id}` : a.id,
|
|
33
33
|
description: a.description || "",
|
|
34
34
|
}));
|
|
35
35
|
const filterRes = filterWithFallbackInfo(list, effectiveIntent, [(a) => a.id, (a) => a.description], !noFallback);
|
|
@@ -66,7 +66,7 @@ export async function handleDescribe(ctx, subArgs) {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
const payload = buildActionDescribePayload(action, {
|
|
69
|
-
packageId: ctx.options.packageId,
|
|
69
|
+
packageId: action.packageId || ctx.options.packageId,
|
|
70
70
|
});
|
|
71
71
|
if (isJson) {
|
|
72
72
|
ctx.writeOut(JSON.stringify(payload, null, 2));
|
|
@@ -274,6 +274,9 @@ function isServiceCapabilityError(err) {
|
|
|
274
274
|
code === "TARGET_CAPABILITY_UNAVAILABLE");
|
|
275
275
|
}
|
|
276
276
|
export async function handleConfig(ctx, subArgs) {
|
|
277
|
+
if (ctx.options.multiPackage) {
|
|
278
|
+
return ctx.emitError(subArgs.includes("--json"), "CAPABILITY_UNAVAILABLE", "Multi-package entries do not support config/state management; configure actions using --config and --data-dir.", ExitCode.INVALID_ARGUMENT);
|
|
279
|
+
}
|
|
277
280
|
const sub = subArgs[0] || "list";
|
|
278
281
|
if (!ctx.service.management) {
|
|
279
282
|
ctx.writeErr("Error: management port is not enabled on this service");
|
|
@@ -350,6 +353,9 @@ function decodeStateKeyArg(key) {
|
|
|
350
353
|
}
|
|
351
354
|
}
|
|
352
355
|
export async function handleState(ctx, subArgs) {
|
|
356
|
+
if (ctx.options.multiPackage) {
|
|
357
|
+
return ctx.emitError(subArgs.includes("--json"), "CAPABILITY_UNAVAILABLE", "Multi-package entries do not support config/state management; configure actions using --config and --data-dir.", ExitCode.INVALID_ARGUMENT);
|
|
358
|
+
}
|
|
353
359
|
const sub = subArgs[0] || "list";
|
|
354
360
|
let namespace;
|
|
355
361
|
let isAll = false;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -104,4 +104,3 @@ export declare function assertPathWithinRoot(rootDir: string, targetPath: string
|
|
|
104
104
|
* Backwards-compatible alias for assertPathWithinRoot targeting project roots.
|
|
105
105
|
*/
|
|
106
106
|
export declare function assertWithinProjectRoot(projectRoot: string, subDir: string, fieldName: string): void;
|
|
107
|
-
export { suppressExperimentalWarnings } from "./warning.js";
|
package/dist/utils/index.js
CHANGED
package/dist/utils/semver.d.ts
CHANGED
|
@@ -6,10 +6,11 @@ export interface SemVer {
|
|
|
6
6
|
minor: number;
|
|
7
7
|
patch: number;
|
|
8
8
|
prerelease?: string;
|
|
9
|
+
build?: string;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* 解析基础 SemVer 版本字符串(单一事实源)。
|
|
12
|
-
* 仅接受可选 v/=
|
|
13
|
+
* 仅接受可选 v/= 前缀的严格三段式语义化版本,可携带预发布后缀与构建元数据;
|
|
13
14
|
* 其余形态(两段式、非数值等)返回 null,由调用方自行兜底。
|
|
14
15
|
*
|
|
15
16
|
* 本模块不依赖任何 Node 内建与 core 领域模块,可在无 loader 的原生
|
package/dist/utils/semver.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 解析基础 SemVer 版本字符串(单一事实源)。
|
|
3
|
-
* 仅接受可选 v/=
|
|
3
|
+
* 仅接受可选 v/= 前缀的严格三段式语义化版本,可携带预发布后缀与构建元数据;
|
|
4
4
|
* 其余形态(两段式、非数值等)返回 null,由调用方自行兜底。
|
|
5
5
|
*
|
|
6
6
|
* 本模块不依赖任何 Node 内建与 core 领域模块,可在无 loader 的原生
|
|
7
7
|
* Node 直接以 .ts 形态导入(工程脚本域复用此处单一事实源)。
|
|
8
8
|
*/
|
|
9
9
|
export function parseSemVer(v) {
|
|
10
|
-
const match = v.trim().replace(/^[v=]/, "").match(/^(\d
|
|
10
|
+
const match = v.trim().replace(/^[v=]/, "").match(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/);
|
|
11
11
|
if (!match)
|
|
12
12
|
return null;
|
|
13
|
+
const [major, minor, patch] = match.slice(1, 4).map(Number);
|
|
14
|
+
if (![major, minor, patch].every(Number.isSafeInteger))
|
|
15
|
+
return null;
|
|
16
|
+
if (match[4]?.split(".").some((id) => /^\d+$/.test(id) && id.length > 1 && id.startsWith("0")))
|
|
17
|
+
return null;
|
|
13
18
|
return {
|
|
14
|
-
major
|
|
15
|
-
minor
|
|
16
|
-
patch
|
|
19
|
+
major,
|
|
20
|
+
minor,
|
|
21
|
+
patch,
|
|
17
22
|
prerelease: match[4],
|
|
23
|
+
...(match[5] === undefined ? {} : { build: match[5] }),
|
|
18
24
|
};
|
|
19
25
|
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actiondock/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "ActionDock Core Engine - Project loader, runtime execution, SQLite storage, standalone builder, and skill exporter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,11 +41,6 @@
|
|
|
41
41
|
"types": "./dist/package/index.d.ts",
|
|
42
42
|
"import": "./dist/package/index.js",
|
|
43
43
|
"default": "./dist/package/index.js"
|
|
44
|
-
},
|
|
45
|
-
"./warning": {
|
|
46
|
-
"types": "./dist/utils/warning.d.ts",
|
|
47
|
-
"import": "./dist/utils/warning.js",
|
|
48
|
-
"default": "./dist/utils/warning.js"
|
|
49
44
|
}
|
|
50
45
|
},
|
|
51
46
|
"files": [
|
|
@@ -64,7 +59,7 @@
|
|
|
64
59
|
"test": "node ../../scripts/run-tests.ts"
|
|
65
60
|
},
|
|
66
61
|
"dependencies": {
|
|
67
|
-
"@actiondock/sdk": "^2.
|
|
62
|
+
"@actiondock/sdk": "^2.15.0",
|
|
68
63
|
"ajv": "^8.17.1",
|
|
69
64
|
"ajv-formats": "^3.0.1",
|
|
70
65
|
"undici": "^7.29.1"
|
package/dist/utils/warning.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function suppressExperimentalWarnings(): void;
|
package/dist/utils/warning.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 全局禁用 Node.js 所有的 ExperimentalWarning 实验性特性警告。
|
|
3
|
-
* 跨所有 Node.js 运行版本,不区分具体特性(如 SQLite、类型擦除等),
|
|
4
|
-
* 在进程级别统一静默全部实验性警告,同时完整保留废弃警告与运行期异常。
|
|
5
|
-
*
|
|
6
|
-
* 逃生通道:当环境变量 ACTIONDOCK_SILENCE_WARNINGS 显式设置为 "0" 时,放弃静默以供深度调试排查。
|
|
7
|
-
*/
|
|
8
|
-
const kExperimentalWarningSuppressed = Symbol.for("actiondock.experimental_warning_suppressed");
|
|
9
|
-
export function suppressExperimentalWarnings() {
|
|
10
|
-
// 逃生通道:支持开发者显式禁用静默逻辑,确保排障透明度
|
|
11
|
-
if (process.env.ACTIONDOCK_SILENCE_WARNINGS === "0") {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const globalObj = globalThis;
|
|
15
|
-
if (globalObj[kExperimentalWarningSuppressed]) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
globalObj[kExperimentalWarningSuppressed] = true;
|
|
19
|
-
// 1. 拦截 process.emitWarning 源头
|
|
20
|
-
const originalEmitWarning = process.emitWarning;
|
|
21
|
-
if (typeof originalEmitWarning === "function") {
|
|
22
|
-
process.emitWarning = function (warning, ...args) {
|
|
23
|
-
if (typeof warning === "string") {
|
|
24
|
-
const type = typeof args[0] === "string" ? args[0] : args[0]?.type || args[1];
|
|
25
|
-
if (type === "ExperimentalWarning") {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else if (warning) {
|
|
30
|
-
const warnObj = warning;
|
|
31
|
-
if (warnObj.name === "ExperimentalWarning" || warnObj.type === "ExperimentalWarning") {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return Reflect.apply(originalEmitWarning, process, [warning, ...args]);
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
// 2. 包装进程级 warning 事件分发器,作为双层防护
|
|
39
|
-
const originalListeners = process.listeners("warning");
|
|
40
|
-
process.removeAllListeners("warning");
|
|
41
|
-
process.on("warning", (warning) => {
|
|
42
|
-
const warnObj = warning;
|
|
43
|
-
if (warnObj.name === "ExperimentalWarning" || warnObj.type === "ExperimentalWarning") {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
for (const listener of originalListeners) {
|
|
47
|
-
listener.call(process, warning);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
// 模块被引入时立即自执行
|
|
52
|
-
suppressExperimentalWarnings();
|