@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/cli.js CHANGED
@@ -3381,7 +3381,7 @@ var program = new Command();
3381
3381
  // package.json
3382
3382
  var package_default = {
3383
3383
  name: "@moxt-ai/mobius",
3384
- version: "0.0.90",
3384
+ version: "0.0.91",
3385
3385
  description: "Mobius CLI for pairing and running local AI agent services.",
3386
3386
  type: "module",
3387
3387
  bin: {
@@ -29786,6 +29786,7 @@ var VERIFIED_CONNECTION_KEYS = [
29786
29786
  var VERSION_THREE_VERIFIED_CONNECTION_KEYS = VERIFIED_CONNECTION_KEYS.filter(
29787
29787
  (key) => key !== "activation"
29788
29788
  );
29789
+ var VERSION_FOUR_VERIFIED_CONNECTION_KEYS = VERIFIED_CONNECTION_KEYS;
29789
29790
  var VERSION_TWO_VERIFIED_CONNECTION_KEYS = VERSION_THREE_VERIFIED_CONNECTION_KEYS.filter(
29790
29791
  (key) => key !== "pairingId"
29791
29792
  );
@@ -29976,16 +29977,17 @@ function decodeChannelIndex(value) {
29976
29977
  };
29977
29978
  }
29978
29979
  function decodeVerifiedConnection(value) {
29979
- const current = hasExactKeys(value, VERIFIED_CONNECTION_KEYS) && value["version"] === 4;
29980
+ const current = hasExactKeys(value, VERIFIED_CONNECTION_KEYS) && value["version"] === 5;
29981
+ const versionFour = hasExactKeys(value, VERSION_FOUR_VERIFIED_CONNECTION_KEYS) && value["version"] === 4;
29980
29982
  const versionThree = hasExactKeys(value, VERSION_THREE_VERIFIED_CONNECTION_KEYS) && value["version"] === 3;
29981
29983
  const versionTwo = hasExactKeys(value, VERSION_TWO_VERIFIED_CONNECTION_KEYS) && value["version"] === 2;
29982
29984
  const legacy = hasExactKeys(value, LEGACY_VERIFIED_CONNECTION_KEYS) && value["version"] === 1;
29983
- if (!current && !versionThree && !versionTwo && !legacy || value["kind"] !== "verified") {
29985
+ if (!current && !versionFour && !versionThree && !versionTwo && !legacy || value["kind"] !== "verified") {
29984
29986
  throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
29985
29987
  }
29986
29988
  const applicationId = value["applicationId"];
29987
- const activation = current ? value["activation"] : "active";
29988
- const appId = typeof value["appId"] === "string" ? value["appId"] : "unknown";
29989
+ const activation = current || versionFour ? value["activation"] : "active";
29990
+ const appId = current && typeof value["appId"] === "string" ? value["appId"] : "unknown";
29989
29991
  const channelId = value["channelId"];
29990
29992
  const connectionId2 = value["connectionId"];
29991
29993
  const defaultWorkspace = value["defaultWorkspace"];
@@ -29995,7 +29997,7 @@ function decodeVerifiedConnection(value) {
29995
29997
  const relayOrigin = value["relayOrigin"];
29996
29998
  const runtimeCredential2 = value["runtimeCredential"];
29997
29999
  const runtimeId = value["runtimeId"];
29998
- 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") {
30000
+ 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") {
29999
30001
  throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
30000
30002
  }
30001
30003
  return new VerifiedRuntimeConnection(
@@ -30006,7 +30008,7 @@ function decodeVerifiedConnection(value) {
30006
30008
  validateConnectionId(connectionId2),
30007
30009
  validateIdentifier(channelId, "invalid_connection"),
30008
30010
  defaultWorkspace,
30009
- (current || versionThree) && savedPairingId.length > 0 ? validateIdentifier(savedPairingId, "invalid_connection") : "",
30011
+ (current || versionFour || versionThree) && savedPairingId.length > 0 ? validateIdentifier(savedPairingId, "invalid_connection") : "",
30010
30012
  parseRelayOrigin(relayOrigin),
30011
30013
  validateRuntimeCredential(runtimeCredential2),
30012
30014
  validateIdentifier(runtimeId, "invalid_connection")
@@ -30321,7 +30323,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
30321
30323
  relayOrigin: connection.relayOrigin.toString(),
30322
30324
  runtimeCredential: connection.runtimeCredential,
30323
30325
  runtimeId: connection.runtimeId,
30324
- version: 4
30326
+ version: 5
30325
30327
  },
30326
30328
  signal
30327
30329
  );
@@ -30384,8 +30386,8 @@ var PAIRING_TIMEOUT_MILLISECONDS = 2e4;
30384
30386
  var PAIRING_CODE_PATTERN = /^[A-HJ-NP-Z2-9]{4}(?:-[A-HJ-NP-Z2-9]{4}){4}$/;
30385
30387
  var IDENTIFIER_PATTERN5 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
30386
30388
  var TOKEN_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
30387
- var CLAIM_RESPONSE_KEYS = ["channelId", "daemonToken", "runtimeId"];
30388
- var REDEEM_RESPONSE_KEYS = ["channelId", "runtimeCredential", "runtimeId"];
30389
+ var CLAIM_RESPONSE_KEYS = ["appId", "channelId", "daemonToken", "runtimeId"];
30390
+ var REDEEM_RESPONSE_KEYS = ["appId", "channelId", "runtimeCredential", "runtimeId"];
30389
30391
  var MOBIUS_CLI_APPLICATION_ID = "dev.mobius.cli";
30390
30392
  var PairingClientError = class extends Error {
30391
30393
  code;
@@ -30423,7 +30425,7 @@ function readSingleOption(arguments_, option) {
30423
30425
  function assertKnownArguments(arguments_) {
30424
30426
  for (let index2 = 0; index2 < arguments_.length; index2 += 2) {
30425
30427
  const option = arguments_[index2];
30426
- if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace" && option !== "--app-id") {
30428
+ if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace") {
30427
30429
  throw new PairingClientError("invalid_arguments", `Unknown pairing option: ${option ?? "missing option"}`);
30428
30430
  }
30429
30431
  }
@@ -30462,7 +30464,6 @@ function parsePairingCode(value) {
30462
30464
  function parsePairCommand(arguments_, defaultWorkspace) {
30463
30465
  assertKnownArguments(arguments_);
30464
30466
  return {
30465
- appId: arguments_.includes("--app-id") ? validatePairingId(readSingleOption(arguments_, "--app-id")) : "standalone",
30466
30467
  code: parsePairingCode(readSingleOption(arguments_, "--code")),
30467
30468
  pairingId: arguments_.includes("--pairing") ? validatePairingId(readSingleOption(arguments_, "--pairing")) : "",
30468
30469
  relayOrigin: parseRelayOrigin2(readSingleOption(arguments_, "--url")),
@@ -30535,13 +30536,14 @@ function decodePairingResponse(value, credentialField, expectedKeys) {
30535
30536
  if (!isRecord6(value) || !hasExactKeys2(value, expectedKeys)) {
30536
30537
  throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
30537
30538
  }
30539
+ const appId = value["appId"];
30538
30540
  const channelId = value["channelId"];
30539
30541
  const runtimeCredential2 = value[credentialField];
30540
30542
  const runtimeId = value["runtimeId"];
30541
- if (typeof channelId !== "string" || !IDENTIFIER_PATTERN5.test(channelId) || typeof runtimeCredential2 !== "string" || !TOKEN_PATTERN.test(runtimeCredential2) || typeof runtimeId !== "string" || !IDENTIFIER_PATTERN5.test(runtimeId)) {
30543
+ 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)) {
30542
30544
  throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
30543
30545
  }
30544
- return { channelId, runtimeCredential: runtimeCredential2, runtimeId };
30546
+ return { appId, channelId, runtimeCredential: runtimeCredential2, runtimeId };
30545
30547
  }
30546
30548
  async function claimPairing(options, defaultWorkspace, localAgents, installableAgents, signal) {
30547
30549
  const agents = localAgents.map((agent) => ({
@@ -30619,7 +30621,7 @@ async function pairRuntime(installation, options, signal, environment) {
30619
30621
  const claim2 = await claimPairing(options, defaultWorkspace, agents, inventory.installable, signal);
30620
30622
  const connection = await installation.saveConnection(
30621
30623
  {
30622
- appId: options.appId,
30624
+ appId: claim2.appId,
30623
30625
  channelId: claim2.channelId,
30624
30626
  defaultWorkspace,
30625
30627
  pairingId: options.pairingId,
@@ -30667,7 +30669,6 @@ async function pairLocalMachine(arguments_, signal = new AbortController().signa
30667
30669
  return await pairRuntime(
30668
30670
  installation,
30669
30671
  {
30670
- appId: requested.appId,
30671
30672
  code: requested.code,
30672
30673
  pairingId: requested.pairingId,
30673
30674
  relayOrigin: requested.relayOrigin,
@@ -49022,7 +49023,6 @@ function pairArguments(options) {
49022
49023
  "--code",
49023
49024
  options.code,
49024
49025
  ...options.pairing === void 0 ? [] : ["--pairing", options.pairing],
49025
- ...options.appId === void 0 ? [] : ["--app-id", options.appId],
49026
49026
  ...options.workspace === void 0 ? [] : ["--workspace", options.workspace]
49027
49027
  ];
49028
49028
  }
@@ -49084,7 +49084,7 @@ function createProgram() {
49084
49084
  await runManager(installation, package_default.version, shutdown.signal);
49085
49085
  });
49086
49086
  const pair = program2.command("pair").description("pair this machine or manage saved pairings");
49087
- pair.addOption(valueOption("--url <relay-url>", "relay HTTP or HTTPS URL")).addOption(valueOption("--code <pairing-code>", "pairing code shown in the browser")).addOption(valueOption("--pairing <runtime-pairing-id>", "Runtime pairing identifier")).addOption(valueOption("--app-id <app-id>", "application identifier")).addOption(valueOption("--workspace <directory>", "default workspace directory")).action(async (options) => {
49087
+ pair.addOption(valueOption("--url <relay-url>", "relay HTTP or HTTPS URL")).addOption(valueOption("--code <pairing-code>", "pairing code shown in the browser")).addOption(valueOption("--pairing <runtime-pairing-id>", "Runtime pairing identifier")).addOption(valueOption("--workspace <directory>", "default workspace directory")).action(async (options) => {
49088
49088
  const requested = {
49089
49089
  ...options,
49090
49090
  code: requireOption(options.code, "--code <pairing-code>", pair),