@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/runtime.js CHANGED
@@ -22368,6 +22368,17 @@ var AgentProbeFailed = class extends UnavailableAgent {
22368
22368
  this.message = message;
22369
22369
  }
22370
22370
  };
22371
+ var UnsupportedAgentVersion = class extends UnavailableInstalledAgent {
22372
+ code = "agent_version_unsupported";
22373
+ message;
22374
+ minimumSupportedVersion;
22375
+ status = "unsupported_version";
22376
+ constructor(specification, agent, minimumSupportedVersion) {
22377
+ super(specification, agent);
22378
+ this.minimumSupportedVersion = minimumSupportedVersion;
22379
+ this.message = `Agent version ${agent.agentVersion} is below the minimum supported version ${minimumSupportedVersion}`;
22380
+ }
22381
+ };
22371
22382
  var IntegrationProbeFailed = class extends UnavailableInstalledAgent {
22372
22383
  code;
22373
22384
  message;
@@ -22395,12 +22406,25 @@ var AuthenticationRequiredAgent = class extends UnavailableInstalledAgent {
22395
22406
  super(specification, agent);
22396
22407
  }
22397
22408
  };
22409
+ var AgentDiscoveryResult = class {
22410
+ detectionMilliseconds;
22411
+ discovery;
22412
+ constructor(discovery, detectionMilliseconds) {
22413
+ if (!Number.isFinite(detectionMilliseconds) || detectionMilliseconds < 0) {
22414
+ throw new Error("The Agent detection duration is invalid");
22415
+ }
22416
+ this.detectionMilliseconds = Math.round(detectionMilliseconds * 1e3) / 1e3;
22417
+ this.discovery = discovery;
22418
+ }
22419
+ };
22398
22420
  var LocalAgentInventory = class {
22399
22421
  available;
22400
22422
  discoveries;
22401
22423
  installable;
22424
+ results;
22402
22425
  unavailable;
22403
- constructor(discoveries) {
22426
+ constructor(results) {
22427
+ const discoveries = results.map((result) => result.discovery);
22404
22428
  const available = [];
22405
22429
  const unavailable = [];
22406
22430
  for (const discovery of discoveries) {
@@ -22419,8 +22443,17 @@ var LocalAgentInventory = class {
22419
22443
  (discovery) => discovery instanceof UnavailableInstalledAgent ? discovery.agent : new MissingAgentDefinition(discovery.specification.id, discovery.specification.label)
22420
22444
  )
22421
22445
  );
22446
+ this.results = Object.freeze([...results]);
22422
22447
  this.unavailable = Object.freeze(unavailable);
22423
22448
  }
22449
+ detectionMillisecondsFor = (discovery) => {
22450
+ for (const result of this.results) {
22451
+ if (result.discovery === discovery) {
22452
+ return result.detectionMilliseconds;
22453
+ }
22454
+ }
22455
+ throw new Error("The Agent discovery result is unavailable");
22456
+ };
22424
22457
  readyAgents = () => this.available.map((discovery) => discovery.agent);
22425
22458
  };
22426
22459
 
@@ -26485,15 +26518,20 @@ async function discoverAgent(specification, context) {
26485
26518
  );
26486
26519
  continue;
26487
26520
  }
26488
- if (!supportedVersion) {
26489
- continue;
26490
- }
26491
26521
  const installedAgent = new AgentIntegrationDefinition(
26492
26522
  specification.id,
26493
26523
  specification.label,
26494
26524
  agent.identity.requestedPath,
26495
26525
  agentVersion
26496
26526
  );
26527
+ if (!supportedVersion) {
26528
+ lastFailure = new UnsupportedAgentVersion(
26529
+ specification,
26530
+ installedAgent,
26531
+ specification.minimumSupportedAgentVersion
26532
+ );
26533
+ continue;
26534
+ }
26497
26535
  if (adapters.length === 0 && !(specification instanceof InProcessAcpAgentDefinition2)) {
26498
26536
  return new MissingAdapter(specification, installedAgent);
26499
26537
  }
@@ -26587,10 +26625,15 @@ async function discoverAgent(specification, context) {
26587
26625
  // src/agent-catalog/discover-local-agents.ts
26588
26626
  async function discoverLocalAgentInventory(options) {
26589
26627
  const specifications = options.specifications ?? supportedLocalAgentSpecifications();
26590
- const discoveries = await Promise.all(
26591
- specifications.map(async (specification) => await discoverAgent(specification, options))
26628
+ const monotonicTimeMilliseconds = options.monotonicTimeMilliseconds ?? (() => performance.now());
26629
+ const results = await Promise.all(
26630
+ specifications.map(async (specification) => {
26631
+ const startedAt = monotonicTimeMilliseconds();
26632
+ const discovery = await discoverAgent(specification, options);
26633
+ return new AgentDiscoveryResult(discovery, monotonicTimeMilliseconds() - startedAt);
26634
+ })
26592
26635
  );
26593
- return new LocalAgentInventory(discoveries);
26636
+ return new LocalAgentInventory(results);
26594
26637
  }
26595
26638
 
26596
26639
  // src/audit/audit-store.ts