@actiondock/core 2.2.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +8 -3
  2. package/dist/app/app.d.ts +2 -0
  3. package/dist/app/app.js +6 -0
  4. package/dist/app/types.d.ts +12 -0
  5. package/dist/errors.d.ts +38 -0
  6. package/dist/errors.js +44 -0
  7. package/dist/execution/service.d.ts +2 -0
  8. package/dist/execution/service.js +13 -2
  9. package/dist/execution/types.d.ts +17 -0
  10. package/dist/host/host.js +46 -5
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +1 -0
  13. package/dist/ipc/host.d.ts +5 -0
  14. package/dist/ipc/host.js +43 -1
  15. package/dist/ipc/target.d.ts +18 -0
  16. package/dist/ipc/target.js +74 -6
  17. package/dist/ipc/types.d.ts +10 -1
  18. package/dist/platform/default.d.ts +7 -1
  19. package/dist/platform/default.js +40 -2
  20. package/dist/process/context-process.d.ts +83 -0
  21. package/dist/process/context-process.js +168 -0
  22. package/dist/process/cursor.d.ts +52 -0
  23. package/dist/process/cursor.js +144 -0
  24. package/dist/process/driver.d.ts +214 -0
  25. package/dist/process/driver.js +197 -0
  26. package/dist/process/index.d.ts +6 -0
  27. package/dist/process/index.js +6 -0
  28. package/dist/process/metadata-store.d.ts +205 -0
  29. package/dist/process/metadata-store.js +462 -0
  30. package/dist/process/output-log.d.ts +136 -0
  31. package/dist/process/output-log.js +331 -0
  32. package/dist/process/process-manager.d.ts +279 -0
  33. package/dist/process/process-manager.js +1879 -0
  34. package/dist/profile/client.js +63 -21
  35. package/dist/project/init.js +2 -2
  36. package/dist/registry/registry.js +12 -3
  37. package/dist/runtime/context.d.ts +9 -6
  38. package/dist/runtime/context.js +31 -8
  39. package/dist/runtime/process.d.ts +19 -2
  40. package/dist/runtime/process.js +103 -131
  41. package/dist/runtime/runner.d.ts +45 -24
  42. package/dist/runtime/runner.js +106 -25
  43. package/dist/target/remote.js +7 -0
  44. package/dist/version.d.ts +1 -1
  45. package/dist/version.js +1 -1
  46. package/package.json +2 -2
@@ -0,0 +1,214 @@
1
+ import type { Capabilities, LaunchSpec } from "@actiondock/sdk";
2
+ /**
3
+ * 进程驱动实例底层控制句柄接口。
4
+ */
5
+ export interface ProcessDriverHandle {
6
+ /**
7
+ * 向受管进程标准输入通道写入原始字节数据。
8
+ *
9
+ * @param data 原始字节切片
10
+ */
11
+ write(data: Uint8Array): Promise<void>;
12
+ /**
13
+ * 关闭标准输入流发送 EOF 信号。
14
+ */
15
+ sendInputEOF?(): Promise<void>;
16
+ /**
17
+ * 向进程前台作业组发送中断信号。
18
+ */
19
+ interruptForeground?(): Promise<void>;
20
+ /**
21
+ * 动态调整伪终端窗口尺寸。
22
+ *
23
+ * @param cols 列数
24
+ * @param rows 行数
25
+ */
26
+ resize?(cols: number, rows: number): Promise<void>;
27
+ /**
28
+ * 优雅终止或强制终止底层进程。
29
+ *
30
+ * @param graceMs 优雅退出宽限时限(毫秒)
31
+ */
32
+ terminate(graceMs: number): Promise<{
33
+ code: number | null;
34
+ signal: string | null;
35
+ } | void>;
36
+ }
37
+ /**
38
+ * 进程驱动底层事件回调接口。
39
+ */
40
+ export interface ProcessDriverCallbacks {
41
+ /**
42
+ * 接收来自进程的原始输出字节切片。
43
+ *
44
+ * @param stream 输出流来源标签
45
+ * @param data 原始字节切片
46
+ */
47
+ onOutput(stream: "stdout" | "stderr" | "pty", data: Uint8Array): void;
48
+ /**
49
+ * 进程退出时触发。
50
+ *
51
+ * @param exit 退出状态码与信号
52
+ */
53
+ onExit(exit: {
54
+ code: number | null;
55
+ signal: string | null;
56
+ }): void;
57
+ /**
58
+ * 输出通道彻底关闭时触发。
59
+ *
60
+ * @param reason 关闭原因:自然关闭、drain 超时或宿主丢失
61
+ */
62
+ onOutputClosed?(reason: "natural" | "drain-timeout" | "host-lost"): void;
63
+ /**
64
+ * 进程发生底层错误时触发。
65
+ *
66
+ * @param err 异常对象
67
+ */
68
+ onError(err: Error): void;
69
+ }
70
+ /**
71
+ * 默认允许继承的环境变量白名单。
72
+ */
73
+ export declare const DEFAULT_ENV_ALLOWLIST: readonly string[];
74
+ /**
75
+ * 解析并生成子进程生效环境变量集合。
76
+ *
77
+ * @param envConfig 启动规范中的环境变量配置
78
+ * @param hostEnv 宿主环境变量字典,默认为 process.env
79
+ */
80
+ export declare function resolveProcessEnv(envConfig?: LaunchSpec["env"], hostEnv?: Record<string, string | undefined>): Record<string, string>;
81
+ /**
82
+ * 进程观察者接口,接收来自底层驱动的流输出与生命周期通知。
83
+ */
84
+ export interface ProcessObserver {
85
+ /**
86
+ * 接收来自进程的输出数据。
87
+ *
88
+ * @param stream 输出流类型
89
+ * @param data 原始字节切片
90
+ */
91
+ output(stream: "stdout" | "stderr" | "pty", data: Uint8Array): void;
92
+ /**
93
+ * 进程退出通知。
94
+ *
95
+ * @param result 退出状态码与信号
96
+ */
97
+ exited(result: {
98
+ code: number | null;
99
+ signal: string | null;
100
+ }): void;
101
+ /**
102
+ * 输出流彻底关闭通知。
103
+ *
104
+ * @param reason 关闭原因:自然关闭、drain 超时或宿主丢失
105
+ */
106
+ outputClosed(reason: "natural" | "drain-timeout" | "host-lost"): void;
107
+ /**
108
+ * 底层驱动故障通知。
109
+ *
110
+ * @param error 故障异常对象
111
+ */
112
+ fault?(error: Error): void;
113
+ }
114
+ /**
115
+ * 进程驱动句柄接口。
116
+ */
117
+ export interface ProcessHandle {
118
+ /** 句柄唯一标识 */
119
+ readonly id: string;
120
+ /** 操作系统进程标识符(若可用) */
121
+ readonly pid?: number;
122
+ }
123
+ /**
124
+ * 受管进程底层执行驱动接口。
125
+ */
126
+ export interface ProcessDriver {
127
+ /**
128
+ * 查询当前驱动支持的运行时能力集快照。
129
+ */
130
+ getCapabilities(): Capabilities;
131
+ /**
132
+ * 依据《Managed Process 设计 v2》标准接口派生新进程。
133
+ *
134
+ * @param spec 进程启动规范
135
+ * @param observer 进程生命周期与输出观察者
136
+ */
137
+ spawn(spec: LaunchSpec, observer: ProcessObserver): Promise<ProcessHandle>;
138
+ /**
139
+ * 兼容旧版基于 processId 派生新进程签名。
140
+ */
141
+ spawn(processId: string, spec: LaunchSpec, callbacks: ProcessDriverCallbacks): Promise<ProcessDriverHandle>;
142
+ /**
143
+ * 向受管进程标准输入写入字节数据。
144
+ *
145
+ * @param handle 进程句柄
146
+ * @param data 原始字节数据
147
+ */
148
+ write?(handle: ProcessHandle, data: Uint8Array): Promise<void>;
149
+ /**
150
+ * 关闭标准输入流发送 EOF 信号。
151
+ */
152
+ inputEOF?(handle: ProcessHandle): Promise<void>;
153
+ /**
154
+ * 向进程前台作业组发送中断信号。
155
+ */
156
+ interruptForeground?(handle: ProcessHandle): Promise<void>;
157
+ /**
158
+ * 动态调整终端窗口尺寸。
159
+ */
160
+ resize?(handle: ProcessHandle, cols: number, rows: number): Promise<void>;
161
+ /**
162
+ * 优雅终止或强制终止底层进程。
163
+ */
164
+ terminate(handle: ProcessHandle, graceMs: number): Promise<void>;
165
+ terminate(processId: string, graceMs: number): Promise<void>;
166
+ /**
167
+ * 销毁进程句柄并清理关联资源。
168
+ */
169
+ dispose?(handle: ProcessHandle): Promise<void>;
170
+ }
171
+ /**
172
+ * 内存模拟进程驱动实现,专用于确定性测试与离线环境。
173
+ */
174
+ export declare class MemoryProcessDriver implements ProcessDriver {
175
+ private capabilities;
176
+ handles: Map<string, MemoryProcessDriverHandle>;
177
+ spawnHook?: (processId: string, spec: LaunchSpec, callbacks: ProcessDriverCallbacks) => Promise<MemoryProcessDriverHandle | void> | MemoryProcessDriverHandle | void;
178
+ constructor(capabilities?: Partial<Capabilities>);
179
+ getCapabilities(): Capabilities;
180
+ setCapabilities(caps: Partial<Capabilities>): void;
181
+ spawn(specOrProcessId: LaunchSpec | string, observerOrSpec: ProcessObserver | LaunchSpec, maybeCallbacks?: ProcessDriverCallbacks): Promise<any>;
182
+ terminate(handleOrId: ProcessHandle | string, graceMs: number): Promise<void>;
183
+ }
184
+ /**
185
+ * 内存模拟进程驱动句柄实现。
186
+ */
187
+ export declare class MemoryProcessDriverHandle implements ProcessDriverHandle, ProcessHandle {
188
+ readonly id: string;
189
+ readonly processId: string;
190
+ readonly spec: LaunchSpec;
191
+ readonly callbacks: ProcessDriverCallbacks;
192
+ writtenChunks: Uint8Array[];
193
+ eofSent: boolean;
194
+ interrupted: boolean;
195
+ currentSize?: {
196
+ cols: number;
197
+ rows: number;
198
+ };
199
+ terminated: boolean;
200
+ writeFailureError?: Error;
201
+ constructor(processId: string, spec: LaunchSpec, callbacks: ProcessDriverCallbacks);
202
+ write(data: Uint8Array): Promise<void>;
203
+ sendInputEOF(): Promise<void>;
204
+ interruptForeground(): Promise<void>;
205
+ resize(cols: number, rows: number): Promise<void>;
206
+ terminate(graceMs: number): Promise<{
207
+ code: number | null;
208
+ signal: string | null;
209
+ }>;
210
+ emitOutput(stream: "stdout" | "stderr" | "pty", textOrBytes: string | Uint8Array): void;
211
+ emitExit(code?: number | null, signal?: string | null): void;
212
+ emitOutputClosed(reason?: "natural" | "drain-timeout" | "host-lost"): void;
213
+ emitError(err: Error): void;
214
+ }
@@ -0,0 +1,197 @@
1
+ /**
2
+ * 默认允许继承的环境变量白名单。
3
+ */
4
+ export const DEFAULT_ENV_ALLOWLIST = Object.freeze([
5
+ "PATH",
6
+ "PATHEXT",
7
+ "HOME",
8
+ "USER",
9
+ "LOGNAME",
10
+ "SHELL",
11
+ "LANG",
12
+ "LC_ALL",
13
+ "LC_CTYPE",
14
+ "TERM",
15
+ "TZ",
16
+ "TMPDIR",
17
+ "TMP",
18
+ "TEMP",
19
+ "SYSTEMROOT",
20
+ "SYSTEMDRIVE",
21
+ "COMSPEC",
22
+ "APPDATA",
23
+ "LOCALAPPDATA",
24
+ "USERPROFILE",
25
+ "HOMEDRIVE",
26
+ "HOMEPATH",
27
+ "WINDIR",
28
+ ]);
29
+ /**
30
+ * 解析并生成子进程生效环境变量集合。
31
+ *
32
+ * @param envConfig 启动规范中的环境变量配置
33
+ * @param hostEnv 宿主环境变量字典,默认为 process.env
34
+ */
35
+ export function resolveProcessEnv(envConfig, hostEnv = process.env) {
36
+ const inherit = envConfig?.inherit ?? "allowlisted";
37
+ const result = {};
38
+ if (inherit === "allowlisted") {
39
+ const isWin = process.platform === "win32";
40
+ const allowSet = new Set(DEFAULT_ENV_ALLOWLIST.map((key) => (isWin ? key.toUpperCase() : key)));
41
+ for (const [key, value] of Object.entries(hostEnv)) {
42
+ if (value === undefined)
43
+ continue;
44
+ const lookupKey = isWin ? key.toUpperCase() : key;
45
+ if (allowSet.has(lookupKey)) {
46
+ result[key] = value;
47
+ }
48
+ }
49
+ }
50
+ if (envConfig?.set) {
51
+ for (const [key, value] of Object.entries(envConfig.set)) {
52
+ result[key] = value;
53
+ }
54
+ }
55
+ if (envConfig?.unset) {
56
+ const isWin = process.platform === "win32";
57
+ for (const unsetKey of envConfig.unset) {
58
+ if (isWin) {
59
+ const unsetUpper = unsetKey.toUpperCase();
60
+ for (const existingKey of Object.keys(result)) {
61
+ if (existingKey.toUpperCase() === unsetUpper) {
62
+ delete result[existingKey];
63
+ }
64
+ }
65
+ }
66
+ else {
67
+ delete result[unsetKey];
68
+ }
69
+ }
70
+ }
71
+ return result;
72
+ }
73
+ /**
74
+ * 内存模拟进程驱动实现,专用于确定性测试与离线环境。
75
+ */
76
+ export class MemoryProcessDriver {
77
+ capabilities;
78
+ handles = new Map();
79
+ spawnHook;
80
+ constructor(capabilities) {
81
+ this.capabilities = {
82
+ pty: true,
83
+ resize: true,
84
+ inputEOF: true,
85
+ interruptForeground: true,
86
+ terminationScope: "process-tree",
87
+ ...capabilities,
88
+ };
89
+ }
90
+ getCapabilities() {
91
+ return { ...this.capabilities };
92
+ }
93
+ setCapabilities(caps) {
94
+ this.capabilities = { ...this.capabilities, ...caps };
95
+ }
96
+ async spawn(specOrProcessId, observerOrSpec, maybeCallbacks) {
97
+ if (typeof specOrProcessId === "string") {
98
+ const processId = specOrProcessId;
99
+ const spec = observerOrSpec;
100
+ const callbacks = maybeCallbacks;
101
+ if (this.spawnHook) {
102
+ const customHandle = await this.spawnHook(processId, spec, callbacks);
103
+ if (customHandle) {
104
+ this.handles.set(processId, customHandle);
105
+ return customHandle;
106
+ }
107
+ }
108
+ const handle = new MemoryProcessDriverHandle(processId, spec, callbacks);
109
+ this.handles.set(processId, handle);
110
+ return handle;
111
+ }
112
+ const spec = specOrProcessId;
113
+ const observer = observerOrSpec;
114
+ const processId = `mem-${Math.random().toString(36).slice(2, 10)}`;
115
+ const callbacks = {
116
+ onOutput(stream, data) {
117
+ observer.output(stream, data);
118
+ },
119
+ onExit(exit) {
120
+ observer.exited(exit);
121
+ },
122
+ onOutputClosed(reason) {
123
+ observer.outputClosed(reason ?? "natural");
124
+ },
125
+ onError(err) {
126
+ observer.fault?.(err);
127
+ },
128
+ };
129
+ const handle = new MemoryProcessDriverHandle(processId, spec, callbacks);
130
+ this.handles.set(processId, handle);
131
+ return handle;
132
+ }
133
+ async terminate(handleOrId, graceMs) {
134
+ const id = typeof handleOrId === "string" ? handleOrId : handleOrId.id;
135
+ const handle = this.handles.get(id);
136
+ if (handle) {
137
+ await handle.terminate(graceMs);
138
+ }
139
+ }
140
+ }
141
+ /**
142
+ * 内存模拟进程驱动句柄实现。
143
+ */
144
+ export class MemoryProcessDriverHandle {
145
+ id;
146
+ processId;
147
+ spec;
148
+ callbacks;
149
+ writtenChunks = [];
150
+ eofSent = false;
151
+ interrupted = false;
152
+ currentSize;
153
+ terminated = false;
154
+ writeFailureError;
155
+ constructor(processId, spec, callbacks) {
156
+ this.id = processId;
157
+ this.processId = processId;
158
+ this.spec = spec;
159
+ this.callbacks = callbacks;
160
+ }
161
+ async write(data) {
162
+ if (this.writeFailureError) {
163
+ throw this.writeFailureError;
164
+ }
165
+ this.writtenChunks.push(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
166
+ }
167
+ async sendInputEOF() {
168
+ this.eofSent = true;
169
+ }
170
+ async interruptForeground() {
171
+ this.interrupted = true;
172
+ }
173
+ async resize(cols, rows) {
174
+ this.currentSize = { cols, rows };
175
+ }
176
+ async terminate(graceMs) {
177
+ this.terminated = true;
178
+ const exitResult = { code: null, signal: "SIGTERM" };
179
+ this.callbacks.onExit(exitResult);
180
+ return exitResult;
181
+ }
182
+ emitOutput(stream, textOrBytes) {
183
+ const bytes = typeof textOrBytes === "string"
184
+ ? new TextEncoder().encode(textOrBytes)
185
+ : textOrBytes;
186
+ this.callbacks.onOutput(stream, bytes);
187
+ }
188
+ emitExit(code = 0, signal = null) {
189
+ this.callbacks.onExit({ code, signal });
190
+ }
191
+ emitOutputClosed(reason = "natural") {
192
+ this.callbacks.onOutputClosed?.(reason);
193
+ }
194
+ emitError(err) {
195
+ this.callbacks.onError(err);
196
+ }
197
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./cursor.js";
2
+ export * from "./output-log.js";
3
+ export * from "./metadata-store.js";
4
+ export * from "./driver.js";
5
+ export * from "./process-manager.js";
6
+ export * from "./context-process.js";
@@ -0,0 +1,6 @@
1
+ export * from "./cursor.js";
2
+ export * from "./output-log.js";
3
+ export * from "./metadata-store.js";
4
+ export * from "./driver.js";
5
+ export * from "./process-manager.js";
6
+ export * from "./context-process.js";
@@ -0,0 +1,205 @@
1
+ import type { SqliteDriver } from "../storage/types.js";
2
+ /**
3
+ * 受管进程运行状态。
4
+ */
5
+ export type ProcessState = "starting" | "running" | "stopping" | "stopped" | "failed" | "lost" | "killed" | "completed" | string;
6
+ /**
7
+ * 受管进程控制通道状态。
8
+ */
9
+ export type ProcessControlState = "open" | "closing" | "closed" | string;
10
+ /**
11
+ * 进程终止原因。
12
+ */
13
+ export type ProcessEndReason = "exit" | "host-lost" | "timeout" | "signal" | "error" | "killed" | string;
14
+ /**
15
+ * 进程输入输出配置。
16
+ */
17
+ export interface ProcessIOConfig {
18
+ [key: string]: unknown;
19
+ }
20
+ /**
21
+ * 进程能力集定义。
22
+ */
23
+ export interface ProcessCapabilities {
24
+ [key: string]: unknown;
25
+ }
26
+ /**
27
+ * 进程生效资源限制配置。
28
+ */
29
+ export interface ProcessEffectiveLimits {
30
+ [key: string]: unknown;
31
+ }
32
+ /**
33
+ * 受管进程核心模型信息。
34
+ */
35
+ export interface ProcessInfo {
36
+ processId: string;
37
+ hostEpoch: string;
38
+ state: ProcessState;
39
+ controlState?: ProcessControlState;
40
+ control?: ProcessControlState;
41
+ ioConfig?: ProcessIOConfig;
42
+ capabilities?: ProcessCapabilities;
43
+ createdAt?: string;
44
+ exitCode?: number | null;
45
+ exitSignal?: string | null;
46
+ endReason?: ProcessEndReason | null;
47
+ outputClosed?: boolean;
48
+ outputEndReason?: string | null;
49
+ /** 输入通道是否已发送 EOF 彻底关闭 */
50
+ inputClosed?: boolean;
51
+ effectiveLimits?: ProcessEffectiveLimits;
52
+ }
53
+ /**
54
+ * 带有归属所有者与请求凭据的持久化进程记录。
55
+ */
56
+ export type StoredProcessRecord = ProcessInfo & {
57
+ tenantId: string;
58
+ principalId: string;
59
+ packageInstanceId: string;
60
+ generationId: string;
61
+ startRequestId?: string;
62
+ };
63
+ /**
64
+ * 进程所有者过滤条件。
65
+ */
66
+ export interface ProcessOwnerFilter {
67
+ tenantId: string;
68
+ principalId: string;
69
+ packageInstanceId: string;
70
+ generationId: string;
71
+ }
72
+ /**
73
+ * 操作请求去重查询键。
74
+ */
75
+ export interface ProcessRequestKey {
76
+ hostEpoch: string;
77
+ scope: string;
78
+ processId?: string;
79
+ requestId: string;
80
+ }
81
+ /**
82
+ * 操作回执凭证。
83
+ */
84
+ export interface OperationReceipt {
85
+ status?: string;
86
+ result?: unknown;
87
+ error?: unknown;
88
+ timestamp?: string;
89
+ [key: string]: unknown;
90
+ }
91
+ /**
92
+ * 操作请求记录项。
93
+ */
94
+ export interface RequestRecord {
95
+ receipt: OperationReceipt;
96
+ payloadHash?: string;
97
+ createdAt?: string;
98
+ }
99
+ /**
100
+ * 受管进程元数据存储契约接口。
101
+ */
102
+ export interface ProcessMetadataStore {
103
+ /**
104
+ * 保存或替换受管进程元数据。
105
+ */
106
+ saveProcess(process: StoredProcessRecord): Promise<void>;
107
+ /**
108
+ * 按进程标识获取受管进程元数据详情。
109
+ */
110
+ getProcess(processId: string): Promise<StoredProcessRecord | undefined>;
111
+ /**
112
+ * 分页列出指定所有者归属下的受管进程列表。
113
+ */
114
+ listProcesses(owner: ProcessOwnerFilter, pageToken?: string, limit?: number): Promise<{
115
+ processes: ProcessInfo[];
116
+ nextPageToken?: string;
117
+ }>;
118
+ /**
119
+ * 局部更新受管进程状态字段。
120
+ */
121
+ updateProcessState(processId: string, patch: Partial<ProcessInfo>): Promise<void>;
122
+ /**
123
+ * 记录幂等请求与操作凭据。
124
+ */
125
+ recordRequest(key: ProcessRequestKey, receipt: OperationReceipt, payloadHash?: string): Promise<void>;
126
+ /**
127
+ * 获取幂等请求已记录的操作凭据。
128
+ */
129
+ getRequest(key: ProcessRequestKey): Promise<{
130
+ receipt: OperationReceipt;
131
+ payloadHash?: string;
132
+ } | undefined>;
133
+ /**
134
+ * 宿主生命周期初始化与故障收敛:
135
+ * 将所有不属于当前 hostEpoch 且处于非终态(starting/running/stopping)的旧进程状态更新为 lost。
136
+ */
137
+ initializeHost(hostEpoch: string): Promise<number>;
138
+ /**
139
+ * 释放存储资源(如关闭数据库连接)。
140
+ */
141
+ close?(): Promise<void> | void;
142
+ }
143
+ /**
144
+ * 内存型受管进程元数据存储实现。
145
+ * 适用于确定性测试与无持久化文件系统运行场景。
146
+ */
147
+ export declare class MemoryProcessMetadataStore implements ProcessMetadataStore {
148
+ private processes;
149
+ private requests;
150
+ private formatRequestKey;
151
+ saveProcess(process: StoredProcessRecord): Promise<void>;
152
+ getProcess(processId: string): Promise<StoredProcessRecord | undefined>;
153
+ listProcesses(owner: ProcessOwnerFilter, pageToken?: string, limit?: number): Promise<{
154
+ processes: ProcessInfo[];
155
+ nextPageToken?: string;
156
+ }>;
157
+ updateProcessState(processId: string, patch: Partial<ProcessInfo>): Promise<void>;
158
+ recordRequest(key: ProcessRequestKey, receipt: OperationReceipt, payloadHash?: string): Promise<void>;
159
+ getRequest(key: ProcessRequestKey): Promise<{
160
+ receipt: OperationReceipt;
161
+ payloadHash?: string;
162
+ } | undefined>;
163
+ initializeHost(hostEpoch: string): Promise<number>;
164
+ clear(): void;
165
+ }
166
+ /**
167
+ * SQLite 存储选项。
168
+ */
169
+ export interface SqliteProcessMetadataStoreOptions {
170
+ dbPath?: string;
171
+ driver?: SqliteDriver;
172
+ }
173
+ /**
174
+ * 基于 SQLite 的受管进程元数据持久化存储实现。
175
+ */
176
+ export declare class SqliteProcessMetadataStore implements ProcessMetadataStore {
177
+ private driver;
178
+ private statementCache;
179
+ private isClosed;
180
+ constructor(options?: SqliteProcessMetadataStoreOptions);
181
+ private initTables;
182
+ /**
183
+ * 旧库结构迁移:逐列探测并补充新增字段,重复执行安全(幂等)。
184
+ */
185
+ private migrateSchema;
186
+ /**
187
+ * 枚举指定表的全部列定义。
188
+ */
189
+ private listTableColumns;
190
+ private getStatement;
191
+ saveProcess(process: StoredProcessRecord): Promise<void>;
192
+ getProcess(processId: string): Promise<StoredProcessRecord | undefined>;
193
+ listProcesses(owner: ProcessOwnerFilter, pageToken?: string, limit?: number): Promise<{
194
+ processes: ProcessInfo[];
195
+ nextPageToken?: string;
196
+ }>;
197
+ updateProcessState(processId: string, patch: Partial<ProcessInfo>): Promise<void>;
198
+ recordRequest(key: ProcessRequestKey, receipt: OperationReceipt, payloadHash?: string): Promise<void>;
199
+ getRequest(key: ProcessRequestKey): Promise<{
200
+ receipt: OperationReceipt;
201
+ payloadHash?: string;
202
+ } | undefined>;
203
+ initializeHost(hostEpoch: string): Promise<number>;
204
+ close(): void;
205
+ }