@moxt-ai/mobius 0.0.82 → 0.0.88
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-config/session-config-registry.d.ts +1 -1
- package/dist/acp/session-config/session-config-registry.d.ts.map +1 -1
- package/dist/acp/session-config/session-config-registry.js +2 -3
- package/dist/acp/session-config/session-config-registry.js.map +1 -1
- package/dist/agent-catalog/agent-specification.d.ts +2 -0
- package/dist/agent-catalog/agent-specification.d.ts.map +1 -1
- package/dist/agent-catalog/agent-specification.js +2 -0
- package/dist/agent-catalog/agent-specification.js.map +1 -1
- package/dist/agent-catalog/agent-version.d.ts +3 -0
- package/dist/agent-catalog/agent-version.d.ts.map +1 -0
- package/dist/agent-catalog/agent-version.js +54 -0
- package/dist/agent-catalog/agent-version.js.map +1 -0
- package/dist/agent-catalog/agents/claude-code-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/claude-code-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/claude-code-agent.js +2 -0
- package/dist/agent-catalog/agents/claude-code-agent.js.map +1 -1
- package/dist/agent-catalog/agents/codex-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/codex-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/codex-agent.js +2 -0
- package/dist/agent-catalog/agents/codex-agent.js.map +1 -1
- package/dist/agent-catalog/agents/copilot-cli-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/copilot-cli-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/copilot-cli-agent.js +2 -0
- package/dist/agent-catalog/agents/copilot-cli-agent.js.map +1 -1
- package/dist/agent-catalog/agents/cursor-cli-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/cursor-cli-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/cursor-cli-agent.js +2 -0
- package/dist/agent-catalog/agents/cursor-cli-agent.js.map +1 -1
- package/dist/agent-catalog/agents/deepseek-harness-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/deepseek-harness-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/deepseek-harness-agent.js +2 -0
- package/dist/agent-catalog/agents/deepseek-harness-agent.js.map +1 -1
- package/dist/agent-catalog/agents/gemini-cli-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/gemini-cli-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/gemini-cli-agent.js +2 -0
- package/dist/agent-catalog/agents/gemini-cli-agent.js.map +1 -1
- package/dist/agent-catalog/agents/grok-build-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/grok-build-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/grok-build-agent.js +2 -0
- package/dist/agent-catalog/agents/grok-build-agent.js.map +1 -1
- package/dist/agent-catalog/agents/hermes-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/hermes-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/hermes-agent.js +2 -0
- package/dist/agent-catalog/agents/hermes-agent.js.map +1 -1
- package/dist/agent-catalog/agents/oh-my-pi-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/oh-my-pi-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/oh-my-pi-agent.js +2 -0
- package/dist/agent-catalog/agents/oh-my-pi-agent.js.map +1 -1
- package/dist/agent-catalog/agents/opencode-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/opencode-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/opencode-agent.js +2 -0
- package/dist/agent-catalog/agents/opencode-agent.js.map +1 -1
- package/dist/agent-catalog/agents/pi-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/pi-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/pi-agent.js +2 -0
- package/dist/agent-catalog/agents/pi-agent.js.map +1 -1
- package/dist/agent-catalog/agents/workbuddy-agent.d.ts +2 -0
- package/dist/agent-catalog/agents/workbuddy-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/workbuddy-agent.js +2 -0
- package/dist/agent-catalog/agents/workbuddy-agent.js.map +1 -1
- package/dist/agent-catalog/discover-agent.d.ts.map +1 -1
- package/dist/agent-catalog/discover-agent.js +9 -0
- package/dist/agent-catalog/discover-agent.js.map +1 -1
- package/dist/agent-installation/deepseek-managed-package.d.ts.map +1 -1
- package/dist/agent-installation/deepseek-managed-package.js +3 -2
- package/dist/agent-installation/deepseek-managed-package.js.map +1 -1
- package/dist/cli.js +1151 -536
- package/dist/cli.js.map +4 -4
- package/dist/config.d.ts +2 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -10
- package/dist/config.js.map +1 -1
- package/dist/daemon-manager.d.ts +51 -0
- package/dist/daemon-manager.d.ts.map +1 -0
- package/dist/daemon-manager.js +589 -0
- package/dist/daemon-manager.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +336 -431
- package/dist/index.js.map +4 -4
- package/dist/pairing/pair-local-machine.d.ts.map +1 -1
- package/dist/pairing/pair-local-machine.js +26 -40
- package/dist/pairing/pair-local-machine.js.map +1 -1
- package/dist/relay-connection/session-event-outbox.d.ts.map +1 -1
- package/dist/relay-connection/session-event-outbox.js +0 -62
- package/dist/relay-connection/session-event-outbox.js.map +1 -1
- package/dist/run-daemon.d.ts +1 -0
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +16 -4
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.d.ts +3 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +317 -383
- package/dist/runtime.js.map +4 -4
- package/dist/storage/runtime-installation-store.d.ts +14 -5
- package/dist/storage/runtime-installation-store.d.ts.map +1 -1
- package/dist/storage/runtime-installation-store.js +134 -89
- package/dist/storage/runtime-installation-store.js.map +1 -1
- package/package.json +1 -1
- package/dist/acp/session-config/grok-build-session-config.d.ts +0 -10
- package/dist/acp/session-config/grok-build-session-config.d.ts.map +0 -1
- package/dist/acp/session-config/grok-build-session-config.js +0 -197
- package/dist/acp/session-config/grok-build-session-config.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -22344,16 +22344,7 @@ var OpaqueDaemonReconnectTarget = class extends DaemonReconnectTarget {
|
|
|
22344
22344
|
this.commandArgument = `--connection ${connectionId2}`;
|
|
22345
22345
|
}
|
|
22346
22346
|
};
|
|
22347
|
-
|
|
22348
|
-
channelId;
|
|
22349
|
-
commandArgument;
|
|
22350
|
-
constructor(channelId) {
|
|
22351
|
-
super();
|
|
22352
|
-
this.channelId = channelId;
|
|
22353
|
-
this.commandArgument = `--channel ${channelId}`;
|
|
22354
|
-
}
|
|
22355
|
-
};
|
|
22356
|
-
function createDaemonConfig(connection, agents = [], installableAgents = [], localContext = new DaemonLocalContext(readStateDirectory(), process.env), reconnectTarget = new ChannelDaemonReconnectTarget(connection.channelId)) {
|
|
22347
|
+
function createDaemonConfig(connection, agents = [], installableAgents = [], localContext = new DaemonLocalContext(readStateDirectory(), process.env), reconnectTarget = null) {
|
|
22357
22348
|
const daemonAgents = agents.map((agent) => withDaemonEnvironment(agent, localContext.environment));
|
|
22358
22349
|
return {
|
|
22359
22350
|
agents: daemonAgents,
|
|
@@ -30521,7 +30512,6 @@ var nativeSessionPageSchema = external_exports.object({
|
|
|
30521
30512
|
|
|
30522
30513
|
// src/acp/session-config/session-config-protocol.ts
|
|
30523
30514
|
import { methods as methods2 } from "@agentclientprotocol/sdk";
|
|
30524
|
-
var AGENT_DEFAULT_REASONING_EFFORT = "agent_default";
|
|
30525
30515
|
var MAXIMUM_CONFIG_OPTIONS = 100;
|
|
30526
30516
|
var SessionConfigProtocolError = class extends Error {
|
|
30527
30517
|
code = "invalid_session_configuration_response";
|
|
@@ -30719,207 +30709,9 @@ var StandardSessionConfigProtocol = class {
|
|
|
30719
30709
|
};
|
|
30720
30710
|
var standardSessionConfigProtocol = new StandardSessionConfigProtocol();
|
|
30721
30711
|
|
|
30722
|
-
// src/acp/session-config/grok-build-session-config.ts
|
|
30723
|
-
var LEGACY_MODEL_CONFIG_ID = "grok_build_legacy_model";
|
|
30724
|
-
var LEGACY_REASONING_EFFORT_CONFIG_ID = "grok_build_legacy_reasoning_effort";
|
|
30725
|
-
function legacyOptions(response) {
|
|
30726
|
-
if (!isRecord4(response)) {
|
|
30727
|
-
return [];
|
|
30728
|
-
}
|
|
30729
|
-
const metadata = response["_meta"];
|
|
30730
|
-
if (!isRecord4(metadata)) {
|
|
30731
|
-
return [];
|
|
30732
|
-
}
|
|
30733
|
-
const sessionConfig = metadata["x.ai/sessionConfig"];
|
|
30734
|
-
if (!isRecord4(sessionConfig) || !Array.isArray(sessionConfig["options"])) {
|
|
30735
|
-
return [];
|
|
30736
|
-
}
|
|
30737
|
-
return sessionConfig["options"].slice(0, 500).filter(isRecord4);
|
|
30738
|
-
}
|
|
30739
|
-
function legacyValue(option) {
|
|
30740
|
-
const value = readString2(option["id"]);
|
|
30741
|
-
return {
|
|
30742
|
-
description: readString2(option["description"]).slice(0, 500),
|
|
30743
|
-
groupId: "",
|
|
30744
|
-
groupName: "",
|
|
30745
|
-
name: readString2(option["label"], value).slice(0, 255),
|
|
30746
|
-
value: value.slice(0, 500)
|
|
30747
|
-
};
|
|
30748
|
-
}
|
|
30749
|
-
function modelsRecord(response) {
|
|
30750
|
-
if (!isRecord4(response) || !isRecord4(response["models"])) {
|
|
30751
|
-
return {};
|
|
30752
|
-
}
|
|
30753
|
-
return response["models"];
|
|
30754
|
-
}
|
|
30755
|
-
function legacyModelOptions(response) {
|
|
30756
|
-
const options = legacyOptions(response);
|
|
30757
|
-
const models = modelsRecord(response);
|
|
30758
|
-
const values = [];
|
|
30759
|
-
for (const option of options) {
|
|
30760
|
-
if (option["category"] === "model") {
|
|
30761
|
-
const value = legacyValue(option);
|
|
30762
|
-
if (value.value.length > 0 && !values.some((existing) => existing.value === value.value)) {
|
|
30763
|
-
values.push(value);
|
|
30764
|
-
}
|
|
30765
|
-
}
|
|
30766
|
-
}
|
|
30767
|
-
if (values.length === 0 && Array.isArray(models["availableModels"])) {
|
|
30768
|
-
for (const model of models["availableModels"]) {
|
|
30769
|
-
if (!isRecord4(model)) {
|
|
30770
|
-
continue;
|
|
30771
|
-
}
|
|
30772
|
-
const value = readString2(model["modelId"]).slice(0, 500);
|
|
30773
|
-
if (value.length === 0) {
|
|
30774
|
-
continue;
|
|
30775
|
-
}
|
|
30776
|
-
if (!values.some((existing) => existing.value === value)) {
|
|
30777
|
-
values.push({
|
|
30778
|
-
description: "",
|
|
30779
|
-
groupId: "",
|
|
30780
|
-
groupName: "",
|
|
30781
|
-
name: readString2(model["name"], value).slice(0, 255),
|
|
30782
|
-
value
|
|
30783
|
-
});
|
|
30784
|
-
}
|
|
30785
|
-
}
|
|
30786
|
-
}
|
|
30787
|
-
const selected = options.find((option) => option["category"] === "model" && option["selected"] === true);
|
|
30788
|
-
const currentValue = readString2(
|
|
30789
|
-
models["currentModelId"],
|
|
30790
|
-
selected === void 0 ? "" : readString2(selected["id"])
|
|
30791
|
-
).slice(0, 500);
|
|
30792
|
-
if (values.length === 0 || !values.some((value) => value.value === currentValue)) {
|
|
30793
|
-
return [];
|
|
30794
|
-
}
|
|
30795
|
-
const result = {
|
|
30796
|
-
booleanValue: false,
|
|
30797
|
-
category: "model",
|
|
30798
|
-
currentValue,
|
|
30799
|
-
description: "Model used by Grok Build",
|
|
30800
|
-
id: LEGACY_MODEL_CONFIG_ID,
|
|
30801
|
-
name: "Model",
|
|
30802
|
-
type: "select",
|
|
30803
|
-
values: values.slice(0, 500)
|
|
30804
|
-
};
|
|
30805
|
-
return [result];
|
|
30806
|
-
}
|
|
30807
|
-
function legacyReasoningEffortOptions(response) {
|
|
30808
|
-
const options = legacyOptions(response);
|
|
30809
|
-
const values = [];
|
|
30810
|
-
for (const option of options) {
|
|
30811
|
-
if (option["category"] !== "mode") {
|
|
30812
|
-
continue;
|
|
30813
|
-
}
|
|
30814
|
-
const value = legacyValue(option);
|
|
30815
|
-
if (value.value.length > 0 && !values.some((existing) => existing.value === value.value)) {
|
|
30816
|
-
values.push(value);
|
|
30817
|
-
}
|
|
30818
|
-
}
|
|
30819
|
-
if (values.length === 0) {
|
|
30820
|
-
return [];
|
|
30821
|
-
}
|
|
30822
|
-
const selected = options.find((option) => option["category"] === "mode" && option["selected"] === true);
|
|
30823
|
-
if (selected === void 0) {
|
|
30824
|
-
values.unshift({
|
|
30825
|
-
description: "Use the selected model's default reasoning effort",
|
|
30826
|
-
groupId: "",
|
|
30827
|
-
groupName: "",
|
|
30828
|
-
name: "Agent default",
|
|
30829
|
-
value: AGENT_DEFAULT_REASONING_EFFORT
|
|
30830
|
-
});
|
|
30831
|
-
}
|
|
30832
|
-
const currentValue = selected === void 0 ? AGENT_DEFAULT_REASONING_EFFORT : readString2(selected["id"], AGENT_DEFAULT_REASONING_EFFORT);
|
|
30833
|
-
if (!values.some((value) => value.value === currentValue)) {
|
|
30834
|
-
return [];
|
|
30835
|
-
}
|
|
30836
|
-
const result = {
|
|
30837
|
-
booleanValue: false,
|
|
30838
|
-
category: "thought_level",
|
|
30839
|
-
currentValue,
|
|
30840
|
-
description: "Reasoning effort used by Grok Build",
|
|
30841
|
-
id: LEGACY_REASONING_EFFORT_CONFIG_ID,
|
|
30842
|
-
name: "Reasoning effort",
|
|
30843
|
-
type: "select",
|
|
30844
|
-
values: values.slice(0, 500)
|
|
30845
|
-
};
|
|
30846
|
-
return [result];
|
|
30847
|
-
}
|
|
30848
|
-
function normalizeGrokLifecycle(response) {
|
|
30849
|
-
const lifecycle = isRecord4(response) ? response : {};
|
|
30850
|
-
const standard = normalizeConfigOptions(lifecycle["configOptions"], lifecycle["modes"]);
|
|
30851
|
-
const normalized = [...standard];
|
|
30852
|
-
if (!normalized.some((option) => option.category === "model")) {
|
|
30853
|
-
normalized.push(...legacyModelOptions(response));
|
|
30854
|
-
}
|
|
30855
|
-
if (!normalized.some((option) => option.category === "thought_level")) {
|
|
30856
|
-
const efforts = legacyReasoningEffortOptions(response);
|
|
30857
|
-
if (efforts.length > 0) {
|
|
30858
|
-
const modelIndex = normalized.findIndex((option) => option.category === "model");
|
|
30859
|
-
normalized.splice(modelIndex < 0 ? normalized.length : modelIndex + 1, 0, ...efforts);
|
|
30860
|
-
}
|
|
30861
|
-
}
|
|
30862
|
-
return normalized.slice(0, 100);
|
|
30863
|
-
}
|
|
30864
|
-
function updateCurrentValue2(current, category, value) {
|
|
30865
|
-
return current.map((option) => option.category === category ? { ...option, currentValue: value } : option);
|
|
30866
|
-
}
|
|
30867
|
-
function validateGrokResponse(response, modelId) {
|
|
30868
|
-
if (!isRecord4(response) || !isRecord4(response["_meta"])) {
|
|
30869
|
-
throw new SessionConfigProtocolError("Grok Build returned an invalid session configuration response");
|
|
30870
|
-
}
|
|
30871
|
-
const model = response["_meta"]["model"];
|
|
30872
|
-
const appliedModel = isRecord4(model) ? model["Ok"] : model;
|
|
30873
|
-
if (appliedModel !== modelId) {
|
|
30874
|
-
throw new SessionConfigProtocolError("Grok Build returned an invalid session configuration response");
|
|
30875
|
-
}
|
|
30876
|
-
}
|
|
30877
|
-
var GrokBuildSessionConfigProtocol = class {
|
|
30878
|
-
configure = async (current, change, nativeSessionId, transport) => {
|
|
30879
|
-
const existing = current.find((option) => option.id === change.configId);
|
|
30880
|
-
if (existing === void 0 || existing.id !== LEGACY_MODEL_CONFIG_ID && existing.id !== LEGACY_REASONING_EFFORT_CONFIG_ID) {
|
|
30881
|
-
return await standardSessionConfigProtocol.configure(current, change, nativeSessionId, transport);
|
|
30882
|
-
}
|
|
30883
|
-
const model = current.find((option) => option.category === "model");
|
|
30884
|
-
if (model === void 0) {
|
|
30885
|
-
return current;
|
|
30886
|
-
}
|
|
30887
|
-
if (existing.category === "thought_level" && change.value === AGENT_DEFAULT_REASONING_EFFORT) {
|
|
30888
|
-
return current;
|
|
30889
|
-
}
|
|
30890
|
-
const modelId = existing.category === "model" ? change.value : model.currentValue;
|
|
30891
|
-
const params = {
|
|
30892
|
-
modelId,
|
|
30893
|
-
sessionId: nativeSessionId
|
|
30894
|
-
};
|
|
30895
|
-
if (existing.category === "thought_level") {
|
|
30896
|
-
params["_meta"] = {
|
|
30897
|
-
reasoningEffort: change.value
|
|
30898
|
-
};
|
|
30899
|
-
}
|
|
30900
|
-
const response = await transport.request(
|
|
30901
|
-
"session/set_model",
|
|
30902
|
-
params,
|
|
30903
|
-
existing.category === "model" ? "Grok Build exited while setting the session model" : "Grok Build exited while setting reasoning effort",
|
|
30904
|
-
change.signal
|
|
30905
|
-
);
|
|
30906
|
-
validateGrokResponse(response, modelId);
|
|
30907
|
-
const updated = updateCurrentValue2(current, existing.category, change.value);
|
|
30908
|
-
return existing.category === "thought_level" ? updated.map(
|
|
30909
|
-
(option) => option.category === "thought_level" ? {
|
|
30910
|
-
...option,
|
|
30911
|
-
values: option.values.filter((value) => value.value !== AGENT_DEFAULT_REASONING_EFFORT)
|
|
30912
|
-
} : option
|
|
30913
|
-
) : updated;
|
|
30914
|
-
};
|
|
30915
|
-
normalizeLifecycle = (response) => normalizeGrokLifecycle(response);
|
|
30916
|
-
normalizeUpdate = (current, value) => standardSessionConfigProtocol.normalizeUpdate(current, value);
|
|
30917
|
-
};
|
|
30918
|
-
var grokBuildSessionConfigProtocol = new GrokBuildSessionConfigProtocol();
|
|
30919
|
-
|
|
30920
30712
|
// src/acp/session-config/session-config-registry.ts
|
|
30921
|
-
function sessionConfigProtocolForAgent(
|
|
30922
|
-
return
|
|
30713
|
+
function sessionConfigProtocolForAgent(_agentId) {
|
|
30714
|
+
return standardSessionConfigProtocol;
|
|
30923
30715
|
}
|
|
30924
30716
|
|
|
30925
30717
|
// src/acp/session-history.ts
|
|
@@ -34741,6 +34533,8 @@ function normalizeVersionOutput(output2) {
|
|
|
34741
34533
|
var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e4;
|
|
34742
34534
|
var ACP_PROBE_TIMEOUT_MILLISECONDS = 6e4;
|
|
34743
34535
|
var LocalAgentSpecification = class {
|
|
34536
|
+
minimumSupportedAgentVersion = "0.0.0";
|
|
34537
|
+
maximumTestedAgentVersion = "0.0.0";
|
|
34744
34538
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS;
|
|
34745
34539
|
authenticationCommand = () => "";
|
|
34746
34540
|
adapterVersionArguments = ["--version"];
|
|
@@ -34823,6 +34617,8 @@ var ClaudeCodeAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
34823
34617
|
agentOverrideVariable = "MOBIUS_CLAUDE_PATH";
|
|
34824
34618
|
id = "claude";
|
|
34825
34619
|
label = "Claude Code";
|
|
34620
|
+
minimumSupportedAgentVersion = "2.1.273";
|
|
34621
|
+
maximumTestedAgentVersion = "2.1.273";
|
|
34826
34622
|
managedAdapterExecutablePath = [
|
|
34827
34623
|
"adapters",
|
|
34828
34624
|
"claude",
|
|
@@ -36349,6 +36145,8 @@ var CodexAgentSpecification = class extends InProcessAcpAgentDefinition2 {
|
|
|
36349
36145
|
createEndpoint = (options) => new CodexAcpAgent(options);
|
|
36350
36146
|
id = "codex";
|
|
36351
36147
|
label = "Codex";
|
|
36148
|
+
minimumSupportedAgentVersion = "0.153.0";
|
|
36149
|
+
maximumTestedAgentVersion = "0.154.0";
|
|
36352
36150
|
constructor() {
|
|
36353
36151
|
super("MOBIUS_CODEX_PATH", ["agents", "codex", "bin", "codex"]);
|
|
36354
36152
|
}
|
|
@@ -36411,6 +36209,8 @@ var CopilotCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36411
36209
|
agentExecutable = "copilot";
|
|
36412
36210
|
id = "github-copilot-cli";
|
|
36413
36211
|
label = "GitHub Copilot CLI";
|
|
36212
|
+
minimumSupportedAgentVersion = COPILOT_CLI_TESTED_VERSION;
|
|
36213
|
+
maximumTestedAgentVersion = COPILOT_CLI_TESTED_VERSION;
|
|
36414
36214
|
versionProbeTimeoutMilliseconds = 1e4;
|
|
36415
36215
|
constructor() {
|
|
36416
36216
|
super(
|
|
@@ -36441,6 +36241,8 @@ var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36441
36241
|
agentExecutable = "cursor-agent";
|
|
36442
36242
|
id = "cursor";
|
|
36443
36243
|
label = "Cursor CLI";
|
|
36244
|
+
minimumSupportedAgentVersion = CURSOR_CLI_TESTED_VERSION;
|
|
36245
|
+
maximumTestedAgentVersion = CURSOR_CLI_TESTED_VERSION;
|
|
36444
36246
|
constructor() {
|
|
36445
36247
|
super(
|
|
36446
36248
|
"MOBIUS_CURSOR_PATH",
|
|
@@ -36463,16 +36265,16 @@ import { isAbsolute as isAbsolute4, join as join7, normalize as normalize2 } fro
|
|
|
36463
36265
|
|
|
36464
36266
|
// src/agent-installation/deepseek-managed-package.ts
|
|
36465
36267
|
var DeepSeekHarnessManagedPackage = class extends SriManagedNpmPackageDefinition {
|
|
36466
|
-
dependencyResolutionArguments = Object.freeze(["--before=2026-09-
|
|
36268
|
+
dependencyResolutionArguments = Object.freeze(["--before=2026-09-23T00:00:00.000Z"]);
|
|
36467
36269
|
includeOptionalDependencies = true;
|
|
36468
36270
|
verifyDependencyClosure = true;
|
|
36469
36271
|
};
|
|
36470
36272
|
var DEEPSEEK_HARNESS_PACKAGE = new DeepSeekHarnessManagedPackage(
|
|
36471
36273
|
"@deepseek-ai/dsh",
|
|
36472
|
-
"0.1.5-rc.
|
|
36274
|
+
"0.1.5-rc.3",
|
|
36473
36275
|
"dsh",
|
|
36474
|
-
"sha512-
|
|
36475
|
-
"https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.1.5-rc.
|
|
36276
|
+
"sha512-c0W6Xqc4ChjFcCJkbzPeIxZQdnbKqe+QAcJzWGtogg0ZzsnZRcw3vopMyZ5oZU6E2fmyqGcyDR1sBeiCH4yHcg==",
|
|
36277
|
+
"https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.1.5-rc.3.tgz"
|
|
36476
36278
|
);
|
|
36477
36279
|
|
|
36478
36280
|
// src/agent-catalog/agents/deepseek-harness-agent.ts
|
|
@@ -36516,6 +36318,8 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36516
36318
|
agentExecutable = "dsh";
|
|
36517
36319
|
id = "deepseek-harness";
|
|
36518
36320
|
label = "DeepSeek Harness";
|
|
36321
|
+
minimumSupportedAgentVersion = "0.1.2-rc.1";
|
|
36322
|
+
maximumTestedAgentVersion = DEEPSEEK_HARNESS_PACKAGE.version;
|
|
36519
36323
|
constructor() {
|
|
36520
36324
|
super(
|
|
36521
36325
|
"MOBIUS_DEEPSEEK_HARNESS_PATH",
|
|
@@ -36586,6 +36390,8 @@ var GeminiCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36586
36390
|
agentExecutable = "gemini";
|
|
36587
36391
|
id = "gemini-cli";
|
|
36588
36392
|
label = "Gemini CLI";
|
|
36393
|
+
minimumSupportedAgentVersion = GEMINI_CLI_TESTED_VERSION;
|
|
36394
|
+
maximumTestedAgentVersion = GEMINI_CLI_TESTED_VERSION;
|
|
36589
36395
|
versionProbeTimeoutMilliseconds = 1e4;
|
|
36590
36396
|
constructor() {
|
|
36591
36397
|
super(
|
|
@@ -36687,6 +36493,8 @@ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36687
36493
|
adapterVersionArguments = ["version"];
|
|
36688
36494
|
id = "grok-build";
|
|
36689
36495
|
label = "Grok Build";
|
|
36496
|
+
minimumSupportedAgentVersion = GROK_BUILD_MANAGED_VERSION;
|
|
36497
|
+
maximumTestedAgentVersion = GROK_BUILD_MANAGED_VERSION;
|
|
36690
36498
|
constructor() {
|
|
36691
36499
|
super(
|
|
36692
36500
|
"MOBIUS_GROK_BUILD_PATH",
|
|
@@ -36758,6 +36566,8 @@ var HermesAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36758
36566
|
agentVersionArguments = ["acp", "--version"];
|
|
36759
36567
|
id = "hermes";
|
|
36760
36568
|
label = "Hermes Agent";
|
|
36569
|
+
minimumSupportedAgentVersion = HERMES_TESTED_VERSION;
|
|
36570
|
+
maximumTestedAgentVersion = HERMES_TESTED_VERSION;
|
|
36761
36571
|
constructor() {
|
|
36762
36572
|
super("MOBIUS_HERMES_PATH", ["acp"], ["agents", "hermes", HERMES_TESTED_VERSION, "bin", "hermes"]);
|
|
36763
36573
|
}
|
|
@@ -36786,6 +36596,8 @@ var OhMyPiAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36786
36596
|
agentOverrideVariable = "MOBIUS_OH_MY_PI_PATH";
|
|
36787
36597
|
id = "oh-my-pi";
|
|
36788
36598
|
label = "Oh My Pi";
|
|
36599
|
+
minimumSupportedAgentVersion = OH_MY_PI_TESTED_VERSION;
|
|
36600
|
+
maximumTestedAgentVersion = OH_MY_PI_TESTED_VERSION;
|
|
36789
36601
|
constructor() {
|
|
36790
36602
|
super("MOBIUS_OH_MY_PI_PATH", ["acp"], ["agents", "oh-my-pi", OH_MY_PI_TESTED_VERSION, "bin", "omp"]);
|
|
36791
36603
|
}
|
|
@@ -37177,6 +36989,8 @@ var OpenCodeAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
37177
36989
|
agentExecutable = "opencode";
|
|
37178
36990
|
id = "opencode";
|
|
37179
36991
|
label = "OpenCode";
|
|
36992
|
+
minimumSupportedAgentVersion = OPENCODE_MANAGED_VERSION;
|
|
36993
|
+
maximumTestedAgentVersion = OPENCODE_MANAGED_VERSION;
|
|
37180
36994
|
constructor() {
|
|
37181
36995
|
super(
|
|
37182
36996
|
"MOBIUS_OPENCODE_PATH",
|
|
@@ -37251,6 +37065,8 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
37251
37065
|
agentOverrideVariable = "MOBIUS_PI_PATH";
|
|
37252
37066
|
id = "pi";
|
|
37253
37067
|
label = "Pi";
|
|
37068
|
+
minimumSupportedAgentVersion = PI_AGENT_PACKAGE.version;
|
|
37069
|
+
maximumTestedAgentVersion = PI_AGENT_PACKAGE.version;
|
|
37254
37070
|
managedAdapterExecutablePath = [
|
|
37255
37071
|
"adapters",
|
|
37256
37072
|
"pi",
|
|
@@ -37345,6 +37161,8 @@ var WorkBuddyAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
37345
37161
|
agentExecutable = "codebuddy";
|
|
37346
37162
|
id = "workbuddy";
|
|
37347
37163
|
label = "WorkBuddy";
|
|
37164
|
+
minimumSupportedAgentVersion = "2.115.0";
|
|
37165
|
+
maximumTestedAgentVersion = WORKBUDDY_MANAGED_VERSION;
|
|
37348
37166
|
constructor() {
|
|
37349
37167
|
super(
|
|
37350
37168
|
"MOBIUS_WORKBUDDY_PATH",
|
|
@@ -37658,6 +37476,61 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
|
|
|
37658
37476
|
}
|
|
37659
37477
|
}
|
|
37660
37478
|
|
|
37479
|
+
// src/agent-catalog/agent-version.ts
|
|
37480
|
+
function parseVersion(value) {
|
|
37481
|
+
const match = /(?:^|[^0-9])v?(\d+(?:\.\d+)+)(?:-([0-9A-Za-z.-]+))?/u.exec(value);
|
|
37482
|
+
if (match?.[1] === void 0) {
|
|
37483
|
+
return null;
|
|
37484
|
+
}
|
|
37485
|
+
return {
|
|
37486
|
+
core: match[1].split(".").map(Number),
|
|
37487
|
+
prerelease: match[2]?.split(".") ?? []
|
|
37488
|
+
};
|
|
37489
|
+
}
|
|
37490
|
+
function comparePrerelease(left, right) {
|
|
37491
|
+
if (left.length === 0 || right.length === 0) {
|
|
37492
|
+
return left.length === right.length ? 0 : left.length === 0 ? 1 : -1;
|
|
37493
|
+
}
|
|
37494
|
+
for (let index2 = 0; index2 < Math.max(left.length, right.length); index2 += 1) {
|
|
37495
|
+
const leftPart = left[index2];
|
|
37496
|
+
const rightPart = right[index2];
|
|
37497
|
+
if (leftPart === void 0 || rightPart === void 0) {
|
|
37498
|
+
return leftPart === rightPart ? 0 : leftPart === void 0 ? -1 : 1;
|
|
37499
|
+
}
|
|
37500
|
+
if (leftPart === rightPart) {
|
|
37501
|
+
continue;
|
|
37502
|
+
}
|
|
37503
|
+
const leftNumber = /^\d+$/u.test(leftPart) ? Number(leftPart) : null;
|
|
37504
|
+
const rightNumber = /^\d+$/u.test(rightPart) ? Number(rightPart) : null;
|
|
37505
|
+
if (leftNumber !== null && rightNumber !== null) {
|
|
37506
|
+
return Math.sign(leftNumber - rightNumber);
|
|
37507
|
+
}
|
|
37508
|
+
if (leftNumber !== null || rightNumber !== null) {
|
|
37509
|
+
return leftNumber !== null ? -1 : 1;
|
|
37510
|
+
}
|
|
37511
|
+
return leftPart.localeCompare(rightPart);
|
|
37512
|
+
}
|
|
37513
|
+
return 0;
|
|
37514
|
+
}
|
|
37515
|
+
function compareAgentVersions(left, right) {
|
|
37516
|
+
const parsedLeft = parseVersion(left);
|
|
37517
|
+
const parsedRight = parseVersion(right);
|
|
37518
|
+
if (parsedLeft === null || parsedRight === null) {
|
|
37519
|
+
return null;
|
|
37520
|
+
}
|
|
37521
|
+
for (let index2 = 0; index2 < Math.max(parsedLeft.core.length, parsedRight.core.length); index2 += 1) {
|
|
37522
|
+
const difference = (parsedLeft.core[index2] ?? 0) - (parsedRight.core[index2] ?? 0);
|
|
37523
|
+
if (difference !== 0) {
|
|
37524
|
+
return Math.sign(difference);
|
|
37525
|
+
}
|
|
37526
|
+
}
|
|
37527
|
+
return comparePrerelease(parsedLeft.prerelease, parsedRight.prerelease);
|
|
37528
|
+
}
|
|
37529
|
+
function isAgentVersionSupported(reportedVersion, minimumSupportedVersion) {
|
|
37530
|
+
const comparison = compareAgentVersions(reportedVersion, minimumSupportedVersion);
|
|
37531
|
+
return comparison === null ? null : comparison >= 0;
|
|
37532
|
+
}
|
|
37533
|
+
|
|
37661
37534
|
// src/agent-catalog/executable-discovery.ts
|
|
37662
37535
|
import { isAbsolute as isAbsolute8, join as join14 } from "node:path";
|
|
37663
37536
|
|
|
@@ -37939,6 +37812,18 @@ async function discoverAgent(specification, context) {
|
|
|
37939
37812
|
lastFailure = agentProbeFailure(specification, error62);
|
|
37940
37813
|
continue;
|
|
37941
37814
|
}
|
|
37815
|
+
const supportedVersion = isAgentVersionSupported(agentVersion, specification.minimumSupportedAgentVersion);
|
|
37816
|
+
if (supportedVersion === null) {
|
|
37817
|
+
lastFailure = new AgentProbeFailed(
|
|
37818
|
+
specification,
|
|
37819
|
+
"agent_probe_failed",
|
|
37820
|
+
"Agent reported an unrecognized version"
|
|
37821
|
+
);
|
|
37822
|
+
continue;
|
|
37823
|
+
}
|
|
37824
|
+
if (!supportedVersion) {
|
|
37825
|
+
continue;
|
|
37826
|
+
}
|
|
37942
37827
|
const installedAgent = new AgentIntegrationDefinition(
|
|
37943
37828
|
specification.id,
|
|
37944
37829
|
specification.label,
|
|
@@ -38046,7 +37931,7 @@ async function discoverLocalAgentInventory(options) {
|
|
|
38046
37931
|
|
|
38047
37932
|
// src/storage/runtime-installation-store.ts
|
|
38048
37933
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
38049
|
-
import { mkdir as mkdir4, open as open5, rename as rename3, unlink, writeFile as writeFile3 } from "node:fs/promises";
|
|
37934
|
+
import { mkdir as mkdir4, open as open5, readdir as readdir2, rename as rename3, unlink, writeFile as writeFile3 } from "node:fs/promises";
|
|
38050
37935
|
import { dirname as dirname5, join as join15, resolve as resolve4 } from "node:path";
|
|
38051
37936
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
38052
37937
|
var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
|
|
@@ -38063,18 +37948,31 @@ var CHANNEL_INDEX_KEYS = [
|
|
|
38063
37948
|
"version"
|
|
38064
37949
|
];
|
|
38065
37950
|
var VERIFIED_CONNECTION_KEYS = [
|
|
37951
|
+
"activation",
|
|
37952
|
+
"appId",
|
|
38066
37953
|
"applicationId",
|
|
38067
37954
|
"channelId",
|
|
38068
37955
|
"connectionId",
|
|
38069
37956
|
"defaultWorkspace",
|
|
38070
37957
|
"installationId",
|
|
38071
37958
|
"kind",
|
|
37959
|
+
"pairingId",
|
|
38072
37960
|
"relayOrigin",
|
|
38073
37961
|
"runtimeCredential",
|
|
38074
37962
|
"runtimeId",
|
|
38075
37963
|
"version"
|
|
38076
37964
|
];
|
|
37965
|
+
var VERSION_THREE_VERIFIED_CONNECTION_KEYS = VERIFIED_CONNECTION_KEYS.filter(
|
|
37966
|
+
(key) => key !== "activation"
|
|
37967
|
+
);
|
|
37968
|
+
var VERSION_TWO_VERIFIED_CONNECTION_KEYS = VERSION_THREE_VERIFIED_CONNECTION_KEYS.filter(
|
|
37969
|
+
(key) => key !== "pairingId"
|
|
37970
|
+
);
|
|
37971
|
+
var LEGACY_VERIFIED_CONNECTION_KEYS = VERSION_TWO_VERIFIED_CONNECTION_KEYS.filter(
|
|
37972
|
+
(key) => key !== "appId"
|
|
37973
|
+
);
|
|
38077
37974
|
var IMPORTED_LEGACY_CONNECTION_KEYS = [
|
|
37975
|
+
"activation",
|
|
38078
37976
|
"applicationId",
|
|
38079
37977
|
"channelId",
|
|
38080
37978
|
"connectionId",
|
|
@@ -38085,13 +37983,9 @@ var IMPORTED_LEGACY_CONNECTION_KEYS = [
|
|
|
38085
37983
|
"runtimeCredential",
|
|
38086
37984
|
"version"
|
|
38087
37985
|
];
|
|
38088
|
-
var
|
|
38089
|
-
"
|
|
38090
|
-
|
|
38091
|
-
"relayOrigin",
|
|
38092
|
-
"runtimeCredential"
|
|
38093
|
-
];
|
|
38094
|
-
var LEGACY_CONNECTION_KEYS = ["defaultWorkspace", "channelId", "daemonToken", "relayOrigin"];
|
|
37986
|
+
var VERSION_ONE_IMPORTED_LEGACY_CONNECTION_KEYS = IMPORTED_LEGACY_CONNECTION_KEYS.filter(
|
|
37987
|
+
(key) => key !== "activation"
|
|
37988
|
+
);
|
|
38095
37989
|
var RuntimeInstallationStoreError = class extends Error {
|
|
38096
37990
|
code;
|
|
38097
37991
|
constructor(code, message, options = {}) {
|
|
@@ -38101,19 +37995,25 @@ var RuntimeInstallationStoreError = class extends Error {
|
|
|
38101
37995
|
}
|
|
38102
37996
|
};
|
|
38103
37997
|
var StoredRuntimeConnection = class {
|
|
37998
|
+
activation;
|
|
37999
|
+
appId;
|
|
38104
38000
|
applicationId;
|
|
38105
38001
|
channelId;
|
|
38106
38002
|
connectionId;
|
|
38107
38003
|
defaultWorkspace;
|
|
38108
38004
|
installationId;
|
|
38005
|
+
pairingId;
|
|
38109
38006
|
relayOrigin;
|
|
38110
38007
|
runtimeCredential;
|
|
38111
|
-
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2) {
|
|
38008
|
+
constructor(activation, applicationId, appId, installationId2, connectionId2, channelId, defaultWorkspace, pairingId, relayOrigin, runtimeCredential2) {
|
|
38009
|
+
this.activation = activation;
|
|
38112
38010
|
this.applicationId = applicationId;
|
|
38011
|
+
this.appId = appId;
|
|
38113
38012
|
this.channelId = channelId;
|
|
38114
38013
|
this.connectionId = connectionId2;
|
|
38115
38014
|
this.defaultWorkspace = defaultWorkspace;
|
|
38116
38015
|
this.installationId = installationId2;
|
|
38016
|
+
this.pairingId = pairingId;
|
|
38117
38017
|
this.relayOrigin = relayOrigin;
|
|
38118
38018
|
this.runtimeCredential = runtimeCredential2;
|
|
38119
38019
|
}
|
|
@@ -38121,15 +38021,37 @@ var StoredRuntimeConnection = class {
|
|
|
38121
38021
|
var VerifiedRuntimeConnection = class extends StoredRuntimeConnection {
|
|
38122
38022
|
kind = "verified";
|
|
38123
38023
|
runtimeId;
|
|
38124
|
-
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2, runtimeId) {
|
|
38125
|
-
super(
|
|
38024
|
+
constructor(activation, applicationId, appId, installationId2, connectionId2, channelId, defaultWorkspace, pairingId, relayOrigin, runtimeCredential2, runtimeId) {
|
|
38025
|
+
super(
|
|
38026
|
+
activation,
|
|
38027
|
+
applicationId,
|
|
38028
|
+
appId,
|
|
38029
|
+
installationId2,
|
|
38030
|
+
connectionId2,
|
|
38031
|
+
channelId,
|
|
38032
|
+
defaultWorkspace,
|
|
38033
|
+
pairingId,
|
|
38034
|
+
relayOrigin,
|
|
38035
|
+
runtimeCredential2
|
|
38036
|
+
);
|
|
38126
38037
|
this.runtimeId = runtimeId;
|
|
38127
38038
|
}
|
|
38128
38039
|
};
|
|
38129
38040
|
var ImportedLegacyRuntimeConnection = class extends StoredRuntimeConnection {
|
|
38130
38041
|
kind = "legacy_imported";
|
|
38131
|
-
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2) {
|
|
38132
|
-
super(
|
|
38042
|
+
constructor(activation, applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2) {
|
|
38043
|
+
super(
|
|
38044
|
+
activation,
|
|
38045
|
+
applicationId,
|
|
38046
|
+
"unknown",
|
|
38047
|
+
installationId2,
|
|
38048
|
+
connectionId2,
|
|
38049
|
+
channelId,
|
|
38050
|
+
defaultWorkspace,
|
|
38051
|
+
"",
|
|
38052
|
+
relayOrigin,
|
|
38053
|
+
runtimeCredential2
|
|
38054
|
+
);
|
|
38133
38055
|
}
|
|
38134
38056
|
};
|
|
38135
38057
|
function isRecord8(value) {
|
|
@@ -38148,6 +38070,12 @@ function validateApplicationId(value) {
|
|
|
38148
38070
|
}
|
|
38149
38071
|
return value;
|
|
38150
38072
|
}
|
|
38073
|
+
function validateRemoteAppId(value) {
|
|
38074
|
+
if (!IDENTIFIER_PATTERN4.test(value)) {
|
|
38075
|
+
throw new RuntimeInstallationStoreError("invalid_app_id", "The remote App ID is invalid");
|
|
38076
|
+
}
|
|
38077
|
+
return value;
|
|
38078
|
+
}
|
|
38151
38079
|
function validateConnectionId(value) {
|
|
38152
38080
|
if (!CONNECTION_ID_PATTERN.test(value)) {
|
|
38153
38081
|
throw new RuntimeInstallationStoreError("invalid_connection_id", "The local connection ID is invalid");
|
|
@@ -38227,46 +38155,61 @@ function decodeChannelIndex(value) {
|
|
|
38227
38155
|
};
|
|
38228
38156
|
}
|
|
38229
38157
|
function decodeVerifiedConnection(value) {
|
|
38230
|
-
|
|
38158
|
+
const current = hasExactKeys(value, VERIFIED_CONNECTION_KEYS) && value["version"] === 4;
|
|
38159
|
+
const versionThree = hasExactKeys(value, VERSION_THREE_VERIFIED_CONNECTION_KEYS) && value["version"] === 3;
|
|
38160
|
+
const versionTwo = hasExactKeys(value, VERSION_TWO_VERIFIED_CONNECTION_KEYS) && value["version"] === 2;
|
|
38161
|
+
const legacy = hasExactKeys(value, LEGACY_VERIFIED_CONNECTION_KEYS) && value["version"] === 1;
|
|
38162
|
+
if (!current && !versionThree && !versionTwo && !legacy || value["kind"] !== "verified") {
|
|
38231
38163
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38232
38164
|
}
|
|
38233
38165
|
const applicationId = value["applicationId"];
|
|
38166
|
+
const activation = current ? value["activation"] : "active";
|
|
38167
|
+
const appId = typeof value["appId"] === "string" ? value["appId"] : "unknown";
|
|
38234
38168
|
const channelId = value["channelId"];
|
|
38235
38169
|
const connectionId2 = value["connectionId"];
|
|
38236
38170
|
const defaultWorkspace = value["defaultWorkspace"];
|
|
38237
38171
|
const storedInstallationId = value["installationId"];
|
|
38172
|
+
const pairingId = value["pairingId"];
|
|
38173
|
+
const savedPairingId = typeof pairingId === "string" ? pairingId : "";
|
|
38238
38174
|
const relayOrigin = value["relayOrigin"];
|
|
38239
38175
|
const runtimeCredential2 = value["runtimeCredential"];
|
|
38240
38176
|
const runtimeId = value["runtimeId"];
|
|
38241
|
-
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") {
|
|
38177
|
+
if (typeof applicationId !== "string" || activation !== "active" && activation !== "stopped" || (current || versionThree || versionTwo) && typeof value["appId"] !== "string" || typeof channelId !== "string" || typeof connectionId2 !== "string" || typeof defaultWorkspace !== "string" || typeof storedInstallationId !== "string" || (current || versionThree) && typeof pairingId !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string" || typeof runtimeId !== "string") {
|
|
38242
38178
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38243
38179
|
}
|
|
38244
38180
|
return new VerifiedRuntimeConnection(
|
|
38181
|
+
activation,
|
|
38245
38182
|
validateApplicationId(applicationId),
|
|
38183
|
+
validateRemoteAppId(appId),
|
|
38246
38184
|
validateInstallationId(storedInstallationId),
|
|
38247
38185
|
validateConnectionId(connectionId2),
|
|
38248
38186
|
validateIdentifier(channelId, "invalid_connection"),
|
|
38249
38187
|
defaultWorkspace,
|
|
38188
|
+
current || versionThree ? validateIdentifier(savedPairingId, "invalid_connection") : "",
|
|
38250
38189
|
parseRelayOrigin(relayOrigin),
|
|
38251
38190
|
validateRuntimeCredential(runtimeCredential2),
|
|
38252
38191
|
validateIdentifier(runtimeId, "invalid_connection")
|
|
38253
38192
|
);
|
|
38254
38193
|
}
|
|
38255
38194
|
function decodeImportedLegacyConnection(value) {
|
|
38256
|
-
|
|
38195
|
+
const current = hasExactKeys(value, IMPORTED_LEGACY_CONNECTION_KEYS) && value["version"] === 2;
|
|
38196
|
+
const legacy = hasExactKeys(value, VERSION_ONE_IMPORTED_LEGACY_CONNECTION_KEYS) && value["version"] === 1;
|
|
38197
|
+
if (!current && !legacy || value["kind"] !== "legacy_imported" || value["version"] !== 1 && value["version"] !== 2) {
|
|
38257
38198
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38258
38199
|
}
|
|
38259
38200
|
const applicationId = value["applicationId"];
|
|
38201
|
+
const activation = current ? value["activation"] : "active";
|
|
38260
38202
|
const channelId = value["channelId"];
|
|
38261
38203
|
const connectionId2 = value["connectionId"];
|
|
38262
38204
|
const defaultWorkspace = value["defaultWorkspace"];
|
|
38263
38205
|
const storedInstallationId = value["installationId"];
|
|
38264
38206
|
const relayOrigin = value["relayOrigin"];
|
|
38265
38207
|
const runtimeCredential2 = value["runtimeCredential"];
|
|
38266
|
-
if (typeof applicationId !== "string" || typeof channelId !== "string" || typeof connectionId2 !== "string" || typeof defaultWorkspace !== "string" || typeof storedInstallationId !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string") {
|
|
38208
|
+
if (typeof applicationId !== "string" || activation !== "active" && activation !== "stopped" || typeof channelId !== "string" || typeof connectionId2 !== "string" || typeof defaultWorkspace !== "string" || typeof storedInstallationId !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string") {
|
|
38267
38209
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38268
38210
|
}
|
|
38269
38211
|
return new ImportedLegacyRuntimeConnection(
|
|
38212
|
+
activation,
|
|
38270
38213
|
validateApplicationId(applicationId),
|
|
38271
38214
|
validateInstallationId(storedInstallationId),
|
|
38272
38215
|
validateConnectionId(connectionId2),
|
|
@@ -38288,24 +38231,6 @@ function decodeConnection(value) {
|
|
|
38288
38231
|
}
|
|
38289
38232
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38290
38233
|
}
|
|
38291
|
-
function decodeLegacyConnection(value, expectedChannelId) {
|
|
38292
|
-
if (!isRecord8(value) || !hasExactKeys(value, CURRENT_CONNECTION_KEYS) && !hasExactKeys(value, LEGACY_CONNECTION_KEYS)) {
|
|
38293
|
-
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38294
|
-
}
|
|
38295
|
-
const channelId = value["channelId"];
|
|
38296
|
-
const defaultWorkspace = value["defaultWorkspace"];
|
|
38297
|
-
const relayOrigin = value["relayOrigin"];
|
|
38298
|
-
const runtimeCredential2 = value["runtimeCredential"] ?? value["daemonToken"];
|
|
38299
|
-
if (typeof channelId !== "string" || channelId !== expectedChannelId || typeof defaultWorkspace !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string") {
|
|
38300
|
-
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38301
|
-
}
|
|
38302
|
-
return {
|
|
38303
|
-
channelId: validateIdentifier(channelId, "invalid_connection"),
|
|
38304
|
-
defaultWorkspace,
|
|
38305
|
-
relayOrigin: parseRelayOrigin(relayOrigin),
|
|
38306
|
-
runtimeCredential: validateRuntimeCredential(runtimeCredential2)
|
|
38307
|
-
};
|
|
38308
|
-
}
|
|
38309
38234
|
async function readJsonFile(path2, signal, missingCode) {
|
|
38310
38235
|
signal.throwIfAborted();
|
|
38311
38236
|
let handle;
|
|
@@ -38436,23 +38361,16 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
38436
38361
|
}
|
|
38437
38362
|
return await this.readConnection(index2.connectionId, signal);
|
|
38438
38363
|
};
|
|
38439
|
-
migrateLegacyConnection = async (legacyStateDirectory, channelId, signal) => {
|
|
38440
|
-
try {
|
|
38441
|
-
return await this.#readConnectionForChannel(channelId, signal);
|
|
38442
|
-
} catch (cause) {
|
|
38443
|
-
if (!(cause instanceof RuntimeInstallationStoreError) || cause.code !== "connection_not_found") {
|
|
38444
|
-
throw cause;
|
|
38445
|
-
}
|
|
38446
|
-
}
|
|
38447
|
-
return await this.importLegacyConnection(legacyStateDirectory, channelId, signal);
|
|
38448
|
-
};
|
|
38449
38364
|
saveConnection = async (input2, signal) => {
|
|
38450
38365
|
const stored = new VerifiedRuntimeConnection(
|
|
38366
|
+
"active",
|
|
38451
38367
|
this.applicationId,
|
|
38368
|
+
validateRemoteAppId(input2.appId),
|
|
38452
38369
|
this.installationId,
|
|
38453
38370
|
connectionId(),
|
|
38454
38371
|
validateIdentifier(input2.channelId, "invalid_connection"),
|
|
38455
38372
|
input2.defaultWorkspace,
|
|
38373
|
+
input2.pairingId.length === 0 ? "" : validateIdentifier(input2.pairingId, "invalid_pairing_id"),
|
|
38456
38374
|
parseRelayOrigin(input2.relayOrigin.toString()),
|
|
38457
38375
|
validateRuntimeCredential(input2.runtimeCredential),
|
|
38458
38376
|
validateIdentifier(input2.runtimeId, "invalid_connection")
|
|
@@ -38460,25 +38378,6 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
38460
38378
|
await this.writeConnection(stored, signal);
|
|
38461
38379
|
return stored;
|
|
38462
38380
|
};
|
|
38463
|
-
importLegacyConnection = async (legacyStateDirectory, channelId, signal) => {
|
|
38464
|
-
const normalizedChannelId = validateIdentifier(channelId, "invalid_channel_id");
|
|
38465
|
-
const legacyPath = join15(resolve4(legacyStateDirectory), "connections", `${normalizedChannelId}.json`);
|
|
38466
|
-
const legacy = decodeLegacyConnection(
|
|
38467
|
-
await readJsonFile(legacyPath, signal, "connection_not_found"),
|
|
38468
|
-
normalizedChannelId
|
|
38469
|
-
);
|
|
38470
|
-
const stored = new ImportedLegacyRuntimeConnection(
|
|
38471
|
-
this.applicationId,
|
|
38472
|
-
this.installationId,
|
|
38473
|
-
connectionId(),
|
|
38474
|
-
legacy.channelId,
|
|
38475
|
-
legacy.defaultWorkspace,
|
|
38476
|
-
legacy.relayOrigin,
|
|
38477
|
-
legacy.runtimeCredential
|
|
38478
|
-
);
|
|
38479
|
-
await this.writeConnection(stored, signal);
|
|
38480
|
-
return stored;
|
|
38481
|
-
};
|
|
38482
38381
|
writeConnection = async (stored, signal) => {
|
|
38483
38382
|
signal.throwIfAborted();
|
|
38484
38383
|
try {
|
|
@@ -38492,49 +38391,134 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
38492
38391
|
throw cause;
|
|
38493
38392
|
}
|
|
38494
38393
|
}
|
|
38495
|
-
|
|
38496
|
-
|
|
38497
|
-
|
|
38498
|
-
|
|
38394
|
+
await this.overwriteConnection(stored, signal);
|
|
38395
|
+
await writeJsonAtomically(
|
|
38396
|
+
this.channelIndexPath(stored.channelId),
|
|
38397
|
+
{
|
|
38398
|
+
applicationId: this.applicationId,
|
|
38399
|
+
channelId: stored.channelId,
|
|
38400
|
+
connectionId: stored.connectionId,
|
|
38401
|
+
installationId: this.installationId,
|
|
38402
|
+
version: 1
|
|
38403
|
+
},
|
|
38404
|
+
signal
|
|
38405
|
+
);
|
|
38406
|
+
};
|
|
38407
|
+
listConnections = async (signal) => {
|
|
38408
|
+
signal.throwIfAborted();
|
|
38409
|
+
let entries;
|
|
38410
|
+
try {
|
|
38411
|
+
entries = await readdir2(this.#connectionDirectory);
|
|
38412
|
+
} catch (cause) {
|
|
38413
|
+
if (isNodeError(cause, "ENOENT")) {
|
|
38414
|
+
return [];
|
|
38415
|
+
}
|
|
38416
|
+
throw new RuntimeInstallationStoreError(
|
|
38417
|
+
"connection_unavailable",
|
|
38418
|
+
"Saved Runtime connections cannot be listed",
|
|
38499
38419
|
{
|
|
38500
|
-
|
|
38501
|
-
|
|
38502
|
-
connectionId: stored.connectionId,
|
|
38503
|
-
defaultWorkspace: stored.defaultWorkspace,
|
|
38504
|
-
installationId: stored.installationId,
|
|
38505
|
-
kind: stored.kind,
|
|
38506
|
-
relayOrigin: stored.relayOrigin.toString(),
|
|
38507
|
-
runtimeCredential: stored.runtimeCredential,
|
|
38508
|
-
runtimeId: stored.runtimeId,
|
|
38509
|
-
version: 1
|
|
38510
|
-
},
|
|
38511
|
-
signal
|
|
38420
|
+
cause
|
|
38421
|
+
}
|
|
38512
38422
|
);
|
|
38513
|
-
}
|
|
38423
|
+
}
|
|
38424
|
+
const connections = [];
|
|
38425
|
+
for (const entry of [...entries].sort()) {
|
|
38426
|
+
signal.throwIfAborted();
|
|
38427
|
+
const match = /^(mcn_[a-f0-9]{32})\.json$/.exec(entry);
|
|
38428
|
+
if (match?.[1] !== void 0) {
|
|
38429
|
+
connections.push(await this.readConnection(match[1], signal));
|
|
38430
|
+
}
|
|
38431
|
+
}
|
|
38432
|
+
return connections;
|
|
38433
|
+
};
|
|
38434
|
+
readConnectionForPairing = async (pairingId, signal) => {
|
|
38435
|
+
const normalizedPairingId = validateIdentifier(pairingId, "invalid_pairing_id");
|
|
38436
|
+
const connections = await this.listConnections(signal);
|
|
38437
|
+
return connections.find((connection) => connection.pairingId === normalizedPairingId) ?? null;
|
|
38438
|
+
};
|
|
38439
|
+
setConnectionActivation = async (connectionId2, activation, signal) => {
|
|
38440
|
+
const connection = await this.readConnection(connectionId2, signal);
|
|
38441
|
+
const updated = connection instanceof VerifiedRuntimeConnection ? new VerifiedRuntimeConnection(
|
|
38442
|
+
activation,
|
|
38443
|
+
connection.applicationId,
|
|
38444
|
+
connection.appId,
|
|
38445
|
+
connection.installationId,
|
|
38446
|
+
connection.connectionId,
|
|
38447
|
+
connection.channelId,
|
|
38448
|
+
connection.defaultWorkspace,
|
|
38449
|
+
connection.pairingId,
|
|
38450
|
+
connection.relayOrigin,
|
|
38451
|
+
connection.runtimeCredential,
|
|
38452
|
+
connection.runtimeId
|
|
38453
|
+
) : new ImportedLegacyRuntimeConnection(
|
|
38454
|
+
activation,
|
|
38455
|
+
connection.applicationId,
|
|
38456
|
+
connection.installationId,
|
|
38457
|
+
connection.connectionId,
|
|
38458
|
+
connection.channelId,
|
|
38459
|
+
connection.defaultWorkspace,
|
|
38460
|
+
connection.relayOrigin,
|
|
38461
|
+
connection.runtimeCredential
|
|
38462
|
+
);
|
|
38463
|
+
await this.overwriteConnection(updated, signal);
|
|
38464
|
+
return updated;
|
|
38465
|
+
};
|
|
38466
|
+
removeConnection = async (connectionId2, signal) => {
|
|
38467
|
+
const connection = await this.readConnection(connectionId2, signal);
|
|
38468
|
+
signal.throwIfAborted();
|
|
38469
|
+
try {
|
|
38470
|
+
await unlink(this.connectionPath(connection.connectionId));
|
|
38471
|
+
signal.throwIfAborted();
|
|
38472
|
+
await unlink(this.channelIndexPath(connection.channelId));
|
|
38473
|
+
} catch (cause) {
|
|
38474
|
+
signal.throwIfAborted();
|
|
38475
|
+
if (isNodeError(cause, "ENOENT")) {
|
|
38476
|
+
return;
|
|
38477
|
+
}
|
|
38478
|
+
throw new RuntimeInstallationStoreError(
|
|
38479
|
+
"connection_unavailable",
|
|
38480
|
+
"The saved Runtime connection cannot be removed",
|
|
38481
|
+
{ cause }
|
|
38482
|
+
);
|
|
38483
|
+
}
|
|
38484
|
+
};
|
|
38485
|
+
overwriteConnection = async (connection, signal) => {
|
|
38486
|
+
const connectionPath = this.connectionPath(connection.connectionId);
|
|
38487
|
+
if (connection instanceof VerifiedRuntimeConnection) {
|
|
38514
38488
|
await writeJsonAtomically(
|
|
38515
38489
|
connectionPath,
|
|
38516
38490
|
{
|
|
38517
|
-
|
|
38518
|
-
|
|
38519
|
-
|
|
38520
|
-
|
|
38521
|
-
|
|
38522
|
-
|
|
38523
|
-
|
|
38524
|
-
|
|
38525
|
-
|
|
38491
|
+
activation: connection.activation,
|
|
38492
|
+
applicationId: connection.applicationId,
|
|
38493
|
+
appId: connection.appId,
|
|
38494
|
+
channelId: connection.channelId,
|
|
38495
|
+
connectionId: connection.connectionId,
|
|
38496
|
+
defaultWorkspace: connection.defaultWorkspace,
|
|
38497
|
+
installationId: connection.installationId,
|
|
38498
|
+
kind: connection.kind,
|
|
38499
|
+
pairingId: connection.pairingId,
|
|
38500
|
+
relayOrigin: connection.relayOrigin.toString(),
|
|
38501
|
+
runtimeCredential: connection.runtimeCredential,
|
|
38502
|
+
runtimeId: connection.runtimeId,
|
|
38503
|
+
version: 4
|
|
38526
38504
|
},
|
|
38527
38505
|
signal
|
|
38528
38506
|
);
|
|
38507
|
+
return;
|
|
38529
38508
|
}
|
|
38530
38509
|
await writeJsonAtomically(
|
|
38531
|
-
|
|
38510
|
+
connectionPath,
|
|
38532
38511
|
{
|
|
38533
|
-
|
|
38534
|
-
|
|
38535
|
-
|
|
38536
|
-
|
|
38537
|
-
|
|
38512
|
+
activation: connection.activation,
|
|
38513
|
+
applicationId: connection.applicationId,
|
|
38514
|
+
channelId: connection.channelId,
|
|
38515
|
+
connectionId: connection.connectionId,
|
|
38516
|
+
defaultWorkspace: connection.defaultWorkspace,
|
|
38517
|
+
installationId: connection.installationId,
|
|
38518
|
+
kind: connection.kind,
|
|
38519
|
+
relayOrigin: connection.relayOrigin.toString(),
|
|
38520
|
+
runtimeCredential: connection.runtimeCredential,
|
|
38521
|
+
version: 2
|
|
38538
38522
|
},
|
|
38539
38523
|
signal
|
|
38540
38524
|
);
|
|
@@ -38618,7 +38602,7 @@ function readSingleOption(arguments_, option) {
|
|
|
38618
38602
|
function assertKnownArguments(arguments_) {
|
|
38619
38603
|
for (let index2 = 0; index2 < arguments_.length; index2 += 2) {
|
|
38620
38604
|
const option = arguments_[index2];
|
|
38621
|
-
if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace") {
|
|
38605
|
+
if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace" && option !== "--app-id") {
|
|
38622
38606
|
throw new PairingClientError("invalid_arguments", `Unknown pairing option: ${option ?? "missing option"}`);
|
|
38623
38607
|
}
|
|
38624
38608
|
}
|
|
@@ -38657,6 +38641,7 @@ function parsePairingCode(value) {
|
|
|
38657
38641
|
function parsePairCommand(arguments_, defaultWorkspace) {
|
|
38658
38642
|
assertKnownArguments(arguments_);
|
|
38659
38643
|
return {
|
|
38644
|
+
appId: arguments_.includes("--app-id") ? validatePairingId(readSingleOption(arguments_, "--app-id")) : "standalone",
|
|
38660
38645
|
code: parsePairingCode(readSingleOption(arguments_, "--code")),
|
|
38661
38646
|
pairingId: arguments_.includes("--pairing") ? validatePairingId(readSingleOption(arguments_, "--pairing")) : "",
|
|
38662
38647
|
relayOrigin: parseRelayOrigin2(readSingleOption(arguments_, "--url")),
|
|
@@ -38669,48 +38654,15 @@ function validatePairingId(value) {
|
|
|
38669
38654
|
}
|
|
38670
38655
|
return value;
|
|
38671
38656
|
}
|
|
38672
|
-
|
|
38673
|
-
|
|
38674
|
-
|
|
38675
|
-
connectionId;
|
|
38676
|
-
constructor(connectionId2) {
|
|
38677
|
-
super();
|
|
38678
|
-
this.connectionId = connectionId2;
|
|
38679
|
-
}
|
|
38680
|
-
resume = async (installation, signal, environment) => await resumeMobiusRuntime(installation, this.connectionId, signal, environment);
|
|
38681
|
-
};
|
|
38682
|
-
var LegacyChannelResumeCommandTarget = class extends ResumeCommandTarget {
|
|
38683
|
-
channelId;
|
|
38684
|
-
constructor(channelId) {
|
|
38685
|
-
super();
|
|
38686
|
-
this.channelId = channelId;
|
|
38687
|
-
}
|
|
38688
|
-
resume = async (installation, signal, environment) => await resumeLegacyChannel(installation, this.channelId, signal, environment);
|
|
38689
|
-
};
|
|
38690
|
-
function parseResumeArgument(arguments_) {
|
|
38691
|
-
if (arguments_.length !== 2) {
|
|
38692
|
-
throw new PairingClientError(
|
|
38693
|
-
"invalid_arguments",
|
|
38694
|
-
"Usage: mobius start --connection <connection-id> or mobius start --channel <legacy-channel-id>"
|
|
38695
|
-
);
|
|
38657
|
+
function parseResumeConnectionId(arguments_) {
|
|
38658
|
+
if (arguments_.length !== 2 || arguments_[0] !== "--connection") {
|
|
38659
|
+
throw new PairingClientError("invalid_arguments", "Usage: mobius start --connection <connection-id>");
|
|
38696
38660
|
}
|
|
38697
38661
|
const value = arguments_[1] ?? "";
|
|
38698
|
-
if (
|
|
38699
|
-
|
|
38700
|
-
throw new PairingClientError("invalid_connection_id", "The saved Runtime connection ID is invalid");
|
|
38701
|
-
}
|
|
38702
|
-
return new ConnectionResumeCommandTarget(value);
|
|
38703
|
-
}
|
|
38704
|
-
if (arguments_[0] === "--channel") {
|
|
38705
|
-
if (!IDENTIFIER_PATTERN5.test(value)) {
|
|
38706
|
-
throw new PairingClientError("invalid_channel_id", "The saved channel ID is invalid");
|
|
38707
|
-
}
|
|
38708
|
-
return new LegacyChannelResumeCommandTarget(value);
|
|
38662
|
+
if (!/^mcn_[a-f0-9]{32}$/.test(value)) {
|
|
38663
|
+
throw new PairingClientError("invalid_connection_id", "The saved Runtime connection ID is invalid");
|
|
38709
38664
|
}
|
|
38710
|
-
|
|
38711
|
-
"invalid_arguments",
|
|
38712
|
-
"Usage: mobius start --connection <connection-id> or mobius start --channel <legacy-channel-id>"
|
|
38713
|
-
);
|
|
38665
|
+
return value;
|
|
38714
38666
|
}
|
|
38715
38667
|
async function resolveDefaultWorkspace(path2) {
|
|
38716
38668
|
const requestedWorkspace = resolve5(path2);
|
|
@@ -38846,8 +38798,10 @@ async function pairRuntime(installation, options, signal, environment) {
|
|
|
38846
38798
|
const claim2 = await claimPairing(options, defaultWorkspace, agents, inventory.installable, signal);
|
|
38847
38799
|
const connection = await installation.saveConnection(
|
|
38848
38800
|
{
|
|
38801
|
+
appId: options.appId,
|
|
38849
38802
|
channelId: claim2.channelId,
|
|
38850
38803
|
defaultWorkspace,
|
|
38804
|
+
pairingId: options.pairingId,
|
|
38851
38805
|
relayOrigin: options.relayOrigin,
|
|
38852
38806
|
runtimeCredential: claim2.runtimeCredential,
|
|
38853
38807
|
runtimeId: claim2.runtimeId
|
|
@@ -38860,6 +38814,7 @@ async function pairMobiusRuntime(installation, options, signal, environment = pr
|
|
|
38860
38814
|
return await pairRuntime(
|
|
38861
38815
|
installation,
|
|
38862
38816
|
{
|
|
38817
|
+
appId: "embedded",
|
|
38863
38818
|
code: parsePairingCode(options.pairingCode),
|
|
38864
38819
|
pairingId: validatePairingId(options.pairingId),
|
|
38865
38820
|
relayOrigin: parseRelayOrigin2(options.relayOrigin),
|
|
@@ -38883,10 +38838,6 @@ async function resumeMobiusRuntime(installation, connectionId2, signal, environm
|
|
|
38883
38838
|
const connection = await installation.readConnection(connectionId2, signal);
|
|
38884
38839
|
return await resumeRuntimeConnection(installation, connection, signal, environment);
|
|
38885
38840
|
}
|
|
38886
|
-
async function resumeLegacyChannel(installation, channelId, signal, environment) {
|
|
38887
|
-
const connection = await installation.migrateLegacyConnection(readStateDirectory(environment), channelId, signal);
|
|
38888
|
-
return await resumeRuntimeConnection(installation, connection, signal, environment);
|
|
38889
|
-
}
|
|
38890
38841
|
async function openMobiusCliInstallation(signal, environment) {
|
|
38891
38842
|
return await openRuntimeInstallationStore(
|
|
38892
38843
|
{
|
|
@@ -38900,9 +38851,16 @@ async function pairLocalMachine(arguments_, signal = new AbortController().signa
|
|
|
38900
38851
|
const requested = parsePairCommand(arguments_, "");
|
|
38901
38852
|
const installation = await openMobiusCliInstallation(signal, process.env);
|
|
38902
38853
|
const localContext = new DaemonLocalContext(installation.stateDirectory, process.env);
|
|
38854
|
+
if (requested.pairingId.length > 0) {
|
|
38855
|
+
const existing = await installation.readConnectionForPairing(requested.pairingId, signal);
|
|
38856
|
+
if (existing !== null) {
|
|
38857
|
+
return await resumeRuntimeConnection(installation, existing, signal, process.env);
|
|
38858
|
+
}
|
|
38859
|
+
}
|
|
38903
38860
|
return await pairRuntime(
|
|
38904
38861
|
installation,
|
|
38905
38862
|
{
|
|
38863
|
+
appId: requested.appId,
|
|
38906
38864
|
code: requested.code,
|
|
38907
38865
|
pairingId: requested.pairingId,
|
|
38908
38866
|
relayOrigin: requested.relayOrigin,
|
|
@@ -38913,9 +38871,9 @@ async function pairLocalMachine(arguments_, signal = new AbortController().signa
|
|
|
38913
38871
|
);
|
|
38914
38872
|
}
|
|
38915
38873
|
async function resumeLocalMachine(arguments_, signal = new AbortController().signal) {
|
|
38916
|
-
const
|
|
38874
|
+
const connectionId2 = parseResumeConnectionId(arguments_);
|
|
38917
38875
|
const installation = await openMobiusCliInstallation(signal, process.env);
|
|
38918
|
-
return await
|
|
38876
|
+
return await resumeMobiusRuntime(installation, connectionId2, signal, process.env);
|
|
38919
38877
|
}
|
|
38920
38878
|
|
|
38921
38879
|
// src/relay-connection/runtime-revocation.ts
|
|
@@ -39799,7 +39757,7 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
39799
39757
|
}
|
|
39800
39758
|
|
|
39801
39759
|
// src/authorization/workspace-directory.ts
|
|
39802
|
-
import { readdir as
|
|
39760
|
+
import { readdir as readdir3, realpath as realpath9, stat as stat8 } from "node:fs/promises";
|
|
39803
39761
|
import { homedir as homedir2 } from "node:os";
|
|
39804
39762
|
import { basename as basename5, dirname as dirname6, isAbsolute as isAbsolute10, join as join16, normalize as normalize4, relative as relative4 } from "node:path";
|
|
39805
39763
|
var WorkspaceDirectoryListing = class {
|
|
@@ -39904,7 +39862,7 @@ var WorkspaceDirectoryService = class {
|
|
|
39904
39862
|
list = async (bindingId, id, signal) => {
|
|
39905
39863
|
const target = await this.resolve(bindingId, id, signal);
|
|
39906
39864
|
try {
|
|
39907
|
-
const children = await
|
|
39865
|
+
const children = await readdir3(target, { withFileTypes: true });
|
|
39908
39866
|
signal.throwIfAborted();
|
|
39909
39867
|
const entries = [];
|
|
39910
39868
|
for (const child of children) {
|
|
@@ -41619,71 +41577,7 @@ var SessionEventOutbox = class {
|
|
|
41619
41577
|
received_at INTEGER NOT NULL
|
|
41620
41578
|
) STRICT;
|
|
41621
41579
|
`);
|
|
41622
|
-
const deadLetterTable = this.#database.prepare(
|
|
41623
|
-
`SELECT sql FROM sqlite_master
|
|
41624
|
-
WHERE type = 'table' AND name = 'relay_session_event_dead_letters'`
|
|
41625
|
-
).get();
|
|
41626
|
-
const deadLetterSql = typeof deadLetterTable === "object" && deadLetterTable !== null ? Reflect.get(deadLetterTable, "sql") : void 0;
|
|
41627
|
-
if (typeof deadLetterSql !== "string" || !deadLetterSql.includes("'session_rejected'")) {
|
|
41628
|
-
this.#database.exec(`
|
|
41629
|
-
BEGIN IMMEDIATE;
|
|
41630
|
-
ALTER TABLE relay_session_event_dead_letters
|
|
41631
|
-
RENAME TO relay_session_event_dead_letters_legacy;
|
|
41632
|
-
CREATE TABLE relay_session_event_dead_letters (
|
|
41633
|
-
ordinal INTEGER PRIMARY KEY,
|
|
41634
|
-
event_id TEXT NOT NULL UNIQUE,
|
|
41635
|
-
session_id TEXT NOT NULL,
|
|
41636
|
-
envelope_json TEXT NOT NULL,
|
|
41637
|
-
rejection_code TEXT NOT NULL CHECK (
|
|
41638
|
-
rejection_code IN ('session_deleted', 'session_not_found', 'session_rejected')
|
|
41639
|
-
)
|
|
41640
|
-
) STRICT;
|
|
41641
|
-
INSERT INTO relay_session_event_dead_letters (
|
|
41642
|
-
ordinal, event_id, session_id, envelope_json, rejection_code
|
|
41643
|
-
)
|
|
41644
|
-
SELECT ordinal, event_id, session_id, envelope_json, rejection_code
|
|
41645
|
-
FROM relay_session_event_dead_letters_legacy;
|
|
41646
|
-
DROP TABLE relay_session_event_dead_letters_legacy;
|
|
41647
|
-
COMMIT;
|
|
41648
|
-
`);
|
|
41649
|
-
}
|
|
41650
|
-
const outboxColumns = this.#database.prepare("PRAGMA table_info(relay_session_event_outbox)").all();
|
|
41651
|
-
const hasSourceKey = outboxColumns.some(
|
|
41652
|
-
(column) => typeof column === "object" && column !== null && Reflect.get(column, "name") === "source_key"
|
|
41653
|
-
);
|
|
41654
|
-
if (!hasSourceKey) {
|
|
41655
|
-
this.#database.exec(`
|
|
41656
|
-
ALTER TABLE relay_session_event_outbox
|
|
41657
|
-
ADD COLUMN source_key TEXT NOT NULL DEFAULT '';
|
|
41658
|
-
`);
|
|
41659
|
-
}
|
|
41660
|
-
const hasByteLength = outboxColumns.some(
|
|
41661
|
-
(column) => typeof column === "object" && column !== null && Reflect.get(column, "name") === "byte_length"
|
|
41662
|
-
);
|
|
41663
|
-
if (!hasByteLength) {
|
|
41664
|
-
this.#database.exec(`
|
|
41665
|
-
ALTER TABLE relay_session_event_outbox
|
|
41666
|
-
ADD COLUMN byte_length INTEGER NOT NULL DEFAULT 0;
|
|
41667
|
-
`);
|
|
41668
|
-
}
|
|
41669
41580
|
this.#database.exec(`
|
|
41670
|
-
UPDATE relay_session_event_outbox
|
|
41671
|
-
SET source_key = CASE json_extract(envelope_json, '$.source.kind')
|
|
41672
|
-
WHEN 'attempt' THEN
|
|
41673
|
-
'attempt:' || session_id || ':' || json_extract(envelope_json, '$.source.attemptId')
|
|
41674
|
-
ELSE 'runtime:' || session_id
|
|
41675
|
-
END
|
|
41676
|
-
WHERE source_key = '';
|
|
41677
|
-
UPDATE relay_session_event_outbox
|
|
41678
|
-
SET byte_length = length(CAST(envelope_json AS BLOB))
|
|
41679
|
-
WHERE byte_length = 0;
|
|
41680
|
-
UPDATE relay_session_event_outbox_state
|
|
41681
|
-
SET event_count = (SELECT COUNT(*) FROM relay_session_event_outbox),
|
|
41682
|
-
total_bytes = (
|
|
41683
|
-
SELECT COALESCE(SUM(byte_length), 0)
|
|
41684
|
-
FROM relay_session_event_outbox
|
|
41685
|
-
)
|
|
41686
|
-
WHERE singleton = 1;
|
|
41687
41581
|
CREATE INDEX IF NOT EXISTS relay_session_event_outbox_source_order
|
|
41688
41582
|
ON relay_session_event_outbox(source_key, ordinal);
|
|
41689
41583
|
`);
|
|
@@ -44895,7 +44789,11 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44895
44789
|
);
|
|
44896
44790
|
};
|
|
44897
44791
|
const announceReadiness = () => {
|
|
44898
|
-
if (!connectionAnnounced || !catalogPublished
|
|
44792
|
+
if (!connectionAnnounced || !catalogPublished) {
|
|
44793
|
+
return;
|
|
44794
|
+
}
|
|
44795
|
+
options.onConnectionStatus?.("online");
|
|
44796
|
+
if (readinessAnnounced) {
|
|
44899
44797
|
return;
|
|
44900
44798
|
}
|
|
44901
44799
|
readinessAnnounced = true;
|
|
@@ -44906,14 +44804,16 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44906
44804
|
return;
|
|
44907
44805
|
}
|
|
44908
44806
|
connectionAnnounced = true;
|
|
44909
|
-
const reconnectCommand = `npx --yes @moxt-ai/mobius start ${config2.reconnectTarget.commandArgument}`;
|
|
44910
44807
|
process.stdout.write("Mobius daemon connected to the relay.\n\n");
|
|
44911
|
-
|
|
44912
|
-
|
|
44808
|
+
if (config2.reconnectTarget !== null) {
|
|
44809
|
+
const reconnectCommand = `mobius start ${config2.reconnectTarget.commandArgument}`;
|
|
44810
|
+
process.stdout.write(
|
|
44811
|
+
`${styleText(["bold", "yellow"], `Reconnect this local connection later:
|
|
44913
44812
|
${reconnectCommand}`)}
|
|
44914
44813
|
|
|
44915
44814
|
`
|
|
44916
|
-
|
|
44815
|
+
);
|
|
44816
|
+
}
|
|
44917
44817
|
announceReadiness();
|
|
44918
44818
|
startAutomaticIntegrationProvisioning();
|
|
44919
44819
|
};
|
|
@@ -44944,7 +44844,12 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44944
44844
|
activeAttemptIds,
|
|
44945
44845
|
connectionEpoch,
|
|
44946
44846
|
diagnostics,
|
|
44947
|
-
|
|
44847
|
+
() => {
|
|
44848
|
+
if (catalogPublished) {
|
|
44849
|
+
options.onConnectionStatus?.("online");
|
|
44850
|
+
}
|
|
44851
|
+
announceConnection();
|
|
44852
|
+
},
|
|
44948
44853
|
signal,
|
|
44949
44854
|
timer,
|
|
44950
44855
|
resolveAgentCatalogEnvironment
|
|
@@ -44958,6 +44863,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44958
44863
|
}
|
|
44959
44864
|
diagnostics.connectionFailed(connectionEpoch, error62, "connection");
|
|
44960
44865
|
}
|
|
44866
|
+
options.onConnectionStatus?.("reconnecting");
|
|
44961
44867
|
await waitForRelayRetry(signal, timer);
|
|
44962
44868
|
}
|
|
44963
44869
|
} finally {
|
|
@@ -45124,6 +45030,7 @@ var MobiusRuntimeEngine = class {
|
|
|
45124
45030
|
const audit = new AuditStore(this.#config.auditDatabasePath);
|
|
45125
45031
|
try {
|
|
45126
45032
|
await runDaemon(this.#config, audit, signal, void 0, {
|
|
45033
|
+
...this.#options.onConnectionStatus === void 0 ? {} : { onConnectionStatus: this.#options.onConnectionStatus },
|
|
45127
45034
|
...this.#options.resolveAgentCatalogEnvironment === void 0 ? {} : { resolveAgentCatalogEnvironment: this.#options.resolveAgentCatalogEnvironment }
|
|
45128
45035
|
});
|
|
45129
45036
|
} finally {
|
|
@@ -45135,10 +45042,8 @@ var MobiusRuntimeEngine = class {
|
|
|
45135
45042
|
export {
|
|
45136
45043
|
AcpExecutionError,
|
|
45137
45044
|
AuditStore,
|
|
45138
|
-
ChannelDaemonReconnectTarget,
|
|
45139
45045
|
DaemonLocalContext,
|
|
45140
45046
|
DaemonReconnectTarget,
|
|
45141
|
-
ImportedLegacyRuntimeConnection,
|
|
45142
45047
|
LocalAuthorizationError,
|
|
45143
45048
|
MobiusRuntimeConfigurationError,
|
|
45144
45049
|
MobiusRuntimeEngine,
|