@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/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.308",
2089
+ version: "0.0.310",
2090
2090
  description: "Mobius CLI for pairing and running local AI agent services.",
2091
2091
  type: "module",
2092
2092
  bin: {
@@ -70244,8 +70244,8 @@ async function validatePathPermissions(path8, _directory, privateAccess, signal)
70244
70244
  MOBIUS_PERMISSION_PRIVATE: privateAccess ? "1" : "0"
70245
70245
  },
70246
70246
  windowsHide: true,
70247
- signal: AbortSignal.any([signal, AbortSignal.timeout(1e4)]),
70248
- timeout: 1e4,
70247
+ signal: AbortSignal.any([signal, AbortSignal.timeout(windowsPermissionsTimeoutMs)]),
70248
+ timeout: windowsPermissionsTimeoutMs,
70249
70249
  maxBuffer: 16384
70250
70250
  }
70251
70251
  );
@@ -70254,7 +70254,7 @@ async function validatePathPermissions(path8, _directory, privateAccess, signal)
70254
70254
  throw new LocalPathError("The local path permissions could not be secured", { cause });
70255
70255
  }
70256
70256
  }
70257
- var execute, windowsPermissions, windowsPlatform;
70257
+ var execute, windowsPermissions, windowsPermissionsTimeoutMs, windowsPlatform;
70258
70258
  var init_windows = __esm({
70259
70259
  "src/util/platform/windows.ts"() {
70260
70260
  "use strict";
@@ -70265,6 +70265,7 @@ var init_windows = __esm({
70265
70265
  execute = promisify2(execFile3);
70266
70266
  windowsPermissions = `
70267
70267
  $ErrorActionPreference = 'Stop'
70268
+ $ProgressPreference = 'SilentlyContinue'
70268
70269
  Import-Module (Join-Path $PSHOME 'Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1')
70269
70270
  $item = Get-Item -LiteralPath $env:MOBIUS_PERMISSION_PATH -Force
70270
70271
  if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Unsafe path' }
@@ -70286,6 +70287,7 @@ if ($env:MOBIUS_PERMISSION_PRIVATE -eq '1') {
70286
70287
  Set-Acl -LiteralPath $item.FullName -AclObject $private
70287
70288
  }
70288
70289
  `;
70290
+ windowsPermissionsTimeoutMs = 3e4;
70289
70291
  windowsPlatform = {
70290
70292
  controlSocketPath: (installationHash) => `\\\\.\\pipe\\mobius-${installationHash}`,
70291
70293
  prepareControlSocket: async () => {
@@ -81782,6 +81784,24 @@ var init_session_event_history_projection = __esm({
81782
81784
  #toolCallEventIds = /* @__PURE__ */ new Map();
81783
81785
  #latestEvent = null;
81784
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
+ }
81785
81805
  if (liveEvent2.type === "acp" && liveEvent2.payload.sessionUpdate === "tool_call_update") {
81786
81806
  const targetEventId = this.#toolCallEventIds.get(liveEvent2.payload.toolCallId);
81787
81807
  const current = targetEventId === void 0 ? void 0 : resolve19([targetEventId]).get(targetEventId);
@@ -81802,7 +81822,7 @@ var init_session_event_history_projection = __esm({
81802
81822
  const event = projectNewEvent(liveEvent2, liveEvent2.eventId);
81803
81823
  this.#latestEvent = event;
81804
81824
  this.#indexToolCall(event);
81805
- return { event, kind: "append" };
81825
+ return { events: [event], kind: "append" };
81806
81826
  };
81807
81827
  /**
81808
81828
  * The projected tool call announced with this identifier, in its current
@@ -81911,6 +81931,9 @@ var init_session_event_store = __esm({
81911
81931
  apply = (event, resolve19) => {
81912
81932
  const projected = this.#projection.apply(event, resolve19);
81913
81933
  this.#throughPosition = event.position;
81934
+ if (projected.kind === "skip") {
81935
+ return;
81936
+ }
81914
81937
  if (projected.kind === "replace") {
81915
81938
  const current = this.#cachedItemsByEventId.get(projected.replacedEventId);
81916
81939
  if (current === void 0) {
@@ -81919,10 +81942,12 @@ var init_session_event_store = __esm({
81919
81942
  current.replaceEvent(projected.event);
81920
81943
  return;
81921
81944
  }
81922
- const item = new ProjectedSessionEvent(projected.event);
81923
- this.#eventIndexById.set(projected.event.eventId, this.#eventIds.length);
81924
- this.#cachedItemsByEventId.set(projected.event.eventId, item);
81925
- 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
+ }
81926
81951
  };
81927
81952
  get throughPosition() {
81928
81953
  return this.#throughPosition;
@@ -82078,14 +82103,12 @@ var init_session_event_store = __esm({
82078
82103
  };
82079
82104
  };
82080
82105
  CachedSessionEventStore = class {
82081
- #terminalOutcomes;
82082
82106
  #cacheTable;
82083
82107
  #eventIds;
82084
82108
  #liveEventPositions;
82085
82109
  #sessions = /* @__PURE__ */ new Map();
82086
82110
  #flushSchedule = { kind: "idle" };
82087
- constructor(cacheTable, liveEventPositions, eventIds = new InMemorySessionEventIdAllocator(), terminalOutcomes = () => []) {
82088
- this.#terminalOutcomes = terminalOutcomes;
82111
+ constructor(cacheTable, liveEventPositions, eventIds = new InMemorySessionEventIdAllocator()) {
82089
82112
  this.#eventIds = eventIds;
82090
82113
  this.#liveEventPositions = liveEventPositions;
82091
82114
  this.#cacheTable = cacheTable;
@@ -82219,9 +82242,6 @@ var init_session_event_store = __esm({
82219
82242
  this.#deletePersisted(sessionId, previous?.sessionGenerationId);
82220
82243
  const sessionGenerationId = randomUUID8();
82221
82244
  this.#sessions.set(sessionId, new SessionEvents(sessionGenerationId));
82222
- for (const { event, recordedAt } of this.#terminalOutcomes(sessionId)) {
82223
- this.append(sessionId, event, recordedAt);
82224
- }
82225
82245
  };
82226
82246
  materializedEventCount = (sessionId) => this.#sessions.get(sessionId)?.materializedCount ?? 0;
82227
82247
  close = () => {
@@ -96299,18 +96319,6 @@ var init_execution_receipts = __esm({
96299
96319
  }
96300
96320
  return recovered;
96301
96321
  };
96302
- terminalOutcomes = (sessionId) => [...this.#executions.values()].flatMap((receipt) => {
96303
- if (receipt.sessionId !== sessionId || receipt.outcome === null) {
96304
- return [];
96305
- }
96306
- const decoded = JSON.parse(receipt.outcome);
96307
- return [
96308
- {
96309
- event: sessionEventPayloadSchema.parse(decoded),
96310
- recordedAt: external_exports.object({ recordedAt: external_exports.string() }).parse(decoded).recordedAt
96311
- }
96312
- ];
96313
- });
96314
96322
  claimExecution = (commandId, sessionId, commandJson) => {
96315
96323
  const commandHash = createHash7("sha256").update(commandJson).digest("hex");
96316
96324
  let existing = this.#executions.get(commandId);
@@ -96949,9 +96957,7 @@ function buildSessionLayer(options) {
96949
96957
  operations = new ExecutionReceipts(new ExecutionReceiptTable(sessionDatabase), options.onExecutionCountChange);
96950
96958
  events = new CachedSessionEventStore(
96951
96959
  new SessionEventCacheTable(openSessionEventCacheDatabase(databases.events)),
96952
- new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase)),
96953
- void 0,
96954
- (sessionId) => operations.terminalOutcomes(sessionId)
96960
+ new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase))
96955
96961
  );
96956
96962
  } catch (error62) {
96957
96963
  sessionDatabase.close();