@moxt-ai/mobius 0.0.118 → 0.0.120
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/artifacts/local-file-streamer.d.ts +1 -1
- package/dist/artifacts/local-file-streamer.d.ts.map +1 -1
- package/dist/artifacts/local-file-streamer.js +10 -6
- package/dist/artifacts/local-file-streamer.js.map +1 -1
- package/dist/cli.js +69 -46
- package/dist/cli.js.map +3 -3
- package/dist/index.js +54 -31
- package/dist/index.js.map +3 -3
- package/dist/relay-connection/daemon-operation-state.d.ts +3 -1
- package/dist/relay-connection/daemon-operation-state.d.ts.map +1 -1
- package/dist/relay-connection/daemon-operation-state.js +1 -1
- package/dist/relay-connection/daemon-operation-state.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +18 -4
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +58 -35
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
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,
|
|
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,
|
|
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,
|
|
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 ?? (
|
|
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((
|
|
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
|
-
|
|
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((
|
|
29995
|
+
this.#termination = new Promise((resolve9) => {
|
|
29996
29996
|
child.once("error", (cause) => {
|
|
29997
|
-
|
|
29997
|
+
resolve9({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
|
|
29998
29998
|
});
|
|
29999
29999
|
child.once("exit", (code, signal) => {
|
|
30000
|
-
|
|
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
|
|
39730
|
-
if (
|
|
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((
|
|
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
|
-
|
|
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((
|
|
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
|
-
|
|
41364
|
+
resolve9(socket);
|
|
41361
41365
|
};
|
|
41362
41366
|
function onTimeout() {
|
|
41363
41367
|
fail(
|
|
@@ -41390,7 +41394,7 @@ var DaemonOperationState = class {
|
|
|
41390
41394
|
const existing = this.#executions.get(commandId);
|
|
41391
41395
|
if (existing !== void 0) {
|
|
41392
41396
|
if (existing.sessionId !== sessionId || existing.commandHash !== commandHash) {
|
|
41393
|
-
|
|
41397
|
+
return { kind: "conflict" };
|
|
41394
41398
|
}
|
|
41395
41399
|
return { attemptId: existing.attemptId, commandId, kind: "duplicate", state: existing.state };
|
|
41396
41400
|
}
|
|
@@ -41782,12 +41786,12 @@ function waitForRelayRetry(signal, timer) {
|
|
|
41782
41786
|
if (signal.aborted) {
|
|
41783
41787
|
return Promise.resolve();
|
|
41784
41788
|
}
|
|
41785
|
-
return new Promise((
|
|
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
|
-
|
|
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((
|
|
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
|
-
|
|
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((
|
|
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
|
-
|
|
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;
|
|
@@ -42226,10 +42231,28 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
42226
42231
|
throw new Error("Unsupported protocol message");
|
|
42227
42232
|
}
|
|
42228
42233
|
const command = message;
|
|
42229
|
-
|
|
42234
|
+
const receipt = operations.claimExecution(
|
|
42235
|
+
command.commandId,
|
|
42236
|
+
command.sessionId,
|
|
42237
|
+
encodeSessionPromptCommand(command)
|
|
42238
|
+
);
|
|
42239
|
+
if (receipt.kind === "conflict") {
|
|
42240
|
+
const code = "command_identity_conflict";
|
|
42241
|
+
audit.record({
|
|
42242
|
+
commandId: command.commandId,
|
|
42243
|
+
details: { code },
|
|
42244
|
+
event: "session_prompt_rejected",
|
|
42245
|
+
sessionId: command.sessionId
|
|
42246
|
+
});
|
|
42247
|
+
send(socket, {
|
|
42248
|
+
code,
|
|
42249
|
+
requestId: command.commandId,
|
|
42250
|
+
kind: "session.operation.failed",
|
|
42251
|
+
message: "This command identifier was already used for a different request.",
|
|
42252
|
+
sessionId: command.sessionId
|
|
42253
|
+
});
|
|
42230
42254
|
return;
|
|
42231
42255
|
}
|
|
42232
|
-
const receipt = operations.claimExecution(command.commandId, command.sessionId, encoded);
|
|
42233
42256
|
if (receipt.kind === "duplicate") {
|
|
42234
42257
|
return;
|
|
42235
42258
|
}
|
|
@@ -42484,7 +42507,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42484
42507
|
|
|
42485
42508
|
// src/runtime.ts
|
|
42486
42509
|
import { mkdir as mkdir6, realpath as realpath10, stat as stat9 } from "node:fs/promises";
|
|
42487
|
-
import { resolve as
|
|
42510
|
+
import { resolve as resolve8 } from "node:path";
|
|
42488
42511
|
var RUNTIME_CREDENTIAL_PATTERN2 = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
42489
42512
|
var MobiusRuntimeConfigurationError = class extends Error {
|
|
42490
42513
|
code = "runtime_configuration_invalid";
|
|
@@ -42547,7 +42570,7 @@ function loadMobiusRuntimeConnection(environment = process.env) {
|
|
|
42547
42570
|
});
|
|
42548
42571
|
}
|
|
42549
42572
|
async function resolveWorkspace(path2) {
|
|
42550
|
-
const requested =
|
|
42573
|
+
const requested = resolve8(path2);
|
|
42551
42574
|
try {
|
|
42552
42575
|
await mkdir6(requested, { recursive: true, mode: 448 });
|
|
42553
42576
|
const resolved = await realpath10(requested);
|