@moxt-ai/mobius 0.0.81 → 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/codex/app-server-protocol.d.ts +2 -2
- package/dist/acp/codex/app-server-protocol.d.ts.map +1 -1
- package/dist/acp/codex/app-server-protocol.js +5 -3
- package/dist/acp/codex/app-server-protocol.js.map +1 -1
- 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 +1154 -538
- 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 +339 -433
- 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 +320 -385
- 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",
|
|
@@ -35029,11 +34825,12 @@ var threadLifecycleResponseSchema = external_exports.object({
|
|
|
35029
34825
|
});
|
|
35030
34826
|
var threadResumeResponseSchema = threadLifecycleResponseSchema;
|
|
35031
34827
|
var threadForkResponseSchema = threadLifecycleResponseSchema;
|
|
34828
|
+
var threadTitleSchema = external_exports.string().transform((value) => value.slice(0, 500));
|
|
35032
34829
|
var threadSummarySchema = external_exports.object({
|
|
35033
34830
|
cwd: boundedText(2048),
|
|
35034
34831
|
id: boundedText(256),
|
|
35035
|
-
name:
|
|
35036
|
-
preview:
|
|
34832
|
+
name: threadTitleSchema.nullish(),
|
|
34833
|
+
preview: threadTitleSchema.nullish(),
|
|
35037
34834
|
updatedAt: external_exports.number().int().nonnegative()
|
|
35038
34835
|
});
|
|
35039
34836
|
var threadListResponseSchema = external_exports.object({
|
|
@@ -36348,6 +36145,8 @@ var CodexAgentSpecification = class extends InProcessAcpAgentDefinition2 {
|
|
|
36348
36145
|
createEndpoint = (options) => new CodexAcpAgent(options);
|
|
36349
36146
|
id = "codex";
|
|
36350
36147
|
label = "Codex";
|
|
36148
|
+
minimumSupportedAgentVersion = "0.153.0";
|
|
36149
|
+
maximumTestedAgentVersion = "0.154.0";
|
|
36351
36150
|
constructor() {
|
|
36352
36151
|
super("MOBIUS_CODEX_PATH", ["agents", "codex", "bin", "codex"]);
|
|
36353
36152
|
}
|
|
@@ -36410,6 +36209,8 @@ var CopilotCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36410
36209
|
agentExecutable = "copilot";
|
|
36411
36210
|
id = "github-copilot-cli";
|
|
36412
36211
|
label = "GitHub Copilot CLI";
|
|
36212
|
+
minimumSupportedAgentVersion = COPILOT_CLI_TESTED_VERSION;
|
|
36213
|
+
maximumTestedAgentVersion = COPILOT_CLI_TESTED_VERSION;
|
|
36413
36214
|
versionProbeTimeoutMilliseconds = 1e4;
|
|
36414
36215
|
constructor() {
|
|
36415
36216
|
super(
|
|
@@ -36440,6 +36241,8 @@ var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36440
36241
|
agentExecutable = "cursor-agent";
|
|
36441
36242
|
id = "cursor";
|
|
36442
36243
|
label = "Cursor CLI";
|
|
36244
|
+
minimumSupportedAgentVersion = CURSOR_CLI_TESTED_VERSION;
|
|
36245
|
+
maximumTestedAgentVersion = CURSOR_CLI_TESTED_VERSION;
|
|
36443
36246
|
constructor() {
|
|
36444
36247
|
super(
|
|
36445
36248
|
"MOBIUS_CURSOR_PATH",
|
|
@@ -36462,16 +36265,16 @@ import { isAbsolute as isAbsolute4, join as join7, normalize as normalize2 } fro
|
|
|
36462
36265
|
|
|
36463
36266
|
// src/agent-installation/deepseek-managed-package.ts
|
|
36464
36267
|
var DeepSeekHarnessManagedPackage = class extends SriManagedNpmPackageDefinition {
|
|
36465
|
-
dependencyResolutionArguments = Object.freeze(["--before=2026-09-
|
|
36268
|
+
dependencyResolutionArguments = Object.freeze(["--before=2026-09-23T00:00:00.000Z"]);
|
|
36466
36269
|
includeOptionalDependencies = true;
|
|
36467
36270
|
verifyDependencyClosure = true;
|
|
36468
36271
|
};
|
|
36469
36272
|
var DEEPSEEK_HARNESS_PACKAGE = new DeepSeekHarnessManagedPackage(
|
|
36470
36273
|
"@deepseek-ai/dsh",
|
|
36471
|
-
"0.1.5-rc.
|
|
36274
|
+
"0.1.5-rc.3",
|
|
36472
36275
|
"dsh",
|
|
36473
|
-
"sha512-
|
|
36474
|
-
"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"
|
|
36475
36278
|
);
|
|
36476
36279
|
|
|
36477
36280
|
// src/agent-catalog/agents/deepseek-harness-agent.ts
|
|
@@ -36515,6 +36318,8 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36515
36318
|
agentExecutable = "dsh";
|
|
36516
36319
|
id = "deepseek-harness";
|
|
36517
36320
|
label = "DeepSeek Harness";
|
|
36321
|
+
minimumSupportedAgentVersion = "0.1.2-rc.1";
|
|
36322
|
+
maximumTestedAgentVersion = DEEPSEEK_HARNESS_PACKAGE.version;
|
|
36518
36323
|
constructor() {
|
|
36519
36324
|
super(
|
|
36520
36325
|
"MOBIUS_DEEPSEEK_HARNESS_PATH",
|
|
@@ -36585,6 +36390,8 @@ var GeminiCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36585
36390
|
agentExecutable = "gemini";
|
|
36586
36391
|
id = "gemini-cli";
|
|
36587
36392
|
label = "Gemini CLI";
|
|
36393
|
+
minimumSupportedAgentVersion = GEMINI_CLI_TESTED_VERSION;
|
|
36394
|
+
maximumTestedAgentVersion = GEMINI_CLI_TESTED_VERSION;
|
|
36588
36395
|
versionProbeTimeoutMilliseconds = 1e4;
|
|
36589
36396
|
constructor() {
|
|
36590
36397
|
super(
|
|
@@ -36686,6 +36493,8 @@ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36686
36493
|
adapterVersionArguments = ["version"];
|
|
36687
36494
|
id = "grok-build";
|
|
36688
36495
|
label = "Grok Build";
|
|
36496
|
+
minimumSupportedAgentVersion = GROK_BUILD_MANAGED_VERSION;
|
|
36497
|
+
maximumTestedAgentVersion = GROK_BUILD_MANAGED_VERSION;
|
|
36689
36498
|
constructor() {
|
|
36690
36499
|
super(
|
|
36691
36500
|
"MOBIUS_GROK_BUILD_PATH",
|
|
@@ -36757,6 +36566,8 @@ var HermesAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36757
36566
|
agentVersionArguments = ["acp", "--version"];
|
|
36758
36567
|
id = "hermes";
|
|
36759
36568
|
label = "Hermes Agent";
|
|
36569
|
+
minimumSupportedAgentVersion = HERMES_TESTED_VERSION;
|
|
36570
|
+
maximumTestedAgentVersion = HERMES_TESTED_VERSION;
|
|
36760
36571
|
constructor() {
|
|
36761
36572
|
super("MOBIUS_HERMES_PATH", ["acp"], ["agents", "hermes", HERMES_TESTED_VERSION, "bin", "hermes"]);
|
|
36762
36573
|
}
|
|
@@ -36785,6 +36596,8 @@ var OhMyPiAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36785
36596
|
agentOverrideVariable = "MOBIUS_OH_MY_PI_PATH";
|
|
36786
36597
|
id = "oh-my-pi";
|
|
36787
36598
|
label = "Oh My Pi";
|
|
36599
|
+
minimumSupportedAgentVersion = OH_MY_PI_TESTED_VERSION;
|
|
36600
|
+
maximumTestedAgentVersion = OH_MY_PI_TESTED_VERSION;
|
|
36788
36601
|
constructor() {
|
|
36789
36602
|
super("MOBIUS_OH_MY_PI_PATH", ["acp"], ["agents", "oh-my-pi", OH_MY_PI_TESTED_VERSION, "bin", "omp"]);
|
|
36790
36603
|
}
|
|
@@ -37176,6 +36989,8 @@ var OpenCodeAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
37176
36989
|
agentExecutable = "opencode";
|
|
37177
36990
|
id = "opencode";
|
|
37178
36991
|
label = "OpenCode";
|
|
36992
|
+
minimumSupportedAgentVersion = OPENCODE_MANAGED_VERSION;
|
|
36993
|
+
maximumTestedAgentVersion = OPENCODE_MANAGED_VERSION;
|
|
37179
36994
|
constructor() {
|
|
37180
36995
|
super(
|
|
37181
36996
|
"MOBIUS_OPENCODE_PATH",
|
|
@@ -37250,6 +37065,8 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
37250
37065
|
agentOverrideVariable = "MOBIUS_PI_PATH";
|
|
37251
37066
|
id = "pi";
|
|
37252
37067
|
label = "Pi";
|
|
37068
|
+
minimumSupportedAgentVersion = PI_AGENT_PACKAGE.version;
|
|
37069
|
+
maximumTestedAgentVersion = PI_AGENT_PACKAGE.version;
|
|
37253
37070
|
managedAdapterExecutablePath = [
|
|
37254
37071
|
"adapters",
|
|
37255
37072
|
"pi",
|
|
@@ -37344,6 +37161,8 @@ var WorkBuddyAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
37344
37161
|
agentExecutable = "codebuddy";
|
|
37345
37162
|
id = "workbuddy";
|
|
37346
37163
|
label = "WorkBuddy";
|
|
37164
|
+
minimumSupportedAgentVersion = "2.115.0";
|
|
37165
|
+
maximumTestedAgentVersion = WORKBUDDY_MANAGED_VERSION;
|
|
37347
37166
|
constructor() {
|
|
37348
37167
|
super(
|
|
37349
37168
|
"MOBIUS_WORKBUDDY_PATH",
|
|
@@ -37657,6 +37476,61 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
|
|
|
37657
37476
|
}
|
|
37658
37477
|
}
|
|
37659
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
|
+
|
|
37660
37534
|
// src/agent-catalog/executable-discovery.ts
|
|
37661
37535
|
import { isAbsolute as isAbsolute8, join as join14 } from "node:path";
|
|
37662
37536
|
|
|
@@ -37938,6 +37812,18 @@ async function discoverAgent(specification, context) {
|
|
|
37938
37812
|
lastFailure = agentProbeFailure(specification, error62);
|
|
37939
37813
|
continue;
|
|
37940
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
|
+
}
|
|
37941
37827
|
const installedAgent = new AgentIntegrationDefinition(
|
|
37942
37828
|
specification.id,
|
|
37943
37829
|
specification.label,
|
|
@@ -38045,7 +37931,7 @@ async function discoverLocalAgentInventory(options) {
|
|
|
38045
37931
|
|
|
38046
37932
|
// src/storage/runtime-installation-store.ts
|
|
38047
37933
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
38048
|
-
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";
|
|
38049
37935
|
import { dirname as dirname5, join as join15, resolve as resolve4 } from "node:path";
|
|
38050
37936
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
38051
37937
|
var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
|
|
@@ -38062,18 +37948,31 @@ var CHANNEL_INDEX_KEYS = [
|
|
|
38062
37948
|
"version"
|
|
38063
37949
|
];
|
|
38064
37950
|
var VERIFIED_CONNECTION_KEYS = [
|
|
37951
|
+
"activation",
|
|
37952
|
+
"appId",
|
|
38065
37953
|
"applicationId",
|
|
38066
37954
|
"channelId",
|
|
38067
37955
|
"connectionId",
|
|
38068
37956
|
"defaultWorkspace",
|
|
38069
37957
|
"installationId",
|
|
38070
37958
|
"kind",
|
|
37959
|
+
"pairingId",
|
|
38071
37960
|
"relayOrigin",
|
|
38072
37961
|
"runtimeCredential",
|
|
38073
37962
|
"runtimeId",
|
|
38074
37963
|
"version"
|
|
38075
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
|
+
);
|
|
38076
37974
|
var IMPORTED_LEGACY_CONNECTION_KEYS = [
|
|
37975
|
+
"activation",
|
|
38077
37976
|
"applicationId",
|
|
38078
37977
|
"channelId",
|
|
38079
37978
|
"connectionId",
|
|
@@ -38084,13 +37983,9 @@ var IMPORTED_LEGACY_CONNECTION_KEYS = [
|
|
|
38084
37983
|
"runtimeCredential",
|
|
38085
37984
|
"version"
|
|
38086
37985
|
];
|
|
38087
|
-
var
|
|
38088
|
-
"
|
|
38089
|
-
|
|
38090
|
-
"relayOrigin",
|
|
38091
|
-
"runtimeCredential"
|
|
38092
|
-
];
|
|
38093
|
-
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
|
+
);
|
|
38094
37989
|
var RuntimeInstallationStoreError = class extends Error {
|
|
38095
37990
|
code;
|
|
38096
37991
|
constructor(code, message, options = {}) {
|
|
@@ -38100,19 +37995,25 @@ var RuntimeInstallationStoreError = class extends Error {
|
|
|
38100
37995
|
}
|
|
38101
37996
|
};
|
|
38102
37997
|
var StoredRuntimeConnection = class {
|
|
37998
|
+
activation;
|
|
37999
|
+
appId;
|
|
38103
38000
|
applicationId;
|
|
38104
38001
|
channelId;
|
|
38105
38002
|
connectionId;
|
|
38106
38003
|
defaultWorkspace;
|
|
38107
38004
|
installationId;
|
|
38005
|
+
pairingId;
|
|
38108
38006
|
relayOrigin;
|
|
38109
38007
|
runtimeCredential;
|
|
38110
|
-
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2) {
|
|
38008
|
+
constructor(activation, applicationId, appId, installationId2, connectionId2, channelId, defaultWorkspace, pairingId, relayOrigin, runtimeCredential2) {
|
|
38009
|
+
this.activation = activation;
|
|
38111
38010
|
this.applicationId = applicationId;
|
|
38011
|
+
this.appId = appId;
|
|
38112
38012
|
this.channelId = channelId;
|
|
38113
38013
|
this.connectionId = connectionId2;
|
|
38114
38014
|
this.defaultWorkspace = defaultWorkspace;
|
|
38115
38015
|
this.installationId = installationId2;
|
|
38016
|
+
this.pairingId = pairingId;
|
|
38116
38017
|
this.relayOrigin = relayOrigin;
|
|
38117
38018
|
this.runtimeCredential = runtimeCredential2;
|
|
38118
38019
|
}
|
|
@@ -38120,15 +38021,37 @@ var StoredRuntimeConnection = class {
|
|
|
38120
38021
|
var VerifiedRuntimeConnection = class extends StoredRuntimeConnection {
|
|
38121
38022
|
kind = "verified";
|
|
38122
38023
|
runtimeId;
|
|
38123
|
-
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2, runtimeId) {
|
|
38124
|
-
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
|
+
);
|
|
38125
38037
|
this.runtimeId = runtimeId;
|
|
38126
38038
|
}
|
|
38127
38039
|
};
|
|
38128
38040
|
var ImportedLegacyRuntimeConnection = class extends StoredRuntimeConnection {
|
|
38129
38041
|
kind = "legacy_imported";
|
|
38130
|
-
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2) {
|
|
38131
|
-
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
|
+
);
|
|
38132
38055
|
}
|
|
38133
38056
|
};
|
|
38134
38057
|
function isRecord8(value) {
|
|
@@ -38147,6 +38070,12 @@ function validateApplicationId(value) {
|
|
|
38147
38070
|
}
|
|
38148
38071
|
return value;
|
|
38149
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
|
+
}
|
|
38150
38079
|
function validateConnectionId(value) {
|
|
38151
38080
|
if (!CONNECTION_ID_PATTERN.test(value)) {
|
|
38152
38081
|
throw new RuntimeInstallationStoreError("invalid_connection_id", "The local connection ID is invalid");
|
|
@@ -38226,46 +38155,61 @@ function decodeChannelIndex(value) {
|
|
|
38226
38155
|
};
|
|
38227
38156
|
}
|
|
38228
38157
|
function decodeVerifiedConnection(value) {
|
|
38229
|
-
|
|
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") {
|
|
38230
38163
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38231
38164
|
}
|
|
38232
38165
|
const applicationId = value["applicationId"];
|
|
38166
|
+
const activation = current ? value["activation"] : "active";
|
|
38167
|
+
const appId = typeof value["appId"] === "string" ? value["appId"] : "unknown";
|
|
38233
38168
|
const channelId = value["channelId"];
|
|
38234
38169
|
const connectionId2 = value["connectionId"];
|
|
38235
38170
|
const defaultWorkspace = value["defaultWorkspace"];
|
|
38236
38171
|
const storedInstallationId = value["installationId"];
|
|
38172
|
+
const pairingId = value["pairingId"];
|
|
38173
|
+
const savedPairingId = typeof pairingId === "string" ? pairingId : "";
|
|
38237
38174
|
const relayOrigin = value["relayOrigin"];
|
|
38238
38175
|
const runtimeCredential2 = value["runtimeCredential"];
|
|
38239
38176
|
const runtimeId = value["runtimeId"];
|
|
38240
|
-
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") {
|
|
38241
38178
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38242
38179
|
}
|
|
38243
38180
|
return new VerifiedRuntimeConnection(
|
|
38181
|
+
activation,
|
|
38244
38182
|
validateApplicationId(applicationId),
|
|
38183
|
+
validateRemoteAppId(appId),
|
|
38245
38184
|
validateInstallationId(storedInstallationId),
|
|
38246
38185
|
validateConnectionId(connectionId2),
|
|
38247
38186
|
validateIdentifier(channelId, "invalid_connection"),
|
|
38248
38187
|
defaultWorkspace,
|
|
38188
|
+
current || versionThree ? validateIdentifier(savedPairingId, "invalid_connection") : "",
|
|
38249
38189
|
parseRelayOrigin(relayOrigin),
|
|
38250
38190
|
validateRuntimeCredential(runtimeCredential2),
|
|
38251
38191
|
validateIdentifier(runtimeId, "invalid_connection")
|
|
38252
38192
|
);
|
|
38253
38193
|
}
|
|
38254
38194
|
function decodeImportedLegacyConnection(value) {
|
|
38255
|
-
|
|
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) {
|
|
38256
38198
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38257
38199
|
}
|
|
38258
38200
|
const applicationId = value["applicationId"];
|
|
38201
|
+
const activation = current ? value["activation"] : "active";
|
|
38259
38202
|
const channelId = value["channelId"];
|
|
38260
38203
|
const connectionId2 = value["connectionId"];
|
|
38261
38204
|
const defaultWorkspace = value["defaultWorkspace"];
|
|
38262
38205
|
const storedInstallationId = value["installationId"];
|
|
38263
38206
|
const relayOrigin = value["relayOrigin"];
|
|
38264
38207
|
const runtimeCredential2 = value["runtimeCredential"];
|
|
38265
|
-
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") {
|
|
38266
38209
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38267
38210
|
}
|
|
38268
38211
|
return new ImportedLegacyRuntimeConnection(
|
|
38212
|
+
activation,
|
|
38269
38213
|
validateApplicationId(applicationId),
|
|
38270
38214
|
validateInstallationId(storedInstallationId),
|
|
38271
38215
|
validateConnectionId(connectionId2),
|
|
@@ -38287,24 +38231,6 @@ function decodeConnection(value) {
|
|
|
38287
38231
|
}
|
|
38288
38232
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38289
38233
|
}
|
|
38290
|
-
function decodeLegacyConnection(value, expectedChannelId) {
|
|
38291
|
-
if (!isRecord8(value) || !hasExactKeys(value, CURRENT_CONNECTION_KEYS) && !hasExactKeys(value, LEGACY_CONNECTION_KEYS)) {
|
|
38292
|
-
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38293
|
-
}
|
|
38294
|
-
const channelId = value["channelId"];
|
|
38295
|
-
const defaultWorkspace = value["defaultWorkspace"];
|
|
38296
|
-
const relayOrigin = value["relayOrigin"];
|
|
38297
|
-
const runtimeCredential2 = value["runtimeCredential"] ?? value["daemonToken"];
|
|
38298
|
-
if (typeof channelId !== "string" || channelId !== expectedChannelId || typeof defaultWorkspace !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string") {
|
|
38299
|
-
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
38300
|
-
}
|
|
38301
|
-
return {
|
|
38302
|
-
channelId: validateIdentifier(channelId, "invalid_connection"),
|
|
38303
|
-
defaultWorkspace,
|
|
38304
|
-
relayOrigin: parseRelayOrigin(relayOrigin),
|
|
38305
|
-
runtimeCredential: validateRuntimeCredential(runtimeCredential2)
|
|
38306
|
-
};
|
|
38307
|
-
}
|
|
38308
38234
|
async function readJsonFile(path2, signal, missingCode) {
|
|
38309
38235
|
signal.throwIfAborted();
|
|
38310
38236
|
let handle;
|
|
@@ -38435,23 +38361,16 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
38435
38361
|
}
|
|
38436
38362
|
return await this.readConnection(index2.connectionId, signal);
|
|
38437
38363
|
};
|
|
38438
|
-
migrateLegacyConnection = async (legacyStateDirectory, channelId, signal) => {
|
|
38439
|
-
try {
|
|
38440
|
-
return await this.#readConnectionForChannel(channelId, signal);
|
|
38441
|
-
} catch (cause) {
|
|
38442
|
-
if (!(cause instanceof RuntimeInstallationStoreError) || cause.code !== "connection_not_found") {
|
|
38443
|
-
throw cause;
|
|
38444
|
-
}
|
|
38445
|
-
}
|
|
38446
|
-
return await this.importLegacyConnection(legacyStateDirectory, channelId, signal);
|
|
38447
|
-
};
|
|
38448
38364
|
saveConnection = async (input2, signal) => {
|
|
38449
38365
|
const stored = new VerifiedRuntimeConnection(
|
|
38366
|
+
"active",
|
|
38450
38367
|
this.applicationId,
|
|
38368
|
+
validateRemoteAppId(input2.appId),
|
|
38451
38369
|
this.installationId,
|
|
38452
38370
|
connectionId(),
|
|
38453
38371
|
validateIdentifier(input2.channelId, "invalid_connection"),
|
|
38454
38372
|
input2.defaultWorkspace,
|
|
38373
|
+
input2.pairingId.length === 0 ? "" : validateIdentifier(input2.pairingId, "invalid_pairing_id"),
|
|
38455
38374
|
parseRelayOrigin(input2.relayOrigin.toString()),
|
|
38456
38375
|
validateRuntimeCredential(input2.runtimeCredential),
|
|
38457
38376
|
validateIdentifier(input2.runtimeId, "invalid_connection")
|
|
@@ -38459,25 +38378,6 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
38459
38378
|
await this.writeConnection(stored, signal);
|
|
38460
38379
|
return stored;
|
|
38461
38380
|
};
|
|
38462
|
-
importLegacyConnection = async (legacyStateDirectory, channelId, signal) => {
|
|
38463
|
-
const normalizedChannelId = validateIdentifier(channelId, "invalid_channel_id");
|
|
38464
|
-
const legacyPath = join15(resolve4(legacyStateDirectory), "connections", `${normalizedChannelId}.json`);
|
|
38465
|
-
const legacy = decodeLegacyConnection(
|
|
38466
|
-
await readJsonFile(legacyPath, signal, "connection_not_found"),
|
|
38467
|
-
normalizedChannelId
|
|
38468
|
-
);
|
|
38469
|
-
const stored = new ImportedLegacyRuntimeConnection(
|
|
38470
|
-
this.applicationId,
|
|
38471
|
-
this.installationId,
|
|
38472
|
-
connectionId(),
|
|
38473
|
-
legacy.channelId,
|
|
38474
|
-
legacy.defaultWorkspace,
|
|
38475
|
-
legacy.relayOrigin,
|
|
38476
|
-
legacy.runtimeCredential
|
|
38477
|
-
);
|
|
38478
|
-
await this.writeConnection(stored, signal);
|
|
38479
|
-
return stored;
|
|
38480
|
-
};
|
|
38481
38381
|
writeConnection = async (stored, signal) => {
|
|
38482
38382
|
signal.throwIfAborted();
|
|
38483
38383
|
try {
|
|
@@ -38491,49 +38391,134 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
38491
38391
|
throw cause;
|
|
38492
38392
|
}
|
|
38493
38393
|
}
|
|
38494
|
-
|
|
38495
|
-
|
|
38496
|
-
|
|
38497
|
-
|
|
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",
|
|
38498
38419
|
{
|
|
38499
|
-
|
|
38500
|
-
|
|
38501
|
-
connectionId: stored.connectionId,
|
|
38502
|
-
defaultWorkspace: stored.defaultWorkspace,
|
|
38503
|
-
installationId: stored.installationId,
|
|
38504
|
-
kind: stored.kind,
|
|
38505
|
-
relayOrigin: stored.relayOrigin.toString(),
|
|
38506
|
-
runtimeCredential: stored.runtimeCredential,
|
|
38507
|
-
runtimeId: stored.runtimeId,
|
|
38508
|
-
version: 1
|
|
38509
|
-
},
|
|
38510
|
-
signal
|
|
38420
|
+
cause
|
|
38421
|
+
}
|
|
38511
38422
|
);
|
|
38512
|
-
}
|
|
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) {
|
|
38513
38488
|
await writeJsonAtomically(
|
|
38514
38489
|
connectionPath,
|
|
38515
38490
|
{
|
|
38516
|
-
|
|
38517
|
-
|
|
38518
|
-
|
|
38519
|
-
|
|
38520
|
-
|
|
38521
|
-
|
|
38522
|
-
|
|
38523
|
-
|
|
38524
|
-
|
|
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
|
|
38525
38504
|
},
|
|
38526
38505
|
signal
|
|
38527
38506
|
);
|
|
38507
|
+
return;
|
|
38528
38508
|
}
|
|
38529
38509
|
await writeJsonAtomically(
|
|
38530
|
-
|
|
38510
|
+
connectionPath,
|
|
38531
38511
|
{
|
|
38532
|
-
|
|
38533
|
-
|
|
38534
|
-
|
|
38535
|
-
|
|
38536
|
-
|
|
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
|
|
38537
38522
|
},
|
|
38538
38523
|
signal
|
|
38539
38524
|
);
|
|
@@ -38617,7 +38602,7 @@ function readSingleOption(arguments_, option) {
|
|
|
38617
38602
|
function assertKnownArguments(arguments_) {
|
|
38618
38603
|
for (let index2 = 0; index2 < arguments_.length; index2 += 2) {
|
|
38619
38604
|
const option = arguments_[index2];
|
|
38620
|
-
if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace") {
|
|
38605
|
+
if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace" && option !== "--app-id") {
|
|
38621
38606
|
throw new PairingClientError("invalid_arguments", `Unknown pairing option: ${option ?? "missing option"}`);
|
|
38622
38607
|
}
|
|
38623
38608
|
}
|
|
@@ -38656,6 +38641,7 @@ function parsePairingCode(value) {
|
|
|
38656
38641
|
function parsePairCommand(arguments_, defaultWorkspace) {
|
|
38657
38642
|
assertKnownArguments(arguments_);
|
|
38658
38643
|
return {
|
|
38644
|
+
appId: arguments_.includes("--app-id") ? validatePairingId(readSingleOption(arguments_, "--app-id")) : "standalone",
|
|
38659
38645
|
code: parsePairingCode(readSingleOption(arguments_, "--code")),
|
|
38660
38646
|
pairingId: arguments_.includes("--pairing") ? validatePairingId(readSingleOption(arguments_, "--pairing")) : "",
|
|
38661
38647
|
relayOrigin: parseRelayOrigin2(readSingleOption(arguments_, "--url")),
|
|
@@ -38668,48 +38654,15 @@ function validatePairingId(value) {
|
|
|
38668
38654
|
}
|
|
38669
38655
|
return value;
|
|
38670
38656
|
}
|
|
38671
|
-
|
|
38672
|
-
|
|
38673
|
-
|
|
38674
|
-
connectionId;
|
|
38675
|
-
constructor(connectionId2) {
|
|
38676
|
-
super();
|
|
38677
|
-
this.connectionId = connectionId2;
|
|
38678
|
-
}
|
|
38679
|
-
resume = async (installation, signal, environment) => await resumeMobiusRuntime(installation, this.connectionId, signal, environment);
|
|
38680
|
-
};
|
|
38681
|
-
var LegacyChannelResumeCommandTarget = class extends ResumeCommandTarget {
|
|
38682
|
-
channelId;
|
|
38683
|
-
constructor(channelId) {
|
|
38684
|
-
super();
|
|
38685
|
-
this.channelId = channelId;
|
|
38686
|
-
}
|
|
38687
|
-
resume = async (installation, signal, environment) => await resumeLegacyChannel(installation, this.channelId, signal, environment);
|
|
38688
|
-
};
|
|
38689
|
-
function parseResumeArgument(arguments_) {
|
|
38690
|
-
if (arguments_.length !== 2) {
|
|
38691
|
-
throw new PairingClientError(
|
|
38692
|
-
"invalid_arguments",
|
|
38693
|
-
"Usage: mobius start --connection <connection-id> or mobius start --channel <legacy-channel-id>"
|
|
38694
|
-
);
|
|
38657
|
+
function parseResumeConnectionId(arguments_) {
|
|
38658
|
+
if (arguments_.length !== 2 || arguments_[0] !== "--connection") {
|
|
38659
|
+
throw new PairingClientError("invalid_arguments", "Usage: mobius start --connection <connection-id>");
|
|
38695
38660
|
}
|
|
38696
38661
|
const value = arguments_[1] ?? "";
|
|
38697
|
-
if (
|
|
38698
|
-
|
|
38699
|
-
throw new PairingClientError("invalid_connection_id", "The saved Runtime connection ID is invalid");
|
|
38700
|
-
}
|
|
38701
|
-
return new ConnectionResumeCommandTarget(value);
|
|
38702
|
-
}
|
|
38703
|
-
if (arguments_[0] === "--channel") {
|
|
38704
|
-
if (!IDENTIFIER_PATTERN5.test(value)) {
|
|
38705
|
-
throw new PairingClientError("invalid_channel_id", "The saved channel ID is invalid");
|
|
38706
|
-
}
|
|
38707
|
-
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");
|
|
38708
38664
|
}
|
|
38709
|
-
|
|
38710
|
-
"invalid_arguments",
|
|
38711
|
-
"Usage: mobius start --connection <connection-id> or mobius start --channel <legacy-channel-id>"
|
|
38712
|
-
);
|
|
38665
|
+
return value;
|
|
38713
38666
|
}
|
|
38714
38667
|
async function resolveDefaultWorkspace(path2) {
|
|
38715
38668
|
const requestedWorkspace = resolve5(path2);
|
|
@@ -38845,8 +38798,10 @@ async function pairRuntime(installation, options, signal, environment) {
|
|
|
38845
38798
|
const claim2 = await claimPairing(options, defaultWorkspace, agents, inventory.installable, signal);
|
|
38846
38799
|
const connection = await installation.saveConnection(
|
|
38847
38800
|
{
|
|
38801
|
+
appId: options.appId,
|
|
38848
38802
|
channelId: claim2.channelId,
|
|
38849
38803
|
defaultWorkspace,
|
|
38804
|
+
pairingId: options.pairingId,
|
|
38850
38805
|
relayOrigin: options.relayOrigin,
|
|
38851
38806
|
runtimeCredential: claim2.runtimeCredential,
|
|
38852
38807
|
runtimeId: claim2.runtimeId
|
|
@@ -38859,6 +38814,7 @@ async function pairMobiusRuntime(installation, options, signal, environment = pr
|
|
|
38859
38814
|
return await pairRuntime(
|
|
38860
38815
|
installation,
|
|
38861
38816
|
{
|
|
38817
|
+
appId: "embedded",
|
|
38862
38818
|
code: parsePairingCode(options.pairingCode),
|
|
38863
38819
|
pairingId: validatePairingId(options.pairingId),
|
|
38864
38820
|
relayOrigin: parseRelayOrigin2(options.relayOrigin),
|
|
@@ -38882,10 +38838,6 @@ async function resumeMobiusRuntime(installation, connectionId2, signal, environm
|
|
|
38882
38838
|
const connection = await installation.readConnection(connectionId2, signal);
|
|
38883
38839
|
return await resumeRuntimeConnection(installation, connection, signal, environment);
|
|
38884
38840
|
}
|
|
38885
|
-
async function resumeLegacyChannel(installation, channelId, signal, environment) {
|
|
38886
|
-
const connection = await installation.migrateLegacyConnection(readStateDirectory(environment), channelId, signal);
|
|
38887
|
-
return await resumeRuntimeConnection(installation, connection, signal, environment);
|
|
38888
|
-
}
|
|
38889
38841
|
async function openMobiusCliInstallation(signal, environment) {
|
|
38890
38842
|
return await openRuntimeInstallationStore(
|
|
38891
38843
|
{
|
|
@@ -38899,9 +38851,16 @@ async function pairLocalMachine(arguments_, signal = new AbortController().signa
|
|
|
38899
38851
|
const requested = parsePairCommand(arguments_, "");
|
|
38900
38852
|
const installation = await openMobiusCliInstallation(signal, process.env);
|
|
38901
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
|
+
}
|
|
38902
38860
|
return await pairRuntime(
|
|
38903
38861
|
installation,
|
|
38904
38862
|
{
|
|
38863
|
+
appId: requested.appId,
|
|
38905
38864
|
code: requested.code,
|
|
38906
38865
|
pairingId: requested.pairingId,
|
|
38907
38866
|
relayOrigin: requested.relayOrigin,
|
|
@@ -38912,9 +38871,9 @@ async function pairLocalMachine(arguments_, signal = new AbortController().signa
|
|
|
38912
38871
|
);
|
|
38913
38872
|
}
|
|
38914
38873
|
async function resumeLocalMachine(arguments_, signal = new AbortController().signal) {
|
|
38915
|
-
const
|
|
38874
|
+
const connectionId2 = parseResumeConnectionId(arguments_);
|
|
38916
38875
|
const installation = await openMobiusCliInstallation(signal, process.env);
|
|
38917
|
-
return await
|
|
38876
|
+
return await resumeMobiusRuntime(installation, connectionId2, signal, process.env);
|
|
38918
38877
|
}
|
|
38919
38878
|
|
|
38920
38879
|
// src/relay-connection/runtime-revocation.ts
|
|
@@ -39798,7 +39757,7 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
39798
39757
|
}
|
|
39799
39758
|
|
|
39800
39759
|
// src/authorization/workspace-directory.ts
|
|
39801
|
-
import { readdir as
|
|
39760
|
+
import { readdir as readdir3, realpath as realpath9, stat as stat8 } from "node:fs/promises";
|
|
39802
39761
|
import { homedir as homedir2 } from "node:os";
|
|
39803
39762
|
import { basename as basename5, dirname as dirname6, isAbsolute as isAbsolute10, join as join16, normalize as normalize4, relative as relative4 } from "node:path";
|
|
39804
39763
|
var WorkspaceDirectoryListing = class {
|
|
@@ -39903,7 +39862,7 @@ var WorkspaceDirectoryService = class {
|
|
|
39903
39862
|
list = async (bindingId, id, signal) => {
|
|
39904
39863
|
const target = await this.resolve(bindingId, id, signal);
|
|
39905
39864
|
try {
|
|
39906
|
-
const children = await
|
|
39865
|
+
const children = await readdir3(target, { withFileTypes: true });
|
|
39907
39866
|
signal.throwIfAborted();
|
|
39908
39867
|
const entries = [];
|
|
39909
39868
|
for (const child of children) {
|
|
@@ -41618,71 +41577,7 @@ var SessionEventOutbox = class {
|
|
|
41618
41577
|
received_at INTEGER NOT NULL
|
|
41619
41578
|
) STRICT;
|
|
41620
41579
|
`);
|
|
41621
|
-
const deadLetterTable = this.#database.prepare(
|
|
41622
|
-
`SELECT sql FROM sqlite_master
|
|
41623
|
-
WHERE type = 'table' AND name = 'relay_session_event_dead_letters'`
|
|
41624
|
-
).get();
|
|
41625
|
-
const deadLetterSql = typeof deadLetterTable === "object" && deadLetterTable !== null ? Reflect.get(deadLetterTable, "sql") : void 0;
|
|
41626
|
-
if (typeof deadLetterSql !== "string" || !deadLetterSql.includes("'session_rejected'")) {
|
|
41627
|
-
this.#database.exec(`
|
|
41628
|
-
BEGIN IMMEDIATE;
|
|
41629
|
-
ALTER TABLE relay_session_event_dead_letters
|
|
41630
|
-
RENAME TO relay_session_event_dead_letters_legacy;
|
|
41631
|
-
CREATE TABLE relay_session_event_dead_letters (
|
|
41632
|
-
ordinal INTEGER PRIMARY KEY,
|
|
41633
|
-
event_id TEXT NOT NULL UNIQUE,
|
|
41634
|
-
session_id TEXT NOT NULL,
|
|
41635
|
-
envelope_json TEXT NOT NULL,
|
|
41636
|
-
rejection_code TEXT NOT NULL CHECK (
|
|
41637
|
-
rejection_code IN ('session_deleted', 'session_not_found', 'session_rejected')
|
|
41638
|
-
)
|
|
41639
|
-
) STRICT;
|
|
41640
|
-
INSERT INTO relay_session_event_dead_letters (
|
|
41641
|
-
ordinal, event_id, session_id, envelope_json, rejection_code
|
|
41642
|
-
)
|
|
41643
|
-
SELECT ordinal, event_id, session_id, envelope_json, rejection_code
|
|
41644
|
-
FROM relay_session_event_dead_letters_legacy;
|
|
41645
|
-
DROP TABLE relay_session_event_dead_letters_legacy;
|
|
41646
|
-
COMMIT;
|
|
41647
|
-
`);
|
|
41648
|
-
}
|
|
41649
|
-
const outboxColumns = this.#database.prepare("PRAGMA table_info(relay_session_event_outbox)").all();
|
|
41650
|
-
const hasSourceKey = outboxColumns.some(
|
|
41651
|
-
(column) => typeof column === "object" && column !== null && Reflect.get(column, "name") === "source_key"
|
|
41652
|
-
);
|
|
41653
|
-
if (!hasSourceKey) {
|
|
41654
|
-
this.#database.exec(`
|
|
41655
|
-
ALTER TABLE relay_session_event_outbox
|
|
41656
|
-
ADD COLUMN source_key TEXT NOT NULL DEFAULT '';
|
|
41657
|
-
`);
|
|
41658
|
-
}
|
|
41659
|
-
const hasByteLength = outboxColumns.some(
|
|
41660
|
-
(column) => typeof column === "object" && column !== null && Reflect.get(column, "name") === "byte_length"
|
|
41661
|
-
);
|
|
41662
|
-
if (!hasByteLength) {
|
|
41663
|
-
this.#database.exec(`
|
|
41664
|
-
ALTER TABLE relay_session_event_outbox
|
|
41665
|
-
ADD COLUMN byte_length INTEGER NOT NULL DEFAULT 0;
|
|
41666
|
-
`);
|
|
41667
|
-
}
|
|
41668
41580
|
this.#database.exec(`
|
|
41669
|
-
UPDATE relay_session_event_outbox
|
|
41670
|
-
SET source_key = CASE json_extract(envelope_json, '$.source.kind')
|
|
41671
|
-
WHEN 'attempt' THEN
|
|
41672
|
-
'attempt:' || session_id || ':' || json_extract(envelope_json, '$.source.attemptId')
|
|
41673
|
-
ELSE 'runtime:' || session_id
|
|
41674
|
-
END
|
|
41675
|
-
WHERE source_key = '';
|
|
41676
|
-
UPDATE relay_session_event_outbox
|
|
41677
|
-
SET byte_length = length(CAST(envelope_json AS BLOB))
|
|
41678
|
-
WHERE byte_length = 0;
|
|
41679
|
-
UPDATE relay_session_event_outbox_state
|
|
41680
|
-
SET event_count = (SELECT COUNT(*) FROM relay_session_event_outbox),
|
|
41681
|
-
total_bytes = (
|
|
41682
|
-
SELECT COALESCE(SUM(byte_length), 0)
|
|
41683
|
-
FROM relay_session_event_outbox
|
|
41684
|
-
)
|
|
41685
|
-
WHERE singleton = 1;
|
|
41686
41581
|
CREATE INDEX IF NOT EXISTS relay_session_event_outbox_source_order
|
|
41687
41582
|
ON relay_session_event_outbox(source_key, ordinal);
|
|
41688
41583
|
`);
|
|
@@ -44894,7 +44789,11 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44894
44789
|
);
|
|
44895
44790
|
};
|
|
44896
44791
|
const announceReadiness = () => {
|
|
44897
|
-
if (!connectionAnnounced || !catalogPublished
|
|
44792
|
+
if (!connectionAnnounced || !catalogPublished) {
|
|
44793
|
+
return;
|
|
44794
|
+
}
|
|
44795
|
+
options.onConnectionStatus?.("online");
|
|
44796
|
+
if (readinessAnnounced) {
|
|
44898
44797
|
return;
|
|
44899
44798
|
}
|
|
44900
44799
|
readinessAnnounced = true;
|
|
@@ -44905,14 +44804,16 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44905
44804
|
return;
|
|
44906
44805
|
}
|
|
44907
44806
|
connectionAnnounced = true;
|
|
44908
|
-
const reconnectCommand = `npx --yes @moxt-ai/mobius start ${config2.reconnectTarget.commandArgument}`;
|
|
44909
44807
|
process.stdout.write("Mobius daemon connected to the relay.\n\n");
|
|
44910
|
-
|
|
44911
|
-
|
|
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:
|
|
44912
44812
|
${reconnectCommand}`)}
|
|
44913
44813
|
|
|
44914
44814
|
`
|
|
44915
|
-
|
|
44815
|
+
);
|
|
44816
|
+
}
|
|
44916
44817
|
announceReadiness();
|
|
44917
44818
|
startAutomaticIntegrationProvisioning();
|
|
44918
44819
|
};
|
|
@@ -44943,7 +44844,12 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44943
44844
|
activeAttemptIds,
|
|
44944
44845
|
connectionEpoch,
|
|
44945
44846
|
diagnostics,
|
|
44946
|
-
|
|
44847
|
+
() => {
|
|
44848
|
+
if (catalogPublished) {
|
|
44849
|
+
options.onConnectionStatus?.("online");
|
|
44850
|
+
}
|
|
44851
|
+
announceConnection();
|
|
44852
|
+
},
|
|
44947
44853
|
signal,
|
|
44948
44854
|
timer,
|
|
44949
44855
|
resolveAgentCatalogEnvironment
|
|
@@ -44957,6 +44863,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44957
44863
|
}
|
|
44958
44864
|
diagnostics.connectionFailed(connectionEpoch, error62, "connection");
|
|
44959
44865
|
}
|
|
44866
|
+
options.onConnectionStatus?.("reconnecting");
|
|
44960
44867
|
await waitForRelayRetry(signal, timer);
|
|
44961
44868
|
}
|
|
44962
44869
|
} finally {
|
|
@@ -45123,6 +45030,7 @@ var MobiusRuntimeEngine = class {
|
|
|
45123
45030
|
const audit = new AuditStore(this.#config.auditDatabasePath);
|
|
45124
45031
|
try {
|
|
45125
45032
|
await runDaemon(this.#config, audit, signal, void 0, {
|
|
45033
|
+
...this.#options.onConnectionStatus === void 0 ? {} : { onConnectionStatus: this.#options.onConnectionStatus },
|
|
45126
45034
|
...this.#options.resolveAgentCatalogEnvironment === void 0 ? {} : { resolveAgentCatalogEnvironment: this.#options.resolveAgentCatalogEnvironment }
|
|
45127
45035
|
});
|
|
45128
45036
|
} finally {
|
|
@@ -45134,10 +45042,8 @@ var MobiusRuntimeEngine = class {
|
|
|
45134
45042
|
export {
|
|
45135
45043
|
AcpExecutionError,
|
|
45136
45044
|
AuditStore,
|
|
45137
|
-
ChannelDaemonReconnectTarget,
|
|
45138
45045
|
DaemonLocalContext,
|
|
45139
45046
|
DaemonReconnectTarget,
|
|
45140
|
-
ImportedLegacyRuntimeConnection,
|
|
45141
45047
|
LocalAuthorizationError,
|
|
45142
45048
|
MobiusRuntimeConfigurationError,
|
|
45143
45049
|
MobiusRuntimeEngine,
|