@moxt-ai/mobius 0.0.312 → 0.0.313
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/acp/adapter/claude/adapter.d.ts +2 -0
- package/dist/acp/adapter/claude/adapter.d.ts.map +1 -1
- package/dist/acp/adapter/claude/adapter.js +2 -0
- package/dist/acp/adapter/claude/adapter.js.map +1 -1
- package/dist/acp/adapter/codex/adapter.d.ts +2 -0
- package/dist/acp/adapter/codex/adapter.d.ts.map +1 -1
- package/dist/acp/adapter/codex/adapter.js +2 -0
- package/dist/acp/adapter/codex/adapter.js.map +1 -1
- package/dist/acp/adapter/live-sessions.d.ts +2 -0
- package/dist/acp/adapter/live-sessions.d.ts.map +1 -1
- package/dist/acp/adapter/live-sessions.js +40 -2
- package/dist/acp/adapter/live-sessions.js.map +1 -1
- package/dist/acp/adapter/pi/adapter.d.ts +2 -0
- package/dist/acp/adapter/pi/adapter.d.ts.map +1 -1
- package/dist/acp/adapter/pi/adapter.js +2 -0
- package/dist/acp/adapter/pi/adapter.js.map +1 -1
- package/dist/acp/native-history/preview-contract.d.ts +2 -0
- package/dist/acp/native-history/preview-contract.d.ts.map +1 -1
- package/dist/cli/handler/agents/index.d.ts.map +1 -1
- package/dist/cli/handler/agents/index.js +8 -1
- package/dist/cli/handler/agents/index.js.map +1 -1
- package/dist/cli/handler/agents/logic/agent-diagnostics.d.ts +2 -0
- package/dist/cli/handler/agents/logic/agent-diagnostics.d.ts.map +1 -1
- package/dist/cli/handler/agents/logic/agent-diagnostics.js +16 -0
- package/dist/cli/handler/agents/logic/agent-diagnostics.js.map +1 -1
- package/dist/cli.js +225 -157
- package/dist/cli.js.map +4 -4
- package/dist/runtime/command/registry/interactions.js +2 -2
- package/dist/runtime/command/registry/interactions.js.map +1 -1
- package/dist/runtime.js +67 -25
- package/dist/runtime.js.map +3 -3
- package/dist/session/live/agent-session.d.ts +1 -1
- package/dist/session/live/agent-session.d.ts.map +1 -1
- package/dist/session/live/agent-session.js +14 -15
- package/dist/session/live/agent-session.js.map +1 -1
- package/dist/session/manager/session-manager.d.ts +1 -1
- package/dist/session/manager/session-manager.d.ts.map +1 -1
- package/dist/session/manager/session-manager.js +3 -3
- package/dist/session/manager/session-manager.js.map +1 -1
- package/package.json +1 -1
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.
|
|
2089
|
+
version: "0.0.313",
|
|
2090
2090
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
2091
2091
|
type: "module",
|
|
2092
2092
|
bin: {
|
|
@@ -41949,14 +41949,14 @@ function unreachable(value, logger = console) {
|
|
|
41949
41949
|
async function withDeadline(signal, timeoutMilliseconds, operation) {
|
|
41950
41950
|
const deadline = AbortSignal.any([signal, AbortSignal.timeout(timeoutMilliseconds)]);
|
|
41951
41951
|
deadline.throwIfAborted();
|
|
41952
|
-
return await new Promise((
|
|
41952
|
+
return await new Promise((resolve21, reject2) => {
|
|
41953
41953
|
const settle2 = (callback) => {
|
|
41954
41954
|
deadline.removeEventListener("abort", onAbort);
|
|
41955
41955
|
callback();
|
|
41956
41956
|
};
|
|
41957
41957
|
const onAbort = () => settle2(() => reject2(deadline.reason));
|
|
41958
41958
|
deadline.addEventListener("abort", onAbort, { once: true });
|
|
41959
|
-
operation().then((value) => settle2(() =>
|
|
41959
|
+
operation().then((value) => settle2(() => resolve21(value)), (error62) => settle2(() => reject2(error62)));
|
|
41960
41960
|
});
|
|
41961
41961
|
}
|
|
41962
41962
|
function withEnvironment(environment, operation) {
|
|
@@ -41983,11 +41983,11 @@ var init_utils = __esm({
|
|
|
41983
41983
|
done = false;
|
|
41984
41984
|
push(item) {
|
|
41985
41985
|
if (this.resolvers.length > 0) {
|
|
41986
|
-
const
|
|
41987
|
-
if (
|
|
41986
|
+
const resolve21 = this.resolvers.shift();
|
|
41987
|
+
if (resolve21 === void 0) {
|
|
41988
41988
|
return;
|
|
41989
41989
|
}
|
|
41990
|
-
|
|
41990
|
+
resolve21({ value: item, done: false });
|
|
41991
41991
|
} else {
|
|
41992
41992
|
this.queue.push(item);
|
|
41993
41993
|
}
|
|
@@ -41995,8 +41995,8 @@ var init_utils = __esm({
|
|
|
41995
41995
|
end() {
|
|
41996
41996
|
this.done = true;
|
|
41997
41997
|
while (this.resolvers.length > 0) {
|
|
41998
|
-
const
|
|
41999
|
-
|
|
41998
|
+
const resolve21 = this.resolvers.shift();
|
|
41999
|
+
resolve21?.({ done: true, value: void 0 });
|
|
42000
42000
|
}
|
|
42001
42001
|
}
|
|
42002
42002
|
[Symbol.asyncIterator]() {
|
|
@@ -42012,8 +42012,8 @@ var init_utils = __esm({
|
|
|
42012
42012
|
if (this.done) {
|
|
42013
42013
|
return Promise.resolve({ done: true, value: void 0 });
|
|
42014
42014
|
}
|
|
42015
|
-
return new Promise((
|
|
42016
|
-
this.resolvers.push(
|
|
42015
|
+
return new Promise((resolve21) => {
|
|
42016
|
+
this.resolvers.push(resolve21);
|
|
42017
42017
|
});
|
|
42018
42018
|
}
|
|
42019
42019
|
};
|
|
@@ -47489,7 +47489,7 @@ function isRef(value) {
|
|
|
47489
47489
|
function cloneIssues(issues) {
|
|
47490
47490
|
return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
|
|
47491
47491
|
}
|
|
47492
|
-
function isRecursive(inst, stack,
|
|
47492
|
+
function isRecursive(inst, stack, resolve21) {
|
|
47493
47493
|
const cached2 = recursive.get(inst);
|
|
47494
47494
|
if (cached2 !== void 0)
|
|
47495
47495
|
return cached2 ? PROVEN : NONE;
|
|
@@ -47499,7 +47499,7 @@ function isRecursive(inst, stack, resolve20) {
|
|
|
47499
47499
|
let result = NONE;
|
|
47500
47500
|
const check2 = (child) => {
|
|
47501
47501
|
if (result !== PROVEN && child?._zod) {
|
|
47502
|
-
const answer = isRecursive(child, stack,
|
|
47502
|
+
const answer = isRecursive(child, stack, resolve21);
|
|
47503
47503
|
if (answer > result)
|
|
47504
47504
|
result = answer;
|
|
47505
47505
|
}
|
|
@@ -47510,7 +47510,7 @@ function isRecursive(inst, stack, resolve20) {
|
|
|
47510
47510
|
const desc2 = Object.getOwnPropertyDescriptor(sh, key);
|
|
47511
47511
|
if (spread && !desc2.enumerable)
|
|
47512
47512
|
continue;
|
|
47513
|
-
const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack,
|
|
47513
|
+
const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve21) : NONE;
|
|
47514
47514
|
if (child > answer)
|
|
47515
47515
|
answer = child;
|
|
47516
47516
|
}
|
|
@@ -47574,7 +47574,7 @@ function isRecursive(inst, stack, resolve20) {
|
|
|
47574
47574
|
break;
|
|
47575
47575
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
47576
47576
|
case "lazy": {
|
|
47577
|
-
const inner = def._cachedInner ?? (
|
|
47577
|
+
const inner = def._cachedInner ?? (resolve21 ? inst._zod.innerType : void 0);
|
|
47578
47578
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
47579
47579
|
break;
|
|
47580
47580
|
}
|
|
@@ -65177,14 +65177,14 @@ function waitUnlessAborted(milliseconds, signal) {
|
|
|
65177
65177
|
if (signal.aborted) {
|
|
65178
65178
|
return Promise.resolve(false);
|
|
65179
65179
|
}
|
|
65180
|
-
return new Promise((
|
|
65180
|
+
return new Promise((resolve21) => {
|
|
65181
65181
|
const timer = setTimeout(() => {
|
|
65182
65182
|
signal.removeEventListener("abort", onAbort);
|
|
65183
|
-
|
|
65183
|
+
resolve21(true);
|
|
65184
65184
|
}, milliseconds);
|
|
65185
65185
|
const onAbort = () => {
|
|
65186
65186
|
clearTimeout(timer);
|
|
65187
|
-
|
|
65187
|
+
resolve21(false);
|
|
65188
65188
|
};
|
|
65189
65189
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
65190
65190
|
});
|
|
@@ -65368,7 +65368,7 @@ function stripLocalCommandMetadata(content) {
|
|
|
65368
65368
|
return kept;
|
|
65369
65369
|
}
|
|
65370
65370
|
function raceWithAbort(operation, signal) {
|
|
65371
|
-
return new Promise((
|
|
65371
|
+
return new Promise((resolve21, reject2) => {
|
|
65372
65372
|
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
65373
65373
|
const onAbort = () => {
|
|
65374
65374
|
cleanup();
|
|
@@ -65380,7 +65380,7 @@ function raceWithAbort(operation, signal) {
|
|
|
65380
65380
|
}
|
|
65381
65381
|
void operation.then((value) => {
|
|
65382
65382
|
cleanup();
|
|
65383
|
-
|
|
65383
|
+
resolve21(value);
|
|
65384
65384
|
}, (error62) => {
|
|
65385
65385
|
cleanup();
|
|
65386
65386
|
reject2(error62);
|
|
@@ -67309,12 +67309,12 @@ var init_acp_agent = __esm({
|
|
|
67309
67309
|
}
|
|
67310
67310
|
};
|
|
67311
67311
|
let completeTurn;
|
|
67312
|
-
turn.completion = new Promise((
|
|
67313
|
-
completeTurn =
|
|
67312
|
+
turn.completion = new Promise((resolve21) => {
|
|
67313
|
+
completeTurn = resolve21;
|
|
67314
67314
|
});
|
|
67315
|
-
const response = new Promise((
|
|
67315
|
+
const response = new Promise((resolve21, reject2) => {
|
|
67316
67316
|
turn.resolve = (result) => {
|
|
67317
|
-
|
|
67317
|
+
resolve21(result);
|
|
67318
67318
|
completeTurn();
|
|
67319
67319
|
};
|
|
67320
67320
|
turn.reject = (error62) => {
|
|
@@ -67718,8 +67718,8 @@ var init_acp_agent = __esm({
|
|
|
67718
67718
|
pendingNext ??= session.query.next().then((result) => ({ kind: "message", result }));
|
|
67719
67719
|
const nextMessage = pendingNext;
|
|
67720
67720
|
let onAbort;
|
|
67721
|
-
const abortRace = new Promise((
|
|
67722
|
-
onAbort = () =>
|
|
67721
|
+
const abortRace = new Promise((resolve21) => {
|
|
67722
|
+
onAbort = () => resolve21("abort");
|
|
67723
67723
|
cancelController.signal.addEventListener("abort", onAbort, { once: true });
|
|
67724
67724
|
});
|
|
67725
67725
|
const raced = await Promise.race([nextMessage, abortRace]);
|
|
@@ -76684,10 +76684,10 @@ var init_process = __esm({
|
|
|
76684
76684
|
shell: shouldUseShellForPiCommand(cmd)
|
|
76685
76685
|
});
|
|
76686
76686
|
try {
|
|
76687
|
-
await new Promise((
|
|
76687
|
+
await new Promise((resolve21, reject2) => {
|
|
76688
76688
|
const onSpawn = () => {
|
|
76689
76689
|
cleanup();
|
|
76690
|
-
|
|
76690
|
+
resolve21();
|
|
76691
76691
|
};
|
|
76692
76692
|
const onError = (err) => {
|
|
76693
76693
|
cleanup();
|
|
@@ -76889,7 +76889,7 @@ var init_process = __esm({
|
|
|
76889
76889
|
const timeoutMs = opts?.timeoutMs;
|
|
76890
76890
|
const line = `${JSON.stringify(withId)}
|
|
76891
76891
|
`;
|
|
76892
|
-
return new Promise((
|
|
76892
|
+
return new Promise((resolve21, reject2) => {
|
|
76893
76893
|
const signal = opts?.signal;
|
|
76894
76894
|
if (signal?.aborted === true) {
|
|
76895
76895
|
reject2(signal.reason);
|
|
@@ -76911,7 +76911,7 @@ var init_process = __esm({
|
|
|
76911
76911
|
this.pending.set(id, {
|
|
76912
76912
|
resolve: (res) => {
|
|
76913
76913
|
drop();
|
|
76914
|
-
|
|
76914
|
+
resolve21(res);
|
|
76915
76915
|
},
|
|
76916
76916
|
reject: (error62) => {
|
|
76917
76917
|
drop();
|
|
@@ -76944,14 +76944,14 @@ var init_process = __esm({
|
|
|
76944
76944
|
});
|
|
76945
76945
|
}
|
|
76946
76946
|
writeLine(line) {
|
|
76947
|
-
return new Promise((
|
|
76947
|
+
return new Promise((resolve21, reject2) => {
|
|
76948
76948
|
try {
|
|
76949
76949
|
this.child.stdin.write(line, (error62) => {
|
|
76950
76950
|
if (error62) {
|
|
76951
76951
|
reject2(error62);
|
|
76952
76952
|
return;
|
|
76953
76953
|
}
|
|
76954
|
-
|
|
76954
|
+
resolve21();
|
|
76955
76955
|
});
|
|
76956
76956
|
} catch (error62) {
|
|
76957
76957
|
reject2(error62);
|
|
@@ -78316,8 +78316,8 @@ var init_session = __esm({
|
|
|
78316
78316
|
}
|
|
78317
78317
|
async prompt(message, images = []) {
|
|
78318
78318
|
const expandedMessage = expandSlashCommand(message, this.fileCommands);
|
|
78319
|
-
const turnPromise = new Promise((
|
|
78320
|
-
const queued = { message: expandedMessage, images, resolve:
|
|
78319
|
+
const turnPromise = new Promise((resolve21, reject2) => {
|
|
78320
|
+
const queued = { message: expandedMessage, images, resolve: resolve21, reject: reject2 };
|
|
78321
78321
|
if (this.pendingTurn) {
|
|
78322
78322
|
this.turnQueue.push(queued);
|
|
78323
78323
|
this.emit({
|
|
@@ -81617,8 +81617,8 @@ var init_adapter_registry = __esm({
|
|
|
81617
81617
|
#resolve;
|
|
81618
81618
|
#dependencies;
|
|
81619
81619
|
#adapters = /* @__PURE__ */ new Map();
|
|
81620
|
-
constructor(
|
|
81621
|
-
this.#resolve =
|
|
81620
|
+
constructor(resolve21, dependencies) {
|
|
81621
|
+
this.#resolve = resolve21;
|
|
81622
81622
|
this.#dependencies = dependencies;
|
|
81623
81623
|
}
|
|
81624
81624
|
resolve = (agent) => {
|
|
@@ -82028,7 +82028,7 @@ function createWritableAcpStream(output2) {
|
|
|
82028
82028
|
if (outputFailure !== void 0) {
|
|
82029
82029
|
return Promise.reject(outputFailure);
|
|
82030
82030
|
}
|
|
82031
|
-
return new Promise((
|
|
82031
|
+
return new Promise((resolve21, reject2) => {
|
|
82032
82032
|
pendingWriteFailures.add(reject2);
|
|
82033
82033
|
output2.write(chunk, (error62) => {
|
|
82034
82034
|
pendingWriteFailures.delete(reject2);
|
|
@@ -82041,7 +82041,7 @@ function createWritableAcpStream(output2) {
|
|
|
82041
82041
|
reject2(outputFailure);
|
|
82042
82042
|
return;
|
|
82043
82043
|
}
|
|
82044
|
-
|
|
82044
|
+
resolve21();
|
|
82045
82045
|
});
|
|
82046
82046
|
});
|
|
82047
82047
|
}
|
|
@@ -82095,12 +82095,12 @@ var init_agent_connection = __esm({
|
|
|
82095
82095
|
stderr.on("data", (chunk) => {
|
|
82096
82096
|
process.stderr.write(`[${agent.id}-acp] ${chunk}`);
|
|
82097
82097
|
});
|
|
82098
|
-
this.termination = new Promise((
|
|
82098
|
+
this.termination = new Promise((resolve21) => {
|
|
82099
82099
|
child.once("error", (cause) => {
|
|
82100
|
-
|
|
82100
|
+
resolve21({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
|
|
82101
82101
|
});
|
|
82102
82102
|
child.once("exit", (code, signal) => {
|
|
82103
|
-
|
|
82103
|
+
resolve21({
|
|
82104
82104
|
kind: "failed",
|
|
82105
82105
|
error: new AcpExecutionError("The ACP process stopped", { cause: { code, signal } })
|
|
82106
82106
|
});
|
|
@@ -82543,7 +82543,7 @@ var init_live_sessions = __esm({
|
|
|
82543
82543
|
this.#sessions.add(session);
|
|
82544
82544
|
return connection;
|
|
82545
82545
|
};
|
|
82546
|
-
#
|
|
82546
|
+
#find = (target) => {
|
|
82547
82547
|
const decoded = targetSchema.safeParse(target);
|
|
82548
82548
|
if (!decoded.success) {
|
|
82549
82549
|
throw new AcpExecutionError(
|
|
@@ -82561,12 +82561,52 @@ var init_live_sessions = __esm({
|
|
|
82561
82561
|
if (matches.length > 1) {
|
|
82562
82562
|
throw new AcpExecutionError("Another writer is using this native session", {}, "session_busy");
|
|
82563
82563
|
}
|
|
82564
|
-
|
|
82564
|
+
return matches[0];
|
|
82565
|
+
};
|
|
82566
|
+
#resolve = (target) => {
|
|
82567
|
+
const session = this.#find(target);
|
|
82565
82568
|
if (session === void 0) {
|
|
82566
82569
|
throw new AcpExecutionError("The native session is not active", {}, "invalid_agent_session");
|
|
82567
82570
|
}
|
|
82568
82571
|
return session;
|
|
82569
82572
|
};
|
|
82573
|
+
cancel = async (target, signal) => {
|
|
82574
|
+
const bounded = AbortSignal.any([signal, AbortSignal.timeout(3e4)]);
|
|
82575
|
+
bounded.throwIfAborted();
|
|
82576
|
+
const { connection } = this.#resolve(target);
|
|
82577
|
+
await connection.race(
|
|
82578
|
+
connection.connection.agent.notify(methods10.agent.session.cancel, {
|
|
82579
|
+
sessionId: connection.events.sessionId()
|
|
82580
|
+
}),
|
|
82581
|
+
"ACP agent exited while cancelling a prompt",
|
|
82582
|
+
bounded
|
|
82583
|
+
);
|
|
82584
|
+
};
|
|
82585
|
+
closeSession = async (target, signal) => {
|
|
82586
|
+
const session = this.#find(target);
|
|
82587
|
+
if (session === void 0) {
|
|
82588
|
+
signal.throwIfAborted();
|
|
82589
|
+
return;
|
|
82590
|
+
}
|
|
82591
|
+
const { connection, scope } = session;
|
|
82592
|
+
try {
|
|
82593
|
+
signal.throwIfAborted();
|
|
82594
|
+
if (scope.capabilities().closeSession) {
|
|
82595
|
+
try {
|
|
82596
|
+
await connection.connection.agent.request(
|
|
82597
|
+
methods10.agent.session.close,
|
|
82598
|
+
{ sessionId: connection.events.sessionId() },
|
|
82599
|
+
{ cancellationSignal: AbortSignal.any([signal, AbortSignal.timeout(1e3)]) }
|
|
82600
|
+
);
|
|
82601
|
+
} catch {
|
|
82602
|
+
signal.throwIfAborted();
|
|
82603
|
+
}
|
|
82604
|
+
}
|
|
82605
|
+
} finally {
|
|
82606
|
+
await connection.closeProcess();
|
|
82607
|
+
}
|
|
82608
|
+
signal.throwIfAborted();
|
|
82609
|
+
};
|
|
82570
82610
|
prompt = async (target, content, signal) => {
|
|
82571
82611
|
signal.throwIfAborted();
|
|
82572
82612
|
const { connection, scope } = this.#resolve(target);
|
|
@@ -82879,7 +82919,7 @@ var init_session_event_history_projection = __esm({
|
|
|
82879
82919
|
SessionEventHistoryProjection = class {
|
|
82880
82920
|
#toolCallEventIds = /* @__PURE__ */ new Map();
|
|
82881
82921
|
#latestEvent = null;
|
|
82882
|
-
apply = (liveEvent2,
|
|
82922
|
+
apply = (liveEvent2, resolve21) => {
|
|
82883
82923
|
if (liveEvent2.type === "lifecycle-metadata") {
|
|
82884
82924
|
this.#latestEvent = null;
|
|
82885
82925
|
const prompt = liveEvent2.payload;
|
|
@@ -82900,7 +82940,7 @@ var init_session_event_history_projection = __esm({
|
|
|
82900
82940
|
}
|
|
82901
82941
|
if (liveEvent2.type === "acp" && liveEvent2.payload.sessionUpdate === "tool_call_update") {
|
|
82902
82942
|
const targetEventId = this.#toolCallEventIds.get(liveEvent2.payload.toolCallId);
|
|
82903
|
-
const current = targetEventId === void 0 ? void 0 :
|
|
82943
|
+
const current = targetEventId === void 0 ? void 0 : resolve21([targetEventId]).get(targetEventId);
|
|
82904
82944
|
if (current?.type === "acp" && (current.payload.sessionUpdate === "tool_call" || current.payload.sessionUpdate === "tool_call_update")) {
|
|
82905
82945
|
return this.#replace(
|
|
82906
82946
|
current,
|
|
@@ -82924,12 +82964,12 @@ var init_session_event_history_projection = __esm({
|
|
|
82924
82964
|
* The projected tool call announced with this identifier, in its current
|
|
82925
82965
|
* merged form, or `undefined` when the projection has not recorded one.
|
|
82926
82966
|
*/
|
|
82927
|
-
getToolCall = (toolCallId,
|
|
82967
|
+
getToolCall = (toolCallId, resolve21) => {
|
|
82928
82968
|
const eventId = this.#toolCallEventIds.get(toolCallId);
|
|
82929
82969
|
if (eventId === void 0) {
|
|
82930
82970
|
return void 0;
|
|
82931
82971
|
}
|
|
82932
|
-
const event =
|
|
82972
|
+
const event = resolve21([eventId]).get(eventId);
|
|
82933
82973
|
if (event?.type === "acp" && (event.payload.sessionUpdate === "tool_call" || event.payload.sessionUpdate === "tool_call_update")) {
|
|
82934
82974
|
return event.payload;
|
|
82935
82975
|
}
|
|
@@ -83024,8 +83064,8 @@ var init_session_event_store = __esm({
|
|
|
83024
83064
|
this.sessionGenerationId = sessionGenerationId;
|
|
83025
83065
|
this.#projection = new SessionEventHistoryProjection();
|
|
83026
83066
|
}
|
|
83027
|
-
apply = (event,
|
|
83028
|
-
const projected = this.#projection.apply(event,
|
|
83067
|
+
apply = (event, resolve21) => {
|
|
83068
|
+
const projected = this.#projection.apply(event, resolve21);
|
|
83029
83069
|
this.#throughPosition = event.position;
|
|
83030
83070
|
if (projected.kind === "skip") {
|
|
83031
83071
|
return;
|
|
@@ -83052,7 +83092,7 @@ var init_session_event_store = __esm({
|
|
|
83052
83092
|
return this.#cachedItemsByEventId.size;
|
|
83053
83093
|
}
|
|
83054
83094
|
/** The projected tool call for this identifier, materializing it if needed. */
|
|
83055
|
-
toolCall = (toolCallId,
|
|
83095
|
+
toolCall = (toolCallId, resolve21) => this.#projection.getToolCall(toolCallId, resolve21);
|
|
83056
83096
|
endIndex = (cursor) => {
|
|
83057
83097
|
if (cursor === null) {
|
|
83058
83098
|
return this.#eventIds.length;
|
|
@@ -83880,6 +83920,8 @@ var init_adapter = __esm({
|
|
|
83880
83920
|
}
|
|
83881
83921
|
getCapabilities = async (query) => await this.#queryProcesses.capabilities(query);
|
|
83882
83922
|
connectSession = (options) => this.#liveSessions.connectSession(options);
|
|
83923
|
+
cancel = (...args) => this.#liveSessions.cancel(...args);
|
|
83924
|
+
closeSession = (...args) => this.#liveSessions.closeSession(...args);
|
|
83883
83925
|
prompt = (...args) => this.#liveSessions.prompt(...args);
|
|
83884
83926
|
steer = (...args) => this.#liveSessions.steer(...args);
|
|
83885
83927
|
renameSession = (...args) => this.#liveSessions.renameSession(...args);
|
|
@@ -89821,6 +89863,8 @@ var init_adapter2 = __esm({
|
|
|
89821
89863
|
}
|
|
89822
89864
|
getCapabilities = async (query) => await this.#queryProcesses.capabilities(query);
|
|
89823
89865
|
connectSession = (options) => this.#liveSessions.connectSession(options);
|
|
89866
|
+
cancel = (...args) => this.#liveSessions.cancel(...args);
|
|
89867
|
+
closeSession = (...args) => this.#liveSessions.closeSession(...args);
|
|
89824
89868
|
prompt = (...args) => this.#liveSessions.prompt(...args);
|
|
89825
89869
|
steer = (...args) => this.#liveSessions.steer(...args);
|
|
89826
89870
|
renameSession = (...args) => this.#liveSessions.renameSession(...args);
|
|
@@ -89928,6 +89972,8 @@ var init_adapter3 = __esm({
|
|
|
89928
89972
|
}
|
|
89929
89973
|
getCapabilities = async (query) => await this.#queryProcesses.capabilities(query);
|
|
89930
89974
|
connectSession = (options) => this.#liveSessions.connectSession(options);
|
|
89975
|
+
cancel = (...args) => this.#liveSessions.cancel(...args);
|
|
89976
|
+
closeSession = (...args) => this.#liveSessions.closeSession(...args);
|
|
89931
89977
|
prompt = (...args) => this.#liveSessions.prompt(...args);
|
|
89932
89978
|
steer = (...args) => this.#liveSessions.steer(...args);
|
|
89933
89979
|
renameSession = (...args) => this.#liveSessions.renameSession(...args);
|
|
@@ -91349,7 +91395,7 @@ function controlSocketPath(stateDirectory, endpoint = "manager") {
|
|
|
91349
91395
|
}
|
|
91350
91396
|
async function readSocketMessage(socket, signal) {
|
|
91351
91397
|
signal.throwIfAborted();
|
|
91352
|
-
return await new Promise((
|
|
91398
|
+
return await new Promise((resolve21, reject2) => {
|
|
91353
91399
|
let encoded = "";
|
|
91354
91400
|
const finish = (error62, value) => {
|
|
91355
91401
|
signal.removeEventListener("abort", abort);
|
|
@@ -91357,7 +91403,7 @@ async function readSocketMessage(socket, signal) {
|
|
|
91357
91403
|
socket.removeAllListeners("error");
|
|
91358
91404
|
socket.removeAllListeners("end");
|
|
91359
91405
|
if (error62 === void 0) {
|
|
91360
|
-
|
|
91406
|
+
resolve21(value);
|
|
91361
91407
|
} else {
|
|
91362
91408
|
reject2(error62);
|
|
91363
91409
|
}
|
|
@@ -91393,14 +91439,14 @@ async function sendLocalRequest(stateDirectory, endpoint, command, signal) {
|
|
|
91393
91439
|
deadline.throwIfAborted();
|
|
91394
91440
|
const socket = createConnection(controlSocketPath(stateDirectory, endpoint));
|
|
91395
91441
|
try {
|
|
91396
|
-
await new Promise((
|
|
91442
|
+
await new Promise((resolve21, reject2) => {
|
|
91397
91443
|
const abort = () => {
|
|
91398
91444
|
socket.destroy();
|
|
91399
91445
|
reject2(deadline.reason);
|
|
91400
91446
|
};
|
|
91401
91447
|
socket.once("connect", () => {
|
|
91402
91448
|
deadline.removeEventListener("abort", abort);
|
|
91403
|
-
|
|
91449
|
+
resolve21();
|
|
91404
91450
|
});
|
|
91405
91451
|
socket.once("error", reject2);
|
|
91406
91452
|
deadline.addEventListener("abort", abort, { once: true });
|
|
@@ -91846,6 +91892,56 @@ var init_pair_local_machine = __esm({
|
|
|
91846
91892
|
}
|
|
91847
91893
|
});
|
|
91848
91894
|
|
|
91895
|
+
// src/cli/util/options.ts
|
|
91896
|
+
function readOnce(optionName) {
|
|
91897
|
+
return (value, previous) => {
|
|
91898
|
+
if (previous !== void 0) {
|
|
91899
|
+
throw new InvalidArgumentError(`${optionName} may only be specified once`);
|
|
91900
|
+
}
|
|
91901
|
+
return value;
|
|
91902
|
+
};
|
|
91903
|
+
}
|
|
91904
|
+
function valueOption(flags, description, mandatory = false) {
|
|
91905
|
+
const option = new Option(flags, description).argParser(readOnce(flags.split(" ")[0] ?? flags));
|
|
91906
|
+
return mandatory ? option.makeOptionMandatory() : option;
|
|
91907
|
+
}
|
|
91908
|
+
var init_options2 = __esm({
|
|
91909
|
+
"src/cli/util/options.ts"() {
|
|
91910
|
+
"use strict";
|
|
91911
|
+
init_commander();
|
|
91912
|
+
}
|
|
91913
|
+
});
|
|
91914
|
+
|
|
91915
|
+
// src/storage/files/output-file.ts
|
|
91916
|
+
import { constants as constants5 } from "node:fs";
|
|
91917
|
+
import { open as open6 } from "node:fs/promises";
|
|
91918
|
+
async function writeExistingFile(path8, content, signal) {
|
|
91919
|
+
let file2;
|
|
91920
|
+
try {
|
|
91921
|
+
file2 = await open6(path8, constants5.O_WRONLY | constants5.O_NOFOLLOW);
|
|
91922
|
+
} catch (cause) {
|
|
91923
|
+
return isNodeError(cause, "ENOENT") ? { kind: "missing", cause } : { kind: "unwritable", cause };
|
|
91924
|
+
}
|
|
91925
|
+
try {
|
|
91926
|
+
const metadata = await file2.stat();
|
|
91927
|
+
if (!metadata.isFile()) {
|
|
91928
|
+
return { kind: "not-a-file" };
|
|
91929
|
+
}
|
|
91930
|
+
signal.throwIfAborted();
|
|
91931
|
+
await file2.truncate(0);
|
|
91932
|
+
await file2.writeFile(content, "utf8");
|
|
91933
|
+
return { kind: "written" };
|
|
91934
|
+
} finally {
|
|
91935
|
+
await file2.close();
|
|
91936
|
+
}
|
|
91937
|
+
}
|
|
91938
|
+
var init_output_file = __esm({
|
|
91939
|
+
"src/storage/files/output-file.ts"() {
|
|
91940
|
+
"use strict";
|
|
91941
|
+
init_node_error();
|
|
91942
|
+
}
|
|
91943
|
+
});
|
|
91944
|
+
|
|
91849
91945
|
// src/cli/handler/agents/logic/agent-diagnostics.ts
|
|
91850
91946
|
function withDetectionTime(diagnostic, detectionMilliseconds, verbose) {
|
|
91851
91947
|
return verbose ? { ...diagnostic, detectionMilliseconds } : diagnostic;
|
|
@@ -91891,11 +91987,26 @@ function formatAgentDiagnostics(inventory, json2, verbose = false) {
|
|
|
91891
91987
|
return `${lines.join("\n")}
|
|
91892
91988
|
`;
|
|
91893
91989
|
}
|
|
91990
|
+
async function writeAgentDiagnostics(path8, inventory, verbose, signal) {
|
|
91991
|
+
signal.throwIfAborted();
|
|
91992
|
+
const write = await writeExistingFile(path8, formatAgentDiagnostics(inventory, true, verbose), signal);
|
|
91993
|
+
switch (write.kind) {
|
|
91994
|
+
case "written":
|
|
91995
|
+
return;
|
|
91996
|
+
case "missing":
|
|
91997
|
+
throw new Error("The JSON output file does not exist", { cause: write.cause });
|
|
91998
|
+
case "unwritable":
|
|
91999
|
+
throw new Error("The JSON output file cannot be written", { cause: write.cause });
|
|
92000
|
+
case "not-a-file":
|
|
92001
|
+
throw new Error("The JSON output path is not a regular file");
|
|
92002
|
+
}
|
|
92003
|
+
}
|
|
91894
92004
|
var AvailableAgentDiagnostic, UnavailableAgentDiagnostic, UnsupportedAgentVersionDiagnostic, AgentDiagnostics;
|
|
91895
92005
|
var init_agent_diagnostics = __esm({
|
|
91896
92006
|
"src/cli/handler/agents/logic/agent-diagnostics.ts"() {
|
|
91897
92007
|
"use strict";
|
|
91898
92008
|
init_agent_discovery();
|
|
92009
|
+
init_output_file();
|
|
91899
92010
|
AvailableAgentDiagnostic = class {
|
|
91900
92011
|
adapterVersion;
|
|
91901
92012
|
agentVersion;
|
|
@@ -91954,8 +92065,9 @@ var init_agent_diagnostics = __esm({
|
|
|
91954
92065
|
});
|
|
91955
92066
|
|
|
91956
92067
|
// src/cli/handler/agents/index.ts
|
|
92068
|
+
import { resolve as resolve17 } from "node:path";
|
|
91957
92069
|
function registerAgentsHandler(program2, context) {
|
|
91958
|
-
program2.command("agents").description("show detected, missing, and integration-ready Agents").option("--json", "write the Agent inventory as JSON").option("--verbose", "include per-Agent detection timing").action(async (options) => {
|
|
92070
|
+
program2.command("agents").description("show detected, missing, and integration-ready Agents").option("--json", "write the Agent inventory as JSON").addOption(valueOption("--output-json <existing-file.json>", "write the JSON inventory to an existing file")).option("--verbose", "include per-Agent detection timing").action(async (options) => {
|
|
91959
92071
|
const installation = await openMobiusCliInstallation(context.shutdownSignal, process.env);
|
|
91960
92072
|
const localContext = new RuntimeLocalContext(installation.stateDirectory, process.env);
|
|
91961
92073
|
const defaultWorkspace = loadDefaultWorkspace(localContext.environment);
|
|
@@ -91965,6 +92077,15 @@ function registerAgentsHandler(program2, context) {
|
|
|
91965
92077
|
environment: localContext.environment,
|
|
91966
92078
|
signal: context.shutdownSignal
|
|
91967
92079
|
});
|
|
92080
|
+
if (options.outputJson !== void 0) {
|
|
92081
|
+
await writeAgentDiagnostics(
|
|
92082
|
+
resolve17(options.outputJson),
|
|
92083
|
+
inventory,
|
|
92084
|
+
options.verbose === true,
|
|
92085
|
+
context.shutdownSignal
|
|
92086
|
+
);
|
|
92087
|
+
return;
|
|
92088
|
+
}
|
|
91968
92089
|
process.stdout.write(formatAgentDiagnostics(inventory, options.json === true, options.verbose === true));
|
|
91969
92090
|
});
|
|
91970
92091
|
}
|
|
@@ -91975,6 +92096,7 @@ var init_agents = __esm({
|
|
|
91975
92096
|
init_pair_local_machine();
|
|
91976
92097
|
init_config();
|
|
91977
92098
|
init_local_files();
|
|
92099
|
+
init_options2();
|
|
91978
92100
|
init_agent_diagnostics();
|
|
91979
92101
|
}
|
|
91980
92102
|
});
|
|
@@ -92070,21 +92192,21 @@ async function serveLocalControl(stateDirectory, endpoint, signal, handle, onLis
|
|
|
92070
92192
|
});
|
|
92071
92193
|
try {
|
|
92072
92194
|
await platform2.prepareControlSocket(path8);
|
|
92073
|
-
await new Promise((
|
|
92074
|
-
server.once("listening",
|
|
92195
|
+
await new Promise((resolve21, reject2) => {
|
|
92196
|
+
server.once("listening", resolve21);
|
|
92075
92197
|
server.once("error", reject2);
|
|
92076
92198
|
server.listen(path8);
|
|
92077
92199
|
});
|
|
92078
92200
|
await platform2.secureControlSocket(path8);
|
|
92079
92201
|
await onListening();
|
|
92080
92202
|
if (!signal.aborted) {
|
|
92081
|
-
await new Promise((
|
|
92203
|
+
await new Promise((resolve21) => signal.addEventListener("abort", () => resolve21(), { once: true }));
|
|
92082
92204
|
}
|
|
92083
92205
|
} finally {
|
|
92084
92206
|
for (const socket of sockets) {
|
|
92085
92207
|
socket.destroy();
|
|
92086
92208
|
}
|
|
92087
|
-
await new Promise((
|
|
92209
|
+
await new Promise((resolve21) => server.close(() => resolve21()));
|
|
92088
92210
|
await Promise.allSettled(requests);
|
|
92089
92211
|
await platform2.removeControlSocket(path8).catch(() => void 0);
|
|
92090
92212
|
}
|
|
@@ -93015,13 +93137,13 @@ async function waitForManagerExit(stateDirectory, signal) {
|
|
|
93015
93137
|
if (!await managerLockExists(stateDirectory)) {
|
|
93016
93138
|
return;
|
|
93017
93139
|
}
|
|
93018
|
-
await new Promise((
|
|
93140
|
+
await new Promise((resolve21, reject2) => {
|
|
93019
93141
|
const timeout = setTimeout(finish, 20);
|
|
93020
93142
|
const abort = () => finish(deadline.reason);
|
|
93021
93143
|
function finish(cause) {
|
|
93022
93144
|
clearTimeout(timeout);
|
|
93023
93145
|
deadline.removeEventListener("abort", abort);
|
|
93024
|
-
cause === void 0 ?
|
|
93146
|
+
cause === void 0 ? resolve21() : reject2(cause);
|
|
93025
93147
|
}
|
|
93026
93148
|
deadline.addEventListener("abort", abort, { once: true });
|
|
93027
93149
|
});
|
|
@@ -93082,13 +93204,13 @@ async function ensureManager(stateDirectory, launch, signal) {
|
|
|
93082
93204
|
await launchManager(launch);
|
|
93083
93205
|
managerStarted = true;
|
|
93084
93206
|
}
|
|
93085
|
-
await new Promise((
|
|
93207
|
+
await new Promise((resolve21, reject2) => {
|
|
93086
93208
|
const timeout = setTimeout(finish, 50);
|
|
93087
93209
|
const abort = () => finish(signal.reason);
|
|
93088
93210
|
function finish(cause2) {
|
|
93089
93211
|
clearTimeout(timeout);
|
|
93090
93212
|
signal.removeEventListener("abort", abort);
|
|
93091
|
-
cause2 === void 0 ?
|
|
93213
|
+
cause2 === void 0 ? resolve21() : reject2(cause2);
|
|
93092
93214
|
}
|
|
93093
93215
|
signal.addEventListener("abort", abort, { once: true });
|
|
93094
93216
|
});
|
|
@@ -94514,7 +94636,7 @@ var init_session_restore = __esm({
|
|
|
94514
94636
|
|
|
94515
94637
|
// src/session/live/agent-session.ts
|
|
94516
94638
|
import { methods as methods14 } from "@agentclientprotocol/sdk";
|
|
94517
|
-
var
|
|
94639
|
+
var AgentSession;
|
|
94518
94640
|
var init_agent_session = __esm({
|
|
94519
94641
|
"src/session/live/agent-session.ts"() {
|
|
94520
94642
|
"use strict";
|
|
@@ -94534,7 +94656,6 @@ var init_agent_session = __esm({
|
|
|
94534
94656
|
init_session_configurations();
|
|
94535
94657
|
init_session_restore();
|
|
94536
94658
|
init_acp_error();
|
|
94537
|
-
PROCESS_STOP_TIMEOUT_MILLISECONDS = 1e3;
|
|
94538
94659
|
AgentSession = class _AgentSession {
|
|
94539
94660
|
// The restore surface: AgentSessionRestore members expose private state to
|
|
94540
94661
|
// session-restore.ts only. The class keeps the fields private.
|
|
@@ -95041,12 +95162,12 @@ var init_agent_session = __esm({
|
|
|
95041
95162
|
throw failure2;
|
|
95042
95163
|
}
|
|
95043
95164
|
};
|
|
95044
|
-
cancel = async () => {
|
|
95165
|
+
cancel = async (signal) => {
|
|
95166
|
+
signal.throwIfAborted();
|
|
95045
95167
|
await this.#interactions.cancelPendingInteractions();
|
|
95168
|
+
signal.throwIfAborted();
|
|
95046
95169
|
if (this.#turn.running) {
|
|
95047
|
-
await this.#
|
|
95048
|
-
sessionId: this.#updates.sessionId()
|
|
95049
|
-
});
|
|
95170
|
+
await this.#adapter.cancel(this.#target(), signal);
|
|
95050
95171
|
}
|
|
95051
95172
|
};
|
|
95052
95173
|
respondPermission = async (options) => {
|
|
@@ -95133,21 +95254,18 @@ var init_agent_session = __esm({
|
|
|
95133
95254
|
close = async () => {
|
|
95134
95255
|
try {
|
|
95135
95256
|
await this.#interactions.cancelPendingInteractions();
|
|
95136
|
-
|
|
95137
|
-
|
|
95138
|
-
|
|
95139
|
-
|
|
95140
|
-
|
|
95141
|
-
{
|
|
95142
|
-
cancellationSignal: AbortSignal.timeout(PROCESS_STOP_TIMEOUT_MILLISECONDS)
|
|
95143
|
-
}
|
|
95144
|
-
);
|
|
95145
|
-
} catch {
|
|
95146
|
-
}
|
|
95257
|
+
} catch (error62) {
|
|
95258
|
+
try {
|
|
95259
|
+
throw error62;
|
|
95260
|
+
} finally {
|
|
95261
|
+
await this.closeProcess();
|
|
95147
95262
|
}
|
|
95148
|
-
}
|
|
95263
|
+
}
|
|
95264
|
+
if (this.#updates.sessionId().length === 0) {
|
|
95149
95265
|
await this.closeProcess();
|
|
95266
|
+
return;
|
|
95150
95267
|
}
|
|
95268
|
+
await this.#adapter.closeSession(this.#target(), AbortSignal.timeout(3e4));
|
|
95151
95269
|
};
|
|
95152
95270
|
closeProcess = () => this.#connection.closeProcess();
|
|
95153
95271
|
agentSettingsModelEffort = () => this.#connection.agentSettingsModelEffort();
|
|
@@ -95733,14 +95851,14 @@ var init_session_manager = __esm({
|
|
|
95733
95851
|
return { title: normalized, updatedAt };
|
|
95734
95852
|
})
|
|
95735
95853
|
);
|
|
95736
|
-
cancelPrompt = async (sessionId) => {
|
|
95854
|
+
cancelPrompt = async (sessionId, signal = AbortSignal.timeout(3e4)) => this.#operations.run({ signal }, async ({ signal: signal2 }) => {
|
|
95737
95855
|
await this.#executions.cancel(sessionId, async () => {
|
|
95738
95856
|
const runtime = this.#executionProcesses.get(sessionId);
|
|
95739
95857
|
if (runtime !== void 0) {
|
|
95740
|
-
await runtime.cancel();
|
|
95858
|
+
await runtime.cancel(signal2);
|
|
95741
95859
|
}
|
|
95742
95860
|
});
|
|
95743
|
-
};
|
|
95861
|
+
});
|
|
95744
95862
|
steerPrompt = async (options) => this.#operations.run(options, async (options2) => {
|
|
95745
95863
|
if (this.#executions.command(options2.sessionId) !== options2.targetCommandId) {
|
|
95746
95864
|
throw new AcpExecutionError("The target turn is no longer active", {}, "steering_target_unavailable");
|
|
@@ -96890,7 +97008,7 @@ var init_runtime_turn_activity = __esm({
|
|
|
96890
97008
|
if (this.#admission.kind !== "open") {
|
|
96891
97009
|
throw new Error("A daemon upgrade already owns admission");
|
|
96892
97010
|
}
|
|
96893
|
-
return new Promise((
|
|
97011
|
+
return new Promise((resolve21, reject2) => {
|
|
96894
97012
|
const abort = () => {
|
|
96895
97013
|
this.#admission = { kind: "open" };
|
|
96896
97014
|
signal.removeEventListener("abort", abort);
|
|
@@ -96899,7 +97017,7 @@ var init_runtime_turn_activity = __esm({
|
|
|
96899
97017
|
const reserve = () => {
|
|
96900
97018
|
this.#admission = { kind: "reserved" };
|
|
96901
97019
|
signal.removeEventListener("abort", abort);
|
|
96902
|
-
|
|
97020
|
+
resolve21({
|
|
96903
97021
|
[Symbol.dispose]: () => {
|
|
96904
97022
|
this.#admission = { kind: "open" };
|
|
96905
97023
|
}
|
|
@@ -97031,7 +97149,7 @@ var init_session_execution = __esm({
|
|
|
97031
97149
|
init_active_turn();
|
|
97032
97150
|
waitForTurnCompletion = (turn, waitSignal) => {
|
|
97033
97151
|
waitSignal.throwIfAborted();
|
|
97034
|
-
return new Promise((
|
|
97152
|
+
return new Promise((resolve21, reject2) => {
|
|
97035
97153
|
let settled = false;
|
|
97036
97154
|
const finish = (result) => {
|
|
97037
97155
|
if (settled) {
|
|
@@ -97040,7 +97158,7 @@ var init_session_execution = __esm({
|
|
|
97040
97158
|
settled = true;
|
|
97041
97159
|
waitSignal.removeEventListener("abort", onAbort);
|
|
97042
97160
|
if (result.kind === "completed") {
|
|
97043
|
-
|
|
97161
|
+
resolve21();
|
|
97044
97162
|
} else {
|
|
97045
97163
|
reject2(result.error);
|
|
97046
97164
|
}
|
|
@@ -99014,7 +99132,7 @@ var init_agent_settings = __esm({
|
|
|
99014
99132
|
});
|
|
99015
99133
|
|
|
99016
99134
|
// src/session/content/session-files.ts
|
|
99017
|
-
import { basename as basename8, extname as extname2, isAbsolute as isAbsolute18, join as join36, normalize as normalize3, resolve as
|
|
99135
|
+
import { basename as basename8, extname as extname2, isAbsolute as isAbsolute18, join as join36, normalize as normalize3, resolve as resolve18 } from "node:path";
|
|
99018
99136
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
99019
99137
|
function requestedPath(value) {
|
|
99020
99138
|
if (value.includes("\0")) {
|
|
@@ -99038,7 +99156,7 @@ async function resolveFile(value, workingDirectory, signal) {
|
|
|
99038
99156
|
if (isAbsolute18(requested.path) && normalize3(requested.path) !== requested.path) {
|
|
99039
99157
|
return null;
|
|
99040
99158
|
}
|
|
99041
|
-
const candidates = requested.explicitUrl || workingDirectory === null ? [requested.path] : isAbsolute18(requested.path) ? [join36(workingDirectory, requested.path), requested.path] : [
|
|
99159
|
+
const candidates = requested.explicitUrl || workingDirectory === null ? [requested.path] : isAbsolute18(requested.path) ? [join36(workingDirectory, requested.path), requested.path] : [resolve18(workingDirectory, requested.path)];
|
|
99042
99160
|
for (const candidate of candidates) {
|
|
99043
99161
|
if (!isAbsolute18(candidate) || normalize3(candidate) !== candidate) {
|
|
99044
99162
|
continue;
|
|
@@ -99399,7 +99517,7 @@ var init_interactions2 = __esm({
|
|
|
99399
99517
|
init_transport();
|
|
99400
99518
|
sessionCancelCommand = {
|
|
99401
99519
|
kind: SESSION_CANCEL_KIND,
|
|
99402
|
-
handle: ({ eventProjection, operations, sessions, sessionTurns }, message) => {
|
|
99520
|
+
handle: ({ eventProjection, operations, sessions, sessionTurns, signal }, message) => {
|
|
99403
99521
|
if (message.kind !== SESSION_CANCEL_KIND) {
|
|
99404
99522
|
throw new Error("Command kind mismatch");
|
|
99405
99523
|
}
|
|
@@ -99414,7 +99532,7 @@ var init_interactions2 = __esm({
|
|
|
99414
99532
|
if (cancellationState === "already-requested" || cancellationState === "pending") {
|
|
99415
99533
|
return;
|
|
99416
99534
|
}
|
|
99417
|
-
void sessions.cancelPrompt(message.sessionId).catch((error62) => {
|
|
99535
|
+
void sessions.cancelPrompt(message.sessionId, signal).catch((error62) => {
|
|
99418
99536
|
console.error("Mobius daemon could not cancel the agent turn", error62);
|
|
99419
99537
|
});
|
|
99420
99538
|
}
|
|
@@ -99510,13 +99628,13 @@ function createNativeSessionRequestHandler(dependencies) {
|
|
|
99510
99628
|
operationSignal.throwIfAborted();
|
|
99511
99629
|
const skipPrevious = command.action === "active-turn";
|
|
99512
99630
|
if (previous.length > 0 && !skipPrevious) {
|
|
99513
|
-
await new Promise((
|
|
99631
|
+
await new Promise((resolve21, reject2) => {
|
|
99514
99632
|
const onAbort = () => reject2(operationSignal.reason);
|
|
99515
99633
|
operationSignal.addEventListener("abort", onAbort, { once: true });
|
|
99516
99634
|
void Promise.all(previous.map((request) => request.completion)).then(
|
|
99517
99635
|
() => {
|
|
99518
99636
|
operationSignal.removeEventListener("abort", onAbort);
|
|
99519
|
-
|
|
99637
|
+
resolve21();
|
|
99520
99638
|
},
|
|
99521
99639
|
(error62) => {
|
|
99522
99640
|
operationSignal.removeEventListener("abort", onAbort);
|
|
@@ -100802,7 +100920,7 @@ var init_runtime_revocation = __esm({
|
|
|
100802
100920
|
import { WebSocket as WebSocket7 } from "undici";
|
|
100803
100921
|
function connectRelay(url2, signal) {
|
|
100804
100922
|
signal.throwIfAborted();
|
|
100805
|
-
return new Promise((
|
|
100923
|
+
return new Promise((resolve21, reject2) => {
|
|
100806
100924
|
let dispatchController;
|
|
100807
100925
|
const dispatcher = environmentProxyDispatcher.compose((dispatch) => (options, handler) => {
|
|
100808
100926
|
const trackedHandler = Object.create(handler);
|
|
@@ -100887,7 +101005,7 @@ function connectRelay(url2, signal) {
|
|
|
100887
101005
|
}
|
|
100888
101006
|
finished = true;
|
|
100889
101007
|
cleanup();
|
|
100890
|
-
|
|
101008
|
+
resolve21({ release, socket });
|
|
100891
101009
|
};
|
|
100892
101010
|
function onTimeout() {
|
|
100893
101011
|
fail(
|
|
@@ -101120,7 +101238,7 @@ async function runRelayConnection({
|
|
|
101120
101238
|
}
|
|
101121
101239
|
});
|
|
101122
101240
|
try {
|
|
101123
|
-
await new Promise((
|
|
101241
|
+
await new Promise((resolve21, reject2) => {
|
|
101124
101242
|
let finished = false;
|
|
101125
101243
|
let ready = false;
|
|
101126
101244
|
const cleanup = () => {
|
|
@@ -101138,7 +101256,7 @@ async function runRelayConnection({
|
|
|
101138
101256
|
}
|
|
101139
101257
|
finished = true;
|
|
101140
101258
|
cleanup();
|
|
101141
|
-
|
|
101259
|
+
resolve21();
|
|
101142
101260
|
};
|
|
101143
101261
|
const rejectConnection = (failure2) => {
|
|
101144
101262
|
if (finished) {
|
|
@@ -101472,12 +101590,12 @@ function waitForRelayRetry(signal, timer) {
|
|
|
101472
101590
|
if (signal.aborted) {
|
|
101473
101591
|
return Promise.resolve();
|
|
101474
101592
|
}
|
|
101475
|
-
return new Promise((
|
|
101593
|
+
return new Promise((resolve21) => {
|
|
101476
101594
|
const retry = timer.schedule(finish, RELAY_RECONNECT_DELAY_MILLISECONDS);
|
|
101477
101595
|
function finish() {
|
|
101478
101596
|
retry.cancel();
|
|
101479
101597
|
signal.removeEventListener("abort", finish);
|
|
101480
|
-
|
|
101598
|
+
resolve21();
|
|
101481
101599
|
}
|
|
101482
101600
|
signal.addEventListener("abort", finish, { once: true });
|
|
101483
101601
|
});
|
|
@@ -101887,11 +102005,11 @@ async function checkDaemonReleaseUpgrade(signal, activity) {
|
|
|
101887
102005
|
const _reservation = __using(_stack, await activity.reserveWhenIdle(signal));
|
|
101888
102006
|
signal.throwIfAborted();
|
|
101889
102007
|
await requestInstalledDaemonReleaseSwitch(control.stateDirectory, launch, signal);
|
|
101890
|
-
await new Promise((
|
|
102008
|
+
await new Promise((resolve21) => {
|
|
101891
102009
|
if (signal.aborted) {
|
|
101892
|
-
|
|
102010
|
+
resolve21();
|
|
101893
102011
|
} else {
|
|
101894
|
-
signal.addEventListener("abort", () =>
|
|
102012
|
+
signal.addEventListener("abort", () => resolve21(), { once: true });
|
|
101895
102013
|
}
|
|
101896
102014
|
});
|
|
101897
102015
|
} catch (_) {
|
|
@@ -102077,26 +102195,6 @@ var init_worker = __esm({
|
|
|
102077
102195
|
}
|
|
102078
102196
|
});
|
|
102079
102197
|
|
|
102080
|
-
// src/cli/util/options.ts
|
|
102081
|
-
function readOnce(optionName) {
|
|
102082
|
-
return (value, previous) => {
|
|
102083
|
-
if (previous !== void 0) {
|
|
102084
|
-
throw new InvalidArgumentError(`${optionName} may only be specified once`);
|
|
102085
|
-
}
|
|
102086
|
-
return value;
|
|
102087
|
-
};
|
|
102088
|
-
}
|
|
102089
|
-
function valueOption(flags, description, mandatory = false) {
|
|
102090
|
-
const option = new Option(flags, description).argParser(readOnce(flags.split(" ")[0] ?? flags));
|
|
102091
|
-
return mandatory ? option.makeOptionMandatory() : option;
|
|
102092
|
-
}
|
|
102093
|
-
var init_options2 = __esm({
|
|
102094
|
-
"src/cli/util/options.ts"() {
|
|
102095
|
-
"use strict";
|
|
102096
|
-
init_commander();
|
|
102097
|
-
}
|
|
102098
|
-
});
|
|
102099
|
-
|
|
102100
102198
|
// src/cli/handler/daemon/start.ts
|
|
102101
102199
|
function registerStartCommand(program2, context) {
|
|
102102
102200
|
program2.command("start").description("ensure the daemon is running and optionally activate a saved connection").addOption(valueOption("--connection <connection-id>", "saved Runtime connection identifier")).action(async (options) => {
|
|
@@ -102197,10 +102295,10 @@ var init_daemon = __esm({
|
|
|
102197
102295
|
});
|
|
102198
102296
|
|
|
102199
102297
|
// src/cli/handler/logs/logic/collect-local-logs.ts
|
|
102200
|
-
import { join as join37, relative as relative5, resolve as
|
|
102298
|
+
import { join as join37, relative as relative5, resolve as resolve19 } from "node:path";
|
|
102201
102299
|
async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
|
|
102202
102300
|
signal.throwIfAborted();
|
|
102203
|
-
const root =
|
|
102301
|
+
const root = resolve19(stateDirectory);
|
|
102204
102302
|
const entries = [];
|
|
102205
102303
|
const unreadable = [];
|
|
102206
102304
|
const directories = await findLogDirectories(root, unreadable, signal);
|
|
@@ -102229,7 +102327,7 @@ async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
|
|
|
102229
102327
|
return { entries, unreadable: [...unreadable].sort() };
|
|
102230
102328
|
}
|
|
102231
102329
|
function defaultStateDirectory(environment = process.env) {
|
|
102232
|
-
return
|
|
102330
|
+
return resolve19(readStateDirectory(environment));
|
|
102233
102331
|
}
|
|
102234
102332
|
var init_collect_local_logs = __esm({
|
|
102235
102333
|
"src/cli/handler/logs/logic/collect-local-logs.ts"() {
|
|
@@ -102307,36 +102405,6 @@ var init_logs = __esm({
|
|
|
102307
102405
|
}
|
|
102308
102406
|
});
|
|
102309
102407
|
|
|
102310
|
-
// src/storage/files/output-file.ts
|
|
102311
|
-
import { constants as constants5 } from "node:fs";
|
|
102312
|
-
import { open as open6 } from "node:fs/promises";
|
|
102313
|
-
async function writeExistingFile(path8, content, signal) {
|
|
102314
|
-
let file2;
|
|
102315
|
-
try {
|
|
102316
|
-
file2 = await open6(path8, constants5.O_WRONLY | constants5.O_NOFOLLOW);
|
|
102317
|
-
} catch (cause) {
|
|
102318
|
-
return isNodeError(cause, "ENOENT") ? { kind: "missing", cause } : { kind: "unwritable", cause };
|
|
102319
|
-
}
|
|
102320
|
-
try {
|
|
102321
|
-
const metadata = await file2.stat();
|
|
102322
|
-
if (!metadata.isFile()) {
|
|
102323
|
-
return { kind: "not-a-file" };
|
|
102324
|
-
}
|
|
102325
|
-
signal.throwIfAborted();
|
|
102326
|
-
await file2.truncate(0);
|
|
102327
|
-
await file2.writeFile(content, "utf8");
|
|
102328
|
-
return { kind: "written" };
|
|
102329
|
-
} finally {
|
|
102330
|
-
await file2.close();
|
|
102331
|
-
}
|
|
102332
|
-
}
|
|
102333
|
-
var init_output_file = __esm({
|
|
102334
|
-
"src/storage/files/output-file.ts"() {
|
|
102335
|
-
"use strict";
|
|
102336
|
-
init_node_error();
|
|
102337
|
-
}
|
|
102338
|
-
});
|
|
102339
|
-
|
|
102340
102408
|
// src/cli/handler/pair/logic/pair-list-output.ts
|
|
102341
102409
|
function savedPairSummary(connection) {
|
|
102342
102410
|
return {
|
|
@@ -102389,11 +102457,11 @@ var init_pair_list_output = __esm({
|
|
|
102389
102457
|
});
|
|
102390
102458
|
|
|
102391
102459
|
// src/cli/handler/pair/list.ts
|
|
102392
|
-
import { resolve as
|
|
102460
|
+
import { resolve as resolve20 } from "node:path";
|
|
102393
102461
|
function registerPairListCommand(command, context) {
|
|
102394
102462
|
command.command("list").description("list saved pairings").addOption(valueOption("--output-json <existing-file.json>", "write JSON to an existing file")).action(async (options) => {
|
|
102395
102463
|
const installation = await openMobiusCliInstallation(context.shutdownSignal, process.env);
|
|
102396
|
-
const outputPath = options.outputJson === void 0 ? null :
|
|
102464
|
+
const outputPath = options.outputJson === void 0 ? null : resolve20(options.outputJson);
|
|
102397
102465
|
const pairs = (await installation.listConnections(context.shutdownSignal)).map(savedPairSummary).sort(
|
|
102398
102466
|
(left, right) => left.appId.localeCompare(right.appId) || left.connectionId.localeCompare(right.connectionId)
|
|
102399
102467
|
);
|