@moxt-ai/mobius 0.0.57 → 0.0.58

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
@@ -40985,9 +40985,24 @@ async function installDetectedAgentIntegrations(config2, installations, signal)
40985
40985
  );
40986
40986
  }
40987
40987
  }
40988
+ async function retainStillInstalledAgents(previous2, refreshed, signal) {
40989
+ const refreshedIdentifiers = new Set(refreshed.map((agent) => agent.id));
40990
+ const retained = [];
40991
+ for (const agent of previous2) {
40992
+ if (refreshedIdentifiers.has(agent.id)) {
40993
+ continue;
40994
+ }
40995
+ signal.throwIfAborted();
40996
+ if (await revalidateExecutable(agent.agentIdentity)) {
40997
+ retained.push(agent);
40998
+ }
40999
+ }
41000
+ return Object.freeze([...refreshed, ...retained]);
41001
+ }
40988
41002
  async function refreshAgentCatalog(config2, resolveEnvironment, signal) {
40989
41003
  signal.throwIfAborted();
40990
- const environment = await resolveEnvironment(signal);
41004
+ const shellEnvironment = await resolveEnvironment(signal);
41005
+ const environment = new DaemonLocalContext(config2.localContext.stateDirectory, shellEnvironment).environment;
40991
41006
  signal.throwIfAborted();
40992
41007
  const inventory = await discoverLocalAgentInventory({
40993
41008
  defaultWorkspace: config2.defaultWorkspace,
@@ -40995,9 +41010,12 @@ async function refreshAgentCatalog(config2, resolveEnvironment, signal) {
40995
41010
  signal
40996
41011
  });
40997
41012
  const previousCatalog = config2.catalog.read();
41013
+ const refreshedAgents = inventory.readyAgents().map((agent) => withDaemonEnvironment(agent, environment));
41014
+ const agents = await retainStillInstalledAgents(previousCatalog.agents, refreshedAgents, signal);
41015
+ const verifiedIdentifiers = new Set(agents.map((agent) => agent.id));
40998
41016
  config2.catalog.transition(
40999
- inventory.readyAgents().map((agent) => withDaemonEnvironment(agent, environment)),
41000
- inventory.installable
41017
+ agents,
41018
+ inventory.installable.filter((agent) => !verifiedIdentifiers.has(agent.id))
41001
41019
  );
41002
41020
  try {
41003
41021
  await publishAgentCatalog(config2, signal);