@moxt-ai/mobius 0.0.312 → 0.0.314
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 +269 -168
- package/dist/cli.js.map +4 -4
- package/dist/daemon/lifecycle/worker.d.ts.map +1 -1
- package/dist/daemon/lifecycle/worker.js +22 -2
- package/dist/daemon/lifecycle/worker.js.map +1 -1
- package/dist/runtime/catalog/handle-agent-catalog-discovery.d.ts +1 -1
- package/dist/runtime/catalog/handle-agent-catalog-discovery.d.ts.map +1 -1
- package/dist/runtime/catalog/handle-agent-catalog-discovery.js +2 -5
- package/dist/runtime/catalog/handle-agent-catalog-discovery.js.map +1 -1
- package/dist/runtime/catalog/refresh-agent-catalog.d.ts +9 -0
- package/dist/runtime/catalog/refresh-agent-catalog.d.ts.map +1 -0
- package/dist/runtime/catalog/refresh-agent-catalog.js +13 -0
- package/dist/runtime/catalog/refresh-agent-catalog.js.map +1 -0
- package/dist/runtime/command/registry/interactions.js +2 -2
- package/dist/runtime/command/registry/interactions.js.map +1 -1
- package/dist/runtime.js +79 -32
- package/dist/runtime.js.map +4 -4
- 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.314",
|
|
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
|
});
|
|
@@ -93143,6 +93265,24 @@ var init_quit = __esm({
|
|
|
93143
93265
|
}
|
|
93144
93266
|
});
|
|
93145
93267
|
|
|
93268
|
+
// src/runtime/catalog/refresh-agent-catalog.ts
|
|
93269
|
+
async function refreshAgentCatalog(config2, discover, signal) {
|
|
93270
|
+
const readyAgents = await discover(signal);
|
|
93271
|
+
signal.throwIfAborted();
|
|
93272
|
+
return await config2.catalog.replaceAndPublish(
|
|
93273
|
+
() => readyAgents.map((agent) => withRuntimeEnvironment(agent, config2.localContext.environment)),
|
|
93274
|
+
(publishSignal) => publishAgentCatalog(config2, publishSignal),
|
|
93275
|
+
signal
|
|
93276
|
+
);
|
|
93277
|
+
}
|
|
93278
|
+
var init_refresh_agent_catalog = __esm({
|
|
93279
|
+
"src/runtime/catalog/refresh-agent-catalog.ts"() {
|
|
93280
|
+
"use strict";
|
|
93281
|
+
init_config();
|
|
93282
|
+
init_publish_agent_catalog();
|
|
93283
|
+
}
|
|
93284
|
+
});
|
|
93285
|
+
|
|
93146
93286
|
// src/schema/acp-session-store/acp-session.ts
|
|
93147
93287
|
var acpSession;
|
|
93148
93288
|
var init_acp_session = __esm({
|
|
@@ -94514,7 +94654,7 @@ var init_session_restore = __esm({
|
|
|
94514
94654
|
|
|
94515
94655
|
// src/session/live/agent-session.ts
|
|
94516
94656
|
import { methods as methods14 } from "@agentclientprotocol/sdk";
|
|
94517
|
-
var
|
|
94657
|
+
var AgentSession;
|
|
94518
94658
|
var init_agent_session = __esm({
|
|
94519
94659
|
"src/session/live/agent-session.ts"() {
|
|
94520
94660
|
"use strict";
|
|
@@ -94534,7 +94674,6 @@ var init_agent_session = __esm({
|
|
|
94534
94674
|
init_session_configurations();
|
|
94535
94675
|
init_session_restore();
|
|
94536
94676
|
init_acp_error();
|
|
94537
|
-
PROCESS_STOP_TIMEOUT_MILLISECONDS = 1e3;
|
|
94538
94677
|
AgentSession = class _AgentSession {
|
|
94539
94678
|
// The restore surface: AgentSessionRestore members expose private state to
|
|
94540
94679
|
// session-restore.ts only. The class keeps the fields private.
|
|
@@ -95041,12 +95180,12 @@ var init_agent_session = __esm({
|
|
|
95041
95180
|
throw failure2;
|
|
95042
95181
|
}
|
|
95043
95182
|
};
|
|
95044
|
-
cancel = async () => {
|
|
95183
|
+
cancel = async (signal) => {
|
|
95184
|
+
signal.throwIfAborted();
|
|
95045
95185
|
await this.#interactions.cancelPendingInteractions();
|
|
95186
|
+
signal.throwIfAborted();
|
|
95046
95187
|
if (this.#turn.running) {
|
|
95047
|
-
await this.#
|
|
95048
|
-
sessionId: this.#updates.sessionId()
|
|
95049
|
-
});
|
|
95188
|
+
await this.#adapter.cancel(this.#target(), signal);
|
|
95050
95189
|
}
|
|
95051
95190
|
};
|
|
95052
95191
|
respondPermission = async (options) => {
|
|
@@ -95133,21 +95272,18 @@ var init_agent_session = __esm({
|
|
|
95133
95272
|
close = async () => {
|
|
95134
95273
|
try {
|
|
95135
95274
|
await this.#interactions.cancelPendingInteractions();
|
|
95136
|
-
|
|
95137
|
-
|
|
95138
|
-
|
|
95139
|
-
|
|
95140
|
-
|
|
95141
|
-
{
|
|
95142
|
-
cancellationSignal: AbortSignal.timeout(PROCESS_STOP_TIMEOUT_MILLISECONDS)
|
|
95143
|
-
}
|
|
95144
|
-
);
|
|
95145
|
-
} catch {
|
|
95146
|
-
}
|
|
95275
|
+
} catch (error62) {
|
|
95276
|
+
try {
|
|
95277
|
+
throw error62;
|
|
95278
|
+
} finally {
|
|
95279
|
+
await this.closeProcess();
|
|
95147
95280
|
}
|
|
95148
|
-
}
|
|
95281
|
+
}
|
|
95282
|
+
if (this.#updates.sessionId().length === 0) {
|
|
95149
95283
|
await this.closeProcess();
|
|
95284
|
+
return;
|
|
95150
95285
|
}
|
|
95286
|
+
await this.#adapter.closeSession(this.#target(), AbortSignal.timeout(3e4));
|
|
95151
95287
|
};
|
|
95152
95288
|
closeProcess = () => this.#connection.closeProcess();
|
|
95153
95289
|
agentSettingsModelEffort = () => this.#connection.agentSettingsModelEffort();
|
|
@@ -95733,14 +95869,14 @@ var init_session_manager = __esm({
|
|
|
95733
95869
|
return { title: normalized, updatedAt };
|
|
95734
95870
|
})
|
|
95735
95871
|
);
|
|
95736
|
-
cancelPrompt = async (sessionId) => {
|
|
95872
|
+
cancelPrompt = async (sessionId, signal = AbortSignal.timeout(3e4)) => this.#operations.run({ signal }, async ({ signal: signal2 }) => {
|
|
95737
95873
|
await this.#executions.cancel(sessionId, async () => {
|
|
95738
95874
|
const runtime = this.#executionProcesses.get(sessionId);
|
|
95739
95875
|
if (runtime !== void 0) {
|
|
95740
|
-
await runtime.cancel();
|
|
95876
|
+
await runtime.cancel(signal2);
|
|
95741
95877
|
}
|
|
95742
95878
|
});
|
|
95743
|
-
};
|
|
95879
|
+
});
|
|
95744
95880
|
steerPrompt = async (options) => this.#operations.run(options, async (options2) => {
|
|
95745
95881
|
if (this.#executions.command(options2.sessionId) !== options2.targetCommandId) {
|
|
95746
95882
|
throw new AcpExecutionError("The target turn is no longer active", {}, "steering_target_unavailable");
|
|
@@ -96890,7 +97026,7 @@ var init_runtime_turn_activity = __esm({
|
|
|
96890
97026
|
if (this.#admission.kind !== "open") {
|
|
96891
97027
|
throw new Error("A daemon upgrade already owns admission");
|
|
96892
97028
|
}
|
|
96893
|
-
return new Promise((
|
|
97029
|
+
return new Promise((resolve21, reject2) => {
|
|
96894
97030
|
const abort = () => {
|
|
96895
97031
|
this.#admission = { kind: "open" };
|
|
96896
97032
|
signal.removeEventListener("abort", abort);
|
|
@@ -96899,7 +97035,7 @@ var init_runtime_turn_activity = __esm({
|
|
|
96899
97035
|
const reserve = () => {
|
|
96900
97036
|
this.#admission = { kind: "reserved" };
|
|
96901
97037
|
signal.removeEventListener("abort", abort);
|
|
96902
|
-
|
|
97038
|
+
resolve21({
|
|
96903
97039
|
[Symbol.dispose]: () => {
|
|
96904
97040
|
this.#admission = { kind: "open" };
|
|
96905
97041
|
}
|
|
@@ -97031,7 +97167,7 @@ var init_session_execution = __esm({
|
|
|
97031
97167
|
init_active_turn();
|
|
97032
97168
|
waitForTurnCompletion = (turn, waitSignal) => {
|
|
97033
97169
|
waitSignal.throwIfAborted();
|
|
97034
|
-
return new Promise((
|
|
97170
|
+
return new Promise((resolve21, reject2) => {
|
|
97035
97171
|
let settled = false;
|
|
97036
97172
|
const finish = (result) => {
|
|
97037
97173
|
if (settled) {
|
|
@@ -97040,7 +97176,7 @@ var init_session_execution = __esm({
|
|
|
97040
97176
|
settled = true;
|
|
97041
97177
|
waitSignal.removeEventListener("abort", onAbort);
|
|
97042
97178
|
if (result.kind === "completed") {
|
|
97043
|
-
|
|
97179
|
+
resolve21();
|
|
97044
97180
|
} else {
|
|
97045
97181
|
reject2(result.error);
|
|
97046
97182
|
}
|
|
@@ -98380,13 +98516,7 @@ function createAgentCatalogDiscoveryHandler(dependencies) {
|
|
|
98380
98516
|
);
|
|
98381
98517
|
completion = (async () => {
|
|
98382
98518
|
try {
|
|
98383
|
-
const
|
|
98384
|
-
operationSignal.throwIfAborted();
|
|
98385
|
-
const published = await config2.catalog.replaceAndPublish(
|
|
98386
|
-
() => readyAgents.map((agent) => withRuntimeEnvironment(agent, config2.localContext.environment)),
|
|
98387
|
-
(publishSignal) => publishAgentCatalog(config2, publishSignal),
|
|
98388
|
-
operationSignal
|
|
98389
|
-
);
|
|
98519
|
+
const published = await refreshAgentCatalog(config2, discover, operationSignal);
|
|
98390
98520
|
operationSignal.throwIfAborted();
|
|
98391
98521
|
if (socket.readyState === WebSocket3.OPEN) {
|
|
98392
98522
|
send(
|
|
@@ -98436,8 +98566,7 @@ var init_handle_agent_catalog_discovery = __esm({
|
|
|
98436
98566
|
init_protocol();
|
|
98437
98567
|
init_operation_error();
|
|
98438
98568
|
init_transport();
|
|
98439
|
-
|
|
98440
|
-
init_publish_agent_catalog();
|
|
98569
|
+
init_refresh_agent_catalog();
|
|
98441
98570
|
CATALOG_DISCOVERY_TIMEOUT_MILLISECONDS = 9e4;
|
|
98442
98571
|
}
|
|
98443
98572
|
});
|
|
@@ -99014,7 +99143,7 @@ var init_agent_settings = __esm({
|
|
|
99014
99143
|
});
|
|
99015
99144
|
|
|
99016
99145
|
// 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
|
|
99146
|
+
import { basename as basename8, extname as extname2, isAbsolute as isAbsolute18, join as join36, normalize as normalize3, resolve as resolve18 } from "node:path";
|
|
99018
99147
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
99019
99148
|
function requestedPath(value) {
|
|
99020
99149
|
if (value.includes("\0")) {
|
|
@@ -99038,7 +99167,7 @@ async function resolveFile(value, workingDirectory, signal) {
|
|
|
99038
99167
|
if (isAbsolute18(requested.path) && normalize3(requested.path) !== requested.path) {
|
|
99039
99168
|
return null;
|
|
99040
99169
|
}
|
|
99041
|
-
const candidates = requested.explicitUrl || workingDirectory === null ? [requested.path] : isAbsolute18(requested.path) ? [join36(workingDirectory, requested.path), requested.path] : [
|
|
99170
|
+
const candidates = requested.explicitUrl || workingDirectory === null ? [requested.path] : isAbsolute18(requested.path) ? [join36(workingDirectory, requested.path), requested.path] : [resolve18(workingDirectory, requested.path)];
|
|
99042
99171
|
for (const candidate of candidates) {
|
|
99043
99172
|
if (!isAbsolute18(candidate) || normalize3(candidate) !== candidate) {
|
|
99044
99173
|
continue;
|
|
@@ -99399,7 +99528,7 @@ var init_interactions2 = __esm({
|
|
|
99399
99528
|
init_transport();
|
|
99400
99529
|
sessionCancelCommand = {
|
|
99401
99530
|
kind: SESSION_CANCEL_KIND,
|
|
99402
|
-
handle: ({ eventProjection, operations, sessions, sessionTurns }, message) => {
|
|
99531
|
+
handle: ({ eventProjection, operations, sessions, sessionTurns, signal }, message) => {
|
|
99403
99532
|
if (message.kind !== SESSION_CANCEL_KIND) {
|
|
99404
99533
|
throw new Error("Command kind mismatch");
|
|
99405
99534
|
}
|
|
@@ -99414,7 +99543,7 @@ var init_interactions2 = __esm({
|
|
|
99414
99543
|
if (cancellationState === "already-requested" || cancellationState === "pending") {
|
|
99415
99544
|
return;
|
|
99416
99545
|
}
|
|
99417
|
-
void sessions.cancelPrompt(message.sessionId).catch((error62) => {
|
|
99546
|
+
void sessions.cancelPrompt(message.sessionId, signal).catch((error62) => {
|
|
99418
99547
|
console.error("Mobius daemon could not cancel the agent turn", error62);
|
|
99419
99548
|
});
|
|
99420
99549
|
}
|
|
@@ -99510,13 +99639,13 @@ function createNativeSessionRequestHandler(dependencies) {
|
|
|
99510
99639
|
operationSignal.throwIfAborted();
|
|
99511
99640
|
const skipPrevious = command.action === "active-turn";
|
|
99512
99641
|
if (previous.length > 0 && !skipPrevious) {
|
|
99513
|
-
await new Promise((
|
|
99642
|
+
await new Promise((resolve21, reject2) => {
|
|
99514
99643
|
const onAbort = () => reject2(operationSignal.reason);
|
|
99515
99644
|
operationSignal.addEventListener("abort", onAbort, { once: true });
|
|
99516
99645
|
void Promise.all(previous.map((request) => request.completion)).then(
|
|
99517
99646
|
() => {
|
|
99518
99647
|
operationSignal.removeEventListener("abort", onAbort);
|
|
99519
|
-
|
|
99648
|
+
resolve21();
|
|
99520
99649
|
},
|
|
99521
99650
|
(error62) => {
|
|
99522
99651
|
operationSignal.removeEventListener("abort", onAbort);
|
|
@@ -100802,7 +100931,7 @@ var init_runtime_revocation = __esm({
|
|
|
100802
100931
|
import { WebSocket as WebSocket7 } from "undici";
|
|
100803
100932
|
function connectRelay(url2, signal) {
|
|
100804
100933
|
signal.throwIfAborted();
|
|
100805
|
-
return new Promise((
|
|
100934
|
+
return new Promise((resolve21, reject2) => {
|
|
100806
100935
|
let dispatchController;
|
|
100807
100936
|
const dispatcher = environmentProxyDispatcher.compose((dispatch) => (options, handler) => {
|
|
100808
100937
|
const trackedHandler = Object.create(handler);
|
|
@@ -100887,7 +101016,7 @@ function connectRelay(url2, signal) {
|
|
|
100887
101016
|
}
|
|
100888
101017
|
finished = true;
|
|
100889
101018
|
cleanup();
|
|
100890
|
-
|
|
101019
|
+
resolve21({ release, socket });
|
|
100891
101020
|
};
|
|
100892
101021
|
function onTimeout() {
|
|
100893
101022
|
fail(
|
|
@@ -101120,7 +101249,7 @@ async function runRelayConnection({
|
|
|
101120
101249
|
}
|
|
101121
101250
|
});
|
|
101122
101251
|
try {
|
|
101123
|
-
await new Promise((
|
|
101252
|
+
await new Promise((resolve21, reject2) => {
|
|
101124
101253
|
let finished = false;
|
|
101125
101254
|
let ready = false;
|
|
101126
101255
|
const cleanup = () => {
|
|
@@ -101138,7 +101267,7 @@ async function runRelayConnection({
|
|
|
101138
101267
|
}
|
|
101139
101268
|
finished = true;
|
|
101140
101269
|
cleanup();
|
|
101141
|
-
|
|
101270
|
+
resolve21();
|
|
101142
101271
|
};
|
|
101143
101272
|
const rejectConnection = (failure2) => {
|
|
101144
101273
|
if (finished) {
|
|
@@ -101472,12 +101601,12 @@ function waitForRelayRetry(signal, timer) {
|
|
|
101472
101601
|
if (signal.aborted) {
|
|
101473
101602
|
return Promise.resolve();
|
|
101474
101603
|
}
|
|
101475
|
-
return new Promise((
|
|
101604
|
+
return new Promise((resolve21) => {
|
|
101476
101605
|
const retry = timer.schedule(finish, RELAY_RECONNECT_DELAY_MILLISECONDS);
|
|
101477
101606
|
function finish() {
|
|
101478
101607
|
retry.cancel();
|
|
101479
101608
|
signal.removeEventListener("abort", finish);
|
|
101480
|
-
|
|
101609
|
+
resolve21();
|
|
101481
101610
|
}
|
|
101482
101611
|
signal.addEventListener("abort", finish, { once: true });
|
|
101483
101612
|
});
|
|
@@ -101887,11 +102016,11 @@ async function checkDaemonReleaseUpgrade(signal, activity) {
|
|
|
101887
102016
|
const _reservation = __using(_stack, await activity.reserveWhenIdle(signal));
|
|
101888
102017
|
signal.throwIfAborted();
|
|
101889
102018
|
await requestInstalledDaemonReleaseSwitch(control.stateDirectory, launch, signal);
|
|
101890
|
-
await new Promise((
|
|
102019
|
+
await new Promise((resolve21) => {
|
|
101891
102020
|
if (signal.aborted) {
|
|
101892
|
-
|
|
102021
|
+
resolve21();
|
|
101893
102022
|
} else {
|
|
101894
|
-
signal.addEventListener("abort", () =>
|
|
102023
|
+
signal.addEventListener("abort", () => resolve21(), { once: true });
|
|
101895
102024
|
}
|
|
101896
102025
|
});
|
|
101897
102026
|
} catch (_) {
|
|
@@ -102009,7 +102138,7 @@ async function runWorkerRuntime(version2, combined, shutdown, rejectionGuard) {
|
|
|
102009
102138
|
}
|
|
102010
102139
|
}
|
|
102011
102140
|
).finally(() => active.delete(connection.connectionId));
|
|
102012
|
-
active.set(connection.connectionId, { controller, completion });
|
|
102141
|
+
active.set(connection.connectionId, { config: paired.config, controller, completion });
|
|
102013
102142
|
} catch (cause) {
|
|
102014
102143
|
combined.throwIfAborted();
|
|
102015
102144
|
fail(connection.connectionId, cause);
|
|
@@ -102017,6 +102146,26 @@ async function runWorkerRuntime(version2, combined, shutdown, rejectionGuard) {
|
|
|
102017
102146
|
}
|
|
102018
102147
|
}
|
|
102019
102148
|
};
|
|
102149
|
+
const refreshRunningCatalogs = async (connectionIds) => {
|
|
102150
|
+
await Promise.all(
|
|
102151
|
+
[...connectionIds].map(async (connectionId2) => {
|
|
102152
|
+
const config2 = active.get(connectionId2)?.config;
|
|
102153
|
+
if (config2?.rediscoverAgents === void 0) {
|
|
102154
|
+
return;
|
|
102155
|
+
}
|
|
102156
|
+
try {
|
|
102157
|
+
await refreshAgentCatalog(
|
|
102158
|
+
config2,
|
|
102159
|
+
config2.rediscoverAgents,
|
|
102160
|
+
AbortSignal.any([combined, AbortSignal.timeout(9e4)])
|
|
102161
|
+
);
|
|
102162
|
+
} catch (cause) {
|
|
102163
|
+
combined.throwIfAborted();
|
|
102164
|
+
console.error(`Runtime ${connectionId2} could not refresh its Agent catalog`, cause);
|
|
102165
|
+
}
|
|
102166
|
+
})
|
|
102167
|
+
);
|
|
102168
|
+
};
|
|
102020
102169
|
let reload = Promise.resolve();
|
|
102021
102170
|
let upgrades = Promise.resolve();
|
|
102022
102171
|
try {
|
|
@@ -102029,7 +102178,8 @@ async function runWorkerRuntime(version2, combined, shutdown, rejectionGuard) {
|
|
|
102029
102178
|
if (typeof request !== "object" || request === null || !("kind" in request) || request.kind !== "reload") {
|
|
102030
102179
|
return { kind: "error", code: "invalid_reload", message: "Expected a configuration reload" };
|
|
102031
102180
|
}
|
|
102032
|
-
const
|
|
102181
|
+
const running = new Set(active.keys());
|
|
102182
|
+
const pending = reload.then(reconcile).then(async () => await refreshRunningCatalogs(running));
|
|
102033
102183
|
reload = pending.catch(() => void 0);
|
|
102034
102184
|
await pending;
|
|
102035
102185
|
return { kind: "reloaded" };
|
|
@@ -102058,6 +102208,7 @@ var WorkerRuntimeError;
|
|
|
102058
102208
|
var init_worker = __esm({
|
|
102059
102209
|
"src/daemon/lifecycle/worker.ts"() {
|
|
102060
102210
|
"use strict";
|
|
102211
|
+
init_refresh_agent_catalog();
|
|
102061
102212
|
init_engine();
|
|
102062
102213
|
init_runtime_turn_activity();
|
|
102063
102214
|
init_manager_lock();
|
|
@@ -102077,26 +102228,6 @@ var init_worker = __esm({
|
|
|
102077
102228
|
}
|
|
102078
102229
|
});
|
|
102079
102230
|
|
|
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
102231
|
// src/cli/handler/daemon/start.ts
|
|
102101
102232
|
function registerStartCommand(program2, context) {
|
|
102102
102233
|
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 +102328,10 @@ var init_daemon = __esm({
|
|
|
102197
102328
|
});
|
|
102198
102329
|
|
|
102199
102330
|
// src/cli/handler/logs/logic/collect-local-logs.ts
|
|
102200
|
-
import { join as join37, relative as relative5, resolve as
|
|
102331
|
+
import { join as join37, relative as relative5, resolve as resolve19 } from "node:path";
|
|
102201
102332
|
async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
|
|
102202
102333
|
signal.throwIfAborted();
|
|
102203
|
-
const root =
|
|
102334
|
+
const root = resolve19(stateDirectory);
|
|
102204
102335
|
const entries = [];
|
|
102205
102336
|
const unreadable = [];
|
|
102206
102337
|
const directories = await findLogDirectories(root, unreadable, signal);
|
|
@@ -102229,7 +102360,7 @@ async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
|
|
|
102229
102360
|
return { entries, unreadable: [...unreadable].sort() };
|
|
102230
102361
|
}
|
|
102231
102362
|
function defaultStateDirectory(environment = process.env) {
|
|
102232
|
-
return
|
|
102363
|
+
return resolve19(readStateDirectory(environment));
|
|
102233
102364
|
}
|
|
102234
102365
|
var init_collect_local_logs = __esm({
|
|
102235
102366
|
"src/cli/handler/logs/logic/collect-local-logs.ts"() {
|
|
@@ -102307,36 +102438,6 @@ var init_logs = __esm({
|
|
|
102307
102438
|
}
|
|
102308
102439
|
});
|
|
102309
102440
|
|
|
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
102441
|
// src/cli/handler/pair/logic/pair-list-output.ts
|
|
102341
102442
|
function savedPairSummary(connection) {
|
|
102342
102443
|
return {
|
|
@@ -102389,11 +102490,11 @@ var init_pair_list_output = __esm({
|
|
|
102389
102490
|
});
|
|
102390
102491
|
|
|
102391
102492
|
// src/cli/handler/pair/list.ts
|
|
102392
|
-
import { resolve as
|
|
102493
|
+
import { resolve as resolve20 } from "node:path";
|
|
102393
102494
|
function registerPairListCommand(command, context) {
|
|
102394
102495
|
command.command("list").description("list saved pairings").addOption(valueOption("--output-json <existing-file.json>", "write JSON to an existing file")).action(async (options) => {
|
|
102395
102496
|
const installation = await openMobiusCliInstallation(context.shutdownSignal, process.env);
|
|
102396
|
-
const outputPath = options.outputJson === void 0 ? null :
|
|
102497
|
+
const outputPath = options.outputJson === void 0 ? null : resolve20(options.outputJson);
|
|
102397
102498
|
const pairs = (await installation.listConnections(context.shutdownSignal)).map(savedPairSummary).sort(
|
|
102398
102499
|
(left, right) => left.appId.localeCompare(right.appId) || left.connectionId.localeCompare(right.connectionId)
|
|
102399
102500
|
);
|