acpx 0.4.1 → 0.5.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 (47) hide show
  1. package/dist/agent-registry-DGw0-3Tc.js +54 -0
  2. package/dist/agent-registry-DGw0-3Tc.js.map +1 -0
  3. package/dist/{cli-idpWyCOs.js → cli-CLRrs6eQ.js} +8 -12
  4. package/dist/cli-CLRrs6eQ.js.map +1 -0
  5. package/dist/cli.d.ts +2 -2
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +1018 -1009
  8. package/dist/cli.js.map +1 -1
  9. package/dist/client-DLTWuu4w.d.ts +116 -0
  10. package/dist/client-DLTWuu4w.d.ts.map +1 -0
  11. package/dist/{flags-CCcX9fZj.js → flags-BmubjvOw.js} +5 -55
  12. package/dist/flags-BmubjvOw.js.map +1 -0
  13. package/dist/{flows-BL1tSvZT.js → flows-CR7xCmkR.js} +471 -281
  14. package/dist/flows-CR7xCmkR.js.map +1 -0
  15. package/dist/flows.d.ts +5 -9
  16. package/dist/flows.d.ts.map +1 -1
  17. package/dist/flows.js +1 -1
  18. package/dist/{queue-ipc-CE8_QGX3.js → ipc-DN6M4Ui9.js} +12 -571
  19. package/dist/ipc-DN6M4Ui9.js.map +1 -0
  20. package/dist/{acp-jsonrpc-BbBgC5gO.js → jsonrpc-M3y-qzy8.js} +2 -2
  21. package/dist/jsonrpc-M3y-qzy8.js.map +1 -0
  22. package/dist/{output-Du3m6oPQ.js → output-Di0M9Et8.js} +6 -6
  23. package/dist/output-Di0M9Et8.js.map +1 -0
  24. package/dist/perf-metrics-D9QC81lB.js +568 -0
  25. package/dist/perf-metrics-D9QC81lB.js.map +1 -0
  26. package/dist/{session-RO_LZUnv.js → prompt-turn-Bt8T3SRR.js} +2304 -3632
  27. package/dist/prompt-turn-Bt8T3SRR.js.map +1 -0
  28. package/dist/{output-render-Bz58qaQn.js → render-BL5ynRkN.js} +7 -6
  29. package/dist/render-BL5ynRkN.js.map +1 -0
  30. package/dist/runtime.d.ts +266 -0
  31. package/dist/runtime.d.ts.map +1 -0
  32. package/dist/runtime.js +984 -0
  33. package/dist/runtime.js.map +1 -0
  34. package/dist/session-BbN0SBgf.js +1488 -0
  35. package/dist/session-BbN0SBgf.js.map +1 -0
  36. package/dist/{types-CeRKmEQ1.d.ts → types-DXxLBQc3.d.ts} +40 -3
  37. package/dist/types-DXxLBQc3.d.ts.map +1 -0
  38. package/package.json +5 -3
  39. package/dist/acp-jsonrpc-BbBgC5gO.js.map +0 -1
  40. package/dist/cli-idpWyCOs.js.map +0 -1
  41. package/dist/flags-CCcX9fZj.js.map +0 -1
  42. package/dist/flows-BL1tSvZT.js.map +0 -1
  43. package/dist/output-Du3m6oPQ.js.map +0 -1
  44. package/dist/output-render-Bz58qaQn.js.map +0 -1
  45. package/dist/queue-ipc-CE8_QGX3.js.map +0 -1
  46. package/dist/session-RO_LZUnv.js.map +0 -1
  47. package/dist/types-CeRKmEQ1.d.ts.map +0 -1
@@ -1,15 +1,16 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
2
- import { N as normalizeRuntimeSessionId, s as probeQueueOwnerHealth } from "./queue-ipc-CE8_QGX3.js";
2
+ import { u as normalizeRuntimeSessionId } from "./perf-metrics-D9QC81lB.js";
3
+ import { s as probeQueueOwnerHealth } from "./ipc-DN6M4Ui9.js";
3
4
  import path from "node:path";
4
- //#region src/cli/json-output.ts
5
+ //#region src/cli/output/json-output.ts
5
6
  function emitJsonResult(format, payload) {
6
7
  if (format !== "json") return false;
7
8
  process.stdout.write(`${JSON.stringify(payload)}\n`);
8
9
  return true;
9
10
  }
10
11
  //#endregion
11
- //#region src/cli/output-render.ts
12
- var output_render_exports = /* @__PURE__ */ __exportAll({
12
+ //#region src/cli/output/render.ts
13
+ var render_exports = /* @__PURE__ */ __exportAll({
13
14
  agentSessionIdPayload: () => agentSessionIdPayload,
14
15
  formatPromptSessionBannerLine: () => formatPromptSessionBannerLine,
15
16
  printClosedSessionByFormat: () => printClosedSessionByFormat,
@@ -134,6 +135,6 @@ function agentSessionIdPayload(agentSessionId) {
134
135
  return { agentSessionId: normalized };
135
136
  }
136
137
  //#endregion
137
- export { emitJsonResult as i, formatPromptSessionBannerLine as n, output_render_exports as r, agentSessionIdPayload as t };
138
+ export { emitJsonResult as i, formatPromptSessionBannerLine as n, render_exports as r, agentSessionIdPayload as t };
138
139
 
139
- //# sourceMappingURL=output-render-Bz58qaQn.js.map
140
+ //# sourceMappingURL=render-BL5ynRkN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-BL5ynRkN.js","names":[],"sources":["../src/cli/output/json-output.ts","../src/cli/output/render.ts"],"sourcesContent":["import type { OutputFormat } from \"../../types.js\";\n\nexport function emitJsonResult(format: OutputFormat, payload: unknown): boolean {\n if (format !== \"json\") {\n return false;\n }\n process.stdout.write(`${JSON.stringify(payload)}\\n`);\n return true;\n}\n","import path from \"node:path\";\nimport { normalizeRuntimeSessionId } from \"../../session/runtime-session-id.js\";\nimport type { OutputFormat, SessionRecord } from \"../../types.js\";\nimport { probeQueueOwnerHealth } from \"../queue/ipc.js\";\nimport { emitJsonResult } from \"./json-output.js\";\n\nfunction formatSessionLabel(record: SessionRecord): string {\n return record.name ?? \"cwd\";\n}\n\nfunction formatRoutedFrom(sessionCwd: string, currentCwd: string): string | undefined {\n const relative = path.relative(sessionCwd, currentCwd);\n if (!relative || relative === \".\") {\n return undefined;\n }\n return relative.startsWith(\".\") ? relative : `.${path.sep}${relative}`;\n}\n\ntype SessionConnectionStatus = \"connected\" | \"needs reconnect\";\n\nasync function resolveSessionConnectionStatus(\n record: SessionRecord,\n): Promise<SessionConnectionStatus> {\n const health = await probeQueueOwnerHealth(record.acpxRecordId);\n return health.healthy ? \"connected\" : \"needs reconnect\";\n}\n\nexport function printSessionsByFormat(sessions: SessionRecord[], format: OutputFormat): void {\n if (format === \"json\") {\n process.stdout.write(`${JSON.stringify(sessions)}\\n`);\n return;\n }\n\n if (format === \"quiet\") {\n for (const session of sessions) {\n const closedMarker = session.closed ? \" [closed]\" : \"\";\n process.stdout.write(`${session.acpxRecordId}${closedMarker}\\n`);\n }\n return;\n }\n\n if (sessions.length === 0) {\n process.stdout.write(\"No sessions\\n\");\n return;\n }\n\n for (const session of sessions) {\n const closedMarker = session.closed ? \" [closed]\" : \"\";\n process.stdout.write(\n `${session.acpxRecordId}${closedMarker}\\t${session.name ?? \"-\"}\\t${session.cwd}\\t${session.lastUsedAt}\\n`,\n );\n }\n}\n\nexport function printClosedSessionByFormat(record: SessionRecord, format: OutputFormat): void {\n if (\n emitJsonResult(format, {\n action: \"session_closed\",\n acpxRecordId: record.acpxRecordId,\n acpxSessionId: record.acpSessionId,\n agentSessionId: record.agentSessionId,\n })\n ) {\n return;\n }\n\n if (format === \"quiet\") {\n return;\n }\n\n process.stdout.write(`${record.acpxRecordId}\\n`);\n}\n\nexport function printNewSessionByFormat(\n record: SessionRecord,\n replaced: SessionRecord | undefined,\n format: OutputFormat,\n): void {\n if (\n emitJsonResult(format, {\n action: \"session_ensured\",\n created: true,\n acpxRecordId: record.acpxRecordId,\n acpxSessionId: record.acpSessionId,\n agentSessionId: record.agentSessionId,\n name: record.name,\n replacedSessionId: replaced?.acpxRecordId,\n })\n ) {\n return;\n }\n\n if (format === \"quiet\") {\n process.stdout.write(`${record.acpxRecordId}\\n`);\n return;\n }\n\n if (replaced) {\n process.stdout.write(`${record.acpxRecordId}\\t(replaced ${replaced.acpxRecordId})\\n`);\n return;\n }\n\n process.stdout.write(`${record.acpxRecordId}\\n`);\n}\n\nexport function printEnsuredSessionByFormat(\n record: SessionRecord,\n created: boolean,\n format: OutputFormat,\n): void {\n if (\n emitJsonResult(format, {\n action: \"session_ensured\",\n created,\n acpxRecordId: record.acpxRecordId,\n acpxSessionId: record.acpSessionId,\n agentSessionId: record.agentSessionId,\n name: record.name,\n })\n ) {\n return;\n }\n\n if (format === \"quiet\") {\n process.stdout.write(`${record.acpxRecordId}\\n`);\n return;\n }\n\n const action = created ? \"created\" : \"existing\";\n process.stdout.write(`${record.acpxRecordId}\\t(${action})\\n`);\n}\n\nexport function printQueuedPromptByFormat(\n result: {\n sessionId: string;\n requestId: string;\n },\n format: OutputFormat,\n): void {\n if (\n emitJsonResult(format, {\n action: \"prompt_queued\",\n acpxRecordId: result.sessionId,\n requestId: result.requestId,\n })\n ) {\n return;\n }\n\n if (format === \"quiet\") {\n return;\n }\n\n process.stdout.write(`[queued] ${result.requestId}\\n`);\n}\n\nexport function formatPromptSessionBannerLine(\n record: SessionRecord,\n currentCwd: string,\n connectionStatus: SessionConnectionStatus = \"needs reconnect\",\n): string {\n const label = formatSessionLabel(record);\n const normalizedSessionCwd = path.resolve(record.cwd);\n const normalizedCurrentCwd = path.resolve(currentCwd);\n const routedFrom =\n normalizedSessionCwd === normalizedCurrentCwd\n ? undefined\n : formatRoutedFrom(normalizedSessionCwd, normalizedCurrentCwd);\n const status = connectionStatus;\n\n if (routedFrom) {\n return `[acpx] session ${label} (${record.acpxRecordId}) · ${normalizedSessionCwd} (routed from ${routedFrom}) · agent ${status}`;\n }\n\n return `[acpx] session ${label} (${record.acpxRecordId}) · ${normalizedSessionCwd} · agent ${status}`;\n}\n\nexport async function printPromptSessionBanner(\n record: SessionRecord,\n currentCwd: string,\n format: OutputFormat,\n jsonStrict = false,\n): Promise<void> {\n if (format === \"quiet\" || (jsonStrict && format === \"json\")) {\n return;\n }\n\n const status = await resolveSessionConnectionStatus(record);\n process.stderr.write(`${formatPromptSessionBannerLine(record, currentCwd, status)}\\n`);\n}\n\nexport function printCreatedSessionBanner(\n record: SessionRecord,\n agentName: string,\n format: OutputFormat,\n jsonStrict = false,\n): void {\n if (format === \"quiet\" || (jsonStrict && format === \"json\")) {\n return;\n }\n\n const label = formatSessionLabel(record);\n process.stderr.write(`[acpx] created session ${label} (${record.acpxRecordId})\\n`);\n process.stderr.write(`[acpx] agent: ${agentName}\\n`);\n process.stderr.write(`[acpx] cwd: ${record.cwd}\\n`);\n}\n\nexport function agentSessionIdPayload(agentSessionId: string | undefined): {\n agentSessionId?: string;\n} {\n const normalized = normalizeRuntimeSessionId(agentSessionId);\n if (!normalized) {\n return {};\n }\n\n return { agentSessionId: normalized };\n}\n"],"mappings":";;;;;AAEA,SAAgB,eAAe,QAAsB,SAA2B;AAC9E,KAAI,WAAW,OACb,QAAO;AAET,SAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,CAAC,IAAI;AACpD,QAAO;;;;;;;;;;;;;;;ACDT,SAAS,mBAAmB,QAA+B;AACzD,QAAO,OAAO,QAAQ;;AAGxB,SAAS,iBAAiB,YAAoB,YAAwC;CACpF,MAAM,WAAW,KAAK,SAAS,YAAY,WAAW;AACtD,KAAI,CAAC,YAAY,aAAa,IAC5B;AAEF,QAAO,SAAS,WAAW,IAAI,GAAG,WAAW,IAAI,KAAK,MAAM;;AAK9D,eAAe,+BACb,QACkC;AAElC,SADe,MAAM,sBAAsB,OAAO,aAAa,EACjD,UAAU,cAAc;;AAGxC,SAAgB,sBAAsB,UAA2B,QAA4B;AAC3F,KAAI,WAAW,QAAQ;AACrB,UAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,SAAS,CAAC,IAAI;AACrD;;AAGF,KAAI,WAAW,SAAS;AACtB,OAAK,MAAM,WAAW,UAAU;GAC9B,MAAM,eAAe,QAAQ,SAAS,cAAc;AACpD,WAAQ,OAAO,MAAM,GAAG,QAAQ,eAAe,aAAa,IAAI;;AAElE;;AAGF,KAAI,SAAS,WAAW,GAAG;AACzB,UAAQ,OAAO,MAAM,gBAAgB;AACrC;;AAGF,MAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,eAAe,QAAQ,SAAS,cAAc;AACpD,UAAQ,OAAO,MACb,GAAG,QAAQ,eAAe,aAAa,IAAI,QAAQ,QAAQ,IAAI,IAAI,QAAQ,IAAI,IAAI,QAAQ,WAAW,IACvG;;;AAIL,SAAgB,2BAA2B,QAAuB,QAA4B;AAC5F,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,QAAQ,OAAO,IAAI;CACrD,MAAM,uBAAuB,KAAK,QAAQ,WAAW;CACrD,MAAM,aACJ,yBAAyB,uBACrB,KAAA,IACA,iBAAiB,sBAAsB,qBAAqB;CAClE,MAAM,SAAS;AAEf,KAAI,WACF,QAAO,kBAAkB,MAAM,IAAI,OAAO,aAAa,MAAM,qBAAqB,gBAAgB,WAAW,YAAY;AAG3H,QAAO,kBAAkB,MAAM,IAAI,OAAO,aAAa,MAAM,qBAAqB,WAAW;;AAG/F,eAAsB,yBACpB,QACA,YACA,QACA,aAAa,OACE;AACf,KAAI,WAAW,WAAY,cAAc,WAAW,OAClD;CAGF,MAAM,SAAS,MAAM,+BAA+B,OAAO;AAC3D,SAAQ,OAAO,MAAM,GAAG,8BAA8B,QAAQ,YAAY,OAAO,CAAC,IAAI;;AAGxF,SAAgB,0BACd,QACA,WACA,QACA,aAAa,OACP;AACN,KAAI,WAAW,WAAY,cAAc,WAAW,OAClD;CAGF,MAAM,QAAQ,mBAAmB,OAAO;AACxC,SAAQ,OAAO,MAAM,0BAA0B,MAAM,IAAI,OAAO,aAAa,KAAK;AAClF,SAAQ,OAAO,MAAM,iBAAiB,UAAU,IAAI;AACpD,SAAQ,OAAO,MAAM,eAAe,OAAO,IAAI,IAAI;;AAGrD,SAAgB,sBAAsB,gBAEpC;CACA,MAAM,aAAa,0BAA0B,eAAe;AAC5D,KAAI,CAAC,WACH,QAAO,EAAE;AAGX,QAAO,EAAE,gBAAgB,YAAY"}
@@ -0,0 +1,266 @@
1
+ import { a as PermissionMode, i as NonInteractivePermissionPolicy, r as McpServer, s as SessionRecord } from "./types-DXxLBQc3.js";
2
+ import { t as AcpClient } from "./client-DLTWuu4w.js";
3
+
4
+ //#region src/runtime/public/contract.d.ts
5
+ type AcpRuntimePromptMode = "prompt" | "steer";
6
+ type AcpRuntimeSessionMode = "persistent" | "oneshot";
7
+ type AcpSessionUpdateTag = "agent_message_chunk" | "agent_thought_chunk" | "tool_call" | "tool_call_update" | "usage_update" | "available_commands_update" | "current_mode_update" | "config_option_update" | "session_info_update" | "plan" | (string & {});
8
+ type AcpRuntimeControl = "session/set_mode" | "session/set_config_option" | "session/status";
9
+ type AcpRuntimeHandle = {
10
+ sessionKey: string;
11
+ backend: string;
12
+ runtimeSessionName: string;
13
+ cwd?: string;
14
+ acpxRecordId?: string;
15
+ backendSessionId?: string;
16
+ agentSessionId?: string;
17
+ };
18
+ type AcpRuntimeEnsureInput = {
19
+ sessionKey: string;
20
+ agent: string;
21
+ mode: AcpRuntimeSessionMode;
22
+ resumeSessionId?: string;
23
+ cwd?: string;
24
+ };
25
+ type AcpRuntimeTurnAttachment = {
26
+ mediaType: string;
27
+ data: string;
28
+ };
29
+ type AcpRuntimeTurnInput = {
30
+ handle: AcpRuntimeHandle;
31
+ text: string;
32
+ attachments?: AcpRuntimeTurnAttachment[];
33
+ mode: AcpRuntimePromptMode;
34
+ requestId: string;
35
+ timeoutMs?: number;
36
+ signal?: AbortSignal;
37
+ };
38
+ type AcpRuntimeCapabilities = {
39
+ controls: AcpRuntimeControl[];
40
+ configOptionKeys?: string[];
41
+ };
42
+ type AcpRuntimeStatus = {
43
+ summary?: string;
44
+ acpxRecordId?: string;
45
+ backendSessionId?: string;
46
+ agentSessionId?: string;
47
+ details?: Record<string, unknown>;
48
+ };
49
+ type AcpRuntimeDoctorReport = {
50
+ ok: boolean;
51
+ code?: string;
52
+ message: string;
53
+ installCommand?: string;
54
+ details?: string[];
55
+ };
56
+ type AcpRuntimeEvent = {
57
+ type: "text_delta";
58
+ text: string;
59
+ stream?: "output" | "thought";
60
+ tag?: AcpSessionUpdateTag;
61
+ } | {
62
+ type: "status";
63
+ text: string;
64
+ tag?: AcpSessionUpdateTag;
65
+ used?: number;
66
+ size?: number;
67
+ } | {
68
+ type: "tool_call";
69
+ text: string;
70
+ tag?: AcpSessionUpdateTag;
71
+ toolCallId?: string;
72
+ status?: string;
73
+ title?: string;
74
+ } | {
75
+ type: "done";
76
+ stopReason?: string;
77
+ } | {
78
+ type: "error";
79
+ message: string;
80
+ code?: string;
81
+ retryable?: boolean;
82
+ };
83
+ interface AcpRuntime {
84
+ ensureSession(input: AcpRuntimeEnsureInput): Promise<AcpRuntimeHandle>;
85
+ runTurn(input: AcpRuntimeTurnInput): AsyncIterable<AcpRuntimeEvent>;
86
+ getCapabilities?(input: {
87
+ handle?: AcpRuntimeHandle;
88
+ }): Promise<AcpRuntimeCapabilities> | AcpRuntimeCapabilities;
89
+ getStatus?(input: {
90
+ handle: AcpRuntimeHandle;
91
+ signal?: AbortSignal;
92
+ }): Promise<AcpRuntimeStatus>;
93
+ setMode?(input: {
94
+ handle: AcpRuntimeHandle;
95
+ mode: string;
96
+ }): Promise<void>;
97
+ setConfigOption?(input: {
98
+ handle: AcpRuntimeHandle;
99
+ key: string;
100
+ value: string;
101
+ }): Promise<void>;
102
+ doctor?(): Promise<AcpRuntimeDoctorReport>;
103
+ cancel(input: {
104
+ handle: AcpRuntimeHandle;
105
+ reason?: string;
106
+ }): Promise<void>;
107
+ close(input: {
108
+ handle: AcpRuntimeHandle;
109
+ reason: string;
110
+ }): Promise<void>;
111
+ }
112
+ type AcpSessionRecord = SessionRecord;
113
+ interface AcpSessionStore {
114
+ load(sessionId: string): Promise<AcpSessionRecord | undefined>;
115
+ save(record: AcpSessionRecord): Promise<void>;
116
+ }
117
+ interface AcpAgentRegistry {
118
+ resolve(agentName: string): string;
119
+ list(): string[];
120
+ }
121
+ type AcpRuntimeOptions = {
122
+ cwd: string;
123
+ sessionStore: AcpSessionStore;
124
+ agentRegistry: AcpAgentRegistry;
125
+ mcpServers?: McpServer[];
126
+ permissionMode: PermissionMode;
127
+ nonInteractivePermissions?: NonInteractivePermissionPolicy;
128
+ timeoutMs?: number;
129
+ probeAgent?: string;
130
+ verbose?: boolean;
131
+ };
132
+ type AcpFileSessionStoreOptions = {
133
+ stateDir: string;
134
+ };
135
+ //#endregion
136
+ //#region src/agent-registry.d.ts
137
+ declare const DEFAULT_AGENT_NAME = "codex";
138
+ //#endregion
139
+ //#region src/runtime/engine/manager.d.ts
140
+ type AcpRuntimeManagerDeps = {
141
+ clientFactory?: (options: ConstructorParameters<typeof AcpClient>[0]) => AcpClient;
142
+ };
143
+ declare class AcpRuntimeManager {
144
+ private readonly options;
145
+ private readonly deps;
146
+ private readonly activeControllers;
147
+ private readonly pendingPersistentClients;
148
+ constructor(options: AcpRuntimeOptions, deps?: AcpRuntimeManagerDeps);
149
+ private createClient;
150
+ ensureSession(input: {
151
+ sessionKey: string;
152
+ agent: string;
153
+ mode: "persistent" | "oneshot";
154
+ cwd?: string;
155
+ resumeSessionId?: string;
156
+ }): Promise<SessionRecord>;
157
+ runTurn(input: {
158
+ handle: AcpRuntimeHandle;
159
+ text: string;
160
+ attachments?: AcpRuntimeTurnAttachment[];
161
+ mode: AcpRuntimePromptMode;
162
+ sessionMode: "persistent" | "oneshot";
163
+ requestId: string;
164
+ timeoutMs?: number;
165
+ signal?: AbortSignal;
166
+ }): AsyncIterable<AcpRuntimeEvent>;
167
+ getStatus(handle: AcpRuntimeHandle): Promise<AcpRuntimeStatus>;
168
+ setMode(handle: AcpRuntimeHandle, mode: string, sessionMode?: "persistent" | "oneshot"): Promise<void>;
169
+ setConfigOption(handle: AcpRuntimeHandle, key: string, value: string, sessionMode?: "persistent" | "oneshot"): Promise<void>;
170
+ cancel(handle: AcpRuntimeHandle): Promise<void>;
171
+ close(handle: AcpRuntimeHandle): Promise<void>;
172
+ private requireRecord;
173
+ }
174
+ //#endregion
175
+ //#region src/runtime/public/file-session-store.d.ts
176
+ declare function createFileSessionStore(options: AcpFileSessionStoreOptions): AcpSessionStore;
177
+ //#endregion
178
+ //#region src/runtime/public/errors.d.ts
179
+ declare const ACP_ERROR_CODES: readonly ["ACP_BACKEND_MISSING", "ACP_BACKEND_UNAVAILABLE", "ACP_BACKEND_UNSUPPORTED_CONTROL", "ACP_DISPATCH_DISABLED", "ACP_INVALID_RUNTIME_OPTION", "ACP_SESSION_INIT_FAILED", "ACP_TURN_FAILED"];
180
+ type AcpRuntimeErrorCode = (typeof ACP_ERROR_CODES)[number];
181
+ declare class AcpRuntimeError extends Error {
182
+ readonly code: AcpRuntimeErrorCode;
183
+ readonly cause?: unknown;
184
+ constructor(code: AcpRuntimeErrorCode, message: string, options?: {
185
+ cause?: unknown;
186
+ });
187
+ }
188
+ declare function isAcpRuntimeError(value: unknown): value is AcpRuntimeError;
189
+ //#endregion
190
+ //#region src/runtime/public/shared.d.ts
191
+ type AcpxHandleState = {
192
+ name: string;
193
+ agent: string;
194
+ cwd: string;
195
+ mode: "persistent" | "oneshot";
196
+ acpxRecordId?: string;
197
+ backendSessionId?: string;
198
+ agentSessionId?: string;
199
+ };
200
+ //#endregion
201
+ //#region src/runtime/public/handle-state.d.ts
202
+ declare function encodeAcpxRuntimeHandleState(state: AcpxHandleState): string;
203
+ declare function decodeAcpxRuntimeHandleState(runtimeSessionName: string): AcpxHandleState | null;
204
+ //#endregion
205
+ //#region src/runtime.d.ts
206
+ declare const ACPX_BACKEND_ID = "acpx";
207
+ type AcpxRuntimeLike = AcpRuntime & {
208
+ probeAvailability(): Promise<void>;
209
+ isHealthy(): boolean;
210
+ doctor(): Promise<AcpRuntimeDoctorReport>;
211
+ };
212
+ declare function createAgentRegistry(params?: {
213
+ overrides?: Record<string, string>;
214
+ }): AcpAgentRegistry;
215
+ declare class AcpxRuntime implements AcpxRuntimeLike {
216
+ private readonly options;
217
+ private readonly testOptions?;
218
+ private healthy;
219
+ private manager;
220
+ private managerPromise;
221
+ constructor(options: AcpRuntimeOptions, testOptions?: {
222
+ managerFactory?: (options: AcpRuntimeOptions) => AcpRuntimeManager;
223
+ probeRunner?: (options: AcpRuntimeOptions) => Promise<{
224
+ ok: boolean;
225
+ message: string;
226
+ details?: string[];
227
+ }>;
228
+ } | undefined);
229
+ isHealthy(): boolean;
230
+ probeAvailability(): Promise<void>;
231
+ doctor(): Promise<AcpRuntimeDoctorReport>;
232
+ ensureSession(input: AcpRuntimeEnsureInput): Promise<AcpRuntimeHandle>;
233
+ runTurn(input: AcpRuntimeTurnInput): AsyncIterable<AcpRuntimeEvent>;
234
+ getCapabilities(): AcpRuntimeCapabilities;
235
+ getStatus(input: {
236
+ handle: AcpRuntimeHandle;
237
+ signal?: AbortSignal;
238
+ }): Promise<AcpRuntimeStatus>;
239
+ setMode(input: {
240
+ handle: AcpRuntimeHandle;
241
+ mode: string;
242
+ }): Promise<void>;
243
+ setConfigOption(input: {
244
+ handle: AcpRuntimeHandle;
245
+ key: string;
246
+ value: string;
247
+ }): Promise<void>;
248
+ cancel(input: {
249
+ handle: AcpRuntimeHandle;
250
+ reason?: string;
251
+ }): Promise<void>;
252
+ close(input: {
253
+ handle: AcpRuntimeHandle;
254
+ reason: string;
255
+ }): Promise<void>;
256
+ private getManager;
257
+ private runProbe;
258
+ private resolveHandleState;
259
+ }
260
+ declare function createAcpRuntime(options: AcpRuntimeOptions): AcpxRuntime;
261
+ declare function createRuntimeStore(options: {
262
+ stateDir: string;
263
+ }): AcpSessionStore;
264
+ //#endregion
265
+ export { ACPX_BACKEND_ID, type AcpAgentRegistry, type AcpFileSessionStoreOptions, type AcpRuntime, type AcpRuntimeCapabilities, type AcpRuntimeDoctorReport, type AcpRuntimeEnsureInput, AcpRuntimeError, type AcpRuntimeErrorCode, type AcpRuntimeEvent, type AcpRuntimeHandle, type AcpRuntimeOptions, type AcpRuntimePromptMode, type AcpRuntimeSessionMode, type AcpRuntimeStatus, type AcpRuntimeTurnAttachment, type AcpRuntimeTurnInput, type AcpSessionRecord, type AcpSessionStore, type AcpSessionUpdateTag, AcpxRuntime, DEFAULT_AGENT_NAME, createAcpRuntime, createAgentRegistry, createFileSessionStore, createRuntimeStore, decodeAcpxRuntimeHandleState, encodeAcpxRuntimeHandleState, isAcpRuntimeError };
266
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","names":[],"sources":["../src/runtime/public/contract.ts","../src/agent-registry.ts","../src/runtime/engine/manager.ts","../src/runtime/public/file-session-store.ts","../src/runtime/public/errors.ts","../src/runtime/public/shared.ts","../src/runtime/public/handle-state.ts","../src/runtime.ts"],"mappings":";;;;KAOY,oBAAA;AAAA,KAEA,qBAAA;AAAA,KAEA,mBAAA;AAAA,KAaA,iBAAA;AAAA,KAEA,gBAAA;EACV,UAAA;EACA,OAAA;EACA,kBAAA;EACA,GAAA;EACA,YAAA;EACA,gBAAA;EACA,cAAA;AAAA;AAAA,KAGU,qBAAA;EACV,UAAA;EACA,KAAA;EACA,IAAA,EAAM,qBAAA;EACN,eAAA;EACA,GAAA;AAAA;AAAA,KAGU,wBAAA;EACV,SAAA;EACA,IAAA;AAAA;AAAA,KAGU,mBAAA;EACV,MAAA,EAAQ,gBAAA;EACR,IAAA;EACA,WAAA,GAAc,wBAAA;EACd,IAAA,EAAM,oBAAA;EACN,SAAA;EACA,SAAA;EACA,MAAA,GAAS,WAAA;AAAA;AAAA,KAGC,sBAAA;EACV,QAAA,EAAU,iBAAA;EACV,gBAAA;AAAA;AAAA,KAGU,gBAAA;EACV,OAAA;EACA,YAAA;EACA,gBAAA;EACA,cAAA;EACA,OAAA,GAAU,MAAA;AAAA;AAAA,KAGA,sBAAA;EACV,EAAA;EACA,IAAA;EACA,OAAA;EACA,cAAA;EACA,OAAA;AAAA;AAAA,KAGU,eAAA;EAEN,IAAA;EACA,IAAA;EACA,MAAA;EACA,GAAA,GAAM,mBAAA;AAAA;EAGN,IAAA;EACA,IAAA;EACA,GAAA,GAAM,mBAAA;EACN,IAAA;EACA,IAAA;AAAA;EAGA,IAAA;EACA,IAAA;EACA,GAAA,GAAM,mBAAA;EACN,UAAA;EACA,MAAA;EACA,KAAA;AAAA;EAGA,IAAA;EACA,UAAA;AAAA;EAGA,IAAA;EACA,OAAA;EACA,IAAA;EACA,SAAA;AAAA;AAAA,UAGW,UAAA;EACf,aAAA,CAAc,KAAA,EAAO,qBAAA,GAAwB,OAAA,CAAQ,gBAAA;EACrD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