@actiondock/core 2.0.11 → 2.0.12
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/build/templates.d.ts +19 -0
- package/dist/catalog/action-index.d.ts +9 -0
- package/dist/catalog/action-resolver.d.ts +20 -0
- package/dist/catalog/location-registry.d.ts +15 -0
- package/dist/catalog/package-catalog.d.ts +7 -0
- package/dist/catalog/types.d.ts +68 -0
- package/dist/doctor/doctor.d.ts +6 -0
- package/dist/doctor/types.d.ts +23 -0
- package/dist/execution/index.d.ts +2 -0
- package/dist/execution/service.d.ts +74 -0
- package/dist/execution/types.d.ts +74 -0
- package/dist/export/templates.d.ts +33 -0
- package/dist/filter/intent.d.ts +33 -0
- package/{src/index.ts → dist/index.d.ts} +1 -1
- package/dist/index.js +8458 -0
- package/dist/profile/client.d.ts +116 -0
- package/dist/profile/manager.d.ts +47 -0
- package/dist/profile/types.d.ts +61 -0
- package/dist/project/closure.d.ts +25 -0
- package/{src/project/index.ts → dist/project/index.d.ts} +1 -0
- package/dist/project/init.d.ts +27 -0
- package/dist/project/loader.d.ts +105 -0
- package/dist/project/manifest.d.ts +44 -0
- package/dist/project/types.d.ts +131 -0
- package/dist/registry/registry.d.ts +24 -0
- package/dist/registry/types.d.ts +117 -0
- package/dist/runtime/clock.d.ts +21 -0
- package/dist/runtime/context.d.ts +75 -0
- package/dist/runtime/env.d.ts +54 -0
- package/dist/runtime/events.d.ts +61 -0
- package/dist/runtime/execution-manager.d.ts +48 -0
- package/{src/runtime/index.ts → dist/runtime/index.d.ts} +0 -1
- package/dist/runtime/module-loader.d.ts +42 -0
- package/dist/runtime/process.d.ts +11 -0
- package/dist/runtime/runner.d.ts +186 -0
- package/dist/runtime/standalone.d.ts +40 -0
- package/dist/schema/validator.d.ts +28 -0
- package/dist/server/body.d.ts +40 -0
- package/{src/server/index.ts → dist/server/index.d.ts} +0 -1
- package/dist/server/routes/actions.d.ts +5 -0
- package/dist/server/routes/common.d.ts +36 -0
- package/dist/server/routes/config.d.ts +5 -0
- package/dist/server/routes/doctor.d.ts +5 -0
- package/dist/server/routes/health.d.ts +5 -0
- package/dist/server/routes/info.d.ts +5 -0
- package/dist/server/routes/playbooks.d.ts +5 -0
- package/dist/server/routes/runs.d.ts +5 -0
- package/dist/server/routes/state.d.ts +5 -0
- package/dist/server/runtime-registry.d.ts +78 -0
- package/dist/server/security.d.ts +37 -0
- package/dist/server/server.d.ts +15 -0
- package/dist/server/types.d.ts +59 -0
- package/dist/storage/driver.d.ts +15 -0
- package/dist/storage/index.d.ts +44 -0
- package/{src/storage/mask.ts → dist/storage/mask.d.ts} +5 -20
- package/dist/storage/sqlite.d.ts +66 -0
- package/dist/storage/types.d.ts +121 -0
- package/dist/utils/index.d.ts +29 -0
- package/dist/version.d.ts +4 -0
- package/package.json +11 -10
- package/src/build/templates.ts +0 -59
- package/src/catalog/action-index.ts +0 -92
- package/src/catalog/action-resolver.ts +0 -120
- package/src/catalog/location-registry.ts +0 -134
- package/src/catalog/package-catalog.ts +0 -87
- package/src/catalog/types.ts +0 -75
- package/src/doctor/doctor.ts +0 -419
- package/src/doctor/types.ts +0 -25
- package/src/execution/index.ts +0 -2
- package/src/execution/service.ts +0 -322
- package/src/execution/types.ts +0 -73
- package/src/export/templates.ts +0 -590
- package/src/filter/intent.ts +0 -154
- package/src/profile/client.ts +0 -552
- package/src/profile/manager.ts +0 -341
- package/src/profile/types.ts +0 -71
- package/src/project/init.ts +0 -242
- package/src/project/loader.ts +0 -479
- package/src/project/manifest.ts +0 -299
- package/src/project/types.ts +0 -141
- package/src/registry/registry.ts +0 -940
- package/src/registry/types.ts +0 -127
- package/src/runtime/clock.ts +0 -41
- package/src/runtime/context.ts +0 -259
- package/src/runtime/env.ts +0 -172
- package/src/runtime/events.ts +0 -142
- package/src/runtime/execution-manager.ts +0 -74
- package/src/runtime/module-loader.ts +0 -67
- package/src/runtime/process.ts +0 -245
- package/src/runtime/runner.ts +0 -527
- package/src/runtime/standalone.ts +0 -429
- package/src/schema/validator.ts +0 -61
- package/src/server/body.ts +0 -112
- package/src/server/routes/actions.ts +0 -262
- package/src/server/routes/common.ts +0 -126
- package/src/server/routes/config.ts +0 -147
- package/src/server/routes/doctor.ts +0 -29
- package/src/server/routes/health.ts +0 -40
- package/src/server/routes/info.ts +0 -221
- package/src/server/routes/playbooks.ts +0 -109
- package/src/server/routes/runs.ts +0 -301
- package/src/server/routes/state.ts +0 -133
- package/src/server/runtime-registry.ts +0 -115
- package/src/server/security.ts +0 -115
- package/src/server/server.ts +0 -251
- package/src/server/types.ts +0 -57
- package/src/storage/driver.ts +0 -126
- package/src/storage/index.ts +0 -81
- package/src/storage/sqlite.ts +0 -714
- package/src/storage/types.ts +0 -139
- package/src/utils/index.ts +0 -62
- /package/{src/build/index.ts → dist/build/index.d.ts} +0 -0
- /package/{src/catalog/index.ts → dist/catalog/index.d.ts} +0 -0
- /package/{src/doctor/index.ts → dist/doctor/index.d.ts} +0 -0
- /package/{src/export/index.ts → dist/export/index.d.ts} +0 -0
- /package/{src/filter/index.ts → dist/filter/index.d.ts} +0 -0
- /package/{src/profile/index.ts → dist/profile/index.d.ts} +0 -0
- /package/{src/registry/index.ts → dist/registry/index.d.ts} +0 -0
- /package/{src/server/routes/index.ts → dist/server/routes/index.d.ts} +0 -0
package/src/storage/types.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import type { JsonValue, RuntimeError, RunRecord } from "@actiondock/sdk";
|
|
2
|
-
import type { Clock } from "../runtime/clock";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* SQLite 基础参数值类型。
|
|
6
|
-
*/
|
|
7
|
-
export type SqlValue = null | number | string | Uint8Array;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* SQLite 位置参数数组。
|
|
11
|
-
*/
|
|
12
|
-
export type SqlParams = readonly SqlValue[];
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 编译后的 SQLite 参数化语句接口。
|
|
16
|
-
*/
|
|
17
|
-
export interface SqliteStatement {
|
|
18
|
-
run(...params: any[]): { changes: number; lastInsertRowid?: number | bigint };
|
|
19
|
-
get<T>(...params: any[]): T | undefined;
|
|
20
|
-
all<T>(...params: any[]): T[];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* 统一 SQLite 驱动层接口。
|
|
25
|
-
*/
|
|
26
|
-
export interface SqliteDriver {
|
|
27
|
-
exec(sql: string): void;
|
|
28
|
-
prepare(sql: string): SqliteStatement;
|
|
29
|
-
transaction<T>(fn: () => T extends PromiseLike<unknown> ? never : T): T;
|
|
30
|
-
close(): void;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 数据库中存储的配置条目实体。
|
|
35
|
-
*/
|
|
36
|
-
export interface ConfigEntry {
|
|
37
|
-
/** 所属 Package ID */
|
|
38
|
-
packageId: string;
|
|
39
|
-
/** 配置键名 */
|
|
40
|
-
key: string;
|
|
41
|
-
/** 配置值(JSON 序列化存储) */
|
|
42
|
-
value: unknown;
|
|
43
|
-
/** 最近更新时间(ISO 8601 格式) */
|
|
44
|
-
updatedAt: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 数据库中存储的状态条目实体。
|
|
49
|
-
*/
|
|
50
|
-
export interface StateEntry {
|
|
51
|
-
/** 所属 Package ID */
|
|
52
|
-
packageId: string;
|
|
53
|
-
/** 状态隔离命名空间 */
|
|
54
|
-
namespace: string;
|
|
55
|
-
/** 状态键名 */
|
|
56
|
-
key: string;
|
|
57
|
-
/** 复合完整键名 */
|
|
58
|
-
fullKey: string;
|
|
59
|
-
/** 状态值(JSON 序列化存储) */
|
|
60
|
-
value: unknown;
|
|
61
|
-
/** 最近更新时间(ISO 8601 格式) */
|
|
62
|
-
updatedAt: string;
|
|
63
|
-
/** 自动过期时间戳(ISO 8601 格式,null/undefined 表示不过期) */
|
|
64
|
-
expiresAt?: string;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 初始化存储引擎所需的选项。
|
|
69
|
-
*/
|
|
70
|
-
export interface StorageOptions {
|
|
71
|
-
/** SQLite 数据库文件绝对路径,或 ":memory:" 表示内存数据库 */
|
|
72
|
-
dbPath?: string;
|
|
73
|
-
/** 所绑定的 Package ID */
|
|
74
|
-
packageId: string;
|
|
75
|
-
/** 显式注入的 SQLite 底层驱动 */
|
|
76
|
-
driver?: SqliteDriver;
|
|
77
|
-
/** 可选注入的时间提供器,便于与模拟时钟联动 */
|
|
78
|
-
clock?: Clock;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Action 执行终态枚举。
|
|
83
|
-
*/
|
|
84
|
-
export type TerminalRunStatus =
|
|
85
|
-
| "success"
|
|
86
|
-
| "failed"
|
|
87
|
-
| "cancelled"
|
|
88
|
-
| "timed_out"
|
|
89
|
-
| "interrupted";
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* 统一运行时存储抽象接口。
|
|
93
|
-
*/
|
|
94
|
-
export interface RuntimeStorage {
|
|
95
|
-
/** 数据库是否处于打开状态 */
|
|
96
|
-
readonly isOpen?: boolean;
|
|
97
|
-
/** 数据库是否已关闭 */
|
|
98
|
-
readonly closed?: boolean;
|
|
99
|
-
|
|
100
|
-
// --- Config 配置管理 ---
|
|
101
|
-
getConfig<T = unknown>(key: string): T | undefined;
|
|
102
|
-
listConfig(): Record<string, unknown>;
|
|
103
|
-
setConfig(key: string, value: unknown): void;
|
|
104
|
-
deleteConfig(key: string): boolean;
|
|
105
|
-
|
|
106
|
-
// --- State 状态管理 ---
|
|
107
|
-
getState<T = unknown>(namespace: string, key: string): Promise<T | undefined>;
|
|
108
|
-
findState<T = unknown>(
|
|
109
|
-
targetKey: string,
|
|
110
|
-
namespace?: string
|
|
111
|
-
): Promise<StateEntry | undefined>;
|
|
112
|
-
setState<T = unknown>(
|
|
113
|
-
namespace: string,
|
|
114
|
-
key: string,
|
|
115
|
-
value: T,
|
|
116
|
-
ttl?: number
|
|
117
|
-
): Promise<void>;
|
|
118
|
-
deleteState(namespace: string, key: string): Promise<boolean>;
|
|
119
|
-
deleteStateSmart(targetKey: string, namespace?: string): Promise<boolean>;
|
|
120
|
-
clearState(options?: { namespace?: string; all?: boolean; prefix?: string }): Promise<number>;
|
|
121
|
-
listStateKeys(namespace?: string | null, prefix?: string): Promise<string[]>;
|
|
122
|
-
listStateEntries(options?: { namespace?: string; prefix?: string }): Promise<StateEntry[]>;
|
|
123
|
-
|
|
124
|
-
// --- Runs 运行记录管理 ---
|
|
125
|
-
createRun(record: RunRecord): void;
|
|
126
|
-
updateRun(
|
|
127
|
-
id: string,
|
|
128
|
-
status: TerminalRunStatus,
|
|
129
|
-
output?: unknown,
|
|
130
|
-
error?: RuntimeError,
|
|
131
|
-
finishedAt?: string
|
|
132
|
-
): void;
|
|
133
|
-
getRun(id: string): RunRecord | null;
|
|
134
|
-
listRuns(options?: { actionId?: string; limit?: number }): RunRecord[];
|
|
135
|
-
clearRuns(options?: { actionId?: string; status?: string }): number;
|
|
136
|
-
|
|
137
|
-
/** 关闭底层 SQLite 数据库连接并释放句柄 */
|
|
138
|
-
close(): void;
|
|
139
|
-
}
|
package/src/utils/index.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { homedir } from "node:os";
|
|
2
|
-
|
|
3
|
-
export { findExecutable } from "@actiondock/sdk";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Parses duration strings like "500ms", "30s", "5m", "1h", "1d" or pure numbers into milliseconds.
|
|
7
|
-
*/
|
|
8
|
-
export function parseDuration(input?: string): number | undefined {
|
|
9
|
-
if (!input || !input.trim()) {
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const str = input.trim();
|
|
14
|
-
if (/^\d+$/.test(str)) {
|
|
15
|
-
return parseInt(str, 10);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const match = str.match(/^(\d+(?:\.\d+)?)\s*(ms|s|m|h|d)$/i);
|
|
19
|
-
if (!match) {
|
|
20
|
-
throw new Error(
|
|
21
|
-
`Invalid duration format: '${input}'. Supported formats: 500ms, 30s, 5m, 1h`
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const val = parseFloat(match[1]);
|
|
26
|
-
const unit = match[2].toLowerCase();
|
|
27
|
-
|
|
28
|
-
switch (unit) {
|
|
29
|
-
case "ms":
|
|
30
|
-
return Math.round(val);
|
|
31
|
-
case "s":
|
|
32
|
-
return Math.round(val * 1000);
|
|
33
|
-
case "m":
|
|
34
|
-
return Math.round(val * 60 * 1000);
|
|
35
|
-
case "h":
|
|
36
|
-
return Math.round(val * 60 * 60 * 1000);
|
|
37
|
-
case "d":
|
|
38
|
-
return Math.round(val * 24 * 60 * 60 * 1000);
|
|
39
|
-
default:
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Extracts a concise slug from a package or action identifier (e.g. '@scope/pkg' -> 'pkg', 'team.action' -> 'action').
|
|
46
|
-
*/
|
|
47
|
-
export function getPackageSlug(id: string): string {
|
|
48
|
-
if (id.includes("/")) {
|
|
49
|
-
return id.split("/").pop()!;
|
|
50
|
-
}
|
|
51
|
-
if (id.includes(".")) {
|
|
52
|
-
return id.split(".").pop()!;
|
|
53
|
-
}
|
|
54
|
-
return id;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Resolves the root ActionDock user home directory based on customHome, ACTIONDOCK_HOME, or user homedir.
|
|
59
|
-
*/
|
|
60
|
-
export function getActionDockHome(customHome?: string): string {
|
|
61
|
-
return customHome || process.env.ACTIONDOCK_HOME || homedir();
|
|
62
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|