@actiondock/core 2.5.0 → 2.6.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/app/app.d.ts +14 -1
- package/dist/app/app.js +88 -215
- package/dist/app/static-index.d.ts +39 -0
- package/dist/app/static-index.js +164 -0
- package/dist/app/types.d.ts +5 -0
- package/dist/catalog/action-index.js +6 -4
- package/dist/catalog/package-catalog.js +2 -1
- package/dist/doctor/checks/index.d.ts +5 -0
- package/dist/doctor/checks/index.js +5 -0
- package/dist/doctor/checks/project-locate.d.ts +6 -0
- package/dist/doctor/checks/project-locate.js +36 -0
- package/dist/doctor/checks/project.d.ts +6 -0
- package/dist/doctor/checks/project.js +383 -0
- package/dist/doctor/checks/registry.d.ts +13 -0
- package/dist/doctor/checks/registry.js +207 -0
- package/dist/doctor/checks/runtime.d.ts +13 -0
- package/dist/doctor/checks/runtime.js +90 -0
- package/dist/doctor/checks/storage.d.ts +5 -0
- package/dist/doctor/checks/storage.js +34 -0
- package/dist/doctor/context.d.ts +35 -0
- package/dist/doctor/context.js +11 -0
- package/dist/doctor/doctor.d.ts +5 -0
- package/dist/doctor/doctor.js +33 -602
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +2 -0
- package/dist/execution/service.js +14 -9
- package/dist/host/host.d.ts +33 -0
- package/dist/host/host.js +222 -362
- package/dist/host/routing.d.ts +92 -0
- package/dist/host/routing.js +238 -0
- package/dist/host/types.d.ts +8 -0
- package/dist/ipc/host.js +38 -0
- package/dist/platform/types.d.ts +7 -0
- package/dist/process/control-arbiter.d.ts +107 -0
- package/dist/process/control-arbiter.js +251 -0
- package/dist/process/diagnostics-sink.d.ts +26 -0
- package/dist/process/diagnostics-sink.js +35 -0
- package/dist/process/index.d.ts +7 -0
- package/dist/process/index.js +7 -0
- package/dist/process/input-dispatcher.d.ts +88 -0
- package/dist/process/input-dispatcher.js +240 -0
- package/dist/process/managed-record.d.ts +78 -0
- package/dist/process/managed-record.js +1 -0
- package/dist/process/process-manager.d.ts +15 -56
- package/dist/process/process-manager.js +119 -707
- package/dist/process/reservation-table.d.ts +39 -0
- package/dist/process/reservation-table.js +80 -0
- package/dist/process/run-executor.d.ts +16 -0
- package/dist/process/run-executor.js +155 -0
- package/dist/process/terminal-output-cache.d.ts +66 -0
- package/dist/process/terminal-output-cache.js +132 -0
- package/dist/profile/client-actions.d.ts +56 -0
- package/dist/profile/client-actions.js +215 -0
- package/dist/profile/client-config.d.ts +20 -0
- package/dist/profile/client-config.js +51 -0
- package/dist/profile/client-health.d.ts +14 -0
- package/dist/profile/client-health.js +68 -0
- package/dist/profile/client-playbooks.d.ts +19 -0
- package/dist/profile/client-playbooks.js +36 -0
- package/dist/profile/client-query.d.ts +30 -0
- package/dist/profile/client-query.js +70 -0
- package/dist/profile/client-runs.d.ts +42 -0
- package/dist/profile/client-runs.js +58 -0
- package/dist/profile/client-state.d.ts +56 -0
- package/dist/profile/client-state.js +83 -0
- package/dist/profile/client-transport.d.ts +61 -0
- package/dist/profile/client-transport.js +155 -0
- package/dist/profile/client.d.ts +23 -142
- package/dist/profile/client.js +28 -588
- package/dist/profile/manager.js +1 -1
- package/dist/project/closure.d.ts +4 -4
- package/dist/project/closure.js +11 -5
- package/dist/project/init.js +2 -2
- package/dist/project/loader.d.ts +0 -25
- package/dist/project/loader.js +1 -154
- package/dist/project/transactions.d.ts +12 -14
- package/dist/project/transactions.js +60 -836
- package/dist/registry/registry.js +6 -4
- package/dist/registry/resolve.js +1 -1
- package/dist/runtime/action-registry.d.ts +45 -0
- package/dist/runtime/action-registry.js +108 -0
- package/dist/runtime/clock.d.ts +5 -17
- package/dist/runtime/clock.js +5 -15
- package/dist/runtime/context.d.ts +3 -0
- package/dist/runtime/context.js +17 -56
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.js +3 -0
- package/dist/runtime/package-runner-factory.d.ts +82 -0
- package/dist/runtime/package-runner-factory.js +186 -0
- package/dist/runtime/run-persistence.d.ts +85 -0
- package/dist/runtime/run-persistence.js +111 -0
- package/dist/runtime/runner.d.ts +23 -33
- package/dist/runtime/runner.js +92 -286
- package/dist/runtime/standalone.d.ts +11 -1
- package/dist/runtime/standalone.js +137 -25
- package/dist/server/dispatcher.d.ts +8 -3
- package/dist/server/dispatcher.js +16 -40
- package/dist/server/routes/runs.js +6 -4
- package/dist/server/security.d.ts +1 -7
- package/dist/server/security.js +2 -13
- package/dist/storage/clock.d.ts +25 -0
- package/dist/storage/clock.js +23 -0
- package/dist/storage/data-dir-lock.d.ts +3 -36
- package/dist/storage/data-dir-lock.js +48 -881
- package/dist/storage/index.d.ts +8 -1
- package/dist/storage/index.js +8 -2
- package/dist/storage/lazy.js +1 -0
- package/dist/storage/lock-core.d.ts +162 -0
- package/dist/storage/lock-core.js +885 -0
- package/dist/storage/sqlite.d.ts +19 -6
- package/dist/storage/sqlite.js +81 -89
- package/dist/storage/types.d.ts +27 -5
- package/dist/storage/types.js +21 -0
- package/dist/storage/utils.d.ts +22 -0
- package/dist/storage/utils.js +34 -0
- package/dist/target/local.d.ts +1 -0
- package/dist/target/local.js +23 -17
- package/dist/target/remote-errors.d.ts +21 -0
- package/dist/target/remote-errors.js +51 -0
- package/dist/target/remote-polling.d.ts +35 -0
- package/dist/target/remote-polling.js +104 -0
- package/dist/target/remote.d.ts +4 -0
- package/dist/target/remote.js +108 -301
- package/dist/target/sse-parser.d.ts +35 -0
- package/dist/target/sse-parser.js +163 -0
- package/dist/target/target.js +2 -0
- package/dist/target/types.d.ts +6 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/net.d.ts +10 -0
- package/dist/utils/net.js +16 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,8 @@ import { ActionResolver } from "../catalog/action-resolver.js";
|
|
|
3
3
|
import { computeDigest } from "../project/digest.js";
|
|
4
4
|
import { InMemoryEventSink } from "../runtime/events.js";
|
|
5
5
|
import { ActionRunner } from "../runtime/runner.js";
|
|
6
|
-
import {
|
|
6
|
+
import { ACTION_NOT_FOUND, EXECUTION_FAILED, IDEMPOTENCY_CONFLICT, RUN_REPOSITORY_UNAVAILABLE, UNHANDLED_EXECUTION_ERROR, describeActionLoadFailure, } from "../errors.js";
|
|
7
|
+
import { resultStatusToRunStatus } from "../storage/types.js";
|
|
7
8
|
/**
|
|
8
9
|
* 统一执行协调服务实现。
|
|
9
10
|
*/
|
|
@@ -49,6 +50,8 @@ export class DefaultExecutionService {
|
|
|
49
50
|
options.platform.storage.createStorage(this.packageId, {
|
|
50
51
|
projectRoot: options.projectRoot,
|
|
51
52
|
customHome: options.customHome,
|
|
53
|
+
// 执行服务属于数据目录持有者主路径,打开时收割遗留孤儿运行
|
|
54
|
+
recoverOrphans: true,
|
|
52
55
|
});
|
|
53
56
|
}
|
|
54
57
|
else {
|
|
@@ -60,7 +63,8 @@ export class DefaultExecutionService {
|
|
|
60
63
|
this.storage = options.storage;
|
|
61
64
|
}
|
|
62
65
|
const globalStorage = options.platform
|
|
63
|
-
? (options.globalStorage ??
|
|
66
|
+
? (options.globalStorage ??
|
|
67
|
+
options.platform.storage.createGlobalStorage({ customHome: options.customHome, recoverOrphans: true }))
|
|
64
68
|
: options.globalStorage;
|
|
65
69
|
this.ownsStorage = !options.storage;
|
|
66
70
|
this.ownsGlobalStorage = !options.globalStorage && !!options.platform;
|
|
@@ -533,13 +537,7 @@ export class DefaultExecutionService {
|
|
|
533
537
|
watchHandleCompletion(handle, activeItem, bridge) {
|
|
534
538
|
handle.result
|
|
535
539
|
.then((result) => {
|
|
536
|
-
const finalStatus = result.ok
|
|
537
|
-
? "success"
|
|
538
|
-
: result.error?.code === ACTION_TIMEOUT
|
|
539
|
-
? "timed_out"
|
|
540
|
-
: result.error?.code === ACTION_CANCELLED
|
|
541
|
-
? "cancelled"
|
|
542
|
-
: "failed";
|
|
540
|
+
const finalStatus = resultStatusToRunStatus(result.ok, result.ok ? undefined : result.error?.code);
|
|
543
541
|
activeItem.status = finalStatus;
|
|
544
542
|
bridge.emitEvent({ type: "status", status: finalStatus });
|
|
545
543
|
bridge.emitEvent({ type: "finish", result });
|
|
@@ -633,6 +631,13 @@ export class DefaultExecutionService {
|
|
|
633
631
|
}
|
|
634
632
|
}
|
|
635
633
|
this.activeRuns.clear();
|
|
634
|
+
// 级联释放跨包子包 Runner 及其独立创建的存储连接(幂等,异常不阻断后续释放)
|
|
635
|
+
try {
|
|
636
|
+
await this._runner.dispose();
|
|
637
|
+
}
|
|
638
|
+
catch {
|
|
639
|
+
// 子包释放异常已在 dispose 内部隔离,此处仅需保障主流程继续
|
|
640
|
+
}
|
|
636
641
|
if (this.ownsStorage && this.storage && typeof this.storage.close === "function") {
|
|
637
642
|
await this.storage.close();
|
|
638
643
|
}
|
package/dist/host/host.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { ActionDockHost, ActionDockHostOptions } from "./types.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class DefaultActionDockHost implements ActionDockHost {
|
|
10
10
|
readonly hostSessionId: string;
|
|
11
|
+
readonly options: ActionDockHostOptions;
|
|
11
12
|
private apps;
|
|
12
13
|
private readonly internallyCreatedApps;
|
|
13
14
|
private activeSubRunsPerRoot;
|
|
@@ -19,11 +20,43 @@ export declare class DefaultActionDockHost implements ActionDockHost {
|
|
|
19
20
|
private isClosed;
|
|
20
21
|
private dataDirLock?;
|
|
21
22
|
private failedLinkedPackages;
|
|
23
|
+
private failedAutoLoad?;
|
|
24
|
+
/** 透传给内部创建 App 的存储收割开关(Host 默认持有者身份,显式可关) */
|
|
25
|
+
private recoverOrphans;
|
|
22
26
|
constructor(options?: ActionDockHostOptions);
|
|
27
|
+
/**
|
|
28
|
+
* 阶段函数:注册显式传入的 packages 列表(现成 App 实例或 AppOptions 配置)。
|
|
29
|
+
*/
|
|
30
|
+
private registerExplicitPackages;
|
|
31
|
+
/**
|
|
32
|
+
* 阶段函数:自动加载当前工程并注册依赖闭包内的全部包。
|
|
33
|
+
*
|
|
34
|
+
* 失败语义区分场景:
|
|
35
|
+
* - 显式传入 projectRoot 时,任何解析失败(损坏 actiondock.json、文件系统错误等)
|
|
36
|
+
* 必须向上抛出,由调用方感知,严禁吞没;
|
|
37
|
+
* - 自动探测场景(未传 projectRoot,由 findProjectRoot 发现)失败时记录实例诊断
|
|
38
|
+
* failedAutoLoad 并在创建时输出单行告警,保持宿主其余能力可用但绝不无声。
|
|
39
|
+
*/
|
|
40
|
+
private loadCurrentProject;
|
|
41
|
+
/**
|
|
42
|
+
* 阶段函数:扫描全局注册表中已软链接的外部包并注册至 Host。
|
|
43
|
+
* 加载失败的链接包记录至 failedLinkedPackages 诊断并在调阅时透传精准失败原因。
|
|
44
|
+
*/
|
|
45
|
+
private registerLinkedPackages;
|
|
23
46
|
private resolvePackageContext;
|
|
24
47
|
private bindApp;
|
|
48
|
+
/** 路由可见性上下文(公开包集合与依赖解析器) */
|
|
49
|
+
private visibility;
|
|
25
50
|
getApp(packageId: string): ActionDockApp | undefined;
|
|
26
51
|
listApps(): ActionDockApp[];
|
|
52
|
+
/**
|
|
53
|
+
* 获取自动加载工程的失败诊断信息。
|
|
54
|
+
* 仅自动探测场景会记录此诊断;显式传入 projectRoot 的加载失败会直接抛出,不产生此诊断。
|
|
55
|
+
*/
|
|
56
|
+
getAutoLoadFailure(): {
|
|
57
|
+
projectRoot: string;
|
|
58
|
+
error: string;
|
|
59
|
+
} | undefined;
|
|
27
60
|
private registerAppInternal;
|
|
28
61
|
registerApp(app: ActionDockApp): void;
|
|
29
62
|
info(): Promise<PackageInfo[]>;
|