@moxt-ai/mobius 0.0.118 → 0.0.119

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
@@ -5060,7 +5060,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
5060
5060
  var NONE = 0;
5061
5061
  var ASSUMED = 1;
5062
5062
  var PROVEN = 2;
5063
- function isRecursive(inst, stack, resolve8) {
5063
+ function isRecursive(inst, stack, resolve9) {
5064
5064
  const cached2 = recursive.get(inst);
5065
5065
  if (cached2 !== void 0)
5066
5066
  return cached2 ? PROVEN : NONE;
@@ -5070,7 +5070,7 @@ function isRecursive(inst, stack, resolve8) {
5070
5070
  let result = NONE;
5071
5071
  const check2 = (child) => {
5072
5072
  if (result !== PROVEN && child?._zod) {
5073
- const answer = isRecursive(child, stack, resolve8);
5073
+ const answer = isRecursive(child, stack, resolve9);
5074
5074
  if (answer > result)
5075
5075
  result = answer;
5076
5076
  }
@@ -5081,7 +5081,7 @@ function isRecursive(inst, stack, resolve8) {
5081
5081
  const desc2 = Object.getOwnPropertyDescriptor(sh, key);
5082
5082
  if (spread && !desc2.enumerable)
5083
5083
  continue;
5084
- const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve8) : NONE;
5084
+ const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve9) : NONE;
5085
5085
  if (child > answer)
5086
5086
  answer = child;
5087
5087
  }
@@ -5145,7 +5145,7 @@ function isRecursive(inst, stack, resolve8) {
5145
5145
  break;
5146
5146
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
5147
5147
  case "lazy": {
5148
- const inner = def._cachedInner ?? (resolve8 ? inst._zod.innerType : void 0);
5148
+ const inner = def._cachedInner ?? (resolve9 ? inst._zod.innerType : void 0);
5149
5149
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
5150
5150
  break;
5151
5151
  }
@@ -29883,7 +29883,7 @@ function createWritableAcpStream(output2) {
29883
29883
  if (outputFailure !== void 0) {
29884
29884
  return Promise.reject(outputFailure);
29885
29885
  }
29886
- return new Promise((resolve8, reject) => {
29886
+ return new Promise((resolve9, reject) => {
29887
29887
  pendingWriteFailures.add(reject);
29888
29888
  output2.write(chunk, (error62) => {
29889
29889
  pendingWriteFailures.delete(reject);
@@ -29896,7 +29896,7 @@ function createWritableAcpStream(output2) {
29896
29896
  reject(outputFailure);
29897
29897
  return;
29898
29898
  }
29899
- resolve8();
29899
+ resolve9();
29900
29900
  });
29901
29901
  });
29902
29902
  }
@@ -29992,12 +29992,12 @@ var AcpProcessSession = class _AcpProcessSession {
29992
29992
  stderr.on("data", (chunk) => {
29993
29993
  process.stderr.write(`[${agent.id}-acp] ${chunk}`);
29994
29994
  });
29995
- this.#termination = new Promise((resolve8) => {
29995
+ this.#termination = new Promise((resolve9) => {
29996
29996
  child.once("error", (cause) => {
29997
- resolve8({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
29997
+ resolve9({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
29998
29998
  });
29999
29999
  child.once("exit", (code, signal) => {
30000
- resolve8({
30000
+ resolve9({
30001
30001
  kind: "failed",
30002
30002
  error: new AcpExecutionError("The ACP process stopped", { cause: { code, signal } })
30003
30003
  });
@@ -39708,7 +39708,7 @@ var FixedInstallationExecutor = class {
39708
39708
  // src/artifacts/local-file-streamer.ts
39709
39709
  import { createReadStream as createReadStream2 } from "node:fs";
39710
39710
  import { realpath as realpath8, stat as stat7 } from "node:fs/promises";
39711
- import { basename as basename5, isAbsolute as isAbsolute9, normalize as normalize3 } from "node:path";
39711
+ import { basename as basename5, isAbsolute as isAbsolute9, normalize as normalize3, resolve as resolve7 } from "node:path";
39712
39712
  import { fileURLToPath as fileURLToPath2 } from "node:url";
39713
39713
  var CHUNK_BYTES = 192 * 1024;
39714
39714
  function requestedPath(value) {
@@ -39725,9 +39725,13 @@ function requestedPath(value) {
39725
39725
  }
39726
39726
  return value;
39727
39727
  }
39728
- async function resolveFile(value, signal) {
39729
- const requested = requestedPath(value);
39730
- if (requested === null || !isAbsolute9(requested) || normalize3(requested) !== requested) {
39728
+ async function resolveFile(value, workingDirectory, signal) {
39729
+ const path2 = requestedPath(value);
39730
+ if (path2 === null || !isAbsolute9(path2) && workingDirectory === null) {
39731
+ return null;
39732
+ }
39733
+ const requested = workingDirectory === null ? path2 : resolve7(workingDirectory, path2);
39734
+ if (!isAbsolute9(requested) || isAbsolute9(path2) && normalize3(path2) !== path2) {
39731
39735
  return null;
39732
39736
  }
39733
39737
  try {
@@ -39739,8 +39743,8 @@ async function resolveFile(value, signal) {
39739
39743
  return null;
39740
39744
  }
39741
39745
  }
39742
- async function streamLocalFile(command, send2, signal) {
39743
- const target = await resolveFile(command.path, signal);
39746
+ async function streamLocalFile(command, send2, signal, workingDirectory) {
39747
+ const target = await resolveFile(command.path, workingDirectory, signal);
39744
39748
  if (target === null) {
39745
39749
  throw new Error("The local file is unavailable");
39746
39750
  }
@@ -40725,13 +40729,13 @@ function createNativeSessionRequestHandler(dependencies) {
40725
40729
  operationSignal.throwIfAborted();
40726
40730
  const skipPrevious = command.action === "active-turn";
40727
40731
  if (previous.length > 0 && !skipPrevious) {
40728
- await new Promise((resolve8, reject) => {
40732
+ await new Promise((resolve9, reject) => {
40729
40733
  const onAbort = () => reject(operationSignal.reason);
40730
40734
  operationSignal.addEventListener("abort", onAbort, { once: true });
40731
40735
  void Promise.all(previous.map((request) => request.completion)).then(
40732
40736
  () => {
40733
40737
  operationSignal.removeEventListener("abort", onAbort);
40734
- resolve8();
40738
+ resolve9();
40735
40739
  },
40736
40740
  (error62) => {
40737
40741
  operationSignal.removeEventListener("abort", onAbort);
@@ -41290,7 +41294,7 @@ var RelayConnectionError = class extends Error {
41290
41294
  };
41291
41295
  function connectRelay(url2, signal) {
41292
41296
  signal.throwIfAborted();
41293
- return new Promise((resolve8, reject) => {
41297
+ return new Promise((resolve9, reject) => {
41294
41298
  const endpoint = new URL(url2);
41295
41299
  const headers = runtimeAuthorization(endpoint);
41296
41300
  endpoint.searchParams.delete("token");
@@ -41357,7 +41361,7 @@ function connectRelay(url2, signal) {
41357
41361
  }
41358
41362
  finished = true;
41359
41363
  cleanup();
41360
- resolve8(socket);
41364
+ resolve9(socket);
41361
41365
  };
41362
41366
  function onTimeout() {
41363
41367
  fail(
@@ -41782,12 +41786,12 @@ function waitForRelayRetry(signal, timer) {
41782
41786
  if (signal.aborted) {
41783
41787
  return Promise.resolve();
41784
41788
  }
41785
- return new Promise((resolve8) => {
41789
+ return new Promise((resolve9) => {
41786
41790
  const retry = timer.schedule(finish, RELAY_RECONNECT_DELAY_MILLISECONDS);
41787
41791
  function finish() {
41788
41792
  retry.cancel();
41789
41793
  signal.removeEventListener("abort", finish);
41790
- resolve8();
41794
+ resolve9();
41791
41795
  }
41792
41796
  signal.addEventListener("abort", finish, { once: true });
41793
41797
  });
@@ -41878,7 +41882,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
41878
41882
  installationObserver.connect(socket);
41879
41883
  onConnected();
41880
41884
  try {
41881
- await new Promise((resolve8, reject) => {
41885
+ await new Promise((resolve9, reject) => {
41882
41886
  let finished = false;
41883
41887
  const cleanup = () => {
41884
41888
  connectionLiveness.close();
@@ -41896,7 +41900,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
41896
41900
  }
41897
41901
  finished = true;
41898
41902
  cleanup();
41899
- resolve8();
41903
+ resolve9();
41900
41904
  };
41901
41905
  const rejectConnection = (failure2) => {
41902
41906
  if (finished) {
@@ -41919,7 +41923,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
41919
41923
  };
41920
41924
  const waitForTurnCompletion = (turn, waitSignal) => {
41921
41925
  waitSignal.throwIfAborted();
41922
- return new Promise((resolve9, reject2) => {
41926
+ return new Promise((resolve10, reject2) => {
41923
41927
  let settled = false;
41924
41928
  const finish = (result) => {
41925
41929
  if (settled) {
@@ -41928,7 +41932,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
41928
41932
  settled = true;
41929
41933
  waitSignal.removeEventListener("abort", onAbort);
41930
41934
  if (result.kind === "completed") {
41931
- resolve9();
41935
+ resolve10();
41932
41936
  } else {
41933
41937
  reject2(result.error);
41934
41938
  }
@@ -42084,7 +42088,8 @@ async function runRelayConnection(config2, directories, audit, sessions, install
42084
42088
  void streamLocalFile(
42085
42089
  command2,
42086
42090
  (message2) => send(socket, message2),
42087
- connectionController.signal
42091
+ connectionController.signal,
42092
+ sessions.findSessions([command2.sessionId])[0]?.cwd ?? null
42088
42093
  ).catch((error62) => {
42089
42094
  if (socket.readyState !== WebSocket8.OPEN || connectionController.signal.aborted) {
42090
42095
  return;
@@ -42484,7 +42489,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
42484
42489
 
42485
42490
  // src/runtime.ts
42486
42491
  import { mkdir as mkdir6, realpath as realpath10, stat as stat9 } from "node:fs/promises";
42487
- import { resolve as resolve7 } from "node:path";
42492
+ import { resolve as resolve8 } from "node:path";
42488
42493
  var RUNTIME_CREDENTIAL_PATTERN2 = /^[a-zA-Z0-9_-]{32,256}$/;
42489
42494
  var MobiusRuntimeConfigurationError = class extends Error {
42490
42495
  code = "runtime_configuration_invalid";
@@ -42547,7 +42552,7 @@ function loadMobiusRuntimeConnection(environment = process.env) {
42547
42552
  });
42548
42553
  }
42549
42554
  async function resolveWorkspace(path2) {
42550
- const requested = resolve7(path2);
42555
+ const requested = resolve8(path2);
42551
42556
  try {
42552
42557
  await mkdir6(requested, { recursive: true, mode: 448 });
42553
42558
  const resolved = await realpath10(requested);