@moxt-ai/mobius 0.0.90 → 0.0.91

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/index.js CHANGED
@@ -37965,6 +37965,7 @@ var VERIFIED_CONNECTION_KEYS = [
37965
37965
  var VERSION_THREE_VERIFIED_CONNECTION_KEYS = VERIFIED_CONNECTION_KEYS.filter(
37966
37966
  (key) => key !== "activation"
37967
37967
  );
37968
+ var VERSION_FOUR_VERIFIED_CONNECTION_KEYS = VERIFIED_CONNECTION_KEYS;
37968
37969
  var VERSION_TWO_VERIFIED_CONNECTION_KEYS = VERSION_THREE_VERIFIED_CONNECTION_KEYS.filter(
37969
37970
  (key) => key !== "pairingId"
37970
37971
  );
@@ -38155,16 +38156,17 @@ function decodeChannelIndex(value) {
38155
38156
  };
38156
38157
  }
38157
38158
  function decodeVerifiedConnection(value) {
38158
- const current = hasExactKeys(value, VERIFIED_CONNECTION_KEYS) && value["version"] === 4;
38159
+ const current = hasExactKeys(value, VERIFIED_CONNECTION_KEYS) && value["version"] === 5;
38160
+ const versionFour = hasExactKeys(value, VERSION_FOUR_VERIFIED_CONNECTION_KEYS) && value["version"] === 4;
38159
38161
  const versionThree = hasExactKeys(value, VERSION_THREE_VERIFIED_CONNECTION_KEYS) && value["version"] === 3;
38160
38162
  const versionTwo = hasExactKeys(value, VERSION_TWO_VERIFIED_CONNECTION_KEYS) && value["version"] === 2;
38161
38163
  const legacy = hasExactKeys(value, LEGACY_VERIFIED_CONNECTION_KEYS) && value["version"] === 1;
38162
- if (!current && !versionThree && !versionTwo && !legacy || value["kind"] !== "verified") {
38164
+ if (!current && !versionFour && !versionThree && !versionTwo && !legacy || value["kind"] !== "verified") {
38163
38165
  throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
38164
38166
  }
38165
38167
  const applicationId = value["applicationId"];
38166
- const activation = current ? value["activation"] : "active";
38167
- const appId = typeof value["appId"] === "string" ? value["appId"] : "unknown";
38168
+ const activation = current || versionFour ? value["activation"] : "active";
38169
+ const appId = current && typeof value["appId"] === "string" ? value["appId"] : "unknown";
38168
38170
  const channelId = value["channelId"];
38169
38171
  const connectionId2 = value["connectionId"];
38170
38172
  const defaultWorkspace = value["defaultWorkspace"];
@@ -38174,7 +38176,7 @@ function decodeVerifiedConnection(value) {
38174
38176
  const relayOrigin = value["relayOrigin"];
38175
38177
  const runtimeCredential2 = value["runtimeCredential"];
38176
38178
  const runtimeId = value["runtimeId"];
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") {
38179
+ if (typeof applicationId !== "string" || activation !== "active" && activation !== "stopped" || (current || versionFour || versionThree || versionTwo) && typeof value["appId"] !== "string" || typeof channelId !== "string" || typeof connectionId2 !== "string" || typeof defaultWorkspace !== "string" || typeof storedInstallationId !== "string" || (current || versionFour || versionThree) && typeof pairingId !== "string" || typeof relayOrigin !== "string" || typeof runtimeCredential2 !== "string" || typeof runtimeId !== "string") {
38178
38180
  throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
38179
38181
  }
38180
38182
  return new VerifiedRuntimeConnection(
@@ -38185,7 +38187,7 @@ function decodeVerifiedConnection(value) {
38185
38187
  validateConnectionId(connectionId2),
38186
38188
  validateIdentifier(channelId, "invalid_connection"),
38187
38189
  defaultWorkspace,
38188
- (current || versionThree) && savedPairingId.length > 0 ? validateIdentifier(savedPairingId, "invalid_connection") : "",
38190
+ (current || versionFour || versionThree) && savedPairingId.length > 0 ? validateIdentifier(savedPairingId, "invalid_connection") : "",
38189
38191
  parseRelayOrigin(relayOrigin),
38190
38192
  validateRuntimeCredential(runtimeCredential2),
38191
38193
  validateIdentifier(runtimeId, "invalid_connection")
@@ -38500,7 +38502,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
38500
38502
  relayOrigin: connection.relayOrigin.toString(),
38501
38503
  runtimeCredential: connection.runtimeCredential,
38502
38504
  runtimeId: connection.runtimeId,
38503
- version: 4
38505
+ version: 5
38504
38506
  },
38505
38507
  signal
38506
38508
  );
@@ -38563,8 +38565,8 @@ var PAIRING_TIMEOUT_MILLISECONDS = 2e4;
38563
38565
  var PAIRING_CODE_PATTERN = /^[A-HJ-NP-Z2-9]{4}(?:-[A-HJ-NP-Z2-9]{4}){4}$/;
38564
38566
  var IDENTIFIER_PATTERN5 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
38565
38567
  var TOKEN_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
38566
- var CLAIM_RESPONSE_KEYS = ["channelId", "daemonToken", "runtimeId"];
38567
- var REDEEM_RESPONSE_KEYS = ["channelId", "runtimeCredential", "runtimeId"];
38568
+ var CLAIM_RESPONSE_KEYS = ["appId", "channelId", "daemonToken", "runtimeId"];
38569
+ var REDEEM_RESPONSE_KEYS = ["appId", "channelId", "runtimeCredential", "runtimeId"];
38568
38570
  var MOBIUS_CLI_APPLICATION_ID = "dev.mobius.cli";
38569
38571
  var PairingClientError = class extends Error {
38570
38572
  code;
@@ -38602,7 +38604,7 @@ function readSingleOption(arguments_, option) {
38602
38604
  function assertKnownArguments(arguments_) {
38603
38605
  for (let index2 = 0; index2 < arguments_.length; index2 += 2) {
38604
38606
  const option = arguments_[index2];
38605
- if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace" && option !== "--app-id") {
38607
+ if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace") {
38606
38608
  throw new PairingClientError("invalid_arguments", `Unknown pairing option: ${option ?? "missing option"}`);
38607
38609
  }
38608
38610
  }
@@ -38641,7 +38643,6 @@ function parsePairingCode(value) {
38641
38643
  function parsePairCommand(arguments_, defaultWorkspace) {
38642
38644
  assertKnownArguments(arguments_);
38643
38645
  return {
38644
- appId: arguments_.includes("--app-id") ? validatePairingId(readSingleOption(arguments_, "--app-id")) : "standalone",
38645
38646
  code: parsePairingCode(readSingleOption(arguments_, "--code")),
38646
38647
  pairingId: arguments_.includes("--pairing") ? validatePairingId(readSingleOption(arguments_, "--pairing")) : "",
38647
38648
  relayOrigin: parseRelayOrigin2(readSingleOption(arguments_, "--url")),
@@ -38714,13 +38715,14 @@ function decodePairingResponse(value, credentialField, expectedKeys) {
38714
38715
  if (!isRecord9(value) || !hasExactKeys2(value, expectedKeys)) {
38715
38716
  throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
38716
38717
  }
38718
+ const appId = value["appId"];
38717
38719
  const channelId = value["channelId"];
38718
38720
  const runtimeCredential2 = value[credentialField];
38719
38721
  const runtimeId = value["runtimeId"];
38720
- if (typeof channelId !== "string" || !IDENTIFIER_PATTERN5.test(channelId) || typeof runtimeCredential2 !== "string" || !TOKEN_PATTERN.test(runtimeCredential2) || typeof runtimeId !== "string" || !IDENTIFIER_PATTERN5.test(runtimeId)) {
38722
+ if (typeof appId !== "string" || !IDENTIFIER_PATTERN5.test(appId) || typeof channelId !== "string" || !IDENTIFIER_PATTERN5.test(channelId) || typeof runtimeCredential2 !== "string" || !TOKEN_PATTERN.test(runtimeCredential2) || typeof runtimeId !== "string" || !IDENTIFIER_PATTERN5.test(runtimeId)) {
38721
38723
  throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
38722
38724
  }
38723
- return { channelId, runtimeCredential: runtimeCredential2, runtimeId };
38725
+ return { appId, channelId, runtimeCredential: runtimeCredential2, runtimeId };
38724
38726
  }
38725
38727
  async function claimPairing(options, defaultWorkspace, localAgents, installableAgents, signal) {
38726
38728
  const agents = localAgents.map((agent) => ({
@@ -38798,7 +38800,7 @@ async function pairRuntime(installation, options, signal, environment) {
38798
38800
  const claim2 = await claimPairing(options, defaultWorkspace, agents, inventory.installable, signal);
38799
38801
  const connection = await installation.saveConnection(
38800
38802
  {
38801
- appId: options.appId,
38803
+ appId: claim2.appId,
38802
38804
  channelId: claim2.channelId,
38803
38805
  defaultWorkspace,
38804
38806
  pairingId: options.pairingId,
@@ -38814,7 +38816,6 @@ async function pairMobiusRuntime(installation, options, signal, environment = pr
38814
38816
  return await pairRuntime(
38815
38817
  installation,
38816
38818
  {
38817
- appId: "embedded",
38818
38819
  code: parsePairingCode(options.pairingCode),
38819
38820
  pairingId: validatePairingId(options.pairingId),
38820
38821
  relayOrigin: parseRelayOrigin2(options.relayOrigin),
@@ -38860,7 +38861,6 @@ async function pairLocalMachine(arguments_, signal = new AbortController().signa
38860
38861
  return await pairRuntime(
38861
38862
  installation,
38862
38863
  {
38863
- appId: requested.appId,
38864
38864
  code: requested.code,
38865
38865
  pairingId: requested.pairingId,
38866
38866
  relayOrigin: requested.relayOrigin,