@moxt-ai/mobius 0.0.188 → 0.0.189

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.
package/dist/runtime.js CHANGED
@@ -23332,6 +23332,11 @@ var threadLifecycleResponseSchema = external_exports.object({
23332
23332
  serviceTier: boundedText(256).nullish(),
23333
23333
  thread: external_exports.object({ id: boundedText(256), turns: threadTurnsSchema })
23334
23334
  });
23335
+ var CODEX_HISTORY_TURN_PAGE_LIMIT = 20;
23336
+ var threadTurnsPageSchema = external_exports.object({
23337
+ data: external_exports.array(threadTurnSchema).max(CODEX_HISTORY_TURN_PAGE_LIMIT),
23338
+ nextCursor: boundedText(1024).nullish()
23339
+ });
23335
23340
  var threadResumeResponseSchema = threadLifecycleResponseSchema;
23336
23341
  var threadForkResponseSchema = threadLifecycleResponseSchema;
23337
23342
  var threadTitleSchema = external_exports.string().transform((value) => value.slice(0, 500));
@@ -24406,14 +24411,14 @@ var CodexAcpAgent = class {
24406
24411
  const resumed = threadResumeResponseSchema.parse(
24407
24412
  await this.#appServer.request(
24408
24413
  "thread/resume",
24409
- { cwd: context.params.cwd, excludeTurns: false, threadId: context.params.sessionId },
24414
+ { cwd: context.params.cwd, excludeTurns: true, threadId: context.params.sessionId },
24410
24415
  AbortSignal.any([context.signal, AbortSignal.timeout(APPROVAL_TIMEOUT_MILLISECONDS2)])
24411
24416
  )
24412
24417
  );
24413
24418
  this.#nativeSessionId = resumed.thread.id;
24414
24419
  this.#settings.selectRestoredThread(resumed);
24415
24420
  await this.#settings.probeCollaborationMode(this.#nativeSessionId, context.signal);
24416
- await this.#replayHistory(resumed.thread.turns);
24421
+ await this.#replaySavedHistory(context.signal);
24417
24422
  await this.#emitAvailableCommands();
24418
24423
  return { configOptions: this.#settings.configOptions() };
24419
24424
  }).onRequest(methods.agent.session.fork, async (context) => {
@@ -24508,14 +24513,46 @@ var CodexAcpAgent = class {
24508
24513
  }
24509
24514
  return this.#closePromise;
24510
24515
  };
24511
- /**
24512
- * Reads the model catalog once per app-server. A failure leaves the catalog empty, which costs
24513
- * the Run settings panel its model selector; it must not cost the conversation itself, so the
24514
- * turn lifecycle continues without settings rather than failing initialization.
24515
- */
24516
- #replayHistory = async (turns) => {
24517
- for (const turn of turns ?? []) {
24516
+ // ACP load requires chronological replay. Resume only restores execution;
24517
+ // native pages supply history without a single full-transcript response.
24518
+ #replaySavedHistory = async (signal) => {
24519
+ const deadline = AbortSignal.any([signal, AbortSignal.timeout(6e4)]);
24520
+ const seenCursors = /* @__PURE__ */ new Set();
24521
+ let cursor = null;
24522
+ for (; ; ) {
24523
+ deadline.throwIfAborted();
24524
+ const page = threadTurnsPageSchema.parse(
24525
+ await this.#appServer.request(
24526
+ "thread/turns/list",
24527
+ {
24528
+ threadId: this.#nativeSessionId,
24529
+ limit: CODEX_HISTORY_TURN_PAGE_LIMIT,
24530
+ sortDirection: "asc",
24531
+ itemsView: "full",
24532
+ ...cursor === null ? {} : { cursor }
24533
+ },
24534
+ deadline
24535
+ )
24536
+ );
24537
+ await this.#replayHistory(page.data, deadline);
24538
+ if (page.nextCursor == null) {
24539
+ return;
24540
+ }
24541
+ if (page.data.length === 0 || seenCursors.has(page.nextCursor)) {
24542
+ throw new AcpExecutionError(
24543
+ "Codex repeated a history page cursor",
24544
+ {},
24545
+ "invalid_native_session_response"
24546
+ );
24547
+ }
24548
+ seenCursors.add(page.nextCursor);
24549
+ cursor = page.nextCursor;
24550
+ }
24551
+ };
24552
+ #replayHistory = async (turns, signal) => {
24553
+ for (const turn of turns) {
24518
24554
  for (const rawItem of turn.items) {
24555
+ signal.throwIfAborted();
24519
24556
  const item = decodeThreadItem(rawItem);
24520
24557
  if (item === null) {
24521
24558
  continue;