@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/cli.js CHANGED
@@ -2086,7 +2086,7 @@ var init_package = __esm({
2086
2086
  "package.json"() {
2087
2087
  package_default = {
2088
2088
  name: "@moxt-ai/mobius",
2089
- version: "0.0.309",
2089
+ version: "0.0.311",
2090
2090
  description: "Mobius CLI for pairing and running local AI agent services.",
2091
2091
  type: "module",
2092
2092
  bin: {
@@ -81784,6 +81784,24 @@ var init_session_event_history_projection = __esm({
81784
81784
  #toolCallEventIds = /* @__PURE__ */ new Map();
81785
81785
  #latestEvent = null;
81786
81786
  apply = (liveEvent2, resolve19) => {
81787
+ if (liveEvent2.type === "lifecycle-metadata") {
81788
+ this.#latestEvent = null;
81789
+ const prompt = liveEvent2.payload;
81790
+ if (prompt.kind === "prompt.requested") {
81791
+ const events = prompt.content.map(
81792
+ (content, index2) => ({
81793
+ eventId: index2 === 0 ? liveEvent2.eventId : `${liveEvent2.eventId}-content-${index2}`,
81794
+ payload: { content, messageId: liveEvent2.eventId, sessionUpdate: "user_message_chunk" },
81795
+ recordedAt: liveEvent2.recordedAt,
81796
+ sessionGenerationId: liveEvent2.sessionGenerationId,
81797
+ sessionId: liveEvent2.sessionId,
81798
+ type: "acp"
81799
+ })
81800
+ );
81801
+ return { events, kind: "append" };
81802
+ }
81803
+ return { kind: "skip" };
81804
+ }
81787
81805
  if (liveEvent2.type === "acp" && liveEvent2.payload.sessionUpdate === "tool_call_update") {
81788
81806
  const targetEventId = this.#toolCallEventIds.get(liveEvent2.payload.toolCallId);
81789
81807
  const current = targetEventId === void 0 ? void 0 : resolve19([targetEventId]).get(targetEventId);
@@ -81804,7 +81822,7 @@ var init_session_event_history_projection = __esm({
81804
81822
  const event = projectNewEvent(liveEvent2, liveEvent2.eventId);
81805
81823
  this.#latestEvent = event;
81806
81824
  this.#indexToolCall(event);
81807
- return { event, kind: "append" };
81825
+ return { events: [event], kind: "append" };
81808
81826
  };
81809
81827
  /**
81810
81828
  * The projected tool call announced with this identifier, in its current
@@ -81913,6 +81931,9 @@ var init_session_event_store = __esm({
81913
81931
  apply = (event, resolve19) => {
81914
81932
  const projected = this.#projection.apply(event, resolve19);
81915
81933
  this.#throughPosition = event.position;
81934
+ if (projected.kind === "skip") {
81935
+ return;
81936
+ }
81916
81937
  if (projected.kind === "replace") {
81917
81938
  const current = this.#cachedItemsByEventId.get(projected.replacedEventId);
81918
81939
  if (current === void 0) {
@@ -81921,10 +81942,12 @@ var init_session_event_store = __esm({
81921
81942
  current.replaceEvent(projected.event);
81922
81943
  return;
81923
81944
  }
81924
- const item = new ProjectedSessionEvent(projected.event);
81925
- this.#eventIndexById.set(projected.event.eventId, this.#eventIds.length);
81926
- this.#cachedItemsByEventId.set(projected.event.eventId, item);
81927
- this.#eventIds.push(projected.event.eventId);
81945
+ for (const projectedEvent of projected.events) {
81946
+ const item = new ProjectedSessionEvent(projectedEvent);
81947
+ this.#eventIndexById.set(projectedEvent.eventId, this.#eventIds.length);
81948
+ this.#cachedItemsByEventId.set(projectedEvent.eventId, item);
81949
+ this.#eventIds.push(projectedEvent.eventId);
81950
+ }
81928
81951
  };
81929
81952
  get throughPosition() {
81930
81953
  return this.#throughPosition;
@@ -82080,14 +82103,12 @@ var init_session_event_store = __esm({
82080
82103
  };
82081
82104
  };
82082
82105
  CachedSessionEventStore = class {
82083
- #terminalOutcomes;
82084
82106
  #cacheTable;
82085
82107
  #eventIds;
82086
82108
  #liveEventPositions;
82087
82109
  #sessions = /* @__PURE__ */ new Map();
82088
82110
  #flushSchedule = { kind: "idle" };
82089
- constructor(cacheTable, liveEventPositions, eventIds = new InMemorySessionEventIdAllocator(), terminalOutcomes = () => []) {
82090
- this.#terminalOutcomes = terminalOutcomes;
82111
+ constructor(cacheTable, liveEventPositions, eventIds = new InMemorySessionEventIdAllocator()) {
82091
82112
  this.#eventIds = eventIds;
82092
82113
  this.#liveEventPositions = liveEventPositions;
82093
82114
  this.#cacheTable = cacheTable;
@@ -82221,9 +82242,6 @@ var init_session_event_store = __esm({
82221
82242
  this.#deletePersisted(sessionId, previous?.sessionGenerationId);
82222
82243
  const sessionGenerationId = randomUUID8();
82223
82244
  this.#sessions.set(sessionId, new SessionEvents(sessionGenerationId));
82224
- for (const { event, recordedAt } of this.#terminalOutcomes(sessionId)) {
82225
- this.append(sessionId, event, recordedAt);
82226
- }
82227
82245
  };
82228
82246
  materializedEventCount = (sessionId) => this.#sessions.get(sessionId)?.materializedCount ?? 0;
82229
82247
  close = () => {
@@ -95141,12 +95159,14 @@ var init_session_manager = __esm({
95141
95159
  const prepared = runtime.prepared();
95142
95160
  const discoveredModelEffort = runtime.agentSettingsModelEffort();
95143
95161
  const model = options2.model;
95144
- const configOptions = model === void 0 ? prepared.configOptions : await runtime.configure({
95162
+ const modelOption2 = prepared.configOptions.find(
95163
+ (option) => option.id === "model" || option.category === "model"
95164
+ );
95165
+ const modelIsFixed = modelOption2?.type === "select" && modelOption2.values.length < 2 && modelOption2.currentValue === model;
95166
+ const configOptions = model === void 0 || modelIsFixed ? prepared.configOptions : await runtime.configure({
95145
95167
  ...options2,
95146
95168
  booleanValue: false,
95147
- configId: prepared.configOptions.find(
95148
- (option) => option.id === "model" || option.category === "model"
95149
- )?.id ?? "model",
95169
+ configId: modelOption2?.id ?? "model",
95150
95170
  requestId: "agent-settings-model",
95151
95171
  sessionId: `agent-settings-${crypto.randomUUID()}`,
95152
95172
  value: model,
@@ -96301,18 +96321,6 @@ var init_execution_receipts = __esm({
96301
96321
  }
96302
96322
  return recovered;
96303
96323
  };
96304
- terminalOutcomes = (sessionId) => [...this.#executions.values()].flatMap((receipt) => {
96305
- if (receipt.sessionId !== sessionId || receipt.outcome === null) {
96306
- return [];
96307
- }
96308
- const decoded = JSON.parse(receipt.outcome);
96309
- return [
96310
- {
96311
- event: sessionEventPayloadSchema.parse(decoded),
96312
- recordedAt: external_exports.object({ recordedAt: external_exports.string() }).parse(decoded).recordedAt
96313
- }
96314
- ];
96315
- });
96316
96324
  claimExecution = (commandId, sessionId, commandJson) => {
96317
96325
  const commandHash = createHash7("sha256").update(commandJson).digest("hex");
96318
96326
  let existing = this.#executions.get(commandId);
@@ -96951,9 +96959,7 @@ function buildSessionLayer(options) {
96951
96959
  operations = new ExecutionReceipts(new ExecutionReceiptTable(sessionDatabase), options.onExecutionCountChange);
96952
96960
  events = new CachedSessionEventStore(
96953
96961
  new SessionEventCacheTable(openSessionEventCacheDatabase(databases.events)),
96954
- new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase)),
96955
- void 0,
96956
- (sessionId) => operations.terminalOutcomes(sessionId)
96962
+ new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase))
96957
96963
  );
96958
96964
  } catch (error62) {
96959
96965
  sessionDatabase.close();