@moxt-ai/mobius 0.0.308 → 0.0.310

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
@@ -499,6 +499,7 @@ function terminateProcess2(child, signal) {
499
499
  }
500
500
  var windowsPermissions = `
501
501
  $ErrorActionPreference = 'Stop'
502
+ $ProgressPreference = 'SilentlyContinue'
502
503
  Import-Module (Join-Path $PSHOME 'Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1')
503
504
  $item = Get-Item -LiteralPath $env:MOBIUS_PERMISSION_PATH -Force
504
505
  if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Unsafe path' }
@@ -520,6 +521,7 @@ if ($env:MOBIUS_PERMISSION_PRIVATE -eq '1') {
520
521
  Set-Acl -LiteralPath $item.FullName -AclObject $private
521
522
  }
522
523
  `;
524
+ var windowsPermissionsTimeoutMs = 3e4;
523
525
  async function validatePathPermissions(path7, _directory, privateAccess, signal) {
524
526
  signal.throwIfAborted();
525
527
  const systemRoot = environmentValue(process.env, "SystemRoot");
@@ -543,8 +545,8 @@ async function validatePathPermissions(path7, _directory, privateAccess, signal)
543
545
  MOBIUS_PERMISSION_PRIVATE: privateAccess ? "1" : "0"
544
546
  },
545
547
  windowsHide: true,
546
- signal: AbortSignal.any([signal, AbortSignal.timeout(1e4)]),
547
- timeout: 1e4,
548
+ signal: AbortSignal.any([signal, AbortSignal.timeout(windowsPermissionsTimeoutMs)]),
549
+ timeout: windowsPermissionsTimeoutMs,
548
550
  maxBuffer: 16384
549
551
  }
550
552
  );
@@ -22691,7 +22693,7 @@ import { fetch as fetch3 } from "undici";
22691
22693
  // package.json
22692
22694
  var package_default = {
22693
22695
  name: "@moxt-ai/mobius",
22694
- version: "0.0.308",
22696
+ version: "0.0.310",
22695
22697
  description: "Mobius CLI for pairing and running local AI agent services.",
22696
22698
  type: "module",
22697
22699
  bin: {
@@ -74660,6 +74662,24 @@ var SessionEventHistoryProjection = class {
74660
74662
  #toolCallEventIds = /* @__PURE__ */ new Map();
74661
74663
  #latestEvent = null;
74662
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
+ }
74663
74683
  if (liveEvent2.type === "acp" && liveEvent2.payload.sessionUpdate === "tool_call_update") {
74664
74684
  const targetEventId = this.#toolCallEventIds.get(liveEvent2.payload.toolCallId);
74665
74685
  const current = targetEventId === void 0 ? void 0 : resolve18([targetEventId]).get(targetEventId);
@@ -74680,7 +74700,7 @@ var SessionEventHistoryProjection = class {
74680
74700
  const event = projectNewEvent(liveEvent2, liveEvent2.eventId);
74681
74701
  this.#latestEvent = event;
74682
74702
  this.#indexToolCall(event);
74683
- return { event, kind: "append" };
74703
+ return { events: [event], kind: "append" };
74684
74704
  };
74685
74705
  /**
74686
74706
  * The projected tool call announced with this identifier, in its current
@@ -74754,6 +74774,9 @@ var SessionEvents = class {
74754
74774
  apply = (event, resolve18) => {
74755
74775
  const projected = this.#projection.apply(event, resolve18);
74756
74776
  this.#throughPosition = event.position;
74777
+ if (projected.kind === "skip") {
74778
+ return;
74779
+ }
74757
74780
  if (projected.kind === "replace") {
74758
74781
  const current = this.#cachedItemsByEventId.get(projected.replacedEventId);
74759
74782
  if (current === void 0) {
@@ -74762,10 +74785,12 @@ var SessionEvents = class {
74762
74785
  current.replaceEvent(projected.event);
74763
74786
  return;
74764
74787
  }
74765
- const item = new ProjectedSessionEvent(projected.event);
74766
- this.#eventIndexById.set(projected.event.eventId, this.#eventIds.length);
74767
- this.#cachedItemsByEventId.set(projected.event.eventId, item);
74768
- 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
+ }
74769
74794
  };
74770
74795
  get throughPosition() {
74771
74796
  return this.#throughPosition;
@@ -74941,14 +74966,12 @@ var MemorySessionEventStore = class {
74941
74966
  };
74942
74967
  };
74943
74968
  var CachedSessionEventStore = class {
74944
- #terminalOutcomes;
74945
74969
  #cacheTable;
74946
74970
  #eventIds;
74947
74971
  #liveEventPositions;
74948
74972
  #sessions = /* @__PURE__ */ new Map();
74949
74973
  #flushSchedule = { kind: "idle" };
74950
- constructor(cacheTable, liveEventPositions, eventIds = new InMemorySessionEventIdAllocator(), terminalOutcomes = () => []) {
74951
- this.#terminalOutcomes = terminalOutcomes;
74974
+ constructor(cacheTable, liveEventPositions, eventIds = new InMemorySessionEventIdAllocator()) {
74952
74975
  this.#eventIds = eventIds;
74953
74976
  this.#liveEventPositions = liveEventPositions;
74954
74977
  this.#cacheTable = cacheTable;
@@ -75082,9 +75105,6 @@ var CachedSessionEventStore = class {
75082
75105
  this.#deletePersisted(sessionId, previous?.sessionGenerationId);
75083
75106
  const sessionGenerationId = randomUUID8();
75084
75107
  this.#sessions.set(sessionId, new SessionEvents(sessionGenerationId));
75085
- for (const { event, recordedAt } of this.#terminalOutcomes(sessionId)) {
75086
- this.append(sessionId, event, recordedAt);
75087
- }
75088
75108
  };
75089
75109
  materializedEventCount = (sessionId) => this.#sessions.get(sessionId)?.materializedCount ?? 0;
75090
75110
  close = () => {
@@ -86495,18 +86515,6 @@ var ExecutionReceipts = class {
86495
86515
  }
86496
86516
  return recovered;
86497
86517
  };
86498
- terminalOutcomes = (sessionId) => [...this.#executions.values()].flatMap((receipt) => {
86499
- if (receipt.sessionId !== sessionId || receipt.outcome === null) {
86500
- return [];
86501
- }
86502
- const decoded = JSON.parse(receipt.outcome);
86503
- return [
86504
- {
86505
- event: sessionEventPayloadSchema.parse(decoded),
86506
- recordedAt: external_exports.object({ recordedAt: external_exports.string() }).parse(decoded).recordedAt
86507
- }
86508
- ];
86509
- });
86510
86518
  claimExecution = (commandId, sessionId, commandJson) => {
86511
86519
  const commandHash = createHash6("sha256").update(commandJson).digest("hex");
86512
86520
  let existing = this.#executions.get(commandId);
@@ -87122,9 +87130,7 @@ function buildSessionLayer(options) {
87122
87130
  operations = new ExecutionReceipts(new ExecutionReceiptTable(sessionDatabase), options.onExecutionCountChange);
87123
87131
  events = new CachedSessionEventStore(
87124
87132
  new SessionEventCacheTable(openSessionEventCacheDatabase(databases.events)),
87125
- new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase)),
87126
- void 0,
87127
- (sessionId) => operations.terminalOutcomes(sessionId)
87133
+ new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase))
87128
87134
  );
87129
87135
  } catch (error62) {
87130
87136
  sessionDatabase.close();