@moxt-ai/mobius 0.0.302 → 0.0.305
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/agent/catalog.d.ts +2 -1
- package/dist/agent/catalog.d.ts.map +1 -1
- package/dist/agent/catalog.js +18 -4
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/discovery/agent-discovery.d.ts +9 -0
- package/dist/agent/discovery/agent-discovery.d.ts.map +1 -1
- package/dist/agent/discovery/agent-discovery.js +10 -0
- package/dist/agent/discovery/agent-discovery.js.map +1 -1
- package/dist/agent/discovery/discover-local-agents.d.ts +1 -0
- package/dist/agent/discovery/discover-local-agents.d.ts.map +1 -1
- package/dist/agent/discovery/discover-local-agents.js +1 -0
- package/dist/agent/discovery/discover-local-agents.js.map +1 -1
- package/dist/cli.js +615 -364
- package/dist/cli.js.map +4 -4
- package/dist/daemon/lifecycle/manager-client.d.ts.map +1 -1
- package/dist/daemon/lifecycle/manager-client.js +13 -12
- package/dist/daemon/lifecycle/manager-client.js.map +1 -1
- package/dist/daemon/lifecycle/manager.d.ts.map +1 -1
- package/dist/daemon/lifecycle/manager.js +11 -2
- package/dist/daemon/lifecycle/manager.js.map +1 -1
- package/dist/daemon/lifecycle/worker-process.d.ts +0 -1
- package/dist/daemon/lifecycle/worker-process.d.ts.map +1 -1
- package/dist/daemon/lifecycle/worker-process.js +1 -12
- package/dist/daemon/lifecycle/worker-process.js.map +1 -1
- package/dist/daemon/pairing/pair-local-machine.d.ts.map +1 -1
- package/dist/daemon/pairing/pair-local-machine.js +5 -1
- package/dist/daemon/pairing/pair-local-machine.js.map +1 -1
- package/dist/daemon/upgrades/package.d.ts +1 -0
- package/dist/daemon/upgrades/package.d.ts.map +1 -1
- package/dist/daemon/upgrades/package.js +70 -38
- package/dist/daemon/upgrades/package.js.map +1 -1
- package/dist/runtime/catalog/handle-agent-catalog-discovery.d.ts +29 -0
- package/dist/runtime/catalog/handle-agent-catalog-discovery.d.ts.map +1 -0
- package/dist/runtime/catalog/handle-agent-catalog-discovery.js +88 -0
- package/dist/runtime/catalog/handle-agent-catalog-discovery.js.map +1 -0
- package/dist/runtime/catalog/resolve-catalog-agent.d.ts +2 -1
- package/dist/runtime/catalog/resolve-catalog-agent.d.ts.map +1 -1
- package/dist/runtime/catalog/resolve-catalog-agent.js +12 -20
- package/dist/runtime/catalog/resolve-catalog-agent.js.map +1 -1
- package/dist/runtime/command/registry/agent-catalog.d.ts +4 -0
- package/dist/runtime/command/registry/agent-catalog.d.ts.map +1 -0
- package/dist/runtime/command/registry/agent-catalog.js +29 -0
- package/dist/runtime/command/registry/agent-catalog.js.map +1 -0
- package/dist/runtime/command/registry/index.d.ts.map +1 -1
- package/dist/runtime/command/registry/index.js +2 -0
- package/dist/runtime/command/registry/index.js.map +1 -1
- package/dist/runtime/config.d.ts +6 -1
- package/dist/runtime/config.d.ts.map +1 -1
- package/dist/runtime/config.js +2 -1
- package/dist/runtime/config.js.map +1 -1
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +1 -1
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime.js +260 -67
- package/dist/runtime.js.map +4 -4
- package/dist/util/serial-task-queue.d.ts +6 -0
- package/dist/util/serial-task-queue.d.ts.map +1 -0
- package/dist/util/serial-task-queue.js +14 -0
- package/dist/util/serial-task-queue.js.map +1 -0
- package/package.json +2 -2
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.305",
|
|
2090
2090
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
2091
2091
|
type: "module",
|
|
2092
2092
|
bin: {
|
|
@@ -41914,14 +41914,14 @@ function unreachable(value, logger = console) {
|
|
|
41914
41914
|
async function withDeadline(signal, timeoutMilliseconds, operation) {
|
|
41915
41915
|
const deadline = AbortSignal.any([signal, AbortSignal.timeout(timeoutMilliseconds)]);
|
|
41916
41916
|
deadline.throwIfAborted();
|
|
41917
|
-
return await new Promise((
|
|
41917
|
+
return await new Promise((resolve19, reject2) => {
|
|
41918
41918
|
const settle2 = (callback) => {
|
|
41919
41919
|
deadline.removeEventListener("abort", onAbort);
|
|
41920
41920
|
callback();
|
|
41921
41921
|
};
|
|
41922
41922
|
const onAbort = () => settle2(() => reject2(deadline.reason));
|
|
41923
41923
|
deadline.addEventListener("abort", onAbort, { once: true });
|
|
41924
|
-
operation().then((value) => settle2(() =>
|
|
41924
|
+
operation().then((value) => settle2(() => resolve19(value)), (error62) => settle2(() => reject2(error62)));
|
|
41925
41925
|
});
|
|
41926
41926
|
}
|
|
41927
41927
|
function withEnvironment(environment, operation) {
|
|
@@ -41948,11 +41948,11 @@ var init_utils = __esm({
|
|
|
41948
41948
|
done = false;
|
|
41949
41949
|
push(item) {
|
|
41950
41950
|
if (this.resolvers.length > 0) {
|
|
41951
|
-
const
|
|
41952
|
-
if (
|
|
41951
|
+
const resolve19 = this.resolvers.shift();
|
|
41952
|
+
if (resolve19 === void 0) {
|
|
41953
41953
|
return;
|
|
41954
41954
|
}
|
|
41955
|
-
|
|
41955
|
+
resolve19({ value: item, done: false });
|
|
41956
41956
|
} else {
|
|
41957
41957
|
this.queue.push(item);
|
|
41958
41958
|
}
|
|
@@ -41960,8 +41960,8 @@ var init_utils = __esm({
|
|
|
41960
41960
|
end() {
|
|
41961
41961
|
this.done = true;
|
|
41962
41962
|
while (this.resolvers.length > 0) {
|
|
41963
|
-
const
|
|
41964
|
-
|
|
41963
|
+
const resolve19 = this.resolvers.shift();
|
|
41964
|
+
resolve19?.({ done: true, value: void 0 });
|
|
41965
41965
|
}
|
|
41966
41966
|
}
|
|
41967
41967
|
[Symbol.asyncIterator]() {
|
|
@@ -41977,8 +41977,8 @@ var init_utils = __esm({
|
|
|
41977
41977
|
if (this.done) {
|
|
41978
41978
|
return Promise.resolve({ done: true, value: void 0 });
|
|
41979
41979
|
}
|
|
41980
|
-
return new Promise((
|
|
41981
|
-
this.resolvers.push(
|
|
41980
|
+
return new Promise((resolve19) => {
|
|
41981
|
+
this.resolvers.push(resolve19);
|
|
41982
41982
|
});
|
|
41983
41983
|
}
|
|
41984
41984
|
};
|
|
@@ -47450,7 +47450,7 @@ function isRef(value) {
|
|
|
47450
47450
|
function cloneIssues(issues) {
|
|
47451
47451
|
return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
|
|
47452
47452
|
}
|
|
47453
|
-
function isRecursive(inst, stack,
|
|
47453
|
+
function isRecursive(inst, stack, resolve19) {
|
|
47454
47454
|
const cached2 = recursive.get(inst);
|
|
47455
47455
|
if (cached2 !== void 0)
|
|
47456
47456
|
return cached2 ? PROVEN : NONE;
|
|
@@ -47460,7 +47460,7 @@ function isRecursive(inst, stack, resolve20) {
|
|
|
47460
47460
|
let result = NONE;
|
|
47461
47461
|
const check2 = (child) => {
|
|
47462
47462
|
if (result !== PROVEN && child?._zod) {
|
|
47463
|
-
const answer = isRecursive(child, stack,
|
|
47463
|
+
const answer = isRecursive(child, stack, resolve19);
|
|
47464
47464
|
if (answer > result)
|
|
47465
47465
|
result = answer;
|
|
47466
47466
|
}
|
|
@@ -47471,7 +47471,7 @@ function isRecursive(inst, stack, resolve20) {
|
|
|
47471
47471
|
const desc2 = Object.getOwnPropertyDescriptor(sh, key);
|
|
47472
47472
|
if (spread && !desc2.enumerable)
|
|
47473
47473
|
continue;
|
|
47474
|
-
const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack,
|
|
47474
|
+
const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve19) : NONE;
|
|
47475
47475
|
if (child > answer)
|
|
47476
47476
|
answer = child;
|
|
47477
47477
|
}
|
|
@@ -47535,7 +47535,7 @@ function isRecursive(inst, stack, resolve20) {
|
|
|
47535
47535
|
break;
|
|
47536
47536
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
47537
47537
|
case "lazy": {
|
|
47538
|
-
const inner = def._cachedInner ?? (
|
|
47538
|
+
const inner = def._cachedInner ?? (resolve19 ? inst._zod.innerType : void 0);
|
|
47539
47539
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
47540
47540
|
break;
|
|
47541
47541
|
}
|
|
@@ -65138,14 +65138,14 @@ function waitUnlessAborted(milliseconds, signal) {
|
|
|
65138
65138
|
if (signal.aborted) {
|
|
65139
65139
|
return Promise.resolve(false);
|
|
65140
65140
|
}
|
|
65141
|
-
return new Promise((
|
|
65141
|
+
return new Promise((resolve19) => {
|
|
65142
65142
|
const timer = setTimeout(() => {
|
|
65143
65143
|
signal.removeEventListener("abort", onAbort);
|
|
65144
|
-
|
|
65144
|
+
resolve19(true);
|
|
65145
65145
|
}, milliseconds);
|
|
65146
65146
|
const onAbort = () => {
|
|
65147
65147
|
clearTimeout(timer);
|
|
65148
|
-
|
|
65148
|
+
resolve19(false);
|
|
65149
65149
|
};
|
|
65150
65150
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
65151
65151
|
});
|
|
@@ -65329,7 +65329,7 @@ function stripLocalCommandMetadata(content) {
|
|
|
65329
65329
|
return kept;
|
|
65330
65330
|
}
|
|
65331
65331
|
function raceWithAbort(operation, signal) {
|
|
65332
|
-
return new Promise((
|
|
65332
|
+
return new Promise((resolve19, reject2) => {
|
|
65333
65333
|
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
65334
65334
|
const onAbort = () => {
|
|
65335
65335
|
cleanup();
|
|
@@ -65341,7 +65341,7 @@ function raceWithAbort(operation, signal) {
|
|
|
65341
65341
|
}
|
|
65342
65342
|
void operation.then((value) => {
|
|
65343
65343
|
cleanup();
|
|
65344
|
-
|
|
65344
|
+
resolve19(value);
|
|
65345
65345
|
}, (error62) => {
|
|
65346
65346
|
cleanup();
|
|
65347
65347
|
reject2(error62);
|
|
@@ -67250,12 +67250,12 @@ var init_acp_agent = __esm({
|
|
|
67250
67250
|
}
|
|
67251
67251
|
};
|
|
67252
67252
|
let completeTurn;
|
|
67253
|
-
turn.completion = new Promise((
|
|
67254
|
-
completeTurn =
|
|
67253
|
+
turn.completion = new Promise((resolve19) => {
|
|
67254
|
+
completeTurn = resolve19;
|
|
67255
67255
|
});
|
|
67256
|
-
const response = new Promise((
|
|
67256
|
+
const response = new Promise((resolve19, reject2) => {
|
|
67257
67257
|
turn.resolve = (result) => {
|
|
67258
|
-
|
|
67258
|
+
resolve19(result);
|
|
67259
67259
|
completeTurn();
|
|
67260
67260
|
};
|
|
67261
67261
|
turn.reject = (error62) => {
|
|
@@ -67654,8 +67654,8 @@ var init_acp_agent = __esm({
|
|
|
67654
67654
|
pendingNext ??= session.query.next().then((result) => ({ kind: "message", result }));
|
|
67655
67655
|
const nextMessage = pendingNext;
|
|
67656
67656
|
let onAbort;
|
|
67657
|
-
const abortRace = new Promise((
|
|
67658
|
-
onAbort = () =>
|
|
67657
|
+
const abortRace = new Promise((resolve19) => {
|
|
67658
|
+
onAbort = () => resolve19("abort");
|
|
67659
67659
|
cancelController.signal.addEventListener("abort", onAbort, { once: true });
|
|
67660
67660
|
});
|
|
67661
67661
|
const raced = await Promise.race([nextMessage, abortRace]);
|
|
@@ -72906,6 +72906,46 @@ var init_access = __esm({
|
|
|
72906
72906
|
}
|
|
72907
72907
|
});
|
|
72908
72908
|
|
|
72909
|
+
// ../mobius-sdk/src/protocol/session/agent/catalog.ts
|
|
72910
|
+
var AGENT_CATALOG_DISCOVER_KIND, AGENT_CATALOG_DISCOVERED_KIND, AGENT_CATALOG_DISCOVERY_FAILED_KIND, catalogedAgentSchema, agentCatalogDiscoverCommandSchema, agentCatalogDiscoveredEventSchema, agentCatalogDiscoveryFailedEventSchema, decodeAgentCatalogDiscoverCommand, encodeAgentCatalogDiscoverCommand, decodeAgentCatalogDiscoveredEvent, encodeAgentCatalogDiscoveredEvent, decodeAgentCatalogDiscoveryFailedEvent, encodeAgentCatalogDiscoveryFailedEvent;
|
|
72911
|
+
var init_catalog = __esm({
|
|
72912
|
+
"../mobius-sdk/src/protocol/session/agent/catalog.ts"() {
|
|
72913
|
+
"use strict";
|
|
72914
|
+
init_zod();
|
|
72915
|
+
init_identifier();
|
|
72916
|
+
init_message_codec();
|
|
72917
|
+
AGENT_CATALOG_DISCOVER_KIND = "agent.catalog.discover";
|
|
72918
|
+
AGENT_CATALOG_DISCOVERED_KIND = "agent.catalog.discovered";
|
|
72919
|
+
AGENT_CATALOG_DISCOVERY_FAILED_KIND = "agent.catalog.discovery.failed";
|
|
72920
|
+
catalogedAgentSchema = external_exports.object({
|
|
72921
|
+
agentVersion: external_exports.string().min(1).max(128),
|
|
72922
|
+
id: identifierStringSchema,
|
|
72923
|
+
label: external_exports.string().min(1).max(255)
|
|
72924
|
+
}).readonly();
|
|
72925
|
+
agentCatalogDiscoverCommandSchema = external_exports.object({
|
|
72926
|
+
kind: external_exports.literal(AGENT_CATALOG_DISCOVER_KIND),
|
|
72927
|
+
requestId: identifierStringSchema
|
|
72928
|
+
}).readonly();
|
|
72929
|
+
agentCatalogDiscoveredEventSchema = external_exports.object({
|
|
72930
|
+
agents: external_exports.array(catalogedAgentSchema).max(64).readonly(),
|
|
72931
|
+
kind: external_exports.literal(AGENT_CATALOG_DISCOVERED_KIND),
|
|
72932
|
+
requestId: identifierStringSchema
|
|
72933
|
+
}).readonly();
|
|
72934
|
+
agentCatalogDiscoveryFailedEventSchema = external_exports.object({
|
|
72935
|
+
code: identifierStringSchema,
|
|
72936
|
+
kind: external_exports.literal(AGENT_CATALOG_DISCOVERY_FAILED_KIND),
|
|
72937
|
+
message: external_exports.string().min(1).max(500),
|
|
72938
|
+
requestId: identifierStringSchema
|
|
72939
|
+
}).readonly();
|
|
72940
|
+
decodeAgentCatalogDiscoverCommand = (encoded) => decodeZodMessage(encoded, agentCatalogDiscoverCommandSchema);
|
|
72941
|
+
encodeAgentCatalogDiscoverCommand = (message) => encodeZodMessage(message, agentCatalogDiscoverCommandSchema);
|
|
72942
|
+
decodeAgentCatalogDiscoveredEvent = (encoded) => decodeZodMessage(encoded, agentCatalogDiscoveredEventSchema);
|
|
72943
|
+
encodeAgentCatalogDiscoveredEvent = (message) => encodeZodMessage(message, agentCatalogDiscoveredEventSchema);
|
|
72944
|
+
decodeAgentCatalogDiscoveryFailedEvent = (encoded) => decodeZodMessage(encoded, agentCatalogDiscoveryFailedEventSchema);
|
|
72945
|
+
encodeAgentCatalogDiscoveryFailedEvent = (message) => encodeZodMessage(message, agentCatalogDiscoveryFailedEventSchema);
|
|
72946
|
+
}
|
|
72947
|
+
});
|
|
72948
|
+
|
|
72909
72949
|
// ../mobius-sdk/src/protocol/session/shared/index.ts
|
|
72910
72950
|
var SHORT_TEXT, workspaceEntrySchema, sessionStatusSchema, sessionCapabilitiesSchema, sessionCommandSchema, configValueSchema, sessionIdentityFields;
|
|
72911
72951
|
var init_shared2 = __esm({
|
|
@@ -74859,6 +74899,7 @@ var init_daemon_transport = __esm({
|
|
|
74859
74899
|
init_diagnostics();
|
|
74860
74900
|
init_liveness();
|
|
74861
74901
|
init_upgrade();
|
|
74902
|
+
init_catalog();
|
|
74862
74903
|
init_settings2();
|
|
74863
74904
|
init_configuration();
|
|
74864
74905
|
init_title();
|
|
@@ -74882,6 +74923,11 @@ var init_daemon_transport = __esm({
|
|
|
74882
74923
|
encodeAgentSettingsDiscoverCommand,
|
|
74883
74924
|
decodeAgentSettingsDiscoverCommand
|
|
74884
74925
|
),
|
|
74926
|
+
[AGENT_CATALOG_DISCOVER_KIND]: defineMessageSignature(
|
|
74927
|
+
AGENT_CATALOG_DISCOVER_KIND,
|
|
74928
|
+
encodeAgentCatalogDiscoverCommand,
|
|
74929
|
+
decodeAgentCatalogDiscoverCommand
|
|
74930
|
+
),
|
|
74885
74931
|
[FILE_READ_KIND]: defineMessageSignature(FILE_READ_KIND, encodeFileReadCommand, decodeFileReadCommand),
|
|
74886
74932
|
[SESSION_LIST_KIND]: defineMessageSignature(SESSION_LIST_KIND, encodeSessionListCommand, decodeSessionListCommand),
|
|
74887
74933
|
[SESSION_QUERY_KIND]: defineMessageSignature(
|
|
@@ -75023,6 +75069,16 @@ var init_daemon_transport = __esm({
|
|
|
75023
75069
|
encodeAgentSettingsDiscoveryFailedEvent,
|
|
75024
75070
|
decodeAgentSettingsDiscoveryFailedEvent
|
|
75025
75071
|
),
|
|
75072
|
+
[AGENT_CATALOG_DISCOVERED_KIND]: defineMessageSignature(
|
|
75073
|
+
AGENT_CATALOG_DISCOVERED_KIND,
|
|
75074
|
+
encodeAgentCatalogDiscoveredEvent,
|
|
75075
|
+
decodeAgentCatalogDiscoveredEvent
|
|
75076
|
+
),
|
|
75077
|
+
[AGENT_CATALOG_DISCOVERY_FAILED_KIND]: defineMessageSignature(
|
|
75078
|
+
AGENT_CATALOG_DISCOVERY_FAILED_KIND,
|
|
75079
|
+
encodeAgentCatalogDiscoveryFailedEvent,
|
|
75080
|
+
decodeAgentCatalogDiscoveryFailedEvent
|
|
75081
|
+
),
|
|
75026
75082
|
[FILE_BEGIN_KIND]: defineMessageSignature(FILE_BEGIN_KIND, encodeFileBeginEvent, decodeFileBeginEvent),
|
|
75027
75083
|
[FILE_CHUNK_KIND]: defineMessageSignature(FILE_CHUNK_KIND, encodeFileChunkEvent, decodeFileChunkEvent),
|
|
75028
75084
|
[FILE_END_KIND]: defineMessageSignature(FILE_END_KIND, encodeFileEndEvent, decodeFileEndEvent),
|
|
@@ -75108,6 +75164,7 @@ var init_protocol = __esm({
|
|
|
75108
75164
|
init_liveness();
|
|
75109
75165
|
init_upgrade();
|
|
75110
75166
|
init_access();
|
|
75167
|
+
init_catalog();
|
|
75111
75168
|
init_settings2();
|
|
75112
75169
|
init_configuration();
|
|
75113
75170
|
init_title();
|
|
@@ -76090,10 +76147,10 @@ var init_process = __esm({
|
|
|
76090
76147
|
shell: shouldUseShellForPiCommand(cmd)
|
|
76091
76148
|
});
|
|
76092
76149
|
try {
|
|
76093
|
-
await new Promise((
|
|
76150
|
+
await new Promise((resolve19, reject2) => {
|
|
76094
76151
|
const onSpawn = () => {
|
|
76095
76152
|
cleanup();
|
|
76096
|
-
|
|
76153
|
+
resolve19();
|
|
76097
76154
|
};
|
|
76098
76155
|
const onError = (err) => {
|
|
76099
76156
|
cleanup();
|
|
@@ -76295,7 +76352,7 @@ var init_process = __esm({
|
|
|
76295
76352
|
const timeoutMs = opts?.timeoutMs;
|
|
76296
76353
|
const line = `${JSON.stringify(withId)}
|
|
76297
76354
|
`;
|
|
76298
|
-
return new Promise((
|
|
76355
|
+
return new Promise((resolve19, reject2) => {
|
|
76299
76356
|
const signal = opts?.signal;
|
|
76300
76357
|
if (signal?.aborted === true) {
|
|
76301
76358
|
reject2(signal.reason);
|
|
@@ -76317,7 +76374,7 @@ var init_process = __esm({
|
|
|
76317
76374
|
this.pending.set(id, {
|
|
76318
76375
|
resolve: (res) => {
|
|
76319
76376
|
drop();
|
|
76320
|
-
|
|
76377
|
+
resolve19(res);
|
|
76321
76378
|
},
|
|
76322
76379
|
reject: (error62) => {
|
|
76323
76380
|
drop();
|
|
@@ -76350,14 +76407,14 @@ var init_process = __esm({
|
|
|
76350
76407
|
});
|
|
76351
76408
|
}
|
|
76352
76409
|
writeLine(line) {
|
|
76353
|
-
return new Promise((
|
|
76410
|
+
return new Promise((resolve19, reject2) => {
|
|
76354
76411
|
try {
|
|
76355
76412
|
this.child.stdin.write(line, (error62) => {
|
|
76356
76413
|
if (error62) {
|
|
76357
76414
|
reject2(error62);
|
|
76358
76415
|
return;
|
|
76359
76416
|
}
|
|
76360
|
-
|
|
76417
|
+
resolve19();
|
|
76361
76418
|
});
|
|
76362
76419
|
} catch (error62) {
|
|
76363
76420
|
reject2(error62);
|
|
@@ -77722,8 +77779,8 @@ var init_session = __esm({
|
|
|
77722
77779
|
}
|
|
77723
77780
|
async prompt(message, images = []) {
|
|
77724
77781
|
const expandedMessage = expandSlashCommand(message, this.fileCommands);
|
|
77725
|
-
const turnPromise = new Promise((
|
|
77726
|
-
const queued = { message: expandedMessage, images, resolve:
|
|
77782
|
+
const turnPromise = new Promise((resolve19, reject2) => {
|
|
77783
|
+
const queued = { message: expandedMessage, images, resolve: resolve19, reject: reject2 };
|
|
77727
77784
|
if (this.pendingTurn) {
|
|
77728
77785
|
this.turnQueue.push(queued);
|
|
77729
77786
|
this.emit({
|
|
@@ -81010,6 +81067,7 @@ var init_discover_local_agents = __esm({
|
|
|
81010
81067
|
init_supported_agent_specifications();
|
|
81011
81068
|
init_agent_discovery();
|
|
81012
81069
|
init_executable_discovery();
|
|
81070
|
+
init_agent_discovery();
|
|
81013
81071
|
}
|
|
81014
81072
|
});
|
|
81015
81073
|
|
|
@@ -81190,12 +81248,33 @@ var init_publish_agent_catalog = __esm({
|
|
|
81190
81248
|
}
|
|
81191
81249
|
});
|
|
81192
81250
|
|
|
81251
|
+
// src/util/serial-task-queue.ts
|
|
81252
|
+
var SerialTaskQueue;
|
|
81253
|
+
var init_serial_task_queue = __esm({
|
|
81254
|
+
"src/util/serial-task-queue.ts"() {
|
|
81255
|
+
"use strict";
|
|
81256
|
+
SerialTaskQueue = class {
|
|
81257
|
+
#tail = Promise.resolve();
|
|
81258
|
+
run = async (task, signal) => {
|
|
81259
|
+
signal.throwIfAborted();
|
|
81260
|
+
const result = this.#tail.then(() => {
|
|
81261
|
+
signal.throwIfAborted();
|
|
81262
|
+
return task(signal);
|
|
81263
|
+
});
|
|
81264
|
+
this.#tail = result.catch(() => void 0);
|
|
81265
|
+
return await result;
|
|
81266
|
+
};
|
|
81267
|
+
};
|
|
81268
|
+
}
|
|
81269
|
+
});
|
|
81270
|
+
|
|
81193
81271
|
// src/agent/catalog.ts
|
|
81194
81272
|
var LocalAgentCatalogSnapshot, LocalAgentCatalogError, LocalAgentCatalog;
|
|
81195
|
-
var
|
|
81273
|
+
var init_catalog2 = __esm({
|
|
81196
81274
|
"src/agent/catalog.ts"() {
|
|
81197
81275
|
"use strict";
|
|
81198
81276
|
init_operation_error();
|
|
81277
|
+
init_serial_task_queue();
|
|
81199
81278
|
LocalAgentCatalogSnapshot = class {
|
|
81200
81279
|
agents;
|
|
81201
81280
|
constructor(agents) {
|
|
@@ -81210,6 +81289,7 @@ var init_catalog = __esm({
|
|
|
81210
81289
|
};
|
|
81211
81290
|
LocalAgentCatalog = class {
|
|
81212
81291
|
#snapshot;
|
|
81292
|
+
#updates = new SerialTaskQueue();
|
|
81213
81293
|
constructor(agents) {
|
|
81214
81294
|
this.#snapshot = this.validate(agents);
|
|
81215
81295
|
}
|
|
@@ -81222,10 +81302,20 @@ var init_catalog = __esm({
|
|
|
81222
81302
|
throw new LocalAgentCatalogError();
|
|
81223
81303
|
};
|
|
81224
81304
|
read = () => this.#snapshot;
|
|
81225
|
-
|
|
81226
|
-
|
|
81227
|
-
this.#
|
|
81228
|
-
|
|
81305
|
+
/** Serializes replacements and publication; a failed publication restores only its own prior snapshot. */
|
|
81306
|
+
replaceAndPublish = async (build, publish, signal) => {
|
|
81307
|
+
return await this.#updates.run(async (updateSignal) => {
|
|
81308
|
+
const previous = this.#snapshot;
|
|
81309
|
+
const next = this.validate(build(previous.agents));
|
|
81310
|
+
this.#snapshot = next;
|
|
81311
|
+
try {
|
|
81312
|
+
await publish(updateSignal);
|
|
81313
|
+
} catch (error62) {
|
|
81314
|
+
this.#snapshot = previous;
|
|
81315
|
+
throw error62;
|
|
81316
|
+
}
|
|
81317
|
+
return next;
|
|
81318
|
+
}, signal);
|
|
81229
81319
|
};
|
|
81230
81320
|
validate = (agents) => {
|
|
81231
81321
|
const identifiers = /* @__PURE__ */ new Set();
|
|
@@ -81256,7 +81346,7 @@ function withRuntimeEnvironment(agent, environment) {
|
|
|
81256
81346
|
}
|
|
81257
81347
|
return agent.withEnvironment({ ...launchEnvironment, ...agent.environment });
|
|
81258
81348
|
}
|
|
81259
|
-
function createRuntimeConfig(connection, agents = [], localContext = new RuntimeLocalContext(readStateDirectory(), process.env), reconnectTarget = null, resolveAgent) {
|
|
81349
|
+
function createRuntimeConfig(connection, agents = [], localContext = new RuntimeLocalContext(readStateDirectory(), process.env), reconnectTarget = null, resolveAgent, rediscoverAgents) {
|
|
81260
81350
|
const runtimeAgents = agents.map((agent) => withRuntimeEnvironment(agent, localContext.environment));
|
|
81261
81351
|
return {
|
|
81262
81352
|
agents: runtimeAgents,
|
|
@@ -81267,7 +81357,8 @@ function createRuntimeConfig(connection, agents = [], localContext = new Runtime
|
|
|
81267
81357
|
localContext,
|
|
81268
81358
|
reconnectTarget,
|
|
81269
81359
|
relayUrl: connection.relayUrl,
|
|
81270
|
-
...resolveAgent === void 0 ? {} : { resolveAgent }
|
|
81360
|
+
...resolveAgent === void 0 ? {} : { resolveAgent },
|
|
81361
|
+
...rediscoverAgents === void 0 ? {} : { rediscoverAgents }
|
|
81271
81362
|
};
|
|
81272
81363
|
}
|
|
81273
81364
|
var RuntimeLocalContext, RuntimeReconnectTarget, OpaqueRuntimeReconnectTarget;
|
|
@@ -81275,7 +81366,7 @@ var init_config = __esm({
|
|
|
81275
81366
|
"src/runtime/config.ts"() {
|
|
81276
81367
|
"use strict";
|
|
81277
81368
|
init_protocol();
|
|
81278
|
-
|
|
81369
|
+
init_catalog2();
|
|
81279
81370
|
init_state_directory();
|
|
81280
81371
|
RuntimeLocalContext = class {
|
|
81281
81372
|
environment;
|
|
@@ -81325,21 +81416,17 @@ function createCatalogAgentResolver(discover, readConfig, publish) {
|
|
|
81325
81416
|
signal.throwIfAborted();
|
|
81326
81417
|
const inventory = await discover(signal);
|
|
81327
81418
|
signal.throwIfAborted();
|
|
81328
|
-
const
|
|
81329
|
-
|
|
81330
|
-
|
|
81331
|
-
|
|
81332
|
-
|
|
81333
|
-
|
|
81334
|
-
|
|
81335
|
-
|
|
81336
|
-
|
|
81337
|
-
|
|
81338
|
-
|
|
81339
|
-
} catch (error62) {
|
|
81340
|
-
config2.catalog.transition(previous.agents);
|
|
81341
|
-
throw error62;
|
|
81342
|
-
}
|
|
81419
|
+
const rediscovered = inventory.readyAgents().filter((ready) => ready.id === agent.id).map((ready) => withRuntimeEnvironment(ready, config2.localContext.environment));
|
|
81420
|
+
await config2.catalog.replaceAndPublish(
|
|
81421
|
+
(current) => {
|
|
81422
|
+
if (!current.some((entry) => entry.id === agent.id)) {
|
|
81423
|
+
throw new Error(`The local Agent ${agent.id} left the catalog before its refresh completed`);
|
|
81424
|
+
}
|
|
81425
|
+
return [...current.filter((entry) => entry.id !== agent.id), ...rediscovered];
|
|
81426
|
+
},
|
|
81427
|
+
(publishSignal) => publish(config2, publishSignal),
|
|
81428
|
+
signal
|
|
81429
|
+
);
|
|
81343
81430
|
return config2.catalog.find(agent.id);
|
|
81344
81431
|
} finally {
|
|
81345
81432
|
swaps.delete(agent.id);
|
|
@@ -82159,7 +82246,7 @@ function controlSocketPath(stateDirectory, endpoint = "manager") {
|
|
|
82159
82246
|
}
|
|
82160
82247
|
async function readSocketMessage(socket, signal) {
|
|
82161
82248
|
signal.throwIfAborted();
|
|
82162
|
-
return await new Promise((
|
|
82249
|
+
return await new Promise((resolve19, reject2) => {
|
|
82163
82250
|
let encoded = "";
|
|
82164
82251
|
const finish = (error62, value) => {
|
|
82165
82252
|
signal.removeEventListener("abort", abort);
|
|
@@ -82167,7 +82254,7 @@ async function readSocketMessage(socket, signal) {
|
|
|
82167
82254
|
socket.removeAllListeners("error");
|
|
82168
82255
|
socket.removeAllListeners("end");
|
|
82169
82256
|
if (error62 === void 0) {
|
|
82170
|
-
|
|
82257
|
+
resolve19(value);
|
|
82171
82258
|
} else {
|
|
82172
82259
|
reject2(error62);
|
|
82173
82260
|
}
|
|
@@ -82203,14 +82290,14 @@ async function sendLocalRequest(stateDirectory, endpoint, command, signal) {
|
|
|
82203
82290
|
deadline.throwIfAborted();
|
|
82204
82291
|
const socket = createConnection(controlSocketPath(stateDirectory, endpoint));
|
|
82205
82292
|
try {
|
|
82206
|
-
await new Promise((
|
|
82293
|
+
await new Promise((resolve19, reject2) => {
|
|
82207
82294
|
const abort = () => {
|
|
82208
82295
|
socket.destroy();
|
|
82209
82296
|
reject2(deadline.reason);
|
|
82210
82297
|
};
|
|
82211
82298
|
socket.once("connect", () => {
|
|
82212
82299
|
deadline.removeEventListener("abort", abort);
|
|
82213
|
-
|
|
82300
|
+
resolve19();
|
|
82214
82301
|
});
|
|
82215
82302
|
socket.once("error", reject2);
|
|
82216
82303
|
deadline.addEventListener("abort", abort, { once: true });
|
|
@@ -82530,7 +82617,12 @@ function buildPairedRuntime(installation, connection, defaultWorkspace, inventor
|
|
|
82530
82617
|
}),
|
|
82531
82618
|
() => config2,
|
|
82532
82619
|
publishAgentCatalog
|
|
82533
|
-
)
|
|
82620
|
+
),
|
|
82621
|
+
(refreshSignal) => discoverLocalAgentInventory({
|
|
82622
|
+
defaultWorkspace,
|
|
82623
|
+
environment: localContext.environment,
|
|
82624
|
+
signal: refreshSignal
|
|
82625
|
+
}).then((inventory2) => inventory2.readyAgents())
|
|
82534
82626
|
);
|
|
82535
82627
|
return {
|
|
82536
82628
|
channelUrl: new URL(`/channels/${encodeURIComponent(connection.channelId)}`, connection.relayOrigin).toString(),
|
|
@@ -82874,21 +82966,21 @@ async function serveLocalControl(stateDirectory, endpoint, signal, handle, onLis
|
|
|
82874
82966
|
});
|
|
82875
82967
|
try {
|
|
82876
82968
|
await platform2.prepareControlSocket(path8);
|
|
82877
|
-
await new Promise((
|
|
82878
|
-
server.once("listening",
|
|
82969
|
+
await new Promise((resolve19, reject2) => {
|
|
82970
|
+
server.once("listening", resolve19);
|
|
82879
82971
|
server.once("error", reject2);
|
|
82880
82972
|
server.listen(path8);
|
|
82881
82973
|
});
|
|
82882
82974
|
await platform2.secureControlSocket(path8);
|
|
82883
82975
|
await onListening();
|
|
82884
82976
|
if (!signal.aborted) {
|
|
82885
|
-
await new Promise((
|
|
82977
|
+
await new Promise((resolve19) => signal.addEventListener("abort", () => resolve19(), { once: true }));
|
|
82886
82978
|
}
|
|
82887
82979
|
} finally {
|
|
82888
82980
|
for (const socket of sockets) {
|
|
82889
82981
|
socket.destroy();
|
|
82890
82982
|
}
|
|
82891
|
-
await new Promise((
|
|
82983
|
+
await new Promise((resolve19) => server.close(() => resolve19()));
|
|
82892
82984
|
await Promise.allSettled(requests);
|
|
82893
82985
|
await platform2.removeControlSocket(path8).catch(() => void 0);
|
|
82894
82986
|
}
|
|
@@ -83231,18 +83323,7 @@ var init_worker_lifecycle_log = __esm({
|
|
|
83231
83323
|
|
|
83232
83324
|
// src/daemon/lifecycle/worker-process.ts
|
|
83233
83325
|
import { spawn as spawn7 } from "node:child_process";
|
|
83234
|
-
import { isAbsolute as isAbsolute13
|
|
83235
|
-
function currentWorkerLaunch(version2) {
|
|
83236
|
-
const entry = process.argv[1];
|
|
83237
|
-
if (entry === void 0 || entry.length === 0) {
|
|
83238
|
-
throw new Error("The Mobius CLI entry path is unavailable");
|
|
83239
|
-
}
|
|
83240
|
-
return {
|
|
83241
|
-
executable: process.execPath,
|
|
83242
|
-
entry: resolve16(entry),
|
|
83243
|
-
version: version2
|
|
83244
|
-
};
|
|
83245
|
-
}
|
|
83326
|
+
import { isAbsolute as isAbsolute13 } from "node:path";
|
|
83246
83327
|
async function decodeWorkerLaunch(value) {
|
|
83247
83328
|
const { entry, executable, version: version2 } = workerLaunch.parse(value);
|
|
83248
83329
|
if (!isAbsolute13(entry) || !isAbsolute13(executable)) {
|
|
@@ -83422,6 +83503,7 @@ async function runManager(stateDirectory, signal) {
|
|
|
83422
83503
|
const shutdown = new AbortController();
|
|
83423
83504
|
const combined = AbortSignal.any([signal, shutdown.signal]);
|
|
83424
83505
|
const lifecycle = new WorkerLifecycleLog(stateDirectory);
|
|
83506
|
+
const workerExits = /* @__PURE__ */ new Set();
|
|
83425
83507
|
let worker;
|
|
83426
83508
|
let switchState = null;
|
|
83427
83509
|
let queue = Promise.resolve();
|
|
@@ -83456,7 +83538,7 @@ async function runManager(stateDirectory, signal) {
|
|
|
83456
83538
|
if (pid !== null) {
|
|
83457
83539
|
lifecycle.ready(pid, launch.version);
|
|
83458
83540
|
}
|
|
83459
|
-
|
|
83541
|
+
const exited = replacement.exited.then(async () => {
|
|
83460
83542
|
await replacement.streamsSettled;
|
|
83461
83543
|
if (pid !== null) {
|
|
83462
83544
|
lifecycle.exited(pid, launch.version, replacement.exit, replacement.stderr);
|
|
@@ -83479,6 +83561,8 @@ async function runManager(stateDirectory, signal) {
|
|
|
83479
83561
|
}
|
|
83480
83562
|
}
|
|
83481
83563
|
});
|
|
83564
|
+
workerExits.add(exited);
|
|
83565
|
+
void exited.finally(() => workerExits.delete(exited));
|
|
83482
83566
|
};
|
|
83483
83567
|
const switchWorker = async (transition2) => {
|
|
83484
83568
|
try {
|
|
@@ -83557,7 +83641,7 @@ async function runManager(stateDirectory, signal) {
|
|
|
83557
83641
|
}
|
|
83558
83642
|
case "ensure": {
|
|
83559
83643
|
const launch = await decodeWorkerLaunch(command.launch);
|
|
83560
|
-
if (!worker?.running || worker.launch.version !== launch.version) {
|
|
83644
|
+
if (!worker?.running || worker.launch.version !== launch.version || worker.launch.entry !== launch.entry || worker.launch.executable !== launch.executable) {
|
|
83561
83645
|
await start(launch);
|
|
83562
83646
|
}
|
|
83563
83647
|
await worker?.ready;
|
|
@@ -83591,6 +83675,7 @@ async function runManager(stateDirectory, signal) {
|
|
|
83591
83675
|
shutdown.abort();
|
|
83592
83676
|
await queue;
|
|
83593
83677
|
await worker?.close();
|
|
83678
|
+
await Promise.all(workerExits);
|
|
83594
83679
|
rejectionGuard.release();
|
|
83595
83680
|
await release();
|
|
83596
83681
|
}
|
|
@@ -83622,10 +83707,191 @@ var init_manager2 = __esm({
|
|
|
83622
83707
|
}
|
|
83623
83708
|
});
|
|
83624
83709
|
|
|
83710
|
+
// src/storage/daemon/release-files.ts
|
|
83711
|
+
import { readFile as readFile10, realpath as realpath8 } from "node:fs/promises";
|
|
83712
|
+
import { join as join28 } from "node:path";
|
|
83713
|
+
function releasePrefix(version2) {
|
|
83714
|
+
return join28(readStateDirectory(), "npm", version2);
|
|
83715
|
+
}
|
|
83716
|
+
async function readInstalledRelease(prefix) {
|
|
83717
|
+
const packageRoot = await realpath8(join28(prefix, "node_modules", "@moxt-ai", "mobius"));
|
|
83718
|
+
return { manifest: await readFile10(join28(packageRoot, "package.json"), "utf8"), packageRoot };
|
|
83719
|
+
}
|
|
83720
|
+
var init_release_files = __esm({
|
|
83721
|
+
"src/storage/daemon/release-files.ts"() {
|
|
83722
|
+
"use strict";
|
|
83723
|
+
init_state_directory();
|
|
83724
|
+
}
|
|
83725
|
+
});
|
|
83726
|
+
|
|
83727
|
+
// src/daemon/upgrades/package.ts
|
|
83728
|
+
import { isAbsolute as isAbsolute14, join as join29, relative as relative3 } from "node:path";
|
|
83729
|
+
async function prepareDaemonReleaseVersion(version2, signal) {
|
|
83730
|
+
runtimeUpgradeVersionSchema.parse(version2);
|
|
83731
|
+
signal.throwIfAborted();
|
|
83732
|
+
const prefix = releasePrefix(version2);
|
|
83733
|
+
let installed;
|
|
83734
|
+
try {
|
|
83735
|
+
installed = await readInstalledRelease(prefix);
|
|
83736
|
+
} catch (cause) {
|
|
83737
|
+
signal.throwIfAborted();
|
|
83738
|
+
if (!isNodeError(cause, "ENOENT")) {
|
|
83739
|
+
throw new DaemonReleaseUpgradeError(
|
|
83740
|
+
"release_read_failed",
|
|
83741
|
+
"The installed Mobius release could not be read",
|
|
83742
|
+
{ cause }
|
|
83743
|
+
);
|
|
83744
|
+
}
|
|
83745
|
+
return await installDaemonReleaseVersion(version2, signal);
|
|
83746
|
+
}
|
|
83747
|
+
try {
|
|
83748
|
+
return await verifyInstalledDaemonRelease(installed, prefix, version2, signal);
|
|
83749
|
+
} catch (cause) {
|
|
83750
|
+
signal.throwIfAborted();
|
|
83751
|
+
if (cause instanceof DaemonReleaseUpgradeError) {
|
|
83752
|
+
throw cause;
|
|
83753
|
+
}
|
|
83754
|
+
throw new DaemonReleaseUpgradeError("release_invalid", "The installed Mobius release could not be verified", {
|
|
83755
|
+
cause
|
|
83756
|
+
});
|
|
83757
|
+
}
|
|
83758
|
+
}
|
|
83759
|
+
async function installDaemonReleaseVersion(version2, signal) {
|
|
83760
|
+
runtimeUpgradeVersionSchema.parse(version2);
|
|
83761
|
+
const npm = await findExecutableOnPath("npm", process.env);
|
|
83762
|
+
if (npm === null) {
|
|
83763
|
+
throw new DaemonReleaseUpgradeError("npm_unavailable", "npm is required to download the new daemon");
|
|
83764
|
+
}
|
|
83765
|
+
const prefix = releasePrefix(version2);
|
|
83766
|
+
await ensurePrivateDirectory(prefix);
|
|
83767
|
+
try {
|
|
83768
|
+
await validateLocalPath(prefix, true, true, signal);
|
|
83769
|
+
await runBoundedProcess({
|
|
83770
|
+
command: npm.path,
|
|
83771
|
+
arguments: [
|
|
83772
|
+
"install",
|
|
83773
|
+
"--prefix",
|
|
83774
|
+
prefix,
|
|
83775
|
+
"--ignore-scripts",
|
|
83776
|
+
"--no-audit",
|
|
83777
|
+
"--no-fund",
|
|
83778
|
+
"--save-exact",
|
|
83779
|
+
"--",
|
|
83780
|
+
`@moxt-ai/mobius@${version2}`
|
|
83781
|
+
],
|
|
83782
|
+
cwd: prefix,
|
|
83783
|
+
environment: process.env,
|
|
83784
|
+
signal,
|
|
83785
|
+
timeoutMilliseconds: 3e5,
|
|
83786
|
+
outputLimitBytes: 64 * 1024
|
|
83787
|
+
});
|
|
83788
|
+
return await verifyInstalledDaemonRelease(await readInstalledRelease(prefix), prefix, version2, signal);
|
|
83789
|
+
} catch (cause) {
|
|
83790
|
+
signal.throwIfAborted();
|
|
83791
|
+
if (cause instanceof DaemonReleaseUpgradeError) {
|
|
83792
|
+
throw cause;
|
|
83793
|
+
}
|
|
83794
|
+
throw new DaemonReleaseUpgradeError(
|
|
83795
|
+
"npm_install_failed",
|
|
83796
|
+
"npm could not install and verify the requested Mobius version",
|
|
83797
|
+
{ cause }
|
|
83798
|
+
);
|
|
83799
|
+
}
|
|
83800
|
+
}
|
|
83801
|
+
async function verifyInstalledDaemonRelease(installed, prefix, version2, signal) {
|
|
83802
|
+
await validateLocalPath(prefix, true, true, signal);
|
|
83803
|
+
const metadata = external_exports.object({
|
|
83804
|
+
name: external_exports.literal("@moxt-ai/mobius"),
|
|
83805
|
+
version: external_exports.literal(version2),
|
|
83806
|
+
bin: external_exports.object({ mobius: external_exports.literal("dist/cli.js") }),
|
|
83807
|
+
engines: external_exports.object({ node: external_exports.string().refine((value) => (0, import_semver.validRange)(value) !== null) })
|
|
83808
|
+
}).parse(JSON.parse(installed.manifest));
|
|
83809
|
+
const entry = await canonicalPath(join29(installed.packageRoot, metadata.bin.mobius));
|
|
83810
|
+
const resolved = relative3(await canonicalPath(prefix), entry);
|
|
83811
|
+
if (resolved.startsWith("..") || isAbsolute14(resolved)) {
|
|
83812
|
+
throw new Error("Installed entry escaped npm prefix");
|
|
83813
|
+
}
|
|
83814
|
+
if (!(0, import_semver.satisfies)(process.versions.node, metadata.engines.node)) {
|
|
83815
|
+
throw new DaemonReleaseUpgradeError(
|
|
83816
|
+
"node_incompatible",
|
|
83817
|
+
`Mobius ${version2} requires Node.js ${metadata.engines.node}; the running daemon uses ${process.versions.node} at ${process.execPath}. Update Node.js before retrying.`
|
|
83818
|
+
);
|
|
83819
|
+
}
|
|
83820
|
+
try {
|
|
83821
|
+
const result = await runBoundedProcess({
|
|
83822
|
+
command: process.execPath,
|
|
83823
|
+
arguments: [entry, "--version"],
|
|
83824
|
+
cwd: prefix,
|
|
83825
|
+
environment: process.env,
|
|
83826
|
+
signal,
|
|
83827
|
+
timeoutMilliseconds: 3e4,
|
|
83828
|
+
outputLimitBytes: 16 * 1024
|
|
83829
|
+
});
|
|
83830
|
+
if (!result.stdout.split(/\r?\n/u).includes(`CLI: ${version2}`)) {
|
|
83831
|
+
throw new Error("Candidate did not report the requested CLI version");
|
|
83832
|
+
}
|
|
83833
|
+
} catch (cause) {
|
|
83834
|
+
signal.throwIfAborted();
|
|
83835
|
+
throw new DaemonReleaseUpgradeError(
|
|
83836
|
+
"release_startup_failed",
|
|
83837
|
+
`Mobius ${version2} startup check failed; the current daemon is unchanged.`,
|
|
83838
|
+
{ cause }
|
|
83839
|
+
);
|
|
83840
|
+
}
|
|
83841
|
+
return await decodeWorkerLaunch({ executable: process.execPath, entry, version: version2 });
|
|
83842
|
+
}
|
|
83843
|
+
async function findNewDaemonReleaseVersion(currentVersion, signal) {
|
|
83844
|
+
const npm = await findExecutableOnPath("npm", process.env);
|
|
83845
|
+
if (npm === null) {
|
|
83846
|
+
throw new DaemonReleaseUpgradeError("npm_unavailable", "npm is required to check for a new daemon");
|
|
83847
|
+
}
|
|
83848
|
+
try {
|
|
83849
|
+
const result = await runBoundedProcess({
|
|
83850
|
+
command: npm.path,
|
|
83851
|
+
arguments: ["view", "@moxt-ai/mobius", "dist-tags.latest", "--json", "--prefer-online"],
|
|
83852
|
+
cwd: process.cwd(),
|
|
83853
|
+
environment: process.env,
|
|
83854
|
+
signal,
|
|
83855
|
+
timeoutMilliseconds: 3e4,
|
|
83856
|
+
outputLimitBytes: 4096
|
|
83857
|
+
});
|
|
83858
|
+
const version2 = npmViewVersionSchema.parse(JSON.parse(result.stdout));
|
|
83859
|
+
return (0, import_semver.gt)(version2, currentVersion) ? version2 : null;
|
|
83860
|
+
} catch (cause) {
|
|
83861
|
+
signal.throwIfAborted();
|
|
83862
|
+
throw new DaemonReleaseUpgradeError("npm_check_failed", "npm could not return a valid latest Mobius version", {
|
|
83863
|
+
cause
|
|
83864
|
+
});
|
|
83865
|
+
}
|
|
83866
|
+
}
|
|
83867
|
+
var import_semver, DaemonReleaseUpgradeError, npmViewVersionSchema;
|
|
83868
|
+
var init_package2 = __esm({
|
|
83869
|
+
"src/daemon/upgrades/package.ts"() {
|
|
83870
|
+
"use strict";
|
|
83871
|
+
init_protocol();
|
|
83872
|
+
import_semver = __toESM(require_semver2(), 1);
|
|
83873
|
+
init_zod();
|
|
83874
|
+
init_release_files();
|
|
83875
|
+
init_local_files();
|
|
83876
|
+
init_private_path();
|
|
83877
|
+
init_node_error();
|
|
83878
|
+
init_executable();
|
|
83879
|
+
init_worker_process();
|
|
83880
|
+
DaemonReleaseUpgradeError = class extends Error {
|
|
83881
|
+
code;
|
|
83882
|
+
constructor(code, message, options) {
|
|
83883
|
+
super(message, options);
|
|
83884
|
+
this.code = code;
|
|
83885
|
+
}
|
|
83886
|
+
};
|
|
83887
|
+
npmViewVersionSchema = external_exports.union([runtimeUpgradeVersionSchema, external_exports.tuple([runtimeUpgradeVersionSchema])]).transform((value) => typeof value === "string" ? value : value[0]);
|
|
83888
|
+
}
|
|
83889
|
+
});
|
|
83890
|
+
|
|
83625
83891
|
// src/daemon/lifecycle/manager-client.ts
|
|
83626
83892
|
import { spawn as spawn8 } from "node:child_process";
|
|
83627
|
-
async function spawnManager() {
|
|
83628
|
-
const child = spawn8(
|
|
83893
|
+
async function spawnManager(launch) {
|
|
83894
|
+
const child = spawn8(launch.executable, [launch.entry, "__manager"], {
|
|
83629
83895
|
detached: true,
|
|
83630
83896
|
windowsHide: true,
|
|
83631
83897
|
env: process.env,
|
|
@@ -83634,10 +83900,10 @@ async function spawnManager() {
|
|
|
83634
83900
|
child.unref();
|
|
83635
83901
|
return child;
|
|
83636
83902
|
}
|
|
83637
|
-
async function launchManager(
|
|
83638
|
-
process.stdout.write(`Starting mobius daemon ${
|
|
83903
|
+
async function launchManager(launch) {
|
|
83904
|
+
process.stdout.write(`Starting mobius daemon ${launch.version}
|
|
83639
83905
|
`);
|
|
83640
|
-
await spawnManager();
|
|
83906
|
+
await spawnManager(launch);
|
|
83641
83907
|
}
|
|
83642
83908
|
async function waitForManagerExit(stateDirectory, signal) {
|
|
83643
83909
|
const deadline = AbortSignal.any([signal, AbortSignal.timeout(3e4)]);
|
|
@@ -83645,13 +83911,13 @@ async function waitForManagerExit(stateDirectory, signal) {
|
|
|
83645
83911
|
if (!await managerLockExists(stateDirectory)) {
|
|
83646
83912
|
return;
|
|
83647
83913
|
}
|
|
83648
|
-
await new Promise((
|
|
83914
|
+
await new Promise((resolve19, reject2) => {
|
|
83649
83915
|
const timeout = setTimeout(finish, 20);
|
|
83650
83916
|
const abort = () => finish(deadline.reason);
|
|
83651
83917
|
function finish(cause) {
|
|
83652
83918
|
clearTimeout(timeout);
|
|
83653
83919
|
deadline.removeEventListener("abort", abort);
|
|
83654
|
-
cause === void 0 ?
|
|
83920
|
+
cause === void 0 ? resolve19() : reject2(cause);
|
|
83655
83921
|
}
|
|
83656
83922
|
deadline.addEventListener("abort", abort, { once: true });
|
|
83657
83923
|
});
|
|
@@ -83659,15 +83925,11 @@ async function waitForManagerExit(stateDirectory, signal) {
|
|
|
83659
83925
|
throw deadline.reason;
|
|
83660
83926
|
}
|
|
83661
83927
|
async function ensureWorkingProcess(stateDirectory, version2, signal) {
|
|
83928
|
+
const launch = await prepareDaemonReleaseVersion(version2, signal);
|
|
83662
83929
|
const deadline = AbortSignal.any([signal, AbortSignal.timeout(CONTROL_TIMEOUT_MILLISECONDS)]);
|
|
83663
|
-
await ensureManager(stateDirectory,
|
|
83930
|
+
await ensureManager(stateDirectory, launch, deadline);
|
|
83664
83931
|
const response = lifecycleResponse.parse(
|
|
83665
|
-
await sendLocalRequest(
|
|
83666
|
-
stateDirectory,
|
|
83667
|
-
"manager",
|
|
83668
|
-
{ kind: "ensure", launch: currentWorkerLaunch(version2) },
|
|
83669
|
-
deadline
|
|
83670
|
-
)
|
|
83932
|
+
await sendLocalRequest(stateDirectory, "manager", { kind: "ensure", launch }, deadline)
|
|
83671
83933
|
);
|
|
83672
83934
|
if (response.kind === "error") {
|
|
83673
83935
|
throw new Error(response.message);
|
|
@@ -83691,7 +83953,7 @@ async function readWorkingProcessVersion(stateDirectory, signal) {
|
|
|
83691
83953
|
}
|
|
83692
83954
|
return null;
|
|
83693
83955
|
}
|
|
83694
|
-
async function ensureManager(stateDirectory,
|
|
83956
|
+
async function ensureManager(stateDirectory, launch, signal) {
|
|
83695
83957
|
let managerStarted = false;
|
|
83696
83958
|
while (!signal.aborted) {
|
|
83697
83959
|
try {
|
|
@@ -83700,29 +83962,29 @@ async function ensureManager(stateDirectory, managerVersion, signal) {
|
|
|
83700
83962
|
);
|
|
83701
83963
|
if (response.success && response.data.kind === "status") {
|
|
83702
83964
|
if (managerStarted) {
|
|
83703
|
-
process.stdout.write(`Mobius daemon ${
|
|
83965
|
+
process.stdout.write(`Mobius daemon ${launch.version} started
|
|
83704
83966
|
`);
|
|
83705
83967
|
}
|
|
83706
83968
|
return;
|
|
83707
83969
|
}
|
|
83708
83970
|
await stopManager(stateDirectory, signal);
|
|
83709
|
-
await launchManager(
|
|
83971
|
+
await launchManager(launch);
|
|
83710
83972
|
managerStarted = true;
|
|
83711
83973
|
} catch (cause) {
|
|
83712
83974
|
if (!isNodeError(cause, "ENOENT") && !isNodeError(cause, "ECONNREFUSED")) {
|
|
83713
83975
|
throw cause;
|
|
83714
83976
|
}
|
|
83715
83977
|
if (!managerStarted) {
|
|
83716
|
-
await launchManager(
|
|
83978
|
+
await launchManager(launch);
|
|
83717
83979
|
managerStarted = true;
|
|
83718
83980
|
}
|
|
83719
|
-
await new Promise((
|
|
83981
|
+
await new Promise((resolve19, reject2) => {
|
|
83720
83982
|
const timeout = setTimeout(finish, 50);
|
|
83721
83983
|
const abort = () => finish(signal.reason);
|
|
83722
83984
|
function finish(cause2) {
|
|
83723
83985
|
clearTimeout(timeout);
|
|
83724
83986
|
signal.removeEventListener("abort", abort);
|
|
83725
|
-
cause2 === void 0 ?
|
|
83987
|
+
cause2 === void 0 ? resolve19() : reject2(cause2);
|
|
83726
83988
|
}
|
|
83727
83989
|
signal.addEventListener("abort", abort, { once: true });
|
|
83728
83990
|
});
|
|
@@ -83757,7 +84019,7 @@ var init_manager_client = __esm({
|
|
|
83757
84019
|
init_node_error();
|
|
83758
84020
|
init_local_client();
|
|
83759
84021
|
init_protocol2();
|
|
83760
|
-
|
|
84022
|
+
init_package2();
|
|
83761
84023
|
}
|
|
83762
84024
|
});
|
|
83763
84025
|
|
|
@@ -83812,7 +84074,7 @@ var init_native_session = __esm({
|
|
|
83812
84074
|
});
|
|
83813
84075
|
|
|
83814
84076
|
// src/acp/content/raster.ts
|
|
83815
|
-
import { basename as basename6, isAbsolute as
|
|
84077
|
+
import { basename as basename6, isAbsolute as isAbsolute15, normalize } from "node:path";
|
|
83816
84078
|
import { fileURLToPath } from "node:url";
|
|
83817
84079
|
function startsWith(bytes, signature, offset = 0) {
|
|
83818
84080
|
if (bytes.byteLength < offset + signature.byteLength) {
|
|
@@ -83837,13 +84099,13 @@ function sniffRasterMime(bytes) {
|
|
|
83837
84099
|
}
|
|
83838
84100
|
async function resolveCanonicalPath(requested, signal) {
|
|
83839
84101
|
signal.throwIfAborted();
|
|
83840
|
-
if (!
|
|
84102
|
+
if (!isAbsolute15(requested) || requested.includes("\0") || normalize(requested) !== requested) {
|
|
83841
84103
|
return null;
|
|
83842
84104
|
}
|
|
83843
84105
|
try {
|
|
83844
84106
|
const target = await canonicalPath(requested);
|
|
83845
84107
|
signal.throwIfAborted();
|
|
83846
|
-
if (!
|
|
84108
|
+
if (!isAbsolute15(target) || normalize(target) !== target) {
|
|
83847
84109
|
return null;
|
|
83848
84110
|
}
|
|
83849
84111
|
return target;
|
|
@@ -83874,7 +84136,7 @@ function parseLocalImageUri(uri) {
|
|
|
83874
84136
|
return null;
|
|
83875
84137
|
}
|
|
83876
84138
|
}
|
|
83877
|
-
if (!
|
|
84139
|
+
if (!isAbsolute15(trimmed) && /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed)) {
|
|
83878
84140
|
return null;
|
|
83879
84141
|
}
|
|
83880
84142
|
return trimmed;
|
|
@@ -85989,7 +86251,7 @@ function arrayOverlaps(column, values) {
|
|
|
85989
86251
|
}
|
|
85990
86252
|
return sql`${column} && ${bindIfParam(values, column)}`;
|
|
85991
86253
|
}
|
|
85992
|
-
var eq2, ne,
|
|
86254
|
+
var eq2, ne, gt3, gte2, lt2, lte2;
|
|
85993
86255
|
var init_conditions = __esm({
|
|
85994
86256
|
"../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.4_@cloudflare+workers-types@5.20261007.1_@types+better-sqlite3@7.6_b0c6d3ccc291c2479f0b2dd204176291/node_modules/drizzle-orm/sql/expressions/conditions.js"() {
|
|
85995
86257
|
init_sql();
|
|
@@ -86002,7 +86264,7 @@ var init_conditions = __esm({
|
|
|
86002
86264
|
ne = (left, right) => {
|
|
86003
86265
|
return sql`${left} <> ${bindIfParam(right, left)}`;
|
|
86004
86266
|
};
|
|
86005
|
-
|
|
86267
|
+
gt3 = (left, right) => {
|
|
86006
86268
|
return sql`${left} > ${bindIfParam(right, left)}`;
|
|
86007
86269
|
};
|
|
86008
86270
|
gte2 = (left, right) => {
|
|
@@ -86885,7 +87147,7 @@ var init_relations = __esm({
|
|
|
86885
87147
|
between,
|
|
86886
87148
|
eq: eq2,
|
|
86887
87149
|
exists,
|
|
86888
|
-
gt:
|
|
87150
|
+
gt: gt3,
|
|
86889
87151
|
gte: gte2,
|
|
86890
87152
|
ilike,
|
|
86891
87153
|
inArray,
|
|
@@ -91051,12 +91313,12 @@ var init_local_sqlite_database = __esm({
|
|
|
91051
91313
|
|
|
91052
91314
|
// src/storage/sqlite/local-databases.ts
|
|
91053
91315
|
import { createHash as createHash5 } from "node:crypto";
|
|
91054
|
-
import { join as
|
|
91316
|
+
import { join as join30 } from "node:path";
|
|
91055
91317
|
function channelSessionDatabasePaths(stateDirectory, channelId) {
|
|
91056
91318
|
const channelHash = createHash5("sha256").update(channelId).digest("hex");
|
|
91057
91319
|
return {
|
|
91058
|
-
events:
|
|
91059
|
-
sessions:
|
|
91320
|
+
events: join30(stateDirectory, "sessions", `${channelHash}.events.sqlite`),
|
|
91321
|
+
sessions: join30(stateDirectory, "sessions", `${channelHash}.sqlite`)
|
|
91060
91322
|
};
|
|
91061
91323
|
}
|
|
91062
91324
|
var openAcpSessionDatabase, openSessionEventCacheDatabase;
|
|
@@ -91077,8 +91339,8 @@ var init_local_databases = __esm({
|
|
|
91077
91339
|
|
|
91078
91340
|
// src/storage/files/scratch-directory.ts
|
|
91079
91341
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
91080
|
-
import { lstat as lstat6, mkdir as mkdir5, readdir as readdir7, realpath as
|
|
91081
|
-
import { dirname as dirname10, join as
|
|
91342
|
+
import { lstat as lstat6, mkdir as mkdir5, readdir as readdir7, realpath as realpath9, rename as rename5, rm as rm4, stat as stat7, utimes, writeFile as writeFile5 } from "node:fs/promises";
|
|
91343
|
+
import { dirname as dirname10, join as join31 } from "node:path";
|
|
91082
91344
|
async function atomicWrite(path8, bytes, signal) {
|
|
91083
91345
|
const temporary = `${path8}.${randomUUID11()}.tmp`;
|
|
91084
91346
|
try {
|
|
@@ -91096,7 +91358,7 @@ var init_scratch_directory = __esm({
|
|
|
91096
91358
|
ScratchDirectory = class {
|
|
91097
91359
|
#root;
|
|
91098
91360
|
constructor(parent) {
|
|
91099
|
-
this.#root =
|
|
91361
|
+
this.#root = join31(parent, randomUUID11());
|
|
91100
91362
|
}
|
|
91101
91363
|
/** Refreshes this directory's lease and removes sibling directories whose lease is older than `leaseMilliseconds`. */
|
|
91102
91364
|
refreshLease = async (leaseMilliseconds) => {
|
|
@@ -91107,7 +91369,7 @@ var init_scratch_directory = __esm({
|
|
|
91107
91369
|
if (!directory.isDirectory() || !/^[a-f0-9-]{36}$/u.test(directory.name)) {
|
|
91108
91370
|
continue;
|
|
91109
91371
|
}
|
|
91110
|
-
const path8 =
|
|
91372
|
+
const path8 = join31(dirname10(this.#root), directory.name);
|
|
91111
91373
|
if (path8 === this.#root) {
|
|
91112
91374
|
continue;
|
|
91113
91375
|
}
|
|
@@ -91122,10 +91384,10 @@ var init_scratch_directory = __esm({
|
|
|
91122
91384
|
};
|
|
91123
91385
|
/** Writes `bytes` atomically to `<group>/<name>` with owner-only permissions and returns the path. */
|
|
91124
91386
|
write = async (group, name2, bytes, signal) => {
|
|
91125
|
-
const directory =
|
|
91387
|
+
const directory = join31(this.#root, group);
|
|
91126
91388
|
await mkdir5(directory, { mode: 448, recursive: true });
|
|
91127
91389
|
signal.throwIfAborted();
|
|
91128
|
-
const path8 =
|
|
91390
|
+
const path8 = join31(directory, name2);
|
|
91129
91391
|
await atomicWrite(path8, bytes, signal);
|
|
91130
91392
|
return path8;
|
|
91131
91393
|
};
|
|
@@ -91136,8 +91398,8 @@ var init_scratch_directory = __esm({
|
|
|
91136
91398
|
resolveFile = async (path8) => {
|
|
91137
91399
|
try {
|
|
91138
91400
|
const [resolvedDirectory, resolvedPath, file2] = await Promise.all([
|
|
91139
|
-
|
|
91140
|
-
|
|
91401
|
+
realpath9(dirname10(path8)),
|
|
91402
|
+
realpath9(path8),
|
|
91141
91403
|
lstat6(path8)
|
|
91142
91404
|
]);
|
|
91143
91405
|
return file2.isFile() && !file2.isSymbolicLink() && dirname10(resolvedPath) === resolvedDirectory ? resolvedPath : null;
|
|
@@ -91154,7 +91416,7 @@ var init_scratch_directory = __esm({
|
|
|
91154
91416
|
|
|
91155
91417
|
// src/session/content/external-content-store.ts
|
|
91156
91418
|
import { createHash as createHash6 } from "node:crypto";
|
|
91157
|
-
import { join as
|
|
91419
|
+
import { join as join32 } from "node:path";
|
|
91158
91420
|
var contentRequest, CONTENT_LIFETIME_MILLISECONDS, metadataSchema, LocalExternalContentStore;
|
|
91159
91421
|
var init_external_content_store = __esm({
|
|
91160
91422
|
"src/session/content/external-content-store.ts"() {
|
|
@@ -91176,7 +91438,7 @@ var init_external_content_store = __esm({
|
|
|
91176
91438
|
#expirationTimer;
|
|
91177
91439
|
#cleanup = Promise.resolve();
|
|
91178
91440
|
constructor(stateDirectory) {
|
|
91179
|
-
this.#scratch = new ScratchDirectory(
|
|
91441
|
+
this.#scratch = new ScratchDirectory(join32(stateDirectory, "tmp", "session-content"));
|
|
91180
91442
|
this.#expirationTimer = setInterval(() => {
|
|
91181
91443
|
void this.#expire().catch(() => void 0);
|
|
91182
91444
|
}, 6e4);
|
|
@@ -91370,10 +91632,10 @@ var init_session_event_history_projection = __esm({
|
|
|
91370
91632
|
SessionEventHistoryProjection = class {
|
|
91371
91633
|
#toolCallEventIds = /* @__PURE__ */ new Map();
|
|
91372
91634
|
#latestEvent = null;
|
|
91373
|
-
apply = (liveEvent2,
|
|
91635
|
+
apply = (liveEvent2, resolve19) => {
|
|
91374
91636
|
if (liveEvent2.type === "acp" && liveEvent2.payload.sessionUpdate === "tool_call_update") {
|
|
91375
91637
|
const targetEventId = this.#toolCallEventIds.get(liveEvent2.payload.toolCallId);
|
|
91376
|
-
const current = targetEventId === void 0 ? void 0 :
|
|
91638
|
+
const current = targetEventId === void 0 ? void 0 : resolve19([targetEventId]).get(targetEventId);
|
|
91377
91639
|
if (current?.type === "acp" && (current.payload.sessionUpdate === "tool_call" || current.payload.sessionUpdate === "tool_call_update")) {
|
|
91378
91640
|
return this.#replace(
|
|
91379
91641
|
current,
|
|
@@ -91397,12 +91659,12 @@ var init_session_event_history_projection = __esm({
|
|
|
91397
91659
|
* The projected tool call announced with this identifier, in its current
|
|
91398
91660
|
* merged form, or `undefined` when the projection has not recorded one.
|
|
91399
91661
|
*/
|
|
91400
|
-
getToolCall = (toolCallId,
|
|
91662
|
+
getToolCall = (toolCallId, resolve19) => {
|
|
91401
91663
|
const eventId = this.#toolCallEventIds.get(toolCallId);
|
|
91402
91664
|
if (eventId === void 0) {
|
|
91403
91665
|
return void 0;
|
|
91404
91666
|
}
|
|
91405
|
-
const event =
|
|
91667
|
+
const event = resolve19([eventId]).get(eventId);
|
|
91406
91668
|
if (event?.type === "acp" && (event.payload.sessionUpdate === "tool_call" || event.payload.sessionUpdate === "tool_call_update")) {
|
|
91407
91669
|
return event.payload;
|
|
91408
91670
|
}
|
|
@@ -91497,8 +91759,8 @@ var init_session_event_store = __esm({
|
|
|
91497
91759
|
this.sessionGenerationId = sessionGenerationId;
|
|
91498
91760
|
this.#projection = new SessionEventHistoryProjection();
|
|
91499
91761
|
}
|
|
91500
|
-
apply = (event,
|
|
91501
|
-
const projected = this.#projection.apply(event,
|
|
91762
|
+
apply = (event, resolve19) => {
|
|
91763
|
+
const projected = this.#projection.apply(event, resolve19);
|
|
91502
91764
|
this.#throughPosition = event.position;
|
|
91503
91765
|
if (projected.kind === "replace") {
|
|
91504
91766
|
const current = this.#cachedItemsByEventId.get(projected.replacedEventId);
|
|
@@ -91520,7 +91782,7 @@ var init_session_event_store = __esm({
|
|
|
91520
91782
|
return this.#cachedItemsByEventId.size;
|
|
91521
91783
|
}
|
|
91522
91784
|
/** The projected tool call for this identifier, materializing it if needed. */
|
|
91523
|
-
toolCall = (toolCallId,
|
|
91785
|
+
toolCall = (toolCallId, resolve19) => this.#projection.getToolCall(toolCallId, resolve19);
|
|
91524
91786
|
endIndex = (cursor) => {
|
|
91525
91787
|
if (cursor === null) {
|
|
91526
91788
|
return this.#eventIds.length;
|
|
@@ -92004,7 +92266,7 @@ function createWritableAcpStream(output2) {
|
|
|
92004
92266
|
if (outputFailure !== void 0) {
|
|
92005
92267
|
return Promise.reject(outputFailure);
|
|
92006
92268
|
}
|
|
92007
|
-
return new Promise((
|
|
92269
|
+
return new Promise((resolve19, reject2) => {
|
|
92008
92270
|
pendingWriteFailures.add(reject2);
|
|
92009
92271
|
output2.write(chunk, (error62) => {
|
|
92010
92272
|
pendingWriteFailures.delete(reject2);
|
|
@@ -92017,7 +92279,7 @@ function createWritableAcpStream(output2) {
|
|
|
92017
92279
|
reject2(outputFailure);
|
|
92018
92280
|
return;
|
|
92019
92281
|
}
|
|
92020
|
-
|
|
92282
|
+
resolve19();
|
|
92021
92283
|
});
|
|
92022
92284
|
});
|
|
92023
92285
|
}
|
|
@@ -92069,12 +92331,12 @@ var init_agent_connection = __esm({
|
|
|
92069
92331
|
stderr.on("data", (chunk) => {
|
|
92070
92332
|
process.stderr.write(`[${agent.id}-acp] ${chunk}`);
|
|
92071
92333
|
});
|
|
92072
|
-
this.termination = new Promise((
|
|
92334
|
+
this.termination = new Promise((resolve19) => {
|
|
92073
92335
|
child.once("error", (cause) => {
|
|
92074
|
-
|
|
92336
|
+
resolve19({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
|
|
92075
92337
|
});
|
|
92076
92338
|
child.once("exit", (code, signal) => {
|
|
92077
|
-
|
|
92339
|
+
resolve19({
|
|
92078
92340
|
kind: "failed",
|
|
92079
92341
|
error: new AcpExecutionError("The ACP process stopped", { cause: { code, signal } })
|
|
92080
92342
|
});
|
|
@@ -96830,7 +97092,7 @@ var init_runtime_turn_activity = __esm({
|
|
|
96830
97092
|
if (this.#admission.kind !== "open") {
|
|
96831
97093
|
throw new Error("A daemon upgrade already owns admission");
|
|
96832
97094
|
}
|
|
96833
|
-
return new Promise((
|
|
97095
|
+
return new Promise((resolve19, reject2) => {
|
|
96834
97096
|
const abort = () => {
|
|
96835
97097
|
this.#admission = { kind: "open" };
|
|
96836
97098
|
signal.removeEventListener("abort", abort);
|
|
@@ -96839,7 +97101,7 @@ var init_runtime_turn_activity = __esm({
|
|
|
96839
97101
|
const reserve = () => {
|
|
96840
97102
|
this.#admission = { kind: "reserved" };
|
|
96841
97103
|
signal.removeEventListener("abort", abort);
|
|
96842
|
-
|
|
97104
|
+
resolve19({
|
|
96843
97105
|
[Symbol.dispose]: () => {
|
|
96844
97106
|
this.#admission = { kind: "open" };
|
|
96845
97107
|
}
|
|
@@ -96971,7 +97233,7 @@ var init_session_execution = __esm({
|
|
|
96971
97233
|
init_active_turn();
|
|
96972
97234
|
waitForTurnCompletion = (turn, waitSignal) => {
|
|
96973
97235
|
waitSignal.throwIfAborted();
|
|
96974
|
-
return new Promise((
|
|
97236
|
+
return new Promise((resolve19, reject2) => {
|
|
96975
97237
|
let settled = false;
|
|
96976
97238
|
const finish = (result) => {
|
|
96977
97239
|
if (settled) {
|
|
@@ -96980,7 +97242,7 @@ var init_session_execution = __esm({
|
|
|
96980
97242
|
settled = true;
|
|
96981
97243
|
waitSignal.removeEventListener("abort", onAbort);
|
|
96982
97244
|
if (result.kind === "completed") {
|
|
96983
|
-
|
|
97245
|
+
resolve19();
|
|
96984
97246
|
} else {
|
|
96985
97247
|
reject2(result.error);
|
|
96986
97248
|
}
|
|
@@ -97173,7 +97435,7 @@ var init_session_turns = __esm({
|
|
|
97173
97435
|
|
|
97174
97436
|
// src/session/workspace/workspace-directory.ts
|
|
97175
97437
|
import { homedir as homedir4 } from "node:os";
|
|
97176
|
-
import { basename as basename7, dirname as dirname11, isAbsolute as
|
|
97438
|
+
import { basename as basename7, dirname as dirname11, isAbsolute as isAbsolute16, join as join33, normalize as normalize2, relative as relative4 } from "node:path";
|
|
97177
97439
|
function encodePath(path8) {
|
|
97178
97440
|
const encoded = Buffer.from(path8, "utf8").toString("base64url");
|
|
97179
97441
|
if (path8.length === 0 || path8.length > MAX_WORKSPACE_PATH_LENGTH || encoded.length + "path-".length > MAX_DIRECTORY_IDENTIFIER_LENGTH) {
|
|
@@ -97236,7 +97498,7 @@ var init_workspace_directory = __esm({
|
|
|
97236
97498
|
}
|
|
97237
97499
|
if (id.startsWith("path-")) {
|
|
97238
97500
|
const path8 = expandCurrentUserHome(decodePath(id, "path-"));
|
|
97239
|
-
if (
|
|
97501
|
+
if (isAbsolute16(path8)) {
|
|
97240
97502
|
return path8;
|
|
97241
97503
|
}
|
|
97242
97504
|
}
|
|
@@ -97244,7 +97506,7 @@ var init_workspace_directory = __esm({
|
|
|
97244
97506
|
};
|
|
97245
97507
|
resolvePath = async (requested, signal) => {
|
|
97246
97508
|
signal.throwIfAborted();
|
|
97247
|
-
if (!
|
|
97509
|
+
if (!isAbsolute16(requested) || requested.includes("\0") || normalize2(requested) !== requested) {
|
|
97248
97510
|
throw new LocalAuthorizationError("The local directory path is invalid");
|
|
97249
97511
|
}
|
|
97250
97512
|
try {
|
|
@@ -97252,7 +97514,7 @@ var init_workspace_directory = __esm({
|
|
|
97252
97514
|
signal.throwIfAborted();
|
|
97253
97515
|
const metadata = await readPathMetadata(target);
|
|
97254
97516
|
signal.throwIfAborted();
|
|
97255
|
-
if (!
|
|
97517
|
+
if (!isAbsolute16(target) || normalize2(target) !== target || metadata.kind !== "directory") {
|
|
97256
97518
|
throw new LocalAuthorizationError("The selected location is not a directory");
|
|
97257
97519
|
}
|
|
97258
97520
|
return target;
|
|
@@ -97267,8 +97529,8 @@ var init_workspace_directory = __esm({
|
|
|
97267
97529
|
}
|
|
97268
97530
|
};
|
|
97269
97531
|
label = (path8) => {
|
|
97270
|
-
const suffix =
|
|
97271
|
-
return suffix === "" ? "~" : !
|
|
97532
|
+
const suffix = relative4(homedir4(), path8);
|
|
97533
|
+
return suffix === "" ? "~" : !isAbsolute16(suffix) && suffix !== ".." && !suffix.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) ? `~/${suffix.replaceAll("\\", "/")}` : path8;
|
|
97272
97534
|
};
|
|
97273
97535
|
identify = async (bindingId, requestedPath2, signal) => {
|
|
97274
97536
|
this.authorizeMachine(bindingId);
|
|
@@ -97298,7 +97560,7 @@ var init_workspace_directory = __esm({
|
|
|
97298
97560
|
continue;
|
|
97299
97561
|
}
|
|
97300
97562
|
try {
|
|
97301
|
-
const path8 = await this.resolvePath(
|
|
97563
|
+
const path8 = await this.resolvePath(join33(target, child.name), signal);
|
|
97302
97564
|
entries.push({ directoryId: encodePath(path8), name: child.name });
|
|
97303
97565
|
} catch (cause) {
|
|
97304
97566
|
signal.throwIfAborted();
|
|
@@ -97474,7 +97736,7 @@ var init_session_layer = __esm({
|
|
|
97474
97736
|
});
|
|
97475
97737
|
|
|
97476
97738
|
// src/runtime/observability/diagnostic-log.ts
|
|
97477
|
-
import { join as
|
|
97739
|
+
import { join as join34 } from "node:path";
|
|
97478
97740
|
function exportedFields(value) {
|
|
97479
97741
|
const entry = {};
|
|
97480
97742
|
for (const field of REMOTE_DIAGNOSTIC_FIELDS) {
|
|
@@ -97543,7 +97805,7 @@ var init_diagnostic_log = __esm({
|
|
|
97543
97805
|
this.#maximumBytes = maximumBytes;
|
|
97544
97806
|
const processLogsDirectory = options.processLogsDirectory;
|
|
97545
97807
|
this.#sources = [
|
|
97546
|
-
{ maximumBytes, path:
|
|
97808
|
+
{ maximumBytes, path: join34(directory, DAEMON_LOG_FILENAME) },
|
|
97547
97809
|
// The process logs a Runtime does not own, but must read to explain its own deaths.
|
|
97548
97810
|
...processLogsDirectory === void 0 ? [] : processLogPaths(processLogsDirectory).map((path8) => ({ maximumBytes: null, path: path8 }))
|
|
97549
97811
|
];
|
|
@@ -97754,6 +98016,169 @@ var init_diagnostics2 = __esm({
|
|
|
97754
98016
|
}
|
|
97755
98017
|
});
|
|
97756
98018
|
|
|
98019
|
+
// src/runtime/command/transport.ts
|
|
98020
|
+
import { WebSocket as WebSocket2 } from "undici";
|
|
98021
|
+
function send(socket, message) {
|
|
98022
|
+
if (socket.readyState !== WebSocket2.OPEN) {
|
|
98023
|
+
throw new Error("Relay connection is not open");
|
|
98024
|
+
}
|
|
98025
|
+
socket.send(encodeDaemonToServiceMessage(message));
|
|
98026
|
+
}
|
|
98027
|
+
function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTimings = []) {
|
|
98028
|
+
if (socket.readyState !== WebSocket2.OPEN) {
|
|
98029
|
+
return;
|
|
98030
|
+
}
|
|
98031
|
+
send(socket, {
|
|
98032
|
+
code: operationErrorCode(error62),
|
|
98033
|
+
kind: "session.operation.failed",
|
|
98034
|
+
message: operationErrorMessage(error62),
|
|
98035
|
+
requestId,
|
|
98036
|
+
...runtimeTimings.length === 0 ? {} : { runtimeTimings },
|
|
98037
|
+
sessionId
|
|
98038
|
+
});
|
|
98039
|
+
}
|
|
98040
|
+
var init_transport = __esm({
|
|
98041
|
+
"src/runtime/command/transport.ts"() {
|
|
98042
|
+
"use strict";
|
|
98043
|
+
init_protocol();
|
|
98044
|
+
init_operation_error();
|
|
98045
|
+
}
|
|
98046
|
+
});
|
|
98047
|
+
|
|
98048
|
+
// src/runtime/catalog/handle-agent-catalog-discovery.ts
|
|
98049
|
+
import { WebSocket as WebSocket3 } from "undici";
|
|
98050
|
+
function discoveredEvent(command, agents) {
|
|
98051
|
+
return {
|
|
98052
|
+
agents: agents.map((agent) => ({
|
|
98053
|
+
agentVersion: agent.agentVersion,
|
|
98054
|
+
id: agent.id,
|
|
98055
|
+
label: agent.label
|
|
98056
|
+
})),
|
|
98057
|
+
kind: "agent.catalog.discovered",
|
|
98058
|
+
requestId: command.requestId
|
|
98059
|
+
};
|
|
98060
|
+
}
|
|
98061
|
+
function createAgentCatalogDiscoveryHandler(dependencies) {
|
|
98062
|
+
const { config: config2, discover, diagnostics, socket, signal, timer } = dependencies;
|
|
98063
|
+
const requestIds = /* @__PURE__ */ new Set();
|
|
98064
|
+
let controller = null;
|
|
98065
|
+
let completion = null;
|
|
98066
|
+
const handle = (command) => {
|
|
98067
|
+
if (requestIds.has(command.requestId) || controller !== null) {
|
|
98068
|
+
if (socket.readyState === WebSocket3.OPEN) {
|
|
98069
|
+
send(socket, {
|
|
98070
|
+
code: "agent_catalog_discovery_busy",
|
|
98071
|
+
kind: AGENT_CATALOG_DISCOVERY_FAILED_KIND,
|
|
98072
|
+
message: "An Agent catalog discovery is already running",
|
|
98073
|
+
requestId: command.requestId
|
|
98074
|
+
});
|
|
98075
|
+
}
|
|
98076
|
+
return;
|
|
98077
|
+
}
|
|
98078
|
+
controller = new AbortController();
|
|
98079
|
+
requestIds.add(command.requestId);
|
|
98080
|
+
const operationSignal = AbortSignal.any([signal, controller.signal]);
|
|
98081
|
+
const timeout = timer.schedule(
|
|
98082
|
+
() => controller?.abort(new Error("Agent catalog discovery timed out")),
|
|
98083
|
+
CATALOG_DISCOVERY_TIMEOUT_MILLISECONDS
|
|
98084
|
+
);
|
|
98085
|
+
completion = (async () => {
|
|
98086
|
+
try {
|
|
98087
|
+
const readyAgents = await discover(operationSignal);
|
|
98088
|
+
operationSignal.throwIfAborted();
|
|
98089
|
+
const published = await config2.catalog.replaceAndPublish(
|
|
98090
|
+
() => readyAgents.map((agent) => withRuntimeEnvironment(agent, config2.localContext.environment)),
|
|
98091
|
+
(publishSignal) => publishAgentCatalog(config2, publishSignal),
|
|
98092
|
+
operationSignal
|
|
98093
|
+
);
|
|
98094
|
+
operationSignal.throwIfAborted();
|
|
98095
|
+
if (socket.readyState === WebSocket3.OPEN) {
|
|
98096
|
+
send(
|
|
98097
|
+
socket,
|
|
98098
|
+
discoveredEvent(
|
|
98099
|
+
command,
|
|
98100
|
+
published.agents.map((agent) => ({
|
|
98101
|
+
agentVersion: agent.agentVersion,
|
|
98102
|
+
id: agent.id,
|
|
98103
|
+
label: agent.label
|
|
98104
|
+
}))
|
|
98105
|
+
)
|
|
98106
|
+
);
|
|
98107
|
+
}
|
|
98108
|
+
} catch (error62) {
|
|
98109
|
+
diagnostics.daemonDiagnostic(
|
|
98110
|
+
"agent_catalog_discovery_failed",
|
|
98111
|
+
command.requestId,
|
|
98112
|
+
{ code: operationErrorCode(error62) },
|
|
98113
|
+
error62
|
|
98114
|
+
);
|
|
98115
|
+
if (socket.readyState === WebSocket3.OPEN) {
|
|
98116
|
+
send(socket, {
|
|
98117
|
+
code: operationErrorCode(error62),
|
|
98118
|
+
kind: AGENT_CATALOG_DISCOVERY_FAILED_KIND,
|
|
98119
|
+
message: operationErrorMessage(error62),
|
|
98120
|
+
requestId: command.requestId
|
|
98121
|
+
});
|
|
98122
|
+
}
|
|
98123
|
+
} finally {
|
|
98124
|
+
timeout.cancel();
|
|
98125
|
+
requestIds.delete(command.requestId);
|
|
98126
|
+
controller = null;
|
|
98127
|
+
completion = null;
|
|
98128
|
+
}
|
|
98129
|
+
})();
|
|
98130
|
+
};
|
|
98131
|
+
const settle2 = async () => {
|
|
98132
|
+
await (completion ?? Promise.resolve());
|
|
98133
|
+
};
|
|
98134
|
+
return { handle, settle: settle2 };
|
|
98135
|
+
}
|
|
98136
|
+
var CATALOG_DISCOVERY_TIMEOUT_MILLISECONDS;
|
|
98137
|
+
var init_handle_agent_catalog_discovery = __esm({
|
|
98138
|
+
"src/runtime/catalog/handle-agent-catalog-discovery.ts"() {
|
|
98139
|
+
"use strict";
|
|
98140
|
+
init_protocol();
|
|
98141
|
+
init_operation_error();
|
|
98142
|
+
init_transport();
|
|
98143
|
+
init_config();
|
|
98144
|
+
init_publish_agent_catalog();
|
|
98145
|
+
CATALOG_DISCOVERY_TIMEOUT_MILLISECONDS = 9e4;
|
|
98146
|
+
}
|
|
98147
|
+
});
|
|
98148
|
+
|
|
98149
|
+
// src/runtime/command/registry/agent-catalog.ts
|
|
98150
|
+
function createAgentCatalogCommands(context) {
|
|
98151
|
+
const handler = createAgentCatalogDiscoveryHandler({
|
|
98152
|
+
config: context.config,
|
|
98153
|
+
discover: context.config.rediscoverAgents === void 0 ? () => {
|
|
98154
|
+
throw new Error("Agent catalog discovery is not available for this Runtime");
|
|
98155
|
+
} : context.config.rediscoverAgents,
|
|
98156
|
+
diagnostics: context.diagnostics,
|
|
98157
|
+
socket: context.socket,
|
|
98158
|
+
signal: context.signal,
|
|
98159
|
+
timer: context.timer
|
|
98160
|
+
});
|
|
98161
|
+
return [
|
|
98162
|
+
{
|
|
98163
|
+
kind: AGENT_CATALOG_DISCOVER_KIND,
|
|
98164
|
+
handle: (_context, message) => {
|
|
98165
|
+
if (message.kind !== AGENT_CATALOG_DISCOVER_KIND) {
|
|
98166
|
+
throw new Error("Command kind mismatch");
|
|
98167
|
+
}
|
|
98168
|
+
handler.handle(message);
|
|
98169
|
+
},
|
|
98170
|
+
settle: handler.settle
|
|
98171
|
+
}
|
|
98172
|
+
];
|
|
98173
|
+
}
|
|
98174
|
+
var init_agent_catalog = __esm({
|
|
98175
|
+
"src/runtime/command/registry/agent-catalog.ts"() {
|
|
98176
|
+
"use strict";
|
|
98177
|
+
init_protocol();
|
|
98178
|
+
init_handle_agent_catalog_discovery();
|
|
98179
|
+
}
|
|
98180
|
+
});
|
|
98181
|
+
|
|
97757
98182
|
// src/session/api/session-error.ts
|
|
97758
98183
|
var SessionError;
|
|
97759
98184
|
var init_session_error = __esm({
|
|
@@ -98127,37 +98552,8 @@ var init_discover_agent_settings = __esm({
|
|
|
98127
98552
|
}
|
|
98128
98553
|
});
|
|
98129
98554
|
|
|
98130
|
-
// src/runtime/command/transport.ts
|
|
98131
|
-
import { WebSocket as WebSocket2 } from "undici";
|
|
98132
|
-
function send(socket, message) {
|
|
98133
|
-
if (socket.readyState !== WebSocket2.OPEN) {
|
|
98134
|
-
throw new Error("Relay connection is not open");
|
|
98135
|
-
}
|
|
98136
|
-
socket.send(encodeDaemonToServiceMessage(message));
|
|
98137
|
-
}
|
|
98138
|
-
function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTimings = []) {
|
|
98139
|
-
if (socket.readyState !== WebSocket2.OPEN) {
|
|
98140
|
-
return;
|
|
98141
|
-
}
|
|
98142
|
-
send(socket, {
|
|
98143
|
-
code: operationErrorCode(error62),
|
|
98144
|
-
kind: "session.operation.failed",
|
|
98145
|
-
message: operationErrorMessage(error62),
|
|
98146
|
-
requestId,
|
|
98147
|
-
...runtimeTimings.length === 0 ? {} : { runtimeTimings },
|
|
98148
|
-
sessionId
|
|
98149
|
-
});
|
|
98150
|
-
}
|
|
98151
|
-
var init_transport = __esm({
|
|
98152
|
-
"src/runtime/command/transport.ts"() {
|
|
98153
|
-
"use strict";
|
|
98154
|
-
init_protocol();
|
|
98155
|
-
init_operation_error();
|
|
98156
|
-
}
|
|
98157
|
-
});
|
|
98158
|
-
|
|
98159
98555
|
// src/runtime/command/agent-settings-discovery.ts
|
|
98160
|
-
import { WebSocket as
|
|
98556
|
+
import { WebSocket as WebSocket4 } from "undici";
|
|
98161
98557
|
function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
98162
98558
|
const { config: config2, directories, sessions, diagnostics, socket, signal, timer } = dependencies;
|
|
98163
98559
|
const agentSettingsDiscoveries = /* @__PURE__ */ new Map();
|
|
@@ -98166,7 +98562,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
98166
98562
|
(request) => request.agentId === command.agentId && !request.controller.signal.aborted
|
|
98167
98563
|
);
|
|
98168
98564
|
if ([...agentSettingsDiscoveries.values()].some((request) => request.requestIds.has(command.requestId))) {
|
|
98169
|
-
if (socket.readyState ===
|
|
98565
|
+
if (socket.readyState === WebSocket4.OPEN) {
|
|
98170
98566
|
send(socket, {
|
|
98171
98567
|
code: "agent_settings_discovery_busy",
|
|
98172
98568
|
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
@@ -98181,7 +98577,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
98181
98577
|
return;
|
|
98182
98578
|
}
|
|
98183
98579
|
if (existing !== void 0) {
|
|
98184
|
-
if (socket.readyState ===
|
|
98580
|
+
if (socket.readyState === WebSocket4.OPEN) {
|
|
98185
98581
|
send(socket, {
|
|
98186
98582
|
code: "agent_settings_discovery_busy",
|
|
98187
98583
|
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
@@ -98192,7 +98588,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
98192
98588
|
return;
|
|
98193
98589
|
}
|
|
98194
98590
|
if (agentSettingsDiscoveries.size >= 4) {
|
|
98195
|
-
if (socket.readyState ===
|
|
98591
|
+
if (socket.readyState === WebSocket4.OPEN) {
|
|
98196
98592
|
send(socket, {
|
|
98197
98593
|
code: "agent_settings_discovery_busy",
|
|
98198
98594
|
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
@@ -98230,7 +98626,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
98230
98626
|
);
|
|
98231
98627
|
}
|
|
98232
98628
|
for (const requestId of requestIds) {
|
|
98233
|
-
if (socket.readyState ===
|
|
98629
|
+
if (socket.readyState === WebSocket4.OPEN) {
|
|
98234
98630
|
send(socket, { ...result.event, requestId });
|
|
98235
98631
|
}
|
|
98236
98632
|
}
|
|
@@ -98244,7 +98640,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
98244
98640
|
`
|
|
98245
98641
|
);
|
|
98246
98642
|
}
|
|
98247
|
-
if (socket.readyState ===
|
|
98643
|
+
if (socket.readyState === WebSocket4.OPEN) {
|
|
98248
98644
|
for (const requestId of requestIds) {
|
|
98249
98645
|
send(socket, {
|
|
98250
98646
|
code: operationErrorCode(failure2),
|
|
@@ -98318,7 +98714,7 @@ var init_agent_settings = __esm({
|
|
|
98318
98714
|
});
|
|
98319
98715
|
|
|
98320
98716
|
// src/session/content/session-files.ts
|
|
98321
|
-
import { basename as basename8, extname as extname2, isAbsolute as
|
|
98717
|
+
import { basename as basename8, extname as extname2, isAbsolute as isAbsolute17, join as join35, normalize as normalize3, resolve as resolve16 } from "node:path";
|
|
98322
98718
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
98323
98719
|
function requestedPath(value) {
|
|
98324
98720
|
if (value.includes("\0")) {
|
|
@@ -98336,21 +98732,21 @@ function requestedPath(value) {
|
|
|
98336
98732
|
}
|
|
98337
98733
|
async function resolveFile(value, workingDirectory, signal) {
|
|
98338
98734
|
const requested = requestedPath(value);
|
|
98339
|
-
if (requested === null || !
|
|
98735
|
+
if (requested === null || !isAbsolute17(requested.path) && workingDirectory === null) {
|
|
98340
98736
|
return null;
|
|
98341
98737
|
}
|
|
98342
|
-
if (
|
|
98738
|
+
if (isAbsolute17(requested.path) && normalize3(requested.path) !== requested.path) {
|
|
98343
98739
|
return null;
|
|
98344
98740
|
}
|
|
98345
|
-
const candidates = requested.explicitUrl || workingDirectory === null ? [requested.path] :
|
|
98741
|
+
const candidates = requested.explicitUrl || workingDirectory === null ? [requested.path] : isAbsolute17(requested.path) ? [join35(workingDirectory, requested.path), requested.path] : [resolve16(workingDirectory, requested.path)];
|
|
98346
98742
|
for (const candidate of candidates) {
|
|
98347
|
-
if (!
|
|
98743
|
+
if (!isAbsolute17(candidate) || normalize3(candidate) !== candidate) {
|
|
98348
98744
|
continue;
|
|
98349
98745
|
}
|
|
98350
98746
|
try {
|
|
98351
98747
|
const target = await canonicalPath(candidate);
|
|
98352
98748
|
signal.throwIfAborted();
|
|
98353
|
-
if (
|
|
98749
|
+
if (isAbsolute17(target) && normalize3(target) === target) {
|
|
98354
98750
|
return target;
|
|
98355
98751
|
}
|
|
98356
98752
|
} catch {
|
|
@@ -98414,7 +98810,7 @@ var init_session_files = __esm({
|
|
|
98414
98810
|
});
|
|
98415
98811
|
|
|
98416
98812
|
// src/runtime/command/registry/file-read/index.ts
|
|
98417
|
-
import { WebSocket as
|
|
98813
|
+
import { WebSocket as WebSocket5 } from "undici";
|
|
98418
98814
|
var fileReadCommand;
|
|
98419
98815
|
var init_file_read = __esm({
|
|
98420
98816
|
"src/runtime/command/registry/file-read/index.ts"() {
|
|
@@ -98435,7 +98831,7 @@ var init_file_read = __esm({
|
|
|
98435
98831
|
sessions.findSessions([message.sessionId])[0]?.cwd ?? null,
|
|
98436
98832
|
externalContent
|
|
98437
98833
|
).catch((error62) => {
|
|
98438
|
-
if (socket.readyState !==
|
|
98834
|
+
if (socket.readyState !== WebSocket5.OPEN || signal.aborted) {
|
|
98439
98835
|
return;
|
|
98440
98836
|
}
|
|
98441
98837
|
send(socket, {
|
|
@@ -98808,7 +99204,7 @@ var init_interactions2 = __esm({
|
|
|
98808
99204
|
});
|
|
98809
99205
|
|
|
98810
99206
|
// src/runtime/command/native-session-requests.ts
|
|
98811
|
-
import { WebSocket as
|
|
99207
|
+
import { WebSocket as WebSocket6 } from "undici";
|
|
98812
99208
|
function createNativeSessionRequestHandler(dependencies) {
|
|
98813
99209
|
const { diagnostics, nativeSessions, signal, socket, timer } = dependencies;
|
|
98814
99210
|
const pending = /* @__PURE__ */ new Map();
|
|
@@ -98843,13 +99239,13 @@ function createNativeSessionRequestHandler(dependencies) {
|
|
|
98843
99239
|
operationSignal.throwIfAborted();
|
|
98844
99240
|
const skipPrevious = command.action === "active-turn";
|
|
98845
99241
|
if (previous.length > 0 && !skipPrevious) {
|
|
98846
|
-
await new Promise((
|
|
99242
|
+
await new Promise((resolve19, reject2) => {
|
|
98847
99243
|
const onAbort = () => reject2(operationSignal.reason);
|
|
98848
99244
|
operationSignal.addEventListener("abort", onAbort, { once: true });
|
|
98849
99245
|
void Promise.all(previous.map((request) => request.completion)).then(
|
|
98850
99246
|
() => {
|
|
98851
99247
|
operationSignal.removeEventListener("abort", onAbort);
|
|
98852
|
-
|
|
99248
|
+
resolve19();
|
|
98853
99249
|
},
|
|
98854
99250
|
(error62) => {
|
|
98855
99251
|
operationSignal.removeEventListener("abort", onAbort);
|
|
@@ -98860,7 +99256,7 @@ function createNativeSessionRequestHandler(dependencies) {
|
|
|
98860
99256
|
}
|
|
98861
99257
|
operationSignal.throwIfAborted();
|
|
98862
99258
|
const result = await nativeSessions.execute(command, operationSignal);
|
|
98863
|
-
if (socket.readyState ===
|
|
99259
|
+
if (socket.readyState === WebSocket6.OPEN) {
|
|
98864
99260
|
send(socket, result);
|
|
98865
99261
|
}
|
|
98866
99262
|
} catch (error62) {
|
|
@@ -100045,6 +100441,7 @@ function createCommandRegistry(context) {
|
|
|
100045
100441
|
sessionHistoryPageLoadCommand,
|
|
100046
100442
|
previewHistoryPageLoadCommand,
|
|
100047
100443
|
...createNativeSessionCommands(context),
|
|
100444
|
+
...createAgentCatalogCommands(context),
|
|
100048
100445
|
...createAgentSettingsCommands(context),
|
|
100049
100446
|
fileReadCommand,
|
|
100050
100447
|
sessionCancelCommand,
|
|
@@ -100076,6 +100473,7 @@ function createCommandRegistry(context) {
|
|
|
100076
100473
|
var init_registry2 = __esm({
|
|
100077
100474
|
"src/runtime/command/registry/index.ts"() {
|
|
100078
100475
|
"use strict";
|
|
100476
|
+
init_agent_catalog();
|
|
100079
100477
|
init_agent_settings();
|
|
100080
100478
|
init_file_read();
|
|
100081
100479
|
init_history2();
|
|
@@ -100123,14 +100521,14 @@ var init_runtime_revocation = __esm({
|
|
|
100123
100521
|
});
|
|
100124
100522
|
|
|
100125
100523
|
// src/runtime/relay/connect.ts
|
|
100126
|
-
import { WebSocket as
|
|
100524
|
+
import { WebSocket as WebSocket7 } from "undici";
|
|
100127
100525
|
function connectRelay(url2, signal) {
|
|
100128
100526
|
signal.throwIfAborted();
|
|
100129
|
-
return new Promise((
|
|
100527
|
+
return new Promise((resolve19, reject2) => {
|
|
100130
100528
|
const endpoint = new URL(url2);
|
|
100131
100529
|
const headers = relayAuthorization(endpoint);
|
|
100132
100530
|
endpoint.searchParams.delete("token");
|
|
100133
|
-
const socket = new
|
|
100531
|
+
const socket = new WebSocket7(endpoint, {
|
|
100134
100532
|
dispatcher: environmentProxyDispatcher,
|
|
100135
100533
|
headers
|
|
100136
100534
|
});
|
|
@@ -100193,7 +100591,7 @@ function connectRelay(url2, signal) {
|
|
|
100193
100591
|
}
|
|
100194
100592
|
finished = true;
|
|
100195
100593
|
cleanup();
|
|
100196
|
-
|
|
100594
|
+
resolve19(socket);
|
|
100197
100595
|
};
|
|
100198
100596
|
function onTimeout() {
|
|
100199
100597
|
fail(
|
|
@@ -100335,7 +100733,7 @@ var init_liveness2 = __esm({
|
|
|
100335
100733
|
});
|
|
100336
100734
|
|
|
100337
100735
|
// src/runtime/relay/run-relay-connection.ts
|
|
100338
|
-
import { WebSocket as
|
|
100736
|
+
import { WebSocket as WebSocket8 } from "undici";
|
|
100339
100737
|
function closeRelaySocket(socket, code, reason) {
|
|
100340
100738
|
try {
|
|
100341
100739
|
socket.close(code, reason);
|
|
@@ -100366,7 +100764,7 @@ function readCommandCorrelation(encoded) {
|
|
|
100366
100764
|
};
|
|
100367
100765
|
}
|
|
100368
100766
|
function rejectUnsupportedCommand(socket, correlation, rejection) {
|
|
100369
|
-
if (socket.readyState !==
|
|
100767
|
+
if (socket.readyState !== WebSocket8.OPEN) {
|
|
100370
100768
|
return;
|
|
100371
100769
|
}
|
|
100372
100770
|
send(socket, {
|
|
@@ -100414,7 +100812,7 @@ async function runRelayConnection({
|
|
|
100414
100812
|
timer
|
|
100415
100813
|
});
|
|
100416
100814
|
void reportUpgradeAvailability((result) => {
|
|
100417
|
-
if (socket.readyState ===
|
|
100815
|
+
if (socket.readyState === WebSocket8.OPEN) {
|
|
100418
100816
|
send(socket, result);
|
|
100419
100817
|
}
|
|
100420
100818
|
}, signal).catch((cause) => {
|
|
@@ -100423,7 +100821,7 @@ async function runRelayConnection({
|
|
|
100423
100821
|
}
|
|
100424
100822
|
});
|
|
100425
100823
|
try {
|
|
100426
|
-
await new Promise((
|
|
100824
|
+
await new Promise((resolve19, reject2) => {
|
|
100427
100825
|
let finished = false;
|
|
100428
100826
|
let ready = false;
|
|
100429
100827
|
const cleanup = () => {
|
|
@@ -100441,7 +100839,7 @@ async function runRelayConnection({
|
|
|
100441
100839
|
}
|
|
100442
100840
|
finished = true;
|
|
100443
100841
|
cleanup();
|
|
100444
|
-
|
|
100842
|
+
resolve19();
|
|
100445
100843
|
};
|
|
100446
100844
|
const rejectConnection = (failure2) => {
|
|
100447
100845
|
if (finished) {
|
|
@@ -100465,14 +100863,14 @@ async function runRelayConnection({
|
|
|
100465
100863
|
};
|
|
100466
100864
|
const connectionLiveness = new RelayConnectionLiveness(timer, {
|
|
100467
100865
|
send: (message) => {
|
|
100468
|
-
if (socket.readyState !==
|
|
100866
|
+
if (socket.readyState !== WebSocket8.OPEN) {
|
|
100469
100867
|
return false;
|
|
100470
100868
|
}
|
|
100471
100869
|
try {
|
|
100472
100870
|
send(socket, message);
|
|
100473
100871
|
return true;
|
|
100474
100872
|
} catch (error62) {
|
|
100475
|
-
if (socket.readyState !==
|
|
100873
|
+
if (socket.readyState !== WebSocket8.OPEN) {
|
|
100476
100874
|
return false;
|
|
100477
100875
|
}
|
|
100478
100876
|
throw error62;
|
|
@@ -100589,7 +100987,7 @@ var init_run_relay_connection = __esm({
|
|
|
100589
100987
|
});
|
|
100590
100988
|
|
|
100591
100989
|
// src/runtime/relay/session-event-publisher.ts
|
|
100592
|
-
import { WebSocket as
|
|
100990
|
+
import { WebSocket as WebSocket9 } from "undici";
|
|
100593
100991
|
var MAX_BUFFERED_BYTES, MAX_PENDING_BYTES2, MAX_EVENT_BATCH_BYTES, MAX_FRAME_BYTES, LOCAL_BACKPRESSURE_CLOSE_CODE, EMPTY_ENVELOPE_BYTES, SESSION_EVENT_BATCH_WINDOW_MILLISECONDS, RuntimeSessionEventPublisher;
|
|
100594
100992
|
var init_session_event_publisher = __esm({
|
|
100595
100993
|
"src/runtime/relay/session-event-publisher.ts"() {
|
|
@@ -100644,7 +101042,7 @@ var init_session_event_publisher = __esm({
|
|
|
100644
101042
|
publishClosed = (event) => this.#send(event);
|
|
100645
101043
|
#send = (message) => {
|
|
100646
101044
|
const connection = this.#connection;
|
|
100647
|
-
if (connection.kind !== "connected" || connection.socket.readyState !==
|
|
101045
|
+
if (connection.kind !== "connected" || connection.socket.readyState !== WebSocket9.OPEN) {
|
|
100648
101046
|
return;
|
|
100649
101047
|
}
|
|
100650
101048
|
const socket = connection.socket;
|
|
@@ -100695,7 +101093,7 @@ var init_session_event_publisher = __esm({
|
|
|
100695
101093
|
batch.bytes += bytes;
|
|
100696
101094
|
this.#pendingBytes += additionalBytes;
|
|
100697
101095
|
const connection = this.#connection;
|
|
100698
|
-
if (connection.kind !== "connected" || connection.socket.readyState !==
|
|
101096
|
+
if (connection.kind !== "connected" || connection.socket.readyState !== WebSocket9.OPEN) {
|
|
100699
101097
|
return;
|
|
100700
101098
|
}
|
|
100701
101099
|
const socket = connection.socket;
|
|
@@ -100715,7 +101113,7 @@ var init_session_event_publisher = __esm({
|
|
|
100715
101113
|
flushEvents = (socket) => {
|
|
100716
101114
|
this.cancelFlush();
|
|
100717
101115
|
const connection = this.#connection;
|
|
100718
|
-
if (connection.kind !== "connected" || connection.socket !== socket || socket.readyState !==
|
|
101116
|
+
if (connection.kind !== "connected" || connection.socket !== socket || socket.readyState !== WebSocket9.OPEN) {
|
|
100719
101117
|
return;
|
|
100720
101118
|
}
|
|
100721
101119
|
let attempted = 0;
|
|
@@ -100749,12 +101147,12 @@ function waitForRelayRetry(signal, timer) {
|
|
|
100749
101147
|
if (signal.aborted) {
|
|
100750
101148
|
return Promise.resolve();
|
|
100751
101149
|
}
|
|
100752
|
-
return new Promise((
|
|
101150
|
+
return new Promise((resolve19) => {
|
|
100753
101151
|
const retry = timer.schedule(finish, RELAY_RECONNECT_DELAY_MILLISECONDS);
|
|
100754
101152
|
function finish() {
|
|
100755
101153
|
retry.cancel();
|
|
100756
101154
|
signal.removeEventListener("abort", finish);
|
|
100757
|
-
|
|
101155
|
+
resolve19();
|
|
100758
101156
|
}
|
|
100759
101157
|
signal.addEventListener("abort", finish, { once: true });
|
|
100760
101158
|
});
|
|
@@ -101029,153 +101427,6 @@ var init_engine = __esm({
|
|
|
101029
101427
|
}
|
|
101030
101428
|
});
|
|
101031
101429
|
|
|
101032
|
-
// src/storage/daemon/release-files.ts
|
|
101033
|
-
import { readFile as readFile10, realpath as realpath9 } from "node:fs/promises";
|
|
101034
|
-
import { join as join34 } from "node:path";
|
|
101035
|
-
function releasePrefix(version2) {
|
|
101036
|
-
return join34(readStateDirectory(), "npm", version2);
|
|
101037
|
-
}
|
|
101038
|
-
async function readInstalledRelease(prefix) {
|
|
101039
|
-
const packageRoot = await realpath9(join34(prefix, "node_modules", "@moxt-ai", "mobius"));
|
|
101040
|
-
return { manifest: await readFile10(join34(packageRoot, "package.json"), "utf8"), packageRoot };
|
|
101041
|
-
}
|
|
101042
|
-
var init_release_files = __esm({
|
|
101043
|
-
"src/storage/daemon/release-files.ts"() {
|
|
101044
|
-
"use strict";
|
|
101045
|
-
init_state_directory();
|
|
101046
|
-
}
|
|
101047
|
-
});
|
|
101048
|
-
|
|
101049
|
-
// src/daemon/upgrades/package.ts
|
|
101050
|
-
import { isAbsolute as isAbsolute17, join as join35, relative as relative4 } from "node:path";
|
|
101051
|
-
async function installDaemonReleaseVersion(version2, signal) {
|
|
101052
|
-
runtimeUpgradeVersionSchema.parse(version2);
|
|
101053
|
-
const npm = await findExecutableOnPath("npm", process.env);
|
|
101054
|
-
if (npm === null) {
|
|
101055
|
-
throw new DaemonReleaseUpgradeError("npm_unavailable", "npm is required to download the new daemon");
|
|
101056
|
-
}
|
|
101057
|
-
const prefix = releasePrefix(version2);
|
|
101058
|
-
await ensurePrivateDirectory(prefix);
|
|
101059
|
-
try {
|
|
101060
|
-
await validateLocalPath(prefix, true, true, signal);
|
|
101061
|
-
await runBoundedProcess({
|
|
101062
|
-
command: npm.path,
|
|
101063
|
-
arguments: [
|
|
101064
|
-
"install",
|
|
101065
|
-
"--prefix",
|
|
101066
|
-
prefix,
|
|
101067
|
-
"--ignore-scripts",
|
|
101068
|
-
"--no-audit",
|
|
101069
|
-
"--no-fund",
|
|
101070
|
-
"--save-exact",
|
|
101071
|
-
"--",
|
|
101072
|
-
`@moxt-ai/mobius@${version2}`
|
|
101073
|
-
],
|
|
101074
|
-
cwd: prefix,
|
|
101075
|
-
environment: process.env,
|
|
101076
|
-
signal,
|
|
101077
|
-
timeoutMilliseconds: 3e5,
|
|
101078
|
-
outputLimitBytes: 64 * 1024
|
|
101079
|
-
});
|
|
101080
|
-
const installed = await readInstalledRelease(prefix);
|
|
101081
|
-
const metadata = external_exports.object({
|
|
101082
|
-
name: external_exports.literal("@moxt-ai/mobius"),
|
|
101083
|
-
version: external_exports.literal(version2),
|
|
101084
|
-
bin: external_exports.object({ mobius: external_exports.literal("dist/cli.js") }),
|
|
101085
|
-
engines: external_exports.object({ node: external_exports.string().refine((value) => (0, import_semver.validRange)(value) !== null) })
|
|
101086
|
-
}).parse(JSON.parse(installed.manifest));
|
|
101087
|
-
const entry = await canonicalPath(join35(installed.packageRoot, metadata.bin.mobius));
|
|
101088
|
-
const resolved = relative4(await canonicalPath(prefix), entry);
|
|
101089
|
-
if (resolved.startsWith("..") || isAbsolute17(resolved)) {
|
|
101090
|
-
throw new Error("Installed entry escaped npm prefix");
|
|
101091
|
-
}
|
|
101092
|
-
if (!(0, import_semver.satisfies)(process.versions.node, metadata.engines.node)) {
|
|
101093
|
-
throw new DaemonReleaseUpgradeError(
|
|
101094
|
-
"node_incompatible",
|
|
101095
|
-
`Mobius ${version2} requires Node.js ${metadata.engines.node}; the running daemon uses ${process.versions.node} at ${process.execPath}. Update Node.js before retrying.`
|
|
101096
|
-
);
|
|
101097
|
-
}
|
|
101098
|
-
try {
|
|
101099
|
-
const result = await runBoundedProcess({
|
|
101100
|
-
command: process.execPath,
|
|
101101
|
-
arguments: [entry, "--version"],
|
|
101102
|
-
cwd: prefix,
|
|
101103
|
-
environment: process.env,
|
|
101104
|
-
signal,
|
|
101105
|
-
timeoutMilliseconds: 3e4,
|
|
101106
|
-
outputLimitBytes: 16 * 1024
|
|
101107
|
-
});
|
|
101108
|
-
if (!result.stdout.split(/\r?\n/u).includes(`CLI: ${version2}`)) {
|
|
101109
|
-
throw new Error("Candidate did not report the requested CLI version");
|
|
101110
|
-
}
|
|
101111
|
-
} catch (cause) {
|
|
101112
|
-
signal.throwIfAborted();
|
|
101113
|
-
throw new DaemonReleaseUpgradeError(
|
|
101114
|
-
"release_startup_failed",
|
|
101115
|
-
`Mobius ${version2} startup check failed; the current daemon is unchanged.`,
|
|
101116
|
-
{ cause }
|
|
101117
|
-
);
|
|
101118
|
-
}
|
|
101119
|
-
return await decodeWorkerLaunch({ executable: process.execPath, entry, version: version2 });
|
|
101120
|
-
} catch (cause) {
|
|
101121
|
-
signal.throwIfAborted();
|
|
101122
|
-
if (cause instanceof DaemonReleaseUpgradeError) {
|
|
101123
|
-
throw cause;
|
|
101124
|
-
}
|
|
101125
|
-
throw new DaemonReleaseUpgradeError(
|
|
101126
|
-
"npm_install_failed",
|
|
101127
|
-
"npm could not install and verify the requested Mobius version",
|
|
101128
|
-
{ cause }
|
|
101129
|
-
);
|
|
101130
|
-
}
|
|
101131
|
-
}
|
|
101132
|
-
async function findNewDaemonReleaseVersion(currentVersion, signal) {
|
|
101133
|
-
const npm = await findExecutableOnPath("npm", process.env);
|
|
101134
|
-
if (npm === null) {
|
|
101135
|
-
throw new DaemonReleaseUpgradeError("npm_unavailable", "npm is required to check for a new daemon");
|
|
101136
|
-
}
|
|
101137
|
-
try {
|
|
101138
|
-
const result = await runBoundedProcess({
|
|
101139
|
-
command: npm.path,
|
|
101140
|
-
arguments: ["view", "@moxt-ai/mobius", "dist-tags.latest", "--json", "--prefer-online"],
|
|
101141
|
-
cwd: process.cwd(),
|
|
101142
|
-
environment: process.env,
|
|
101143
|
-
signal,
|
|
101144
|
-
timeoutMilliseconds: 3e4,
|
|
101145
|
-
outputLimitBytes: 4096
|
|
101146
|
-
});
|
|
101147
|
-
const version2 = npmViewVersionSchema.parse(JSON.parse(result.stdout));
|
|
101148
|
-
return (0, import_semver.gt)(version2, currentVersion) ? version2 : null;
|
|
101149
|
-
} catch (cause) {
|
|
101150
|
-
signal.throwIfAborted();
|
|
101151
|
-
throw new DaemonReleaseUpgradeError("npm_check_failed", "npm could not return a valid latest Mobius version", {
|
|
101152
|
-
cause
|
|
101153
|
-
});
|
|
101154
|
-
}
|
|
101155
|
-
}
|
|
101156
|
-
var import_semver, DaemonReleaseUpgradeError, npmViewVersionSchema;
|
|
101157
|
-
var init_package2 = __esm({
|
|
101158
|
-
"src/daemon/upgrades/package.ts"() {
|
|
101159
|
-
"use strict";
|
|
101160
|
-
init_protocol();
|
|
101161
|
-
import_semver = __toESM(require_semver2(), 1);
|
|
101162
|
-
init_zod();
|
|
101163
|
-
init_release_files();
|
|
101164
|
-
init_local_files();
|
|
101165
|
-
init_private_path();
|
|
101166
|
-
init_executable();
|
|
101167
|
-
init_worker_process();
|
|
101168
|
-
DaemonReleaseUpgradeError = class extends Error {
|
|
101169
|
-
code;
|
|
101170
|
-
constructor(code, message, options) {
|
|
101171
|
-
super(message, options);
|
|
101172
|
-
this.code = code;
|
|
101173
|
-
}
|
|
101174
|
-
};
|
|
101175
|
-
npmViewVersionSchema = external_exports.union([runtimeUpgradeVersionSchema, external_exports.tuple([runtimeUpgradeVersionSchema])]).transform((value) => typeof value === "string" ? value : value[0]);
|
|
101176
|
-
}
|
|
101177
|
-
});
|
|
101178
|
-
|
|
101179
101430
|
// src/daemon/upgrades/upgrade.ts
|
|
101180
101431
|
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
101181
101432
|
import { setInterval as setInterval2, setTimeout as setTimeout4 } from "node:timers/promises";
|
|
@@ -101303,11 +101554,11 @@ async function checkDaemonReleaseUpgrade(signal, activity2) {
|
|
|
101303
101554
|
const _reservation = __using(_stack, await activity2.reserveWhenIdle(signal));
|
|
101304
101555
|
signal.throwIfAborted();
|
|
101305
101556
|
await requestInstalledDaemonReleaseSwitch(control.stateDirectory, launch, signal);
|
|
101306
|
-
await new Promise((
|
|
101557
|
+
await new Promise((resolve19) => {
|
|
101307
101558
|
if (signal.aborted) {
|
|
101308
|
-
|
|
101559
|
+
resolve19();
|
|
101309
101560
|
} else {
|
|
101310
|
-
signal.addEventListener("abort", () =>
|
|
101561
|
+
signal.addEventListener("abort", () => resolve19(), { once: true });
|
|
101311
101562
|
}
|
|
101312
101563
|
});
|
|
101313
101564
|
} catch (_) {
|
|
@@ -101613,10 +101864,10 @@ var init_daemon = __esm({
|
|
|
101613
101864
|
});
|
|
101614
101865
|
|
|
101615
101866
|
// src/cli/handler/logs/logic/collect-local-logs.ts
|
|
101616
|
-
import { join as join36, relative as relative5, resolve as
|
|
101867
|
+
import { join as join36, relative as relative5, resolve as resolve17 } from "node:path";
|
|
101617
101868
|
async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
|
|
101618
101869
|
signal.throwIfAborted();
|
|
101619
|
-
const root =
|
|
101870
|
+
const root = resolve17(stateDirectory);
|
|
101620
101871
|
const entries = [];
|
|
101621
101872
|
const unreadable = [];
|
|
101622
101873
|
const directories = await findLogDirectories(root, unreadable, signal);
|
|
@@ -101645,7 +101896,7 @@ async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
|
|
|
101645
101896
|
return { entries, unreadable: [...unreadable].sort() };
|
|
101646
101897
|
}
|
|
101647
101898
|
function defaultStateDirectory(environment = process.env) {
|
|
101648
|
-
return
|
|
101899
|
+
return resolve17(readStateDirectory(environment));
|
|
101649
101900
|
}
|
|
101650
101901
|
var init_collect_local_logs = __esm({
|
|
101651
101902
|
"src/cli/handler/logs/logic/collect-local-logs.ts"() {
|
|
@@ -101805,11 +102056,11 @@ var init_pair_list_output = __esm({
|
|
|
101805
102056
|
});
|
|
101806
102057
|
|
|
101807
102058
|
// src/cli/handler/pair/list.ts
|
|
101808
|
-
import { resolve as
|
|
102059
|
+
import { resolve as resolve18 } from "node:path";
|
|
101809
102060
|
function registerPairListCommand(command, context) {
|
|
101810
102061
|
command.command("list").description("list saved pairings").addOption(valueOption("--output-json <existing-file.json>", "write JSON to an existing file")).action(async (options) => {
|
|
101811
102062
|
const installation = await openMobiusCliInstallation(context.shutdownSignal, process.env);
|
|
101812
|
-
const outputPath = options.outputJson === void 0 ? null :
|
|
102063
|
+
const outputPath = options.outputJson === void 0 ? null : resolve18(options.outputJson);
|
|
101813
102064
|
const pairs = (await installation.listConnections(context.shutdownSignal)).map(savedPairSummary).sort(
|
|
101814
102065
|
(left, right) => left.appId.localeCompare(right.appId) || left.connectionId.localeCompare(right.connectionId)
|
|
101815
102066
|
);
|