@moxt-ai/mobius 0.0.49 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp/session-manager.d.ts +1 -0
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +3 -4
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/cli.js +796 -227
- package/dist/cli.js.map +4 -4
- package/dist/config.d.ts +21 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +32 -2
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +768 -196
- package/dist/index.js.map +4 -4
- package/dist/pairing/pair-local-machine.d.ts +5 -2
- package/dist/pairing/pair-local-machine.d.ts.map +1 -1
- package/dist/pairing/pair-local-machine.js +93 -111
- package/dist/pairing/pair-local-machine.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +19 -9
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.d.ts +2 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +680 -168
- package/dist/runtime.js.map +4 -4
- package/dist/storage/runtime-installation-store.d.ts +53 -0
- package/dist/storage/runtime-installation-store.d.ts.map +1 -0
- package/dist/storage/runtime-installation-store.js +491 -0
- package/dist/storage/runtime-installation-store.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var createAcpClient = (handler) => client({ name: "mobius" }).onRequest(
|
|
|
32
32
|
})).onNotification("cursor/update_todos", discardExtensionParams, async () => Promise.resolve()).onNotification("cursor/task", discardExtensionParams, async () => Promise.resolve()).onNotification("cursor/generate_image", discardExtensionParams, async () => Promise.resolve());
|
|
33
33
|
|
|
34
34
|
// src/config.ts
|
|
35
|
-
import { join as join3 } from "node:path";
|
|
35
|
+
import { join as join3, resolve as resolve3 } from "node:path";
|
|
36
36
|
import { fileURLToPath } from "node:url";
|
|
37
37
|
|
|
38
38
|
// ../../node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/classic/external.js
|
|
@@ -5067,7 +5067,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
5067
5067
|
var NONE = 0;
|
|
5068
5068
|
var ASSUMED = 1;
|
|
5069
5069
|
var PROVEN = 2;
|
|
5070
|
-
function isRecursive(inst, stack,
|
|
5070
|
+
function isRecursive(inst, stack, resolve8) {
|
|
5071
5071
|
const cached2 = recursive.get(inst);
|
|
5072
5072
|
if (cached2 !== void 0)
|
|
5073
5073
|
return cached2 ? PROVEN : NONE;
|
|
@@ -5077,7 +5077,7 @@ function isRecursive(inst, stack, resolve6) {
|
|
|
5077
5077
|
let result = NONE;
|
|
5078
5078
|
const check2 = (child) => {
|
|
5079
5079
|
if (result !== PROVEN && child?._zod) {
|
|
5080
|
-
const answer = isRecursive(child, stack,
|
|
5080
|
+
const answer = isRecursive(child, stack, resolve8);
|
|
5081
5081
|
if (answer > result)
|
|
5082
5082
|
result = answer;
|
|
5083
5083
|
}
|
|
@@ -5088,7 +5088,7 @@ function isRecursive(inst, stack, resolve6) {
|
|
|
5088
5088
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
5089
5089
|
if (spread && !desc.enumerable)
|
|
5090
5090
|
continue;
|
|
5091
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
5091
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve8) : NONE;
|
|
5092
5092
|
if (child > answer)
|
|
5093
5093
|
answer = child;
|
|
5094
5094
|
}
|
|
@@ -5155,7 +5155,7 @@ function isRecursive(inst, stack, resolve6) {
|
|
|
5155
5155
|
break;
|
|
5156
5156
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
5157
5157
|
case "lazy": {
|
|
5158
|
-
const inner = def._cachedInner ?? (
|
|
5158
|
+
const inner = def._cachedInner ?? (resolve8 ? inst._zod.innerType : void 0);
|
|
5159
5159
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
5160
5160
|
break;
|
|
5161
5161
|
}
|
|
@@ -22004,7 +22004,35 @@ function loadDefaultWorkspace(environment = process.env) {
|
|
|
22004
22004
|
const { MOBIUS_DEFAULT_WORKSPACE: configuredWorkspace } = environment;
|
|
22005
22005
|
return configuredWorkspace ?? join3(readStateDirectory(environment), "workspace");
|
|
22006
22006
|
}
|
|
22007
|
-
|
|
22007
|
+
var DaemonLocalContext = class {
|
|
22008
|
+
environment;
|
|
22009
|
+
stateDirectory;
|
|
22010
|
+
constructor(stateDirectory, environment = process.env) {
|
|
22011
|
+
this.stateDirectory = resolve3(stateDirectory);
|
|
22012
|
+
this.environment = Object.freeze({ ...environment, MOBIUS_STATE_DIRECTORY: this.stateDirectory });
|
|
22013
|
+
}
|
|
22014
|
+
};
|
|
22015
|
+
var DaemonReconnectTarget = class {
|
|
22016
|
+
};
|
|
22017
|
+
var OpaqueDaemonReconnectTarget = class extends DaemonReconnectTarget {
|
|
22018
|
+
connectionId;
|
|
22019
|
+
commandArgument;
|
|
22020
|
+
constructor(connectionId2) {
|
|
22021
|
+
super();
|
|
22022
|
+
this.connectionId = connectionId2;
|
|
22023
|
+
this.commandArgument = `--connection ${connectionId2}`;
|
|
22024
|
+
}
|
|
22025
|
+
};
|
|
22026
|
+
var ChannelDaemonReconnectTarget = class extends DaemonReconnectTarget {
|
|
22027
|
+
channelId;
|
|
22028
|
+
commandArgument;
|
|
22029
|
+
constructor(channelId) {
|
|
22030
|
+
super();
|
|
22031
|
+
this.channelId = channelId;
|
|
22032
|
+
this.commandArgument = `--channel ${channelId}`;
|
|
22033
|
+
}
|
|
22034
|
+
};
|
|
22035
|
+
function createDaemonConfig(connection, agents = [], installableAgents = [], localContext = new DaemonLocalContext(readStateDirectory(), process.env), reconnectTarget = new ChannelDaemonReconnectTarget(connection.channelId)) {
|
|
22008
22036
|
return {
|
|
22009
22037
|
agents,
|
|
22010
22038
|
defaultWorkspace: connection.defaultWorkspace,
|
|
@@ -22013,6 +22041,8 @@ function createDaemonConfig(connection, agents = [], installableAgents = []) {
|
|
|
22013
22041
|
catalog: new LocalAgentCatalog(agents, installableAgents),
|
|
22014
22042
|
channelId: connection.channelId,
|
|
22015
22043
|
installableAgents,
|
|
22044
|
+
localContext,
|
|
22045
|
+
reconnectTarget,
|
|
22016
22046
|
relayUrl: connection.relayUrl
|
|
22017
22047
|
};
|
|
22018
22048
|
}
|
|
@@ -25451,10 +25481,10 @@ function resolveAll(constructs2, events, context) {
|
|
|
25451
25481
|
const called = [];
|
|
25452
25482
|
let index2 = -1;
|
|
25453
25483
|
while (++index2 < constructs2.length) {
|
|
25454
|
-
const
|
|
25455
|
-
if (
|
|
25456
|
-
events =
|
|
25457
|
-
called.push(
|
|
25484
|
+
const resolve8 = constructs2[index2].resolveAll;
|
|
25485
|
+
if (resolve8 && !called.includes(resolve8)) {
|
|
25486
|
+
events = resolve8(events, context);
|
|
25487
|
+
called.push(resolve8);
|
|
25458
25488
|
}
|
|
25459
25489
|
}
|
|
25460
25490
|
return events;
|
|
@@ -31038,7 +31068,7 @@ function createWritableAcpStream(output2) {
|
|
|
31038
31068
|
if (outputFailure !== void 0) {
|
|
31039
31069
|
return Promise.reject(outputFailure);
|
|
31040
31070
|
}
|
|
31041
|
-
return new Promise((
|
|
31071
|
+
return new Promise((resolve8, reject) => {
|
|
31042
31072
|
pendingWriteFailures.add(reject);
|
|
31043
31073
|
output2.write(chunk, (error62) => {
|
|
31044
31074
|
pendingWriteFailures.delete(reject);
|
|
@@ -31051,7 +31081,7 @@ function createWritableAcpStream(output2) {
|
|
|
31051
31081
|
reject(outputFailure);
|
|
31052
31082
|
return;
|
|
31053
31083
|
}
|
|
31054
|
-
|
|
31084
|
+
resolve8();
|
|
31055
31085
|
});
|
|
31056
31086
|
});
|
|
31057
31087
|
}
|
|
@@ -31464,9 +31494,9 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31464
31494
|
stderr.on("data", (chunk) => {
|
|
31465
31495
|
process.stderr.write(`[${agent.id}-acp] ${chunk}`);
|
|
31466
31496
|
});
|
|
31467
|
-
this.#processExit = new Promise((
|
|
31468
|
-
this.#child.once("error",
|
|
31469
|
-
this.#child.once("exit",
|
|
31497
|
+
this.#processExit = new Promise((resolve8) => {
|
|
31498
|
+
this.#child.once("error", resolve8);
|
|
31499
|
+
this.#child.once("exit", resolve8);
|
|
31470
31500
|
});
|
|
31471
31501
|
const stream = ndJsonStream(createWritableAcpStream(stdin), readableWebStream(stdout));
|
|
31472
31502
|
this.#connection = createAcpClient(this).connect(stream);
|
|
@@ -31549,6 +31579,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31549
31579
|
belongsTo = (agentId, cwd, additionalDirectories) => this.#agentId === agentId && this.#cwd === cwd && arraysEqual(this.#additionalDirectories, additionalDirectories);
|
|
31550
31580
|
usesEnvironment = (environment) => recordsEqual(this.#environment, environment);
|
|
31551
31581
|
canRebind = () => !this.#prompted && !this.#turn.running;
|
|
31582
|
+
hasRunningTurn = () => this.#turn.running;
|
|
31552
31583
|
prepared = () => new AcpPreparedSession(
|
|
31553
31584
|
this.#agentName,
|
|
31554
31585
|
this.#agentVersion,
|
|
@@ -33032,7 +33063,6 @@ var AcpSessionManager = class {
|
|
|
33032
33063
|
const operation = (async () => {
|
|
33033
33064
|
try {
|
|
33034
33065
|
await this.#retireSessionProcess(options.sessionId, existing, async () => await existing.close());
|
|
33035
|
-
this.#store.remove(options.sessionId);
|
|
33036
33066
|
const runtime = await this.#startRetainedSessionProcess(
|
|
33037
33067
|
options,
|
|
33038
33068
|
async () => await AcpProcessSession.start(options, () => this.#observer, this.#store)
|
|
@@ -33072,7 +33102,6 @@ var AcpSessionManager = class {
|
|
|
33072
33102
|
}
|
|
33073
33103
|
} catch (error62) {
|
|
33074
33104
|
await this.#retireSessionProcess(options.sessionId, runtime, async () => await runtime.close());
|
|
33075
|
-
this.#store.remove(options.sessionId);
|
|
33076
33105
|
throw error62;
|
|
33077
33106
|
}
|
|
33078
33107
|
return runtime;
|
|
@@ -33192,11 +33221,11 @@ var AcpSessionManager = class {
|
|
|
33192
33221
|
this.#touchExpectedSession(options.sessionId, existing);
|
|
33193
33222
|
return existing.prepared();
|
|
33194
33223
|
}
|
|
33195
|
-
if (
|
|
33224
|
+
if (existing.hasRunningTurn()) {
|
|
33196
33225
|
throw new AcpExecutionError(
|
|
33197
|
-
"The execution environment cannot change
|
|
33226
|
+
"The execution environment cannot change while a conversation turn is running",
|
|
33198
33227
|
{},
|
|
33199
|
-
"
|
|
33228
|
+
"session_busy"
|
|
33200
33229
|
);
|
|
33201
33230
|
}
|
|
33202
33231
|
return (await this.#replaceExecutionPreparation(existing, options)).prepared();
|
|
@@ -33769,10 +33798,9 @@ var LocalAuthorizationError = class extends Error {
|
|
|
33769
33798
|
};
|
|
33770
33799
|
|
|
33771
33800
|
// src/pairing/pair-local-machine.ts
|
|
33772
|
-
import {
|
|
33773
|
-
import { mkdir as mkdir3, open as open5, realpath as realpath7, rename as rename3, stat as stat6, writeFile as writeFile2 } from "node:fs/promises";
|
|
33801
|
+
import { mkdir as mkdir4, realpath as realpath7, stat as stat6 } from "node:fs/promises";
|
|
33774
33802
|
import { hostname as hostname3 } from "node:os";
|
|
33775
|
-
import { basename as basename3,
|
|
33803
|
+
import { basename as basename3, resolve as resolve5 } from "node:path";
|
|
33776
33804
|
import { fetch as fetch2 } from "undici";
|
|
33777
33805
|
|
|
33778
33806
|
// src/agent-catalog/agent-discovery.ts
|
|
@@ -35765,16 +35793,544 @@ async function discoverLocalAgentInventory(options) {
|
|
|
35765
35793
|
return new LocalAgentInventory(discoveries);
|
|
35766
35794
|
}
|
|
35767
35795
|
|
|
35796
|
+
// src/storage/runtime-installation-store.ts
|
|
35797
|
+
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
35798
|
+
import { mkdir as mkdir3, open as open5, rename as rename3, unlink, writeFile as writeFile2 } from "node:fs/promises";
|
|
35799
|
+
import { dirname as dirname5, join as join15, resolve as resolve4 } from "node:path";
|
|
35800
|
+
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
35801
|
+
var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
|
|
35802
|
+
var INSTALLATION_ID_PATTERN = /^min_[a-f0-9]{32}$/;
|
|
35803
|
+
var IDENTIFIER_PATTERN4 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
35804
|
+
var RUNTIME_CREDENTIAL_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
35805
|
+
var MAX_FILE_LENGTH = 16 * 1024;
|
|
35806
|
+
var INSTALLATION_POINTER_KEYS = ["installationId", "version"];
|
|
35807
|
+
var CHANNEL_INDEX_KEYS = [
|
|
35808
|
+
"applicationId",
|
|
35809
|
+
"channelId",
|
|
35810
|
+
"connectionId",
|
|
35811
|
+
"installationId",
|
|
35812
|
+
"version"
|
|
35813
|
+
];
|
|
35814
|
+
var VERIFIED_CONNECTION_KEYS = [
|
|
35815
|
+
"applicationId",
|
|
35816
|
+
"channelId",
|
|
35817
|
+
"connectionId",
|
|
35818
|
+
"defaultWorkspace",
|
|
35819
|
+
"installationId",
|
|
35820
|
+
"kind",
|
|
35821
|
+
"relayOrigin",
|
|
35822
|
+
"runtimeCredential",
|
|
35823
|
+
"runtimeId",
|
|
35824
|
+
"version"
|
|
35825
|
+
];
|
|
35826
|
+
var IMPORTED_LEGACY_CONNECTION_KEYS = [
|
|
35827
|
+
"applicationId",
|
|
35828
|
+
"channelId",
|
|
35829
|
+
"connectionId",
|
|
35830
|
+
"defaultWorkspace",
|
|
35831
|
+
"installationId",
|
|
35832
|
+
"kind",
|
|
35833
|
+
"relayOrigin",
|
|
35834
|
+
"runtimeCredential",
|
|
35835
|
+
"version"
|
|
35836
|
+
];
|
|
35837
|
+
var CURRENT_CONNECTION_KEYS = [
|
|
35838
|
+
"defaultWorkspace",
|
|
35839
|
+
"channelId",
|
|
35840
|
+
"relayOrigin",
|
|
35841
|
+
"runtimeCredential"
|
|
35842
|
+
];
|
|
35843
|
+
var LEGACY_CONNECTION_KEYS = ["defaultWorkspace", "channelId", "daemonToken", "relayOrigin"];
|
|
35844
|
+
var RuntimeInstallationStoreError = class extends Error {
|
|
35845
|
+
code;
|
|
35846
|
+
constructor(code, message, options = {}) {
|
|
35847
|
+
super(message, options);
|
|
35848
|
+
this.code = code;
|
|
35849
|
+
this.name = "RuntimeInstallationStoreError";
|
|
35850
|
+
}
|
|
35851
|
+
};
|
|
35852
|
+
var StoredRuntimeConnection = class {
|
|
35853
|
+
applicationId;
|
|
35854
|
+
channelId;
|
|
35855
|
+
connectionId;
|
|
35856
|
+
defaultWorkspace;
|
|
35857
|
+
installationId;
|
|
35858
|
+
relayOrigin;
|
|
35859
|
+
runtimeCredential;
|
|
35860
|
+
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2) {
|
|
35861
|
+
this.applicationId = applicationId;
|
|
35862
|
+
this.channelId = channelId;
|
|
35863
|
+
this.connectionId = connectionId2;
|
|
35864
|
+
this.defaultWorkspace = defaultWorkspace;
|
|
35865
|
+
this.installationId = installationId2;
|
|
35866
|
+
this.relayOrigin = relayOrigin;
|
|
35867
|
+
this.runtimeCredential = runtimeCredential2;
|
|
35868
|
+
}
|
|
35869
|
+
};
|
|
35870
|
+
var VerifiedRuntimeConnection = class extends StoredRuntimeConnection {
|
|
35871
|
+
kind = "verified";
|
|
35872
|
+
runtimeId;
|
|
35873
|
+
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2, runtimeId) {
|
|
35874
|
+
super(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2);
|
|
35875
|
+
this.runtimeId = runtimeId;
|
|
35876
|
+
}
|
|
35877
|
+
};
|
|
35878
|
+
var ImportedLegacyRuntimeConnection = class extends StoredRuntimeConnection {
|
|
35879
|
+
kind = "legacy_imported";
|
|
35880
|
+
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2) {
|
|
35881
|
+
super(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2);
|
|
35882
|
+
}
|
|
35883
|
+
};
|
|
35884
|
+
function isRecord8(value) {
|
|
35885
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
35886
|
+
}
|
|
35887
|
+
function hasExactKeys(value, expectedKeys) {
|
|
35888
|
+
const keys = Object.keys(value);
|
|
35889
|
+
return keys.length === expectedKeys.length && expectedKeys.every((key) => Object.hasOwn(value, key));
|
|
35890
|
+
}
|
|
35891
|
+
function isNodeError(error62, code) {
|
|
35892
|
+
return typeof error62 === "object" && error62 !== null && "code" in error62 && error62.code === code;
|
|
35893
|
+
}
|
|
35894
|
+
function validateApplicationId(value) {
|
|
35895
|
+
if (!APPLICATION_ID_PATTERN.test(value)) {
|
|
35896
|
+
throw new RuntimeInstallationStoreError("invalid_application_id", "The application ID is invalid");
|
|
35897
|
+
}
|
|
35898
|
+
return value;
|
|
35899
|
+
}
|
|
35900
|
+
function validateConnectionId(value) {
|
|
35901
|
+
if (!CONNECTION_ID_PATTERN.test(value)) {
|
|
35902
|
+
throw new RuntimeInstallationStoreError("invalid_connection_id", "The local connection ID is invalid");
|
|
35903
|
+
}
|
|
35904
|
+
return value;
|
|
35905
|
+
}
|
|
35906
|
+
function validateInstallationId(value) {
|
|
35907
|
+
if (!INSTALLATION_ID_PATTERN.test(value)) {
|
|
35908
|
+
throw new RuntimeInstallationStoreError("invalid_installation_id", "The installation ID is invalid");
|
|
35909
|
+
}
|
|
35910
|
+
return value;
|
|
35911
|
+
}
|
|
35912
|
+
function validateIdentifier(value, code) {
|
|
35913
|
+
if (!IDENTIFIER_PATTERN4.test(value)) {
|
|
35914
|
+
throw new RuntimeInstallationStoreError(code, "The saved Runtime connection is invalid");
|
|
35915
|
+
}
|
|
35916
|
+
return value;
|
|
35917
|
+
}
|
|
35918
|
+
function validateRuntimeCredential(value) {
|
|
35919
|
+
if (!RUNTIME_CREDENTIAL_PATTERN.test(value)) {
|
|
35920
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
35921
|
+
}
|
|
35922
|
+
return value;
|
|
35923
|
+
}
|
|
35924
|
+
function parseRelayOrigin(value) {
|
|
35925
|
+
let origin;
|
|
35926
|
+
try {
|
|
35927
|
+
origin = new URL(value);
|
|
35928
|
+
} catch (cause) {
|
|
35929
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid", {
|
|
35930
|
+
cause
|
|
35931
|
+
});
|
|
35932
|
+
}
|
|
35933
|
+
if (origin.protocol !== "https:" && origin.protocol !== "http:" || origin.username.length > 0 || origin.password.length > 0 || origin.protocol === "http:" && origin.hostname !== "127.0.0.1" && origin.hostname !== "localhost") {
|
|
35934
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
35935
|
+
}
|
|
35936
|
+
origin.hash = "";
|
|
35937
|
+
origin.pathname = "/";
|
|
35938
|
+
origin.search = "";
|
|
35939
|
+
return origin;
|
|
35940
|
+
}
|
|
35941
|
+
function connectionId() {
|
|
35942
|
+
return `mcn_${randomUUID().replaceAll("-", "")}`;
|
|
35943
|
+
}
|
|
35944
|
+
function installationId() {
|
|
35945
|
+
return `min_${randomUUID().replaceAll("-", "")}`;
|
|
35946
|
+
}
|
|
35947
|
+
function channelIndexFileName(channelId) {
|
|
35948
|
+
return `mci_${createHash2("sha256").update(channelId).digest("hex")}.json`;
|
|
35949
|
+
}
|
|
35950
|
+
function decodeInstallationPointer(value) {
|
|
35951
|
+
if (!isRecord8(value) || !hasExactKeys(value, INSTALLATION_POINTER_KEYS) || value["version"] !== 1) {
|
|
35952
|
+
throw new RuntimeInstallationStoreError("invalid_installation", "The local installation record is invalid");
|
|
35953
|
+
}
|
|
35954
|
+
const storedInstallationId = value["installationId"];
|
|
35955
|
+
if (typeof storedInstallationId !== "string") {
|
|
35956
|
+
throw new RuntimeInstallationStoreError("invalid_installation", "The local installation record is invalid");
|
|
35957
|
+
}
|
|
35958
|
+
return { installationId: validateInstallationId(storedInstallationId) };
|
|
35959
|
+
}
|
|
35960
|
+
function decodeChannelIndex(value) {
|
|
35961
|
+
if (!isRecord8(value) || !hasExactKeys(value, CHANNEL_INDEX_KEYS) || value["version"] !== 1) {
|
|
35962
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
35963
|
+
}
|
|
35964
|
+
const applicationId = value["applicationId"];
|
|
35965
|
+
const channelId = value["channelId"];
|
|
35966
|
+
const connectionId2 = value["connectionId"];
|
|
35967
|
+
const storedInstallationId = value["installationId"];
|
|
35968
|
+
if (typeof applicationId !== "string" || typeof channelId !== "string" || typeof connectionId2 !== "string" || typeof storedInstallationId !== "string") {
|
|
35969
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
35970
|
+
}
|
|
35971
|
+
return {
|
|
35972
|
+
applicationId: validateApplicationId(applicationId),
|
|
35973
|
+
channelId: validateIdentifier(channelId, "invalid_connection"),
|
|
35974
|
+
connectionId: validateConnectionId(connectionId2),
|
|
35975
|
+
installationId: validateInstallationId(storedInstallationId)
|
|
35976
|
+
};
|
|
35977
|
+
}
|
|
35978
|
+
function decodeVerifiedConnection(value) {
|
|
35979
|
+
if (!hasExactKeys(value, VERIFIED_CONNECTION_KEYS) || value["kind"] !== "verified" || value["version"] !== 1) {
|
|
35980
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
35981
|
+
}
|
|
35982
|
+
const applicationId = value["applicationId"];
|
|
35983
|
+
const channelId = value["channelId"];
|
|
35984
|
+
const connectionId2 = value["connectionId"];
|
|
35985
|
+
const defaultWorkspace = value["defaultWorkspace"];
|
|
35986
|
+
const storedInstallationId = value["installationId"];
|
|
35987
|
+
const relayOrigin = value["relayOrigin"];
|
|
35988
|
+
const runtimeCredential2 = value["runtimeCredential"];
|
|
35989
|
+
const runtimeId = value["runtimeId"];
|
|
35990
|
+
if (typeof applicationId !== "string" || typeof channelId !== "string" || typeof connectionId2 !== "string" || typeof defaultWorkspace !== "string" || typeof storedInstallationId !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string" || typeof runtimeId !== "string") {
|
|
35991
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
35992
|
+
}
|
|
35993
|
+
return new VerifiedRuntimeConnection(
|
|
35994
|
+
validateApplicationId(applicationId),
|
|
35995
|
+
validateInstallationId(storedInstallationId),
|
|
35996
|
+
validateConnectionId(connectionId2),
|
|
35997
|
+
validateIdentifier(channelId, "invalid_connection"),
|
|
35998
|
+
defaultWorkspace,
|
|
35999
|
+
parseRelayOrigin(relayOrigin),
|
|
36000
|
+
validateRuntimeCredential(runtimeCredential2),
|
|
36001
|
+
validateIdentifier(runtimeId, "invalid_connection")
|
|
36002
|
+
);
|
|
36003
|
+
}
|
|
36004
|
+
function decodeImportedLegacyConnection(value) {
|
|
36005
|
+
if (!hasExactKeys(value, IMPORTED_LEGACY_CONNECTION_KEYS) || value["kind"] !== "legacy_imported" || value["version"] !== 1) {
|
|
36006
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
36007
|
+
}
|
|
36008
|
+
const applicationId = value["applicationId"];
|
|
36009
|
+
const channelId = value["channelId"];
|
|
36010
|
+
const connectionId2 = value["connectionId"];
|
|
36011
|
+
const defaultWorkspace = value["defaultWorkspace"];
|
|
36012
|
+
const storedInstallationId = value["installationId"];
|
|
36013
|
+
const relayOrigin = value["relayOrigin"];
|
|
36014
|
+
const runtimeCredential2 = value["runtimeCredential"];
|
|
36015
|
+
if (typeof applicationId !== "string" || typeof channelId !== "string" || typeof connectionId2 !== "string" || typeof defaultWorkspace !== "string" || typeof storedInstallationId !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string") {
|
|
36016
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
36017
|
+
}
|
|
36018
|
+
return new ImportedLegacyRuntimeConnection(
|
|
36019
|
+
validateApplicationId(applicationId),
|
|
36020
|
+
validateInstallationId(storedInstallationId),
|
|
36021
|
+
validateConnectionId(connectionId2),
|
|
36022
|
+
validateIdentifier(channelId, "invalid_connection"),
|
|
36023
|
+
defaultWorkspace,
|
|
36024
|
+
parseRelayOrigin(relayOrigin),
|
|
36025
|
+
validateRuntimeCredential(runtimeCredential2)
|
|
36026
|
+
);
|
|
36027
|
+
}
|
|
36028
|
+
function decodeConnection(value) {
|
|
36029
|
+
if (!isRecord8(value)) {
|
|
36030
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
36031
|
+
}
|
|
36032
|
+
if (value["kind"] === "verified") {
|
|
36033
|
+
return decodeVerifiedConnection(value);
|
|
36034
|
+
}
|
|
36035
|
+
if (value["kind"] === "legacy_imported") {
|
|
36036
|
+
return decodeImportedLegacyConnection(value);
|
|
36037
|
+
}
|
|
36038
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
36039
|
+
}
|
|
36040
|
+
function decodeLegacyConnection(value, expectedChannelId) {
|
|
36041
|
+
if (!isRecord8(value) || !hasExactKeys(value, CURRENT_CONNECTION_KEYS) && !hasExactKeys(value, LEGACY_CONNECTION_KEYS)) {
|
|
36042
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
36043
|
+
}
|
|
36044
|
+
const channelId = value["channelId"];
|
|
36045
|
+
const defaultWorkspace = value["defaultWorkspace"];
|
|
36046
|
+
const relayOrigin = value["relayOrigin"];
|
|
36047
|
+
const runtimeCredential2 = value["runtimeCredential"] ?? value["daemonToken"];
|
|
36048
|
+
if (typeof channelId !== "string" || channelId !== expectedChannelId || typeof defaultWorkspace !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string") {
|
|
36049
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
36050
|
+
}
|
|
36051
|
+
return {
|
|
36052
|
+
channelId: validateIdentifier(channelId, "invalid_connection"),
|
|
36053
|
+
defaultWorkspace,
|
|
36054
|
+
relayOrigin: parseRelayOrigin(relayOrigin),
|
|
36055
|
+
runtimeCredential: validateRuntimeCredential(runtimeCredential2)
|
|
36056
|
+
};
|
|
36057
|
+
}
|
|
36058
|
+
async function readJsonFile(path2, signal, missingCode) {
|
|
36059
|
+
signal.throwIfAborted();
|
|
36060
|
+
let handle;
|
|
36061
|
+
try {
|
|
36062
|
+
handle = await open5(path2, "r");
|
|
36063
|
+
} catch (cause) {
|
|
36064
|
+
if (isNodeError(cause, "ENOENT")) {
|
|
36065
|
+
throw new RuntimeInstallationStoreError(missingCode, "The saved Runtime connection was not found", {
|
|
36066
|
+
cause
|
|
36067
|
+
});
|
|
36068
|
+
}
|
|
36069
|
+
throw new RuntimeInstallationStoreError(
|
|
36070
|
+
"connection_unavailable",
|
|
36071
|
+
"The saved Runtime connection cannot be read",
|
|
36072
|
+
{
|
|
36073
|
+
cause
|
|
36074
|
+
}
|
|
36075
|
+
);
|
|
36076
|
+
}
|
|
36077
|
+
let encoded = "";
|
|
36078
|
+
try {
|
|
36079
|
+
const metadata = await handle.stat();
|
|
36080
|
+
if (!metadata.isFile() || metadata.size > MAX_FILE_LENGTH) {
|
|
36081
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
36082
|
+
}
|
|
36083
|
+
encoded = await handle.readFile({ encoding: "utf8" });
|
|
36084
|
+
} finally {
|
|
36085
|
+
await handle.close();
|
|
36086
|
+
}
|
|
36087
|
+
signal.throwIfAborted();
|
|
36088
|
+
try {
|
|
36089
|
+
return JSON.parse(encoded);
|
|
36090
|
+
} catch (cause) {
|
|
36091
|
+
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid", {
|
|
36092
|
+
cause
|
|
36093
|
+
});
|
|
36094
|
+
}
|
|
36095
|
+
}
|
|
36096
|
+
async function writeJsonAtomically(path2, value, signal) {
|
|
36097
|
+
signal.throwIfAborted();
|
|
36098
|
+
const directory = dirname5(path2);
|
|
36099
|
+
const temporaryPath = join15(directory, `.${randomUUID()}.tmp`);
|
|
36100
|
+
try {
|
|
36101
|
+
await mkdir3(directory, { mode: 448, recursive: true });
|
|
36102
|
+
signal.throwIfAborted();
|
|
36103
|
+
await writeFile2(temporaryPath, `${JSON.stringify(value, null, 2)}
|
|
36104
|
+
`, { flag: "wx", mode: 384 });
|
|
36105
|
+
signal.throwIfAborted();
|
|
36106
|
+
await rename3(temporaryPath, path2);
|
|
36107
|
+
} catch (cause) {
|
|
36108
|
+
await unlink(temporaryPath).catch(() => void 0);
|
|
36109
|
+
signal.throwIfAborted();
|
|
36110
|
+
throw new RuntimeInstallationStoreError("connection_unavailable", "The local Runtime state cannot be written", {
|
|
36111
|
+
cause
|
|
36112
|
+
});
|
|
36113
|
+
}
|
|
36114
|
+
}
|
|
36115
|
+
var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
36116
|
+
applicationId;
|
|
36117
|
+
installationId;
|
|
36118
|
+
stateDirectory;
|
|
36119
|
+
#channelDirectory;
|
|
36120
|
+
#connectionDirectory;
|
|
36121
|
+
constructor(applicationId, installationId2, stateDirectory) {
|
|
36122
|
+
this.applicationId = applicationId;
|
|
36123
|
+
this.installationId = installationId2;
|
|
36124
|
+
this.stateDirectory = stateDirectory;
|
|
36125
|
+
this.#channelDirectory = join15(stateDirectory, "channels");
|
|
36126
|
+
this.#connectionDirectory = join15(stateDirectory, "connections");
|
|
36127
|
+
}
|
|
36128
|
+
static open = async (options, signal) => {
|
|
36129
|
+
signal.throwIfAborted();
|
|
36130
|
+
const applicationId = validateApplicationId(options.applicationId);
|
|
36131
|
+
const rootDirectory = resolve4(options.stateDirectory);
|
|
36132
|
+
const applicationDirectory = join15(rootDirectory, "installations", applicationId);
|
|
36133
|
+
try {
|
|
36134
|
+
await mkdir3(applicationDirectory, { mode: 448, recursive: true });
|
|
36135
|
+
} catch (cause) {
|
|
36136
|
+
throw new RuntimeInstallationStoreError(
|
|
36137
|
+
"installation_unavailable",
|
|
36138
|
+
"The local installation cannot be initialized",
|
|
36139
|
+
{
|
|
36140
|
+
cause
|
|
36141
|
+
}
|
|
36142
|
+
);
|
|
36143
|
+
}
|
|
36144
|
+
const storedInstallationId = await readOrCreateInstallationId(applicationDirectory, signal);
|
|
36145
|
+
const stateDirectory = join15(applicationDirectory, storedInstallationId);
|
|
36146
|
+
try {
|
|
36147
|
+
await mkdir3(stateDirectory, { mode: 448, recursive: true });
|
|
36148
|
+
} catch (cause) {
|
|
36149
|
+
throw new RuntimeInstallationStoreError(
|
|
36150
|
+
"installation_unavailable",
|
|
36151
|
+
"The local installation cannot be initialized",
|
|
36152
|
+
{
|
|
36153
|
+
cause
|
|
36154
|
+
}
|
|
36155
|
+
);
|
|
36156
|
+
}
|
|
36157
|
+
signal.throwIfAborted();
|
|
36158
|
+
return new _RuntimeInstallationStore(applicationId, storedInstallationId, stateDirectory);
|
|
36159
|
+
};
|
|
36160
|
+
connectionPath = (connectionId2) => join15(this.#connectionDirectory, `${validateConnectionId(connectionId2)}.json`);
|
|
36161
|
+
auditDatabasePath = (connectionId2) => join15(this.stateDirectory, "audit", `${validateConnectionId(connectionId2)}.sqlite`);
|
|
36162
|
+
channelIndexPath = (channelId) => join15(this.#channelDirectory, channelIndexFileName(validateIdentifier(channelId, "invalid_channel_id")));
|
|
36163
|
+
readConnection = async (connectionId2, signal) => {
|
|
36164
|
+
const stored = decodeConnection(
|
|
36165
|
+
await readJsonFile(this.connectionPath(connectionId2), signal, "connection_not_found")
|
|
36166
|
+
);
|
|
36167
|
+
if (stored.applicationId !== this.applicationId || stored.installationId !== this.installationId) {
|
|
36168
|
+
throw new RuntimeInstallationStoreError(
|
|
36169
|
+
"connection_owner_mismatch",
|
|
36170
|
+
"The saved Runtime connection belongs to another installation"
|
|
36171
|
+
);
|
|
36172
|
+
}
|
|
36173
|
+
return stored;
|
|
36174
|
+
};
|
|
36175
|
+
#readConnectionForChannel = async (channelId, signal) => {
|
|
36176
|
+
const normalizedChannelId = validateIdentifier(channelId, "invalid_channel_id");
|
|
36177
|
+
const index2 = decodeChannelIndex(
|
|
36178
|
+
await readJsonFile(this.channelIndexPath(normalizedChannelId), signal, "connection_not_found")
|
|
36179
|
+
);
|
|
36180
|
+
if (index2.applicationId !== this.applicationId || index2.installationId !== this.installationId || index2.channelId !== normalizedChannelId) {
|
|
36181
|
+
throw new RuntimeInstallationStoreError(
|
|
36182
|
+
"connection_owner_mismatch",
|
|
36183
|
+
"The saved Runtime connection belongs to another installation"
|
|
36184
|
+
);
|
|
36185
|
+
}
|
|
36186
|
+
return await this.readConnection(index2.connectionId, signal);
|
|
36187
|
+
};
|
|
36188
|
+
migrateLegacyConnection = async (legacyStateDirectory, channelId, signal) => {
|
|
36189
|
+
try {
|
|
36190
|
+
return await this.#readConnectionForChannel(channelId, signal);
|
|
36191
|
+
} catch (cause) {
|
|
36192
|
+
if (!(cause instanceof RuntimeInstallationStoreError) || cause.code !== "connection_not_found") {
|
|
36193
|
+
throw cause;
|
|
36194
|
+
}
|
|
36195
|
+
}
|
|
36196
|
+
return await this.importLegacyConnection(legacyStateDirectory, channelId, signal);
|
|
36197
|
+
};
|
|
36198
|
+
saveConnection = async (input2, signal) => {
|
|
36199
|
+
const stored = new VerifiedRuntimeConnection(
|
|
36200
|
+
this.applicationId,
|
|
36201
|
+
this.installationId,
|
|
36202
|
+
connectionId(),
|
|
36203
|
+
validateIdentifier(input2.channelId, "invalid_connection"),
|
|
36204
|
+
input2.defaultWorkspace,
|
|
36205
|
+
parseRelayOrigin(input2.relayOrigin.toString()),
|
|
36206
|
+
validateRuntimeCredential(input2.runtimeCredential),
|
|
36207
|
+
validateIdentifier(input2.runtimeId, "invalid_connection")
|
|
36208
|
+
);
|
|
36209
|
+
await this.writeConnection(stored, signal);
|
|
36210
|
+
return stored;
|
|
36211
|
+
};
|
|
36212
|
+
importLegacyConnection = async (legacyStateDirectory, channelId, signal) => {
|
|
36213
|
+
const normalizedChannelId = validateIdentifier(channelId, "invalid_channel_id");
|
|
36214
|
+
const legacyPath = join15(resolve4(legacyStateDirectory), "connections", `${normalizedChannelId}.json`);
|
|
36215
|
+
const legacy = decodeLegacyConnection(
|
|
36216
|
+
await readJsonFile(legacyPath, signal, "connection_not_found"),
|
|
36217
|
+
normalizedChannelId
|
|
36218
|
+
);
|
|
36219
|
+
const stored = new ImportedLegacyRuntimeConnection(
|
|
36220
|
+
this.applicationId,
|
|
36221
|
+
this.installationId,
|
|
36222
|
+
connectionId(),
|
|
36223
|
+
legacy.channelId,
|
|
36224
|
+
legacy.defaultWorkspace,
|
|
36225
|
+
legacy.relayOrigin,
|
|
36226
|
+
legacy.runtimeCredential
|
|
36227
|
+
);
|
|
36228
|
+
await this.writeConnection(stored, signal);
|
|
36229
|
+
return stored;
|
|
36230
|
+
};
|
|
36231
|
+
writeConnection = async (stored, signal) => {
|
|
36232
|
+
signal.throwIfAborted();
|
|
36233
|
+
try {
|
|
36234
|
+
await this.#readConnectionForChannel(stored.channelId, signal);
|
|
36235
|
+
throw new RuntimeInstallationStoreError(
|
|
36236
|
+
"connection_conflict",
|
|
36237
|
+
"A Runtime connection for this channel already exists in this installation"
|
|
36238
|
+
);
|
|
36239
|
+
} catch (cause) {
|
|
36240
|
+
if (!(cause instanceof RuntimeInstallationStoreError) || cause.code !== "connection_not_found") {
|
|
36241
|
+
throw cause;
|
|
36242
|
+
}
|
|
36243
|
+
}
|
|
36244
|
+
const connectionPath = this.connectionPath(stored.connectionId);
|
|
36245
|
+
if (stored instanceof VerifiedRuntimeConnection) {
|
|
36246
|
+
await writeJsonAtomically(
|
|
36247
|
+
connectionPath,
|
|
36248
|
+
{
|
|
36249
|
+
applicationId: stored.applicationId,
|
|
36250
|
+
channelId: stored.channelId,
|
|
36251
|
+
connectionId: stored.connectionId,
|
|
36252
|
+
defaultWorkspace: stored.defaultWorkspace,
|
|
36253
|
+
installationId: stored.installationId,
|
|
36254
|
+
kind: stored.kind,
|
|
36255
|
+
relayOrigin: stored.relayOrigin.toString(),
|
|
36256
|
+
runtimeCredential: stored.runtimeCredential,
|
|
36257
|
+
runtimeId: stored.runtimeId,
|
|
36258
|
+
version: 1
|
|
36259
|
+
},
|
|
36260
|
+
signal
|
|
36261
|
+
);
|
|
36262
|
+
} else {
|
|
36263
|
+
await writeJsonAtomically(
|
|
36264
|
+
connectionPath,
|
|
36265
|
+
{
|
|
36266
|
+
applicationId: stored.applicationId,
|
|
36267
|
+
channelId: stored.channelId,
|
|
36268
|
+
connectionId: stored.connectionId,
|
|
36269
|
+
defaultWorkspace: stored.defaultWorkspace,
|
|
36270
|
+
installationId: stored.installationId,
|
|
36271
|
+
kind: stored.kind,
|
|
36272
|
+
relayOrigin: stored.relayOrigin.toString(),
|
|
36273
|
+
runtimeCredential: stored.runtimeCredential,
|
|
36274
|
+
version: 1
|
|
36275
|
+
},
|
|
36276
|
+
signal
|
|
36277
|
+
);
|
|
36278
|
+
}
|
|
36279
|
+
await writeJsonAtomically(
|
|
36280
|
+
this.channelIndexPath(stored.channelId),
|
|
36281
|
+
{
|
|
36282
|
+
applicationId: this.applicationId,
|
|
36283
|
+
channelId: stored.channelId,
|
|
36284
|
+
connectionId: stored.connectionId,
|
|
36285
|
+
installationId: this.installationId,
|
|
36286
|
+
version: 1
|
|
36287
|
+
},
|
|
36288
|
+
signal
|
|
36289
|
+
);
|
|
36290
|
+
};
|
|
36291
|
+
};
|
|
36292
|
+
async function readOrCreateInstallationId(applicationDirectory, signal) {
|
|
36293
|
+
const pointerPath = join15(applicationDirectory, "current.json");
|
|
36294
|
+
try {
|
|
36295
|
+
return decodeInstallationPointer(await readJsonFile(pointerPath, signal, "installation_not_found")).installationId;
|
|
36296
|
+
} catch (cause) {
|
|
36297
|
+
if (!(cause instanceof RuntimeInstallationStoreError) || cause.code !== "installation_not_found") {
|
|
36298
|
+
throw cause;
|
|
36299
|
+
}
|
|
36300
|
+
}
|
|
36301
|
+
const candidate = installationId();
|
|
36302
|
+
try {
|
|
36303
|
+
await writeFile2(pointerPath, `${JSON.stringify({ installationId: candidate, version: 1 })}
|
|
36304
|
+
`, {
|
|
36305
|
+
flag: "wx",
|
|
36306
|
+
mode: 384
|
|
36307
|
+
});
|
|
36308
|
+
return candidate;
|
|
36309
|
+
} catch (cause) {
|
|
36310
|
+
if (!isNodeError(cause, "EEXIST")) {
|
|
36311
|
+
throw new RuntimeInstallationStoreError(
|
|
36312
|
+
"installation_unavailable",
|
|
36313
|
+
"The local installation cannot be initialized",
|
|
36314
|
+
{
|
|
36315
|
+
cause
|
|
36316
|
+
}
|
|
36317
|
+
);
|
|
36318
|
+
}
|
|
36319
|
+
return decodeInstallationPointer(await readJsonFile(pointerPath, signal, "installation_not_found")).installationId;
|
|
36320
|
+
}
|
|
36321
|
+
}
|
|
36322
|
+
async function openRuntimeInstallationStore(options, signal) {
|
|
36323
|
+
return await RuntimeInstallationStore.open(options, signal);
|
|
36324
|
+
}
|
|
36325
|
+
|
|
35768
36326
|
// src/pairing/pair-local-machine.ts
|
|
35769
36327
|
var PAIRING_TIMEOUT_MILLISECONDS = 2e4;
|
|
35770
36328
|
var PAIRING_CODE_PATTERN = /^[A-HJ-NP-Z2-9]{4}(?:-[A-HJ-NP-Z2-9]{4}){4}$/;
|
|
35771
|
-
var
|
|
36329
|
+
var IDENTIFIER_PATTERN5 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
35772
36330
|
var TOKEN_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
35773
|
-
var MAX_CONNECTION_FILE_LENGTH = 16 * 1024;
|
|
35774
36331
|
var CLAIM_RESPONSE_KEYS = ["channelId", "daemonToken", "runtimeId"];
|
|
35775
36332
|
var REDEEM_RESPONSE_KEYS = ["channelId", "runtimeCredential", "runtimeId"];
|
|
35776
|
-
var
|
|
35777
|
-
var SAVED_CONNECTION_KEYS = ["defaultWorkspace", "channelId", "relayOrigin", "runtimeCredential"];
|
|
36333
|
+
var MOBIUS_CLI_APPLICATION_ID = "dev.mobius.cli";
|
|
35778
36334
|
var PairingClientError = class extends Error {
|
|
35779
36335
|
code;
|
|
35780
36336
|
constructor(code, message, options = {}) {
|
|
@@ -35783,10 +36339,10 @@ var PairingClientError = class extends Error {
|
|
|
35783
36339
|
this.name = "PairingClientError";
|
|
35784
36340
|
}
|
|
35785
36341
|
};
|
|
35786
|
-
function
|
|
36342
|
+
function isRecord9(value) {
|
|
35787
36343
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
35788
36344
|
}
|
|
35789
|
-
function
|
|
36345
|
+
function hasExactKeys2(value, expectedKeys) {
|
|
35790
36346
|
const keys = Object.keys(value);
|
|
35791
36347
|
return keys.length === expectedKeys.length && expectedKeys.every((key) => Object.hasOwn(value, key));
|
|
35792
36348
|
}
|
|
@@ -35816,7 +36372,7 @@ function assertKnownArguments(arguments_) {
|
|
|
35816
36372
|
}
|
|
35817
36373
|
}
|
|
35818
36374
|
}
|
|
35819
|
-
function
|
|
36375
|
+
function parseRelayOrigin2(value) {
|
|
35820
36376
|
let url2;
|
|
35821
36377
|
try {
|
|
35822
36378
|
url2 = new URL(value);
|
|
@@ -35847,35 +36403,68 @@ function parsePairingCode(value) {
|
|
|
35847
36403
|
}
|
|
35848
36404
|
return code;
|
|
35849
36405
|
}
|
|
35850
|
-
function parsePairCommand(arguments_) {
|
|
36406
|
+
function parsePairCommand(arguments_, defaultWorkspace) {
|
|
35851
36407
|
assertKnownArguments(arguments_);
|
|
35852
36408
|
return {
|
|
35853
36409
|
code: parsePairingCode(readSingleOption(arguments_, "--code")),
|
|
35854
36410
|
pairingId: arguments_.includes("--pairing") ? validatePairingId(readSingleOption(arguments_, "--pairing")) : "",
|
|
35855
|
-
relayOrigin:
|
|
35856
|
-
workspace: arguments_.includes("--workspace") ? readSingleOption(arguments_, "--workspace") :
|
|
36411
|
+
relayOrigin: parseRelayOrigin2(readSingleOption(arguments_, "--url")),
|
|
36412
|
+
workspace: arguments_.includes("--workspace") ? readSingleOption(arguments_, "--workspace") : defaultWorkspace
|
|
35857
36413
|
};
|
|
35858
36414
|
}
|
|
35859
36415
|
function validatePairingId(value) {
|
|
35860
|
-
if (!
|
|
36416
|
+
if (!IDENTIFIER_PATTERN5.test(value)) {
|
|
35861
36417
|
throw new PairingClientError("invalid_pairing_id", "The Runtime pairing ID is invalid");
|
|
35862
36418
|
}
|
|
35863
36419
|
return value;
|
|
35864
36420
|
}
|
|
35865
|
-
|
|
35866
|
-
|
|
35867
|
-
|
|
36421
|
+
var ResumeCommandTarget = class {
|
|
36422
|
+
};
|
|
36423
|
+
var ConnectionResumeCommandTarget = class extends ResumeCommandTarget {
|
|
36424
|
+
connectionId;
|
|
36425
|
+
constructor(connectionId2) {
|
|
36426
|
+
super();
|
|
36427
|
+
this.connectionId = connectionId2;
|
|
35868
36428
|
}
|
|
35869
|
-
|
|
35870
|
-
|
|
35871
|
-
|
|
36429
|
+
resume = async (installation, signal, environment) => await resumeMobiusRuntime(installation, this.connectionId, signal, environment);
|
|
36430
|
+
};
|
|
36431
|
+
var LegacyChannelResumeCommandTarget = class extends ResumeCommandTarget {
|
|
36432
|
+
channelId;
|
|
36433
|
+
constructor(channelId) {
|
|
36434
|
+
super();
|
|
36435
|
+
this.channelId = channelId;
|
|
35872
36436
|
}
|
|
35873
|
-
|
|
36437
|
+
resume = async (installation, signal, environment) => await resumeLegacyChannel(installation, this.channelId, signal, environment);
|
|
36438
|
+
};
|
|
36439
|
+
function parseResumeArgument(arguments_) {
|
|
36440
|
+
if (arguments_.length !== 2) {
|
|
36441
|
+
throw new PairingClientError(
|
|
36442
|
+
"invalid_arguments",
|
|
36443
|
+
"Usage: mobius start --connection <connection-id> or mobius start --channel <legacy-channel-id>"
|
|
36444
|
+
);
|
|
36445
|
+
}
|
|
36446
|
+
const value = arguments_[1] ?? "";
|
|
36447
|
+
if (arguments_[0] === "--connection") {
|
|
36448
|
+
if (!/^mcn_[a-f0-9]{32}$/.test(value)) {
|
|
36449
|
+
throw new PairingClientError("invalid_connection_id", "The saved Runtime connection ID is invalid");
|
|
36450
|
+
}
|
|
36451
|
+
return new ConnectionResumeCommandTarget(value);
|
|
36452
|
+
}
|
|
36453
|
+
if (arguments_[0] === "--channel") {
|
|
36454
|
+
if (!IDENTIFIER_PATTERN5.test(value)) {
|
|
36455
|
+
throw new PairingClientError("invalid_channel_id", "The saved channel ID is invalid");
|
|
36456
|
+
}
|
|
36457
|
+
return new LegacyChannelResumeCommandTarget(value);
|
|
36458
|
+
}
|
|
36459
|
+
throw new PairingClientError(
|
|
36460
|
+
"invalid_arguments",
|
|
36461
|
+
"Usage: mobius start --connection <connection-id> or mobius start --channel <legacy-channel-id>"
|
|
36462
|
+
);
|
|
35874
36463
|
}
|
|
35875
36464
|
async function resolveDefaultWorkspace(path2) {
|
|
35876
|
-
const requestedWorkspace =
|
|
36465
|
+
const requestedWorkspace = resolve5(path2);
|
|
35877
36466
|
try {
|
|
35878
|
-
await
|
|
36467
|
+
await mkdir4(requestedWorkspace, { recursive: true, mode: 448 });
|
|
35879
36468
|
const defaultWorkspace = await realpath7(requestedWorkspace);
|
|
35880
36469
|
const metadata = await stat6(defaultWorkspace);
|
|
35881
36470
|
if (!metadata.isDirectory()) {
|
|
@@ -35906,9 +36495,9 @@ async function readJsonResponse(response) {
|
|
|
35906
36495
|
}
|
|
35907
36496
|
}
|
|
35908
36497
|
function readRelayError(value) {
|
|
35909
|
-
if (
|
|
36498
|
+
if (isRecord9(value)) {
|
|
35910
36499
|
const error62 = value["error"];
|
|
35911
|
-
if (
|
|
36500
|
+
if (isRecord9(error62)) {
|
|
35912
36501
|
const code = error62["code"];
|
|
35913
36502
|
const message = error62["message"];
|
|
35914
36503
|
if (typeof code === "string" && typeof message === "string") {
|
|
@@ -35919,13 +36508,13 @@ function readRelayError(value) {
|
|
|
35919
36508
|
return new PairingClientError("pairing_failed", "The relay could not pair this machine");
|
|
35920
36509
|
}
|
|
35921
36510
|
function decodePairingResponse(value, credentialField, expectedKeys) {
|
|
35922
|
-
if (!
|
|
36511
|
+
if (!isRecord9(value) || !hasExactKeys2(value, expectedKeys)) {
|
|
35923
36512
|
throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
|
|
35924
36513
|
}
|
|
35925
36514
|
const channelId = value["channelId"];
|
|
35926
36515
|
const runtimeCredential2 = value[credentialField];
|
|
35927
36516
|
const runtimeId = value["runtimeId"];
|
|
35928
|
-
if (typeof channelId !== "string" || !
|
|
36517
|
+
if (typeof channelId !== "string" || !IDENTIFIER_PATTERN5.test(channelId) || typeof runtimeCredential2 !== "string" || !TOKEN_PATTERN.test(runtimeCredential2) || typeof runtimeId !== "string" || !IDENTIFIER_PATTERN5.test(runtimeId)) {
|
|
35929
36518
|
throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
|
|
35930
36519
|
}
|
|
35931
36520
|
return { channelId, runtimeCredential: runtimeCredential2, runtimeId };
|
|
@@ -35965,157 +36554,117 @@ async function claimPairing(options, defaultWorkspace, localAgents, installableA
|
|
|
35965
36554
|
}
|
|
35966
36555
|
return options.pairingId.length > 0 ? decodePairingResponse(value, "runtimeCredential", REDEEM_RESPONSE_KEYS) : decodePairingResponse(value, "daemonToken", CLAIM_RESPONSE_KEYS);
|
|
35967
36556
|
}
|
|
35968
|
-
async function persistConnection(channelId, relayOrigin, runtimeCredential2, defaultWorkspace, environment) {
|
|
35969
|
-
const connectionsDirectory = join15(readStateDirectory(environment), "connections");
|
|
35970
|
-
await mkdir3(connectionsDirectory, { mode: 448, recursive: true });
|
|
35971
|
-
const connectionPath = join15(connectionsDirectory, `${channelId}.json`);
|
|
35972
|
-
const temporaryPath = join15(connectionsDirectory, `.${channelId}.${randomUUID()}.tmp`);
|
|
35973
|
-
await writeFile2(
|
|
35974
|
-
temporaryPath,
|
|
35975
|
-
`${JSON.stringify(
|
|
35976
|
-
{
|
|
35977
|
-
defaultWorkspace,
|
|
35978
|
-
channelId,
|
|
35979
|
-
relayOrigin: relayOrigin.toString(),
|
|
35980
|
-
runtimeCredential: runtimeCredential2
|
|
35981
|
-
},
|
|
35982
|
-
null,
|
|
35983
|
-
2
|
|
35984
|
-
)}
|
|
35985
|
-
`,
|
|
35986
|
-
{ flag: "wx", mode: 384 }
|
|
35987
|
-
);
|
|
35988
|
-
await rename3(temporaryPath, connectionPath);
|
|
35989
|
-
return connectionPath;
|
|
35990
|
-
}
|
|
35991
|
-
function decodeSavedConnection(value, expectedChannelId) {
|
|
35992
|
-
if (!isRecord8(value) || !hasExactKeys(value, SAVED_CONNECTION_KEYS) && !hasExactKeys(value, LEGACY_SAVED_CONNECTION_KEYS)) {
|
|
35993
|
-
throw new PairingClientError("invalid_connection", "The saved connection is invalid");
|
|
35994
|
-
}
|
|
35995
|
-
const defaultWorkspace = value["defaultWorkspace"];
|
|
35996
|
-
const channelId = value["channelId"];
|
|
35997
|
-
const runtimeCredential2 = value["runtimeCredential"] ?? value["daemonToken"];
|
|
35998
|
-
const relayOrigin = value["relayOrigin"];
|
|
35999
|
-
if (typeof defaultWorkspace !== "string" || typeof channelId !== "string" || channelId !== expectedChannelId || !IDENTIFIER_PATTERN4.test(channelId) || typeof runtimeCredential2 !== "string" || !TOKEN_PATTERN.test(runtimeCredential2) || typeof relayOrigin !== "string") {
|
|
36000
|
-
throw new PairingClientError("invalid_connection", "The saved connection is invalid");
|
|
36001
|
-
}
|
|
36002
|
-
return {
|
|
36003
|
-
defaultWorkspace,
|
|
36004
|
-
channelId,
|
|
36005
|
-
relayOrigin: parseRelayOrigin(relayOrigin),
|
|
36006
|
-
runtimeCredential: runtimeCredential2
|
|
36007
|
-
};
|
|
36008
|
-
}
|
|
36009
|
-
async function readSavedConnection(channelId, environment) {
|
|
36010
|
-
const connectionPath = join15(readStateDirectory(environment), "connections", `${channelId}.json`);
|
|
36011
|
-
let encoded = "";
|
|
36012
|
-
const handle = await open5(connectionPath, "r");
|
|
36013
|
-
try {
|
|
36014
|
-
const metadata = await handle.stat();
|
|
36015
|
-
if (!metadata.isFile() || metadata.size > MAX_CONNECTION_FILE_LENGTH) {
|
|
36016
|
-
throw new PairingClientError("invalid_connection", "The saved connection is invalid");
|
|
36017
|
-
}
|
|
36018
|
-
encoded = await handle.readFile({ encoding: "utf8" });
|
|
36019
|
-
} finally {
|
|
36020
|
-
await handle.close();
|
|
36021
|
-
}
|
|
36022
|
-
let value;
|
|
36023
|
-
try {
|
|
36024
|
-
value = JSON.parse(encoded);
|
|
36025
|
-
} catch (error62) {
|
|
36026
|
-
throw new PairingClientError("invalid_connection", "The saved connection is invalid", { cause: error62 });
|
|
36027
|
-
}
|
|
36028
|
-
const connection = decodeSavedConnection(value, channelId);
|
|
36029
|
-
return {
|
|
36030
|
-
defaultWorkspace: await resolveDefaultWorkspace(connection.defaultWorkspace),
|
|
36031
|
-
channelId: connection.channelId,
|
|
36032
|
-
relayOrigin: connection.relayOrigin,
|
|
36033
|
-
runtimeCredential: connection.runtimeCredential
|
|
36034
|
-
};
|
|
36035
|
-
}
|
|
36036
36557
|
function assertInventoryUsable(inventory) {
|
|
36037
36558
|
if (inventory.available.length + inventory.installable.length === 0) {
|
|
36038
36559
|
throw new PairingClientError("no_supported_agent", "No supported Agent is available for local discovery");
|
|
36039
36560
|
}
|
|
36040
36561
|
}
|
|
36041
|
-
function buildPairedDaemon(connection,
|
|
36562
|
+
function buildPairedDaemon(installation, connection, defaultWorkspace, inventory, localContext) {
|
|
36042
36563
|
assertInventoryUsable(inventory);
|
|
36043
36564
|
const relayUrl = mobiusApiUrl(connection.relayOrigin, "/v1/runtimes/connect");
|
|
36044
36565
|
relayUrl.protocol = relayUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
36045
36566
|
relayUrl.searchParams.set("token", connection.runtimeCredential);
|
|
36046
|
-
const auditDatabasePath = join15(readStateDirectory(environment), "audit", `${connection.channelId}.sqlite`);
|
|
36047
36567
|
return {
|
|
36048
36568
|
channelUrl: new URL(`/channels/${encodeURIComponent(connection.channelId)}`, connection.relayOrigin).toString(),
|
|
36569
|
+
connectionId: connection.connectionId,
|
|
36049
36570
|
config: createDaemonConfig(
|
|
36050
36571
|
{
|
|
36051
|
-
defaultWorkspace
|
|
36052
|
-
auditDatabasePath,
|
|
36572
|
+
defaultWorkspace,
|
|
36573
|
+
auditDatabasePath: installation.auditDatabasePath(connection.connectionId),
|
|
36053
36574
|
channelId: connection.channelId,
|
|
36054
36575
|
relayUrl
|
|
36055
36576
|
},
|
|
36056
36577
|
inventory.readyAgents(),
|
|
36057
|
-
inventory.installable
|
|
36578
|
+
inventory.installable,
|
|
36579
|
+
localContext,
|
|
36580
|
+
new OpaqueDaemonReconnectTarget(connection.connectionId)
|
|
36058
36581
|
),
|
|
36059
|
-
connectionPath
|
|
36582
|
+
connectionPath: installation.connectionPath(connection.connectionId)
|
|
36060
36583
|
};
|
|
36061
36584
|
}
|
|
36062
|
-
async function pairRuntime(options, signal, environment) {
|
|
36585
|
+
async function pairRuntime(installation, options, signal, environment) {
|
|
36586
|
+
const localContext = new DaemonLocalContext(installation.stateDirectory, environment);
|
|
36063
36587
|
const defaultWorkspace = await resolveDefaultWorkspace(options.workspace);
|
|
36064
36588
|
const inventory = await discoverLocalAgentInventory({
|
|
36065
36589
|
defaultWorkspace,
|
|
36066
|
-
environment,
|
|
36590
|
+
environment: localContext.environment,
|
|
36067
36591
|
signal
|
|
36068
36592
|
});
|
|
36069
36593
|
assertInventoryUsable(inventory);
|
|
36070
36594
|
const agents = inventory.readyAgents();
|
|
36071
36595
|
const claim2 = await claimPairing(options, defaultWorkspace, agents, inventory.installable, signal);
|
|
36072
|
-
const
|
|
36073
|
-
claim2.channelId,
|
|
36074
|
-
options.relayOrigin,
|
|
36075
|
-
claim2.runtimeCredential,
|
|
36076
|
-
defaultWorkspace,
|
|
36077
|
-
environment
|
|
36078
|
-
);
|
|
36079
|
-
return buildPairedDaemon(
|
|
36596
|
+
const connection = await installation.saveConnection(
|
|
36080
36597
|
{
|
|
36081
|
-
defaultWorkspace,
|
|
36082
36598
|
channelId: claim2.channelId,
|
|
36599
|
+
defaultWorkspace,
|
|
36083
36600
|
relayOrigin: options.relayOrigin,
|
|
36084
|
-
runtimeCredential: claim2.runtimeCredential
|
|
36601
|
+
runtimeCredential: claim2.runtimeCredential,
|
|
36602
|
+
runtimeId: claim2.runtimeId
|
|
36085
36603
|
},
|
|
36086
|
-
|
|
36087
|
-
inventory,
|
|
36088
|
-
environment
|
|
36604
|
+
signal
|
|
36089
36605
|
);
|
|
36606
|
+
return buildPairedDaemon(installation, connection, defaultWorkspace, inventory, localContext);
|
|
36090
36607
|
}
|
|
36091
|
-
async function pairMobiusRuntime(options, signal, environment = process.env) {
|
|
36608
|
+
async function pairMobiusRuntime(installation, options, signal, environment = process.env) {
|
|
36092
36609
|
return await pairRuntime(
|
|
36610
|
+
installation,
|
|
36093
36611
|
{
|
|
36094
36612
|
code: parsePairingCode(options.pairingCode),
|
|
36095
36613
|
pairingId: validatePairingId(options.pairingId),
|
|
36096
|
-
relayOrigin:
|
|
36614
|
+
relayOrigin: parseRelayOrigin2(options.relayOrigin),
|
|
36097
36615
|
workspace: options.defaultWorkspace
|
|
36098
36616
|
},
|
|
36099
36617
|
signal,
|
|
36100
36618
|
environment
|
|
36101
36619
|
);
|
|
36102
36620
|
}
|
|
36103
|
-
async function
|
|
36104
|
-
|
|
36105
|
-
|
|
36106
|
-
async function resumeMobiusRuntime(channelId, signal, environment = process.env) {
|
|
36107
|
-
const normalizedChannelId = validatePairingId(channelId);
|
|
36108
|
-
const connectionPath = join15(readStateDirectory(environment), "connections", `${normalizedChannelId}.json`);
|
|
36109
|
-
const connection = await readSavedConnection(normalizedChannelId, environment);
|
|
36621
|
+
async function resumeRuntimeConnection(installation, connection, signal, environment) {
|
|
36622
|
+
const localContext = new DaemonLocalContext(installation.stateDirectory, environment);
|
|
36623
|
+
const defaultWorkspace = await resolveDefaultWorkspace(connection.defaultWorkspace);
|
|
36110
36624
|
const inventory = await discoverLocalAgentInventory({
|
|
36111
|
-
defaultWorkspace
|
|
36112
|
-
environment,
|
|
36625
|
+
defaultWorkspace,
|
|
36626
|
+
environment: localContext.environment,
|
|
36113
36627
|
signal
|
|
36114
36628
|
});
|
|
36115
|
-
return buildPairedDaemon(connection,
|
|
36629
|
+
return buildPairedDaemon(installation, connection, defaultWorkspace, inventory, localContext);
|
|
36630
|
+
}
|
|
36631
|
+
async function resumeMobiusRuntime(installation, connectionId2, signal, environment = process.env) {
|
|
36632
|
+
const connection = await installation.readConnection(connectionId2, signal);
|
|
36633
|
+
return await resumeRuntimeConnection(installation, connection, signal, environment);
|
|
36634
|
+
}
|
|
36635
|
+
async function resumeLegacyChannel(installation, channelId, signal, environment) {
|
|
36636
|
+
const connection = await installation.migrateLegacyConnection(readStateDirectory(environment), channelId, signal);
|
|
36637
|
+
return await resumeRuntimeConnection(installation, connection, signal, environment);
|
|
36638
|
+
}
|
|
36639
|
+
async function openMobiusCliInstallation(signal, environment) {
|
|
36640
|
+
return await openRuntimeInstallationStore(
|
|
36641
|
+
{
|
|
36642
|
+
applicationId: MOBIUS_CLI_APPLICATION_ID,
|
|
36643
|
+
stateDirectory: readStateDirectory(environment)
|
|
36644
|
+
},
|
|
36645
|
+
signal
|
|
36646
|
+
);
|
|
36647
|
+
}
|
|
36648
|
+
async function pairLocalMachine(arguments_, signal = new AbortController().signal) {
|
|
36649
|
+
const requested = parsePairCommand(arguments_, "");
|
|
36650
|
+
const installation = await openMobiusCliInstallation(signal, process.env);
|
|
36651
|
+
const localContext = new DaemonLocalContext(installation.stateDirectory, process.env);
|
|
36652
|
+
return await pairRuntime(
|
|
36653
|
+
installation,
|
|
36654
|
+
{
|
|
36655
|
+
code: requested.code,
|
|
36656
|
+
pairingId: requested.pairingId,
|
|
36657
|
+
relayOrigin: requested.relayOrigin,
|
|
36658
|
+
workspace: arguments_.includes("--workspace") ? requested.workspace : loadDefaultWorkspace(localContext.environment)
|
|
36659
|
+
},
|
|
36660
|
+
signal,
|
|
36661
|
+
process.env
|
|
36662
|
+
);
|
|
36116
36663
|
}
|
|
36117
36664
|
async function resumeLocalMachine(arguments_, signal = new AbortController().signal) {
|
|
36118
|
-
|
|
36665
|
+
const target = parseResumeArgument(arguments_);
|
|
36666
|
+
const installation = await openMobiusCliInstallation(signal, process.env);
|
|
36667
|
+
return await target.resume(installation, signal, process.env);
|
|
36119
36668
|
}
|
|
36120
36669
|
|
|
36121
36670
|
// src/run-daemon.ts
|
|
@@ -36468,7 +37017,7 @@ var AgentInstallationManager = class {
|
|
|
36468
37017
|
|
|
36469
37018
|
// src/agent-installation/fixed-installation-executor.ts
|
|
36470
37019
|
import { realpathSync as realpathSync2, statSync as statSync2 } from "node:fs";
|
|
36471
|
-
import { resolve as
|
|
37020
|
+
import { resolve as resolve6 } from "node:path";
|
|
36472
37021
|
function findSpecification(specifications, agentId) {
|
|
36473
37022
|
for (const specification of specifications) {
|
|
36474
37023
|
if (specification.id === agentId) {
|
|
@@ -36479,7 +37028,7 @@ function findSpecification(specifications, agentId) {
|
|
|
36479
37028
|
}
|
|
36480
37029
|
function resolveDefaultWorkspace2(path2) {
|
|
36481
37030
|
try {
|
|
36482
|
-
const directory = realpathSync2(
|
|
37031
|
+
const directory = realpathSync2(resolve6(path2));
|
|
36483
37032
|
if (!statSync2(directory).isDirectory()) {
|
|
36484
37033
|
throw new Error("Default workspace is not a directory");
|
|
36485
37034
|
}
|
|
@@ -36494,7 +37043,7 @@ function resolveDefaultWorkspace2(path2) {
|
|
|
36494
37043
|
}
|
|
36495
37044
|
function resolveIntegrationStateDirectory(path2) {
|
|
36496
37045
|
try {
|
|
36497
|
-
const directory = realpathSync2(
|
|
37046
|
+
const directory = realpathSync2(resolve6(path2));
|
|
36498
37047
|
const metadata = statSync2(directory);
|
|
36499
37048
|
if (!metadata.isDirectory() || typeof process.getuid === "function" && metadata.uid !== process.getuid()) {
|
|
36500
37049
|
throw new Error("Installation directory is not user-owned");
|
|
@@ -36749,7 +37298,7 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
36749
37298
|
}
|
|
36750
37299
|
|
|
36751
37300
|
// src/artifacts/runtime-artifact-uploader.ts
|
|
36752
|
-
import { createHash as
|
|
37301
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
36753
37302
|
|
|
36754
37303
|
// ../mobius-sdk/src/errors.ts
|
|
36755
37304
|
var MobiusError = class extends Error {
|
|
@@ -36774,15 +37323,15 @@ var MobiusValidationError = class extends MobiusError {
|
|
|
36774
37323
|
};
|
|
36775
37324
|
|
|
36776
37325
|
// ../mobius-sdk/src/resources.ts
|
|
36777
|
-
var
|
|
37326
|
+
var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
36778
37327
|
function invalidResponse(message) {
|
|
36779
37328
|
return new MobiusProtocolError(message);
|
|
36780
37329
|
}
|
|
36781
|
-
function
|
|
37330
|
+
function isRecord10(value) {
|
|
36782
37331
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36783
37332
|
}
|
|
36784
37333
|
function record3(value, name) {
|
|
36785
|
-
if (!
|
|
37334
|
+
if (!isRecord10(value)) {
|
|
36786
37335
|
throw invalidResponse(`The service returned an invalid ${name}`);
|
|
36787
37336
|
}
|
|
36788
37337
|
return value;
|
|
@@ -36796,7 +37345,7 @@ function stringField(value, field, maximumLength = 85e5) {
|
|
|
36796
37345
|
}
|
|
36797
37346
|
function identifierField(value, field) {
|
|
36798
37347
|
const candidate = stringField(value, field, 128);
|
|
36799
|
-
if (!
|
|
37348
|
+
if (!IDENTIFIER_PATTERN6.test(candidate)) {
|
|
36800
37349
|
throw invalidResponse(`The service returned an invalid ${field}`);
|
|
36801
37350
|
}
|
|
36802
37351
|
return candidate;
|
|
@@ -37068,7 +37617,7 @@ async function uploadRuntimeArtifact(config2, sessionId, artifact, signal) {
|
|
|
37068
37617
|
artifact.name,
|
|
37069
37618
|
artifact.mimeType,
|
|
37070
37619
|
artifact.bytes.byteLength,
|
|
37071
|
-
|
|
37620
|
+
createHash3("sha256").update(artifact.bytes).digest("hex")
|
|
37072
37621
|
);
|
|
37073
37622
|
} catch (cause) {
|
|
37074
37623
|
translateSdkError(cause);
|
|
@@ -37136,7 +37685,7 @@ async function uploadRuntimeArtifact(config2, sessionId, artifact, signal) {
|
|
|
37136
37685
|
// src/authorization/workspace-directory.ts
|
|
37137
37686
|
import { readdir as readdir2, realpath as realpath9, stat as stat8 } from "node:fs/promises";
|
|
37138
37687
|
import { homedir as homedir2 } from "node:os";
|
|
37139
|
-
import { basename as basename5, dirname as
|
|
37688
|
+
import { basename as basename5, dirname as dirname6, isAbsolute as isAbsolute10, join as join16, normalize as normalize4, relative as relative4 } from "node:path";
|
|
37140
37689
|
var WorkspaceDirectoryListing = class {
|
|
37141
37690
|
directoryId;
|
|
37142
37691
|
directoryLabel;
|
|
@@ -37260,7 +37809,7 @@ var WorkspaceDirectoryService = class {
|
|
|
37260
37809
|
}
|
|
37261
37810
|
}
|
|
37262
37811
|
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
37263
|
-
const parent =
|
|
37812
|
+
const parent = dirname6(target);
|
|
37264
37813
|
return new WorkspaceDirectoryListing(
|
|
37265
37814
|
id,
|
|
37266
37815
|
this.label(target),
|
|
@@ -37952,13 +38501,13 @@ var NativeSessionService = class {
|
|
|
37952
38501
|
};
|
|
37953
38502
|
|
|
37954
38503
|
// src/prompt-artifact-resolver.ts
|
|
37955
|
-
import { createHash as
|
|
38504
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
37956
38505
|
import { fetch as fetch5 } from "undici";
|
|
37957
38506
|
var ARTIFACT_SCHEME = "mobius-artifact:";
|
|
37958
38507
|
var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
37959
38508
|
var MAX_AGENT_IMAGE_BASE64_LENGTH = 4e6;
|
|
37960
38509
|
var MAX_AGENT_RESOURCE_BYTE_LENGTH = 1e6;
|
|
37961
|
-
var
|
|
38510
|
+
var IDENTIFIER_PATTERN7 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
37962
38511
|
var PromptArtifactError = class extends Error {
|
|
37963
38512
|
code;
|
|
37964
38513
|
constructor(code, message, options = {}) {
|
|
@@ -38001,7 +38550,7 @@ function parseReference(resource) {
|
|
|
38001
38550
|
const encodedByteLength2 = url2.searchParams.get("byteLength") ?? "";
|
|
38002
38551
|
const sha256 = url2.searchParams.get("sha256") ?? "";
|
|
38003
38552
|
const byteLength = Number(encodedByteLength2);
|
|
38004
|
-
if (url2.protocol !== ARTIFACT_SCHEME || url2.hash.length > 0 || resource.type !== "link" || resource.text.length > 0 || !
|
|
38553
|
+
if (url2.protocol !== ARTIFACT_SCHEME || url2.hash.length > 0 || resource.type !== "link" || resource.text.length > 0 || !IDENTIFIER_PATTERN7.test(artifactId) || keys.length !== 2 || keys[0] !== "byteLength" || keys[1] !== "sha256" || !/^[1-9][0-9]*$/.test(encodedByteLength2) || !Number.isSafeInteger(byteLength) || !/^[a-f0-9]{64}$/.test(sha256)) {
|
|
38005
38554
|
throw new PromptArtifactError("artifact_reference_invalid", "The prompt artifact reference is invalid");
|
|
38006
38555
|
}
|
|
38007
38556
|
return new PromptArtifactReference(artifactId, byteLength, sha256, resource);
|
|
@@ -38091,7 +38640,7 @@ async function download(config2, command, reference, signal) {
|
|
|
38091
38640
|
);
|
|
38092
38641
|
}
|
|
38093
38642
|
const bytes = await responseBytes(response, reference.byteLength, requestSignal);
|
|
38094
|
-
if (
|
|
38643
|
+
if (createHash4("sha256").update(bytes).digest("hex") !== reference.sha256) {
|
|
38095
38644
|
throw new PromptArtifactError(
|
|
38096
38645
|
"artifact_integrity_failed",
|
|
38097
38646
|
"The prompt artifact failed integrity validation"
|
|
@@ -38181,7 +38730,7 @@ var RelayConnectionError = class extends Error {
|
|
|
38181
38730
|
};
|
|
38182
38731
|
function connectRelay(url2, signal) {
|
|
38183
38732
|
signal.throwIfAborted();
|
|
38184
|
-
return new Promise((
|
|
38733
|
+
return new Promise((resolve8, reject) => {
|
|
38185
38734
|
const endpoint = new URL(url2);
|
|
38186
38735
|
const headers = runtimeAuthorization(endpoint);
|
|
38187
38736
|
endpoint.searchParams.delete("token");
|
|
@@ -38244,7 +38793,7 @@ function connectRelay(url2, signal) {
|
|
|
38244
38793
|
}
|
|
38245
38794
|
finished = true;
|
|
38246
38795
|
cleanup();
|
|
38247
|
-
|
|
38796
|
+
resolve8(socket);
|
|
38248
38797
|
};
|
|
38249
38798
|
function onTimeout() {
|
|
38250
38799
|
fail(
|
|
@@ -38505,7 +39054,7 @@ var RelayConnectionLiveness = class {
|
|
|
38505
39054
|
|
|
38506
39055
|
// src/relay-connection/session-event-outbox.ts
|
|
38507
39056
|
import { mkdirSync as mkdirSync3 } from "node:fs";
|
|
38508
|
-
import { dirname as
|
|
39057
|
+
import { dirname as dirname7 } from "node:path";
|
|
38509
39058
|
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
38510
39059
|
var DEFAULT_OUTBOX_LIMITS = {
|
|
38511
39060
|
criticalEventBytes: 136 * 1024 * 1024,
|
|
@@ -38571,7 +39120,7 @@ var SessionEventOutbox = class {
|
|
|
38571
39120
|
constructor(path2, limits = DEFAULT_OUTBOX_LIMITS) {
|
|
38572
39121
|
validateLimits(limits);
|
|
38573
39122
|
this.#limits = limits;
|
|
38574
|
-
mkdirSync3(
|
|
39123
|
+
mkdirSync3(dirname7(path2), { recursive: true });
|
|
38575
39124
|
this.#database = new DatabaseSync3(path2);
|
|
38576
39125
|
this.#database.exec(`
|
|
38577
39126
|
CREATE TABLE IF NOT EXISTS relay_session_event_outbox (
|
|
@@ -39891,10 +40440,11 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
39891
40440
|
"prompt_queue_target_unavailable"
|
|
39892
40441
|
);
|
|
39893
40442
|
}
|
|
40443
|
+
const executionAgent = command.sessionConfigurations === void 0 ? agent : agentForSessionConfiguration(agent, command.sessionConfigurations);
|
|
39894
40444
|
if (command.sessionConfigurations !== void 0) {
|
|
39895
40445
|
const prepared = await sessions.prepareExecutionSession({
|
|
39896
40446
|
additionalDirectories: resolved.additionalDirectories,
|
|
39897
|
-
agent,
|
|
40447
|
+
agent: executionAgent,
|
|
39898
40448
|
cwd: resolved.cwd,
|
|
39899
40449
|
sessionId: command.sessionId,
|
|
39900
40450
|
signal
|
|
@@ -39907,7 +40457,7 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
39907
40457
|
audit,
|
|
39908
40458
|
prepared.configOptions,
|
|
39909
40459
|
command.sessionConfigurations,
|
|
39910
|
-
|
|
40460
|
+
executionAgent,
|
|
39911
40461
|
resolved.cwd,
|
|
39912
40462
|
resolved.additionalDirectories,
|
|
39913
40463
|
command.commandId,
|
|
@@ -39938,7 +40488,7 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
39938
40488
|
if (command.disposition === SessionPromptDisposition.Steer) {
|
|
39939
40489
|
await sessions.steerPrompt({
|
|
39940
40490
|
additionalDirectories: resolved.additionalDirectories,
|
|
39941
|
-
agent,
|
|
40491
|
+
agent: executionAgent,
|
|
39942
40492
|
commandId: command.commandId,
|
|
39943
40493
|
cwd: resolved.cwd,
|
|
39944
40494
|
images: attachments.images,
|
|
@@ -39952,7 +40502,7 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
39952
40502
|
} else {
|
|
39953
40503
|
const result = await sessions.runPrompt({
|
|
39954
40504
|
additionalDirectories: resolved.additionalDirectories,
|
|
39955
|
-
agent,
|
|
40505
|
+
agent: executionAgent,
|
|
39956
40506
|
commandId: command.commandId,
|
|
39957
40507
|
cwd: resolved.cwd,
|
|
39958
40508
|
disposition: command.disposition,
|
|
@@ -40019,6 +40569,16 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40019
40569
|
function invalidSessionConfiguration(message) {
|
|
40020
40570
|
return new AcpExecutionError(message, {}, "invalid_session_configuration");
|
|
40021
40571
|
}
|
|
40572
|
+
function agentForSessionConfiguration(agent, selections) {
|
|
40573
|
+
const permission = selections.find((selection) => selection.configId === AGENT_PERMISSION_MODE_CONFIG_ID);
|
|
40574
|
+
if (permission === void 0) {
|
|
40575
|
+
throw invalidSessionConfiguration(
|
|
40576
|
+
`The Turn configuration does not match Agent setting ${AGENT_PERMISSION_MODE_CONFIG_ID}`
|
|
40577
|
+
);
|
|
40578
|
+
}
|
|
40579
|
+
validateSessionConfigurationSelection(agent.permissionProfile.option(agent.environment), permission);
|
|
40580
|
+
return agent.withPermissionMode(permission.value);
|
|
40581
|
+
}
|
|
40022
40582
|
function validateSessionConfigurationSelection(option, selection) {
|
|
40023
40583
|
if (option.type !== selection.valueType) {
|
|
40024
40584
|
throw invalidSessionConfiguration(`The Agent setting ${selection.configId} changed type`);
|
|
@@ -40242,12 +40802,12 @@ function waitForRelayRetry(signal, timer) {
|
|
|
40242
40802
|
if (signal.aborted) {
|
|
40243
40803
|
return Promise.resolve();
|
|
40244
40804
|
}
|
|
40245
|
-
return new Promise((
|
|
40805
|
+
return new Promise((resolve8) => {
|
|
40246
40806
|
const retry = timer.schedule(finish, RELAY_RECONNECT_DELAY_MILLISECONDS);
|
|
40247
40807
|
function finish() {
|
|
40248
40808
|
retry.cancel();
|
|
40249
40809
|
signal.removeEventListener("abort", finish);
|
|
40250
|
-
|
|
40810
|
+
resolve8();
|
|
40251
40811
|
}
|
|
40252
40812
|
signal.addEventListener("abort", finish, { once: true });
|
|
40253
40813
|
});
|
|
@@ -40303,7 +40863,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40303
40863
|
installationObserver.connect(socket);
|
|
40304
40864
|
onConnected();
|
|
40305
40865
|
try {
|
|
40306
|
-
await new Promise((
|
|
40866
|
+
await new Promise((resolve8, reject) => {
|
|
40307
40867
|
let finished = false;
|
|
40308
40868
|
const cleanup = () => {
|
|
40309
40869
|
connectionLiveness.close();
|
|
@@ -40321,7 +40881,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40321
40881
|
}
|
|
40322
40882
|
finished = true;
|
|
40323
40883
|
cleanup();
|
|
40324
|
-
|
|
40884
|
+
resolve8();
|
|
40325
40885
|
};
|
|
40326
40886
|
const rejectConnection = (failure2) => {
|
|
40327
40887
|
if (finished) {
|
|
@@ -40768,7 +41328,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40768
41328
|
try {
|
|
40769
41329
|
operationSignal.throwIfAborted();
|
|
40770
41330
|
if (previous2.length > 0) {
|
|
40771
|
-
await new Promise((
|
|
41331
|
+
await new Promise((resolve9, reject2) => {
|
|
40772
41332
|
const cancel = () => reject2(operationSignal.reason);
|
|
40773
41333
|
operationSignal.addEventListener("abort", cancel, {
|
|
40774
41334
|
once: true
|
|
@@ -40776,7 +41336,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40776
41336
|
void Promise.all(previous2.map((request) => request.completion)).then(
|
|
40777
41337
|
() => {
|
|
40778
41338
|
operationSignal.removeEventListener("abort", cancel);
|
|
40779
|
-
|
|
41339
|
+
resolve9();
|
|
40780
41340
|
},
|
|
40781
41341
|
(error62) => {
|
|
40782
41342
|
operationSignal.removeEventListener("abort", cancel);
|
|
@@ -40850,13 +41410,13 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40850
41410
|
try {
|
|
40851
41411
|
operationSignal.throwIfAborted();
|
|
40852
41412
|
if (previous2.length > 0) {
|
|
40853
|
-
await new Promise((
|
|
41413
|
+
await new Promise((resolve9, reject2) => {
|
|
40854
41414
|
const cancel = () => reject2(operationSignal.reason);
|
|
40855
41415
|
operationSignal.addEventListener("abort", cancel, { once: true });
|
|
40856
41416
|
void Promise.all(previous2.map((request) => request.completion)).then(
|
|
40857
41417
|
() => {
|
|
40858
41418
|
operationSignal.removeEventListener("abort", cancel);
|
|
40859
|
-
|
|
41419
|
+
resolve9();
|
|
40860
41420
|
},
|
|
40861
41421
|
(error62) => {
|
|
40862
41422
|
operationSignal.removeEventListener("abort", cancel);
|
|
@@ -41111,13 +41671,13 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41111
41671
|
}
|
|
41112
41672
|
async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
41113
41673
|
const installationAudit = new AuditInstallationEvents(audit);
|
|
41114
|
-
const stateDirectory =
|
|
41674
|
+
const stateDirectory = config2.localContext.stateDirectory;
|
|
41115
41675
|
const specifications = supportedLocalAgentSpecifications();
|
|
41116
41676
|
const installationExecutor = new FixedInstallationExecutor({
|
|
41117
41677
|
defaultWorkspace: config2.defaultWorkspace,
|
|
41118
41678
|
audit: installationAudit,
|
|
41119
41679
|
catalog: config2.catalog,
|
|
41120
|
-
environment:
|
|
41680
|
+
environment: config2.localContext.environment,
|
|
41121
41681
|
publishCatalog: async (installationSignal) => await publishAgentCatalog(config2, installationSignal),
|
|
41122
41682
|
stateDirectory
|
|
41123
41683
|
});
|
|
@@ -41176,10 +41736,10 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41176
41736
|
return;
|
|
41177
41737
|
}
|
|
41178
41738
|
connectionAnnounced = true;
|
|
41179
|
-
const reconnectCommand = `npx --yes @moxt-ai/mobius start
|
|
41739
|
+
const reconnectCommand = `npx --yes @moxt-ai/mobius start ${config2.reconnectTarget.commandArgument}`;
|
|
41180
41740
|
process.stdout.write("Mobius daemon connected to the relay.\n\n");
|
|
41181
41741
|
process.stdout.write(
|
|
41182
|
-
`${styleText(["bold", "yellow"], `Reconnect this
|
|
41742
|
+
`${styleText(["bold", "yellow"], `Reconnect this local connection later:
|
|
41183
41743
|
${reconnectCommand}`)}
|
|
41184
41744
|
|
|
41185
41745
|
`
|
|
@@ -41261,10 +41821,10 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41261
41821
|
}
|
|
41262
41822
|
|
|
41263
41823
|
// src/runtime.ts
|
|
41264
|
-
import { mkdir as
|
|
41265
|
-
import { dirname as
|
|
41266
|
-
var
|
|
41267
|
-
var
|
|
41824
|
+
import { mkdir as mkdir5, realpath as realpath10, stat as stat9 } from "node:fs/promises";
|
|
41825
|
+
import { dirname as dirname8, join as join17, resolve as resolve7 } from "node:path";
|
|
41826
|
+
var IDENTIFIER_PATTERN8 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
41827
|
+
var RUNTIME_CREDENTIAL_PATTERN2 = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
41268
41828
|
var MobiusRuntimeConfigurationError = class extends Error {
|
|
41269
41829
|
code = "runtime_configuration_invalid";
|
|
41270
41830
|
constructor(message, options = {}) {
|
|
@@ -41288,7 +41848,7 @@ function validateRuntimeRelay(relayUrl) {
|
|
|
41288
41848
|
if (credential.length === 0) {
|
|
41289
41849
|
throw new MobiusRuntimeConfigurationError("The Runtime relay credential is required");
|
|
41290
41850
|
}
|
|
41291
|
-
if (!
|
|
41851
|
+
if (!RUNTIME_CREDENTIAL_PATTERN2.test(credential)) {
|
|
41292
41852
|
throw new MobiusRuntimeConfigurationError("The Runtime relay credential is invalid");
|
|
41293
41853
|
}
|
|
41294
41854
|
}
|
|
@@ -41315,7 +41875,7 @@ function relayUrlFromConnection(connection) {
|
|
|
41315
41875
|
}
|
|
41316
41876
|
function loadMobiusRuntimeConnection(environment = process.env) {
|
|
41317
41877
|
const channelId = requiredEnvironmentValue(environment, "MOBIUS_CHANNEL_ID");
|
|
41318
|
-
if (!
|
|
41878
|
+
if (!IDENTIFIER_PATTERN8.test(channelId)) {
|
|
41319
41879
|
throw new MobiusRuntimeConfigurationError("MOBIUS_CHANNEL_ID is invalid");
|
|
41320
41880
|
}
|
|
41321
41881
|
return Object.freeze({
|
|
@@ -41327,9 +41887,9 @@ function loadMobiusRuntimeConnection(environment = process.env) {
|
|
|
41327
41887
|
});
|
|
41328
41888
|
}
|
|
41329
41889
|
async function resolveWorkspace(path2) {
|
|
41330
|
-
const requested =
|
|
41890
|
+
const requested = resolve7(path2);
|
|
41331
41891
|
try {
|
|
41332
|
-
await
|
|
41892
|
+
await mkdir5(requested, { recursive: true, mode: 448 });
|
|
41333
41893
|
const resolved = await realpath10(requested);
|
|
41334
41894
|
const metadata = await stat9(resolved);
|
|
41335
41895
|
if (!metadata.isDirectory()) {
|
|
@@ -41345,13 +41905,14 @@ async function resolveWorkspace(path2) {
|
|
|
41345
41905
|
}
|
|
41346
41906
|
async function createMobiusRuntimeEngine(connection, signal, environment = process.env) {
|
|
41347
41907
|
signal.throwIfAborted();
|
|
41908
|
+
const localContext = new DaemonLocalContext(readStateDirectory(environment), environment);
|
|
41348
41909
|
const relayUrl = relayUrlFromConnection(connection);
|
|
41349
41910
|
const defaultWorkspace = await resolveWorkspace(connection.defaultWorkspace);
|
|
41350
|
-
const auditDatabasePath =
|
|
41351
|
-
await
|
|
41911
|
+
const auditDatabasePath = resolve7(connection.auditDatabasePath);
|
|
41912
|
+
await mkdir5(dirname8(auditDatabasePath), { recursive: true, mode: 448 });
|
|
41352
41913
|
const inventory = await discoverLocalAgentInventory({
|
|
41353
41914
|
defaultWorkspace,
|
|
41354
|
-
environment,
|
|
41915
|
+
environment: localContext.environment,
|
|
41355
41916
|
signal
|
|
41356
41917
|
});
|
|
41357
41918
|
if (inventory.available.length + inventory.installable.length === 0) {
|
|
@@ -41366,7 +41927,8 @@ async function createMobiusRuntimeEngine(connection, signal, environment = proce
|
|
|
41366
41927
|
relayUrl
|
|
41367
41928
|
},
|
|
41368
41929
|
inventory.readyAgents(),
|
|
41369
|
-
inventory.installable
|
|
41930
|
+
inventory.installable,
|
|
41931
|
+
localContext
|
|
41370
41932
|
)
|
|
41371
41933
|
);
|
|
41372
41934
|
}
|
|
@@ -41395,14 +41957,24 @@ var MobiusRuntimeEngine = class {
|
|
|
41395
41957
|
export {
|
|
41396
41958
|
AcpExecutionError,
|
|
41397
41959
|
AuditStore,
|
|
41960
|
+
ChannelDaemonReconnectTarget,
|
|
41961
|
+
DaemonLocalContext,
|
|
41962
|
+
DaemonReconnectTarget,
|
|
41963
|
+
ImportedLegacyRuntimeConnection,
|
|
41398
41964
|
LocalAuthorizationError,
|
|
41399
41965
|
MobiusRuntimeConfigurationError,
|
|
41400
41966
|
MobiusRuntimeEngine,
|
|
41967
|
+
OpaqueDaemonReconnectTarget,
|
|
41401
41968
|
PairingClientError,
|
|
41969
|
+
RuntimeInstallationStore,
|
|
41970
|
+
RuntimeInstallationStoreError,
|
|
41971
|
+
StoredRuntimeConnection,
|
|
41972
|
+
VerifiedRuntimeConnection,
|
|
41402
41973
|
createAcpClient,
|
|
41403
41974
|
createMobiusRuntimeEngine,
|
|
41404
41975
|
loadDaemonConfig,
|
|
41405
41976
|
loadMobiusRuntimeConnection,
|
|
41977
|
+
openRuntimeInstallationStore,
|
|
41406
41978
|
pairLocalMachine,
|
|
41407
41979
|
pairMobiusRuntime,
|
|
41408
41980
|
resumeLocalMachine,
|