@moxt-ai/mobius 0.0.38 → 0.0.39

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
@@ -11,7 +11,7 @@ import { mkdir as mkdir5 } from "node:fs/promises";
11
11
  // package.json
12
12
  var package_default = {
13
13
  name: "@moxt-ai/mobius",
14
- version: "0.0.38",
14
+ version: "0.0.39",
15
15
  description: "Mobius CLI for pairing and running local AI agent services.",
16
16
  type: "module",
17
17
  bin: {
@@ -40919,6 +40919,22 @@ async function publishAgentCatalogUntilAvailable(config2, diagnostics, signal, t
40919
40919
  }
40920
40920
  }
40921
40921
  }
40922
+ async function installDetectedAgentIntegrations(config2, installations, signal) {
40923
+ for (const agent of config2.catalog.read().installableAgents) {
40924
+ if (!(agent instanceof AgentIntegrationDefinition)) {
40925
+ continue;
40926
+ }
40927
+ signal.throwIfAborted();
40928
+ await installations.request(
40929
+ {
40930
+ agentId: agent.id,
40931
+ kind: AGENT_INSTALL_REQUEST_KIND,
40932
+ requestId: `automatic-integration-${randomUUID6()}`
40933
+ },
40934
+ signal
40935
+ );
40936
+ }
40937
+ }
40922
40938
  async function runRelayConnection(config2, directories, audit, sessions, installations, installationObserver, nativeSessions, outbox, publisher, grants, contexts, applicator, ipc, activeTurns, activeAttemptIds, connectionEpoch, diagnostics, onConnected, signal, timer) {
40923
40939
  const relayUrl = new URL(config2.relayUrl);
40924
40940
  relayUrl.searchParams.set("deliveryReceipts", "1");
@@ -40926,11 +40942,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
40926
40942
  const socket = await connectRelay(relayUrl, signal);
40927
40943
  const reconnectingTurns = [...activeTurns.values()];
40928
40944
  diagnostics.connectionOpened(connectionEpoch);
40929
- onConnected();
40930
40945
  const connectionController = new AbortController();
40931
40946
  const nativeRequests = /* @__PURE__ */ new Map();
40932
40947
  const agentSettingsDiscoveries = /* @__PURE__ */ new Map();
40933
40948
  installationObserver.connect(socket);
40949
+ onConnected();
40934
40950
  try {
40935
40951
  await new Promise((resolve5, reject) => {
40936
40952
  let finished = false;
@@ -41886,9 +41902,24 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
41886
41902
  installationAudit
41887
41903
  );
41888
41904
  let connectionEpoch = 0;
41905
+ let automaticIntegrationProvisioningStarted = false;
41906
+ let automaticIntegrationProvisioning = Promise.resolve();
41889
41907
  let connectionAnnounced = false;
41890
41908
  let catalogPublished = false;
41891
41909
  let readinessAnnounced = false;
41910
+ const startAutomaticIntegrationProvisioning = () => {
41911
+ if (!connectionAnnounced || !catalogPublished || automaticIntegrationProvisioningStarted) {
41912
+ return;
41913
+ }
41914
+ automaticIntegrationProvisioningStarted = true;
41915
+ automaticIntegrationProvisioning = installDetectedAgentIntegrations(config2, installations, signal).catch(
41916
+ (error62) => {
41917
+ if (!signal.aborted) {
41918
+ console.error("Mobius daemon could not automatically install detected Agent integrations", error62);
41919
+ }
41920
+ }
41921
+ );
41922
+ };
41892
41923
  const announceReadiness = () => {
41893
41924
  if (!connectionAnnounced || !catalogPublished || readinessAnnounced) {
41894
41925
  return;
@@ -41910,6 +41941,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
41910
41941
  `
41911
41942
  );
41912
41943
  announceReadiness();
41944
+ startAutomaticIntegrationProvisioning();
41913
41945
  };
41914
41946
  const catalogPublication = publishAgentCatalogUntilAvailable(config2, diagnostics, signal, timer);
41915
41947
  void catalogPublication.then(() => {
@@ -41918,6 +41950,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
41918
41950
  }
41919
41951
  catalogPublished = true;
41920
41952
  announceReadiness();
41953
+ startAutomaticIntegrationProvisioning();
41921
41954
  });
41922
41955
  try {
41923
41956
  await ipc.listen(signal);
@@ -41964,24 +41997,28 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
41964
41997
  await catalogPublication;
41965
41998
  } finally {
41966
41999
  try {
41967
- await installations.close();
42000
+ await automaticIntegrationProvisioning;
41968
42001
  } finally {
41969
42002
  try {
41970
- await ipc.close();
42003
+ await installations.close();
41971
42004
  } finally {
41972
42005
  try {
41973
- await sessions.close();
42006
+ await ipc.close();
41974
42007
  } finally {
41975
42008
  try {
41976
- sessionStore.close();
42009
+ await sessions.close();
41977
42010
  } finally {
41978
42011
  try {
41979
- grants.close();
42012
+ sessionStore.close();
41980
42013
  } finally {
41981
42014
  try {
41982
- publisher.close();
42015
+ grants.close();
41983
42016
  } finally {
41984
- outbox.close();
42017
+ try {
42018
+ publisher.close();
42019
+ } finally {
42020
+ outbox.close();
42021
+ }
41985
42022
  }
41986
42023
  }
41987
42024
  }