@moxt-ai/mobius 0.0.146 → 0.0.147

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
@@ -32569,6 +32569,17 @@ var AgentProbeFailed = class extends UnavailableAgent {
32569
32569
  this.message = message;
32570
32570
  }
32571
32571
  };
32572
+ var UnsupportedAgentVersion = class extends UnavailableInstalledAgent {
32573
+ code = "agent_version_unsupported";
32574
+ message;
32575
+ minimumSupportedVersion;
32576
+ status = "unsupported_version";
32577
+ constructor(specification, agent, minimumSupportedVersion) {
32578
+ super(specification, agent);
32579
+ this.minimumSupportedVersion = minimumSupportedVersion;
32580
+ this.message = `Agent version ${agent.agentVersion} is below the minimum supported version ${minimumSupportedVersion}`;
32581
+ }
32582
+ };
32572
32583
  var IntegrationProbeFailed = class extends UnavailableInstalledAgent {
32573
32584
  code;
32574
32585
  message;
@@ -32596,12 +32607,25 @@ var AuthenticationRequiredAgent = class extends UnavailableInstalledAgent {
32596
32607
  super(specification, agent);
32597
32608
  }
32598
32609
  };
32610
+ var AgentDiscoveryResult = class {
32611
+ detectionMilliseconds;
32612
+ discovery;
32613
+ constructor(discovery, detectionMilliseconds) {
32614
+ if (!Number.isFinite(detectionMilliseconds) || detectionMilliseconds < 0) {
32615
+ throw new Error("The Agent detection duration is invalid");
32616
+ }
32617
+ this.detectionMilliseconds = Math.round(detectionMilliseconds * 1e3) / 1e3;
32618
+ this.discovery = discovery;
32619
+ }
32620
+ };
32599
32621
  var LocalAgentInventory = class {
32600
32622
  available;
32601
32623
  discoveries;
32602
32624
  installable;
32625
+ results;
32603
32626
  unavailable;
32604
- constructor(discoveries) {
32627
+ constructor(results) {
32628
+ const discoveries = results.map((result) => result.discovery);
32605
32629
  const available = [];
32606
32630
  const unavailable = [];
32607
32631
  for (const discovery of discoveries) {
@@ -32620,8 +32644,17 @@ var LocalAgentInventory = class {
32620
32644
  (discovery) => discovery instanceof UnavailableInstalledAgent ? discovery.agent : new MissingAgentDefinition(discovery.specification.id, discovery.specification.label)
32621
32645
  )
32622
32646
  );
32647
+ this.results = Object.freeze([...results]);
32623
32648
  this.unavailable = Object.freeze(unavailable);
32624
32649
  }
32650
+ detectionMillisecondsFor = (discovery) => {
32651
+ for (const result of this.results) {
32652
+ if (result.discovery === discovery) {
32653
+ return result.detectionMilliseconds;
32654
+ }
32655
+ }
32656
+ throw new Error("The Agent discovery result is unavailable");
32657
+ };
32625
32658
  readyAgents = () => this.available.map((discovery) => discovery.agent);
32626
32659
  };
32627
32660
 
@@ -36540,15 +36573,20 @@ async function discoverAgent(specification, context) {
36540
36573
  );
36541
36574
  continue;
36542
36575
  }
36543
- if (!supportedVersion) {
36544
- continue;
36545
- }
36546
36576
  const installedAgent = new AgentIntegrationDefinition(
36547
36577
  specification.id,
36548
36578
  specification.label,
36549
36579
  agent.identity.requestedPath,
36550
36580
  agentVersion
36551
36581
  );
36582
+ if (!supportedVersion) {
36583
+ lastFailure = new UnsupportedAgentVersion(
36584
+ specification,
36585
+ installedAgent,
36586
+ specification.minimumSupportedAgentVersion
36587
+ );
36588
+ continue;
36589
+ }
36552
36590
  if (adapters.length === 0 && !(specification instanceof InProcessAcpAgentDefinition2)) {
36553
36591
  return new MissingAdapter(specification, installedAgent);
36554
36592
  }
@@ -36642,10 +36680,15 @@ async function discoverAgent(specification, context) {
36642
36680
  // src/agent-catalog/discover-local-agents.ts
36643
36681
  async function discoverLocalAgentInventory(options) {
36644
36682
  const specifications = options.specifications ?? supportedLocalAgentSpecifications();
36645
- const discoveries = await Promise.all(
36646
- specifications.map(async (specification) => await discoverAgent(specification, options))
36683
+ const monotonicTimeMilliseconds = options.monotonicTimeMilliseconds ?? (() => performance.now());
36684
+ const results = await Promise.all(
36685
+ specifications.map(async (specification) => {
36686
+ const startedAt = monotonicTimeMilliseconds();
36687
+ const discovery = await discoverAgent(specification, options);
36688
+ return new AgentDiscoveryResult(discovery, monotonicTimeMilliseconds() - startedAt);
36689
+ })
36647
36690
  );
36648
- return new LocalAgentInventory(discoveries);
36691
+ return new LocalAgentInventory(results);
36649
36692
  }
36650
36693
 
36651
36694
  // src/storage/runtime-installation-store.ts