@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/index.js CHANGED
@@ -33842,6 +33842,11 @@ var threadLifecycleResponseSchema = external_exports.object({
33842
33842
  serviceTier: boundedText(256).nullish(),
33843
33843
  thread: external_exports.object({ id: boundedText(256), turns: threadTurnsSchema })
33844
33844
  });
33845
+ var CODEX_HISTORY_TURN_PAGE_LIMIT = 20;
33846
+ var threadTurnsPageSchema = external_exports.object({
33847
+ data: external_exports.array(threadTurnSchema).max(CODEX_HISTORY_TURN_PAGE_LIMIT),
33848
+ nextCursor: boundedText(1024).nullish()
33849
+ });
33845
33850
  var threadResumeResponseSchema = threadLifecycleResponseSchema;
33846
33851
  var threadForkResponseSchema = threadLifecycleResponseSchema;
33847
33852
  var threadTitleSchema = external_exports.string().transform((value) => value.slice(0, 500));
@@ -34916,14 +34921,14 @@ var CodexAcpAgent = class {
34916
34921
  const resumed = threadResumeResponseSchema.parse(
34917
34922
  await this.#appServer.request(
34918
34923
  "thread/resume",
34919
- { cwd: context.params.cwd, excludeTurns: false, threadId: context.params.sessionId },
34924
+ { cwd: context.params.cwd, excludeTurns: true, threadId: context.params.sessionId },
34920
34925
  AbortSignal.any([context.signal, AbortSignal.timeout(APPROVAL_TIMEOUT_MILLISECONDS2)])
34921
34926
  )
34922
34927
  );
34923
34928
  this.#nativeSessionId = resumed.thread.id;
34924
34929
  this.#settings.selectRestoredThread(resumed);
34925
34930
  await this.#settings.probeCollaborationMode(this.#nativeSessionId, context.signal);
34926
- await this.#replayHistory(resumed.thread.turns);
34931
+ await this.#replaySavedHistory(context.signal);
34927
34932
  await this.#emitAvailableCommands();
34928
34933
  return { configOptions: this.#settings.configOptions() };
34929
34934
  }).onRequest(methods4.agent.session.fork, async (context) => {
@@ -35018,14 +35023,46 @@ var CodexAcpAgent = class {
35018
35023
  }
35019
35024
  return this.#closePromise;
35020
35025
  };
35021
- /**
35022
- * Reads the model catalog once per app-server. A failure leaves the catalog empty, which costs
35023
- * the Run settings panel its model selector; it must not cost the conversation itself, so the
35024
- * turn lifecycle continues without settings rather than failing initialization.
35025
- */
35026
- #replayHistory = async (turns) => {
35027
- for (const turn of turns ?? []) {
35026
+ // ACP load requires chronological replay. Resume only restores execution;
35027
+ // native pages supply history without a single full-transcript response.
35028
+ #replaySavedHistory = async (signal) => {
35029
+ const deadline = AbortSignal.any([signal, AbortSignal.timeout(6e4)]);
35030
+ const seenCursors = /* @__PURE__ */ new Set();
35031
+ let cursor = null;
35032
+ for (; ; ) {
35033
+ deadline.throwIfAborted();
35034
+ const page = threadTurnsPageSchema.parse(
35035
+ await this.#appServer.request(
35036
+ "thread/turns/list",
35037
+ {
35038
+ threadId: this.#nativeSessionId,
35039
+ limit: CODEX_HISTORY_TURN_PAGE_LIMIT,
35040
+ sortDirection: "asc",
35041
+ itemsView: "full",
35042
+ ...cursor === null ? {} : { cursor }
35043
+ },
35044
+ deadline
35045
+ )
35046
+ );
35047
+ await this.#replayHistory(page.data, deadline);
35048
+ if (page.nextCursor == null) {
35049
+ return;
35050
+ }
35051
+ if (page.data.length === 0 || seenCursors.has(page.nextCursor)) {
35052
+ throw new AcpExecutionError(
35053
+ "Codex repeated a history page cursor",
35054
+ {},
35055
+ "invalid_native_session_response"
35056
+ );
35057
+ }
35058
+ seenCursors.add(page.nextCursor);
35059
+ cursor = page.nextCursor;
35060
+ }
35061
+ };
35062
+ #replayHistory = async (turns, signal) => {
35063
+ for (const turn of turns) {
35028
35064
  for (const rawItem of turn.items) {
35065
+ signal.throwIfAborted();
35029
35066
  const item = decodeThreadItem(rawItem);
35030
35067
  if (item === null) {
35031
35068
  continue;