@moxt-ai/mobius 0.0.380 → 0.0.382

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 (107) hide show
  1. package/dist/{chunk-7HMKMNG4.js → chunk-3GTWYIU4.js} +199 -154
  2. package/dist/{chunk-7HMKMNG4.js.map → chunk-3GTWYIU4.js.map} +4 -4
  3. package/dist/{chunk-VQT2JYQE.js → chunk-6JSBDO2X.js} +2 -2
  4. package/dist/{chunk-ZY3EYZYU.js → chunk-WGPROR4Q.js} +2 -2
  5. package/dist/{chunk-ZY3EYZYU.js.map → chunk-WGPROR4Q.js.map} +1 -1
  6. package/dist/cli/handler/version/index.d.ts.map +1 -1
  7. package/dist/cli/handler/version/index.js +0 -6
  8. package/dist/cli/handler/version/index.js.map +1 -1
  9. package/dist/{cli-QH5RSLX3.js → cli-XRZYWC74.js} +34 -71
  10. package/dist/cli-XRZYWC74.js.map +7 -0
  11. package/dist/cli.js +3 -3
  12. package/dist/daemon/lifecycle/manager-client.d.ts.map +1 -1
  13. package/dist/daemon/lifecycle/manager-client.js +1 -4
  14. package/dist/daemon/lifecycle/manager-client.js.map +1 -1
  15. package/dist/daemon/lifecycle/worker.js +2 -2
  16. package/dist/daemon/lifecycle/worker.js.map +1 -1
  17. package/dist/daemon/upgrades/data.d.ts +1 -3
  18. package/dist/daemon/upgrades/data.d.ts.map +1 -1
  19. package/dist/daemon/upgrades/data.js +11 -30
  20. package/dist/daemon/upgrades/data.js.map +1 -1
  21. package/dist/engine/acp/harness/codex/app-server-protocol.d.ts +3 -0
  22. package/dist/engine/acp/harness/codex/app-server-protocol.d.ts.map +1 -1
  23. package/dist/engine/acp/harness/codex/app-server-protocol.js +1 -0
  24. package/dist/engine/acp/harness/codex/app-server-protocol.js.map +1 -1
  25. package/dist/engine/acp/harness/codex/borrowed-agent.d.ts.map +1 -1
  26. package/dist/engine/acp/harness/codex/borrowed-agent.js +26 -4
  27. package/dist/engine/acp/harness/codex/borrowed-agent.js.map +1 -1
  28. package/dist/engine/generated/acp-session-store-migrations.d.ts +6 -0
  29. package/dist/engine/generated/acp-session-store-migrations.d.ts.map +1 -1
  30. package/dist/engine/generated/acp-session-store-migrations.js +9 -1
  31. package/dist/engine/generated/acp-session-store-migrations.js.map +1 -1
  32. package/dist/engine/runtime/catalog/publish-agent-catalog.d.ts.map +1 -1
  33. package/dist/engine/runtime/catalog/publish-agent-catalog.js +0 -2
  34. package/dist/engine/runtime/catalog/publish-agent-catalog.js.map +1 -1
  35. package/dist/engine/runtime/command/registry/session.d.ts.map +1 -1
  36. package/dist/engine/runtime/command/registry/session.js +2 -3
  37. package/dist/engine/runtime/command/registry/session.js.map +1 -1
  38. package/dist/engine/runtime/connection/runtime-installation-store.d.ts.map +1 -1
  39. package/dist/engine/runtime/connection/runtime-installation-store.js +1 -9
  40. package/dist/engine/runtime/connection/runtime-installation-store.js.map +1 -1
  41. package/dist/engine/runtime/pairing.d.ts.map +1 -1
  42. package/dist/engine/runtime/pairing.js +0 -2
  43. package/dist/engine/runtime/pairing.js.map +1 -1
  44. package/dist/engine/runtime/relay/liveness.js +5 -5
  45. package/dist/engine/runtime/relay/liveness.js.map +1 -1
  46. package/dist/engine/runtime/relay/run-relay-connection.d.ts.map +1 -1
  47. package/dist/engine/runtime/relay/run-relay-connection.js +0 -1
  48. package/dist/engine/runtime/relay/run-relay-connection.js.map +1 -1
  49. package/dist/engine/schema/acp-session-store/execution-receipt.d.ts +1 -17
  50. package/dist/engine/schema/acp-session-store/execution-receipt.d.ts.map +1 -1
  51. package/dist/engine/schema/acp-session-store/execution-receipt.js +1 -4
  52. package/dist/engine/schema/acp-session-store/execution-receipt.js.map +1 -1
  53. package/dist/engine/session/api/session-api.d.ts +2 -1
  54. package/dist/engine/session/api/session-api.d.ts.map +1 -1
  55. package/dist/engine/session/api/session-api.js.map +1 -1
  56. package/dist/engine/session/api/session-layer.d.ts.map +1 -1
  57. package/dist/engine/session/api/session-layer.js +5 -0
  58. package/dist/engine/session/api/session-layer.js.map +1 -1
  59. package/dist/engine/session/history/session-event-store.d.ts +4 -0
  60. package/dist/engine/session/history/session-event-store.d.ts.map +1 -1
  61. package/dist/engine/session/history/session-event-store.js +8 -0
  62. package/dist/engine/session/history/session-event-store.js.map +1 -1
  63. package/dist/engine/session/interaction/pending-interactions.d.ts +5 -4
  64. package/dist/engine/session/interaction/pending-interactions.d.ts.map +1 -1
  65. package/dist/engine/session/interaction/pending-interactions.js +8 -8
  66. package/dist/engine/session/interaction/pending-interactions.js.map +1 -1
  67. package/dist/engine/session/interaction/session-interactions.d.ts +2 -1
  68. package/dist/engine/session/interaction/session-interactions.d.ts.map +1 -1
  69. package/dist/engine/session/interaction/session-interactions.js +51 -44
  70. package/dist/engine/session/interaction/session-interactions.js.map +1 -1
  71. package/dist/engine/session/live/agent-session.d.ts +2 -0
  72. package/dist/engine/session/live/agent-session.d.ts.map +1 -1
  73. package/dist/engine/session/live/agent-session.js +6 -2
  74. package/dist/engine/session/live/agent-session.js.map +1 -1
  75. package/dist/engine/session/manager/session-manager.d.ts +2 -0
  76. package/dist/engine/session/manager/session-manager.d.ts.map +1 -1
  77. package/dist/engine/session/manager/session-manager.js +23 -0
  78. package/dist/engine/session/manager/session-manager.js.map +1 -1
  79. package/dist/engine/session/native/native-session-browser.d.ts +1 -1
  80. package/dist/engine/session/native/native-session-browser.d.ts.map +1 -1
  81. package/dist/engine/session/native/native-session-browser.js +1 -0
  82. package/dist/engine/session/native/native-session-browser.js.map +1 -1
  83. package/dist/engine/session/prompt/apply-session-configuration.d.ts.map +1 -1
  84. package/dist/engine/session/prompt/apply-session-configuration.js +1 -0
  85. package/dist/engine/session/prompt/apply-session-configuration.js.map +1 -1
  86. package/dist/engine/storage/session/execution-receipt-table.d.ts.map +1 -1
  87. package/dist/engine/storage/session/execution-receipt-table.js +8 -43
  88. package/dist/engine/storage/session/execution-receipt-table.js.map +1 -1
  89. package/dist/engine/storage/sqlite/local-databases.d.ts.map +1 -1
  90. package/dist/engine/storage/sqlite/local-databases.js +27 -5
  91. package/dist/engine/storage/sqlite/local-databases.js.map +1 -1
  92. package/dist/engine/storage/sqlite/local-sqlite-database.d.ts +0 -5
  93. package/dist/engine/storage/sqlite/local-sqlite-database.d.ts.map +1 -1
  94. package/dist/engine/storage/sqlite/local-sqlite-database.js +0 -9
  95. package/dist/engine/storage/sqlite/local-sqlite-database.js.map +1 -1
  96. package/dist/engine.js +2 -2
  97. package/dist/storage/daemon/version-data.d.ts +2 -6
  98. package/dist/storage/daemon/version-data.d.ts.map +1 -1
  99. package/dist/storage/daemon/version-data.js +4 -26
  100. package/dist/storage/daemon/version-data.js.map +1 -1
  101. package/dist/storage/state-root-layout.d.ts +1 -5
  102. package/dist/storage/state-root-layout.d.ts.map +1 -1
  103. package/dist/storage/state-root-layout.js +1 -5
  104. package/dist/storage/state-root-layout.js.map +1 -1
  105. package/package.json +2 -2
  106. package/dist/cli-QH5RSLX3.js.map +0 -7
  107. /package/dist/{chunk-VQT2JYQE.js.map → chunk-6JSBDO2X.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  __export,
4
4
  __using,
5
5
  package_default
6
- } from "./chunk-ZY3EYZYU.js";
6
+ } from "./chunk-WGPROR4Q.js";
7
7
 
8
8
  // src/engine/runtime/relay/runtime-revocation.ts
9
9
  var runtimeRevocationCloseCode = 1008;
@@ -20262,8 +20262,7 @@ var sessionConfigureCommandSchema = external_exports.object({
20262
20262
  ...sessionIdentityFields,
20263
20263
  booleanValue: external_exports.boolean(),
20264
20264
  configId: external_exports.string().min(1).max(128),
20265
- // Omitted by legacy clients: explicit edits retain last-write-wins behavior.
20266
- expectedConfigurationRevision: identifierStringSchema.optional(),
20265
+ expectedConfigurationRevision: identifierStringSchema,
20267
20266
  kind: external_exports.literal(SESSION_CONFIGURE_KIND),
20268
20267
  requestId: identifierStringSchema,
20269
20268
  value: external_exports.string().max(500),
@@ -20271,8 +20270,8 @@ var sessionConfigureCommandSchema = external_exports.object({
20271
20270
  }).readonly();
20272
20271
  var sessionConfigUpdatedEventSchema = external_exports.object({
20273
20272
  configOptions: sessionConfigOptionsSchema,
20274
- // An opaque Runtime generation token; absent on older Runtimes.
20275
- configurationRevision: identifierStringSchema.optional(),
20273
+ // An opaque Runtime generation token.
20274
+ configurationRevision: identifierStringSchema,
20276
20275
  kind: external_exports.literal(SESSION_CONFIG_UPDATED_KIND),
20277
20276
  requestId: identifierStringSchema,
20278
20277
  sessionId: identifierStringSchema
@@ -20291,8 +20290,8 @@ var sessionConfigReadCommandSchema = external_exports.object({
20291
20290
  }).readonly();
20292
20291
  var sessionConfigReadResultSchema = external_exports.object({
20293
20292
  configOptions: sessionConfigOptionsSchema,
20294
- // An opaque Runtime generation token; absent on older Runtimes.
20295
- configurationRevision: identifierStringSchema.optional(),
20293
+ // An opaque Runtime generation token.
20294
+ configurationRevision: identifierStringSchema,
20296
20295
  kind: external_exports.literal(SESSION_CONFIG_READ_RESULT_KIND),
20297
20296
  requestId: identifierStringSchema,
20298
20297
  sessionId: identifierStringSchema
@@ -20826,8 +20825,8 @@ var sessionEventLogPageSchema = external_exports.object({
20826
20825
  sessionGenerationId: identifierStringSchema,
20827
20826
  tailCursor: external_exports.string().max(512),
20828
20827
  // The generation-scoped live position covered by this snapshot, including
20829
- // coalesced and omitted events. Absent only on older Runtime versions.
20830
- throughPosition: positionSchema.optional(),
20828
+ // coalesced and omitted events.
20829
+ throughPosition: positionSchema,
20831
20830
  truncated: external_exports.boolean(),
20832
20831
  version: external_exports.literal(2)
20833
20832
  }).readonly();
@@ -21139,7 +21138,7 @@ var sessionReadyEventSchema = external_exports.object({
21139
21138
  capabilities: sessionCapabilitiesSchema,
21140
21139
  commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
21141
21140
  configOptions: sessionConfigOptionsSchema,
21142
- configurationRevision: identifierStringSchema.optional(),
21141
+ configurationRevision: identifierStringSchema,
21143
21142
  directoryId: DIRECTORY_IDENTIFIER,
21144
21143
  directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
21145
21144
  kind: external_exports.literal(SESSION_READY_KIND),
@@ -21266,7 +21265,7 @@ function decodeSessionPromptCommand(encoded) {
21266
21265
  const hasSessionConfigurations = Object.hasOwn(value, "sessionConfigurations");
21267
21266
  assertKind(value, SESSION_PROMPT_KIND);
21268
21267
  const prompt = readText(value, "prompt", MAX_PROMPT_LENGTH);
21269
- const attachments = !Object.hasOwn(value, "attachments") && Array.isArray(value["images"]) && Array.isArray(value["resources"]) ? [] : decodePromptAttachmentsValue(value["attachments"]);
21268
+ const attachments = decodePromptAttachmentsValue(value["attachments"]);
21270
21269
  const attachmentBytes = attachments.reduce((total, attachment) => total + attachment.byteLength, 0);
21271
21270
  if (attachmentBytes > MAX_PROMPT_ATTACHMENT_BYTES) {
21272
21271
  throw new ProtocolMessageError("Prompt attachments are too large");
@@ -21332,15 +21331,7 @@ function decodeSessionPromptDispositionCommand(encoded) {
21332
21331
  };
21333
21332
  }
21334
21333
  function encodeSessionPromptCommand(message) {
21335
- const command = decodeSessionPromptCommand(JSON.stringify(message));
21336
- return JSON.stringify({
21337
- ...command,
21338
- // Keep text prompts compatible with the previous Runtime release while
21339
- // attachments move to the content-key protocol. Older Runtimes ignore
21340
- // `attachments` and require both legacy arrays to be present.
21341
- images: [],
21342
- resources: []
21343
- });
21334
+ return JSON.stringify(decodeSessionPromptCommand(JSON.stringify(message)));
21344
21335
  }
21345
21336
  function encodeSessionCancelCommand(message) {
21346
21337
  return JSON.stringify(decodeSessionCancelCommand(JSON.stringify(message)));
@@ -21357,6 +21348,16 @@ var envelope = {
21357
21348
  requestId: identifierStringSchema,
21358
21349
  sessionId: identifierStringSchema
21359
21350
  };
21351
+ var sessionInteractionSnapshotSchema = external_exports.object({
21352
+ sessionGenerationId: identifierStringSchema,
21353
+ throughPosition: external_exports.string().regex(/^(0|[1-9][0-9]*)$/),
21354
+ interactions: external_exports.array(
21355
+ external_exports.discriminatedUnion("kind", [
21356
+ sessionPermissionRequestedEventSchema,
21357
+ sessionElicitationRequestedEventSchema
21358
+ ])
21359
+ ).readonly()
21360
+ }).readonly();
21360
21361
  var activeTurnSnapshotSchema = external_exports.object({
21361
21362
  commandId: identifierStringSchema,
21362
21363
  epoch: identifierStringSchema,
@@ -21462,13 +21463,15 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
21462
21463
  }).readonly()
21463
21464
  ).readonly(),
21464
21465
  turn: activeTurnSnapshotSchema.nullable(),
21466
+ // Absent when an older Runtime or Relay cannot provide session-scoped interaction recovery.
21467
+ interactionState: sessionInteractionSnapshotSchema.optional(),
21465
21468
  // Present only when the request named a command and every hop understands it. An
21466
21469
  // unrecognized delivery from a newer peer reads as absent instead of failing the snapshot.
21467
21470
  command: commandDeliverySchema.optional().catch(void 0),
21468
21471
  // Absent from older Runtimes and while the last started command is still running.
21469
21472
  lastTurn: lastTurnOutcomeSchema.optional().catch(void 0),
21470
- // Runtime-owned support; older Relays strip this field before exposing the snapshot.
21471
- queuedCancellation: external_exports.literal("before-start").optional().catch(void 0)
21473
+ // The Runtime withdraws a queued command only before it starts.
21474
+ queuedCancellation: external_exports.literal("before-start")
21472
21475
  }).readonly(),
21473
21476
  external_exports.object({
21474
21477
  ...resultEnvelope,
@@ -21539,7 +21542,7 @@ var wireNativeSessionEventsSchema = external_exports.object({
21539
21542
  nextCursor: external_exports.string().min(1).max(512).nullable(),
21540
21543
  sessionGenerationId: identifierStringSchema,
21541
21544
  tailCursor: external_exports.string().max(512),
21542
- throughPosition: external_exports.string().regex(/^(0|[1-9][0-9]*)$/u).optional(),
21545
+ throughPosition: external_exports.string().regex(/^(0|[1-9][0-9]*)$/u),
21543
21546
  truncated: external_exports.boolean(),
21544
21547
  version: external_exports.literal(2)
21545
21548
  }).passthrough().readonly(),
@@ -22724,11 +22727,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
22724
22727
  connection.runtimeCredential,
22725
22728
  connection.runtimeId
22726
22729
  );
22727
- if (isRecord3(record2) && record2["version"] === 5) {
22728
- await writeJsonAtomically(this.connectionPath(connectionId2), { ...record2, activation }, signal);
22729
- } else {
22730
- await this.overwriteConnection(updated, signal);
22731
- }
22730
+ await this.overwriteConnection(updated, signal);
22732
22731
  return updated;
22733
22732
  };
22734
22733
  removeConnection = async (connectionId2, signal) => {
@@ -68444,6 +68443,7 @@ var threadStartResponseSchema = external_exports.object({
68444
68443
  var threadTurnSchema = external_exports.object({
68445
68444
  id: boundedText(256).optional(),
68446
68445
  status: turnStatusSchema.optional(),
68446
+ completedAt: external_exports.number().nullish(),
68447
68447
  error: external_exports.object({ message: external_exports.string().transform((message) => message.slice(0, 4096)) }).nullish(),
68448
68448
  items: external_exports.array(external_exports.unknown()).max(1e5)
68449
68449
  });
@@ -68751,7 +68751,19 @@ var CodexAppServerClient = class {
68751
68751
 
68752
68752
  // src/engine/acp/harness/codex/borrowed-agent.ts
68753
68753
  import { randomUUID as randomUUID7 } from "node:crypto";
68754
- import { setTimeout as setTimeout2 } from "node:timers/promises";
68754
+
68755
+ // src/engine/util/timer.ts
68756
+ var SystemTimer = class {
68757
+ schedule = (callback, milliseconds) => {
68758
+ const timeout = setTimeout(callback, milliseconds);
68759
+ return {
68760
+ cancel: () => {
68761
+ clearTimeout(timeout);
68762
+ }
68763
+ };
68764
+ };
68765
+ };
68766
+ var systemTimer = new SystemTimer();
68755
68767
 
68756
68768
  // src/engine/acp/harness/codex/items.ts
68757
68769
  import { pathToFileURL } from "node:url";
@@ -69039,6 +69051,23 @@ var queuePageSchema = external_exports.object({
69039
69051
  data: external_exports.array(external_exports.object({ id: external_exports.string().min(1), clientUserMessageId: external_exports.string().min(1) })).max(100),
69040
69052
  nextCursor: external_exports.string().nullish()
69041
69053
  });
69054
+ function turnRunning(turn) {
69055
+ return turn.status === "inProgress" || turn.status === "interrupted" && turn.completedAt == null;
69056
+ }
69057
+ function waitForNextPoll(timer, signal) {
69058
+ signal.throwIfAborted();
69059
+ return new Promise((resolve19, reject2) => {
69060
+ const poll = timer.schedule(() => {
69061
+ signal.removeEventListener("abort", abort);
69062
+ resolve19();
69063
+ }, POLL_INTERVAL);
69064
+ const abort = () => {
69065
+ poll.cancel();
69066
+ reject2(signal.reason);
69067
+ };
69068
+ signal.addEventListener("abort", abort, { once: true });
69069
+ });
69070
+ }
69042
69071
  var CodexBorrowedAcpAgent = class {
69043
69072
  steeringSupported = false;
69044
69073
  #client;
@@ -69069,7 +69098,7 @@ var CodexBorrowedAcpAgent = class {
69069
69098
  const signal = this.#closed.signal;
69070
69099
  try {
69071
69100
  for (; ; ) {
69072
- await setTimeout2(POLL_INTERVAL, void 0, { signal });
69101
+ await waitForNextPoll(systemTimer, signal);
69073
69102
  await this.#refresh(signal, false);
69074
69103
  }
69075
69104
  } catch (cause) {
@@ -69140,7 +69169,7 @@ var CodexBorrowedAcpAgent = class {
69140
69169
  this.#seen.set(key, text2);
69141
69170
  continue;
69142
69171
  }
69143
- if (item.type === "plan" && turn.status === "inProgress") {
69172
+ if (item.type === "plan" && turnRunning(turn)) {
69144
69173
  continue;
69145
69174
  }
69146
69175
  const previous = this.#seen.get(key);
@@ -69169,7 +69198,7 @@ var CodexBorrowedAcpAgent = class {
69169
69198
  }
69170
69199
  }
69171
69200
  }
69172
- if (matches && turn.status !== void 0 && turn.status !== "inProgress") {
69201
+ if (matches && turn.status !== void 0 && !turnRunning(turn)) {
69173
69202
  if (turn.status === "failed") {
69174
69203
  this.#pending?.completion.reject(
69175
69204
  new AcpExecutionError("The owning Codex turn failed", {}, "codex_turn_failed")
@@ -77547,6 +77576,10 @@ var MemorySessionEventStore = class {
77547
77576
  this.append(sessionId, event);
77548
77577
  }
77549
77578
  };
77579
+ livePosition = (sessionId) => {
77580
+ const session = this.#session(sessionId);
77581
+ return { sessionGenerationId: session.sessionGenerationId, throughPosition: session.throughPosition };
77582
+ };
77550
77583
  page = (sessionId, eventLimit, cursor) => {
77551
77584
  const session = this.#session(sessionId);
77552
77585
  const endIndex = session.endIndex(cursor);
@@ -77674,6 +77707,10 @@ var CachedSessionEventStore = class {
77674
77707
  }
77675
77708
  }
77676
77709
  };
77710
+ livePosition = (sessionId) => {
77711
+ const session = this.#session(sessionId);
77712
+ return { sessionGenerationId: session.sessionGenerationId, throughPosition: session.throughPosition };
77713
+ };
77677
77714
  page = (sessionId, eventLimit, cursor) => {
77678
77715
  const session = this.#sessions.get(sessionId);
77679
77716
  const current = session ?? this.#session(sessionId);
@@ -78181,7 +78218,9 @@ import { join as join23 } from "node:path";
78181
78218
 
78182
78219
  // src/engine/storage/sqlite/local-databases.ts
78183
78220
  import { createHash as createHash4 } from "node:crypto";
78221
+ import { existsSync as existsSync9 } from "node:fs";
78184
78222
  import { join as join22 } from "node:path";
78223
+ import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
78185
78224
 
78186
78225
  // src/engine/generated/acp-session-store-migrations.ts
78187
78226
  var acpSessionStoreMigrations = [
@@ -78224,6 +78263,14 @@ var acpSessionStoreMigrations = [
78224
78263
  {
78225
78264
  "name": "0009_receipt_admission_order.sql",
78226
78265
  "sql": "ALTER TABLE `execution_receipt` ADD `admission_order` integer;"
78266
+ },
78267
+ {
78268
+ "name": "0010_receipt_admission_order_backfill.sql",
78269
+ "sql": "-- Receipts written before admission order existed are ordered by their last update, after every ordered receipt.\nUPDATE `execution_receipt` SET `admission_order` = `ordered`.`admission_order`\nFROM (\n SELECT\n `command_id`,\n (SELECT coalesce(max(`admission_order`), 0) FROM `execution_receipt`)\n + row_number() OVER (ORDER BY `updated_at`, `command_id`) AS `admission_order`\n FROM `execution_receipt`\n WHERE `admission_order` IS NULL\n) AS `ordered`\nWHERE `execution_receipt`.`command_id` = `ordered`.`command_id`;\n"
78270
+ },
78271
+ {
78272
+ "name": "0011_receipt_admission_order_required.sql",
78273
+ "sql": 'PRAGMA foreign_keys=OFF;--> statement-breakpoint\nCREATE TABLE `__new_execution_receipt` (\n `command_id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `command_hash` text NOT NULL,\n `attempt_id` text NOT NULL,\n `admission_order` integer NOT NULL,\n `started` integer NOT NULL,\n `outcome` text,\n `updated_at` text NOT NULL\n);\n--> statement-breakpoint\nINSERT INTO `__new_execution_receipt`("command_id", "session_id", "command_hash", "attempt_id", "admission_order", "started", "outcome", "updated_at") SELECT "command_id", "session_id", "command_hash", "attempt_id", "admission_order", "started", "outcome", "updated_at" FROM `execution_receipt`;--> statement-breakpoint\nDROP TABLE `execution_receipt`;--> statement-breakpoint\nALTER TABLE `__new_execution_receipt` RENAME TO `execution_receipt`;--> statement-breakpoint\nPRAGMA foreign_keys=ON;'
78227
78274
  }
78228
78275
  ];
78229
78276
 
@@ -83136,13 +83183,6 @@ var LocalSqliteDatabase = class {
83136
83183
  throw new Error(`The ${label} migration is unavailable`);
83137
83184
  }
83138
83185
  this.transaction(() => {
83139
- if (migration.compatibleColumn !== void 0) {
83140
- const { table, column } = migration.compatibleColumn;
83141
- if (this.#sqlite.prepare("SELECT name FROM pragma_table_info(?) WHERE name = ?").get(table, column) === void 0) {
83142
- this.#sqlite.exec(migration.sql);
83143
- }
83144
- return;
83145
- }
83146
83186
  this.#sqlite.exec(migration.sql);
83147
83187
  this.#sqlite.exec(`PRAGMA user_version = ${index2 + 1}`);
83148
83188
  });
@@ -83177,16 +83217,25 @@ function channelSessionDatabasePaths(stateDirectory, channelId) {
83177
83217
  sessions: join22(stateDirectory, "sessions", `${channelHash}.sqlite`)
83178
83218
  };
83179
83219
  }
83180
- var openAcpSessionDatabase = (path7) => new LocalSqliteDatabase(
83181
- path7,
83182
- "ACP Session database",
83183
- acpSessionStoreMigrations.map(
83184
- (migration) => migration.name === "0009_receipt_admission_order.sql" ? {
83185
- ...migration,
83186
- compatibleColumn: { table: "execution_receipt", column: "admission_order" }
83187
- } : migration
83188
- )
83189
- );
83220
+ function recordAppliedAdmissionOrder(path7) {
83221
+ if (!existsSync9(path7)) {
83222
+ return;
83223
+ }
83224
+ const database = new DatabaseSync3(path7);
83225
+ try {
83226
+ const version2 = database.prepare("PRAGMA user_version").get()?.["user_version"];
83227
+ const column = database.prepare("SELECT name FROM pragma_table_info('execution_receipt') WHERE name = 'admission_order'").get();
83228
+ if (version2 === 9 && column !== void 0) {
83229
+ database.exec("PRAGMA user_version = 10");
83230
+ }
83231
+ } finally {
83232
+ database.close();
83233
+ }
83234
+ }
83235
+ var openAcpSessionDatabase = (path7) => {
83236
+ recordAppliedAdmissionOrder(path7);
83237
+ return new LocalSqliteDatabase(path7, "ACP Session database", acpSessionStoreMigrations);
83238
+ };
83190
83239
  var openSessionEventCacheDatabase = (path7) => new LocalSqliteDatabase(path7, "V2 Session event cache", sessionEventCacheMigrations, [
83191
83240
  "PRAGMA journal_mode = WAL",
83192
83241
  "PRAGMA synchronous = OFF",
@@ -84463,11 +84512,9 @@ async function publishAgentCatalog(config2, signal) {
84463
84512
  agents: catalog.agents.map((agent) => ({
84464
84513
  agentPath: agent.agentIdentity.requestedPath,
84465
84514
  agentVersion: agent.agentVersion,
84466
- agentSettingsDiscovery: true,
84467
84515
  capabilities: agent.capabilities,
84468
84516
  id: agent.id,
84469
- label: agent.label,
84470
- sessionTurnConfiguration: true
84517
+ label: agent.label
84471
84518
  }))
84472
84519
  }),
84473
84520
  dispatcher: environmentProxyDispatcher,
@@ -84781,11 +84828,9 @@ async function claimPairing(options, defaultWorkspace, localAgents, signal) {
84781
84828
  const agents = localAgents.map((agent) => ({
84782
84829
  agentPath: agent.agentIdentity.requestedPath,
84783
84830
  agentVersion: agent.agentVersion,
84784
- agentSettingsDiscovery: true,
84785
84831
  capabilities: agent.capabilities,
84786
84832
  id: agent.id,
84787
- label: agent.label,
84788
- sessionTurnConfiguration: true
84833
+ label: agent.label
84789
84834
  }));
84790
84835
  const endpoint = options.pairingId.length > 0 ? mobiusApiUrl(options.relayOrigin, `/v1/runtime-pairings/${encodeURIComponent(options.pairingId)}/redeem`) : mobiusApiUrl(options.relayOrigin, "/pairings/claim");
84791
84836
  let response;
@@ -84934,10 +84979,7 @@ var executionReceipt = sqliteTable("execution_receipt", {
84934
84979
  sessionId: text("session_id").notNull(),
84935
84980
  commandHash: text("command_hash").notNull(),
84936
84981
  attemptId: text("attempt_id").notNull(),
84937
- // Nullable only for receipts written by older Runtimes; assigned before recovery.
84938
- admissionOrder: integer2("admission_order"),
84939
- // Compatibility projection for older Runtimes; started and outcome own the facts.
84940
- state: text("state").notNull(),
84982
+ admissionOrder: integer2("admission_order").notNull(),
84941
84983
  started: integer2("started", { mode: "boolean" }).notNull(),
84942
84984
  outcome: text("outcome"),
84943
84985
  updatedAt: text("updated_at").notNull()
@@ -84996,16 +85038,6 @@ var receiptSchema = external_exports.object({
84996
85038
  outcome: external_exports.string().nullable()
84997
85039
  }).readonly();
84998
85040
  var identitySchema = external_exports.object({ sessionId: external_exports.string(), commandHash: external_exports.string() }).readonly();
84999
- function legacyState(receipt) {
85000
- if (receipt.outcome === null) {
85001
- return receipt.started ? "running" : "dispatching";
85002
- }
85003
- const event = decodeKnownSessionEventPayload(JSON.parse(receipt.outcome));
85004
- if (event === null) {
85005
- return "failed";
85006
- }
85007
- return event.type === "lifecycle-metadata" && event.payload.kind === "prompt.completed" ? event.payload.stopReason === "cancelled" ? "cancelled" : "succeeded" : "failed";
85008
- }
85009
85041
  var ExecutionReceiptTable = class {
85010
85042
  #database;
85011
85043
  constructor(database) {
@@ -85015,21 +85047,9 @@ var ExecutionReceiptTable = class {
85015
85047
  const row = this.#database.orm.select({ sessionId: executionIdentity.sessionId, commandHash: executionIdentity.commandHash }).from(executionIdentity).where(eq2(executionIdentity.commandId, commandId)).get();
85016
85048
  return row === void 0 ? void 0 : identitySchema.parse(row);
85017
85049
  };
85018
- list = () => this.#database.transaction(() => {
85019
- const rows = this.#database.orm.select().from(executionReceipt).orderBy(asc(executionReceipt.updatedAt), asc(executionReceipt.commandId)).all();
85020
- let latestOrder = rows.reduce((latest, row) => Math.max(latest, row.admissionOrder ?? 0), 0);
85021
- return rows.map((row) => {
85022
- if (row.admissionOrder !== null) {
85023
- return receiptSchema.parse(row);
85024
- }
85025
- const admissionOrder = ++latestOrder;
85026
- this.#database.orm.update(executionReceipt).set({ admissionOrder }).where(eq2(executionReceipt.commandId, row.commandId)).run();
85027
- return receiptSchema.parse({ ...row, admissionOrder });
85028
- }).sort((left, right) => left.admissionOrder - right.admissionOrder);
85029
- });
85050
+ list = () => this.#database.orm.select().from(executionReceipt).orderBy(asc(executionReceipt.admissionOrder), asc(executionReceipt.commandId)).all().map((row) => receiptSchema.parse(row));
85030
85051
  save = (receipt, terminalLimit) => this.#database.transaction(() => {
85031
- const row = { ...receipt, state: legacyState(receipt) };
85032
- this.#database.orm.insert(executionReceipt).values(row).onConflictDoUpdate({ target: executionReceipt.commandId, set: row }).run();
85052
+ this.#database.orm.insert(executionReceipt).values(receipt).onConflictDoUpdate({ target: executionReceipt.commandId, set: receipt }).run();
85033
85053
  if (receipt.outcome === null) {
85034
85054
  return [];
85035
85055
  }
@@ -85041,7 +85061,7 @@ var ExecutionReceiptTable = class {
85041
85061
  isNotNull(executionReceipt.outcome),
85042
85062
  notInArray(
85043
85063
  executionReceipt.commandId,
85044
- retained.map((row2) => row2.commandId)
85064
+ retained.map((row) => row.commandId)
85045
85065
  )
85046
85066
  )
85047
85067
  );
@@ -85482,12 +85502,12 @@ function validateElicitationContent(encoded, requestedSchema) {
85482
85502
  // src/engine/session/interaction/pending-interactions.ts
85483
85503
  var PendingPermission = class {
85484
85504
  completion = Promise.withResolvers();
85485
- interactionId;
85505
+ request;
85486
85506
  optionIds;
85487
85507
  #settled = false;
85488
- constructor(interactionId, optionIds) {
85489
- this.interactionId = interactionId;
85490
- this.optionIds = optionIds;
85508
+ constructor(request) {
85509
+ this.request = request;
85510
+ this.optionIds = new Set(request.options.map((option) => option.optionId));
85491
85511
  }
85492
85512
  cancel = () => {
85493
85513
  if (this.#settled) {
@@ -85511,12 +85531,12 @@ var PendingPermission = class {
85511
85531
  var PendingElicitation = class {
85512
85532
  completion = Promise.withResolvers();
85513
85533
  elicitationId;
85514
- interactionId;
85534
+ request;
85515
85535
  requestedSchema;
85516
85536
  #settled = false;
85517
- constructor(interactionId, elicitationId, requestedSchema) {
85518
- this.elicitationId = elicitationId;
85519
- this.interactionId = interactionId;
85537
+ constructor(request, requestedSchema) {
85538
+ this.request = request;
85539
+ this.elicitationId = request.elicitationId;
85520
85540
  this.requestedSchema = requestedSchema;
85521
85541
  }
85522
85542
  accept = (content) => {
@@ -85551,6 +85571,11 @@ var SessionInteractions = class {
85551
85571
  #pendingElicitations = /* @__PURE__ */ new Map();
85552
85572
  #acceptedUrlElicitations = /* @__PURE__ */ new Map();
85553
85573
  #context;
85574
+ snapshot = () => [
85575
+ ...[...this.#pendingPermissions.values()].map((pending) => pending.request),
85576
+ ...[...this.#pendingElicitations.values()].map((pending) => pending.request),
85577
+ ...this.#acceptedUrlElicitations.values()
85578
+ ];
85554
85579
  constructor(context) {
85555
85580
  this.#context = context;
85556
85581
  }
@@ -85629,7 +85654,7 @@ var SessionInteractions = class {
85629
85654
  if (pending.elicitationId.length > 0) {
85630
85655
  resolved = pending.accept({});
85631
85656
  if (resolved) {
85632
- this.#acceptedUrlElicitations.set(pending.elicitationId, pending.interactionId);
85657
+ this.#acceptedUrlElicitations.set(pending.elicitationId, { ...pending.request, accepted: true });
85633
85658
  }
85634
85659
  } else {
85635
85660
  resolved = pending.accept(validateElicitationContent(options.content, pending.requestedSchema));
@@ -85669,33 +85694,34 @@ var SessionInteractions = class {
85669
85694
  "invalid_agent_permission_request"
85670
85695
  );
85671
85696
  }
85672
- const pending = new PendingPermission(interactionId, new Set(options.map((option) => option.optionId)));
85697
+ const announced = this.#context.getToolCall(request.toolCall.toolCallId);
85698
+ const title2 = request.toolCall.title ?? announced?.title;
85699
+ const kind = request.toolCall.kind ?? announced?.kind;
85700
+ const rawInput = request.toolCall.rawInput ?? announced?.rawInput;
85701
+ const locations = request.toolCall.locations ?? announced?.locations ?? [];
85702
+ const event = {
85703
+ commandId: this.#context.commandId(),
85704
+ details: {
85705
+ cwd: this.#context.cwd(),
85706
+ rawInput,
85707
+ locations
85708
+ },
85709
+ interactionId,
85710
+ kind: SESSION_PERMISSION_REQUESTED_KIND,
85711
+ options,
85712
+ sessionId: this.#context.sessionId(),
85713
+ title: truncate(title2 ?? "Permission required", 500),
85714
+ toolCallId: truncate(request.toolCall.toolCallId, 255),
85715
+ toolKind: truncate(kind ?? "other", 64)
85716
+ };
85717
+ const pending = new PendingPermission(event);
85673
85718
  this.#pendingPermissions.set(interactionId, pending);
85674
85719
  const abort = () => {
85675
85720
  void this.cancelPermission(interactionId);
85676
85721
  };
85677
85722
  signal.addEventListener("abort", abort, { once: true });
85678
85723
  try {
85679
- const announced = this.#context.getToolCall(request.toolCall.toolCallId);
85680
- const title2 = request.toolCall.title ?? announced?.title;
85681
- const kind = request.toolCall.kind ?? announced?.kind;
85682
- const rawInput = request.toolCall.rawInput ?? announced?.rawInput;
85683
- const locations = request.toolCall.locations ?? announced?.locations ?? [];
85684
- await this.#notifyPermissionRequested({
85685
- commandId: this.#context.commandId(),
85686
- details: {
85687
- cwd: this.#context.cwd(),
85688
- rawInput,
85689
- locations
85690
- },
85691
- interactionId,
85692
- kind: SESSION_PERMISSION_REQUESTED_KIND,
85693
- options,
85694
- sessionId: this.#context.sessionId(),
85695
- title: truncate(title2 ?? "Permission required", 500),
85696
- toolCallId: truncate(request.toolCall.toolCallId, 255),
85697
- toolKind: truncate(kind ?? "other", 64)
85698
- });
85724
+ await this.#notifyPermissionRequested(event);
85699
85725
  return await pending.completion.promise;
85700
85726
  } finally {
85701
85727
  signal.removeEventListener("abort", abort);
@@ -85724,25 +85750,26 @@ var SessionInteractions = class {
85724
85750
  const requestedSchema = request.mode === "form" ? schemaValue : {};
85725
85751
  const elicitationIdValue = Reflect.get(request, "elicitationId");
85726
85752
  const elicitationId = request.mode === "url" && typeof elicitationIdValue === "string" ? truncate(elicitationIdValue, 255) : "";
85727
- const pending = new PendingElicitation(interactionId, elicitationId, requestedSchema);
85753
+ const event = {
85754
+ accepted: false,
85755
+ commandId: this.#context.commandId(),
85756
+ elicitationId,
85757
+ fields: normalizeElicitationFields(requestedSchema),
85758
+ interactionId,
85759
+ kind: SESSION_ELICITATION_REQUESTED_KIND,
85760
+ message: truncate(request.message, 2e3),
85761
+ mode: request.mode,
85762
+ sessionId: this.#context.sessionId(),
85763
+ url: request.mode === "url" && typeof Reflect.get(request, "url") === "string" ? truncate(readString2(Reflect.get(request, "url")), 4096) : ""
85764
+ };
85765
+ const pending = new PendingElicitation(event, requestedSchema);
85728
85766
  this.#pendingElicitations.set(interactionId, pending);
85729
85767
  const abort = () => {
85730
85768
  void this.cancelElicitation(interactionId);
85731
85769
  };
85732
85770
  signal.addEventListener("abort", abort, { once: true });
85733
85771
  try {
85734
- await this.#notifyElicitationRequested({
85735
- accepted: false,
85736
- commandId: this.#context.commandId(),
85737
- elicitationId,
85738
- fields: normalizeElicitationFields(requestedSchema),
85739
- interactionId,
85740
- kind: SESSION_ELICITATION_REQUESTED_KIND,
85741
- message: truncate(request.message, 2e3),
85742
- mode: request.mode,
85743
- sessionId: this.#context.sessionId(),
85744
- url: request.mode === "url" && typeof Reflect.get(request, "url") === "string" ? truncate(readString2(Reflect.get(request, "url")), 4096) : ""
85745
- });
85772
+ await this.#notifyElicitationRequested(event);
85746
85773
  return await pending.completion.promise;
85747
85774
  } finally {
85748
85775
  signal.removeEventListener("abort", abort);
@@ -85750,14 +85777,14 @@ var SessionInteractions = class {
85750
85777
  }
85751
85778
  };
85752
85779
  onElicitationComplete = async (notification) => {
85753
- const interactionId = this.#acceptedUrlElicitations.get(notification.elicitationId);
85754
- if (interactionId === void 0) {
85780
+ const accepted = this.#acceptedUrlElicitations.get(notification.elicitationId);
85781
+ if (accepted === void 0) {
85755
85782
  return;
85756
85783
  }
85757
85784
  this.#acceptedUrlElicitations.delete(notification.elicitationId);
85758
85785
  await this.#notifyElicitationResolved({
85759
85786
  action: "complete",
85760
- interactionId,
85787
+ interactionId: accepted.interactionId,
85761
85788
  kind: SESSION_ELICITATION_RESOLVED_KIND,
85762
85789
  sessionId: this.#context.sessionId()
85763
85790
  });
@@ -85792,7 +85819,9 @@ var SessionInteractions = class {
85792
85819
  cancelPendingInteractions = async () => {
85793
85820
  const permissionIds = [...this.#pendingPermissions.keys()];
85794
85821
  const elicitationIds = [...this.#pendingElicitations.keys()];
85795
- const acceptedElicitationIds = [...this.#acceptedUrlElicitations.values()];
85822
+ const acceptedElicitationIds = [...this.#acceptedUrlElicitations.values()].map(
85823
+ (request) => request.interactionId
85824
+ );
85796
85825
  this.#acceptedUrlElicitations.clear();
85797
85826
  for (const interactionId of permissionIds) {
85798
85827
  await this.cancelPermission(interactionId);
@@ -86600,10 +86629,10 @@ var AgentSession = class _AgentSession {
86600
86629
  await this.#publishConfiguration();
86601
86630
  }
86602
86631
  };
86603
- // The revision check and Agent mutation share one queue, including legacy callers.
86632
+ // The revision check and Agent mutation share one queue, including settings the Runtime applies itself.
86604
86633
  // A lost response may have committed: reread after a conflict, never replay an edit blindly.
86605
86634
  configure = async (options) => this.#configurationChanges.run(async (signal) => {
86606
- if (options.expectedConfigurationRevision !== void 0 && options.expectedConfigurationRevision !== this.#configRevision) {
86635
+ if (options.expectedConfigurationRevision !== null && options.expectedConfigurationRevision !== this.#configRevision) {
86607
86636
  throw new AcpExecutionError(
86608
86637
  "Session settings changed. Review the current settings before applying your selection again.",
86609
86638
  {},
@@ -86808,6 +86837,10 @@ var AgentSession = class _AgentSession {
86808
86837
  }
86809
86838
  return "retained";
86810
86839
  };
86840
+ interactionSnapshot = () => {
86841
+ const { sessionGenerationId, throughPosition } = this.#store.events.livePosition(this.#mobiusSessionId);
86842
+ return { sessionGenerationId, throughPosition, interactions: this.#interactions.snapshot() };
86843
+ };
86811
86844
  respondPermission = async (options) => {
86812
86845
  await this.#interactions.respondPermission(options);
86813
86846
  };
@@ -87255,6 +87288,7 @@ var SessionManager2 = class {
87255
87288
  ...options,
87256
87289
  booleanValue: desired.booleanValue,
87257
87290
  configId: desired.id,
87291
+ expectedConfigurationRevision: null,
87258
87292
  requestId: `execution-prepare-${desired.id}`,
87259
87293
  value: "",
87260
87294
  valueType: "boolean"
@@ -87267,6 +87301,7 @@ var SessionManager2 = class {
87267
87301
  ...options,
87268
87302
  booleanValue: false,
87269
87303
  configId: desired.id,
87304
+ expectedConfigurationRevision: null,
87270
87305
  requestId: `execution-prepare-${desired.id}`,
87271
87306
  value: desired.currentValue,
87272
87307
  valueType: "select"
@@ -87412,6 +87447,7 @@ var SessionManager2 = class {
87412
87447
  ...options2,
87413
87448
  booleanValue: false,
87414
87449
  configId: modelOption2?.id ?? "model",
87450
+ expectedConfigurationRevision: null,
87415
87451
  requestId: "agent-settings-model",
87416
87452
  sessionId: `agent-settings-${crypto.randomUUID()}`,
87417
87453
  value: model,
@@ -87717,6 +87753,21 @@ var SessionManager2 = class {
87717
87753
  };
87718
87754
  listSessions = (limit) => this.#store.list().filter((session) => session.prompted).slice(0, limit);
87719
87755
  findLinkedSessions = (agentId, nativeSessionId) => this.#store.findNative(agentId, nativeSessionId);
87756
+ interactionSnapshot = (options) => {
87757
+ options.signal.throwIfAborted();
87758
+ const runtime = this.#executionProcesses.get(options.sessionId);
87759
+ if (runtime !== void 0) {
87760
+ return runtime.belongsTo(options.agent.id, options.cwd, options.additionalDirectories) ? runtime.interactionSnapshot() : void 0;
87761
+ }
87762
+ const stored = this.#store.read(options.sessionId);
87763
+ if (!(stored instanceof FoundStoredSession) || stored.session.agentId !== options.agent.id || stored.session.cwd !== options.cwd || stored.session.additionalDirectories.length !== options.additionalDirectories.length || !stored.session.additionalDirectories.every(
87764
+ (directory, index2) => directory === options.additionalDirectories[index2]
87765
+ )) {
87766
+ return void 0;
87767
+ }
87768
+ const { sessionGenerationId, throughPosition } = this.#store.events.livePosition(options.sessionId);
87769
+ return { sessionGenerationId, throughPosition, interactions: [] };
87770
+ };
87720
87771
  hasPreparedSession = (sessionId, agentId, cwd, additionalDirectories) => this.#executionProcesses.get(sessionId)?.belongsTo(agentId, cwd, additionalDirectories) === true;
87721
87772
  createNativeSession = async (options) => this.#operations.run(options, async (options2) => {
87722
87773
  const temporarySessionId = `new-${crypto.randomUUID()}`;
@@ -88151,6 +88202,7 @@ var NativeSessionService = class {
88151
88202
  capabilities: opened.prepared.capabilities,
88152
88203
  commands: opened.prepared.commands,
88153
88204
  configOptions: opened.prepared.configOptions,
88205
+ configurationRevision: opened.prepared.configurationRevision,
88154
88206
  directoryId: target.directoryId,
88155
88207
  directoryLabel: target.directoryLabel,
88156
88208
  kind: "session.ready",
@@ -89476,8 +89528,13 @@ function buildSessionLayer(options) {
89476
89528
  );
89477
89529
  });
89478
89530
  const lastTurn = snapshot.turn === null ? operations.lastTurn(request.targetSessionId) : void 0;
89531
+ const interactionState = manager.interactionSnapshot({
89532
+ ...requestOptions,
89533
+ sessionId: request.targetSessionId
89534
+ });
89479
89535
  return {
89480
89536
  ...snapshot,
89537
+ ...interactionState === void 0 ? {} : { interactionState },
89481
89538
  ...request.deliveryCommandId === void 0 ? {} : { command: operations.delivery(request.deliveryCommandId, request.targetSessionId) },
89482
89539
  ...lastTurn === void 0 ? {} : { lastTurn }
89483
89540
  };
@@ -89728,19 +89785,6 @@ var LocalExternalContentStore = class {
89728
89785
  };
89729
89786
  };
89730
89787
 
89731
- // src/engine/util/timer.ts
89732
- var SystemTimer = class {
89733
- schedule = (callback, milliseconds) => {
89734
- const timeout = setTimeout(callback, milliseconds);
89735
- return {
89736
- cancel: () => {
89737
- clearTimeout(timeout);
89738
- }
89739
- };
89740
- };
89741
- };
89742
- var systemTimer = new SystemTimer();
89743
-
89744
89788
  // src/engine/session/process/process-capacity.ts
89745
89789
  var AcpProcessCapacityLease = class {
89746
89790
  #releaseCapacity;
@@ -91699,6 +91743,7 @@ async function applySessionConfigurationSelection(sessions, options, selection,
91699
91743
  agent,
91700
91744
  booleanValue: selection.booleanValue,
91701
91745
  configId: selection.configId,
91746
+ expectedConfigurationRevision: null,
91702
91747
  cwd,
91703
91748
  requestId: `cfg_${randomUUID18()}`,
91704
91749
  sessionId,
@@ -92058,6 +92103,7 @@ async function prepareSession(command, recovery, closed, config2, resolveAgent,
92058
92103
  ...preparation,
92059
92104
  booleanValue: configuration.booleanValue,
92060
92105
  configId: configuration.configId,
92106
+ expectedConfigurationRevision: null,
92061
92107
  requestId: command.requestId,
92062
92108
  value: configuration.value,
92063
92109
  valueType: configuration.valueType
@@ -92234,7 +92280,7 @@ async function executeSessionConfigure(socket, command, config2, resolveAgent, d
92234
92280
  ...await resolveAgent(command.agentId, signal, command.sessionId),
92235
92281
  booleanValue: command.booleanValue,
92236
92282
  configId: command.configId,
92237
- ...command.expectedConfigurationRevision === void 0 ? {} : { expectedConfigurationRevision: command.expectedConfigurationRevision },
92283
+ expectedConfigurationRevision: command.expectedConfigurationRevision,
92238
92284
  cwd: resolved.cwd,
92239
92285
  requestId: command.requestId,
92240
92286
  sessionId: command.sessionId,
@@ -92637,7 +92683,7 @@ var HEARTBEAT_ACK_TIMEOUT_MILLISECONDS = 1e4;
92637
92683
  var HEARTBEAT_INTERVAL_MILLISECONDS = 2e4;
92638
92684
  var RelayLivenessState = class {
92639
92685
  };
92640
- var UnsupportedRelayLivenessState = class extends RelayLivenessState {
92686
+ var NotStartedRelayLivenessState = class extends RelayLivenessState {
92641
92687
  };
92642
92688
  var AwaitingHeartbeatAckState = class extends RelayLivenessState {
92643
92689
  timeout;
@@ -92658,7 +92704,7 @@ var FinishedRelayLivenessState = class extends RelayLivenessState {
92658
92704
  var RelayConnectionLiveness = class {
92659
92705
  #timer;
92660
92706
  #transport;
92661
- #state = new UnsupportedRelayLivenessState();
92707
+ #state = new NotStartedRelayLivenessState();
92662
92708
  constructor(timer, transport) {
92663
92709
  this.#timer = timer;
92664
92710
  this.#transport = transport;
@@ -92677,13 +92723,13 @@ var RelayConnectionLiveness = class {
92677
92723
  this.#state.timeout.cancel();
92678
92724
  } else if (this.#state instanceof WaitingForHeartbeatState) {
92679
92725
  this.#state.schedule.cancel();
92680
- } else if (!(this.#state instanceof UnsupportedRelayLivenessState) && !(this.#state instanceof FinishedRelayLivenessState)) {
92726
+ } else if (!(this.#state instanceof NotStartedRelayLivenessState) && !(this.#state instanceof FinishedRelayLivenessState)) {
92681
92727
  throw new Error("Unknown relay liveness state");
92682
92728
  }
92683
92729
  this.#state = new FinishedRelayLivenessState();
92684
92730
  };
92685
92731
  start = () => {
92686
- if (this.#state instanceof UnsupportedRelayLivenessState) {
92732
+ if (this.#state instanceof NotStartedRelayLivenessState) {
92687
92733
  this.#sendHeartbeat();
92688
92734
  return;
92689
92735
  }
@@ -92709,7 +92755,7 @@ var RelayConnectionLiveness = class {
92709
92755
  #sendHeartbeat = () => {
92710
92756
  if (this.#state instanceof WaitingForHeartbeatState) {
92711
92757
  this.#state.schedule.cancel();
92712
- } else if (!(this.#state instanceof UnsupportedRelayLivenessState)) {
92758
+ } else if (!(this.#state instanceof NotStartedRelayLivenessState)) {
92713
92759
  if (this.#state instanceof FinishedRelayLivenessState) {
92714
92760
  return;
92715
92761
  }
@@ -92759,7 +92805,6 @@ async function runRelayConnection({
92759
92805
  timer
92760
92806
  }) {
92761
92807
  const relayUrl = new URL(config2.relayUrl);
92762
- relayUrl.searchParams.set("liveness", "1");
92763
92808
  const relay = await connectRelay(relayUrl, signal, (failure2, source) => {
92764
92809
  diagnostics.transportFailed(connectionEpoch, failure2, source);
92765
92810
  });
@@ -93591,4 +93636,4 @@ export {
93591
93636
  * MIT Licensed
93592
93637
  *)
93593
93638
  */
93594
- //# sourceMappingURL=chunk-7HMKMNG4.js.map
93639
+ //# sourceMappingURL=chunk-3GTWYIU4.js.map