@kodelyth/acpx 2026.5.39 → 2026.5.42

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 (47) hide show
  1. package/AGENTS.md +54 -0
  2. package/CLAUDE.md +54 -0
  3. package/dist/index.js +14 -0
  4. package/dist/process-reaper-DdVqzAA_.js +370 -0
  5. package/dist/register.runtime.js +53 -0
  6. package/dist/runtime-D9qhNKmy.js +741 -0
  7. package/dist/runtime-api.js +4 -0
  8. package/dist/service-CXeUME_-.js +1483 -0
  9. package/dist/setup-api.js +16 -0
  10. package/index.test.ts +119 -0
  11. package/index.ts +19 -0
  12. package/klaw.plugin.json +12 -27
  13. package/package.json +2 -2
  14. package/register.runtime.test.ts +104 -0
  15. package/register.runtime.ts +86 -0
  16. package/runtime-api.ts +49 -0
  17. package/setup-api.ts +18 -0
  18. package/src/acpx-runtime-compat.d.ts +65 -0
  19. package/src/claude-agent-acp-completion.test.ts +187 -0
  20. package/src/codex-auth-bridge.test.ts +688 -0
  21. package/src/codex-auth-bridge.ts +780 -0
  22. package/src/codex-trust-config.ts +297 -0
  23. package/src/config-schema.ts +118 -0
  24. package/src/config.test.ts +285 -0
  25. package/src/config.ts +281 -0
  26. package/src/manifest.test.ts +21 -0
  27. package/src/process-lease.test.ts +89 -0
  28. package/src/process-lease.ts +179 -0
  29. package/src/process-reaper.test.ts +330 -0
  30. package/src/process-reaper.ts +434 -0
  31. package/src/runtime-internals/error-format.mjs +6 -0
  32. package/src/runtime-internals/mcp-command-line.mjs +123 -0
  33. package/src/runtime-internals/mcp-command-line.test.ts +59 -0
  34. package/src/runtime-internals/mcp-proxy.mjs +121 -0
  35. package/src/runtime-internals/mcp-proxy.test.ts +130 -0
  36. package/src/runtime.test.ts +1817 -0
  37. package/src/runtime.ts +1261 -0
  38. package/src/service.test.ts +802 -0
  39. package/src/service.ts +630 -0
  40. package/tsconfig.json +16 -0
  41. package/index.js +0 -7
  42. package/register.runtime.js +0 -7
  43. package/runtime-api.js +0 -7
  44. package/setup-api.js +0 -7
  45. /package/{error-format.mjs → dist/error-format.mjs} +0 -0
  46. /package/{mcp-command-line.mjs → dist/mcp-command-line.mjs} +0 -0
  47. /package/{mcp-proxy.mjs → dist/mcp-proxy.mjs} +0 -0
@@ -0,0 +1,16 @@
1
+ import { definePluginEntry } from "klaw/plugin-sdk/plugin-entry";
2
+ import { normalizeLowercaseStringOrEmpty } from "klaw/plugin-sdk/string-coerce-runtime";
3
+ //#region extensions/acpx/setup-api.ts
4
+ var setup_api_default = definePluginEntry({
5
+ id: "acpx",
6
+ name: "ACPX Setup",
7
+ description: "Lightweight ACPX setup hooks",
8
+ register(api) {
9
+ api.registerAutoEnableProbe(({ config }) => {
10
+ const backendRaw = normalizeLowercaseStringOrEmpty(config.acp?.backend);
11
+ return (config.acp?.enabled === true || config.acp?.dispatch?.enabled === true || backendRaw === "acpx") && (!backendRaw || backendRaw === "acpx") ? "ACP runtime configured" : null;
12
+ });
13
+ }
14
+ });
15
+ //#endregion
16
+ export { setup_api_default as default };
package/index.test.ts ADDED
@@ -0,0 +1,119 @@
1
+ import type { KlawPluginApi } from "klaw/plugin-sdk/plugin-entry";
2
+ import { createTestPluginApi } from "klaw/plugin-sdk/plugin-test-api";
3
+ import { beforeEach, describe, expect, it, vi } from "vitest";
4
+ import setupPlugin from "./setup-api.js";
5
+
6
+ const { createAcpxRuntimeServiceMock, tryDispatchAcpReplyHookMock } = vi.hoisted(() => ({
7
+ createAcpxRuntimeServiceMock: vi.fn(),
8
+ tryDispatchAcpReplyHookMock: vi.fn(),
9
+ }));
10
+
11
+ vi.mock("./register.runtime.js", () => ({
12
+ createAcpxRuntimeService: createAcpxRuntimeServiceMock,
13
+ }));
14
+
15
+ vi.mock("klaw/plugin-sdk/acp-runtime-backend", () => ({
16
+ tryDispatchAcpReplyHook: tryDispatchAcpReplyHookMock,
17
+ }));
18
+
19
+ import plugin from "./index.js";
20
+
21
+ type AcpxAutoEnableProbe = Parameters<KlawPluginApi["registerAutoEnableProbe"]>[0];
22
+
23
+ function registerAcpxAutoEnableProbe(): AcpxAutoEnableProbe {
24
+ const probes: AcpxAutoEnableProbe[] = [];
25
+ setupPlugin.register(
26
+ createTestPluginApi({
27
+ registerAutoEnableProbe(probe) {
28
+ probes.push(probe);
29
+ },
30
+ }),
31
+ );
32
+ const probe = probes[0];
33
+ if (!probe) {
34
+ throw new Error("expected ACPX setup plugin to register an auto-enable probe");
35
+ }
36
+ return probe;
37
+ }
38
+
39
+ describe("acpx plugin", () => {
40
+ beforeEach(() => {
41
+ vi.clearAllMocks();
42
+ });
43
+
44
+ it("registers the runtime service and reply_dispatch hook", () => {
45
+ const service = { id: "acpx-service", start: vi.fn() };
46
+ createAcpxRuntimeServiceMock.mockReturnValue(service);
47
+
48
+ const api = {
49
+ pluginConfig: { stateDir: "/tmp/acpx" },
50
+ registerService: vi.fn(),
51
+ on: vi.fn(),
52
+ };
53
+
54
+ plugin.register(api as never);
55
+
56
+ expect(createAcpxRuntimeServiceMock).toHaveBeenCalledWith({
57
+ pluginConfig: api.pluginConfig,
58
+ });
59
+ expect(api.registerService).toHaveBeenCalledWith(service);
60
+ expect(api.on).toHaveBeenCalledWith("reply_dispatch", tryDispatchAcpReplyHookMock);
61
+ });
62
+
63
+ it("preserves the ACP reply_dispatch runtime path through the registered hook", async () => {
64
+ const service = { id: "acpx-service", start: vi.fn() };
65
+ createAcpxRuntimeServiceMock.mockReturnValue(service);
66
+ tryDispatchAcpReplyHookMock.mockResolvedValue({
67
+ handled: true,
68
+ queuedFinal: true,
69
+ counts: { tool: 1, block: 0, final: 1 },
70
+ });
71
+
72
+ const on = vi.fn();
73
+ const api = createTestPluginApi({
74
+ pluginConfig: { stateDir: "/tmp/acpx" },
75
+ registerService: vi.fn(),
76
+ on,
77
+ });
78
+
79
+ plugin.register(api);
80
+
81
+ const hook = on.mock.calls.find(([hookName]) => hookName === "reply_dispatch")?.[1];
82
+ if (!hook) {
83
+ throw new Error("expected reply_dispatch hook to be registered");
84
+ }
85
+
86
+ const event = {
87
+ ctx: { raw: "reply ctx" },
88
+ runId: "run-1",
89
+ sessionKey: "agent:test:session",
90
+ inboundAudio: false,
91
+ shouldRouteToOriginating: false,
92
+ shouldSendToolSummaries: true,
93
+ sendPolicy: "allow",
94
+ };
95
+ const ctx = {
96
+ cfg: {},
97
+ dispatcher: { dispatch: vi.fn(), getQueuedCounts: vi.fn(), getFailedCounts: vi.fn() },
98
+ recordProcessed: vi.fn(),
99
+ markIdle: vi.fn(),
100
+ };
101
+
102
+ await expect(hook(event, ctx)).resolves.toEqual({
103
+ handled: true,
104
+ queuedFinal: true,
105
+ counts: { tool: 1, block: 0, final: 1 },
106
+ });
107
+ expect(tryDispatchAcpReplyHookMock).toHaveBeenCalledWith(event, ctx);
108
+ });
109
+
110
+ it("declares setup auto-enable reasons for ACPX-owned ACP config", () => {
111
+ const probe = registerAcpxAutoEnableProbe();
112
+
113
+ expect(probe({ config: { acp: { enabled: true } }, env: {} })).toBe("ACP runtime configured");
114
+ expect(probe({ config: { acp: { backend: "acpx" } }, env: {} })).toBe("ACP runtime configured");
115
+ expect(probe({ config: { acp: { enabled: true, backend: "custom-runtime" } }, env: {} })).toBe(
116
+ null,
117
+ );
118
+ });
119
+ });
package/index.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { tryDispatchAcpReplyHook } from "klaw/plugin-sdk/acp-runtime-backend";
2
+ import { createAcpxRuntimeService } from "./register.runtime.js";
3
+ import type { KlawPluginApi } from "./runtime-api.js";
4
+
5
+ const plugin = {
6
+ id: "acpx",
7
+ name: "ACPX Runtime",
8
+ description: "Embedded ACP runtime backend with plugin-owned session and transport management.",
9
+ register(api: KlawPluginApi) {
10
+ api.registerService(
11
+ createAcpxRuntimeService({
12
+ pluginConfig: api.pluginConfig,
13
+ }),
14
+ );
15
+ api.on("reply_dispatch", tryDispatchAcpReplyHook);
16
+ },
17
+ };
18
+
19
+ export default plugin;
package/klaw.plugin.json CHANGED
@@ -6,9 +6,7 @@
6
6
  "enabledByDefault": true,
7
7
  "name": "ACPX Runtime",
8
8
  "description": "Embedded ACP runtime backend with plugin-owned session and transport management.",
9
- "skills": [
10
- "./skills"
11
- ],
9
+ "skills": ["./skills"],
12
10
  "configSchema": {
13
11
  "type": "object",
14
12
  "additionalProperties": false,
@@ -27,18 +25,11 @@
27
25
  },
28
26
  "permissionMode": {
29
27
  "type": "string",
30
- "enum": [
31
- "approve-all",
32
- "approve-reads",
33
- "deny-all"
34
- ]
28
+ "enum": ["approve-all", "approve-reads", "deny-all"]
35
29
  },
36
30
  "nonInteractivePermissions": {
37
31
  "type": "string",
38
- "enum": [
39
- "deny",
40
- "fail"
41
- ]
32
+ "enum": ["deny", "fail"]
42
33
  },
43
34
  "pluginToolsMcpBridge": {
44
35
  "type": "boolean"
@@ -58,6 +49,10 @@
58
49
  "type": "number",
59
50
  "minimum": 0
60
51
  },
52
+ "probeAgent": {
53
+ "type": "string",
54
+ "minLength": 1
55
+ },
61
56
  "mcpServers": {
62
57
  "type": "object",
63
58
  "additionalProperties": {
@@ -70,22 +65,16 @@
70
65
  },
71
66
  "args": {
72
67
  "type": "array",
73
- "items": {
74
- "type": "string"
75
- },
68
+ "items": { "type": "string" },
76
69
  "description": "Arguments to pass to the command"
77
70
  },
78
71
  "env": {
79
72
  "type": "object",
80
- "additionalProperties": {
81
- "type": "string"
82
- },
73
+ "additionalProperties": { "type": "string" },
83
74
  "description": "Environment variables for the MCP server"
84
75
  }
85
76
  },
86
- "required": [
87
- "command"
88
- ]
77
+ "required": ["command"]
89
78
  }
90
79
  },
91
80
  "agents": {
@@ -99,14 +88,10 @@
99
88
  },
100
89
  "args": {
101
90
  "type": "array",
102
- "items": {
103
- "type": "string"
104
- }
91
+ "items": { "type": "string" }
105
92
  }
106
93
  },
107
- "required": [
108
- "command"
109
- ]
94
+ "required": ["command"]
110
95
  }
111
96
  }
112
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodelyth/acpx",
3
- "version": "2026.5.39",
3
+ "version": "2026.5.42",
4
4
  "description": "Klaw ACP runtime backend",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "klaw": {
20
20
  "extensions": [
21
- "./index.js"
21
+ "./index.ts"
22
22
  ],
23
23
  "install": {
24
24
  "npmSpec": "@kodelyth/acpx",
@@ -0,0 +1,104 @@
1
+ import { afterEach, describe, expect, it, vi } from "vitest";
2
+
3
+ const { runtimeRegistry } = vi.hoisted(() => ({
4
+ runtimeRegistry: new Map<string, { runtime: unknown }>(),
5
+ }));
6
+
7
+ const { realRuntime, realServiceStartMock, realServiceStopMock, createRealServiceMock } =
8
+ vi.hoisted(() => {
9
+ const runtime = { isHealthy: vi.fn(() => true), probeAvailability: vi.fn(async () => {}) };
10
+ const start = vi.fn(async () => {
11
+ runtimeRegistry.set("acpx", { runtime });
12
+ });
13
+ const stop = vi.fn(async () => {
14
+ runtimeRegistry.delete("acpx");
15
+ });
16
+ return {
17
+ realRuntime: runtime,
18
+ realServiceStartMock: start,
19
+ realServiceStopMock: stop,
20
+ createRealServiceMock: vi.fn(() => ({ id: "real-acpx-runtime", start, stop })),
21
+ };
22
+ });
23
+
24
+ vi.mock("klaw/plugin-sdk/acp-runtime-backend", () => ({
25
+ getAcpRuntimeBackend: (id: string) => runtimeRegistry.get(id),
26
+ unregisterAcpRuntimeBackend: (id: string) => {
27
+ runtimeRegistry.delete(id);
28
+ },
29
+ }));
30
+
31
+ vi.mock("./src/service.js", () => ({
32
+ createAcpxRuntimeService: createRealServiceMock,
33
+ }));
34
+
35
+ import { createAcpxRuntimeService } from "./register.runtime.js";
36
+
37
+ const previousSkipRuntime = process.env.KLAW_SKIP_ACPX_RUNTIME;
38
+
39
+ function restoreEnv(): void {
40
+ if (previousSkipRuntime === undefined) {
41
+ delete process.env.KLAW_SKIP_ACPX_RUNTIME;
42
+ } else {
43
+ process.env.KLAW_SKIP_ACPX_RUNTIME = previousSkipRuntime;
44
+ }
45
+ }
46
+
47
+ function createServiceContext() {
48
+ return {
49
+ workspaceDir: "/tmp/klaw-acpx-register-test",
50
+ stateDir: "/tmp/klaw-acpx-register-test/state",
51
+ config: {},
52
+ logger: {
53
+ info: vi.fn(),
54
+ warn: vi.fn(),
55
+ error: vi.fn(),
56
+ debug: vi.fn(),
57
+ },
58
+ };
59
+ }
60
+
61
+ describe("acpx register runtime service", () => {
62
+ afterEach(() => {
63
+ runtimeRegistry.clear();
64
+ realServiceStartMock.mockClear();
65
+ realServiceStopMock.mockClear();
66
+ createRealServiceMock.mockClear();
67
+ restoreEnv();
68
+ });
69
+
70
+ it("starts the real service by default while leaving probe policy to the inner service", async () => {
71
+ delete process.env.KLAW_SKIP_ACPX_RUNTIME;
72
+ const ctx = createServiceContext();
73
+ const service = createAcpxRuntimeService({
74
+ pluginConfig: { timeoutSeconds: 10 },
75
+ });
76
+
77
+ await service.start(ctx as never);
78
+
79
+ expect(createRealServiceMock).toHaveBeenCalledWith({
80
+ pluginConfig: { timeoutSeconds: 10 },
81
+ });
82
+ expect(realServiceStartMock).toHaveBeenCalledWith(ctx);
83
+ expect(runtimeRegistry.get("acpx")?.runtime).toBe(realRuntime);
84
+
85
+ await service.stop?.(ctx as never);
86
+
87
+ expect(realServiceStopMock).toHaveBeenCalledWith(ctx);
88
+ expect(runtimeRegistry.get("acpx")).toBeUndefined();
89
+ });
90
+
91
+ it("keeps the explicit runtime skip env as the only outer startup skip", async () => {
92
+ process.env.KLAW_SKIP_ACPX_RUNTIME = "1";
93
+ const ctx = createServiceContext();
94
+ const service = createAcpxRuntimeService();
95
+
96
+ await service.start(ctx as never);
97
+
98
+ expect(createRealServiceMock).not.toHaveBeenCalled();
99
+ expect(runtimeRegistry.get("acpx")).toBeUndefined();
100
+ expect(ctx.logger.info).toHaveBeenCalledWith(
101
+ "skipping embedded acpx runtime backend (KLAW_SKIP_ACPX_RUNTIME=1)",
102
+ );
103
+ });
104
+ });
@@ -0,0 +1,86 @@
1
+ import {
2
+ getAcpRuntimeBackend,
3
+ unregisterAcpRuntimeBackend,
4
+ type AcpRuntime,
5
+ } from "klaw/plugin-sdk/acp-runtime-backend";
6
+ import type { KlawPluginService, KlawPluginServiceContext } from "klaw/plugin-sdk/core";
7
+
8
+ const ACPX_BACKEND_ID = "acpx";
9
+
10
+ type RealAcpxServiceModule = typeof import("./src/service.js");
11
+ type CreateAcpxRuntimeServiceParams = NonNullable<
12
+ Parameters<RealAcpxServiceModule["createAcpxRuntimeService"]>[0]
13
+ >;
14
+
15
+ type DeferredServiceState = {
16
+ ctx: KlawPluginServiceContext | null;
17
+ params: CreateAcpxRuntimeServiceParams;
18
+ realRuntime: AcpRuntime | null;
19
+ realService: KlawPluginService | null;
20
+ startPromise: Promise<AcpRuntime> | null;
21
+ };
22
+
23
+ let serviceModulePromise: Promise<RealAcpxServiceModule> | null = null;
24
+
25
+ function loadServiceModule(): Promise<RealAcpxServiceModule> {
26
+ serviceModulePromise ??= import("./src/service.js");
27
+ return serviceModulePromise;
28
+ }
29
+
30
+ async function startRealService(state: DeferredServiceState): Promise<AcpRuntime> {
31
+ if (state.realRuntime) {
32
+ return state.realRuntime;
33
+ }
34
+ if (!state.ctx) {
35
+ throw new Error("ACPX runtime service is not started");
36
+ }
37
+ state.startPromise ??= (async () => {
38
+ const { createAcpxRuntimeService } = await loadServiceModule();
39
+ const service = createAcpxRuntimeService(state.params);
40
+ state.realService = service;
41
+ await service.start(state.ctx as KlawPluginServiceContext);
42
+ const backend = getAcpRuntimeBackend(ACPX_BACKEND_ID);
43
+ if (!backend?.runtime) {
44
+ throw new Error("ACPX runtime service did not register an ACP backend");
45
+ }
46
+ state.realRuntime = backend.runtime;
47
+ return state.realRuntime;
48
+ })();
49
+ return await state.startPromise;
50
+ }
51
+
52
+ export function createAcpxRuntimeService(
53
+ params: CreateAcpxRuntimeServiceParams = {},
54
+ ): KlawPluginService {
55
+ const state: DeferredServiceState = {
56
+ ctx: null,
57
+ params,
58
+ realRuntime: null,
59
+ realService: null,
60
+ startPromise: null,
61
+ };
62
+
63
+ return {
64
+ id: "acpx-runtime",
65
+ async start(ctx) {
66
+ if (process.env.KLAW_SKIP_ACPX_RUNTIME === "1") {
67
+ ctx.logger.info("skipping embedded acpx runtime backend (KLAW_SKIP_ACPX_RUNTIME=1)");
68
+ return;
69
+ }
70
+
71
+ state.ctx = ctx;
72
+ await startRealService(state);
73
+ },
74
+ async stop(ctx) {
75
+ if (state.realService) {
76
+ await state.realService.stop?.(ctx);
77
+ } else {
78
+ unregisterAcpRuntimeBackend(ACPX_BACKEND_ID);
79
+ }
80
+ state.ctx = null;
81
+ state.realRuntime = null;
82
+ state.realService = null;
83
+ state.startPromise = null;
84
+ },
85
+ };
86
+ }
package/runtime-api.ts ADDED
@@ -0,0 +1,49 @@
1
+ export type { AcpRuntimeErrorCode } from "klaw/plugin-sdk/acp-runtime-backend";
2
+ export {
3
+ AcpRuntimeError,
4
+ getAcpRuntimeBackend,
5
+ tryDispatchAcpReplyHook,
6
+ registerAcpRuntimeBackend,
7
+ unregisterAcpRuntimeBackend,
8
+ } from "klaw/plugin-sdk/acp-runtime-backend";
9
+ export type {
10
+ AcpRuntime,
11
+ AcpRuntimeCapabilities,
12
+ AcpRuntimeDoctorReport,
13
+ AcpRuntimeEnsureInput,
14
+ AcpRuntimeEvent,
15
+ AcpRuntimeHandle,
16
+ AcpRuntimeStatus,
17
+ AcpRuntimeTurn,
18
+ AcpRuntimeTurnAttachment,
19
+ AcpRuntimeTurnInput,
20
+ AcpRuntimeTurnResult,
21
+ AcpRuntimeTurnResultError,
22
+ AcpSessionUpdateTag,
23
+ } from "klaw/plugin-sdk/acp-runtime-backend";
24
+ export type {
25
+ KlawPluginApi,
26
+ KlawPluginConfigSchema,
27
+ KlawPluginService,
28
+ KlawPluginServiceContext,
29
+ PluginLogger,
30
+ } from "klaw/plugin-sdk/core";
31
+ export type {
32
+ PluginHookReplyDispatchContext,
33
+ PluginHookReplyDispatchEvent,
34
+ PluginHookReplyDispatchResult,
35
+ } from "klaw/plugin-sdk/core";
36
+ export type {
37
+ WindowsSpawnProgram,
38
+ WindowsSpawnProgramCandidate,
39
+ WindowsSpawnResolution,
40
+ } from "klaw/plugin-sdk/windows-spawn";
41
+ export {
42
+ applyWindowsSpawnProgramPolicy,
43
+ materializeWindowsSpawnProgram,
44
+ resolveWindowsSpawnProgramCandidate,
45
+ } from "klaw/plugin-sdk/windows-spawn";
46
+ export {
47
+ listKnownProviderAuthEnvVarNames,
48
+ omitEnvKeysCaseInsensitive,
49
+ } from "klaw/plugin-sdk/provider-env-vars";
package/setup-api.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { definePluginEntry } from "klaw/plugin-sdk/plugin-entry";
2
+ import { normalizeLowercaseStringOrEmpty } from "klaw/plugin-sdk/string-coerce-runtime";
3
+
4
+ export default definePluginEntry({
5
+ id: "acpx",
6
+ name: "ACPX Setup",
7
+ description: "Lightweight ACPX setup hooks",
8
+ register(api) {
9
+ api.registerAutoEnableProbe(({ config }) => {
10
+ const backendRaw = normalizeLowercaseStringOrEmpty(config.acp?.backend);
11
+ const configured =
12
+ config.acp?.enabled === true ||
13
+ config.acp?.dispatch?.enabled === true ||
14
+ backendRaw === "acpx";
15
+ return configured && (!backendRaw || backendRaw === "acpx") ? "ACP runtime configured" : null;
16
+ });
17
+ },
18
+ });
@@ -0,0 +1,65 @@
1
+ declare module "acpx/runtime" {
2
+ export const ACPX_BACKEND_ID: string;
3
+
4
+ export type AcpRuntimeDoctorReport = import("../runtime-api.js").AcpRuntimeDoctorReport;
5
+ export type AcpRuntimeEnsureInput = import("../runtime-api.js").AcpRuntimeEnsureInput;
6
+ export type AcpRuntimeEvent = import("../runtime-api.js").AcpRuntimeEvent;
7
+ export type AcpRuntimeHandle = import("../runtime-api.js").AcpRuntimeHandle;
8
+ export type AcpRuntimeCapabilities = import("../runtime-api.js").AcpRuntimeCapabilities;
9
+ export type AcpRuntimeStatus = import("../runtime-api.js").AcpRuntimeStatus;
10
+ export type AcpRuntimeTurn = import("../runtime-api.js").AcpRuntimeTurn;
11
+ export type AcpRuntimeTurnInput = import("../runtime-api.js").AcpRuntimeTurnInput;
12
+ export type AcpRuntimeTurnResult = import("../runtime-api.js").AcpRuntimeTurnResult;
13
+
14
+ export type AcpAgentRegistry = {
15
+ resolve(agent: string): string | undefined;
16
+ list(): string[];
17
+ };
18
+
19
+ export type AcpSessionRecord = Record<string, unknown>;
20
+
21
+ export type AcpSessionStore = {
22
+ load(sessionId: string): Promise<AcpSessionRecord | undefined>;
23
+ save(record: AcpSessionRecord): Promise<void>;
24
+ };
25
+
26
+ export type AcpRuntimeOptions = {
27
+ cwd: string;
28
+ sessionStore: AcpSessionStore;
29
+ agentRegistry: AcpAgentRegistry;
30
+ probeAgent?: string;
31
+ mcpServers?: unknown;
32
+ permissionMode?: unknown;
33
+ nonInteractivePermissions?: unknown;
34
+ timeoutMs?: number;
35
+ probeAgent?: string;
36
+ };
37
+
38
+ export class AcpxRuntime {
39
+ constructor(options: AcpRuntimeOptions, testOptions?: unknown);
40
+ isHealthy(): boolean;
41
+ probeAvailability(): Promise<void>;
42
+ doctor(): Promise<AcpRuntimeDoctorReport>;
43
+ ensureSession(input: AcpRuntimeEnsureInput): Promise<AcpRuntimeHandle>;
44
+ startTurn(input: AcpRuntimeTurnInput): AcpRuntimeTurn;
45
+ runTurn(input: AcpRuntimeTurnInput): AsyncIterable<AcpRuntimeEvent>;
46
+ getCapabilities(input?: {
47
+ handle?: AcpRuntimeHandle;
48
+ }): AcpRuntimeCapabilities | Promise<AcpRuntimeCapabilities>;
49
+ getStatus(input: { handle: AcpRuntimeHandle; signal?: AbortSignal }): Promise<AcpRuntimeStatus>;
50
+ setMode(input: { handle: AcpRuntimeHandle; mode: string }): Promise<void>;
51
+ setConfigOption(input: { handle: AcpRuntimeHandle; key: string; value: string }): Promise<void>;
52
+ cancel(input: { handle: AcpRuntimeHandle; reason?: string }): Promise<void>;
53
+ close(input: {
54
+ handle: AcpRuntimeHandle;
55
+ reason?: string;
56
+ discardPersistentState?: boolean;
57
+ }): Promise<void>;
58
+ }
59
+
60
+ export function createAcpRuntime(...args: unknown[]): AcpxRuntime;
61
+ export function createAgentRegistry(params: { overrides?: unknown }): AcpAgentRegistry;
62
+ export function createFileSessionStore(params: { stateDir: string }): AcpSessionStore;
63
+ export function decodeAcpxRuntimeHandleState(...args: unknown[]): unknown;
64
+ export function encodeAcpxRuntimeHandleState(...args: unknown[]): unknown;
65
+ }