@moxt-ai/mobius 0.0.309 → 0.0.311

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
@@ -22693,7 +22693,7 @@ import { fetch as fetch3 } from "undici";
22693
22693
  // package.json
22694
22694
  var package_default = {
22695
22695
  name: "@moxt-ai/mobius",
22696
- version: "0.0.309",
22696
+ version: "0.0.311",
22697
22697
  description: "Mobius CLI for pairing and running local AI agent services.",
22698
22698
  type: "module",
22699
22699
  bin: {
@@ -74662,6 +74662,24 @@ var SessionEventHistoryProjection = class {
74662
74662
  #toolCallEventIds = /* @__PURE__ */ new Map();
74663
74663
  #latestEvent = null;
74664
74664
  apply = (liveEvent2, resolve18) => {
74665
+ if (liveEvent2.type === "lifecycle-metadata") {
74666
+ this.#latestEvent = null;
74667
+ const prompt = liveEvent2.payload;
74668
+ if (prompt.kind === "prompt.requested") {
74669
+ const events = prompt.content.map(
74670
+ (content, index2) => ({
74671
+ eventId: index2 === 0 ? liveEvent2.eventId : `${liveEvent2.eventId}-content-${index2}`,
74672
+ payload: { content, messageId: liveEvent2.eventId, sessionUpdate: "user_message_chunk" },
74673
+ recordedAt: liveEvent2.recordedAt,
74674
+ sessionGenerationId: liveEvent2.sessionGenerationId,
74675
+ sessionId: liveEvent2.sessionId,
74676
+ type: "acp"
74677
+ })
74678
+ );
74679
+ return { events, kind: "append" };
74680
+ }
74681
+ return { kind: "skip" };
74682
+ }
74665
74683
  if (liveEvent2.type === "acp" && liveEvent2.payload.sessionUpdate === "tool_call_update") {
74666
74684
  const targetEventId = this.#toolCallEventIds.get(liveEvent2.payload.toolCallId);
74667
74685
  const current = targetEventId === void 0 ? void 0 : resolve18([targetEventId]).get(targetEventId);
@@ -74682,7 +74700,7 @@ var SessionEventHistoryProjection = class {
74682
74700
  const event = projectNewEvent(liveEvent2, liveEvent2.eventId);
74683
74701
  this.#latestEvent = event;
74684
74702
  this.#indexToolCall(event);
74685
- return { event, kind: "append" };
74703
+ return { events: [event], kind: "append" };
74686
74704
  };
74687
74705
  /**
74688
74706
  * The projected tool call announced with this identifier, in its current
@@ -74756,6 +74774,9 @@ var SessionEvents = class {
74756
74774
  apply = (event, resolve18) => {
74757
74775
  const projected = this.#projection.apply(event, resolve18);
74758
74776
  this.#throughPosition = event.position;
74777
+ if (projected.kind === "skip") {
74778
+ return;
74779
+ }
74759
74780
  if (projected.kind === "replace") {
74760
74781
  const current = this.#cachedItemsByEventId.get(projected.replacedEventId);
74761
74782
  if (current === void 0) {
@@ -74764,10 +74785,12 @@ var SessionEvents = class {
74764
74785
  current.replaceEvent(projected.event);
74765
74786
  return;
74766
74787
  }
74767
- const item = new ProjectedSessionEvent(projected.event);
74768
- this.#eventIndexById.set(projected.event.eventId, this.#eventIds.length);
74769
- this.#cachedItemsByEventId.set(projected.event.eventId, item);
74770
- this.#eventIds.push(projected.event.eventId);
74788
+ for (const projectedEvent of projected.events) {
74789
+ const item = new ProjectedSessionEvent(projectedEvent);
74790
+ this.#eventIndexById.set(projectedEvent.eventId, this.#eventIds.length);
74791
+ this.#cachedItemsByEventId.set(projectedEvent.eventId, item);
74792
+ this.#eventIds.push(projectedEvent.eventId);
74793
+ }
74771
74794
  };
74772
74795
  get throughPosition() {
74773
74796
  return this.#throughPosition;
@@ -74943,14 +74966,12 @@ var MemorySessionEventStore = class {
74943
74966
  };
74944
74967
  };
74945
74968
  var CachedSessionEventStore = class {
74946
- #terminalOutcomes;
74947
74969
  #cacheTable;
74948
74970
  #eventIds;
74949
74971
  #liveEventPositions;
74950
74972
  #sessions = /* @__PURE__ */ new Map();
74951
74973
  #flushSchedule = { kind: "idle" };
74952
- constructor(cacheTable, liveEventPositions, eventIds = new InMemorySessionEventIdAllocator(), terminalOutcomes = () => []) {
74953
- this.#terminalOutcomes = terminalOutcomes;
74974
+ constructor(cacheTable, liveEventPositions, eventIds = new InMemorySessionEventIdAllocator()) {
74954
74975
  this.#eventIds = eventIds;
74955
74976
  this.#liveEventPositions = liveEventPositions;
74956
74977
  this.#cacheTable = cacheTable;
@@ -75084,9 +75105,6 @@ var CachedSessionEventStore = class {
75084
75105
  this.#deletePersisted(sessionId, previous?.sessionGenerationId);
75085
75106
  const sessionGenerationId = randomUUID8();
75086
75107
  this.#sessions.set(sessionId, new SessionEvents(sessionGenerationId));
75087
- for (const { event, recordedAt } of this.#terminalOutcomes(sessionId)) {
75088
- this.append(sessionId, event, recordedAt);
75089
- }
75090
75108
  };
75091
75109
  materializedEventCount = (sessionId) => this.#sessions.get(sessionId)?.materializedCount ?? 0;
75092
75110
  close = () => {
@@ -85367,12 +85385,14 @@ var SessionManager2 = class {
85367
85385
  const prepared = runtime.prepared();
85368
85386
  const discoveredModelEffort = runtime.agentSettingsModelEffort();
85369
85387
  const model = options2.model;
85370
- const configOptions = model === void 0 ? prepared.configOptions : await runtime.configure({
85388
+ const modelOption2 = prepared.configOptions.find(
85389
+ (option) => option.id === "model" || option.category === "model"
85390
+ );
85391
+ const modelIsFixed = modelOption2?.type === "select" && modelOption2.values.length < 2 && modelOption2.currentValue === model;
85392
+ const configOptions = model === void 0 || modelIsFixed ? prepared.configOptions : await runtime.configure({
85371
85393
  ...options2,
85372
85394
  booleanValue: false,
85373
- configId: prepared.configOptions.find(
85374
- (option) => option.id === "model" || option.category === "model"
85375
- )?.id ?? "model",
85395
+ configId: modelOption2?.id ?? "model",
85376
85396
  requestId: "agent-settings-model",
85377
85397
  sessionId: `agent-settings-${crypto.randomUUID()}`,
85378
85398
  value: model,
@@ -86497,18 +86517,6 @@ var ExecutionReceipts = class {
86497
86517
  }
86498
86518
  return recovered;
86499
86519
  };
86500
- terminalOutcomes = (sessionId) => [...this.#executions.values()].flatMap((receipt) => {
86501
- if (receipt.sessionId !== sessionId || receipt.outcome === null) {
86502
- return [];
86503
- }
86504
- const decoded = JSON.parse(receipt.outcome);
86505
- return [
86506
- {
86507
- event: sessionEventPayloadSchema.parse(decoded),
86508
- recordedAt: external_exports.object({ recordedAt: external_exports.string() }).parse(decoded).recordedAt
86509
- }
86510
- ];
86511
- });
86512
86520
  claimExecution = (commandId, sessionId, commandJson) => {
86513
86521
  const commandHash = createHash6("sha256").update(commandJson).digest("hex");
86514
86522
  let existing = this.#executions.get(commandId);
@@ -87124,9 +87132,7 @@ function buildSessionLayer(options) {
87124
87132
  operations = new ExecutionReceipts(new ExecutionReceiptTable(sessionDatabase), options.onExecutionCountChange);
87125
87133
  events = new CachedSessionEventStore(
87126
87134
  new SessionEventCacheTable(openSessionEventCacheDatabase(databases.events)),
87127
- new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase)),
87128
- void 0,
87129
- (sessionId) => operations.terminalOutcomes(sessionId)
87135
+ new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase))
87130
87136
  );
87131
87137
  } catch (error62) {
87132
87138
  sessionDatabase.close();