@actiondock/core 2.0.12 → 2.2.1
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 +61 -30
- package/dist/app/app.d.ts +73 -0
- package/dist/app/app.js +700 -0
- package/dist/app/index.d.ts +2 -0
- package/dist/app/index.js +2 -0
- package/dist/app/types.d.ts +283 -0
- package/dist/app/types.js +1 -0
- package/dist/catalog/action-index.d.ts +1 -1
- package/dist/catalog/action-index.js +93 -0
- package/dist/catalog/action-resolver.d.ts +2 -2
- package/dist/catalog/action-resolver.js +95 -0
- package/dist/catalog/index.d.ts +5 -5
- package/dist/catalog/index.js +5 -0
- package/dist/catalog/location-registry.d.ts +5 -5
- package/dist/catalog/location-registry.js +138 -0
- package/dist/catalog/package-catalog.d.ts +2 -2
- package/dist/catalog/package-catalog.js +76 -0
- package/dist/catalog/types.d.ts +2 -2
- package/dist/catalog/types.js +1 -0
- package/dist/doctor/doctor.d.ts +2 -1
- package/dist/doctor/doctor.js +613 -0
- package/dist/doctor/index.d.ts +2 -2
- package/dist/doctor/index.js +2 -0
- package/dist/doctor/types.js +1 -0
- package/dist/errors.d.ts +122 -0
- package/dist/errors.js +123 -0
- package/dist/execution/index.d.ts +2 -2
- package/dist/execution/index.js +2 -0
- package/dist/execution/service.d.ts +46 -41
- package/dist/execution/service.js +633 -0
- package/dist/execution/types.d.ts +59 -2
- package/dist/execution/types.js +1 -0
- package/dist/export/index.d.ts +1 -1
- package/dist/export/index.js +1 -0
- package/dist/export/templates.d.ts +45 -7
- package/dist/export/templates.js +631 -0
- package/dist/filter/index.d.ts +1 -1
- package/dist/filter/index.js +1 -0
- package/dist/filter/intent.js +123 -0
- package/dist/host/host.d.ts +55 -0
- package/dist/host/host.js +740 -0
- package/dist/host/index.d.ts +2 -0
- package/dist/host/index.js +2 -0
- package/dist/host/types.d.ts +81 -0
- package/dist/host/types.js +1 -0
- package/dist/index.d.ts +21 -16
- package/dist/index.js +20 -8458
- package/dist/ipc/diagnostic.d.ts +65 -0
- package/dist/ipc/diagnostic.js +129 -0
- package/dist/ipc/host.d.ts +7 -0
- package/dist/ipc/host.js +93 -0
- package/dist/ipc/index.d.ts +4 -0
- package/dist/ipc/index.js +4 -0
- package/dist/ipc/target.d.ts +56 -0
- package/dist/ipc/target.js +297 -0
- package/dist/ipc/types.d.ts +42 -0
- package/dist/ipc/types.js +1 -0
- package/dist/platform/default.d.ts +32 -0
- package/dist/platform/default.js +40 -0
- package/dist/platform/index.d.ts +3 -0
- package/dist/platform/index.js +3 -0
- package/dist/platform/node-fs.d.ts +37 -0
- package/dist/platform/node-fs.js +81 -0
- package/dist/platform/types.d.ts +104 -0
- package/dist/platform/types.js +1 -0
- package/dist/profile/client.d.ts +58 -12
- package/dist/profile/client.js +467 -0
- package/dist/profile/index.d.ts +3 -3
- package/dist/profile/index.js +3 -0
- package/dist/profile/manager.d.ts +2 -2
- package/dist/profile/manager.js +294 -0
- package/dist/profile/types.d.ts +1 -1
- package/dist/profile/types.js +1 -0
- package/dist/project/closure.js +68 -0
- package/dist/project/digest.d.ts +29 -0
- package/dist/project/digest.js +324 -0
- package/dist/project/index.d.ts +10 -5
- package/dist/project/index.js +10 -0
- package/dist/project/init.d.ts +3 -4
- package/dist/project/init.js +175 -0
- package/dist/project/loader.d.ts +21 -27
- package/dist/project/loader.js +484 -0
- package/dist/project/lockfile.d.ts +55 -0
- package/dist/project/lockfile.js +175 -0
- package/dist/project/manifest.d.ts +6 -28
- package/dist/project/manifest.js +220 -0
- package/dist/project/resolver.d.ts +116 -0
- package/dist/project/resolver.js +376 -0
- package/dist/project/transactions.d.ts +103 -0
- package/dist/project/transactions.js +1203 -0
- package/dist/project/types-generator.d.ts +33 -0
- package/dist/project/types-generator.js +168 -0
- package/dist/project/types.d.ts +58 -82
- package/dist/project/types.js +1 -0
- package/dist/registry/index.d.ts +5 -2
- package/dist/registry/index.js +5 -0
- package/dist/registry/lock.d.ts +27 -0
- package/dist/registry/lock.js +93 -0
- package/dist/registry/registry.d.ts +32 -11
- package/dist/registry/registry.js +611 -0
- package/dist/registry/resolve.d.ts +62 -0
- package/dist/registry/resolve.js +195 -0
- package/dist/registry/scan.d.ts +38 -0
- package/dist/registry/scan.js +135 -0
- package/dist/registry/types.d.ts +1 -1
- package/dist/registry/types.js +1 -0
- package/dist/runtime/action-collection.d.ts +27 -0
- package/dist/runtime/action-collection.js +57 -0
- package/dist/runtime/clock.d.ts +0 -2
- package/dist/runtime/clock.js +17 -0
- package/dist/runtime/context.d.ts +16 -5
- package/dist/runtime/context.js +242 -0
- package/dist/runtime/env.d.ts +3 -1
- package/dist/runtime/env.js +159 -0
- package/dist/runtime/events.d.ts +46 -14
- package/dist/runtime/events.js +604 -0
- package/dist/runtime/execution-manager.d.ts +1 -1
- package/dist/runtime/execution-manager.js +66 -0
- package/dist/runtime/index.d.ts +10 -9
- package/dist/runtime/index.js +10 -0
- package/dist/runtime/module-loader.d.ts +0 -8
- package/dist/runtime/module-loader.js +16 -0
- package/dist/runtime/process.d.ts +2 -4
- package/dist/runtime/process.js +146 -0
- package/dist/runtime/runner.d.ts +117 -10
- package/dist/runtime/runner.js +984 -0
- package/dist/runtime/standalone.d.ts +68 -19
- package/dist/runtime/standalone.js +536 -0
- package/dist/schema/validator.js +122 -0
- package/dist/server/body.js +93 -0
- package/dist/server/index.d.ts +5 -6
- package/dist/server/index.js +5 -0
- package/dist/server/routes/actions.d.ts +2 -2
- package/dist/server/routes/actions.js +298 -0
- package/dist/server/routes/common.d.ts +28 -17
- package/dist/server/routes/common.js +104 -0
- package/dist/server/routes/config.d.ts +2 -1
- package/dist/server/routes/config.js +173 -0
- package/dist/server/routes/doctor.d.ts +2 -2
- package/dist/server/routes/doctor.js +63 -0
- package/dist/server/routes/health.d.ts +2 -2
- package/dist/server/routes/health.js +35 -0
- package/dist/server/routes/index.d.ts +9 -9
- package/dist/server/routes/index.js +9 -0
- package/dist/server/routes/info.d.ts +4 -2
- package/dist/server/routes/info.js +158 -0
- package/dist/server/routes/playbooks.d.ts +2 -2
- package/dist/server/routes/playbooks.js +134 -0
- package/dist/server/routes/runs.d.ts +2 -2
- package/dist/server/routes/runs.js +343 -0
- package/dist/server/routes/state.d.ts +2 -1
- package/dist/server/routes/state.js +169 -0
- package/dist/server/security.d.ts +11 -4
- package/dist/server/security.js +101 -0
- package/dist/server/server.d.ts +6 -6
- package/dist/server/server.js +355 -0
- package/dist/server/types.d.ts +27 -8
- package/dist/server/types.js +1 -0
- package/dist/storage/data-dir-lock.d.ts +119 -0
- package/dist/storage/data-dir-lock.js +1016 -0
- package/dist/storage/driver.d.ts +4 -10
- package/dist/storage/driver.js +59 -0
- package/dist/storage/index.d.ts +30 -10
- package/dist/storage/index.js +98 -0
- package/dist/storage/lazy.d.ts +8 -0
- package/dist/storage/lazy.js +44 -0
- package/dist/storage/mask.d.ts +12 -5
- package/dist/storage/mask.js +48 -0
- package/dist/storage/params.d.ts +13 -0
- package/dist/storage/params.js +32 -0
- package/dist/storage/sqlite.d.ts +19 -6
- package/dist/storage/sqlite.js +689 -0
- package/dist/storage/types.d.ts +57 -6
- package/dist/storage/types.js +14 -0
- package/dist/target/index.d.ts +4 -0
- package/dist/target/index.js +4 -0
- package/dist/target/local.d.ts +52 -0
- package/dist/target/local.js +343 -0
- package/dist/target/remote.d.ts +76 -0
- package/dist/target/remote.js +839 -0
- package/dist/target/target.d.ts +6 -0
- package/dist/target/target.js +35 -0
- package/dist/target/types.d.ts +246 -0
- package/dist/target/types.js +34 -0
- package/dist/utils/index.d.ts +22 -2
- package/dist/utils/index.js +180 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +4 -0
- package/package.json +6 -7
- package/dist/build/index.d.ts +0 -1
- package/dist/build/templates.d.ts +0 -19
- package/dist/server/runtime-registry.d.ts +0 -78
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 监督进程与宿主子进程间调用的 IPC 请求消息。
|
|
3
|
+
*/
|
|
4
|
+
export interface IpcCallMessage {
|
|
5
|
+
id: string;
|
|
6
|
+
type: "call";
|
|
7
|
+
method: string;
|
|
8
|
+
args: unknown[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 宿主子进程回复给监督进程的 IPC 响应消息。
|
|
12
|
+
*/
|
|
13
|
+
export interface IpcResponseMessage {
|
|
14
|
+
id: string;
|
|
15
|
+
type: "response";
|
|
16
|
+
ok: boolean;
|
|
17
|
+
data?: unknown;
|
|
18
|
+
error?: {
|
|
19
|
+
code?: string;
|
|
20
|
+
message: string;
|
|
21
|
+
stack?: string;
|
|
22
|
+
details?: unknown;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 宿主子进程向监督进程流式推送的执行事件。
|
|
27
|
+
*/
|
|
28
|
+
export interface IpcEventMessage {
|
|
29
|
+
type: "event";
|
|
30
|
+
runId: string;
|
|
31
|
+
event: unknown;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 宿主子进程初始化就绪通知。
|
|
35
|
+
*/
|
|
36
|
+
export interface IpcReadyMessage {
|
|
37
|
+
type: "ready";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 联合 IPC 消息类型。
|
|
41
|
+
*/
|
|
42
|
+
export type IpcMessage = IpcCallMessage | IpcResponseMessage | IpcEventMessage | IpcReadyMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ProcessAPI } from "@actiondock/sdk";
|
|
2
|
+
import { type Clock } from "../runtime/clock.js";
|
|
3
|
+
import { type ModuleLoader } from "../runtime/module-loader.js";
|
|
4
|
+
import type { FileSystem, RuntimePlatform, StorageFactory } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* 默认运行时平台构建选项。
|
|
7
|
+
*/
|
|
8
|
+
export interface DefaultPlatformOptions {
|
|
9
|
+
/** 平台名称覆盖(默认使用 node) */
|
|
10
|
+
name?: "node" | "test";
|
|
11
|
+
/** 自定义文件系统实现(默认使用 NodeFileSystem) */
|
|
12
|
+
files?: FileSystem;
|
|
13
|
+
/** 自定义时间与时钟驱动(默认使用 SystemClock) */
|
|
14
|
+
clock?: Clock;
|
|
15
|
+
/** 自定义进程执行驱动(默认使用 DefaultProcessExecutor) */
|
|
16
|
+
process?: ProcessAPI;
|
|
17
|
+
/** 自定义源码加载驱动(默认使用 DefaultModuleLoader) */
|
|
18
|
+
modules?: ModuleLoader;
|
|
19
|
+
/** 自定义存储工厂(默认基于 core/storage 构造) */
|
|
20
|
+
storage?: StorageFactory;
|
|
21
|
+
/** 自定义 ActionDock 家目录 */
|
|
22
|
+
customHome?: string;
|
|
23
|
+
/** 自定义全局数据存储目录 */
|
|
24
|
+
dataDir?: string;
|
|
25
|
+
/** 文件系统沙箱根目录 */
|
|
26
|
+
rootDir?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 创建默认 RuntimePlatform 平台实例。
|
|
30
|
+
* 直接基于 Node 原生与 Core 内核能力组装平台,禁止任何全局单例状态。
|
|
31
|
+
*/
|
|
32
|
+
export declare function createDefaultPlatform(options?: DefaultPlatformOptions): RuntimePlatform;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SystemClock } from "../runtime/clock.js";
|
|
2
|
+
import { DefaultModuleLoader } from "../runtime/module-loader.js";
|
|
3
|
+
import { DefaultProcessExecutor } from "../runtime/process.js";
|
|
4
|
+
import { createGlobalStorage as coreCreateGlobalStorage, createStorage as coreCreateStorage, } from "../storage/index.js";
|
|
5
|
+
import { NodeFileSystem } from "./node-fs.js";
|
|
6
|
+
/**
|
|
7
|
+
* 创建默认 RuntimePlatform 平台实例。
|
|
8
|
+
* 直接基于 Node 原生与 Core 内核能力组装平台,禁止任何全局单例状态。
|
|
9
|
+
*/
|
|
10
|
+
export function createDefaultPlatform(options = {}) {
|
|
11
|
+
const platformName = options.name ?? "node";
|
|
12
|
+
const clock = options.clock ?? new SystemClock();
|
|
13
|
+
const files = options.files ?? new NodeFileSystem({ rootDir: options.rootDir });
|
|
14
|
+
const modules = options.modules ?? new DefaultModuleLoader();
|
|
15
|
+
const process = options.process ?? new DefaultProcessExecutor();
|
|
16
|
+
const storage = options.storage ?? {
|
|
17
|
+
createStorage(packageId, opts) {
|
|
18
|
+
return coreCreateStorage(packageId, {
|
|
19
|
+
customHome: options.customHome,
|
|
20
|
+
dataDir: options.dataDir,
|
|
21
|
+
...opts,
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
createGlobalStorage(opts) {
|
|
25
|
+
return coreCreateGlobalStorage({
|
|
26
|
+
customHome: options.customHome,
|
|
27
|
+
dataDir: options.dataDir,
|
|
28
|
+
...opts,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
name: platformName,
|
|
34
|
+
clock,
|
|
35
|
+
files,
|
|
36
|
+
modules,
|
|
37
|
+
process,
|
|
38
|
+
storage,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { FileStat, FileSystem } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* NodeFileSystem 配置选项。
|
|
4
|
+
*/
|
|
5
|
+
export interface NodeFileSystemOptions {
|
|
6
|
+
/**
|
|
7
|
+
* 安全沙箱根路径。
|
|
8
|
+
* 若指定,则所有文件系统操作将被强制约束在 rootDir 边界内,防止路径遍历逃逸。
|
|
9
|
+
*/
|
|
10
|
+
rootDir?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 基于 node:fs 和 node:path 的安全受限文件系统实现。
|
|
14
|
+
*/
|
|
15
|
+
export declare class NodeFileSystem implements FileSystem {
|
|
16
|
+
private readonly rootDir?;
|
|
17
|
+
constructor(options?: NodeFileSystemOptions);
|
|
18
|
+
/**
|
|
19
|
+
* 安全解析并校验路径边界。
|
|
20
|
+
*/
|
|
21
|
+
private resolvePath;
|
|
22
|
+
readFile(path: string, encoding?: string): Promise<string>;
|
|
23
|
+
writeFile(path: string, content: string | Uint8Array): Promise<void>;
|
|
24
|
+
readdir(dir: string): Promise<string[]>;
|
|
25
|
+
stat(path: string): Promise<FileStat>;
|
|
26
|
+
exists(path: string): Promise<boolean>;
|
|
27
|
+
mkdir(dir: string, options?: {
|
|
28
|
+
recursive?: boolean;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
rm(path: string, options?: {
|
|
31
|
+
recursive?: boolean;
|
|
32
|
+
force?: boolean;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
copy(src: string, dest: string, options?: {
|
|
35
|
+
recursive?: boolean;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import { dirname, isAbsolute, resolve } from "node:path";
|
|
3
|
+
import { assertPathWithinRoot } from "../utils/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* 基于 node:fs 和 node:path 的安全受限文件系统实现。
|
|
6
|
+
*/
|
|
7
|
+
export class NodeFileSystem {
|
|
8
|
+
rootDir;
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
if (options.rootDir) {
|
|
11
|
+
this.rootDir = resolve(options.rootDir);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 安全解析并校验路径边界。
|
|
16
|
+
*/
|
|
17
|
+
resolvePath(targetPath) {
|
|
18
|
+
if (typeof targetPath !== "string" || targetPath.includes("\0")) {
|
|
19
|
+
throw new Error("Invalid path: contains null byte or non-string argument");
|
|
20
|
+
}
|
|
21
|
+
if (this.rootDir) {
|
|
22
|
+
const resolved = isAbsolute(targetPath)
|
|
23
|
+
? resolve(targetPath)
|
|
24
|
+
: resolve(this.rootDir, targetPath);
|
|
25
|
+
assertPathWithinRoot(this.rootDir, resolved);
|
|
26
|
+
return resolved;
|
|
27
|
+
}
|
|
28
|
+
return resolve(targetPath);
|
|
29
|
+
}
|
|
30
|
+
async readFile(path, encoding = "utf-8") {
|
|
31
|
+
const resolved = this.resolvePath(path);
|
|
32
|
+
return await fs.readFile(resolved, { encoding: (encoding || "utf-8") });
|
|
33
|
+
}
|
|
34
|
+
async writeFile(path, content) {
|
|
35
|
+
const resolved = this.resolvePath(path);
|
|
36
|
+
const parentDir = dirname(resolved);
|
|
37
|
+
await fs.mkdir(parentDir, { recursive: true });
|
|
38
|
+
await fs.writeFile(resolved, content);
|
|
39
|
+
}
|
|
40
|
+
async readdir(dir) {
|
|
41
|
+
const resolved = this.resolvePath(dir);
|
|
42
|
+
return await fs.readdir(resolved);
|
|
43
|
+
}
|
|
44
|
+
async stat(path) {
|
|
45
|
+
const resolved = this.resolvePath(path);
|
|
46
|
+
const s = await fs.stat(resolved);
|
|
47
|
+
return {
|
|
48
|
+
isDirectory: () => s.isDirectory(),
|
|
49
|
+
isFile: () => s.isFile(),
|
|
50
|
+
size: s.size,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async exists(path) {
|
|
54
|
+
try {
|
|
55
|
+
const resolved = this.resolvePath(path);
|
|
56
|
+
await fs.access(resolved);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async mkdir(dir, options) {
|
|
64
|
+
const resolved = this.resolvePath(dir);
|
|
65
|
+
await fs.mkdir(resolved, { recursive: options?.recursive ?? true });
|
|
66
|
+
}
|
|
67
|
+
async rm(path, options) {
|
|
68
|
+
const resolved = this.resolvePath(path);
|
|
69
|
+
await fs.rm(resolved, {
|
|
70
|
+
recursive: options?.recursive ?? true,
|
|
71
|
+
force: options?.force ?? true,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
async copy(src, dest, options) {
|
|
75
|
+
const resolvedSrc = this.resolvePath(src);
|
|
76
|
+
const resolvedDest = this.resolvePath(dest);
|
|
77
|
+
const parentDir = dirname(resolvedDest);
|
|
78
|
+
await fs.mkdir(parentDir, { recursive: true });
|
|
79
|
+
await fs.cp(resolvedSrc, resolvedDest, { recursive: options?.recursive ?? true });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { ProcessAPI } from "@actiondock/sdk";
|
|
2
|
+
import type { Clock } from "../runtime/clock.js";
|
|
3
|
+
import type { ModuleLoader } from "../runtime/module-loader.js";
|
|
4
|
+
import type { RuntimeStorage } from "../storage/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* 文件元数据信息契约。
|
|
7
|
+
*/
|
|
8
|
+
export interface FileStat {
|
|
9
|
+
/** 是否为目录 */
|
|
10
|
+
isDirectory(): boolean;
|
|
11
|
+
/** 是否为普通文件 */
|
|
12
|
+
isFile(): boolean;
|
|
13
|
+
/** 文件字节大小 */
|
|
14
|
+
size: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 跨运行时统一文件系统抽象契约。
|
|
18
|
+
*/
|
|
19
|
+
export interface FileSystem {
|
|
20
|
+
/** 读取文件内容 */
|
|
21
|
+
readFile(path: string, encoding?: string): Promise<string> | string;
|
|
22
|
+
/** 写入文件内容 */
|
|
23
|
+
writeFile(path: string, content: string | Uint8Array): Promise<void> | void;
|
|
24
|
+
/** 读取目录下的所有条目名称 */
|
|
25
|
+
readdir(dir: string): Promise<string[]> | string[];
|
|
26
|
+
/** 获取路径对应条目的元数据状态 */
|
|
27
|
+
stat(path: string): Promise<{
|
|
28
|
+
isDirectory(): boolean;
|
|
29
|
+
isFile(): boolean;
|
|
30
|
+
size: number;
|
|
31
|
+
}>;
|
|
32
|
+
/** 检查路径是否存在 */
|
|
33
|
+
exists(path: string): Promise<boolean> | boolean;
|
|
34
|
+
/** 创建目录 */
|
|
35
|
+
mkdir(dir: string, options?: {
|
|
36
|
+
recursive?: boolean;
|
|
37
|
+
}): Promise<void> | void;
|
|
38
|
+
/** 删除文件或目录 */
|
|
39
|
+
rm(path: string, options?: {
|
|
40
|
+
recursive?: boolean;
|
|
41
|
+
force?: boolean;
|
|
42
|
+
}): Promise<void> | void;
|
|
43
|
+
/** 拷贝文件或目录 */
|
|
44
|
+
copy(src: string, dest: string, options?: {
|
|
45
|
+
recursive?: boolean;
|
|
46
|
+
}): Promise<void> | void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 跨运行时持久化存储工厂配置选项。
|
|
50
|
+
*/
|
|
51
|
+
export interface StorageFactoryOptions {
|
|
52
|
+
projectRoot?: string;
|
|
53
|
+
dataDir?: string;
|
|
54
|
+
inMemory?: boolean;
|
|
55
|
+
customHome?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 跨运行时全局存储工厂配置选项。
|
|
59
|
+
*/
|
|
60
|
+
export interface GlobalStorageFactoryOptions {
|
|
61
|
+
dataDir?: string;
|
|
62
|
+
inMemory?: boolean;
|
|
63
|
+
customHome?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 跨运行时持久化存储工厂契约。
|
|
67
|
+
*/
|
|
68
|
+
export interface StorageFactory {
|
|
69
|
+
/**
|
|
70
|
+
* 为指定 Package 创建或连接运行时存储。
|
|
71
|
+
*/
|
|
72
|
+
createStorage(packageId: string, options?: StorageFactoryOptions): RuntimeStorage;
|
|
73
|
+
/**
|
|
74
|
+
* 创建或连接跨 Package 共享的全局存储。
|
|
75
|
+
*/
|
|
76
|
+
createGlobalStorage(options?: GlobalStorageFactoryOptions): RuntimeStorage;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 跨运行时 HTTP 服务启动工厂契约。
|
|
80
|
+
*/
|
|
81
|
+
export interface HttpServerFactory {
|
|
82
|
+
/**
|
|
83
|
+
* 启动 HTTP 服务端实例。
|
|
84
|
+
*/
|
|
85
|
+
launchHttpServer(options: any): Promise<any>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 运行时底层环境核心标准契约。
|
|
89
|
+
* 提供统一的运行时契约,屏蔽宿主平台与测试沙箱环境的实现差异。
|
|
90
|
+
*/
|
|
91
|
+
export interface RuntimePlatform {
|
|
92
|
+
/** 运行时平台名称标识 */
|
|
93
|
+
readonly name: "node" | "test";
|
|
94
|
+
/** 统一时间与时钟驱动 */
|
|
95
|
+
readonly clock: Clock;
|
|
96
|
+
/** 统一文件系统操作驱动 */
|
|
97
|
+
readonly files: FileSystem;
|
|
98
|
+
/** 动态源码模块加载驱动 */
|
|
99
|
+
readonly modules: ModuleLoader;
|
|
100
|
+
/** 子进程衍生与执行驱动 */
|
|
101
|
+
readonly process: ProcessAPI;
|
|
102
|
+
/** 持久化数据库存储驱动工厂 */
|
|
103
|
+
readonly storage: StorageFactory;
|
|
104
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/profile/client.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { ExecutionResult, RunRecord } from "@actiondock/sdk";
|
|
2
|
-
import type { RemoteHealthResult } from "./types";
|
|
2
|
+
import type { RemoteHealthResult } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* 校验在携带认证 Token 时传输层协议是否安全。
|
|
5
|
+
* 若请求携带认证 Token 且目标为非本地回环的明文 http://,默认报错拒绝。
|
|
6
|
+
* 可通过 allowInsecureHttp 选项、ACTIONDOCK_ALLOW_INSECURE_HTTP 环境变量或 --allow-insecure-http 命令行参数豁免。
|
|
7
|
+
*/
|
|
8
|
+
export declare function assertSecureTransport(serverUrl: string, token?: string, allowInsecureHttp?: boolean): void;
|
|
3
9
|
/**
|
|
4
10
|
* 调用远端 ActionDock 服务端执行 Action 时的选项参数。
|
|
5
11
|
*/
|
|
@@ -12,8 +18,12 @@ export interface RemoteExecuteOptions {
|
|
|
12
18
|
timeoutMs?: number;
|
|
13
19
|
/** 中断信号 */
|
|
14
20
|
signal?: AbortSignal;
|
|
21
|
+
/** 幂等请求去重标识 */
|
|
22
|
+
requestId?: string;
|
|
15
23
|
/** 是否异步触发(202 Accepted 立即返回 runId) */
|
|
16
24
|
async?: boolean;
|
|
25
|
+
/** 是否允许通过非回环明文 HTTP 发送认证 Token */
|
|
26
|
+
allowInsecureHttp?: boolean;
|
|
17
27
|
}
|
|
18
28
|
/**
|
|
19
29
|
* 远端 Action 执行结果信封对象。
|
|
@@ -28,29 +38,43 @@ export type RemoteExecutionResult<T = unknown> = ExecutionResult<T> & {
|
|
|
28
38
|
* @param token 鉴权 Token(可选)
|
|
29
39
|
* @param timeoutMs 探测超时时间(默认 5000ms)
|
|
30
40
|
*/
|
|
31
|
-
export declare function checkRemoteHealth(serverUrl: string, token?: string, timeoutMs?: number
|
|
41
|
+
export declare function checkRemoteHealth(serverUrl: string, token?: string, timeoutMs?: number, options?: {
|
|
42
|
+
allowInsecureHttp?: boolean;
|
|
43
|
+
}): Promise<RemoteHealthResult>;
|
|
32
44
|
export declare function executeRemoteAction<T = unknown>(serverUrl: string, actionId: string, input?: unknown, configOverridesOrOptions?: Record<string, unknown> | RemoteExecuteOptions, tokenArg?: string): Promise<RemoteExecutionResult<T>>;
|
|
33
|
-
export declare function fetchRemoteRun(serverUrl: string, runId: string, token?: string
|
|
34
|
-
|
|
45
|
+
export declare function fetchRemoteRun(serverUrl: string, runId: string, token?: string, options?: {
|
|
46
|
+
allowInsecureHttp?: boolean;
|
|
47
|
+
}): Promise<RunRecord>;
|
|
48
|
+
export declare function cancelRemoteRun(serverUrl: string, runId: string, token?: string, reason?: string, options?: {
|
|
49
|
+
allowInsecureHttp?: boolean;
|
|
50
|
+
}): Promise<{
|
|
35
51
|
ok: boolean;
|
|
36
52
|
runId: string;
|
|
37
53
|
status: string;
|
|
38
54
|
}>;
|
|
39
|
-
export declare function fetchRemoteActions(serverUrl: string, token?: string, intent?: string
|
|
55
|
+
export declare function fetchRemoteActions(serverUrl: string, token?: string, intent?: string, options?: {
|
|
56
|
+
allowInsecureHttp?: boolean;
|
|
57
|
+
}): Promise<Array<{
|
|
40
58
|
id: string;
|
|
41
59
|
description: string;
|
|
42
60
|
packageId?: string;
|
|
43
61
|
}>>;
|
|
44
|
-
export declare function fetchRemoteActionShow(serverUrl: string, actionId: string, token?: string
|
|
62
|
+
export declare function fetchRemoteActionShow(serverUrl: string, actionId: string, token?: string, options?: {
|
|
63
|
+
allowInsecureHttp?: boolean;
|
|
64
|
+
}): Promise<any>;
|
|
45
65
|
export declare function fetchRemoteInfo(serverUrl: string, token?: string, options?: {
|
|
46
66
|
intent?: string;
|
|
47
67
|
package?: string;
|
|
48
68
|
tree?: boolean;
|
|
69
|
+
allowInsecureHttp?: boolean;
|
|
70
|
+
}): Promise<any>;
|
|
71
|
+
export declare function fetchRemoteDoctor(serverUrl: string, token?: string, targetPackage?: string, options?: {
|
|
72
|
+
allowInsecureHttp?: boolean;
|
|
49
73
|
}): Promise<any>;
|
|
50
|
-
export declare function fetchRemoteDoctor(serverUrl: string, token?: string, targetPackage?: string): Promise<any>;
|
|
51
74
|
export declare function fetchRemotePlaybooks(serverUrl: string, token?: string, options?: {
|
|
52
75
|
intent?: string;
|
|
53
76
|
package?: string;
|
|
77
|
+
allowInsecureHttp?: boolean;
|
|
54
78
|
}): Promise<Array<{
|
|
55
79
|
id: string;
|
|
56
80
|
description: string;
|
|
@@ -58,13 +82,16 @@ export declare function fetchRemotePlaybooks(serverUrl: string, token?: string,
|
|
|
58
82
|
packageId: string;
|
|
59
83
|
filePath: string;
|
|
60
84
|
}>>;
|
|
61
|
-
export declare function fetchRemotePlaybookShow(serverUrl: string, playbookId: string, token?: string
|
|
85
|
+
export declare function fetchRemotePlaybookShow(serverUrl: string, playbookId: string, token?: string, options?: {
|
|
86
|
+
allowInsecureHttp?: boolean;
|
|
87
|
+
}): Promise<any>;
|
|
62
88
|
export declare function fetchRemoteRuns(serverUrl: string, token?: string, options?: {
|
|
63
89
|
status?: string;
|
|
64
90
|
actionId?: string;
|
|
65
91
|
packageId?: string;
|
|
66
92
|
intent?: string;
|
|
67
93
|
limit?: number;
|
|
94
|
+
allowInsecureHttp?: boolean;
|
|
68
95
|
}): Promise<{
|
|
69
96
|
ok: boolean;
|
|
70
97
|
total: number;
|
|
@@ -74,14 +101,17 @@ export declare function clearRemoteRuns(serverUrl: string, token?: string, optio
|
|
|
74
101
|
packageId?: string;
|
|
75
102
|
actionId?: string;
|
|
76
103
|
status?: string;
|
|
104
|
+
allowInsecureHttp?: boolean;
|
|
77
105
|
}): Promise<{
|
|
78
106
|
ok: boolean;
|
|
79
107
|
clearedCount: number;
|
|
80
108
|
}>;
|
|
81
109
|
export declare function fetchRemoteStateList(serverUrl: string, token?: string, options?: {
|
|
82
110
|
package?: string;
|
|
111
|
+
action?: string;
|
|
83
112
|
namespace?: string;
|
|
84
113
|
prefix?: string;
|
|
114
|
+
allowInsecureHttp?: boolean;
|
|
85
115
|
}): Promise<{
|
|
86
116
|
ok: boolean;
|
|
87
117
|
packageId: string;
|
|
@@ -89,28 +119,44 @@ export declare function fetchRemoteStateList(serverUrl: string, token?: string,
|
|
|
89
119
|
}>;
|
|
90
120
|
export declare function getRemoteStateKey(serverUrl: string, key: string, token?: string, options?: {
|
|
91
121
|
package?: string;
|
|
122
|
+
action?: string;
|
|
92
123
|
namespace?: string;
|
|
124
|
+
allowInsecureHttp?: boolean;
|
|
93
125
|
}): Promise<any>;
|
|
94
126
|
export declare function setRemoteStateKey(serverUrl: string, key: string, value: unknown, token?: string, options?: {
|
|
95
127
|
package?: string;
|
|
128
|
+
action?: string;
|
|
96
129
|
namespace?: string;
|
|
97
130
|
ttl?: number;
|
|
131
|
+
allowInsecureHttp?: boolean;
|
|
98
132
|
}): Promise<any>;
|
|
99
133
|
export declare function deleteRemoteStateKey(serverUrl: string, key: string, token?: string, options?: {
|
|
100
134
|
package?: string;
|
|
135
|
+
action?: string;
|
|
101
136
|
namespace?: string;
|
|
137
|
+
allowInsecureHttp?: boolean;
|
|
102
138
|
}): Promise<any>;
|
|
103
139
|
export declare function clearRemoteState(serverUrl: string, token?: string, options?: {
|
|
104
140
|
package?: string;
|
|
141
|
+
action?: string;
|
|
105
142
|
namespace?: string;
|
|
106
143
|
prefix?: string;
|
|
107
144
|
all?: boolean;
|
|
145
|
+
allowInsecureHttp?: boolean;
|
|
108
146
|
}): Promise<{
|
|
109
147
|
ok: boolean;
|
|
110
148
|
packageId: string;
|
|
111
149
|
clearedCount: number;
|
|
112
150
|
}>;
|
|
113
|
-
export declare function fetchRemoteConfig(serverUrl: string, token?: string, packageId?: string
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
export declare function
|
|
151
|
+
export declare function fetchRemoteConfig(serverUrl: string, token?: string, packageId?: string, options?: {
|
|
152
|
+
allowInsecureHttp?: boolean;
|
|
153
|
+
}): Promise<any>;
|
|
154
|
+
export declare function setRemoteConfig(serverUrl: string, key: string, value: unknown, token?: string, packageId?: string, options?: {
|
|
155
|
+
allowInsecureHttp?: boolean;
|
|
156
|
+
}): Promise<any>;
|
|
157
|
+
export declare function deleteRemoteConfig(serverUrl: string, key: string, token?: string, packageId?: string, options?: {
|
|
158
|
+
allowInsecureHttp?: boolean;
|
|
159
|
+
}): Promise<any>;
|
|
160
|
+
export declare function fetchRemoteConfigEnv(serverUrl: string, token?: string, packageId?: string, options?: {
|
|
161
|
+
allowInsecureHttp?: boolean;
|
|
162
|
+
}): Promise<any>;
|