@moxt-ai/mobius 0.0.425 → 0.0.427

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.
@@ -3,7 +3,7 @@ import {
3
3
  __export,
4
4
  __using,
5
5
  package_default
6
- } from "./chunk-EAUFTFPD.js";
6
+ } from "./chunk-5TGOLSLS.js";
7
7
 
8
8
  // src/engine/runtime/relay/runtime-revocation.ts
9
9
  var runtimeRevocationCloseCode = 1008;
@@ -20809,7 +20809,11 @@ var sessionEventPayloadSchema = external_exports.discriminatedUnion("type", [
20809
20809
  external_exports.object({ payload: lifecycleMetadataSchema, type: external_exports.literal("lifecycle-metadata") }).readonly()
20810
20810
  ]);
20811
20811
  var positionSchema = external_exports.string().regex(/^(0|[1-9][0-9]*)$/);
20812
- var mobiusMetadataFields = { omitted: external_exports.literal(true).optional(), restated: external_exports.literal(true).optional() };
20812
+ var mobiusMetadataFields = {
20813
+ omitted: external_exports.literal(true).optional(),
20814
+ recordedOutcome: external_exports.literal(true).optional(),
20815
+ restated: external_exports.literal(true).optional()
20816
+ };
20813
20817
  var sharedSessionEventFields = {
20814
20818
  eventId: identifierStringSchema,
20815
20819
  mobiusMetadata: external_exports.object(mobiusMetadataFields).readonly().optional(),
@@ -72744,6 +72748,7 @@ function userMessageUpdates(item, submitted) {
72744
72748
  // src/engine/acp/harness/codex/borrowed-agent.ts
72745
72749
  var REQUEST_TIMEOUT = 3e4;
72746
72750
  var POLL_INTERVAL = 500;
72751
+ var UNANSWERED_READ_LIMIT = 3;
72747
72752
  var queueResponseSchema = external_exports.object({
72748
72753
  queuedSubmission: external_exports.object({ id: external_exports.string().min(1), clientUserMessageId: external_exports.string().min(1) })
72749
72754
  });
@@ -72791,15 +72796,30 @@ var CodexBorrowedAcpAgent = class {
72791
72796
  AbortSignal.any([signal, AbortSignal.timeout(REQUEST_TIMEOUT)])
72792
72797
  )
72793
72798
  );
72794
- await this.#refresh(signal, true);
72799
+ await this.#apply(await this.#read(signal, true), true);
72795
72800
  this.#watch = this.#follow();
72796
72801
  };
72797
72802
  #follow = async () => {
72798
72803
  const signal = this.#closed.signal;
72804
+ let unansweredReads = 0;
72799
72805
  try {
72800
72806
  for (; ; ) {
72801
72807
  await waitForNextPoll(systemTimer, signal);
72802
- await this.#refresh(signal, false);
72808
+ let pages;
72809
+ try {
72810
+ pages = await this.#read(signal, false);
72811
+ } catch (cause) {
72812
+ unansweredReads += 1;
72813
+ if (!(cause instanceof DOMException && cause.name === "TimeoutError") || unansweredReads === UNANSWERED_READ_LIMIT) {
72814
+ throw cause;
72815
+ }
72816
+ console.warn("Codex thread history read timed out; following continues", {
72817
+ threadId: this.#threadId
72818
+ });
72819
+ continue;
72820
+ }
72821
+ unansweredReads = 0;
72822
+ await this.#apply(pages, false);
72803
72823
  }
72804
72824
  } catch (cause) {
72805
72825
  if (!signal.aborted) {
@@ -72813,7 +72833,7 @@ var CodexBorrowedAcpAgent = class {
72813
72833
  }
72814
72834
  }
72815
72835
  };
72816
- #refresh = async (signal, baseline) => {
72836
+ #read = async (signal, baseline) => {
72817
72837
  let cursor = null;
72818
72838
  const pages = [];
72819
72839
  const cursors = /* @__PURE__ */ new Set();
@@ -72840,7 +72860,10 @@ var CodexBorrowedAcpAgent = class {
72840
72860
  cursors.add(cursor);
72841
72861
  }
72842
72862
  } while (cursor !== null && (baseline || this.#pending !== null));
72843
- for (const turns of pages.reverse()) {
72863
+ return pages;
72864
+ };
72865
+ #apply = async (pages, baseline) => {
72866
+ for (const turns of [...pages].reverse()) {
72844
72867
  for (const turn of [...turns].reverse()) {
72845
72868
  let matches = false;
72846
72869
  for (const raw of turn.items) {
@@ -92267,15 +92290,24 @@ var PromptLifecycle = class {
92267
92290
  };
92268
92291
  /**
92269
92292
  * Publishes again an outcome a receipt already holds, for clients that missed it. The restatement is marked, so
92270
- * Recording and status notifications do not take it for a new outcome, and it does not settle the receipt again.
92271
- * It keeps the time the outcome was recorded, which receivers that predate the marker report as when it ended.
92293
+ * status notifications do not take it for a new outcome, and it does not settle the receipt again. It keeps the
92294
+ * time the outcome was recorded, which receivers that predate the marker report as when it ended; only an outcome
92295
+ * a receipt recorded is marked as such, so Recording can settle a Turn it missed from it and never from an
92296
+ * acknowledgement composed now.
92272
92297
  */
92273
92298
  restateOutcome = (sessionId, { event, recordedAt }) => {
92274
92299
  if (event.type !== "lifecycle-metadata" || !("commandId" in event.payload)) {
92275
92300
  return;
92276
92301
  }
92277
92302
  const restated = this.#append(sessionId, event, recordedAt);
92278
- this.#publishInOrder({ ...restated, mobiusMetadata: { ...restated.mobiusMetadata, restated: true } });
92303
+ this.#publishInOrder({
92304
+ ...restated,
92305
+ mobiusMetadata: {
92306
+ ...restated.mobiusMetadata,
92307
+ ...recordedAt === void 0 ? {} : { recordedOutcome: true },
92308
+ restated: true
92309
+ }
92310
+ });
92279
92311
  };
92280
92312
  queueChanged = async (sessionId, commandId) => {
92281
92313
  await this.#recordLifecycle(sessionId, {
@@ -97690,4 +97722,4 @@ export {
97690
97722
  * MIT Licensed
97691
97723
  *)
97692
97724
  */
97693
- //# sourceMappingURL=chunk-7GKV7BBF.js.map
97725
+ //# sourceMappingURL=chunk-5IQGZH4R.js.map