@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/runtime.js
CHANGED
|
@@ -1181,6 +1181,8 @@ function normalizeVersionOutput(output2) {
|
|
|
1181
1181
|
var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e4;
|
|
1182
1182
|
var ACP_PROBE_TIMEOUT_MILLISECONDS = 6e4;
|
|
1183
1183
|
var LocalAgentSpecification = class {
|
|
1184
|
+
minimumSupportedAgentVersion = "0.0.0";
|
|
1185
|
+
maximumTestedAgentVersion = "0.0.0";
|
|
1184
1186
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS;
|
|
1185
1187
|
authenticationCommand = () => "";
|
|
1186
1188
|
adapterVersionArguments = ["--version"];
|
|
@@ -1263,6 +1265,8 @@ var ClaudeCodeAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
1263
1265
|
agentOverrideVariable = "MOBIUS_CLAUDE_PATH";
|
|
1264
1266
|
id = "claude";
|
|
1265
1267
|
label = "Claude Code";
|
|
1268
|
+
minimumSupportedAgentVersion = "2.1.273";
|
|
1269
|
+
maximumTestedAgentVersion = "2.1.273";
|
|
1266
1270
|
managedAdapterExecutablePath = [
|
|
1267
1271
|
"adapters",
|
|
1268
1272
|
"claude",
|
|
@@ -21175,11 +21179,12 @@ var threadLifecycleResponseSchema = external_exports.object({
|
|
|
21175
21179
|
});
|
|
21176
21180
|
var threadResumeResponseSchema = threadLifecycleResponseSchema;
|
|
21177
21181
|
var threadForkResponseSchema = threadLifecycleResponseSchema;
|
|
21182
|
+
var threadTitleSchema = external_exports.string().transform((value) => value.slice(0, 500));
|
|
21178
21183
|
var threadSummarySchema = external_exports.object({
|
|
21179
21184
|
cwd: boundedText(2048),
|
|
21180
21185
|
id: boundedText(256),
|
|
21181
|
-
name:
|
|
21182
|
-
preview:
|
|
21186
|
+
name: threadTitleSchema.nullish(),
|
|
21187
|
+
preview: threadTitleSchema.nullish(),
|
|
21183
21188
|
updatedAt: external_exports.number().int().nonnegative()
|
|
21184
21189
|
});
|
|
21185
21190
|
var threadListResponseSchema = external_exports.object({
|
|
@@ -22494,6 +22499,8 @@ var CodexAgentSpecification = class extends InProcessAcpAgentDefinition2 {
|
|
|
22494
22499
|
createEndpoint = (options) => new CodexAcpAgent(options);
|
|
22495
22500
|
id = "codex";
|
|
22496
22501
|
label = "Codex";
|
|
22502
|
+
minimumSupportedAgentVersion = "0.153.0";
|
|
22503
|
+
maximumTestedAgentVersion = "0.154.0";
|
|
22497
22504
|
constructor() {
|
|
22498
22505
|
super("MOBIUS_CODEX_PATH", ["agents", "codex", "bin", "codex"]);
|
|
22499
22506
|
}
|
|
@@ -22556,6 +22563,8 @@ var CopilotCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
22556
22563
|
agentExecutable = "copilot";
|
|
22557
22564
|
id = "github-copilot-cli";
|
|
22558
22565
|
label = "GitHub Copilot CLI";
|
|
22566
|
+
minimumSupportedAgentVersion = COPILOT_CLI_TESTED_VERSION;
|
|
22567
|
+
maximumTestedAgentVersion = COPILOT_CLI_TESTED_VERSION;
|
|
22559
22568
|
versionProbeTimeoutMilliseconds = 1e4;
|
|
22560
22569
|
constructor() {
|
|
22561
22570
|
super(
|
|
@@ -22586,6 +22595,8 @@ var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
22586
22595
|
agentExecutable = "cursor-agent";
|
|
22587
22596
|
id = "cursor";
|
|
22588
22597
|
label = "Cursor CLI";
|
|
22598
|
+
minimumSupportedAgentVersion = CURSOR_CLI_TESTED_VERSION;
|
|
22599
|
+
maximumTestedAgentVersion = CURSOR_CLI_TESTED_VERSION;
|
|
22589
22600
|
constructor() {
|
|
22590
22601
|
super(
|
|
22591
22602
|
"MOBIUS_CURSOR_PATH",
|
|
@@ -22608,16 +22619,16 @@ import { isAbsolute as isAbsolute3, join as join6, normalize } from "node:path";
|
|
|
22608
22619
|
|
|
22609
22620
|
// src/agent-installation/deepseek-managed-package.ts
|
|
22610
22621
|
var DeepSeekHarnessManagedPackage = class extends SriManagedNpmPackageDefinition {
|
|
22611
|
-
dependencyResolutionArguments = Object.freeze(["--before=2026-09-
|
|
22622
|
+
dependencyResolutionArguments = Object.freeze(["--before=2026-09-23T00:00:00.000Z"]);
|
|
22612
22623
|
includeOptionalDependencies = true;
|
|
22613
22624
|
verifyDependencyClosure = true;
|
|
22614
22625
|
};
|
|
22615
22626
|
var DEEPSEEK_HARNESS_PACKAGE = new DeepSeekHarnessManagedPackage(
|
|
22616
22627
|
"@deepseek-ai/dsh",
|
|
22617
|
-
"0.1.5-rc.
|
|
22628
|
+
"0.1.5-rc.3",
|
|
22618
22629
|
"dsh",
|
|
22619
|
-
"sha512-
|
|
22620
|
-
"https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.1.5-rc.
|
|
22630
|
+
"sha512-c0W6Xqc4ChjFcCJkbzPeIxZQdnbKqe+QAcJzWGtogg0ZzsnZRcw3vopMyZ5oZU6E2fmyqGcyDR1sBeiCH4yHcg==",
|
|
22631
|
+
"https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.1.5-rc.3.tgz"
|
|
22621
22632
|
);
|
|
22622
22633
|
|
|
22623
22634
|
// src/storage/state-directory.ts
|
|
@@ -22672,6 +22683,8 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
22672
22683
|
agentExecutable = "dsh";
|
|
22673
22684
|
id = "deepseek-harness";
|
|
22674
22685
|
label = "DeepSeek Harness";
|
|
22686
|
+
minimumSupportedAgentVersion = "0.1.2-rc.1";
|
|
22687
|
+
maximumTestedAgentVersion = DEEPSEEK_HARNESS_PACKAGE.version;
|
|
22675
22688
|
constructor() {
|
|
22676
22689
|
super(
|
|
22677
22690
|
"MOBIUS_DEEPSEEK_HARNESS_PATH",
|
|
@@ -22742,6 +22755,8 @@ var GeminiCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
22742
22755
|
agentExecutable = "gemini";
|
|
22743
22756
|
id = "gemini-cli";
|
|
22744
22757
|
label = "Gemini CLI";
|
|
22758
|
+
minimumSupportedAgentVersion = GEMINI_CLI_TESTED_VERSION;
|
|
22759
|
+
maximumTestedAgentVersion = GEMINI_CLI_TESTED_VERSION;
|
|
22745
22760
|
versionProbeTimeoutMilliseconds = 1e4;
|
|
22746
22761
|
constructor() {
|
|
22747
22762
|
super(
|
|
@@ -22843,6 +22858,8 @@ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
22843
22858
|
adapterVersionArguments = ["version"];
|
|
22844
22859
|
id = "grok-build";
|
|
22845
22860
|
label = "Grok Build";
|
|
22861
|
+
minimumSupportedAgentVersion = GROK_BUILD_MANAGED_VERSION;
|
|
22862
|
+
maximumTestedAgentVersion = GROK_BUILD_MANAGED_VERSION;
|
|
22846
22863
|
constructor() {
|
|
22847
22864
|
super(
|
|
22848
22865
|
"MOBIUS_GROK_BUILD_PATH",
|
|
@@ -22914,6 +22931,8 @@ var HermesAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
22914
22931
|
agentVersionArguments = ["acp", "--version"];
|
|
22915
22932
|
id = "hermes";
|
|
22916
22933
|
label = "Hermes Agent";
|
|
22934
|
+
minimumSupportedAgentVersion = HERMES_TESTED_VERSION;
|
|
22935
|
+
maximumTestedAgentVersion = HERMES_TESTED_VERSION;
|
|
22917
22936
|
constructor() {
|
|
22918
22937
|
super("MOBIUS_HERMES_PATH", ["acp"], ["agents", "hermes", HERMES_TESTED_VERSION, "bin", "hermes"]);
|
|
22919
22938
|
}
|
|
@@ -22942,6 +22961,8 @@ var OhMyPiAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
22942
22961
|
agentOverrideVariable = "MOBIUS_OH_MY_PI_PATH";
|
|
22943
22962
|
id = "oh-my-pi";
|
|
22944
22963
|
label = "Oh My Pi";
|
|
22964
|
+
minimumSupportedAgentVersion = OH_MY_PI_TESTED_VERSION;
|
|
22965
|
+
maximumTestedAgentVersion = OH_MY_PI_TESTED_VERSION;
|
|
22945
22966
|
constructor() {
|
|
22946
22967
|
super("MOBIUS_OH_MY_PI_PATH", ["acp"], ["agents", "oh-my-pi", OH_MY_PI_TESTED_VERSION, "bin", "omp"]);
|
|
22947
22968
|
}
|
|
@@ -23333,6 +23354,8 @@ var OpenCodeAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
23333
23354
|
agentExecutable = "opencode";
|
|
23334
23355
|
id = "opencode";
|
|
23335
23356
|
label = "OpenCode";
|
|
23357
|
+
minimumSupportedAgentVersion = OPENCODE_MANAGED_VERSION;
|
|
23358
|
+
maximumTestedAgentVersion = OPENCODE_MANAGED_VERSION;
|
|
23336
23359
|
constructor() {
|
|
23337
23360
|
super(
|
|
23338
23361
|
"MOBIUS_OPENCODE_PATH",
|
|
@@ -23407,6 +23430,8 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
23407
23430
|
agentOverrideVariable = "MOBIUS_PI_PATH";
|
|
23408
23431
|
id = "pi";
|
|
23409
23432
|
label = "Pi";
|
|
23433
|
+
minimumSupportedAgentVersion = PI_AGENT_PACKAGE.version;
|
|
23434
|
+
maximumTestedAgentVersion = PI_AGENT_PACKAGE.version;
|
|
23410
23435
|
managedAdapterExecutablePath = [
|
|
23411
23436
|
"adapters",
|
|
23412
23437
|
"pi",
|
|
@@ -23501,6 +23526,8 @@ var WorkBuddyAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
23501
23526
|
agentExecutable = "codebuddy";
|
|
23502
23527
|
id = "workbuddy";
|
|
23503
23528
|
label = "WorkBuddy";
|
|
23529
|
+
minimumSupportedAgentVersion = "2.115.0";
|
|
23530
|
+
maximumTestedAgentVersion = WORKBUDDY_MANAGED_VERSION;
|
|
23504
23531
|
constructor() {
|
|
23505
23532
|
super(
|
|
23506
23533
|
"MOBIUS_WORKBUDDY_PATH",
|
|
@@ -23843,6 +23870,61 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
|
|
|
23843
23870
|
}
|
|
23844
23871
|
}
|
|
23845
23872
|
|
|
23873
|
+
// src/agent-catalog/agent-version.ts
|
|
23874
|
+
function parseVersion(value) {
|
|
23875
|
+
const match = /(?:^|[^0-9])v?(\d+(?:\.\d+)+)(?:-([0-9A-Za-z.-]+))?/u.exec(value);
|
|
23876
|
+
if (match?.[1] === void 0) {
|
|
23877
|
+
return null;
|
|
23878
|
+
}
|
|
23879
|
+
return {
|
|
23880
|
+
core: match[1].split(".").map(Number),
|
|
23881
|
+
prerelease: match[2]?.split(".") ?? []
|
|
23882
|
+
};
|
|
23883
|
+
}
|
|
23884
|
+
function comparePrerelease(left, right) {
|
|
23885
|
+
if (left.length === 0 || right.length === 0) {
|
|
23886
|
+
return left.length === right.length ? 0 : left.length === 0 ? 1 : -1;
|
|
23887
|
+
}
|
|
23888
|
+
for (let index2 = 0; index2 < Math.max(left.length, right.length); index2 += 1) {
|
|
23889
|
+
const leftPart = left[index2];
|
|
23890
|
+
const rightPart = right[index2];
|
|
23891
|
+
if (leftPart === void 0 || rightPart === void 0) {
|
|
23892
|
+
return leftPart === rightPart ? 0 : leftPart === void 0 ? -1 : 1;
|
|
23893
|
+
}
|
|
23894
|
+
if (leftPart === rightPart) {
|
|
23895
|
+
continue;
|
|
23896
|
+
}
|
|
23897
|
+
const leftNumber = /^\d+$/u.test(leftPart) ? Number(leftPart) : null;
|
|
23898
|
+
const rightNumber = /^\d+$/u.test(rightPart) ? Number(rightPart) : null;
|
|
23899
|
+
if (leftNumber !== null && rightNumber !== null) {
|
|
23900
|
+
return Math.sign(leftNumber - rightNumber);
|
|
23901
|
+
}
|
|
23902
|
+
if (leftNumber !== null || rightNumber !== null) {
|
|
23903
|
+
return leftNumber !== null ? -1 : 1;
|
|
23904
|
+
}
|
|
23905
|
+
return leftPart.localeCompare(rightPart);
|
|
23906
|
+
}
|
|
23907
|
+
return 0;
|
|
23908
|
+
}
|
|
23909
|
+
function compareAgentVersions(left, right) {
|
|
23910
|
+
const parsedLeft = parseVersion(left);
|
|
23911
|
+
const parsedRight = parseVersion(right);
|
|
23912
|
+
if (parsedLeft === null || parsedRight === null) {
|
|
23913
|
+
return null;
|
|
23914
|
+
}
|
|
23915
|
+
for (let index2 = 0; index2 < Math.max(parsedLeft.core.length, parsedRight.core.length); index2 += 1) {
|
|
23916
|
+
const difference = (parsedLeft.core[index2] ?? 0) - (parsedRight.core[index2] ?? 0);
|
|
23917
|
+
if (difference !== 0) {
|
|
23918
|
+
return Math.sign(difference);
|
|
23919
|
+
}
|
|
23920
|
+
}
|
|
23921
|
+
return comparePrerelease(parsedLeft.prerelease, parsedRight.prerelease);
|
|
23922
|
+
}
|
|
23923
|
+
function isAgentVersionSupported(reportedVersion, minimumSupportedVersion) {
|
|
23924
|
+
const comparison = compareAgentVersions(reportedVersion, minimumSupportedVersion);
|
|
23925
|
+
return comparison === null ? null : comparison >= 0;
|
|
23926
|
+
}
|
|
23927
|
+
|
|
23846
23928
|
// src/agent-catalog/executable-discovery.ts
|
|
23847
23929
|
import { isAbsolute as isAbsolute7, join as join13 } from "node:path";
|
|
23848
23930
|
|
|
@@ -24124,6 +24206,18 @@ async function discoverAgent(specification, context) {
|
|
|
24124
24206
|
lastFailure = agentProbeFailure(specification, error62);
|
|
24125
24207
|
continue;
|
|
24126
24208
|
}
|
|
24209
|
+
const supportedVersion = isAgentVersionSupported(agentVersion, specification.minimumSupportedAgentVersion);
|
|
24210
|
+
if (supportedVersion === null) {
|
|
24211
|
+
lastFailure = new AgentProbeFailed(
|
|
24212
|
+
specification,
|
|
24213
|
+
"agent_probe_failed",
|
|
24214
|
+
"Agent reported an unrecognized version"
|
|
24215
|
+
);
|
|
24216
|
+
continue;
|
|
24217
|
+
}
|
|
24218
|
+
if (!supportedVersion) {
|
|
24219
|
+
continue;
|
|
24220
|
+
}
|
|
24127
24221
|
const installedAgent = new AgentIntegrationDefinition(
|
|
24128
24222
|
specification.id,
|
|
24129
24223
|
specification.label,
|
|
@@ -26175,16 +26269,7 @@ var OpaqueDaemonReconnectTarget = class extends DaemonReconnectTarget {
|
|
|
26175
26269
|
this.commandArgument = `--connection ${connectionId2}`;
|
|
26176
26270
|
}
|
|
26177
26271
|
};
|
|
26178
|
-
|
|
26179
|
-
channelId;
|
|
26180
|
-
commandArgument;
|
|
26181
|
-
constructor(channelId) {
|
|
26182
|
-
super();
|
|
26183
|
-
this.channelId = channelId;
|
|
26184
|
-
this.commandArgument = `--channel ${channelId}`;
|
|
26185
|
-
}
|
|
26186
|
-
};
|
|
26187
|
-
function createDaemonConfig(connection, agents = [], installableAgents = [], localContext = new DaemonLocalContext(readStateDirectory(), process.env), reconnectTarget = new ChannelDaemonReconnectTarget(connection.channelId)) {
|
|
26272
|
+
function createDaemonConfig(connection, agents = [], installableAgents = [], localContext = new DaemonLocalContext(readStateDirectory(), process.env), reconnectTarget = null) {
|
|
26188
26273
|
const daemonAgents = agents.map((agent) => withDaemonEnvironment(agent, localContext.environment));
|
|
26189
26274
|
return {
|
|
26190
26275
|
agents: daemonAgents,
|
|
@@ -34301,7 +34386,6 @@ var nativeSessionPageSchema = external_exports.object({
|
|
|
34301
34386
|
|
|
34302
34387
|
// src/acp/session-config/session-config-protocol.ts
|
|
34303
34388
|
import { methods as methods7 } from "@agentclientprotocol/sdk";
|
|
34304
|
-
var AGENT_DEFAULT_REASONING_EFFORT = "agent_default";
|
|
34305
34389
|
var MAXIMUM_CONFIG_OPTIONS = 100;
|
|
34306
34390
|
var SessionConfigProtocolError = class extends Error {
|
|
34307
34391
|
code = "invalid_session_configuration_response";
|
|
@@ -34499,207 +34583,9 @@ var StandardSessionConfigProtocol = class {
|
|
|
34499
34583
|
};
|
|
34500
34584
|
var standardSessionConfigProtocol = new StandardSessionConfigProtocol();
|
|
34501
34585
|
|
|
34502
|
-
// src/acp/session-config/grok-build-session-config.ts
|
|
34503
|
-
var LEGACY_MODEL_CONFIG_ID = "grok_build_legacy_model";
|
|
34504
|
-
var LEGACY_REASONING_EFFORT_CONFIG_ID = "grok_build_legacy_reasoning_effort";
|
|
34505
|
-
function legacyOptions(response) {
|
|
34506
|
-
if (!isRecord6(response)) {
|
|
34507
|
-
return [];
|
|
34508
|
-
}
|
|
34509
|
-
const metadata = response["_meta"];
|
|
34510
|
-
if (!isRecord6(metadata)) {
|
|
34511
|
-
return [];
|
|
34512
|
-
}
|
|
34513
|
-
const sessionConfig = metadata["x.ai/sessionConfig"];
|
|
34514
|
-
if (!isRecord6(sessionConfig) || !Array.isArray(sessionConfig["options"])) {
|
|
34515
|
-
return [];
|
|
34516
|
-
}
|
|
34517
|
-
return sessionConfig["options"].slice(0, 500).filter(isRecord6);
|
|
34518
|
-
}
|
|
34519
|
-
function legacyValue(option) {
|
|
34520
|
-
const value = readString2(option["id"]);
|
|
34521
|
-
return {
|
|
34522
|
-
description: readString2(option["description"]).slice(0, 500),
|
|
34523
|
-
groupId: "",
|
|
34524
|
-
groupName: "",
|
|
34525
|
-
name: readString2(option["label"], value).slice(0, 255),
|
|
34526
|
-
value: value.slice(0, 500)
|
|
34527
|
-
};
|
|
34528
|
-
}
|
|
34529
|
-
function modelsRecord(response) {
|
|
34530
|
-
if (!isRecord6(response) || !isRecord6(response["models"])) {
|
|
34531
|
-
return {};
|
|
34532
|
-
}
|
|
34533
|
-
return response["models"];
|
|
34534
|
-
}
|
|
34535
|
-
function legacyModelOptions(response) {
|
|
34536
|
-
const options = legacyOptions(response);
|
|
34537
|
-
const models = modelsRecord(response);
|
|
34538
|
-
const values = [];
|
|
34539
|
-
for (const option of options) {
|
|
34540
|
-
if (option["category"] === "model") {
|
|
34541
|
-
const value = legacyValue(option);
|
|
34542
|
-
if (value.value.length > 0 && !values.some((existing) => existing.value === value.value)) {
|
|
34543
|
-
values.push(value);
|
|
34544
|
-
}
|
|
34545
|
-
}
|
|
34546
|
-
}
|
|
34547
|
-
if (values.length === 0 && Array.isArray(models["availableModels"])) {
|
|
34548
|
-
for (const model of models["availableModels"]) {
|
|
34549
|
-
if (!isRecord6(model)) {
|
|
34550
|
-
continue;
|
|
34551
|
-
}
|
|
34552
|
-
const value = readString2(model["modelId"]).slice(0, 500);
|
|
34553
|
-
if (value.length === 0) {
|
|
34554
|
-
continue;
|
|
34555
|
-
}
|
|
34556
|
-
if (!values.some((existing) => existing.value === value)) {
|
|
34557
|
-
values.push({
|
|
34558
|
-
description: "",
|
|
34559
|
-
groupId: "",
|
|
34560
|
-
groupName: "",
|
|
34561
|
-
name: readString2(model["name"], value).slice(0, 255),
|
|
34562
|
-
value
|
|
34563
|
-
});
|
|
34564
|
-
}
|
|
34565
|
-
}
|
|
34566
|
-
}
|
|
34567
|
-
const selected = options.find((option) => option["category"] === "model" && option["selected"] === true);
|
|
34568
|
-
const currentValue = readString2(
|
|
34569
|
-
models["currentModelId"],
|
|
34570
|
-
selected === void 0 ? "" : readString2(selected["id"])
|
|
34571
|
-
).slice(0, 500);
|
|
34572
|
-
if (values.length === 0 || !values.some((value) => value.value === currentValue)) {
|
|
34573
|
-
return [];
|
|
34574
|
-
}
|
|
34575
|
-
const result = {
|
|
34576
|
-
booleanValue: false,
|
|
34577
|
-
category: "model",
|
|
34578
|
-
currentValue,
|
|
34579
|
-
description: "Model used by Grok Build",
|
|
34580
|
-
id: LEGACY_MODEL_CONFIG_ID,
|
|
34581
|
-
name: "Model",
|
|
34582
|
-
type: "select",
|
|
34583
|
-
values: values.slice(0, 500)
|
|
34584
|
-
};
|
|
34585
|
-
return [result];
|
|
34586
|
-
}
|
|
34587
|
-
function legacyReasoningEffortOptions(response) {
|
|
34588
|
-
const options = legacyOptions(response);
|
|
34589
|
-
const values = [];
|
|
34590
|
-
for (const option of options) {
|
|
34591
|
-
if (option["category"] !== "mode") {
|
|
34592
|
-
continue;
|
|
34593
|
-
}
|
|
34594
|
-
const value = legacyValue(option);
|
|
34595
|
-
if (value.value.length > 0 && !values.some((existing) => existing.value === value.value)) {
|
|
34596
|
-
values.push(value);
|
|
34597
|
-
}
|
|
34598
|
-
}
|
|
34599
|
-
if (values.length === 0) {
|
|
34600
|
-
return [];
|
|
34601
|
-
}
|
|
34602
|
-
const selected = options.find((option) => option["category"] === "mode" && option["selected"] === true);
|
|
34603
|
-
if (selected === void 0) {
|
|
34604
|
-
values.unshift({
|
|
34605
|
-
description: "Use the selected model's default reasoning effort",
|
|
34606
|
-
groupId: "",
|
|
34607
|
-
groupName: "",
|
|
34608
|
-
name: "Agent default",
|
|
34609
|
-
value: AGENT_DEFAULT_REASONING_EFFORT
|
|
34610
|
-
});
|
|
34611
|
-
}
|
|
34612
|
-
const currentValue = selected === void 0 ? AGENT_DEFAULT_REASONING_EFFORT : readString2(selected["id"], AGENT_DEFAULT_REASONING_EFFORT);
|
|
34613
|
-
if (!values.some((value) => value.value === currentValue)) {
|
|
34614
|
-
return [];
|
|
34615
|
-
}
|
|
34616
|
-
const result = {
|
|
34617
|
-
booleanValue: false,
|
|
34618
|
-
category: "thought_level",
|
|
34619
|
-
currentValue,
|
|
34620
|
-
description: "Reasoning effort used by Grok Build",
|
|
34621
|
-
id: LEGACY_REASONING_EFFORT_CONFIG_ID,
|
|
34622
|
-
name: "Reasoning effort",
|
|
34623
|
-
type: "select",
|
|
34624
|
-
values: values.slice(0, 500)
|
|
34625
|
-
};
|
|
34626
|
-
return [result];
|
|
34627
|
-
}
|
|
34628
|
-
function normalizeGrokLifecycle(response) {
|
|
34629
|
-
const lifecycle = isRecord6(response) ? response : {};
|
|
34630
|
-
const standard = normalizeConfigOptions(lifecycle["configOptions"], lifecycle["modes"]);
|
|
34631
|
-
const normalized = [...standard];
|
|
34632
|
-
if (!normalized.some((option) => option.category === "model")) {
|
|
34633
|
-
normalized.push(...legacyModelOptions(response));
|
|
34634
|
-
}
|
|
34635
|
-
if (!normalized.some((option) => option.category === "thought_level")) {
|
|
34636
|
-
const efforts = legacyReasoningEffortOptions(response);
|
|
34637
|
-
if (efforts.length > 0) {
|
|
34638
|
-
const modelIndex = normalized.findIndex((option) => option.category === "model");
|
|
34639
|
-
normalized.splice(modelIndex < 0 ? normalized.length : modelIndex + 1, 0, ...efforts);
|
|
34640
|
-
}
|
|
34641
|
-
}
|
|
34642
|
-
return normalized.slice(0, 100);
|
|
34643
|
-
}
|
|
34644
|
-
function updateCurrentValue2(current, category, value) {
|
|
34645
|
-
return current.map((option) => option.category === category ? { ...option, currentValue: value } : option);
|
|
34646
|
-
}
|
|
34647
|
-
function validateGrokResponse(response, modelId) {
|
|
34648
|
-
if (!isRecord6(response) || !isRecord6(response["_meta"])) {
|
|
34649
|
-
throw new SessionConfigProtocolError("Grok Build returned an invalid session configuration response");
|
|
34650
|
-
}
|
|
34651
|
-
const model = response["_meta"]["model"];
|
|
34652
|
-
const appliedModel = isRecord6(model) ? model["Ok"] : model;
|
|
34653
|
-
if (appliedModel !== modelId) {
|
|
34654
|
-
throw new SessionConfigProtocolError("Grok Build returned an invalid session configuration response");
|
|
34655
|
-
}
|
|
34656
|
-
}
|
|
34657
|
-
var GrokBuildSessionConfigProtocol = class {
|
|
34658
|
-
configure = async (current, change, nativeSessionId, transport) => {
|
|
34659
|
-
const existing = current.find((option) => option.id === change.configId);
|
|
34660
|
-
if (existing === void 0 || existing.id !== LEGACY_MODEL_CONFIG_ID && existing.id !== LEGACY_REASONING_EFFORT_CONFIG_ID) {
|
|
34661
|
-
return await standardSessionConfigProtocol.configure(current, change, nativeSessionId, transport);
|
|
34662
|
-
}
|
|
34663
|
-
const model = current.find((option) => option.category === "model");
|
|
34664
|
-
if (model === void 0) {
|
|
34665
|
-
return current;
|
|
34666
|
-
}
|
|
34667
|
-
if (existing.category === "thought_level" && change.value === AGENT_DEFAULT_REASONING_EFFORT) {
|
|
34668
|
-
return current;
|
|
34669
|
-
}
|
|
34670
|
-
const modelId = existing.category === "model" ? change.value : model.currentValue;
|
|
34671
|
-
const params = {
|
|
34672
|
-
modelId,
|
|
34673
|
-
sessionId: nativeSessionId
|
|
34674
|
-
};
|
|
34675
|
-
if (existing.category === "thought_level") {
|
|
34676
|
-
params["_meta"] = {
|
|
34677
|
-
reasoningEffort: change.value
|
|
34678
|
-
};
|
|
34679
|
-
}
|
|
34680
|
-
const response = await transport.request(
|
|
34681
|
-
"session/set_model",
|
|
34682
|
-
params,
|
|
34683
|
-
existing.category === "model" ? "Grok Build exited while setting the session model" : "Grok Build exited while setting reasoning effort",
|
|
34684
|
-
change.signal
|
|
34685
|
-
);
|
|
34686
|
-
validateGrokResponse(response, modelId);
|
|
34687
|
-
const updated = updateCurrentValue2(current, existing.category, change.value);
|
|
34688
|
-
return existing.category === "thought_level" ? updated.map(
|
|
34689
|
-
(option) => option.category === "thought_level" ? {
|
|
34690
|
-
...option,
|
|
34691
|
-
values: option.values.filter((value) => value.value !== AGENT_DEFAULT_REASONING_EFFORT)
|
|
34692
|
-
} : option
|
|
34693
|
-
) : updated;
|
|
34694
|
-
};
|
|
34695
|
-
normalizeLifecycle = (response) => normalizeGrokLifecycle(response);
|
|
34696
|
-
normalizeUpdate = (current, value) => standardSessionConfigProtocol.normalizeUpdate(current, value);
|
|
34697
|
-
};
|
|
34698
|
-
var grokBuildSessionConfigProtocol = new GrokBuildSessionConfigProtocol();
|
|
34699
|
-
|
|
34700
34586
|
// src/acp/session-config/session-config-registry.ts
|
|
34701
|
-
function sessionConfigProtocolForAgent(
|
|
34702
|
-
return
|
|
34587
|
+
function sessionConfigProtocolForAgent(_agentId) {
|
|
34588
|
+
return standardSessionConfigProtocol;
|
|
34703
34589
|
}
|
|
34704
34590
|
|
|
34705
34591
|
// src/acp/session-history.ts
|
|
@@ -40703,71 +40589,7 @@ var SessionEventOutbox = class {
|
|
|
40703
40589
|
received_at INTEGER NOT NULL
|
|
40704
40590
|
) STRICT;
|
|
40705
40591
|
`);
|
|
40706
|
-
const deadLetterTable = this.#database.prepare(
|
|
40707
|
-
`SELECT sql FROM sqlite_master
|
|
40708
|
-
WHERE type = 'table' AND name = 'relay_session_event_dead_letters'`
|
|
40709
|
-
).get();
|
|
40710
|
-
const deadLetterSql = typeof deadLetterTable === "object" && deadLetterTable !== null ? Reflect.get(deadLetterTable, "sql") : void 0;
|
|
40711
|
-
if (typeof deadLetterSql !== "string" || !deadLetterSql.includes("'session_rejected'")) {
|
|
40712
|
-
this.#database.exec(`
|
|
40713
|
-
BEGIN IMMEDIATE;
|
|
40714
|
-
ALTER TABLE relay_session_event_dead_letters
|
|
40715
|
-
RENAME TO relay_session_event_dead_letters_legacy;
|
|
40716
|
-
CREATE TABLE relay_session_event_dead_letters (
|
|
40717
|
-
ordinal INTEGER PRIMARY KEY,
|
|
40718
|
-
event_id TEXT NOT NULL UNIQUE,
|
|
40719
|
-
session_id TEXT NOT NULL,
|
|
40720
|
-
envelope_json TEXT NOT NULL,
|
|
40721
|
-
rejection_code TEXT NOT NULL CHECK (
|
|
40722
|
-
rejection_code IN ('session_deleted', 'session_not_found', 'session_rejected')
|
|
40723
|
-
)
|
|
40724
|
-
) STRICT;
|
|
40725
|
-
INSERT INTO relay_session_event_dead_letters (
|
|
40726
|
-
ordinal, event_id, session_id, envelope_json, rejection_code
|
|
40727
|
-
)
|
|
40728
|
-
SELECT ordinal, event_id, session_id, envelope_json, rejection_code
|
|
40729
|
-
FROM relay_session_event_dead_letters_legacy;
|
|
40730
|
-
DROP TABLE relay_session_event_dead_letters_legacy;
|
|
40731
|
-
COMMIT;
|
|
40732
|
-
`);
|
|
40733
|
-
}
|
|
40734
|
-
const outboxColumns = this.#database.prepare("PRAGMA table_info(relay_session_event_outbox)").all();
|
|
40735
|
-
const hasSourceKey = outboxColumns.some(
|
|
40736
|
-
(column) => typeof column === "object" && column !== null && Reflect.get(column, "name") === "source_key"
|
|
40737
|
-
);
|
|
40738
|
-
if (!hasSourceKey) {
|
|
40739
|
-
this.#database.exec(`
|
|
40740
|
-
ALTER TABLE relay_session_event_outbox
|
|
40741
|
-
ADD COLUMN source_key TEXT NOT NULL DEFAULT '';
|
|
40742
|
-
`);
|
|
40743
|
-
}
|
|
40744
|
-
const hasByteLength = outboxColumns.some(
|
|
40745
|
-
(column) => typeof column === "object" && column !== null && Reflect.get(column, "name") === "byte_length"
|
|
40746
|
-
);
|
|
40747
|
-
if (!hasByteLength) {
|
|
40748
|
-
this.#database.exec(`
|
|
40749
|
-
ALTER TABLE relay_session_event_outbox
|
|
40750
|
-
ADD COLUMN byte_length INTEGER NOT NULL DEFAULT 0;
|
|
40751
|
-
`);
|
|
40752
|
-
}
|
|
40753
40592
|
this.#database.exec(`
|
|
40754
|
-
UPDATE relay_session_event_outbox
|
|
40755
|
-
SET source_key = CASE json_extract(envelope_json, '$.source.kind')
|
|
40756
|
-
WHEN 'attempt' THEN
|
|
40757
|
-
'attempt:' || session_id || ':' || json_extract(envelope_json, '$.source.attemptId')
|
|
40758
|
-
ELSE 'runtime:' || session_id
|
|
40759
|
-
END
|
|
40760
|
-
WHERE source_key = '';
|
|
40761
|
-
UPDATE relay_session_event_outbox
|
|
40762
|
-
SET byte_length = length(CAST(envelope_json AS BLOB))
|
|
40763
|
-
WHERE byte_length = 0;
|
|
40764
|
-
UPDATE relay_session_event_outbox_state
|
|
40765
|
-
SET event_count = (SELECT COUNT(*) FROM relay_session_event_outbox),
|
|
40766
|
-
total_bytes = (
|
|
40767
|
-
SELECT COALESCE(SUM(byte_length), 0)
|
|
40768
|
-
FROM relay_session_event_outbox
|
|
40769
|
-
)
|
|
40770
|
-
WHERE singleton = 1;
|
|
40771
40593
|
CREATE INDEX IF NOT EXISTS relay_session_event_outbox_source_order
|
|
40772
40594
|
ON relay_session_event_outbox(source_key, ordinal);
|
|
40773
40595
|
`);
|
|
@@ -43979,7 +43801,11 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
43979
43801
|
);
|
|
43980
43802
|
};
|
|
43981
43803
|
const announceReadiness = () => {
|
|
43982
|
-
if (!connectionAnnounced || !catalogPublished
|
|
43804
|
+
if (!connectionAnnounced || !catalogPublished) {
|
|
43805
|
+
return;
|
|
43806
|
+
}
|
|
43807
|
+
options.onConnectionStatus?.("online");
|
|
43808
|
+
if (readinessAnnounced) {
|
|
43983
43809
|
return;
|
|
43984
43810
|
}
|
|
43985
43811
|
readinessAnnounced = true;
|
|
@@ -43990,14 +43816,16 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
43990
43816
|
return;
|
|
43991
43817
|
}
|
|
43992
43818
|
connectionAnnounced = true;
|
|
43993
|
-
const reconnectCommand = `npx --yes @moxt-ai/mobius start ${config2.reconnectTarget.commandArgument}`;
|
|
43994
43819
|
process.stdout.write("Mobius daemon connected to the relay.\n\n");
|
|
43995
|
-
|
|
43996
|
-
|
|
43820
|
+
if (config2.reconnectTarget !== null) {
|
|
43821
|
+
const reconnectCommand = `mobius start ${config2.reconnectTarget.commandArgument}`;
|
|
43822
|
+
process.stdout.write(
|
|
43823
|
+
`${styleText(["bold", "yellow"], `Reconnect this local connection later:
|
|
43997
43824
|
${reconnectCommand}`)}
|
|
43998
43825
|
|
|
43999
43826
|
`
|
|
44000
|
-
|
|
43827
|
+
);
|
|
43828
|
+
}
|
|
44001
43829
|
announceReadiness();
|
|
44002
43830
|
startAutomaticIntegrationProvisioning();
|
|
44003
43831
|
};
|
|
@@ -44028,7 +43856,12 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44028
43856
|
activeAttemptIds,
|
|
44029
43857
|
connectionEpoch,
|
|
44030
43858
|
diagnostics,
|
|
44031
|
-
|
|
43859
|
+
() => {
|
|
43860
|
+
if (catalogPublished) {
|
|
43861
|
+
options.onConnectionStatus?.("online");
|
|
43862
|
+
}
|
|
43863
|
+
announceConnection();
|
|
43864
|
+
},
|
|
44032
43865
|
signal,
|
|
44033
43866
|
timer,
|
|
44034
43867
|
resolveAgentCatalogEnvironment
|
|
@@ -44042,6 +43875,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44042
43875
|
}
|
|
44043
43876
|
diagnostics.connectionFailed(connectionEpoch, error62, "connection");
|
|
44044
43877
|
}
|
|
43878
|
+
options.onConnectionStatus?.("reconnecting");
|
|
44045
43879
|
await waitForRelayRetry(signal, timer);
|
|
44046
43880
|
}
|
|
44047
43881
|
} finally {
|
|
@@ -44086,7 +43920,7 @@ import { fetch as fetch5 } from "undici";
|
|
|
44086
43920
|
|
|
44087
43921
|
// src/storage/runtime-installation-store.ts
|
|
44088
43922
|
import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
|
|
44089
|
-
import { mkdir as mkdir4, open as open5, rename as rename3, unlink, writeFile as writeFile3 } from "node:fs/promises";
|
|
43923
|
+
import { mkdir as mkdir4, open as open5, readdir as readdir3, rename as rename3, unlink, writeFile as writeFile3 } from "node:fs/promises";
|
|
44090
43924
|
import { dirname as dirname7, join as join17, resolve as resolve5 } from "node:path";
|
|
44091
43925
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
44092
43926
|
var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
|
|
@@ -44103,18 +43937,31 @@ var CHANNEL_INDEX_KEYS = [
|
|
|
44103
43937
|
"version"
|
|
44104
43938
|
];
|
|
44105
43939
|
var VERIFIED_CONNECTION_KEYS = [
|
|
43940
|
+
"activation",
|
|
43941
|
+
"appId",
|
|
44106
43942
|
"applicationId",
|
|
44107
43943
|
"channelId",
|
|
44108
43944
|
"connectionId",
|
|
44109
43945
|
"defaultWorkspace",
|
|
44110
43946
|
"installationId",
|
|
44111
43947
|
"kind",
|
|
43948
|
+
"pairingId",
|
|
44112
43949
|
"relayOrigin",
|
|
44113
43950
|
"runtimeCredential",
|
|
44114
43951
|
"runtimeId",
|
|
44115
43952
|
"version"
|
|
44116
43953
|
];
|
|
43954
|
+
var VERSION_THREE_VERIFIED_CONNECTION_KEYS = VERIFIED_CONNECTION_KEYS.filter(
|
|
43955
|
+
(key) => key !== "activation"
|
|
43956
|
+
);
|
|
43957
|
+
var VERSION_TWO_VERIFIED_CONNECTION_KEYS = VERSION_THREE_VERIFIED_CONNECTION_KEYS.filter(
|
|
43958
|
+
(key) => key !== "pairingId"
|
|
43959
|
+
);
|
|
43960
|
+
var LEGACY_VERIFIED_CONNECTION_KEYS = VERSION_TWO_VERIFIED_CONNECTION_KEYS.filter(
|
|
43961
|
+
(key) => key !== "appId"
|
|
43962
|
+
);
|
|
44117
43963
|
var IMPORTED_LEGACY_CONNECTION_KEYS = [
|
|
43964
|
+
"activation",
|
|
44118
43965
|
"applicationId",
|
|
44119
43966
|
"channelId",
|
|
44120
43967
|
"connectionId",
|
|
@@ -44125,13 +43972,9 @@ var IMPORTED_LEGACY_CONNECTION_KEYS = [
|
|
|
44125
43972
|
"runtimeCredential",
|
|
44126
43973
|
"version"
|
|
44127
43974
|
];
|
|
44128
|
-
var
|
|
44129
|
-
"
|
|
44130
|
-
|
|
44131
|
-
"relayOrigin",
|
|
44132
|
-
"runtimeCredential"
|
|
44133
|
-
];
|
|
44134
|
-
var LEGACY_CONNECTION_KEYS = ["defaultWorkspace", "channelId", "daemonToken", "relayOrigin"];
|
|
43975
|
+
var VERSION_ONE_IMPORTED_LEGACY_CONNECTION_KEYS = IMPORTED_LEGACY_CONNECTION_KEYS.filter(
|
|
43976
|
+
(key) => key !== "activation"
|
|
43977
|
+
);
|
|
44135
43978
|
var RuntimeInstallationStoreError = class extends Error {
|
|
44136
43979
|
code;
|
|
44137
43980
|
constructor(code, message, options = {}) {
|
|
@@ -44141,19 +43984,25 @@ var RuntimeInstallationStoreError = class extends Error {
|
|
|
44141
43984
|
}
|
|
44142
43985
|
};
|
|
44143
43986
|
var StoredRuntimeConnection = class {
|
|
43987
|
+
activation;
|
|
43988
|
+
appId;
|
|
44144
43989
|
applicationId;
|
|
44145
43990
|
channelId;
|
|
44146
43991
|
connectionId;
|
|
44147
43992
|
defaultWorkspace;
|
|
44148
43993
|
installationId;
|
|
43994
|
+
pairingId;
|
|
44149
43995
|
relayOrigin;
|
|
44150
43996
|
runtimeCredential;
|
|
44151
|
-
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2) {
|
|
43997
|
+
constructor(activation, applicationId, appId, installationId2, connectionId2, channelId, defaultWorkspace, pairingId, relayOrigin, runtimeCredential2) {
|
|
43998
|
+
this.activation = activation;
|
|
44152
43999
|
this.applicationId = applicationId;
|
|
44000
|
+
this.appId = appId;
|
|
44153
44001
|
this.channelId = channelId;
|
|
44154
44002
|
this.connectionId = connectionId2;
|
|
44155
44003
|
this.defaultWorkspace = defaultWorkspace;
|
|
44156
44004
|
this.installationId = installationId2;
|
|
44005
|
+
this.pairingId = pairingId;
|
|
44157
44006
|
this.relayOrigin = relayOrigin;
|
|
44158
44007
|
this.runtimeCredential = runtimeCredential2;
|
|
44159
44008
|
}
|
|
@@ -44161,15 +44010,37 @@ var StoredRuntimeConnection = class {
|
|
|
44161
44010
|
var VerifiedRuntimeConnection = class extends StoredRuntimeConnection {
|
|
44162
44011
|
kind = "verified";
|
|
44163
44012
|
runtimeId;
|
|
44164
|
-
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2, runtimeId) {
|
|
44165
|
-
super(
|
|
44013
|
+
constructor(activation, applicationId, appId, installationId2, connectionId2, channelId, defaultWorkspace, pairingId, relayOrigin, runtimeCredential2, runtimeId) {
|
|
44014
|
+
super(
|
|
44015
|
+
activation,
|
|
44016
|
+
applicationId,
|
|
44017
|
+
appId,
|
|
44018
|
+
installationId2,
|
|
44019
|
+
connectionId2,
|
|
44020
|
+
channelId,
|
|
44021
|
+
defaultWorkspace,
|
|
44022
|
+
pairingId,
|
|
44023
|
+
relayOrigin,
|
|
44024
|
+
runtimeCredential2
|
|
44025
|
+
);
|
|
44166
44026
|
this.runtimeId = runtimeId;
|
|
44167
44027
|
}
|
|
44168
44028
|
};
|
|
44169
44029
|
var ImportedLegacyRuntimeConnection = class extends StoredRuntimeConnection {
|
|
44170
44030
|
kind = "legacy_imported";
|
|
44171
|
-
constructor(applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2) {
|
|
44172
|
-
super(
|
|
44031
|
+
constructor(activation, applicationId, installationId2, connectionId2, channelId, defaultWorkspace, relayOrigin, runtimeCredential2) {
|
|
44032
|
+
super(
|
|
44033
|
+
activation,
|
|
44034
|
+
applicationId,
|
|
44035
|
+
"unknown",
|
|
44036
|
+
installationId2,
|
|
44037
|
+
connectionId2,
|
|
44038
|
+
channelId,
|
|
44039
|
+
defaultWorkspace,
|
|
44040
|
+
"",
|
|
44041
|
+
relayOrigin,
|
|
44042
|
+
runtimeCredential2
|
|
44043
|
+
);
|
|
44173
44044
|
}
|
|
44174
44045
|
};
|
|
44175
44046
|
function isRecord9(value) {
|
|
@@ -44188,6 +44059,12 @@ function validateApplicationId(value) {
|
|
|
44188
44059
|
}
|
|
44189
44060
|
return value;
|
|
44190
44061
|
}
|
|
44062
|
+
function validateRemoteAppId(value) {
|
|
44063
|
+
if (!IDENTIFIER_PATTERN5.test(value)) {
|
|
44064
|
+
throw new RuntimeInstallationStoreError("invalid_app_id", "The remote App ID is invalid");
|
|
44065
|
+
}
|
|
44066
|
+
return value;
|
|
44067
|
+
}
|
|
44191
44068
|
function validateConnectionId(value) {
|
|
44192
44069
|
if (!CONNECTION_ID_PATTERN.test(value)) {
|
|
44193
44070
|
throw new RuntimeInstallationStoreError("invalid_connection_id", "The local connection ID is invalid");
|
|
@@ -44267,46 +44144,61 @@ function decodeChannelIndex(value) {
|
|
|
44267
44144
|
};
|
|
44268
44145
|
}
|
|
44269
44146
|
function decodeVerifiedConnection(value) {
|
|
44270
|
-
|
|
44147
|
+
const current = hasExactKeys(value, VERIFIED_CONNECTION_KEYS) && value["version"] === 4;
|
|
44148
|
+
const versionThree = hasExactKeys(value, VERSION_THREE_VERIFIED_CONNECTION_KEYS) && value["version"] === 3;
|
|
44149
|
+
const versionTwo = hasExactKeys(value, VERSION_TWO_VERIFIED_CONNECTION_KEYS) && value["version"] === 2;
|
|
44150
|
+
const legacy = hasExactKeys(value, LEGACY_VERIFIED_CONNECTION_KEYS) && value["version"] === 1;
|
|
44151
|
+
if (!current && !versionThree && !versionTwo && !legacy || value["kind"] !== "verified") {
|
|
44271
44152
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
44272
44153
|
}
|
|
44273
44154
|
const applicationId = value["applicationId"];
|
|
44155
|
+
const activation = current ? value["activation"] : "active";
|
|
44156
|
+
const appId = typeof value["appId"] === "string" ? value["appId"] : "unknown";
|
|
44274
44157
|
const channelId = value["channelId"];
|
|
44275
44158
|
const connectionId2 = value["connectionId"];
|
|
44276
44159
|
const defaultWorkspace = value["defaultWorkspace"];
|
|
44277
44160
|
const storedInstallationId = value["installationId"];
|
|
44161
|
+
const pairingId = value["pairingId"];
|
|
44162
|
+
const savedPairingId = typeof pairingId === "string" ? pairingId : "";
|
|
44278
44163
|
const relayOrigin = value["relayOrigin"];
|
|
44279
44164
|
const runtimeCredential2 = value["runtimeCredential"];
|
|
44280
44165
|
const runtimeId = value["runtimeId"];
|
|
44281
|
-
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") {
|
|
44166
|
+
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") {
|
|
44282
44167
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
44283
44168
|
}
|
|
44284
44169
|
return new VerifiedRuntimeConnection(
|
|
44170
|
+
activation,
|
|
44285
44171
|
validateApplicationId(applicationId),
|
|
44172
|
+
validateRemoteAppId(appId),
|
|
44286
44173
|
validateInstallationId(storedInstallationId),
|
|
44287
44174
|
validateConnectionId(connectionId2),
|
|
44288
44175
|
validateIdentifier(channelId, "invalid_connection"),
|
|
44289
44176
|
defaultWorkspace,
|
|
44177
|
+
current || versionThree ? validateIdentifier(savedPairingId, "invalid_connection") : "",
|
|
44290
44178
|
parseRelayOrigin(relayOrigin),
|
|
44291
44179
|
validateRuntimeCredential(runtimeCredential2),
|
|
44292
44180
|
validateIdentifier(runtimeId, "invalid_connection")
|
|
44293
44181
|
);
|
|
44294
44182
|
}
|
|
44295
44183
|
function decodeImportedLegacyConnection(value) {
|
|
44296
|
-
|
|
44184
|
+
const current = hasExactKeys(value, IMPORTED_LEGACY_CONNECTION_KEYS) && value["version"] === 2;
|
|
44185
|
+
const legacy = hasExactKeys(value, VERSION_ONE_IMPORTED_LEGACY_CONNECTION_KEYS) && value["version"] === 1;
|
|
44186
|
+
if (!current && !legacy || value["kind"] !== "legacy_imported" || value["version"] !== 1 && value["version"] !== 2) {
|
|
44297
44187
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
44298
44188
|
}
|
|
44299
44189
|
const applicationId = value["applicationId"];
|
|
44190
|
+
const activation = current ? value["activation"] : "active";
|
|
44300
44191
|
const channelId = value["channelId"];
|
|
44301
44192
|
const connectionId2 = value["connectionId"];
|
|
44302
44193
|
const defaultWorkspace = value["defaultWorkspace"];
|
|
44303
44194
|
const storedInstallationId = value["installationId"];
|
|
44304
44195
|
const relayOrigin = value["relayOrigin"];
|
|
44305
44196
|
const runtimeCredential2 = value["runtimeCredential"];
|
|
44306
|
-
if (typeof applicationId !== "string" || typeof channelId !== "string" || typeof connectionId2 !== "string" || typeof defaultWorkspace !== "string" || typeof storedInstallationId !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string") {
|
|
44197
|
+
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") {
|
|
44307
44198
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
44308
44199
|
}
|
|
44309
44200
|
return new ImportedLegacyRuntimeConnection(
|
|
44201
|
+
activation,
|
|
44310
44202
|
validateApplicationId(applicationId),
|
|
44311
44203
|
validateInstallationId(storedInstallationId),
|
|
44312
44204
|
validateConnectionId(connectionId2),
|
|
@@ -44328,24 +44220,6 @@ function decodeConnection(value) {
|
|
|
44328
44220
|
}
|
|
44329
44221
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
44330
44222
|
}
|
|
44331
|
-
function decodeLegacyConnection(value, expectedChannelId) {
|
|
44332
|
-
if (!isRecord9(value) || !hasExactKeys(value, CURRENT_CONNECTION_KEYS) && !hasExactKeys(value, LEGACY_CONNECTION_KEYS)) {
|
|
44333
|
-
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
44334
|
-
}
|
|
44335
|
-
const channelId = value["channelId"];
|
|
44336
|
-
const defaultWorkspace = value["defaultWorkspace"];
|
|
44337
|
-
const relayOrigin = value["relayOrigin"];
|
|
44338
|
-
const runtimeCredential2 = value["runtimeCredential"] ?? value["daemonToken"];
|
|
44339
|
-
if (typeof channelId !== "string" || channelId !== expectedChannelId || typeof defaultWorkspace !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string") {
|
|
44340
|
-
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
44341
|
-
}
|
|
44342
|
-
return {
|
|
44343
|
-
channelId: validateIdentifier(channelId, "invalid_connection"),
|
|
44344
|
-
defaultWorkspace,
|
|
44345
|
-
relayOrigin: parseRelayOrigin(relayOrigin),
|
|
44346
|
-
runtimeCredential: validateRuntimeCredential(runtimeCredential2)
|
|
44347
|
-
};
|
|
44348
|
-
}
|
|
44349
44223
|
async function readJsonFile(path2, signal, missingCode) {
|
|
44350
44224
|
signal.throwIfAborted();
|
|
44351
44225
|
let handle;
|
|
@@ -44476,23 +44350,16 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
44476
44350
|
}
|
|
44477
44351
|
return await this.readConnection(index2.connectionId, signal);
|
|
44478
44352
|
};
|
|
44479
|
-
migrateLegacyConnection = async (legacyStateDirectory, channelId, signal) => {
|
|
44480
|
-
try {
|
|
44481
|
-
return await this.#readConnectionForChannel(channelId, signal);
|
|
44482
|
-
} catch (cause) {
|
|
44483
|
-
if (!(cause instanceof RuntimeInstallationStoreError) || cause.code !== "connection_not_found") {
|
|
44484
|
-
throw cause;
|
|
44485
|
-
}
|
|
44486
|
-
}
|
|
44487
|
-
return await this.importLegacyConnection(legacyStateDirectory, channelId, signal);
|
|
44488
|
-
};
|
|
44489
44353
|
saveConnection = async (input2, signal) => {
|
|
44490
44354
|
const stored = new VerifiedRuntimeConnection(
|
|
44355
|
+
"active",
|
|
44491
44356
|
this.applicationId,
|
|
44357
|
+
validateRemoteAppId(input2.appId),
|
|
44492
44358
|
this.installationId,
|
|
44493
44359
|
connectionId(),
|
|
44494
44360
|
validateIdentifier(input2.channelId, "invalid_connection"),
|
|
44495
44361
|
input2.defaultWorkspace,
|
|
44362
|
+
input2.pairingId.length === 0 ? "" : validateIdentifier(input2.pairingId, "invalid_pairing_id"),
|
|
44496
44363
|
parseRelayOrigin(input2.relayOrigin.toString()),
|
|
44497
44364
|
validateRuntimeCredential(input2.runtimeCredential),
|
|
44498
44365
|
validateIdentifier(input2.runtimeId, "invalid_connection")
|
|
@@ -44500,25 +44367,6 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
44500
44367
|
await this.writeConnection(stored, signal);
|
|
44501
44368
|
return stored;
|
|
44502
44369
|
};
|
|
44503
|
-
importLegacyConnection = async (legacyStateDirectory, channelId, signal) => {
|
|
44504
|
-
const normalizedChannelId = validateIdentifier(channelId, "invalid_channel_id");
|
|
44505
|
-
const legacyPath = join17(resolve5(legacyStateDirectory), "connections", `${normalizedChannelId}.json`);
|
|
44506
|
-
const legacy = decodeLegacyConnection(
|
|
44507
|
-
await readJsonFile(legacyPath, signal, "connection_not_found"),
|
|
44508
|
-
normalizedChannelId
|
|
44509
|
-
);
|
|
44510
|
-
const stored = new ImportedLegacyRuntimeConnection(
|
|
44511
|
-
this.applicationId,
|
|
44512
|
-
this.installationId,
|
|
44513
|
-
connectionId(),
|
|
44514
|
-
legacy.channelId,
|
|
44515
|
-
legacy.defaultWorkspace,
|
|
44516
|
-
legacy.relayOrigin,
|
|
44517
|
-
legacy.runtimeCredential
|
|
44518
|
-
);
|
|
44519
|
-
await this.writeConnection(stored, signal);
|
|
44520
|
-
return stored;
|
|
44521
|
-
};
|
|
44522
44370
|
writeConnection = async (stored, signal) => {
|
|
44523
44371
|
signal.throwIfAborted();
|
|
44524
44372
|
try {
|
|
@@ -44532,49 +44380,134 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
44532
44380
|
throw cause;
|
|
44533
44381
|
}
|
|
44534
44382
|
}
|
|
44535
|
-
|
|
44536
|
-
|
|
44537
|
-
|
|
44538
|
-
|
|
44383
|
+
await this.overwriteConnection(stored, signal);
|
|
44384
|
+
await writeJsonAtomically(
|
|
44385
|
+
this.channelIndexPath(stored.channelId),
|
|
44386
|
+
{
|
|
44387
|
+
applicationId: this.applicationId,
|
|
44388
|
+
channelId: stored.channelId,
|
|
44389
|
+
connectionId: stored.connectionId,
|
|
44390
|
+
installationId: this.installationId,
|
|
44391
|
+
version: 1
|
|
44392
|
+
},
|
|
44393
|
+
signal
|
|
44394
|
+
);
|
|
44395
|
+
};
|
|
44396
|
+
listConnections = async (signal) => {
|
|
44397
|
+
signal.throwIfAborted();
|
|
44398
|
+
let entries;
|
|
44399
|
+
try {
|
|
44400
|
+
entries = await readdir3(this.#connectionDirectory);
|
|
44401
|
+
} catch (cause) {
|
|
44402
|
+
if (isNodeError(cause, "ENOENT")) {
|
|
44403
|
+
return [];
|
|
44404
|
+
}
|
|
44405
|
+
throw new RuntimeInstallationStoreError(
|
|
44406
|
+
"connection_unavailable",
|
|
44407
|
+
"Saved Runtime connections cannot be listed",
|
|
44539
44408
|
{
|
|
44540
|
-
|
|
44541
|
-
|
|
44542
|
-
connectionId: stored.connectionId,
|
|
44543
|
-
defaultWorkspace: stored.defaultWorkspace,
|
|
44544
|
-
installationId: stored.installationId,
|
|
44545
|
-
kind: stored.kind,
|
|
44546
|
-
relayOrigin: stored.relayOrigin.toString(),
|
|
44547
|
-
runtimeCredential: stored.runtimeCredential,
|
|
44548
|
-
runtimeId: stored.runtimeId,
|
|
44549
|
-
version: 1
|
|
44550
|
-
},
|
|
44551
|
-
signal
|
|
44409
|
+
cause
|
|
44410
|
+
}
|
|
44552
44411
|
);
|
|
44553
|
-
}
|
|
44412
|
+
}
|
|
44413
|
+
const connections = [];
|
|
44414
|
+
for (const entry of [...entries].sort()) {
|
|
44415
|
+
signal.throwIfAborted();
|
|
44416
|
+
const match = /^(mcn_[a-f0-9]{32})\.json$/.exec(entry);
|
|
44417
|
+
if (match?.[1] !== void 0) {
|
|
44418
|
+
connections.push(await this.readConnection(match[1], signal));
|
|
44419
|
+
}
|
|
44420
|
+
}
|
|
44421
|
+
return connections;
|
|
44422
|
+
};
|
|
44423
|
+
readConnectionForPairing = async (pairingId, signal) => {
|
|
44424
|
+
const normalizedPairingId = validateIdentifier(pairingId, "invalid_pairing_id");
|
|
44425
|
+
const connections = await this.listConnections(signal);
|
|
44426
|
+
return connections.find((connection) => connection.pairingId === normalizedPairingId) ?? null;
|
|
44427
|
+
};
|
|
44428
|
+
setConnectionActivation = async (connectionId2, activation, signal) => {
|
|
44429
|
+
const connection = await this.readConnection(connectionId2, signal);
|
|
44430
|
+
const updated = connection instanceof VerifiedRuntimeConnection ? new VerifiedRuntimeConnection(
|
|
44431
|
+
activation,
|
|
44432
|
+
connection.applicationId,
|
|
44433
|
+
connection.appId,
|
|
44434
|
+
connection.installationId,
|
|
44435
|
+
connection.connectionId,
|
|
44436
|
+
connection.channelId,
|
|
44437
|
+
connection.defaultWorkspace,
|
|
44438
|
+
connection.pairingId,
|
|
44439
|
+
connection.relayOrigin,
|
|
44440
|
+
connection.runtimeCredential,
|
|
44441
|
+
connection.runtimeId
|
|
44442
|
+
) : new ImportedLegacyRuntimeConnection(
|
|
44443
|
+
activation,
|
|
44444
|
+
connection.applicationId,
|
|
44445
|
+
connection.installationId,
|
|
44446
|
+
connection.connectionId,
|
|
44447
|
+
connection.channelId,
|
|
44448
|
+
connection.defaultWorkspace,
|
|
44449
|
+
connection.relayOrigin,
|
|
44450
|
+
connection.runtimeCredential
|
|
44451
|
+
);
|
|
44452
|
+
await this.overwriteConnection(updated, signal);
|
|
44453
|
+
return updated;
|
|
44454
|
+
};
|
|
44455
|
+
removeConnection = async (connectionId2, signal) => {
|
|
44456
|
+
const connection = await this.readConnection(connectionId2, signal);
|
|
44457
|
+
signal.throwIfAborted();
|
|
44458
|
+
try {
|
|
44459
|
+
await unlink(this.connectionPath(connection.connectionId));
|
|
44460
|
+
signal.throwIfAborted();
|
|
44461
|
+
await unlink(this.channelIndexPath(connection.channelId));
|
|
44462
|
+
} catch (cause) {
|
|
44463
|
+
signal.throwIfAborted();
|
|
44464
|
+
if (isNodeError(cause, "ENOENT")) {
|
|
44465
|
+
return;
|
|
44466
|
+
}
|
|
44467
|
+
throw new RuntimeInstallationStoreError(
|
|
44468
|
+
"connection_unavailable",
|
|
44469
|
+
"The saved Runtime connection cannot be removed",
|
|
44470
|
+
{ cause }
|
|
44471
|
+
);
|
|
44472
|
+
}
|
|
44473
|
+
};
|
|
44474
|
+
overwriteConnection = async (connection, signal) => {
|
|
44475
|
+
const connectionPath = this.connectionPath(connection.connectionId);
|
|
44476
|
+
if (connection instanceof VerifiedRuntimeConnection) {
|
|
44554
44477
|
await writeJsonAtomically(
|
|
44555
44478
|
connectionPath,
|
|
44556
44479
|
{
|
|
44557
|
-
|
|
44558
|
-
|
|
44559
|
-
|
|
44560
|
-
|
|
44561
|
-
|
|
44562
|
-
|
|
44563
|
-
|
|
44564
|
-
|
|
44565
|
-
|
|
44480
|
+
activation: connection.activation,
|
|
44481
|
+
applicationId: connection.applicationId,
|
|
44482
|
+
appId: connection.appId,
|
|
44483
|
+
channelId: connection.channelId,
|
|
44484
|
+
connectionId: connection.connectionId,
|
|
44485
|
+
defaultWorkspace: connection.defaultWorkspace,
|
|
44486
|
+
installationId: connection.installationId,
|
|
44487
|
+
kind: connection.kind,
|
|
44488
|
+
pairingId: connection.pairingId,
|
|
44489
|
+
relayOrigin: connection.relayOrigin.toString(),
|
|
44490
|
+
runtimeCredential: connection.runtimeCredential,
|
|
44491
|
+
runtimeId: connection.runtimeId,
|
|
44492
|
+
version: 4
|
|
44566
44493
|
},
|
|
44567
44494
|
signal
|
|
44568
44495
|
);
|
|
44496
|
+
return;
|
|
44569
44497
|
}
|
|
44570
44498
|
await writeJsonAtomically(
|
|
44571
|
-
|
|
44499
|
+
connectionPath,
|
|
44572
44500
|
{
|
|
44573
|
-
|
|
44574
|
-
|
|
44575
|
-
|
|
44576
|
-
|
|
44577
|
-
|
|
44501
|
+
activation: connection.activation,
|
|
44502
|
+
applicationId: connection.applicationId,
|
|
44503
|
+
channelId: connection.channelId,
|
|
44504
|
+
connectionId: connection.connectionId,
|
|
44505
|
+
defaultWorkspace: connection.defaultWorkspace,
|
|
44506
|
+
installationId: connection.installationId,
|
|
44507
|
+
kind: connection.kind,
|
|
44508
|
+
relayOrigin: connection.relayOrigin.toString(),
|
|
44509
|
+
runtimeCredential: connection.runtimeCredential,
|
|
44510
|
+
version: 2
|
|
44578
44511
|
},
|
|
44579
44512
|
signal
|
|
44580
44513
|
);
|
|
@@ -44807,8 +44740,10 @@ async function pairRuntime(installation, options, signal, environment) {
|
|
|
44807
44740
|
const claim2 = await claimPairing(options, defaultWorkspace, agents, inventory.installable, signal);
|
|
44808
44741
|
const connection = await installation.saveConnection(
|
|
44809
44742
|
{
|
|
44743
|
+
appId: options.appId,
|
|
44810
44744
|
channelId: claim2.channelId,
|
|
44811
44745
|
defaultWorkspace,
|
|
44746
|
+
pairingId: options.pairingId,
|
|
44812
44747
|
relayOrigin: options.relayOrigin,
|
|
44813
44748
|
runtimeCredential: claim2.runtimeCredential,
|
|
44814
44749
|
runtimeId: claim2.runtimeId
|
|
@@ -44821,6 +44756,7 @@ async function pairMobiusRuntime(installation, options, signal, environment = pr
|
|
|
44821
44756
|
return await pairRuntime(
|
|
44822
44757
|
installation,
|
|
44823
44758
|
{
|
|
44759
|
+
appId: "embedded",
|
|
44824
44760
|
code: parsePairingCode(options.pairingCode),
|
|
44825
44761
|
pairingId: validatePairingId(options.pairingId),
|
|
44826
44762
|
relayOrigin: parseRelayOrigin2(options.relayOrigin),
|
|
@@ -44973,6 +44909,7 @@ var MobiusRuntimeEngine = class {
|
|
|
44973
44909
|
const audit = new AuditStore(this.#config.auditDatabasePath);
|
|
44974
44910
|
try {
|
|
44975
44911
|
await runDaemon(this.#config, audit, signal, void 0, {
|
|
44912
|
+
...this.#options.onConnectionStatus === void 0 ? {} : { onConnectionStatus: this.#options.onConnectionStatus },
|
|
44976
44913
|
...this.#options.resolveAgentCatalogEnvironment === void 0 ? {} : { resolveAgentCatalogEnvironment: this.#options.resolveAgentCatalogEnvironment }
|
|
44977
44914
|
});
|
|
44978
44915
|
} finally {
|
|
@@ -44982,10 +44919,8 @@ var MobiusRuntimeEngine = class {
|
|
|
44982
44919
|
};
|
|
44983
44920
|
};
|
|
44984
44921
|
export {
|
|
44985
|
-
ChannelDaemonReconnectTarget,
|
|
44986
44922
|
DaemonLocalContext,
|
|
44987
44923
|
DaemonReconnectTarget,
|
|
44988
|
-
ImportedLegacyRuntimeConnection,
|
|
44989
44924
|
MobiusRuntimeConfigurationError,
|
|
44990
44925
|
MobiusRuntimeEngine,
|
|
44991
44926
|
OpaqueDaemonReconnectTarget,
|