@moxt-ai/mobius 0.0.157 → 0.0.159

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
@@ -31142,6 +31142,7 @@ var AgentSession = class _AgentSession {
31142
31142
  #configRevision = 0;
31143
31143
  #configOptions = [];
31144
31144
  #lastTerminalCommandId = null;
31145
+ #nativeHistoryOwnership = { kind: "unbound" };
31145
31146
  #prompted = false;
31146
31147
  #nativePrompt = null;
31147
31148
  #sessionLoad = { kind: "not-requested" };
@@ -31262,6 +31263,9 @@ var AgentSession = class _AgentSession {
31262
31263
  return await embedLocalHistoryImages(await loaded.history.snapshot(), signal);
31263
31264
  };
31264
31265
  loadHistoryEventsV2 = async (eventLimit, cursor, signal) => {
31266
+ if (!this.#prompted && this.#nativeHistoryOwnership.kind === "fresh-session") {
31267
+ return new AcpHistoryReplay().eventPage(eventLimit, cursor);
31268
+ }
31265
31269
  if (!this.#capabilities.loadSession) {
31266
31270
  throw new AcpExecutionError(
31267
31271
  "This Agent restores context but does not provide message history.",
@@ -31551,6 +31555,7 @@ var AgentSession = class _AgentSession {
31551
31555
  )
31552
31556
  );
31553
31557
  this.selectNativeSession(created.sessionId);
31558
+ this.#nativeHistoryOwnership = { kind: "fresh-session" };
31554
31559
  lifecycleResponse = created;
31555
31560
  }
31556
31561
  this.#configOptions = this.#sessionConfigProtocol.normalizeLifecycle(lifecycleResponse);
@@ -31927,7 +31932,10 @@ var AgentSession = class _AgentSession {
31927
31932
  onElicitation = (request, signal) => this.#interactions.onElicitation(request, signal);
31928
31933
  onElicitationComplete = (notification) => this.#interactions.onElicitationComplete(notification);
31929
31934
  onUpdate = (notification) => this.#updates.receive(notification);
31930
- selectNativeSession = (sessionId) => this.#updates.select(sessionId);
31935
+ selectNativeSession = (sessionId) => {
31936
+ this.#updates.select(sessionId);
31937
+ this.#nativeHistoryOwnership = { kind: "agent-owned" };
31938
+ };
31931
31939
  #processUpdate = async (notification) => {
31932
31940
  this.assertNativeSession(notification.sessionId);
31933
31941
  const update = notification.update;
@@ -34016,16 +34024,15 @@ var threadStartResponseSchema = external_exports.object({
34016
34024
  serviceTier: boundedText(256).nullish(),
34017
34025
  thread: external_exports.object({ id: boundedText(256) })
34018
34026
  });
34027
+ var threadTurnSchema = external_exports.object({
34028
+ items: external_exports.array(external_exports.unknown()).max(1e5)
34029
+ });
34030
+ var threadTurnsSchema = external_exports.array(threadTurnSchema).max(1e5);
34019
34031
  var threadLifecycleResponseSchema = external_exports.object({
34020
34032
  model: boundedText(256).nullish(),
34021
34033
  reasoningEffort: boundedText(256).nullish(),
34022
34034
  serviceTier: boundedText(256).nullish(),
34023
- thread: external_exports.object({ id: boundedText(256) }),
34024
- turns: external_exports.array(
34025
- external_exports.object({
34026
- items: external_exports.array(external_exports.unknown()).max(1e5)
34027
- })
34028
- ).max(1e5).nullish()
34035
+ thread: external_exports.object({ id: boundedText(256), turns: threadTurnsSchema })
34029
34036
  });
34030
34037
  var threadResumeResponseSchema = threadLifecycleResponseSchema;
34031
34038
  var threadForkResponseSchema = threadLifecycleResponseSchema;
@@ -35040,7 +35047,7 @@ var CodexAcpAgent = class {
35040
35047
  this.#nativeSessionId = resumed.thread.id;
35041
35048
  this.#settings.selectRestoredThread(resumed);
35042
35049
  await this.#settings.probeCollaborationMode(this.#nativeSessionId, context.signal);
35043
- await this.#replayHistory(resumed.turns);
35050
+ await this.#replayHistory(resumed.thread.turns);
35044
35051
  await this.#emitAvailableCommands();
35045
35052
  return { configOptions: this.#settings.configOptions() };
35046
35053
  }).onRequest(methods4.agent.session.fork, async (context) => {
@@ -35058,7 +35065,7 @@ var CodexAcpAgent = class {
35058
35065
  this.#nativeSessionId = forked.thread.id;
35059
35066
  this.#settings.selectRestoredThread(forked);
35060
35067
  await this.#settings.probeCollaborationMode(this.#nativeSessionId, context.signal);
35061
- await this.#replayHistory(forked.turns);
35068
+ await this.#replayHistory(forked.thread.turns);
35062
35069
  await this.#emitAvailableCommands();
35063
35070
  return { configOptions: this.#settings.configOptions(), sessionId: forked.thread.id };
35064
35071
  }).onRequest(methods4.agent.session.resume, async (context) => {
@@ -44401,21 +44408,9 @@ var DaemonSessionEventLogV2 = class {
44401
44408
  payload: { commandId: command.commandId, content, kind: "prompt.requested" },
44402
44409
  type: "lifecycle-metadata"
44403
44410
  });
44404
- let eventTail = { event, previous: null };
44405
- for (const block of content) {
44406
- const userMessageEvent = this.#append(command.sessionId, {
44407
- payload: {
44408
- content: block,
44409
- messageId: command.commandId,
44410
- sessionUpdate: "user_message_chunk"
44411
- },
44412
- type: "acp"
44413
- });
44414
- eventTail = { event: userMessageEvent, previous: eventTail };
44415
- }
44416
44411
  this.#requests.set(command.commandId, {
44417
44412
  commandId: command.commandId,
44418
- eventTail,
44413
+ eventTail: { event, previous: null },
44419
44414
  kind: "requested",
44420
44415
  sessionId: command.sessionId
44421
44416
  });