@1agents/acp-service 0.8.0 → 0.8.1
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/README.md +5 -0
- package/dist/bin/acp-service.js +0 -0
- package/dist/src/a2a/executor.js +34 -9
- package/dist/src/a2a/index.d.ts +1 -0
- package/dist/src/a2a/index.js +1 -0
- package/dist/src/a2a/lease.d.ts +13 -0
- package/dist/src/a2a/lease.js +149 -0
- package/dist/src/a2a/request-id.d.ts +2 -0
- package/dist/src/a2a/request-id.js +6 -0
- package/dist/src/a2a/server.js +13 -1
- package/dist/src/a2a/store.d.ts +4 -6
- package/dist/src/a2a/store.js +14 -114
- package/dist/src/a2a/types.d.ts +9 -0
- package/dist/src/acp-connection.d.ts +2 -1
- package/dist/src/acp-connection.js +52 -9
- package/dist/src/bridge.js +38 -39
- package/package.json +3 -2
- package/vendor/dsh/README.md +12 -2
- package/vendor/dsh/a2a-executor.d.ts +7 -1
- package/vendor/dsh/a2a-executor.js +56 -15
- package/vendor/dsh/a2a.d.ts +2 -1
- package/vendor/dsh/a2a.js +9 -5
- package/vendor/dsh/adapter.d.ts +3 -1
- package/vendor/dsh/adapter.js +144 -16
- package/vendor/dsh/diagnostics.d.ts +42 -0
- package/vendor/dsh/diagnostics.js +176 -0
- package/vendor/dsh/index.d.ts +1 -0
- package/vendor/dsh/index.js +16 -4
- package/vendor/runtime/dist/{cli-DUHyAADv.js → cli-Bdzplbpj.js} +4 -4
- package/vendor/runtime/dist/{cli-DUHyAADv.js.map → cli-Bdzplbpj.js.map} +1 -1
- package/vendor/runtime/dist/cli.d.ts +1 -1
- package/vendor/runtime/dist/cli.js +8 -8
- package/vendor/runtime/dist/{client-DjkWknf7.d.ts → client-BXOiB0ND.d.ts} +2 -2
- package/vendor/runtime/dist/{client-DjkWknf7.d.ts.map → client-BXOiB0ND.d.ts.map} +1 -1
- package/vendor/runtime/dist/{flows-CiJSCy4D.js → flows-BKlAuzM8.js} +4 -4
- package/vendor/runtime/dist/{flows-CiJSCy4D.js.map → flows-BKlAuzM8.js.map} +1 -1
- package/vendor/runtime/dist/flows.d.ts +2 -2
- package/vendor/runtime/dist/flows.js +1 -1
- package/vendor/runtime/dist/{invocation-options-BlIySxIw.js → invocation-options-DMy77sEU.js} +4 -4
- package/vendor/runtime/dist/{invocation-options-BlIySxIw.js.map → invocation-options-DMy77sEU.js.map} +1 -1
- package/vendor/runtime/dist/{ipc-BlljKR2b.js → ipc-CLv2iL89.js} +260 -2
- package/vendor/runtime/dist/ipc-CLv2iL89.js.map +1 -0
- package/vendor/runtime/dist/{output-BzXQKArM.js → output-I-t-v55D.js} +3 -3
- package/vendor/runtime/dist/{output-BzXQKArM.js.map → output-I-t-v55D.js.map} +1 -1
- package/vendor/runtime/dist/{queue-owner-runtime-DSFdsS_y.js → queue-owner-runtime-RN3uSid0.js} +2 -2
- package/vendor/runtime/dist/{queue-owner-runtime-DSFdsS_y.js.map → queue-owner-runtime-RN3uSid0.js.map} +1 -1
- package/vendor/runtime/dist/runtime.d.ts +25 -15
- package/vendor/runtime/dist/runtime.d.ts.map +1 -1
- package/vendor/runtime/dist/runtime.js +57 -37
- package/vendor/runtime/dist/runtime.js.map +1 -1
- package/vendor/runtime/dist/{session-options-ORCchZGk.d.ts → session-options-DNnDfiUt.d.ts} +18 -2
- package/vendor/runtime/dist/session-options-DNnDfiUt.d.ts.map +1 -0
- package/vendor/runtime/dist/{session-watch-BiBTBMz4.js → session-watch-CmHbH0jS.js} +4 -4
- package/vendor/runtime/dist/{session-watch-BiBTBMz4.js.map → session-watch-CmHbH0jS.js.map} +1 -1
- package/vendor/runtime/dist/{watch-iYiP-lOo.js → watch-BE-kKa7o.js} +2 -2
- package/vendor/runtime/dist/{watch-iYiP-lOo.js.map → watch-BE-kKa7o.js.map} +1 -1
- package/vendor/runtime/skills/acpx/SKILL.md +1 -0
- package/vendor/runtime/dist/ipc-BlljKR2b.js.map +0 -1
- package/vendor/runtime/dist/session-options-ORCchZGk.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AcpAgentInspection, AcpAgentInspectionOptions, AcpAgentRegistry, AcpInspectableAgentRegistry, DEFAULT_AGENT_NAME, createAgentRegistry } from "./agent-registry.js";
|
|
2
|
-
import { A as
|
|
3
|
-
import { n as AcpControlAuthority, t as AcpClient } from "./client-
|
|
2
|
+
import { A as GrokExitPlanModeRequest, C as PermissionPolicy, D as SafeErrorOrigin, E as SafeErrorCategory, F as GrokAskUserQuestionResponse, M as GrokExitPlanOutcome, N as GrokAskUserAnswers, O as SessionRecord, P as GrokAskUserQuestionRequest, S as PermissionMode, T as SafeError, _ as AcpProcessSpawnFailure, a as AcpElicitationHandler, b as McpServer$1, c as AcpElicitationResponse, d as AcpPermissionHandler, f as AcpPermissionRequest, g as AcpProcessLifecycle, h as AcpProcessLaunchScope, i as AcpElicitationContext, j as GrokExitPlanModeResponse, k as PromptInput, l as AcpJsonRpcMessage, m as AcpProcessLaunch, n as SystemPromptOption, o as AcpElicitationMode, p as AcpProcessExit, s as AcpElicitationRequest, t as SessionAgentOptions, u as AcpPermissionDecision, v as AcpProcessStarted, x as NonInteractivePermissionPolicy, y as AuthPolicy } from "./session-options-DNnDfiUt.js";
|
|
3
|
+
import { n as AcpControlAuthority, t as AcpClient } from "./client-BXOiB0ND.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { SetSessionConfigOptionResponse, ToolCallContent, ToolCallLocation, ToolKind } from "@1agents/acp-runtime-sdk";
|
|
6
6
|
//#region src/acp/model-support.d.ts
|
|
@@ -393,19 +393,10 @@ type AcpRuntimeEvent = {
|
|
|
393
393
|
* Compatibility failure event emitted by runTurn(...). startTurn(...).events
|
|
394
394
|
* does not emit terminal events; use AcpRuntimeTurn.result instead.
|
|
395
395
|
*/
|
|
396
|
-
{
|
|
396
|
+
({
|
|
397
397
|
type: "error";
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
detailCode?: string;
|
|
401
|
-
retryable?: boolean;
|
|
402
|
-
};
|
|
403
|
-
type AcpRuntimeTurnResultError = {
|
|
404
|
-
message: string;
|
|
405
|
-
code?: string;
|
|
406
|
-
detailCode?: string;
|
|
407
|
-
retryable?: boolean;
|
|
408
|
-
};
|
|
398
|
+
} & AcpRuntimeTurnResultError);
|
|
399
|
+
type AcpRuntimeTurnResultError = Pick<SafeError, "message"> & Partial<Omit<SafeError, "message">>;
|
|
409
400
|
type AcpRuntimeTurnResult = {
|
|
410
401
|
status: "completed";
|
|
411
402
|
stopReason?: string;
|
|
@@ -688,6 +679,10 @@ type RuntimeEnsureInput = {
|
|
|
688
679
|
};
|
|
689
680
|
type RuntimeTurnTaskState = {
|
|
690
681
|
pendingCancel: boolean;
|
|
682
|
+
promptWritten: boolean;
|
|
683
|
+
authorityFailure?: {
|
|
684
|
+
error: unknown;
|
|
685
|
+
};
|
|
691
686
|
turnActive: boolean;
|
|
692
687
|
activeController: ActiveSessionController | null;
|
|
693
688
|
};
|
|
@@ -951,6 +946,21 @@ export declare class AcpRuntimeError extends Error {
|
|
|
951
946
|
}
|
|
952
947
|
export declare function isAcpRuntimeError(value: unknown): value is AcpRuntimeError;
|
|
953
948
|
//#endregion
|
|
949
|
+
//#region src/acp/error-normalization.d.ts
|
|
950
|
+
type SafeErrorOptions = {
|
|
951
|
+
origin?: SafeErrorOrigin;
|
|
952
|
+
/** A caller-owned request identifier, never a provider message. */
|
|
953
|
+
operationId?: string;
|
|
954
|
+
outcomeUnknown?: boolean;
|
|
955
|
+
/** Decode only a direct safe record from an owned boundary, never provider data. */
|
|
956
|
+
trustedProjection?: boolean;
|
|
957
|
+
};
|
|
958
|
+
/**
|
|
959
|
+
* Public bridge projection. No provider text, URLs, arbitrary data or unknown
|
|
960
|
+
* codes are copied. Resource categories describe failures, not retry policy.
|
|
961
|
+
*/
|
|
962
|
+
export declare function toSafeError(error: unknown, options?: SafeErrorOptions): SafeError;
|
|
963
|
+
//#endregion
|
|
954
964
|
//#region src/runtime/public/shared.d.ts
|
|
955
965
|
type AcpxHandleState = {
|
|
956
966
|
name: string;
|
|
@@ -1160,5 +1170,5 @@ export declare function createRuntimeStore(options: {
|
|
|
1160
1170
|
stateDir: string;
|
|
1161
1171
|
}): AcpSessionStore;
|
|
1162
1172
|
//#endregion
|
|
1163
|
-
export { type AcpAgentInspection, type AcpAgentInspectionOptions, type AcpAgentRegistry, type AcpElicitationContext, type AcpElicitationHandler, type AcpElicitationMode, type AcpElicitationRequest, type AcpElicitationResponse, type AcpFileSessionStoreOptions, type AcpInspectableAgentRegistry, type AcpPermissionDecision, type AcpPermissionHandler, type AcpPermissionRequest, type AcpProcessExit, type AcpProcessLaunch, type AcpProcessLaunchScope, type AcpProcessLifecycle, type AcpProcessSpawnFailure, type AcpProcessStarted, type AcpRuntime, type AcpRuntimeAvailableCommand, type AcpRuntimeCapabilities, type AcpRuntimeDoctorReport, type AcpRuntimeEnsureInput, type AcpRuntimeErrorCode, type AcpRuntimeEvent, type AcpRuntimeHandle, type AcpRuntimeOptions, type AcpRuntimePlanEntry, type AcpRuntimePromptMode, type AcpRuntimeSessionContext, type AcpRuntimeSessionMode, type AcpRuntimeSessionModels, type AcpRuntimeSessionPermissions, type AcpRuntimeSessionUsage, type AcpRuntimeStatus, type AcpRuntimeTurn, type AcpRuntimeTurnAttachment, type AcpRuntimeTurnInput, type AcpRuntimeTurnResult, type AcpRuntimeTurnResultError, type AcpRuntimeUsageBreakdown, type AcpRuntimeUsageCost, type AcpSessionRecord, type AcpSessionStore, type AcpSessionUpdateTag, type AcpTextDeltaOriginMeta, type AcpTurnJournalMutation, type AcpTurnJournalRecordResult, type AcpTurnJournalSnapshot, type AcpTurnJournalStatus, type AcpTurnJournalTurn, DEFAULT_AGENT_NAME, type InspectAgentModelsOptions, type PermissionPolicy, type RequestedModelUnsupportedErrorCode, type RequestedModelUnsupportedReason, type SessionAgentOptions, type SessionWatchEvent, type SessionWatchResult, type SharedAcpRuntimeOptions, type SystemPromptOption, createAgentRegistry };
|
|
1173
|
+
export { type AcpAgentInspection, type AcpAgentInspectionOptions, type AcpAgentRegistry, type AcpElicitationContext, type AcpElicitationHandler, type AcpElicitationMode, type AcpElicitationRequest, type AcpElicitationResponse, type AcpFileSessionStoreOptions, type AcpInspectableAgentRegistry, type AcpPermissionDecision, type AcpPermissionHandler, type AcpPermissionRequest, type AcpProcessExit, type AcpProcessLaunch, type AcpProcessLaunchScope, type AcpProcessLifecycle, type AcpProcessSpawnFailure, type AcpProcessStarted, type AcpRuntime, type AcpRuntimeAvailableCommand, type AcpRuntimeCapabilities, type AcpRuntimeDoctorReport, type AcpRuntimeEnsureInput, type AcpRuntimeErrorCode, type AcpRuntimeEvent, type AcpRuntimeHandle, type AcpRuntimeOptions, type AcpRuntimePlanEntry, type AcpRuntimePromptMode, type AcpRuntimeSessionContext, type AcpRuntimeSessionMode, type AcpRuntimeSessionModels, type AcpRuntimeSessionPermissions, type AcpRuntimeSessionUsage, type AcpRuntimeStatus, type AcpRuntimeTurn, type AcpRuntimeTurnAttachment, type AcpRuntimeTurnInput, type AcpRuntimeTurnResult, type AcpRuntimeTurnResultError, type AcpRuntimeUsageBreakdown, type AcpRuntimeUsageCost, type AcpSessionRecord, type AcpSessionStore, type AcpSessionUpdateTag, type AcpTextDeltaOriginMeta, type AcpTurnJournalMutation, type AcpTurnJournalRecordResult, type AcpTurnJournalSnapshot, type AcpTurnJournalStatus, type AcpTurnJournalTurn, DEFAULT_AGENT_NAME, type InspectAgentModelsOptions, type PermissionPolicy, type RequestedModelUnsupportedErrorCode, type RequestedModelUnsupportedReason, type SafeError, type SafeErrorCategory, type SafeErrorOrigin, type SessionAgentOptions, type SessionWatchEvent, type SessionWatchResult, type SharedAcpRuntimeOptions, type SystemPromptOption, createAgentRegistry };
|
|
1164
1174
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../src/acp/model-support.ts","../src/acp/config-option-support.ts","../src/acp/mode-support.ts","../src/session/journal.ts","../src/runtime/public/contract.ts","../src/runtime/public/probe.ts","../src/runtime/engine/turn.ts","../src/runtime/engine/manager.ts","../src/runtime/public/file-session-store.ts","../src/runtime/public/turn-journal.ts","../src/runtime/public/errors.ts","../src/runtime/public/shared.ts","../src/runtime/public/handle-state.ts","../src/runtime/shared.ts","../src/runtime.ts"],"mappings":";;;;;;qBAea;KAED,4CAA4C;qBAE3C;KAKD,0CAA0C;qBAEzC,uCAAuC;WACzC;WACA,QAAQ;WACR;EAGP,YAAA,iBACA,QAAQ,iCACR;IAAY;;;wBAoBA,iCACd,iBACC,SAAS;;;KCxDA;EACV;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA,SAAS;;;;KCXC;EACV;EACA;EACA;;KAGU;EACV;EACA,gBAAgB;;;;KCIN;EAEN;EACA;EACA,QAAQ;;EAGR;EACA;IAAS;IAAiB;IAAe;IAAqB;;;KAGxD;EAAsB;;EAC5B;EAAiB;EAA0B,SAAS;;EACpD;EAAsB;;EACtB;EAAqB;EAAmB,QAAQ;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../src/acp/model-support.ts","../src/acp/config-option-support.ts","../src/acp/mode-support.ts","../src/session/journal.ts","../src/runtime/public/contract.ts","../src/runtime/public/probe.ts","../src/runtime/engine/turn.ts","../src/runtime/engine/manager.ts","../src/runtime/public/file-session-store.ts","../src/runtime/public/turn-journal.ts","../src/runtime/public/errors.ts","../src/acp/error-normalization.ts","../src/runtime/public/shared.ts","../src/runtime/public/handle-state.ts","../src/runtime/shared.ts","../src/runtime.ts"],"mappings":";;;;;;qBAea;KAED,4CAA4C;qBAE3C;KAKD,0CAA0C;qBAEzC,uCAAuC;WACzC;WACA,QAAQ;WACR;EAGP,YAAA,iBACA,QAAQ,iCACR;IAAY;;;wBAoBA,iCACd,iBACC,SAAS;;;KCxDA;EACV;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA,SAAS;;;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IAChB,QAAQ;IACR;MACE;IAAU;IAAmB;;EAM3B,cAAc;IAAS,QAAQ;IAAkB;MAAsB;EAM7E,UAAU,OAAO;;;;;;;IAkCM,OAAA;MAAE;QAAiB;IAGd,YAAA;MAAE;QAAiB;;EAMxC,QAAQ,OAAO,sBAAsB,cAAc;EAkBpD,gBAAgB;IAAU,SAAS;MAAqB,QAAQ;EAWhE,UAAU;IACd,QAAQ;IACR,SAAS;MACP,QAAQ;EAMN,QACJ,OAAO;IAAwB,QAAQ;IAAkB;MACxD;EAMG,SACJ,OAAO;IAAwB,QAAQ;IAAkB;MACxD;EAMG,gBACJ,OAAO;IACL,QAAQ;IACR;IACA;MAED,QAAQ;EAML,OAAO;IAAS,QAAQ;IAAkB;MAAoB;EAM9D,oBAAoB;IAAS,QAAQ;MAAqB;EAM1D,MAAM;IACV,QAAQ;IACR;IACA;MACE;EAQJ,YAAY;UAeE;UAkBA;UAmBN;UAcA;;wBA+BM,iBAAiB,SAAS,oBAAoB;wBAI9C,mBAAmB;EAAW;IAAqB"}
|
|
@@ -1,28 +1,13 @@
|
|
|
1
|
-
import { A as findSession, B as assertPersistedKeyPolicy, C as textPrompt, Ct as normalizeOutputError, H as serializeSessionRecordForDisk, L as readSessionRecord, R as resolveSessionRecord, Tt as
|
|
1
|
+
import { A as findSession, B as assertPersistedKeyPolicy, C as textPrompt, Ct as normalizeOutputError, Dt as isAcpResourceNotFoundError, Et as extractAcpError, Ft as AcpRuntimeError, H as serializeSessionRecordForDisk, It as isAcpRuntimeError, L as readSessionRecord, R as resolveSessionRecord, Tt as toSafeError, V as parseSessionRecord, gt as writePrivateJsonFile, t as tryCancelOnRunningOwner, ut as defaultSessionEventLog, wt as safeErrorRejection } from "./ipc-CLv2iL89.js";
|
|
2
2
|
import { a as createAgentRegistry, i as DEFAULT_AGENT_NAME, k as normalizeAgentCommandInput } from "./agent-registry-CMg8LHKY.js";
|
|
3
|
-
import { $ as isRequestedModelUnsupportedError, A as applyInitialModelSelection, B as reconcileAgentSessionId, C as setSessionModeOnOwner, D as connectAndLoadSession, E as withConnectedSession, F as persistSessionOptions, G as recordSessionUpdate, I as sessionOptionsFromRecord, J as advertisedModelState, K as trimConversationForRuntime, L as applyConversation, M as applyRequestedModelIfAdvertised, N as setDesiredModeId, O as applyConfigOptionSelection, P as normalizeSessionOptionShape, Q as RequestedModelUnsupportedError, R as applyLifecycleSnapshotToRecord, T as setSessionModelOnOwner, U as recordClientOperation, V as cloneSessionConversation, W as recordPromptSubmission, X as REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, Y as AcpClient, Z as REQUESTED_MODEL_UNSUPPORTED_REASONS, _ as cancelSessionPrompt, c as LiveSessionCheckpoint, dt as TimeoutError, et as resolveRequestedConfigOption, ft as assertControlAuthority, h as ensureSession, j as applyModelSelection, k as applyConfigOptionsToRecord, l as runPromptTurn, mt as withTimeout, q as cloneSessionAcpxState, r as sendSession, s as DISCARD_OUTPUT_FORMATTER, tt as resolveRequestedModelId, v as closeSession, x as setSessionConfigOptionOnOwner, z as createInitialSessionRecord } from "./queue-owner-runtime-
|
|
4
|
-
import { t as watchSession } from "./watch-
|
|
3
|
+
import { $ as isRequestedModelUnsupportedError, A as applyInitialModelSelection, B as reconcileAgentSessionId, C as setSessionModeOnOwner, D as connectAndLoadSession, E as withConnectedSession, F as persistSessionOptions, G as recordSessionUpdate, I as sessionOptionsFromRecord, J as advertisedModelState, K as trimConversationForRuntime, L as applyConversation, M as applyRequestedModelIfAdvertised, N as setDesiredModeId, O as applyConfigOptionSelection, P as normalizeSessionOptionShape, Q as RequestedModelUnsupportedError, R as applyLifecycleSnapshotToRecord, T as setSessionModelOnOwner, U as recordClientOperation, V as cloneSessionConversation, W as recordPromptSubmission, X as REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, Y as AcpClient, Z as REQUESTED_MODEL_UNSUPPORTED_REASONS, _ as cancelSessionPrompt, c as LiveSessionCheckpoint, dt as TimeoutError, et as resolveRequestedConfigOption, ft as assertControlAuthority, h as ensureSession, j as applyModelSelection, k as applyConfigOptionsToRecord, l as runPromptTurn, mt as withTimeout, q as cloneSessionAcpxState, r as sendSession, s as DISCARD_OUTPUT_FORMATTER, tt as resolveRequestedModelId, v as closeSession, x as setSessionConfigOptionOnOwner, z as createInitialSessionRecord } from "./queue-owner-runtime-RN3uSid0.js";
|
|
4
|
+
import { t as watchSession } from "./watch-BE-kKa7o.js";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { createHash, randomUUID } from "node:crypto";
|
|
10
10
|
import { isDeepStrictEqual } from "node:util";
|
|
11
|
-
//#region src/runtime/public/errors.ts
|
|
12
|
-
var AcpRuntimeError = class extends Error {
|
|
13
|
-
code;
|
|
14
|
-
cause;
|
|
15
|
-
constructor(code, message, options) {
|
|
16
|
-
super(message);
|
|
17
|
-
this.name = "AcpRuntimeError";
|
|
18
|
-
this.code = code;
|
|
19
|
-
this.cause = options?.cause;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
function isAcpRuntimeError(value) {
|
|
23
|
-
return value instanceof AcpRuntimeError;
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
11
|
//#region src/runtime/engine/controls.ts
|
|
27
12
|
function advertisedConfigOptionIds(record) {
|
|
28
13
|
const configOptions = record?.acpx?.config_options;
|
|
@@ -1209,8 +1194,30 @@ async function startRuntimeClient(client, agent, timeoutMs) {
|
|
|
1209
1194
|
await withTimeout(client.start(), timeoutMs);
|
|
1210
1195
|
} catch (error) {
|
|
1211
1196
|
if (!(error instanceof TimeoutError)) throw error;
|
|
1212
|
-
|
|
1197
|
+
const executable = path.basename(agent.agentArgv?.[0] ?? agent.agentCommand.split(/\s+/)[0]);
|
|
1198
|
+
throw new AcpRuntimeError("ACP_SESSION_INIT_FAILED", `ACP agent ${executable} did not complete ACP initialization within ${timeoutMs}ms. Check that the configured command starts an ACP server.`, { cause: error });
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
function observeTurnAuthority(input, state) {
|
|
1202
|
+
if (!input.assertActive) return input;
|
|
1203
|
+
return {
|
|
1204
|
+
...input,
|
|
1205
|
+
assertActive: () => {
|
|
1206
|
+
try {
|
|
1207
|
+
input.assertActive?.();
|
|
1208
|
+
} catch (error) {
|
|
1209
|
+
state.authorityFailure = { error };
|
|
1210
|
+
throw error;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
function runtimeFailureRejection(task, error, safe) {
|
|
1216
|
+
if (task.state.authorityFailure && task.state.authorityFailure.error === error) {
|
|
1217
|
+
if (error instanceof Error) safe.message = error.message;
|
|
1218
|
+
return error;
|
|
1213
1219
|
}
|
|
1220
|
+
return safeErrorRejection(safe);
|
|
1214
1221
|
}
|
|
1215
1222
|
async function createOrLoadRuntimeSession(client, resumeSessionId, cwd) {
|
|
1216
1223
|
if (resumeSessionId) {
|
|
@@ -1889,6 +1896,7 @@ var AcpRuntimeManager = class {
|
|
|
1889
1896
|
let resultSettled = false;
|
|
1890
1897
|
const state = {
|
|
1891
1898
|
pendingCancel: false,
|
|
1899
|
+
promptWritten: false,
|
|
1892
1900
|
turnActive: true,
|
|
1893
1901
|
activeController: null
|
|
1894
1902
|
};
|
|
@@ -1915,7 +1923,7 @@ var AcpRuntimeManager = class {
|
|
|
1915
1923
|
};
|
|
1916
1924
|
if (input.signal && !input.signal.aborted) input.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1917
1925
|
this.queueSessionTask(input.handle.acpxRecordId ?? input.handle.sessionKey, async () => this.runRuntimeTurnTask({
|
|
1918
|
-
input,
|
|
1926
|
+
input: observeTurnAuthority(input, state),
|
|
1919
1927
|
promptInput,
|
|
1920
1928
|
queue,
|
|
1921
1929
|
promptStarted,
|
|
@@ -1983,16 +1991,18 @@ var AcpRuntimeManager = class {
|
|
|
1983
1991
|
* turn-results snapshot because that save would fail too.
|
|
1984
1992
|
*/
|
|
1985
1993
|
finalizationFailureResult(task, error) {
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1994
|
+
const normalized = toSafeError(error, {
|
|
1995
|
+
origin: "runtime",
|
|
1996
|
+
operationId: task.input.requestId
|
|
1997
|
+
});
|
|
1998
|
+
const rejection = runtimeFailureRejection(task, error, normalized);
|
|
1999
|
+
task.promptStarted.reject(rejection);
|
|
2000
|
+
task.sessionReady.reject(rejection);
|
|
1989
2001
|
return {
|
|
1990
2002
|
status: "failed",
|
|
1991
2003
|
error: {
|
|
1992
|
-
|
|
1993
|
-
...normalized
|
|
1994
|
-
...normalized.detailCode ? { detailCode: normalized.detailCode } : {},
|
|
1995
|
-
...normalized.retryable !== void 0 ? { retryable: normalized.retryable } : {}
|
|
2004
|
+
code: "RUNTIME",
|
|
2005
|
+
...normalized
|
|
1996
2006
|
}
|
|
1997
2007
|
};
|
|
1998
2008
|
}
|
|
@@ -2011,7 +2021,10 @@ var AcpRuntimeManager = class {
|
|
|
2011
2021
|
timeoutMs: task.input.timeoutMs ?? this.options.timeoutMs,
|
|
2012
2022
|
conversation: turn.conversation,
|
|
2013
2023
|
promptMessageId: turn.promptMessageId,
|
|
2014
|
-
onPromptRequestWritten: () =>
|
|
2024
|
+
onPromptRequestWritten: () => {
|
|
2025
|
+
task.state.promptWritten = true;
|
|
2026
|
+
task.promptStarted.resolve();
|
|
2027
|
+
},
|
|
2015
2028
|
onElicitation: task.input.onElicitation,
|
|
2016
2029
|
onPermissionRequest: task.input.onPermissionRequest,
|
|
2017
2030
|
authority: task.input
|
|
@@ -2306,17 +2319,20 @@ var AcpRuntimeManager = class {
|
|
|
2306
2319
|
await this.saveCompletedRuntimeTurn(turn);
|
|
2307
2320
|
}
|
|
2308
2321
|
async failRuntimeTurn(task, turn, error) {
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2322
|
+
const normalized = toSafeError(error, {
|
|
2323
|
+
origin: "runtime",
|
|
2324
|
+
operationId: task.input.requestId,
|
|
2325
|
+
outcomeUnknown: task.state.promptWritten && !extractAcpError(error)
|
|
2326
|
+
});
|
|
2327
|
+
const rejection = runtimeFailureRejection(task, error, normalized);
|
|
2328
|
+
task.promptStarted.reject(rejection);
|
|
2329
|
+
task.sessionReady.reject(rejection);
|
|
2312
2330
|
if (turn) await this.saveTerminalRuntimeTurn(turn, "failed", "runtime_error", normalized.code ?? normalized.detailCode).catch(() => {});
|
|
2313
2331
|
return {
|
|
2314
2332
|
status: "failed",
|
|
2315
2333
|
error: {
|
|
2316
|
-
|
|
2317
|
-
...normalized
|
|
2318
|
-
...normalized.detailCode ? { detailCode: normalized.detailCode } : {},
|
|
2319
|
-
...normalized.retryable !== void 0 ? { retryable: normalized.retryable } : {}
|
|
2334
|
+
code: "RUNTIME",
|
|
2335
|
+
...normalized
|
|
2320
2336
|
}
|
|
2321
2337
|
};
|
|
2322
2338
|
}
|
|
@@ -2381,7 +2397,11 @@ var AcpRuntimeManager = class {
|
|
|
2381
2397
|
async *runTurn(input) {
|
|
2382
2398
|
const turn = this.startTurn(input);
|
|
2383
2399
|
yield* turn.events;
|
|
2384
|
-
|
|
2400
|
+
const result = await turn.result;
|
|
2401
|
+
yield result.status === "failed" ? {
|
|
2402
|
+
type: "error",
|
|
2403
|
+
...result.error
|
|
2404
|
+
} : legacyTerminalEventFromTurnResult(result);
|
|
2385
2405
|
}
|
|
2386
2406
|
getStatus(handle) {
|
|
2387
2407
|
this.assertOpen();
|
|
@@ -3672,6 +3692,6 @@ function createRuntimeStore(options) {
|
|
|
3672
3692
|
return createFileSessionStore(options);
|
|
3673
3693
|
}
|
|
3674
3694
|
//#endregion
|
|
3675
|
-
export { ACPX_BACKEND_ID, AcpRuntimeError, AcpxRuntime, DEFAULT_AGENT_NAME, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, REQUESTED_MODEL_UNSUPPORTED_REASONS, RequestedModelUnsupportedError, SharedAcpRuntime, createAcpRuntime, createAgentRegistry, createFileSessionStore, createRuntimeStore, createSharedAcpRuntime, createTurnJournal, decodeAcpxRuntimeHandleState, encodeAcpxRuntimeHandleState, inspectAgentModels, isAcpRuntimeError, isRequestedModelUnsupportedError };
|
|
3695
|
+
export { ACPX_BACKEND_ID, AcpRuntimeError, AcpxRuntime, DEFAULT_AGENT_NAME, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, REQUESTED_MODEL_UNSUPPORTED_REASONS, RequestedModelUnsupportedError, SharedAcpRuntime, createAcpRuntime, createAgentRegistry, createFileSessionStore, createRuntimeStore, createSharedAcpRuntime, createTurnJournal, decodeAcpxRuntimeHandleState, encodeAcpxRuntimeHandleState, inspectAgentModels, isAcpRuntimeError, isRequestedModelUnsupportedError, toSafeError };
|
|
3676
3696
|
|
|
3677
3697
|
//# sourceMappingURL=runtime.js.map
|