@1agents/acp-service 0.10.12 → 0.11.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.
Files changed (115) hide show
  1. package/dist/src/acp-connection.js +33 -0
  2. package/dist/src/bridge.js +44 -1
  3. package/dist/src/capacity-queue.d.ts +3 -1
  4. package/dist/src/capacity-queue.js +4 -0
  5. package/dist/src/catalog.js +13 -3
  6. package/package.json +4 -4
  7. package/skills/acp-service/SKILL.md +1 -1
  8. package/vendor/dsh/adapter.d.ts +6 -0
  9. package/vendor/dsh/adapter.js +23 -0
  10. package/vendor/dsh/index.js +19 -0
  11. package/vendor/runtime/README.md +36 -11
  12. package/vendor/runtime/dist/{agent-registry-DxcyXXqb.js → agent-registry-CsdsVpJb.js} +209 -177
  13. package/vendor/runtime/dist/agent-registry-CsdsVpJb.js.map +1 -0
  14. package/vendor/runtime/dist/agent-registry.d.ts +0 -2
  15. package/vendor/runtime/dist/agent-registry.d.ts.map +1 -1
  16. package/vendor/runtime/dist/agent-registry.js +1 -1
  17. package/vendor/runtime/dist/{cli-BKmMxgix.js → cli-B5gQOSDl.js} +33 -14
  18. package/vendor/runtime/dist/cli-B5gQOSDl.js.map +1 -0
  19. package/vendor/runtime/dist/cli.d.ts +2 -6
  20. package/vendor/runtime/dist/cli.d.ts.map +1 -1
  21. package/vendor/runtime/dist/cli.js +189 -164
  22. package/vendor/runtime/dist/cli.js.map +1 -1
  23. package/vendor/runtime/dist/{client-C5zneoBs.d.ts → client-D5y4RXME.d.ts} +4 -12
  24. package/vendor/runtime/dist/client-D5y4RXME.d.ts.map +1 -0
  25. package/vendor/runtime/dist/docs-site/CLI.html +19 -21
  26. package/vendor/runtime/dist/docs-site/VISION.html +3 -2
  27. package/vendor/runtime/dist/docs-site/agents.html +10 -15
  28. package/vendor/runtime/dist/docs-site/assets/agents/Apache-2.0.txt +202 -0
  29. package/vendor/runtime/dist/docs-site/assets/agents/LobeHub-MIT.txt +21 -0
  30. package/vendor/runtime/dist/docs-site/assets/agents/Mux-AGPL-3.0.txt +661 -0
  31. package/vendor/runtime/dist/docs-site/assets/agents/README.md +41 -0
  32. package/vendor/runtime/dist/docs-site/assets/agents/ante.png +0 -0
  33. package/vendor/runtime/dist/docs-site/assets/agents/antigravity.png +0 -0
  34. package/vendor/runtime/dist/docs-site/assets/agents/claude.png +0 -0
  35. package/vendor/runtime/dist/docs-site/assets/agents/codex.png +0 -0
  36. package/vendor/runtime/dist/docs-site/assets/agents/copilot.png +0 -0
  37. package/vendor/runtime/dist/docs-site/assets/agents/cursor.png +0 -0
  38. package/vendor/runtime/dist/docs-site/assets/agents/deepseek-harness.png +0 -0
  39. package/vendor/runtime/dist/docs-site/assets/agents/devin.png +0 -0
  40. package/vendor/runtime/dist/docs-site/assets/agents/droid.png +0 -0
  41. package/vendor/runtime/dist/docs-site/assets/agents/fast-agent.png +0 -0
  42. package/vendor/runtime/dist/docs-site/assets/agents/fx.png +0 -0
  43. package/vendor/runtime/dist/docs-site/assets/agents/gemini.png +0 -0
  44. package/vendor/runtime/dist/docs-site/assets/agents/goose.png +0 -0
  45. package/vendor/runtime/dist/docs-site/assets/agents/grok-build.png +0 -0
  46. package/vendor/runtime/dist/docs-site/assets/agents/iflow.png +0 -0
  47. package/vendor/runtime/dist/docs-site/assets/agents/junie.png +0 -0
  48. package/vendor/runtime/dist/docs-site/assets/agents/kilocode.png +0 -0
  49. package/vendor/runtime/dist/docs-site/assets/agents/kimi.png +0 -0
  50. package/vendor/runtime/dist/docs-site/assets/agents/kiro.png +0 -0
  51. package/vendor/runtime/dist/docs-site/assets/agents/mcode.png +0 -0
  52. package/vendor/runtime/dist/docs-site/assets/agents/mux.png +0 -0
  53. package/vendor/runtime/dist/docs-site/assets/agents/octomind.png +0 -0
  54. package/vendor/runtime/dist/docs-site/assets/agents/openclaw.png +0 -0
  55. package/vendor/runtime/dist/docs-site/assets/agents/opencode.png +0 -0
  56. package/vendor/runtime/dist/docs-site/assets/agents/pi.png +0 -0
  57. package/vendor/runtime/dist/docs-site/assets/agents/pool.png +0 -0
  58. package/vendor/runtime/dist/docs-site/assets/agents/qoder.png +0 -0
  59. package/vendor/runtime/dist/docs-site/assets/agents/qwen.png +0 -0
  60. package/vendor/runtime/dist/docs-site/assets/agents/trae.png +0 -0
  61. package/vendor/runtime/dist/docs-site/assets/agents/zeroclaw.png +0 -0
  62. package/vendor/runtime/dist/docs-site/compare.html +8 -7
  63. package/vendor/runtime/dist/docs-site/config.html +5 -4
  64. package/vendor/runtime/dist/docs-site/custom-agents.html +13 -13
  65. package/vendor/runtime/dist/docs-site/exit-codes.html +4 -3
  66. package/vendor/runtime/dist/docs-site/flows.html +21 -8
  67. package/vendor/runtime/dist/docs-site/index.html +7 -6
  68. package/vendor/runtime/dist/docs-site/install.html +7 -6
  69. package/vendor/runtime/dist/docs-site/llms.txt +6 -6
  70. package/vendor/runtime/dist/docs-site/output-formats.html +9 -8
  71. package/vendor/runtime/dist/docs-site/permissions.html +5 -4
  72. package/vendor/runtime/dist/docs-site/prompting.html +9 -7
  73. package/vendor/runtime/dist/docs-site/quickstart.html +5 -4
  74. package/vendor/runtime/dist/docs-site/releasing.html +9 -8
  75. package/vendor/runtime/dist/docs-site/runtime-environment.html +28 -5
  76. package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +13 -7
  77. package/vendor/runtime/dist/docs-site/safe-errors.html +3 -2
  78. package/vendor/runtime/dist/docs-site/session-control.html +7 -6
  79. package/vendor/runtime/dist/docs-site/session-watch.html +6 -5
  80. package/vendor/runtime/dist/docs-site/sessions.html +13 -10
  81. package/vendor/runtime/dist/docs-site/shared-sessions.html +7 -4
  82. package/vendor/runtime/dist/{flows-VrII9VKZ.js → flows-CDj5YcTh.js} +136 -68
  83. package/vendor/runtime/dist/flows-CDj5YcTh.js.map +1 -0
  84. package/vendor/runtime/dist/flows.d.ts +28 -19
  85. package/vendor/runtime/dist/flows.d.ts.map +1 -1
  86. package/vendor/runtime/dist/flows.js +1 -1
  87. package/vendor/runtime/dist/{invocation-options-DHMZ5Rrb.js → input-file-BsfVGZgn.js} +30 -15
  88. package/vendor/runtime/dist/input-file-BsfVGZgn.js.map +1 -0
  89. package/vendor/runtime/dist/{ipc-CNNM5DP_.js → ipc-DfqJsbk6.js} +114 -146
  90. package/vendor/runtime/dist/ipc-DfqJsbk6.js.map +1 -0
  91. package/vendor/runtime/dist/{output-DtzXtiBc.js → output-DOIF4iFc.js} +20 -47
  92. package/vendor/runtime/dist/output-DOIF4iFc.js.map +1 -0
  93. package/vendor/runtime/dist/{queue-owner-runtime-ehuh3SQU.js → queue-owner-runtime-DHBQbjXo.js} +394 -258
  94. package/vendor/runtime/dist/queue-owner-runtime-DHBQbjXo.js.map +1 -0
  95. package/vendor/runtime/dist/runtime.d.ts +37 -36
  96. package/vendor/runtime/dist/runtime.d.ts.map +1 -1
  97. package/vendor/runtime/dist/runtime.js +117 -172
  98. package/vendor/runtime/dist/runtime.js.map +1 -1
  99. package/vendor/runtime/dist/{session-options-NjpFwf-c.d.ts → session-options-Ci4aw1oD.d.ts} +13 -16
  100. package/vendor/runtime/dist/session-options-Ci4aw1oD.d.ts.map +1 -0
  101. package/vendor/runtime/dist/{session-watch-CbKfGRkZ.js → session-watch-DRwFHcWw.js} +5 -6
  102. package/vendor/runtime/dist/{session-watch-CbKfGRkZ.js.map → session-watch-DRwFHcWw.js.map} +1 -1
  103. package/vendor/runtime/dist/{watch-BGt4kcE6.js → watch-CUDGkljG.js} +3 -4
  104. package/vendor/runtime/dist/{watch-BGt4kcE6.js.map → watch-CUDGkljG.js.map} +1 -1
  105. package/vendor/runtime/package.json +3 -3
  106. package/vendor/runtime/skills/acpx/SKILL.md +42 -11
  107. package/vendor/runtime/dist/agent-registry-DxcyXXqb.js.map +0 -1
  108. package/vendor/runtime/dist/cli-BKmMxgix.js.map +0 -1
  109. package/vendor/runtime/dist/client-C5zneoBs.d.ts.map +0 -1
  110. package/vendor/runtime/dist/flows-VrII9VKZ.js.map +0 -1
  111. package/vendor/runtime/dist/invocation-options-DHMZ5Rrb.js.map +0 -1
  112. package/vendor/runtime/dist/ipc-CNNM5DP_.js.map +0 -1
  113. package/vendor/runtime/dist/output-DtzXtiBc.js.map +0 -1
  114. package/vendor/runtime/dist/queue-owner-runtime-ehuh3SQU.js.map +0 -1
  115. package/vendor/runtime/dist/session-options-NjpFwf-c.d.ts.map +0 -1
@@ -1,14 +1,14 @@
1
- import { A as findSession, At as extractAcpError, B as assertPersistedKeyPolicy, Bt as isAcpRuntimeError, C as textPrompt, Dt as normalizeOutputError, L as readSessionRecord, Ot as safeErrorRejection, R as resolveSessionRecord, U as serializeSessionRecordForDisk, V as parseSessionRecord, bt as writePrivateJsonFile, ft as defaultSessionEventLog, jt as isAcpResourceNotFoundError, kt as toSafeError, t as tryCancelOnRunningOwner, zt as AcpRuntimeError } from "./ipc-CNNM5DP_.js";
2
- import { a as createAgentRegistry, i as DEFAULT_AGENT_NAME, k as normalizeAgentCommandInput } from "./agent-registry-DxcyXXqb.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-ehuh3SQU.js";
4
- import { t as watchSession } from "./watch-BGt4kcE6.js";
1
+ import { $ as resolveRequestedConfigOption, 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 AcpClient, K as cloneSessionAcpxState, L as applyConversation, M as applyRequestedModelIfAdvertised, N as setDesiredModeId, O as applyConfigOptionSelection, P as normalizeSessionOptionShape, Q as isRequestedModelUnsupportedError, R as applyLifecycleSnapshotToRecord, T as setSessionModelOnOwner, U as recordClientOperation, V as cloneSessionConversation, W as recordPromptSubmission, X as REQUESTED_MODEL_UNSUPPORTED_REASONS, Y as REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, Z as RequestedModelUnsupportedError, _ as cancelSessionPrompt, c as LiveSessionCheckpoint, dt as TimeoutError, et as resolveRequestedModelId, ft as assertControlAuthority, h as ensureSession, j as applyModelSelection, k as applyConfigOptionsToRecord, l as runPromptTurn, mt as withTimeout, nt as snapshotEnvNames, q as advertisedModelState, r as sendSession, s as DISCARD_OUTPUT_FORMATTER, v as closeSession, x as setSessionConfigOptionOnOwner, z as createInitialSessionRecord } from "./queue-owner-runtime-DHBQbjXo.js";
2
+ import { S as normalizeAgentCommandInput, a as createAgentRegistry, i as DEFAULT_AGENT_NAME } from "./agent-registry-CsdsVpJb.js";
3
+ import { At as extractAcpError, Bt as isAcpRuntimeError, Dt as normalizeOutputError, H as parseSessionRecord, Ot as safeErrorRejection, R as readSessionRecord, V as assertPersistedKeyPolicy, W as serializeSessionRecordForDisk, j as findSession, jt as isAcpResourceNotFoundError, kt as toSafeError, n as tryCancelOnRunningOwner, pt as defaultSessionEventLog, w as textPrompt, xt as writePrivateJsonFile, z as resolveSessionRecord, zt as AcpRuntimeError } from "./ipc-DfqJsbk6.js";
4
+ import { t as watchSession } from "./watch-CUDGkljG.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "node:path";
7
7
  import fs from "node:fs/promises";
8
+ import { isDeepStrictEqual } from "node:util";
8
9
  import { z } from "zod";
9
10
  import { createHash, randomUUID } from "node:crypto";
10
- import { isDeepStrictEqual } from "node:util";
11
- //#region src/runtime/engine/controls.ts
11
+ // src/runtime/engine/controls.ts
12
12
  function advertisedConfigOptionIds(record) {
13
13
  const configOptions = record?.acpx?.config_options;
14
14
  if (!configOptions) return;
@@ -36,8 +36,7 @@ function resolveSupportedConfigOptionId(record, configId) {
36
36
  const supportedText = supported.length > 0 ? supported.join(", ") : "none";
37
37
  throw new AcpRuntimeError("ACP_BACKEND_UNSUPPORTED_CONTROL", `ACP session ${record.acpxRecordId} does not advertise config option '${configId}'. Supported config options: ${supportedText}.`);
38
38
  }
39
- //#endregion
40
- //#region src/runtime/public/shared.ts
39
+ // src/runtime/public/shared.ts
41
40
  function isRecord(value) {
42
41
  return typeof value === "object" && value !== null && !Array.isArray(value);
43
42
  }
@@ -54,53 +53,11 @@ function deriveAgentFromSessionKey(sessionKey, fallbackAgent) {
54
53
  const match = sessionKey.match(/^agent:([^:]+):/i);
55
54
  return (match?.[1] ? asTrimmedString(match[1]) : "") || fallbackAgent;
56
55
  }
57
- //#endregion
58
- //#region src/runtime/public/events.ts
56
+ // src/runtime/public/events.ts
59
57
  const TOOL_OUTPUT_SUMMARY_MAX_CHARS = 500;
60
- function safeParseJsonObject(line) {
61
- try {
62
- const parsed = JSON.parse(line);
63
- return isRecord(parsed) ? parsed : null;
64
- } catch {
65
- return null;
66
- }
67
- }
68
58
  function asOptionalFiniteNumber(value) {
69
59
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
70
60
  }
71
- function readMeta(source) {
72
- return isRecord(source) ? { meta: source } : {};
73
- }
74
- function resolveStructuredPromptPayload(parsed) {
75
- if (asTrimmedString(parsed.method) === "session/update") {
76
- const params = parsed.params;
77
- if (isRecord(params) && isRecord(params.update)) {
78
- const update = params.update;
79
- const tag = asOptionalString(update.sessionUpdate);
80
- return {
81
- type: tag ?? "",
82
- payload: update,
83
- ...tag ? { tag } : {},
84
- ...readMeta(params._meta)
85
- };
86
- }
87
- }
88
- const sessionUpdate = asOptionalString(parsed.sessionUpdate);
89
- if (sessionUpdate) return {
90
- type: sessionUpdate,
91
- payload: parsed,
92
- tag: sessionUpdate,
93
- ...readMeta(parsed._meta)
94
- };
95
- const type = asTrimmedString(parsed.type);
96
- const tag = asOptionalString(parsed.tag);
97
- return {
98
- type,
99
- payload: parsed,
100
- ...tag ? { tag } : {},
101
- ...readMeta(parsed._meta)
102
- };
103
- }
104
61
  function resolveStatusTextForTag(params) {
105
62
  const resolver = STATUS_TEXT_RESOLVERS[params.tag];
106
63
  return resolver ? resolver(params.payload) : null;
@@ -259,16 +216,6 @@ function readAgentTurnId(meta) {
259
216
  const promptId = asOptionalString(meta?.promptId);
260
217
  return promptId && promptId.length > 0 ? { agentTurnId: promptId } : {};
261
218
  }
262
- function createTextDeltaEvent(params) {
263
- if (params.content == null || params.content.length === 0) return null;
264
- return {
265
- type: "text_delta",
266
- text: params.content,
267
- stream: params.stream,
268
- ...params.tag ? { tag: params.tag } : {},
269
- ...readAgentTurnId(params.meta)
270
- };
271
- }
272
219
  function readFirstString(record, keys) {
273
220
  for (const key of keys) {
274
221
  const value = asOptionalString(record[key]);
@@ -358,9 +305,6 @@ function summarizeToolOutput(rawOutput) {
358
305
  function isScalarToolOutput(value) {
359
306
  return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
360
307
  }
361
- function shouldForwardArray(value) {
362
- return Array.isArray(value);
363
- }
364
308
  function readToolKind(value) {
365
309
  const kind = asOptionalString(value);
366
310
  return kind && TOOL_KINDS.has(kind) ? kind : void 0;
@@ -436,57 +380,40 @@ function assignToolCallEventMetadata(event, payload, values) {
436
380
  assignForwardedToolPayload(event, payload);
437
381
  }
438
382
  function assignForwardedToolPayload(event, payload) {
439
- if (shouldForwardArray(payload.locations)) event.locations = payload.locations;
440
- if (Object.prototype.hasOwnProperty.call(payload, "rawInput")) event.rawInput = payload.rawInput;
441
- if (Object.prototype.hasOwnProperty.call(payload, "rawOutput")) event.rawOutput = payload.rawOutput;
442
- if (shouldForwardArray(payload.content)) event.content = payload.content;
443
- }
444
- function parsePromptEventLine(line) {
445
- const trimmed = line.trim();
446
- if (!trimmed) return null;
447
- const parsed = safeParseJsonObject(trimmed);
448
- if (!parsed) return {
449
- type: "status",
450
- text: trimmed
451
- };
452
- const structured = resolveStructuredPromptPayload(parsed);
453
- const type = structured.type;
454
- const payload = structured.payload;
455
- const tag = structured.tag;
456
- const meta = structured.meta;
457
- const parser = promptEventParser(type);
458
- return parser ? parser(payload, tag, meta) : null;
383
+ const snapshot = JSON.parse(JSON.stringify(payload));
384
+ if (Array.isArray(snapshot.locations)) event.locations = snapshot.locations;
385
+ if (Object.prototype.hasOwnProperty.call(snapshot, "rawInput")) event.rawInput = snapshot.rawInput;
386
+ if (Object.prototype.hasOwnProperty.call(snapshot, "rawOutput")) event.rawOutput = snapshot.rawOutput;
387
+ if (Array.isArray(snapshot.content)) event.content = snapshot.content;
388
+ }
389
+ function runtimeEventFromMessage(message) {
390
+ if (!isRecord(message)) return null;
391
+ if (asTrimmedString(message.method) !== "session/update") return message.type === "client_operation" ? clientOperationEvent(message) : null;
392
+ const params = message.params;
393
+ if (!isRecord(params) || !isRecord(params.update)) return null;
394
+ const payload = params.update;
395
+ const meta = isRecord(params._meta) ? params._meta : void 0;
396
+ const parser = promptEventParser(asTrimmedString(payload.sessionUpdate));
397
+ return parser ? parser(payload, meta) : null;
459
398
  }
460
399
  const PROMPT_EVENT_PARSERS = {
461
- text: (payload, tag, meta) => createTextDeltaEvent({
462
- content: asString(payload.content),
463
- stream: "output",
464
- tag,
465
- meta
466
- }),
467
- thought: (payload, tag, meta) => createTextDeltaEvent({
468
- content: asString(payload.content),
469
- stream: "thought",
470
- tag,
471
- meta
472
- }),
473
- tool_call: (payload, tag, meta) => createToolCallEvent({
400
+ tool_call: (payload, meta) => createToolCallEvent({
474
401
  payload,
475
- tag: tag ?? "tool_call",
402
+ tag: "tool_call",
476
403
  meta
477
404
  }),
478
- tool_call_update: (payload, tag, meta) => createToolCallEvent({
405
+ tool_call_update: (payload, meta) => createToolCallEvent({
479
406
  payload,
480
- tag: tag ?? "tool_call_update",
407
+ tag: "tool_call_update",
481
408
  meta
482
409
  }),
483
- agent_message_chunk: (payload, _tag, meta) => resolveTextChunk({
410
+ agent_message_chunk: (payload, meta) => resolveTextChunk({
484
411
  payload,
485
412
  stream: "output",
486
413
  tag: "agent_message_chunk",
487
414
  meta
488
415
  }),
489
- agent_thought_chunk: (payload, _tag, meta) => resolveTextChunk({
416
+ agent_thought_chunk: (payload, meta) => resolveTextChunk({
490
417
  payload,
491
418
  stream: "thought",
492
419
  tag: "agent_thought_chunk",
@@ -498,11 +425,7 @@ const PROMPT_EVENT_PARSERS = {
498
425
  config_option_update: (payload) => statusUpdateEvent("config_option_update", payload),
499
426
  session_info_update: (payload) => statusUpdateEvent("session_info_update", payload),
500
427
  plan: planUpdateEvent,
501
- background_task: backgroundTaskUpdateEvent,
502
- client_operation: clientOperationEvent,
503
- update: updateStatusEvent,
504
- done: () => null,
505
- error: () => null
428
+ background_task: backgroundTaskUpdateEvent
506
429
  };
507
430
  function promptEventParser(type) {
508
431
  return Object.hasOwn(PROMPT_EVENT_PARSERS, type) ? PROMPT_EVENT_PARSERS[type] : void 0;
@@ -659,28 +582,17 @@ function statusUpdateEvent(tag, payload) {
659
582
  tag
660
583
  };
661
584
  }
662
- function clientOperationEvent(payload, tag) {
663
- const text = [
664
- asTrimmedString(payload.method) || "operation",
665
- asTrimmedString(payload.status),
666
- asTrimmedString(payload.summary)
667
- ].filter(Boolean).join(" ");
668
- return text ? {
669
- type: "status",
670
- text,
671
- ...tag ? { tag } : {}
672
- } : null;
673
- }
674
- function updateStatusEvent(payload, tag) {
675
- const update = asTrimmedString(payload.update);
676
- return update ? {
585
+ function clientOperationEvent(payload) {
586
+ return {
677
587
  type: "status",
678
- text: update,
679
- ...tag ? { tag } : {}
680
- } : null;
588
+ text: [
589
+ asTrimmedString(payload.method) || "operation",
590
+ asTrimmedString(payload.status),
591
+ asTrimmedString(payload.summary)
592
+ ].filter(Boolean).join(" ")
593
+ };
681
594
  }
682
- //#endregion
683
- //#region src/runtime/public/probe.ts
595
+ // src/runtime/public/probe.ts
684
596
  /**
685
597
  * Inspect session model metadata without a runtime store or prompt. The agent
686
598
  * may create native session history; only its owned transport is closed.
@@ -696,6 +608,8 @@ async function inspectAgentModels(options) {
696
608
  ...normalizeAgentCommandInput(options.agentCommand),
697
609
  cwd: options.cwd,
698
610
  agentProcessEnv: options.agentProcessEnv,
611
+ agentProcessEnvAllow: options.agentProcessEnvAllow,
612
+ agentProcessEnvBlock: options.agentProcessEnvBlock,
699
613
  permissionMode: "deny-all",
700
614
  nonInteractivePermissions: "deny",
701
615
  fs: false,
@@ -803,6 +717,8 @@ function createProbeClient(options, agentName, agentCommand, deps) {
803
717
  ...agentCommand,
804
718
  cwd: options.cwd,
805
719
  agentProcessEnv: options.agentProcessEnv,
720
+ agentProcessEnvAllow: options.agentProcessEnvAllow,
721
+ agentProcessEnvBlock: options.agentProcessEnvBlock,
806
722
  mcpServers: typeof options.mcpServers === "function" ? [] : [...options.mcpServers ?? []],
807
723
  permissionMode: options.permissionMode,
808
724
  nonInteractivePermissions: options.nonInteractivePermissions,
@@ -818,8 +734,7 @@ function createProbeClient(options, agentName, agentCommand, deps) {
818
734
  };
819
735
  return deps.clientFactory?.(clientOptions) ?? new AcpClient(clientOptions);
820
736
  }
821
- //#endregion
822
- //#region src/runtime/engine/reuse-policy.ts
737
+ // src/runtime/engine/reuse-policy.ts
823
738
  function shouldReuseExistingRecord(record, params) {
824
739
  if (record.acpx?.reset_on_next_ensure === true) return false;
825
740
  if (path.resolve(record.cwd) !== path.resolve(params.cwd)) return false;
@@ -833,8 +748,7 @@ function sameArgv(left, right) {
833
748
  const rightValues = right ?? [];
834
749
  return leftValues.length === rightValues.length && leftValues.every((value, index) => value === rightValues[index]);
835
750
  }
836
- //#endregion
837
- //#region src/acp/config-option-support.ts
751
+ // src/acp/config-option-support.ts
838
752
  function asRecord$1(value) {
839
753
  if (!value || typeof value !== "object" || Array.isArray(value)) return;
840
754
  return value;
@@ -903,8 +817,7 @@ function configOptionsFromConfigOptions(configOptions) {
903
817
  }
904
818
  return options.length > 0 ? options : void 0;
905
819
  }
906
- //#endregion
907
- //#region src/acp/mode-support.ts
820
+ // src/acp/mode-support.ts
908
821
  function asRecord(value) {
909
822
  if (!value || typeof value !== "object" || Array.isArray(value)) return;
910
823
  return value;
@@ -947,8 +860,7 @@ function modeStateFromConfigOptions(configOptions) {
947
860
  if (option && isModeSelectOption(option)) return parseModeOption(option);
948
861
  }
949
862
  }
950
- //#endregion
951
- //#region src/runtime/engine/status.ts
863
+ // src/runtime/engine/status.ts
952
864
  function runtimeStatusFromRecord(record) {
953
865
  return {
954
866
  forkSupported: Boolean(record.agentCapabilities?.sessionCapabilities?.fork),
@@ -1056,8 +968,7 @@ function commandRecord(value) {
1056
968
  if (!value || typeof value !== "object" || Array.isArray(value)) return;
1057
969
  return value;
1058
970
  }
1059
- //#endregion
1060
- //#region src/runtime/engine/turn.ts
971
+ // src/runtime/engine/turn.ts
1061
972
  function createDeferred() {
1062
973
  let resolve;
1063
974
  let reject;
@@ -1153,8 +1064,7 @@ function legacyTerminalEventFromTurnResult(result) {
1153
1064
  ...result._meta === void 0 ? {} : { _meta: result._meta }
1154
1065
  };
1155
1066
  }
1156
- //#endregion
1157
- //#region src/runtime/engine/manager.ts
1067
+ // src/runtime/engine/manager.ts
1158
1068
  async function settleAttempt(run) {
1159
1069
  try {
1160
1070
  return {
@@ -1219,10 +1129,18 @@ function runtimeFailureRejection(task, error, safe) {
1219
1129
  }
1220
1130
  return safeErrorRejection(safe);
1221
1131
  }
1222
- async function createOrLoadRuntimeSession(client, resumeSessionId, cwd) {
1132
+ async function withSessionSetupTimeout(method, request, timeoutMs) {
1133
+ try {
1134
+ return await withTimeout(request, timeoutMs);
1135
+ } catch (error) {
1136
+ if (!(error instanceof TimeoutError)) throw error;
1137
+ throw new AcpRuntimeError("ACP_SESSION_INIT_FAILED", `ACP ${method} did not complete within ${timeoutMs}ms. Retry session setup and check that the configured ACP agent is responding.`, { cause: error });
1138
+ }
1139
+ }
1140
+ async function createOrLoadRuntimeSession(client, resumeSessionId, cwd, timeoutMs) {
1223
1141
  if (resumeSessionId) {
1224
1142
  if (client.supportsResumeSession()) {
1225
- const resumed = await client.resumeSession(resumeSessionId, cwd);
1143
+ const resumed = await withSessionSetupTimeout("session/resume", client.resumeSession(resumeSessionId, cwd), timeoutMs);
1226
1144
  return {
1227
1145
  sessionId: resumeSessionId,
1228
1146
  agentSessionId: resumed.agentSessionId,
@@ -1230,14 +1148,14 @@ async function createOrLoadRuntimeSession(client, resumeSessionId, cwd) {
1230
1148
  };
1231
1149
  }
1232
1150
  if (!client.supportsLoadSession()) throw new Error(`Agent does not support session/resume or session/load; cannot resume session ${resumeSessionId}`);
1233
- const loaded = await client.loadSession(resumeSessionId, cwd);
1151
+ const loaded = await withSessionSetupTimeout("session/load", client.loadSession(resumeSessionId, cwd), timeoutMs);
1234
1152
  return {
1235
1153
  sessionId: resumeSessionId,
1236
1154
  agentSessionId: loaded.agentSessionId,
1237
1155
  sessionResult: loaded
1238
1156
  };
1239
1157
  }
1240
- const created = await client.createSession(cwd);
1158
+ const created = await withSessionSetupTimeout("session/new", client.createSession(cwd), timeoutMs);
1241
1159
  return {
1242
1160
  sessionId: created.sessionId,
1243
1161
  agentSessionId: created.agentSessionId,
@@ -1247,6 +1165,7 @@ async function createOrLoadRuntimeSession(client, resumeSessionId, cwd) {
1247
1165
  var AcpRuntimeManager = class {
1248
1166
  options;
1249
1167
  deps;
1168
+ exactSessionRecordIds = /* @__PURE__ */ new Set();
1250
1169
  activeControllers = /* @__PURE__ */ new Map();
1251
1170
  controlSessionRecords = /* @__PURE__ */ new Map();
1252
1171
  retainedSessionOwners = /* @__PURE__ */ new Map();
@@ -1261,6 +1180,11 @@ var AcpRuntimeManager = class {
1261
1180
  pendingTasks = /* @__PURE__ */ new Set();
1262
1181
  shuttingDown = false;
1263
1182
  shutdownTask;
1183
+ observeAcpMessage = (direction, message) => {
1184
+ try {
1185
+ Promise.resolve(this.options.onAcpMessage?.(direction, message)).catch(() => {});
1186
+ } catch {}
1187
+ };
1264
1188
  constructor(options, deps = {}) {
1265
1189
  this.options = options;
1266
1190
  this.deps = deps;
@@ -1276,7 +1200,10 @@ var AcpRuntimeManager = class {
1276
1200
  this.assertOpen();
1277
1201
  const clientOptions = {
1278
1202
  ...options,
1203
+ onAcpMessage: options.processLaunchScope?.kind === "runtime-session" ? this.observeAcpMessage : void 0,
1279
1204
  agentProcessEnv: this.options.agentProcessEnv,
1205
+ agentProcessEnvAllow: this.options.agentProcessEnvAllow,
1206
+ agentProcessEnvBlock: this.options.agentProcessEnvBlock,
1280
1207
  processLifecycle: {
1281
1208
  ...options.processLifecycle,
1282
1209
  onBeforeSpawn: async (launch) => {
@@ -1395,6 +1322,7 @@ var AcpRuntimeManager = class {
1395
1322
  }
1396
1323
  installActiveOwnerEventHandlers(owner) {
1397
1324
  owner.client.setEventHandlers({
1325
+ onAcpMessage: this.observeAcpMessage,
1398
1326
  onSessionUpdate: (notification) => this.routeOwnedSessionUpdate(owner, notification),
1399
1327
  onClientOperation: (operation) => this.routeOwnedClientOperation(owner, operation)
1400
1328
  });
@@ -1426,7 +1354,6 @@ var AcpRuntimeManager = class {
1426
1354
  turn.acpxState = recordSessionUpdate(turn.conversation, turn.acpxState, notification);
1427
1355
  owner.checkpoint.request();
1428
1356
  } else turn.record.acpx = recordSessionUpdate(turn.conversation, turn.record.acpx, notification);
1429
- trimConversationForRuntime(turn.conversation);
1430
1357
  this.emitRuntimeTurnEvent(task, {
1431
1358
  jsonrpc: "2.0",
1432
1359
  method: "session/update",
@@ -1444,7 +1371,6 @@ var AcpRuntimeManager = class {
1444
1371
  return;
1445
1372
  }
1446
1373
  projection.record.acpx = recordSessionUpdate(projection.conversation, projection.record.acpx, notification);
1447
- trimConversationForRuntime(projection.conversation);
1448
1374
  const updateTag = notification.update.sessionUpdate;
1449
1375
  owner.pendingOutOfTurnNotice = () => {
1450
1376
  this.options.onOutOfTurnSessionUpdate?.(owner.recordId ?? owner.sessionKey, updateTag, notification);
@@ -1459,7 +1385,6 @@ var AcpRuntimeManager = class {
1459
1385
  turn.acpxState = recordClientOperation(turn.conversation, turn.acpxState, operation);
1460
1386
  owner.checkpoint.request();
1461
1387
  } else turn.record.acpx = recordClientOperation(turn.conversation, turn.record.acpx, operation);
1462
- trimConversationForRuntime(turn.conversation);
1463
1388
  this.emitRuntimeTurnEvent(task, {
1464
1389
  type: "client_operation",
1465
1390
  ...operation
@@ -1650,6 +1575,7 @@ var AcpRuntimeManager = class {
1650
1575
  verbose: this.options.verbose,
1651
1576
  timeoutMs: this.options.timeoutMs,
1652
1577
  resumePolicy: resumePolicyForSessionMode(sessionMode),
1578
+ strictResume: this.exactSessionRecordIds.has(record.acpxRecordId),
1653
1579
  replacingMode: replayOptions?.replacingMode,
1654
1580
  replacingConfigOption: replayOptions?.replacingConfigOption,
1655
1581
  authority,
@@ -1677,7 +1603,14 @@ var AcpRuntimeManager = class {
1677
1603
  applyLifecycleSnapshotToRecord(record, owner.client.getAgentLifecycleSnapshot());
1678
1604
  }
1679
1605
  async ensureSession(input) {
1680
- return await this.withEnsureSessionLock(input, async () => this.ensureSessionWithOwnership(input));
1606
+ return await this.withEnsureSessionLock(input, async () => {
1607
+ const record = await this.ensureSessionWithOwnership(input);
1608
+ if (input.resumeSessionId && !this.exactSessionRecordIds.has(record.acpxRecordId)) {
1609
+ this.assertRuntimeSessionIdle(record.acpxRecordId);
1610
+ this.exactSessionRecordIds.add(record.acpxRecordId);
1611
+ }
1612
+ return record;
1613
+ });
1681
1614
  }
1682
1615
  async withEnsureSessionLock(input, run) {
1683
1616
  const key = `${input.mode}\0${input.sessionKey}`;
@@ -1823,7 +1756,7 @@ var AcpRuntimeManager = class {
1823
1756
  try {
1824
1757
  await startRuntimeClient(client, agent, this.options.timeoutMs);
1825
1758
  this.assertOpen();
1826
- const session = await createOrLoadRuntimeSession(client, input.resumeSessionId, cwd);
1759
+ const session = await createOrLoadRuntimeSession(client, input.resumeSessionId, cwd, this.options.timeoutMs);
1827
1760
  const record = await this.prepareInitialRuntimeRecord({
1828
1761
  input,
1829
1762
  client,
@@ -1835,6 +1768,7 @@ var AcpRuntimeManager = class {
1835
1768
  });
1836
1769
  this.setTransientCredentials(record.acpxRecordId, input.authCredentials);
1837
1770
  await this.retainInitializedSessionOwner(owner, record);
1771
+ if (!input.resumeSessionId) this.exactSessionRecordIds.delete(record.acpxRecordId);
1838
1772
  return record;
1839
1773
  } catch (error) {
1840
1774
  await settleAttempt(async () => this.abandonInitializingSessionOwner(owner));
@@ -2090,7 +2024,6 @@ var AcpRuntimeManager = class {
2090
2024
  try {
2091
2025
  const promptStartedAt = isoNow();
2092
2026
  const promptMessageId = recordPromptSubmission(conversation, task.promptInput, promptStartedAt, task.input.requestId);
2093
- trimConversationForRuntime(conversation);
2094
2027
  const nextAcpxState = cloneSessionAcpxState(acpxState) ?? {};
2095
2028
  nextAcpxState.turn_results = {
2096
2029
  ...nextAcpxState.turn_results,
@@ -2237,8 +2170,8 @@ var AcpRuntimeManager = class {
2237
2170
  await task.sessionReady.promise;
2238
2171
  }
2239
2172
  async requestRuntimeTurnCancel(task, turn) {
2240
- if (turn.client.hasActivePrompt()) return await turn.client.requestCancelActivePrompt();
2241
2173
  if (!task.state.turnActive) return false;
2174
+ if (turn.client.hasActivePrompt()) return await turn.client.requestCancelActivePrompt();
2242
2175
  task.state.pendingCancel = true;
2243
2176
  return true;
2244
2177
  }
@@ -2264,7 +2197,7 @@ var AcpRuntimeManager = class {
2264
2197
  };
2265
2198
  }
2266
2199
  emitRuntimeTurnEvent(task, payload) {
2267
- const parsed = parsePromptEventLine(JSON.stringify(payload));
2200
+ const parsed = runtimeEventFromMessage(payload);
2268
2201
  if (!parsed) return;
2269
2202
  task.queue.push(parsed);
2270
2203
  }
@@ -2272,7 +2205,8 @@ var AcpRuntimeManager = class {
2272
2205
  if (turn.connected) return {
2273
2206
  sessionId: turn.record.acpSessionId,
2274
2207
  resumed: false,
2275
- loadError: void 0
2208
+ loadError: void 0,
2209
+ reusingLoadedSession: true
2276
2210
  };
2277
2211
  const loaded = await this.connectRuntimeTurnClient(task, turn);
2278
2212
  turn.acpxState = cloneSessionAcpxState(turn.record.acpx);
@@ -2284,6 +2218,7 @@ var AcpRuntimeManager = class {
2284
2218
  client: turn.client,
2285
2219
  record: turn.record,
2286
2220
  resumePolicy: resumePolicyForSessionMode(task.input.sessionMode),
2221
+ strictResume: this.exactSessionRecordIds.has(turn.record.acpxRecordId),
2287
2222
  timeoutMs: this.options.timeoutMs,
2288
2223
  promptRecorded: true,
2289
2224
  activeController: task.state.activeController,
@@ -2766,8 +2701,7 @@ function applyTerminalTurnSnapshot(turn, status, stopReason, errorCode, complete
2766
2701
  };
2767
2702
  turn.acpxState = nextState;
2768
2703
  }
2769
- //#endregion
2770
- //#region src/runtime/public/file-session-store.ts
2704
+ // src/runtime/public/file-session-store.ts
2771
2705
  function safeSessionId$1(sessionId) {
2772
2706
  return encodeURIComponent(sessionId);
2773
2707
  }
@@ -2846,8 +2780,7 @@ var FileSessionStore = class {
2846
2780
  function createFileSessionStore(options) {
2847
2781
  return new FileSessionStore(path.resolve(options.stateDir));
2848
2782
  }
2849
- //#endregion
2850
- //#region src/runtime/public/handle-state.ts
2783
+ // src/runtime/public/handle-state.ts
2851
2784
  const ACPX_RUNTIME_HANDLE_PREFIX = "acpx:v2:";
2852
2785
  function encodeAcpxRuntimeHandleState(state) {
2853
2786
  const payload = Buffer.from(JSON.stringify(state), "utf8").toString("base64url");
@@ -2884,8 +2817,7 @@ function writeHandleState(handle, state) {
2884
2817
  handle.backendSessionId = state.backendSessionId;
2885
2818
  handle.agentSessionId = state.agentSessionId;
2886
2819
  }
2887
- //#endregion
2888
- //#region src/runtime/public/turn-journal.ts
2820
+ // src/runtime/public/turn-journal.ts
2889
2821
  const TERMINAL_STATUSES = /* @__PURE__ */ new Set([
2890
2822
  "completed",
2891
2823
  "failed",
@@ -3140,8 +3072,7 @@ var AcpTurnJournal = class {
3140
3072
  function createTurnJournal(options) {
3141
3073
  return new AcpTurnJournal(options);
3142
3074
  }
3143
- //#endregion
3144
- //#region src/runtime/shared.ts
3075
+ // src/runtime/shared.ts
3145
3076
  const SHARED_BACKEND = "acpx-shared";
3146
3077
  function invalidOption(message) {
3147
3078
  throw new AcpRuntimeError("ACP_INVALID_RUNTIME_OPTION", message);
@@ -3198,13 +3129,17 @@ var SharedAcpRuntime = class {
3198
3129
  pending = /* @__PURE__ */ new Set();
3199
3130
  controlChains = /* @__PURE__ */ new Map();
3200
3131
  constructor(options) {
3132
+ if (options.ttlMs !== void 0 && Number.isFinite(options.ttlMs) && Math.round(options.ttlMs) > 2147483647) invalidOption("ttlMs exceeds the maximum supported timer delay");
3201
3133
  for (const name of [
3202
3134
  "sessionStore",
3203
3135
  "agentProcessEnv",
3136
+ "agentProcessEnvAllow",
3137
+ "agentProcessEnvBlock",
3204
3138
  "mcpServers",
3205
3139
  "sessionPermissions",
3206
3140
  "processLifecycle",
3207
3141
  "onPermissionRequest",
3142
+ "onAcpMessage",
3208
3143
  "elicitationModes",
3209
3144
  "fs",
3210
3145
  "terminal"
@@ -3246,6 +3181,7 @@ var SharedAcpRuntime = class {
3246
3181
  ...session,
3247
3182
  walkBoundary: session.cwd,
3248
3183
  sessionOptions: input.sessionOptions,
3184
+ applyModelOnReuse: false,
3249
3185
  resumeSessionId: input.resumeSessionId,
3250
3186
  handleProcessInterrupts: false,
3251
3187
  signal: this.disconnect.signal
@@ -3257,7 +3193,8 @@ var SharedAcpRuntime = class {
3257
3193
  startTurn(input) {
3258
3194
  this.assertOpen();
3259
3195
  if (input.mode !== "prompt" || input.assertActive || input.onPermissionRequest || input.onElicitation) invalidOption("Shared turns support prompt mode and the client's static permission policy; in-process callbacks and steering are unsupported.");
3260
- if (!input.requestId.trim()) invalidOption("A shared turn requires a requestId.");
3196
+ const requestId = input.requestId;
3197
+ if (!requestId.trim()) invalidOption("A shared turn requires a requestId.");
3261
3198
  const sessionId = sharedRecordId(input.handle);
3262
3199
  const prompt = toPromptInput(input.text, input.attachments);
3263
3200
  const events = new AsyncEventQueue();
@@ -3272,7 +3209,7 @@ var SharedAcpRuntime = class {
3272
3209
  if (!accepted || settled) return;
3273
3210
  cancellation ??= tryCancelOnRunningOwner({
3274
3211
  sessionId,
3275
- targetRequestId: input.requestId
3212
+ targetRequestId: requestId
3276
3213
  }).then(() => {});
3277
3214
  await cancellation;
3278
3215
  };
@@ -3293,7 +3230,7 @@ var SharedAcpRuntime = class {
3293
3230
  const result = await sendSession({
3294
3231
  ...this.options,
3295
3232
  sessionId,
3296
- requestId: input.requestId,
3233
+ requestId,
3297
3234
  prompt: typeof prompt === "string" ? textPrompt(prompt) : prompt,
3298
3235
  resumePolicy: "same-session-only",
3299
3236
  requireSharedRuntime: true,
@@ -3308,7 +3245,7 @@ var SharedAcpRuntime = class {
3308
3245
  outputFormatter: {
3309
3246
  ...DISCARD_OUTPUT_FORMATTER,
3310
3247
  onAcpMessage: (message) => {
3311
- const event = parsePromptEventLine(JSON.stringify(message));
3248
+ const event = runtimeEventFromMessage(message);
3312
3249
  if (event) events.push(event);
3313
3250
  }
3314
3251
  },
@@ -3329,7 +3266,7 @@ var SharedAcpRuntime = class {
3329
3266
  events.close();
3330
3267
  }));
3331
3268
  return {
3332
- requestId: input.requestId,
3269
+ requestId,
3333
3270
  promptStarted: promptStarted.promise,
3334
3271
  events: events.iterate(),
3335
3272
  result,
@@ -3446,9 +3383,11 @@ var SharedAcpRuntime = class {
3446
3383
  function createSharedAcpRuntime(options) {
3447
3384
  return new SharedAcpRuntime(options);
3448
3385
  }
3449
- //#endregion
3450
- //#region src/runtime.ts
3386
+ // src/runtime.ts
3451
3387
  const ACPX_BACKEND_ID = "acpx";
3388
+ function validateRuntimeTimeoutMs(timeoutMs) {
3389
+ if (timeoutMs !== void 0 && Number.isFinite(timeoutMs) && timeoutMs > 2147483647) throw new AcpRuntimeError("ACP_INVALID_RUNTIME_OPTION", "timeoutMs exceeds the maximum supported timer delay. Set timeoutMs to 2147483647 or less.");
3390
+ }
3452
3391
  var AcpxRuntime = class {
3453
3392
  options;
3454
3393
  testOptions;
@@ -3460,9 +3399,12 @@ var AcpxRuntime = class {
3460
3399
  constructor(options, testOptions) {
3461
3400
  this.options = options;
3462
3401
  this.testOptions = testOptions;
3463
- if (options.agentProcessEnv) this.options = {
3402
+ validateRuntimeTimeoutMs(options.timeoutMs);
3403
+ if (options.agentProcessEnv || options.agentProcessEnvAllow !== void 0 || options.agentProcessEnvBlock !== void 0) this.options = {
3464
3404
  ...options,
3465
- agentProcessEnv: { ...options.agentProcessEnv }
3405
+ agentProcessEnv: options.agentProcessEnv ? { ...options.agentProcessEnv } : void 0,
3406
+ agentProcessEnvAllow: snapshotEnvNames("agentProcessEnvAllow", options.agentProcessEnvAllow),
3407
+ agentProcessEnvBlock: snapshotEnvNames("agentProcessEnvBlock", options.agentProcessEnvBlock)
3466
3408
  };
3467
3409
  }
3468
3410
  isHealthy() {
@@ -3588,6 +3530,8 @@ var AcpxRuntime = class {
3588
3530
  });
3589
3531
  }
3590
3532
  startTurn(input) {
3533
+ const timeoutMs = input.timeoutMs;
3534
+ validateRuntimeTimeoutMs(timeoutMs);
3591
3535
  const { handle, state } = this.resolveManagerHandle(input.handle);
3592
3536
  const turnPromise = this.getManager().then((manager) => manager.startTurn({
3593
3537
  handle,
@@ -3596,7 +3540,7 @@ var AcpxRuntime = class {
3596
3540
  mode: input.mode,
3597
3541
  sessionMode: state.mode,
3598
3542
  requestId: input.requestId,
3599
- timeoutMs: input.timeoutMs,
3543
+ timeoutMs,
3600
3544
  signal: input.signal,
3601
3545
  assertActive: input.assertActive,
3602
3546
  onElicitation: input.onElicitation,
@@ -3623,6 +3567,8 @@ var AcpxRuntime = class {
3623
3567
  };
3624
3568
  }
3625
3569
  async *runTurn(input) {
3570
+ const timeoutMs = input.timeoutMs;
3571
+ validateRuntimeTimeoutMs(timeoutMs);
3626
3572
  const { handle, state } = this.resolveManagerHandle(input.handle);
3627
3573
  yield* (await this.getManager()).runTurn({
3628
3574
  handle,
@@ -3631,7 +3577,7 @@ var AcpxRuntime = class {
3631
3577
  mode: input.mode,
3632
3578
  sessionMode: state.mode,
3633
3579
  requestId: input.requestId,
3634
- timeoutMs: input.timeoutMs,
3580
+ timeoutMs,
3635
3581
  signal: input.signal,
3636
3582
  assertActive: input.assertActive,
3637
3583
  onElicitation: input.onElicitation,
@@ -3739,7 +3685,6 @@ function createAcpRuntime(options) {
3739
3685
  function createRuntimeStore(options) {
3740
3686
  return createFileSessionStore(options);
3741
3687
  }
3742
- //#endregion
3743
3688
  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 };
3744
3689
 
3745
3690
  //# sourceMappingURL=runtime.js.map