acpx 0.13.2 → 0.15.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 (34) hide show
  1. package/README.md +4 -3
  2. package/dist/{cli-DJT3MRRI.js → cli-Cen2Rb6S.js} +4 -4
  3. package/dist/{cli-DJT3MRRI.js.map → cli-Cen2Rb6S.js.map} +1 -1
  4. package/dist/cli.d.ts +5 -6
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +11 -8
  7. package/dist/cli.js.map +1 -1
  8. package/dist/{client-CxNllqui.d.ts → client-Cvz6msGc.d.ts} +8 -3
  9. package/dist/client-Cvz6msGc.d.ts.map +1 -0
  10. package/dist/{flags-CM2rAdBo.js → flags-CRh8BJre.js} +21 -4
  11. package/dist/flags-CRh8BJre.js.map +1 -0
  12. package/dist/{flows-BiRKgCnW.js → flows-D-F3Y2o9.js} +436 -63
  13. package/dist/flows-D-F3Y2o9.js.map +1 -0
  14. package/dist/flows.d.ts +27 -17
  15. package/dist/flows.d.ts.map +1 -1
  16. package/dist/flows.js +1 -1
  17. package/dist/{live-checkpoint-Gw2oGjhe.js → live-checkpoint-CYRs-D9t.js} +312 -124
  18. package/dist/live-checkpoint-CYRs-D9t.js.map +1 -0
  19. package/dist/{output-DiPPprGk.js → output-CIVecnHU.js} +42 -9
  20. package/dist/output-CIVecnHU.js.map +1 -0
  21. package/dist/runtime.d.ts +22 -15
  22. package/dist/runtime.d.ts.map +1 -1
  23. package/dist/runtime.js +46 -8
  24. package/dist/runtime.js.map +1 -1
  25. package/dist/{session-options-DwRDODlr.d.ts → session-options-DyIGRNfu.d.ts} +48 -2
  26. package/dist/session-options-DyIGRNfu.d.ts.map +1 -0
  27. package/package.json +10 -10
  28. package/skills/acpx/SKILL.md +5 -0
  29. package/dist/client-CxNllqui.d.ts.map +0 -1
  30. package/dist/flags-CM2rAdBo.js.map +0 -1
  31. package/dist/flows-BiRKgCnW.js.map +0 -1
  32. package/dist/live-checkpoint-Gw2oGjhe.js.map +0 -1
  33. package/dist/output-DiPPprGk.js.map +0 -1
  34. package/dist/session-options-DwRDODlr.d.ts.map +0 -1
package/dist/runtime.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { _ as SessionRecord, a as AcpElicitationHandler, c as AcpElicitationResponse, f as McpServer$1, h as PermissionPolicy, i as AcpElicitationContext, l as AcpPermissionDecision, m as PermissionMode, n as SystemPromptOption, o as AcpElicitationMode, p as NonInteractivePermissionPolicy, s as AcpElicitationRequest, t as SessionAgentOptions, u as AcpPermissionRequest } from "./session-options-DwRDODlr.js";
2
- import { a as RequestedModelUnsupportedErrorCode, i as RequestedModelUnsupportedError, n as REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, o as RequestedModelUnsupportedReason, r as REQUESTED_MODEL_UNSUPPORTED_REASONS, s as isRequestedModelUnsupportedError, t as AcpClient } from "./client-CxNllqui.js";
1
+ import { C as SessionRecord, a as AcpElicitationHandler, b as PermissionMode, c as AcpElicitationResponse, d as AcpProcessExit, f as AcpProcessLaunch, g as AcpProcessStarted, h as AcpProcessSpawnFailure, i as AcpElicitationContext, l as AcpPermissionDecision, m as AcpProcessLifecycle, n as SystemPromptOption, o as AcpElicitationMode, p as AcpProcessLaunchScope, s as AcpElicitationRequest, t as SessionAgentOptions, u as AcpPermissionRequest, v as McpServer$1, x as PermissionPolicy, y as NonInteractivePermissionPolicy } from "./session-options-DyIGRNfu.js";
2
+ import { a as RequestedModelUnsupportedErrorCode, i as RequestedModelUnsupportedError, n as REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, o as RequestedModelUnsupportedReason, r as REQUESTED_MODEL_UNSUPPORTED_REASONS, s as isRequestedModelUnsupportedError, t as AcpClient } from "./client-Cvz6msGc.js";
3
3
  import fs from "node:fs";
4
4
  import { SetSessionConfigOptionResponse, ToolCallContent, ToolCallLocation, ToolKind } from "@agentclientprotocol/sdk";
5
5
  //#region src/agent-registry.d.ts
6
- declare const DEFAULT_AGENT_NAME = "codex";
6
+ export declare const DEFAULT_AGENT_NAME = "codex";
7
7
  //#endregion
8
8
  //#region src/runtime/public/contract.d.ts
9
9
  type AcpRuntimePromptMode = "prompt" | "steer";
@@ -206,6 +206,7 @@ type AcpRuntimeEvent = {
206
206
  {
207
207
  type: "done";
208
208
  stopReason?: string;
209
+ _meta?: Record<string, unknown> | null;
209
210
  } |
210
211
  /**
211
212
  * Compatibility failure event emitted by runTurn(...). startTurn(...).events
@@ -227,16 +228,18 @@ type AcpRuntimeTurnResultError = {
227
228
  type AcpRuntimeTurnResult = {
228
229
  status: "completed";
229
230
  stopReason?: string;
231
+ _meta?: Record<string, unknown> | null;
230
232
  } | {
231
233
  status: "cancelled";
232
234
  stopReason?: string;
235
+ _meta?: Record<string, unknown> | null;
233
236
  } | {
234
237
  status: "failed";
235
238
  error: AcpRuntimeTurnResultError;
236
239
  };
237
240
  interface AcpRuntimeTurn {
238
241
  readonly requestId: string;
239
- /** Resolves after `connection.prompt()` returns its request promise. */
242
+ /** Resolves after the underlying writable transport accepts the prompt request. */
240
243
  readonly promptStarted: Promise<void>;
241
244
  readonly events: AsyncIterable<AcpRuntimeEvent>;
242
245
  /**
@@ -299,6 +302,8 @@ interface AcpAgentRegistry {
299
302
  }
300
303
  type AcpRuntimeOptions = {
301
304
  cwd: string;
305
+ /** Trusted child-only environment, snapshotted at construction and never persisted. */
306
+ agentProcessEnv?: Record<string, string>;
302
307
  sessionStore: AcpSessionStore;
303
308
  agentRegistry: AcpAgentRegistry;
304
309
  mcpServers?: McpServer$1[];
@@ -310,6 +315,8 @@ type AcpRuntimeOptions = {
310
315
  verbose?: boolean;
311
316
  /** ACP elicitation modes the embedding host can render for prompt turns. */
312
317
  elicitationModes?: readonly AcpElicitationMode[];
318
+ /** Optional lifecycle observer for ACP agent processes owned by this runtime. */
319
+ processLifecycle?: AcpProcessLifecycle;
313
320
  onPermissionRequest?: (req: AcpPermissionRequest, ctx: {
314
321
  signal: AbortSignal;
315
322
  }) => Promise<AcpPermissionDecision | undefined>;
@@ -442,19 +449,19 @@ declare class AcpRuntimeManager {
442
449
  }
443
450
  //#endregion
444
451
  //#region src/runtime/public/file-session-store.d.ts
445
- declare function createFileSessionStore(options: AcpFileSessionStoreOptions): AcpSessionStore;
452
+ export declare function createFileSessionStore(options: AcpFileSessionStoreOptions): AcpSessionStore;
446
453
  //#endregion
447
454
  //#region src/runtime/public/errors.d.ts
448
455
  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"];
449
456
  type AcpRuntimeErrorCode = (typeof ACP_ERROR_CODES)[number];
450
- declare class AcpRuntimeError extends Error {
457
+ export declare class AcpRuntimeError extends Error {
451
458
  readonly code: AcpRuntimeErrorCode;
452
459
  readonly cause?: unknown;
453
460
  constructor(code: AcpRuntimeErrorCode, message: string, options?: {
454
461
  cause?: unknown;
455
462
  });
456
463
  }
457
- declare function isAcpRuntimeError(value: unknown): value is AcpRuntimeError;
464
+ export declare function isAcpRuntimeError(value: unknown): value is AcpRuntimeError;
458
465
  //#endregion
459
466
  //#region src/runtime/public/shared.d.ts
460
467
  type AcpxHandleState = {
@@ -468,20 +475,20 @@ type AcpxHandleState = {
468
475
  };
469
476
  //#endregion
470
477
  //#region src/runtime/public/handle-state.d.ts
471
- declare function encodeAcpxRuntimeHandleState(state: AcpxHandleState): string;
472
- declare function decodeAcpxRuntimeHandleState(runtimeSessionName: string): AcpxHandleState | null;
478
+ export declare function encodeAcpxRuntimeHandleState(state: AcpxHandleState): string;
479
+ export declare function decodeAcpxRuntimeHandleState(runtimeSessionName: string): AcpxHandleState | null;
473
480
  //#endregion
474
481
  //#region src/runtime.d.ts
475
- declare const ACPX_BACKEND_ID = "acpx";
482
+ export declare const ACPX_BACKEND_ID = "acpx";
476
483
  type AcpxRuntimeLike = AcpRuntime & {
477
484
  probeAvailability(): Promise<void>;
478
485
  isHealthy(): boolean;
479
486
  doctor(): Promise<AcpRuntimeDoctorReport>;
480
487
  };
481
- declare function createAgentRegistry(params?: {
488
+ export declare function createAgentRegistry(params?: {
482
489
  overrides?: Record<string, string | string[]>;
483
490
  }): AcpAgentRegistry;
484
- declare class AcpxRuntime implements AcpxRuntimeLike {
491
+ export declare class AcpxRuntime implements AcpxRuntimeLike {
485
492
  private readonly options;
486
493
  private readonly testOptions?;
487
494
  private healthy;
@@ -544,10 +551,10 @@ declare class AcpxRuntime implements AcpxRuntimeLike {
544
551
  private resolveManagerHandle;
545
552
  private resolveHandleState;
546
553
  }
547
- declare function createAcpRuntime(options: AcpRuntimeOptions): AcpxRuntime;
548
- declare function createRuntimeStore(options: {
554
+ export declare function createAcpRuntime(options: AcpRuntimeOptions): AcpxRuntime;
555
+ export declare function createRuntimeStore(options: {
549
556
  stateDir: string;
550
557
  }): AcpSessionStore;
551
558
  //#endregion
552
- export { ACPX_BACKEND_ID, type AcpAgentRegistry, type AcpElicitationContext, type AcpElicitationHandler, type AcpElicitationMode, type AcpElicitationRequest, type AcpElicitationResponse, type AcpFileSessionStoreOptions, type AcpPermissionDecision, type AcpPermissionRequest, type AcpRuntime, type AcpRuntimeAvailableCommand, type AcpRuntimeCapabilities, type AcpRuntimeDoctorReport, type AcpRuntimeEnsureInput, AcpRuntimeError, type AcpRuntimeErrorCode, type AcpRuntimeEvent, type AcpRuntimeHandle, type AcpRuntimeOptions, type AcpRuntimePromptMode, type AcpRuntimeSessionMode, type AcpRuntimeSessionModels, 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, AcpxRuntime, DEFAULT_AGENT_NAME, type PermissionPolicy, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, REQUESTED_MODEL_UNSUPPORTED_REASONS, RequestedModelUnsupportedError, type RequestedModelUnsupportedErrorCode, type RequestedModelUnsupportedReason, type SessionAgentOptions, type SystemPromptOption, createAcpRuntime, createAgentRegistry, createFileSessionStore, createRuntimeStore, decodeAcpxRuntimeHandleState, encodeAcpxRuntimeHandleState, isAcpRuntimeError, isRequestedModelUnsupportedError };
559
+ export { type AcpAgentRegistry, type AcpElicitationContext, type AcpElicitationHandler, type AcpElicitationMode, type AcpElicitationRequest, type AcpElicitationResponse, type AcpFileSessionStoreOptions, type AcpPermissionDecision, 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 AcpRuntimePromptMode, type AcpRuntimeSessionMode, type AcpRuntimeSessionModels, 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 PermissionPolicy, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, REQUESTED_MODEL_UNSUPPORTED_REASONS, RequestedModelUnsupportedError, type RequestedModelUnsupportedErrorCode, type RequestedModelUnsupportedReason, type SessionAgentOptions, type SystemPromptOption, isRequestedModelUnsupportedError };
553
560
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","names":[],"sources":["../src/agent-registry.ts","../src/runtime/public/contract.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":";;;;;cAkHa;;;KClFD;KAEA;KAEA;KAaA;KAEA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA,MAAM;EACN;EACA;;;;;;;;;EASA,iBAAiB;;KAGP;;;;;EAKV;EACA;;KAGU;EACV,QAAQ;EACR;EACA,cAAc;EACd,MAAM;EACN;EACA;EACA,SAAS;;EAET,gBAAgB;;KAGN;EACV,UAAU;EACV;;KAGU;EACV;EACA;;;;;;;KAQU;EACV;EACA;;;;;;;KAQU;EACV;EACA;EACA;EACA;EACA;EACA;;;;;;;;KASU;EACV;EACA;;EAEA;;;;;;;KAQU;EACV,aAAa;;EAEb,OAAO;;EAEP,aAAa,eAAe;;KAGlB;EACV;EACA;EACA;EACA;EACA,SAAS;;EAET,QAAQ;;;;;;;EAOR,oBAAoB;EACpB,UAAU;;KAGA;EACV;EACA;EACA;EACA;EACA;;;;;;KAOU;EACV;EACA;EACA;;KAGU;EAEN;EACA;EACA;EACA,MAAM;;;;;;;;;EASN;;;;;;;;;;EAUA,OAAO;;EAGP;EACA;EACA,MAAM;EACN;EACA;;EAEA,OAAO;;;;;;EAMP,YAAY;;;;;;;EAOZ,oBAAoB;;EAGpB;EACA;EACA,MAAM;EACN;EACA;EACA;EACA,OAAO;EACP,YAAY;EACZ;EACA;EACA,UAAU;;;;;;;EAOV;EACA;;;;;;;EAOA;EACA;EACA;EACA;EACA;;KAGM;EACV;EACA;EACA;EACA;;KAGU;EAEN;EACA;;EAGA;EACA;;EAGA;EACA,OAAO;;UAGI;WACN;;WAEA,eAAe;WACf,QAAQ,cAAc;;;;;;WAMtB,QAAQ,QAAQ;EACzB,OAAO;IAAU;MAAoB;EACrC,YAAY;IAAU;MAAoB;;U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QAAQ;EAyBhE,UAAU;IACd,QAAQ;IACR,SAAS;MACP,QAAQ;EAMN,QAAQ;IAAS,QAAQ;IAAkB;MAAiB;EAM5D,gBAAgB;IACpB,QAAQ;IACR;IACA;MACE,QAAQ;EAMN,OAAO;IAAS,QAAQ;IAAkB;MAAoB;EAM9D,MAAM;IACV,QAAQ;IACR;IACA;MACE;UAQU;UAeA;UAIN;UAcA;;iBA+BM,iBAAiB,SAAS,oBAAoB;iBAI9C,mBAAmB;EAAW;IAAqB"}
1
+ {"version":3,"file":"runtime.d.ts","names":[],"sources":["../src/agent-registry.ts","../src/runtime/public/contract.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":";;;;;qBAoHa;;;KC7ED;KAEA;KAEA;KAaA;KAEA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA,MAAM;EACN;EACA;;;;;;;;;EASA,iBAAiB;;KAGP;;;;;EAKV;EACA;;KAGU;EACV,QAAQ;EACR;EACA,cAAc;EACd,MAAM;EACN;EACA;EACA,SAAS;;EAET,gBAAgB;;KAGN;EACV,UAAU;EACV;;KAGU;EACV;EACA;;;;;;;KAQU;EACV;EACA;;;;;;;KAQU;EACV;EACA;EACA;EACA;EACA;EACA;;;;;;;;KASU;EACV;EACA;;EAEA;;;;;;;KAQU;EACV,aAAa;;EAEb,OAAO;;EAEP,aAAa,eAAe;;KAGlB;EACV;EACA;EACA;EACA;EACA,SAAS;;EAET,QAAQ;;;;;;;EAOR,oBAAoB;EACpB,UAAU;;KAGA;EACV;EACA;EACA;EACA;EACA;;;;;;KAOU;EACV;EACA;EACA;;KAGU;EAEN;EACA;EACA;EACA,MAAM;;;;;;;;;EASN;;;;;;;;;;EAUA,OAAO;;EAGP;EACA;EACA,MAAM;EACN;EACA;;EAEA,OAAO;;;;;;EAMP,YAAY;;;;;;;EAOZ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QAAQ;;wBAGJ,oBAAoB;EAClC,YAAY;IACV;qBAuCS,uBAAuB;mBAMf;mBACA;UANX;UACA;UACA;EAGW,YAAA,SAAS,mBACT;IACf,kBAAkB,SAAS,sBAAsB;IACjD,eAAe,SAAS,sBAAsB;MAC5C;MACA;MACA;;;EASN;EAIM,qBAAqB;EAKrB,UAAU,QAAQ;EAWlB,cAAc,OAAO,wBAAwB,QAAQ;EAyC3D,UAAU,OAAO;;;;;;;IA8BM,OAAA;MAAE;QAAiB;IAGd,YAAA;MAAE;QAAiB;;EAMxC,QAAQ,OAAO,sBAAsB,cAAc;EAgBpD,gBAAgB;IAAU,SAAS;MAAqB,QAAQ;EAyBhE,UAAU;IACd,QAAQ;IACR,SAAS;MACP,QAAQ;EAMN,QAAQ;IAAS,QAAQ;IAAkB;MAAiB;EAM5D,gBAAgB;IACpB,QAAQ;IACR;IACA;MACE,QAAQ;EAMN,OAAO;IAAS,QAAQ;IAAkB;MAAoB;EAM9D,MAAM;IACV,QAAQ;IACR;IACA;MACE;UAQU;UAeA;UAIN;UAcA;;wBA+BM,iBAAiB,SAAS,oBAAoB;wBAI9C,mBAAmB;EAAW;IAAqB"}
package/dist/runtime.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as RequestedModelUnsupportedError, At as DEFAULT_AGENT_NAME, Bt as extractAcpError, C as sessionOptionsFromRecord, D as AcpClient, E as reconcileAgentSessionId, Ft as resolveCanonicalAgentName, M as modelStateFromConfigOptions, Mt as normalizeAgentName, N as normalizeAgentCommandInput, Nt as resolveAgentArgv, O as REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, Pt as resolveAgentCommand, Q as assertPersistedKeyPolicy, S as persistSessionOptions, T as applyLifecycleSnapshotToRecord, Tt as textPrompt, Vt as isAcpResourceNotFoundError, Z as createAtomicWriteTempPath, _ as recordPromptSubmission, a as applyConfigOptionSelection, b as advertisedModelState, c as applyRequestedModelIfAdvertised, ct as serializeSessionRecordForDisk, d as setDesiredModeId, dt as defaultSessionEventLog, f as syncAdvertisedModelState, g as recordClientOperation, h as createSessionConversation, i as connectAndLoadSession, j as isRequestedModelUnsupportedError, jt as listBuiltInAgents, k as REQUESTED_MODEL_UNSUPPORTED_REASONS, kt as withTimeout, l as currentModelIdFromSetModelResponse, m as cloneSessionConversation, n as runPromptTurn, o as applyConfigOptionsToRecord, p as cloneSessionAcpxState, r as withConnectedSession, s as applyModelSelection, st as parseSessionRecord, t as LiveSessionCheckpoint, u as setCurrentModelId, v as recordSessionUpdate, w as applyConversation, y as trimConversationForRuntime, zt as normalizeOutputError } from "./live-checkpoint-Gw2oGjhe.js";
1
+ import { A as RequestedModelUnsupportedError, At as DEFAULT_AGENT_NAME, Bt as extractAcpError, C as sessionOptionsFromRecord, D as AcpClient, E as reconcileAgentSessionId, Ft as resolveCanonicalAgentName, M as modelStateFromConfigOptions, Mt as normalizeAgentName, N as normalizeAgentCommandInput, Nt as resolveAgentArgv, O as REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, Pt as resolveAgentCommand, Q as assertPersistedKeyPolicy, S as persistSessionOptions, T as applyLifecycleSnapshotToRecord, Tt as textPrompt, Vt as isAcpResourceNotFoundError, Z as createAtomicWriteTempPath, _ as recordPromptSubmission, a as applyConfigOptionSelection, b as advertisedModelState, c as applyRequestedModelIfAdvertised, ct as serializeSessionRecordForDisk, d as setDesiredModeId, dt as defaultSessionEventLog, f as syncAdvertisedModelState, g as recordClientOperation, h as createSessionConversation, i as connectAndLoadSession, j as isRequestedModelUnsupportedError, jt as listBuiltInAgents, k as REQUESTED_MODEL_UNSUPPORTED_REASONS, kt as withTimeout, l as currentModelIdFromSetModelResponse, m as cloneSessionConversation, n as runPromptTurn, o as applyConfigOptionsToRecord, p as cloneSessionAcpxState, r as withConnectedSession, s as applyModelSelection, st as parseSessionRecord, t as LiveSessionCheckpoint, u as setCurrentModelId, v as recordSessionUpdate, w as applyConversation, y as trimConversationForRuntime, zt as normalizeOutputError } from "./live-checkpoint-CYRs-D9t.js";
2
2
  import path from "node:path";
3
3
  import fs from "node:fs/promises";
4
4
  import { randomUUID } from "node:crypto";
@@ -655,7 +655,8 @@ function legacyTerminalEventFromTurnResult(result) {
655
655
  };
656
656
  return {
657
657
  type: "done",
658
- ...result.stopReason ? { stopReason: result.stopReason } : {}
658
+ ...result.stopReason ? { stopReason: result.stopReason } : {},
659
+ ...result._meta === void 0 ? {} : { _meta: result._meta }
659
660
  };
660
661
  }
661
662
  function statusSummary(record) {
@@ -788,7 +789,11 @@ var AcpRuntimeManager = class {
788
789
  this.deps = deps;
789
790
  }
790
791
  createClient(options) {
791
- return this.deps.clientFactory?.(options) ?? new AcpClient(options);
792
+ const clientOptions = {
793
+ ...options,
794
+ agentProcessEnv: this.options.agentProcessEnv
795
+ };
796
+ return this.deps.clientFactory?.(clientOptions) ?? new AcpClient(clientOptions);
792
797
  }
793
798
  createSessionOwner(input) {
794
799
  const owner = {
@@ -953,7 +958,14 @@ var AcpRuntimeManager = class {
953
958
  sessionRecordId: record.acpxRecordId,
954
959
  loadRecord: async (sessionRecordId) => await this.requireRecord(sessionRecordId),
955
960
  saveRecord: async (connectedRecord) => await this.options.sessionStore.save(connectedRecord),
956
- createClient: (options) => this.createClient(options),
961
+ createClient: (options) => this.createClient({
962
+ ...options,
963
+ processLifecycle: this.options.processLifecycle,
964
+ processLaunchScope: {
965
+ kind: "runtime-session",
966
+ sessionKey: record.name ?? record.acpxRecordId
967
+ }
968
+ }),
957
969
  mcpServers: [...this.options.mcpServers ?? []],
958
970
  permissionMode: this.options.permissionMode,
959
971
  nonInteractivePermissions: this.options.nonInteractivePermissions,
@@ -1062,6 +1074,11 @@ var AcpRuntimeManager = class {
1062
1074
  permissionPolicy: this.options.permissionPolicy,
1063
1075
  onPermissionRequest: this.options.onPermissionRequest,
1064
1076
  elicitationModes: this.options.elicitationModes,
1077
+ processLifecycle: this.options.processLifecycle,
1078
+ processLaunchScope: {
1079
+ kind: "runtime-session",
1080
+ sessionKey: input.sessionKey
1081
+ },
1065
1082
  verbose: this.options.verbose,
1066
1083
  sessionOptions: input.sessionOptions
1067
1084
  });
@@ -1242,7 +1259,8 @@ var AcpRuntimeManager = class {
1242
1259
  await this.saveCompletedRuntimeTurn(turn, response.stopReason);
1243
1260
  terminalResult = {
1244
1261
  status: response.stopReason === "cancelled" ? "cancelled" : "completed",
1245
- ...response.stopReason ? { stopReason: response.stopReason } : {}
1262
+ ...response.stopReason ? { stopReason: response.stopReason } : {},
1263
+ ...response._meta === void 0 ? {} : { _meta: response._meta }
1246
1264
  };
1247
1265
  }
1248
1266
  } catch (error) {
@@ -1264,7 +1282,7 @@ var AcpRuntimeManager = class {
1264
1282
  timeoutMs: task.input.timeoutMs ?? this.options.timeoutMs,
1265
1283
  conversation: turn.conversation,
1266
1284
  promptMessageId: turn.promptMessageId,
1267
- onPromptRequestStarted: () => task.promptStarted.resolve(),
1285
+ onPromptRequestWritten: () => task.promptStarted.resolve(),
1268
1286
  onElicitation: task.input.onElicitation
1269
1287
  });
1270
1288
  } finally {
@@ -1386,6 +1404,11 @@ var AcpRuntimeManager = class {
1386
1404
  permissionPolicy: this.options.permissionPolicy,
1387
1405
  onPermissionRequest: this.options.onPermissionRequest,
1388
1406
  elicitationModes: this.options.elicitationModes,
1407
+ processLifecycle: this.options.processLifecycle,
1408
+ processLaunchScope: {
1409
+ kind: "runtime-session",
1410
+ sessionKey: record.name ?? record.acpxRecordId
1411
+ },
1389
1412
  verbose: this.options.verbose,
1390
1413
  sessionOptions: sessionOptionsFromRecord(record)
1391
1414
  });
@@ -1720,6 +1743,11 @@ var AcpRuntimeManager = class {
1720
1743
  permissionPolicy: this.options.permissionPolicy,
1721
1744
  onPermissionRequest: this.options.onPermissionRequest,
1722
1745
  elicitationModes: this.options.elicitationModes,
1746
+ processLifecycle: this.options.processLifecycle,
1747
+ processLaunchScope: {
1748
+ kind: "runtime-session",
1749
+ sessionKey: record.name ?? record.acpxRecordId
1750
+ },
1723
1751
  verbose: this.options.verbose
1724
1752
  }) };
1725
1753
  }
@@ -1863,7 +1891,7 @@ function normalizeRuntimeDetails(details) {
1863
1891
  async function probeRuntime(options, deps = {}) {
1864
1892
  const agentName = options.probeAgent?.trim() || "codex";
1865
1893
  const agentCommand = normalizeAgentCommandInput(options.agentRegistry.resolve(agentName));
1866
- const client = createProbeClient(options, agentCommand, deps);
1894
+ const client = createProbeClient(options, agentName, agentCommand, deps);
1867
1895
  try {
1868
1896
  await client.start();
1869
1897
  return {
@@ -1891,14 +1919,20 @@ async function probeRuntime(options, deps = {}) {
1891
1919
  await client.close().catch(() => {});
1892
1920
  }
1893
1921
  }
1894
- function createProbeClient(options, agentCommand, deps) {
1922
+ function createProbeClient(options, agentName, agentCommand, deps) {
1895
1923
  const clientOptions = {
1896
1924
  ...agentCommand,
1897
1925
  cwd: options.cwd,
1926
+ agentProcessEnv: options.agentProcessEnv,
1898
1927
  mcpServers: [...options.mcpServers ?? []],
1899
1928
  permissionMode: options.permissionMode,
1900
1929
  nonInteractivePermissions: options.nonInteractivePermissions,
1901
1930
  permissionPolicy: options.permissionPolicy,
1931
+ processLifecycle: options.processLifecycle,
1932
+ processLaunchScope: {
1933
+ kind: "runtime-probe",
1934
+ agent: agentName
1935
+ },
1902
1936
  verbose: options.verbose
1903
1937
  };
1904
1938
  return deps.clientFactory?.(clientOptions) ?? new AcpClient(clientOptions);
@@ -1946,6 +1980,10 @@ var AcpxRuntime = class {
1946
1980
  constructor(options, testOptions) {
1947
1981
  this.options = options;
1948
1982
  this.testOptions = testOptions;
1983
+ if (options.agentProcessEnv) this.options = {
1984
+ ...options,
1985
+ agentProcessEnv: { ...options.agentProcessEnv }
1986
+ };
1949
1987
  }
1950
1988
  isHealthy() {
1951
1989
  return this.healthy;