@moxt-ai/mobius 0.0.325 → 0.0.326

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 (28) hide show
  1. package/dist/cli.js +63 -12
  2. package/dist/cli.js.map +4 -4
  3. package/dist/generated/acp-session-store-migrations.d.ts +3 -0
  4. package/dist/generated/acp-session-store-migrations.d.ts.map +1 -1
  5. package/dist/generated/acp-session-store-migrations.js +5 -1
  6. package/dist/generated/acp-session-store-migrations.js.map +1 -1
  7. package/dist/runtime/command/registry/prompt.d.ts.map +1 -1
  8. package/dist/runtime/command/registry/prompt.js +10 -0
  9. package/dist/runtime/command/registry/prompt.js.map +1 -1
  10. package/dist/runtime.js +54 -11
  11. package/dist/runtime.js.map +4 -4
  12. package/dist/schema/acp-session-store/execution-identity.d.ts +57 -0
  13. package/dist/schema/acp-session-store/execution-identity.d.ts.map +1 -0
  14. package/dist/schema/acp-session-store/execution-identity.js +8 -0
  15. package/dist/schema/acp-session-store/execution-identity.js.map +1 -0
  16. package/dist/schema/acp-session-store/index.d.ts +1 -0
  17. package/dist/schema/acp-session-store/index.d.ts.map +1 -1
  18. package/dist/schema/acp-session-store/index.js +1 -0
  19. package/dist/schema/acp-session-store/index.js.map +1 -1
  20. package/dist/session/turn/execution-receipts.d.ts +3 -1
  21. package/dist/session/turn/execution-receipts.d.ts.map +1 -1
  22. package/dist/session/turn/execution-receipts.js +10 -4
  23. package/dist/session/turn/execution-receipts.js.map +1 -1
  24. package/dist/storage/session/execution-receipt-table.d.ts +5 -0
  25. package/dist/storage/session/execution-receipt-table.d.ts.map +1 -1
  26. package/dist/storage/session/execution-receipt-table.js +32 -6
  27. package/dist/storage/session/execution-receipt-table.js.map +1 -1
  28. package/package.json +1 -1
@@ -22,5 +22,8 @@ export declare const acpSessionStoreMigrations: readonly [{
22
22
  }, {
23
23
  readonly name: "0007_busy_excalibur.sql";
24
24
  readonly sql: "CREATE TABLE `execution_receipt` (\n\t`command_id` text PRIMARY KEY NOT NULL,\n\t`session_id` text NOT NULL,\n\t`command_hash` text NOT NULL,\n\t`attempt_id` text NOT NULL,\n\t`state` text NOT NULL,\n\t`started` integer NOT NULL,\n\t`outcome` text,\n\t`updated_at` text NOT NULL\n);\n";
25
+ }, {
26
+ readonly name: "0008_execution_identity.sql";
27
+ readonly sql: "CREATE TABLE `execution_identity` (\n\t`command_id` text PRIMARY KEY NOT NULL,\n\t`session_id` text NOT NULL,\n\t`command_hash` text NOT NULL\n);\n";
25
28
  }];
26
29
  //# sourceMappingURL=acp-session-store-migrations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"acp-session-store-migrations.d.ts","sourceRoot":"","sources":["../../src/generated/acp-session-store-migrations.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB;aAE9B,IAAM,EAAE,iCAAiC;aACzC,GAAK,EAAE,2ZAA2Z;;aAGla,IAAM,EAAE,4BAA4B;aACpC,GAAK,EAAE,gEAAgE;;aAGvE,IAAM,EAAE,4BAA4B;aACpC,GAAK,EAAE,ybAAyb;;aAGhc,IAAM,EAAE,yBAAyB;aACjC,GAAK,EAAE,gCAAgC;;aAGvC,IAAM,EAAE,6BAA6B;aACrC,GAAK,EAAE,8HAA8H;;aAGrI,IAAM,EAAE,2BAA2B;aACnC,GAAK,EAAE,4EAA4E;;aAGnF,IAAM,EAAE,yCAAyC;aACjD,GAAK,EAAE,iKAAiK;;aAGxK,IAAM,EAAE,yBAAyB;aACjC,GAAK,EAAE,8RAA8R;EAEnS,CAAC"}
1
+ {"version":3,"file":"acp-session-store-migrations.d.ts","sourceRoot":"","sources":["../../src/generated/acp-session-store-migrations.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB;aAE9B,IAAM,EAAE,iCAAiC;aACzC,GAAK,EAAE,2ZAA2Z;;aAGla,IAAM,EAAE,4BAA4B;aACpC,GAAK,EAAE,gEAAgE;;aAGvE,IAAM,EAAE,4BAA4B;aACpC,GAAK,EAAE,ybAAyb;;aAGhc,IAAM,EAAE,yBAAyB;aACjC,GAAK,EAAE,gCAAgC;;aAGvC,IAAM,EAAE,6BAA6B;aACrC,GAAK,EAAE,8HAA8H;;aAGrI,IAAM,EAAE,2BAA2B;aACnC,GAAK,EAAE,4EAA4E;;aAGnF,IAAM,EAAE,yCAAyC;aACjD,GAAK,EAAE,iKAAiK;;aAGxK,IAAM,EAAE,yBAAyB;aACjC,GAAK,EAAE,8RAA8R;;aAGrS,IAAM,EAAE,6BAA6B;aACrC,GAAK,EAAE,qJAAqJ;EAE1J,CAAC"}
@@ -1,5 +1,5 @@
1
1
  // Generated by scripts/generate-sql-modules.ts. Do not edit.
2
- // Sources: ../../migrations/acp-session-store/0000_slimy_captain_midlands.sql, ../../migrations/acp-session-store/0001_regular_ultimates.sql, ../../migrations/acp-session-store/0002_equal_black_queen.sql, ../../migrations/acp-session-store/0003_silky_ravenous.sql, ../../migrations/acp-session-store/0004_special_mathemanic.sql, ../../migrations/acp-session-store/0005_orange_amphibian.sql, ../../migrations/acp-session-store/0006_live_event_position_allocation.sql, ../../migrations/acp-session-store/0007_busy_excalibur.sql
2
+ // Sources: ../../migrations/acp-session-store/0000_slimy_captain_midlands.sql, ../../migrations/acp-session-store/0001_regular_ultimates.sql, ../../migrations/acp-session-store/0002_equal_black_queen.sql, ../../migrations/acp-session-store/0003_silky_ravenous.sql, ../../migrations/acp-session-store/0004_special_mathemanic.sql, ../../migrations/acp-session-store/0005_orange_amphibian.sql, ../../migrations/acp-session-store/0006_live_event_position_allocation.sql, ../../migrations/acp-session-store/0007_busy_excalibur.sql, ../../migrations/acp-session-store/0008_execution_identity.sql
3
3
  export const acpSessionStoreMigrations = [
4
4
  {
5
5
  "name": "0000_slimy_captain_midlands.sql",
@@ -32,6 +32,10 @@ export const acpSessionStoreMigrations = [
32
32
  {
33
33
  "name": "0007_busy_excalibur.sql",
34
34
  "sql": "CREATE TABLE `execution_receipt` (\n\t`command_id` text PRIMARY KEY NOT NULL,\n\t`session_id` text NOT NULL,\n\t`command_hash` text NOT NULL,\n\t`attempt_id` text NOT NULL,\n\t`state` text NOT NULL,\n\t`started` integer NOT NULL,\n\t`outcome` text,\n\t`updated_at` text NOT NULL\n);\n"
35
+ },
36
+ {
37
+ "name": "0008_execution_identity.sql",
38
+ "sql": "CREATE TABLE `execution_identity` (\n\t`command_id` text PRIMARY KEY NOT NULL,\n\t`session_id` text NOT NULL,\n\t`command_hash` text NOT NULL\n);\n"
35
39
  }
36
40
  ];
37
41
  //# sourceMappingURL=acp-session-store-migrations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"acp-session-store-migrations.js","sourceRoot":"","sources":["../../src/generated/acp-session-store-migrations.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,8gBAA8gB;AAC9gB,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACrC;QACI,MAAM,EAAE,iCAAiC;QACzC,KAAK,EAAE,2ZAA2Z;KACra;IACD;QACI,MAAM,EAAE,4BAA4B;QACpC,KAAK,EAAE,gEAAgE;KAC1E;IACD;QACI,MAAM,EAAE,4BAA4B;QACpC,KAAK,EAAE,ybAAyb;KACnc;IACD;QACI,MAAM,EAAE,yBAAyB;QACjC,KAAK,EAAE,gCAAgC;KAC1C;IACD;QACI,MAAM,EAAE,6BAA6B;QACrC,KAAK,EAAE,8HAA8H;KACxI;IACD;QACI,MAAM,EAAE,2BAA2B;QACnC,KAAK,EAAE,4EAA4E;KACtF;IACD;QACI,MAAM,EAAE,yCAAyC;QACjD,KAAK,EAAE,iKAAiK;KAC3K;IACD;QACI,MAAM,EAAE,yBAAyB;QACjC,KAAK,EAAE,8RAA8R;KACxS;CACK,CAAC"}
1
+ {"version":3,"file":"acp-session-store-migrations.js","sourceRoot":"","sources":["../../src/generated/acp-session-store-migrations.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,8kBAA8kB;AAC9kB,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACrC;QACI,MAAM,EAAE,iCAAiC;QACzC,KAAK,EAAE,2ZAA2Z;KACra;IACD;QACI,MAAM,EAAE,4BAA4B;QACpC,KAAK,EAAE,gEAAgE;KAC1E;IACD;QACI,MAAM,EAAE,4BAA4B;QACpC,KAAK,EAAE,ybAAyb;KACnc;IACD;QACI,MAAM,EAAE,yBAAyB;QACjC,KAAK,EAAE,gCAAgC;KAC1C;IACD;QACI,MAAM,EAAE,6BAA6B;QACrC,KAAK,EAAE,8HAA8H;KACxI;IACD;QACI,MAAM,EAAE,2BAA2B;QACnC,KAAK,EAAE,4EAA4E;KACtF;IACD;QACI,MAAM,EAAE,yCAAyC;QACjD,KAAK,EAAE,iKAAiK;KAC3K;IACD;QACI,MAAM,EAAE,yBAAyB;QACjC,KAAK,EAAE,8RAA8R;KACxS;IACD;QACI,MAAM,EAAE,6BAA6B;QACrC,KAAK,EAAE,qJAAqJ;KAC/J;CACK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/runtime/command/registry/prompt.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,eAAO,MAAM,oBAAoB,EAAE,cA0FlC,CAAC"}
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/runtime/command/registry/prompt.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,eAAO,MAAM,oBAAoB,EAAE,cAqGlC,CAAC"}
@@ -37,6 +37,16 @@ export const sessionPromptCommand = {
37
37
  }
38
38
  return;
39
39
  }
40
+ if (receipt.kind === "expired") {
41
+ send(context.socket, {
42
+ code: "command_result_expired",
43
+ requestId: message.commandId,
44
+ kind: "session.operation.failed",
45
+ message: "This command already started. Its execution result is no longer available; it will not run again.",
46
+ sessionId: message.sessionId,
47
+ });
48
+ return;
49
+ }
40
50
  const turn = context.sessionTurns.start(message, receipt.attemptId);
41
51
  context.eventProjection.requested(message);
42
52
  // Queue admission is acknowledged by the V2 session.queue.changed lifecycle
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/runtime/command/registry/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,0BAA0B,EAC1B,mBAAmB,EACnB,wBAAwB,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE1E,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,MAAM,CAAC,MAAM,oBAAoB,GAAmB;IAChD,IAAI,EAAE,mBAAmB;IACzB,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,EAAQ,EAAE;QAC/B,IAAI,OAAO,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,EAAE,EAAE,CAAC;YACzC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;gBACjB,IAAI,EAAE,mBAAmB;gBACzB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,IAAI,EAAE,0BAA0B;gBAChC,OAAO,EAAE,sDAAsD;gBAC/D,SAAS,EAAE,OAAO,CAAC,SAAS;aAC/B,CAAC,CAAC;YACH,OAAO;QACX,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,CAC7C,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,SAAS,EACjB,0BAA0B,CAAC,OAAO,CAAC,CACtC,CAAC;QACF,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;gBACjB,IAAI,EAAE,2BAA2B;gBACjC,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,IAAI,EAAE,0BAA0B;gBAChC,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,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAClC,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;YAC9E,IAAI,OAAO,CAAC,WAAW,KAAK,wBAAwB,CAAC,KAAK,EAAE,CAAC;gBACzD,YAAY,EAAE,CAAC;YACnB,CAAC;QACL,CAAC,CAAC,CAAC;IACX,CAAC;CACJ,CAAC"}
package/dist/runtime.js CHANGED
@@ -22175,12 +22175,12 @@ var contentFields = { annotations: annotationsSchema.nullable().optional() };
22175
22175
  var textContentSchema = external_exports.object({ ...contentFields, text: boundedString2, type: external_exports.literal("text") }).readonly();
22176
22176
  var imageContentSchema = external_exports.object({
22177
22177
  ...contentFields,
22178
- data: boundedString2,
22178
+ data: external_exports.string(),
22179
22179
  mimeType: shortString,
22180
22180
  type: external_exports.literal("image"),
22181
22181
  uri: boundedString2.nullable().optional()
22182
22182
  }).readonly();
22183
- var audioContentSchema = external_exports.object({ ...contentFields, data: boundedString2, mimeType: shortString, type: external_exports.literal("audio") }).readonly();
22183
+ var audioContentSchema = external_exports.object({ ...contentFields, data: external_exports.string(), mimeType: shortString, type: external_exports.literal("audio") }).readonly();
22184
22184
  var externalImageContentSchema = external_exports.object({
22185
22185
  ...contentFields,
22186
22186
  byteLength: external_exports.number().int().positive().safe(),
@@ -22221,7 +22221,7 @@ var textResourceSchema = external_exports.object({
22221
22221
  uri: boundedString2
22222
22222
  }).readonly();
22223
22223
  var blobResourceSchema = external_exports.object({
22224
- blob: boundedString2,
22224
+ blob: external_exports.string(),
22225
22225
  mimeType: shortString.nullable().optional(),
22226
22226
  uri: boundedString2
22227
22227
  }).readonly();
@@ -26741,6 +26741,10 @@ var acpSessionStoreMigrations = [
26741
26741
  {
26742
26742
  "name": "0007_busy_excalibur.sql",
26743
26743
  "sql": "CREATE TABLE `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 `state` text NOT NULL,\n `started` integer NOT NULL,\n `outcome` text,\n `updated_at` text NOT NULL\n);\n"
26744
+ },
26745
+ {
26746
+ "name": "0008_execution_identity.sql",
26747
+ "sql": "CREATE TABLE `execution_identity` (\n `command_id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `command_hash` text NOT NULL\n);\n"
26744
26748
  }
26745
26749
  ];
26746
26750
 
@@ -32382,7 +32386,7 @@ import { fetch as fetch3 } from "undici";
32382
32386
  // package.json
32383
32387
  var package_default = {
32384
32388
  name: "@moxt-ai/mobius",
32385
- version: "0.0.325",
32389
+ version: "0.0.326",
32386
32390
  description: "Mobius CLI for pairing and running local AI agent services.",
32387
32391
  type: "module",
32388
32392
  bin: {
@@ -83388,6 +83392,13 @@ var acpSession = sqliteTable("acp_session", {
83388
83392
  updatedAt: text("updated_at").notNull()
83389
83393
  });
83390
83394
 
83395
+ // src/schema/acp-session-store/execution-identity.ts
83396
+ var executionIdentity = sqliteTable("execution_identity", {
83397
+ commandId: text("command_id").primaryKey(),
83398
+ sessionId: text("session_id").notNull(),
83399
+ commandHash: text("command_hash").notNull()
83400
+ });
83401
+
83391
83402
  // src/schema/acp-session-store/execution-receipt.ts
83392
83403
  var executionReceipt = sqliteTable("execution_receipt", {
83393
83404
  commandId: text("command_id").primaryKey(),
@@ -83458,11 +83469,16 @@ var receiptSchema = external_exports.discriminatedUnion("state", [
83458
83469
  outcome: external_exports.string().nullable()
83459
83470
  })
83460
83471
  ]).readonly();
83472
+ var identitySchema = external_exports.object({ sessionId: external_exports.string(), commandHash: external_exports.string() }).readonly();
83461
83473
  var ExecutionReceiptTable = class {
83462
83474
  #database;
83463
83475
  constructor(database) {
83464
83476
  this.#database = database;
83465
83477
  }
83478
+ identity = (commandId) => {
83479
+ const row = this.#database.orm.select({ sessionId: executionIdentity.sessionId, commandHash: executionIdentity.commandHash }).from(executionIdentity).where(eq(executionIdentity.commandId, commandId)).get();
83480
+ return row === void 0 ? void 0 : identitySchema.parse(row);
83481
+ };
83466
83482
  list = () => receiptSchema.array().parse(
83467
83483
  this.#database.orm.select().from(executionReceipt).orderBy(asc(executionReceipt.updatedAt), asc(executionReceipt.commandId)).all()
83468
83484
  );
@@ -83479,7 +83495,7 @@ var ExecutionReceiptTable = class {
83479
83495
  )
83480
83496
  ).orderBy(desc(executionReceipt.updatedAt), desc(executionReceipt.commandId)).limit(1024).all();
83481
83497
  if (retained.length === 1024) {
83482
- this.#database.orm.delete(executionReceipt).where(
83498
+ this.#remove(
83483
83499
  and(
83484
83500
  eq(executionReceipt.sessionId, receipt.sessionId),
83485
83501
  inArray(executionReceipt.state, ["succeeded", "failed", "cancelled"]),
@@ -83488,12 +83504,25 @@ var ExecutionReceiptTable = class {
83488
83504
  retained.map((row) => row.commandId)
83489
83505
  )
83490
83506
  )
83491
- ).run();
83507
+ );
83492
83508
  }
83493
83509
  });
83494
83510
  };
83495
83511
  remove = (commandId) => {
83496
- this.#database.orm.delete(executionReceipt).where(eq(executionReceipt.commandId, commandId)).run();
83512
+ this.#database.transaction(() => this.#remove(eq(executionReceipt.commandId, commandId)));
83513
+ };
83514
+ #remove = (condition) => {
83515
+ if (condition === void 0) {
83516
+ throw new Error("Execution receipt removal requires a scope");
83517
+ }
83518
+ this.#database.orm.insert(executionIdentity).select(
83519
+ this.#database.orm.select({
83520
+ commandId: executionReceipt.commandId,
83521
+ sessionId: executionReceipt.sessionId,
83522
+ commandHash: executionReceipt.commandHash
83523
+ }).from(executionReceipt).where(and(condition, eq(executionReceipt.started, true)))
83524
+ ).onConflictDoNothing().run();
83525
+ this.#database.orm.delete(executionReceipt).where(condition).run();
83497
83526
  };
83498
83527
  };
83499
83528
 
@@ -86724,7 +86753,7 @@ var ExecutionReceipts = class {
86724
86753
  constructor(table, onCount = () => void 0) {
86725
86754
  this.#onCount = onCount;
86726
86755
  this.#table = table;
86727
- for (const row of table?.list() ?? []) {
86756
+ for (const row of table.list()) {
86728
86757
  this.#executions.set(row.commandId, row);
86729
86758
  this.#recoveredCommands.add(row.commandId);
86730
86759
  if (!isTerminal(row.state)) {
@@ -86740,7 +86769,7 @@ var ExecutionReceipts = class {
86740
86769
  }
86741
86770
  #save = (commandId, receipt) => {
86742
86771
  if (!this.#closing) {
86743
- this.#table?.save({ ...receipt, commandId, updatedAt: (/* @__PURE__ */ new Date()).toISOString() });
86772
+ this.#table.save({ ...receipt, commandId, updatedAt: (/* @__PURE__ */ new Date()).toISOString() });
86744
86773
  }
86745
86774
  const previous = this.#executions.get(commandId);
86746
86775
  const wasActive = previous !== void 0 && !isTerminal(previous.state);
@@ -86816,9 +86845,9 @@ var ExecutionReceipts = class {
86816
86845
  let existing = this.#executions.get(commandId);
86817
86846
  const previous = this.outcome(commandId);
86818
86847
  if (existing?.sessionId === sessionId && !existing.started && previous?.type === "lifecycle-metadata" && previous.payload.kind === "prompt.failed-before-start" && previous.payload.code === "runtime_restarted") {
86848
+ this.#table.remove(commandId);
86819
86849
  this.#executions.delete(commandId);
86820
86850
  this.#recoveredCommands.delete(commandId);
86821
- this.#table?.remove(commandId);
86822
86851
  this.#terminalCountBySession.set(
86823
86852
  sessionId,
86824
86853
  Math.max(0, (this.#terminalCountBySession.get(sessionId) ?? 1) - 1)
@@ -86837,6 +86866,10 @@ var ExecutionReceipts = class {
86837
86866
  outcome: this.#recoveredCommands.has(commandId) ? this.outcome(commandId) : void 0
86838
86867
  };
86839
86868
  }
86869
+ const identity2 = this.#table.identity(commandId);
86870
+ if (identity2 !== void 0) {
86871
+ return identity2.sessionId === sessionId && identity2.commandHash === commandHash ? { kind: "expired" } : { kind: "conflict" };
86872
+ }
86840
86873
  const attemptId = randomUUID13();
86841
86874
  this.#save(commandId, {
86842
86875
  attemptId,
@@ -86887,9 +86920,9 @@ var ExecutionReceipts = class {
86887
86920
  }
86888
86921
  for (const [commandId, receipt] of this.#executions) {
86889
86922
  if (receipt.sessionId === sessionId && isTerminal(receipt.state)) {
86923
+ this.#table.remove(commandId);
86890
86924
  this.#executions.delete(commandId);
86891
86925
  this.#recoveredCommands.delete(commandId);
86892
- this.#table?.remove(commandId);
86893
86926
  const remaining = (this.#terminalCountBySession.get(sessionId) ?? 1) - 1;
86894
86927
  if (remaining > 0) {
86895
86928
  this.#terminalCountBySession.set(sessionId, remaining);
@@ -90118,6 +90151,16 @@ var sessionPromptCommand = {
90118
90151
  }
90119
90152
  return;
90120
90153
  }
90154
+ if (receipt.kind === "expired") {
90155
+ send(context.socket, {
90156
+ code: "command_result_expired",
90157
+ requestId: message.commandId,
90158
+ kind: "session.operation.failed",
90159
+ message: "This command already started. Its execution result is no longer available; it will not run again.",
90160
+ sessionId: message.sessionId
90161
+ });
90162
+ return;
90163
+ }
90121
90164
  const turn = context.sessionTurns.start(message, receipt.attemptId);
90122
90165
  context.eventProjection.requested(message);
90123
90166
  const queueChanged = () => {