@openscout/protocol 0.2.63 → 0.2.82

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.
Files changed (216) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +103 -52
  3. package/dist/a2a.d.ts +224 -0
  4. package/dist/a2a.d.ts.map +1 -0
  5. package/dist/a2a.js +225 -0
  6. package/dist/activity.d.ts +70 -0
  7. package/dist/activity.d.ts.map +1 -0
  8. package/dist/activity.js +1 -0
  9. package/dist/actors.d.ts +7 -3
  10. package/dist/actors.d.ts.map +1 -0
  11. package/dist/actors.js +15 -1
  12. package/dist/agent-broker-feed.d.ts +84 -0
  13. package/dist/agent-broker-feed.d.ts.map +1 -0
  14. package/dist/agent-broker-feed.js +1 -0
  15. package/dist/agent-identity.d.ts +23 -0
  16. package/dist/agent-identity.d.ts.map +1 -0
  17. package/dist/agent-identity.js +122 -8
  18. package/dist/agent-runs.d.ts +191 -0
  19. package/dist/agent-runs.d.ts.map +1 -0
  20. package/dist/agent-runs.js +365 -0
  21. package/dist/assigned-roles.d.ts +205 -0
  22. package/dist/assigned-roles.d.ts.map +1 -0
  23. package/dist/assigned-roles.js +228 -0
  24. package/dist/broker-routes.d.ts +40 -0
  25. package/dist/broker-routes.d.ts.map +1 -0
  26. package/dist/broker-routes.js +56 -0
  27. package/dist/budget.d.ts +65 -0
  28. package/dist/budget.d.ts.map +1 -0
  29. package/dist/budget.js +19 -0
  30. package/dist/capability-matrix.d.ts +230 -0
  31. package/dist/capability-matrix.d.ts.map +1 -0
  32. package/dist/capability-matrix.js +304 -0
  33. package/dist/channel-identity.d.ts +40 -0
  34. package/dist/channel-identity.d.ts.map +1 -0
  35. package/dist/channel-identity.js +108 -0
  36. package/dist/collaboration.d.ts +45 -16
  37. package/dist/collaboration.d.ts.map +1 -0
  38. package/dist/collaboration.js +39 -23
  39. package/dist/common.d.ts +4 -3
  40. package/dist/common.d.ts.map +1 -0
  41. package/dist/conversations.d.ts +1 -0
  42. package/dist/conversations.d.ts.map +1 -0
  43. package/dist/cursor-transport.d.ts +22 -0
  44. package/dist/cursor-transport.d.ts.map +1 -0
  45. package/dist/cursor-transport.js +10 -0
  46. package/dist/debug-attach.d.ts +29 -0
  47. package/dist/debug-attach.d.ts.map +1 -0
  48. package/dist/debug-attach.js +6 -0
  49. package/dist/deliveries.d.ts +16 -2
  50. package/dist/deliveries.d.ts.map +1 -0
  51. package/dist/durable-actions.d.ts +94 -0
  52. package/dist/durable-actions.d.ts.map +1 -0
  53. package/dist/durable-actions.js +1 -0
  54. package/dist/events.d.ts +27 -1
  55. package/dist/events.d.ts.map +1 -0
  56. package/dist/events.js +14 -1
  57. package/dist/harness-feature-support.d.ts +76 -0
  58. package/dist/harness-feature-support.d.ts.map +1 -0
  59. package/dist/harness-feature-support.js +29 -0
  60. package/dist/host-integrations.d.ts +22 -0
  61. package/dist/host-integrations.d.ts.map +1 -0
  62. package/dist/host-integrations.js +64 -0
  63. package/dist/inbox.d.ts +50 -0
  64. package/dist/inbox.d.ts.map +1 -0
  65. package/dist/inbox.js +9 -0
  66. package/dist/index.d.ts +36 -2
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.js +35 -2
  69. package/dist/invocations.d.ts +121 -0
  70. package/dist/invocations.d.ts.map +1 -0
  71. package/dist/invocations.js +201 -1
  72. package/dist/mesh.d.ts +98 -0
  73. package/dist/mesh.d.ts.map +1 -0
  74. package/dist/mesh.js +18 -1
  75. package/dist/messages.d.ts +3 -0
  76. package/dist/messages.d.ts.map +1 -0
  77. package/dist/native-interactions.d.ts +30 -0
  78. package/dist/native-interactions.d.ts.map +1 -0
  79. package/dist/native-interactions.js +51 -0
  80. package/dist/observed-status.d.ts +33 -0
  81. package/dist/observed-status.d.ts.map +1 -0
  82. package/dist/observed-status.js +6 -0
  83. package/dist/orchestrator-prompt.d.ts +10 -0
  84. package/dist/orchestrator-prompt.d.ts.map +1 -0
  85. package/dist/orchestrator-prompt.js +36 -0
  86. package/dist/permission-policy.d.ts +5 -0
  87. package/dist/permission-policy.d.ts.map +1 -0
  88. package/dist/permission-policy.js +15 -0
  89. package/dist/provisional-agent-names.d.ts +30 -0
  90. package/dist/provisional-agent-names.d.ts.map +1 -0
  91. package/dist/provisional-agent-names.js +224 -0
  92. package/dist/read-receipts.d.ts +12 -0
  93. package/dist/read-receipts.d.ts.map +1 -0
  94. package/dist/read-receipts.js +1 -0
  95. package/dist/relay-agent-card.d.ts +10 -0
  96. package/dist/relay-agent-card.d.ts.map +1 -0
  97. package/dist/rendezvous.d.ts +97 -0
  98. package/dist/rendezvous.d.ts.map +1 -0
  99. package/dist/rendezvous.js +35 -0
  100. package/dist/reserved-vocabulary.d.ts +21 -0
  101. package/dist/reserved-vocabulary.d.ts.map +1 -0
  102. package/dist/reserved-vocabulary.js +101 -0
  103. package/dist/route-aliases.d.ts +112 -0
  104. package/dist/route-aliases.d.ts.map +1 -0
  105. package/dist/route-aliases.js +1 -0
  106. package/dist/runtime-catalog-contract.d.ts +39 -0
  107. package/dist/runtime-catalog-contract.d.ts.map +1 -0
  108. package/dist/runtime-catalog-contract.js +17 -0
  109. package/dist/runtime-catalog.d.ts +11 -0
  110. package/dist/runtime-catalog.d.ts.map +1 -0
  111. package/dist/runtime-catalog.generated.d.ts +230 -0
  112. package/dist/runtime-catalog.generated.d.ts.map +1 -0
  113. package/dist/runtime-catalog.generated.js +299 -0
  114. package/dist/runtime-catalog.js +192 -0
  115. package/dist/runtime-execution.d.ts +161 -0
  116. package/dist/runtime-execution.d.ts.map +1 -0
  117. package/dist/runtime-execution.js +327 -0
  118. package/dist/runtime-profiles.d.ts +12 -0
  119. package/dist/runtime-profiles.d.ts.map +1 -0
  120. package/dist/runtime-profiles.js +20 -0
  121. package/dist/scout-agent-card.d.ts +10 -0
  122. package/dist/scout-agent-card.d.ts.map +1 -0
  123. package/dist/scout-composer.d.ts +27 -0
  124. package/dist/scout-composer.d.ts.map +1 -0
  125. package/dist/scout-composer.js +192 -0
  126. package/dist/scout-delivery.d.ts +101 -4
  127. package/dist/scout-delivery.d.ts.map +1 -0
  128. package/dist/scout-dispatch.d.ts +44 -3
  129. package/dist/scout-dispatch.d.ts.map +1 -0
  130. package/dist/scout-reply-context.d.ts +14 -0
  131. package/dist/scout-reply-context.d.ts.map +1 -0
  132. package/dist/scout-reply-context.js +1 -0
  133. package/dist/session-display-state.d.ts +132 -0
  134. package/dist/session-display-state.d.ts.map +1 -0
  135. package/dist/session-display-state.js +94 -0
  136. package/dist/terminal-host-topology.d.ts +119 -0
  137. package/dist/terminal-host-topology.d.ts.map +1 -0
  138. package/dist/terminal-host-topology.js +21 -0
  139. package/dist/terminal-sessions.d.ts +142 -0
  140. package/dist/terminal-sessions.d.ts.map +1 -0
  141. package/dist/terminal-sessions.js +81 -0
  142. package/dist/terminal-surface-id.d.ts +73 -0
  143. package/dist/terminal-surface-id.d.ts.map +1 -0
  144. package/dist/terminal-surface-id.js +162 -0
  145. package/dist/terminal-workspaces.d.ts +199 -0
  146. package/dist/terminal-workspaces.d.ts.map +1 -0
  147. package/dist/terminal-workspaces.js +287 -0
  148. package/dist/thread-events.d.ts +1 -0
  149. package/dist/thread-events.d.ts.map +1 -0
  150. package/dist/time.d.ts +16 -0
  151. package/dist/time.d.ts.map +1 -0
  152. package/dist/time.js +33 -0
  153. package/dist/transports.d.ts +1 -0
  154. package/dist/transports.d.ts.map +1 -0
  155. package/package.json +37 -9
  156. package/src/a2a.ts +471 -0
  157. package/src/activity.ts +113 -0
  158. package/src/actors.ts +42 -8
  159. package/src/agent-broker-feed.ts +102 -0
  160. package/src/agent-identity.ts +143 -8
  161. package/src/agent-runs.ts +675 -0
  162. package/src/assigned-roles.ts +437 -0
  163. package/src/broker-routes.ts +62 -0
  164. package/src/budget.ts +88 -0
  165. package/src/capability-matrix.ts +648 -0
  166. package/src/channel-identity.ts +147 -0
  167. package/src/collaboration.ts +78 -48
  168. package/src/common.ts +24 -5
  169. package/src/cursor-transport.ts +34 -0
  170. package/src/debug-attach.ts +38 -0
  171. package/src/deliveries.ts +16 -1
  172. package/src/durable-actions.ts +125 -0
  173. package/src/events.ts +31 -0
  174. package/src/harness-feature-support.ts +116 -0
  175. package/src/host-integrations.ts +104 -0
  176. package/src/inbox.ts +68 -0
  177. package/src/index.ts +35 -2
  178. package/src/invocations.ts +353 -0
  179. package/src/mesh.ts +130 -0
  180. package/src/messages.ts +2 -0
  181. package/src/native-interactions.ts +100 -0
  182. package/src/observed-status.ts +90 -0
  183. package/src/orchestrator-prompt.ts +47 -0
  184. package/src/permission-policy.ts +21 -0
  185. package/src/provisional-agent-names.ts +272 -0
  186. package/src/read-receipts.ts +12 -0
  187. package/src/relay-agent-card.ts +73 -63
  188. package/src/rendezvous.ts +154 -0
  189. package/src/reserved-vocabulary.ts +135 -0
  190. package/src/route-aliases.ts +130 -0
  191. package/src/runtime-catalog-contract.ts +60 -0
  192. package/src/runtime-catalog.generated.ts +300 -0
  193. package/src/runtime-catalog.md +21 -0
  194. package/src/runtime-catalog.ts +193 -0
  195. package/src/runtime-catalog.v1.json +81 -0
  196. package/src/runtime-execution.ts +545 -0
  197. package/src/runtime-profiles.ts +37 -0
  198. package/src/scout-agent-card.ts +10 -0
  199. package/src/scout-composer.ts +249 -0
  200. package/src/scout-delivery.ts +117 -4
  201. package/src/scout-dispatch.ts +34 -2
  202. package/src/scout-reply-context.ts +15 -0
  203. package/src/session-display-state.ts +202 -0
  204. package/src/terminal-host-topology.ts +132 -0
  205. package/src/terminal-sessions.ts +187 -0
  206. package/src/terminal-surface-id.ts +189 -0
  207. package/src/terminal-workspaces.ts +455 -0
  208. package/src/time.ts +49 -0
  209. package/dist/agent-address.d.ts +0 -1
  210. package/dist/agent-address.js +0 -1
  211. package/dist/agent-selectors.d.ts +0 -1
  212. package/dist/agent-selectors.js +0 -1
  213. package/src/agent-address.ts +0 -1
  214. package/src/agent-identity.test.ts +0 -435
  215. package/src/agent-selectors.ts +0 -1
  216. package/src/scout-agent-card.test.ts +0 -54
@@ -0,0 +1,102 @@
1
+ import type { AgentState, DeliveryTransport, MetadataMap, ScoutId } from "./common.js";
2
+ import type { DeliveryAttempt, DeliveryIntent } from "./deliveries.js";
3
+ import type { FlightRecord, InvocationRequest } from "./invocations.js";
4
+ import type { MessageRecord } from "./messages.js";
5
+ import type { ScoutDispatchRecord } from "./scout-dispatch.js";
6
+
7
+ export type AgentBrokerFeedItemKind =
8
+ | "message"
9
+ | "status"
10
+ | "invocation"
11
+ | "flight"
12
+ | "delivery"
13
+ | "delivery_attempt"
14
+ | "dispatch";
15
+
16
+ export type AgentBrokerFeedSeverity = "info" | "status" | "warning" | "error";
17
+
18
+ export type AgentBrokerFeedSource =
19
+ | "activity"
20
+ | "snapshot"
21
+ | "delivery"
22
+ | "dispatch";
23
+
24
+ export interface AgentBrokerFeedEndpointStatus {
25
+ id: ScoutId;
26
+ nodeId: ScoutId;
27
+ harness: string;
28
+ transport: DeliveryTransport | string;
29
+ state: AgentState | string;
30
+ sessionId?: string;
31
+ projectRoot?: string;
32
+ cwd?: string;
33
+ lastError?: string;
34
+ lastFailureStage?: string;
35
+ updatedAt?: number;
36
+ }
37
+
38
+ export interface AgentBrokerFeedStatus {
39
+ agentId: ScoutId;
40
+ displayName?: string;
41
+ found: boolean;
42
+ agentState?: AgentState | string;
43
+ endpoints: AgentBrokerFeedEndpointStatus[];
44
+ activeFlightIds: ScoutId[];
45
+ pendingDeliveryIds: ScoutId[];
46
+ errorCount: number;
47
+ warningCount: number;
48
+ lastError?: string;
49
+ lastActivityAt?: number;
50
+ }
51
+
52
+ export interface AgentBrokerFeedItem {
53
+ id: string;
54
+ kind: AgentBrokerFeedItemKind;
55
+ severity: AgentBrokerFeedSeverity;
56
+ at: number;
57
+ title: string;
58
+ summary: string;
59
+ agentId?: ScoutId;
60
+ actorId?: ScoutId;
61
+ targetAgentId?: ScoutId;
62
+ conversationId?: ScoutId;
63
+ messageId?: ScoutId;
64
+ invocationId?: ScoutId;
65
+ flightId?: ScoutId;
66
+ deliveryId?: ScoutId;
67
+ dispatchId?: ScoutId;
68
+ status?: string;
69
+ reason?: string;
70
+ source: AgentBrokerFeedSource;
71
+ message?: MessageRecord;
72
+ invocation?: InvocationRequest;
73
+ flight?: FlightRecord;
74
+ delivery?: DeliveryIntent;
75
+ deliveryAttempt?: DeliveryAttempt;
76
+ dispatch?: ScoutDispatchRecord;
77
+ metadata?: MetadataMap;
78
+ }
79
+
80
+ export interface AgentBrokerFeedCounts {
81
+ items: number;
82
+ messages: number;
83
+ statuses: number;
84
+ invocations: number;
85
+ flights: number;
86
+ deliveries: number;
87
+ deliveryAttempts: number;
88
+ dispatches: number;
89
+ errors: number;
90
+ warnings: number;
91
+ }
92
+
93
+ export interface AgentBrokerFeed {
94
+ agentId: ScoutId;
95
+ generatedAt: number;
96
+ since: number | null;
97
+ limit: number;
98
+ cursor: number | null;
99
+ status: AgentBrokerFeedStatus;
100
+ counts: AgentBrokerFeedCounts;
101
+ items: AgentBrokerFeedItem[];
102
+ }
@@ -21,6 +21,7 @@ export interface AgentIdentityCandidate {
21
21
  profile?: string;
22
22
  harness?: string;
23
23
  model?: string;
24
+ referenceId?: string;
24
25
  aliases?: string[];
25
26
  }
26
27
 
@@ -366,16 +367,37 @@ function candidateAliases(candidate: AgentIdentityCandidate): string[] {
366
367
  return Array.from(new Set(aliases.map((alias) => trimIdentityPrefix(alias)).filter(Boolean)));
367
368
  }
368
369
 
370
+ // Directory-wide operations (formatMinimalAgentIdentity, diagnoseAgentIdentity)
371
+ // evaluate these per candidate pair, and broker snapshots can carry thousands
372
+ // of candidates — recomputing parse/construct work per visit turns those
373
+ // call sites quadratic in heavy string handling. Candidates are treated as
374
+ // immutable once they enter these pipelines, so per-object memoization is safe.
375
+ const explicitAliasesCache = new WeakMap<AgentIdentityCandidate, string[]>();
376
+ const aliasKeysCache = new WeakMap<AgentIdentityCandidate, string[]>();
377
+ const canonicalIdentityCache = new WeakMap<AgentIdentityCandidate, AgentIdentity | null>();
378
+
369
379
  function explicitCandidateAliases(candidate: AgentIdentityCandidate): string[] {
380
+ const cached = explicitAliasesCache.get(candidate);
381
+ if (cached) return cached;
370
382
  const canonical = candidateCanonicalIdentity(candidate);
371
383
  const implicitAliases = canonical?.definitionId === OPENSCOUT_COORDINATOR_AGENT_ID
372
384
  ? [SCOUT_DISPATCHER_AGENT_ID]
373
385
  : [];
374
- return Array.from(new Set(
386
+ const aliases = Array.from(new Set(
375
387
  [...(candidate.aliases ?? []), ...implicitAliases]
376
388
  .map((alias) => normalizeAgentIdentitySegment(trimIdentityPrefix(alias)))
377
389
  .filter(Boolean),
378
390
  ));
391
+ explicitAliasesCache.set(candidate, aliases);
392
+ return aliases;
393
+ }
394
+
395
+ function candidateAliasKeys(candidate: AgentIdentityCandidate): string[] {
396
+ const cached = aliasKeysCache.get(candidate);
397
+ if (cached) return cached;
398
+ const keys = explicitCandidateAliases(candidate).map(canonicalizeAliasValue);
399
+ aliasKeysCache.set(candidate, keys);
400
+ return keys;
379
401
  }
380
402
 
381
403
  function canonicalizeAliasValue(value: string): string {
@@ -396,7 +418,10 @@ function identityAliasKeys(identity: AgentIdentity): string[] {
396
418
  }
397
419
 
398
420
  function candidateCanonicalIdentity(candidate: AgentIdentityCandidate): AgentIdentity | null {
399
- return constructAgentIdentity({
421
+ if (canonicalIdentityCache.has(candidate)) {
422
+ return canonicalIdentityCache.get(candidate) ?? null;
423
+ }
424
+ const canonical = constructAgentIdentity({
400
425
  definitionId: candidate.definitionId || candidate.agentId,
401
426
  nodeQualifier: candidate.nodeQualifier,
402
427
  workspaceQualifier: candidate.workspaceQualifier,
@@ -404,6 +429,8 @@ function candidateCanonicalIdentity(candidate: AgentIdentityCandidate): AgentIde
404
429
  harness: candidate.harness,
405
430
  model: candidate.model,
406
431
  });
432
+ canonicalIdentityCache.set(candidate, canonical);
433
+ return canonical;
407
434
  }
408
435
 
409
436
  function candidateDimensionValue(
@@ -422,6 +449,82 @@ function candidateDimensionValue(
422
449
  return canonical.nodeQualifier;
423
450
  }
424
451
 
452
+ function normalizeAgentReferenceValue(value: string | null | undefined): string {
453
+ return value?.trim().toLowerCase().replace(/[^a-z0-9]/g, "") ?? "";
454
+ }
455
+
456
+ function candidateReferenceValue(candidate: AgentIdentityCandidate): string {
457
+ return normalizeAgentReferenceValue(
458
+ candidate.referenceId
459
+ || candidate.workspaceQualifier
460
+ || candidate.agentId,
461
+ );
462
+ }
463
+
464
+ function candidateReferenceSuffix(candidate: AgentIdentityCandidate, length: number): string {
465
+ const value = candidateReferenceValue(candidate);
466
+ if (!value) {
467
+ return "";
468
+ }
469
+ return value.length <= length ? value : value.slice(-length);
470
+ }
471
+
472
+ export function formatAgentReferenceIdentity<T extends AgentIdentityCandidate>(
473
+ candidate: T,
474
+ candidates: T[],
475
+ options: { includeSigil?: boolean; minLength?: number; maxLength?: number } = {},
476
+ ): string {
477
+ const canonical = candidateCanonicalIdentity(candidate);
478
+ if (!canonical) {
479
+ return options.includeSigil === false ? "" : "@";
480
+ }
481
+
482
+ const minLength = Math.max(1, options.minLength ?? 5);
483
+ const maxLength = Math.max(minLength, options.maxLength ?? 8);
484
+ const peers = candidates.filter((peer) => {
485
+ if (peer === candidate) {
486
+ return false;
487
+ }
488
+ const peerCanonical = candidateCanonicalIdentity(peer);
489
+ return peerCanonical?.definitionId === canonical.definitionId;
490
+ });
491
+
492
+ let suffix = "";
493
+ for (let length = minLength; length <= maxLength; length += 1) {
494
+ const candidateSuffix = candidateReferenceSuffix(candidate, length);
495
+ if (!candidateSuffix) {
496
+ break;
497
+ }
498
+ suffix = candidateSuffix;
499
+ const collides = peers.some((peer) => candidateReferenceSuffix(peer, length) === candidateSuffix);
500
+ if (!collides) {
501
+ break;
502
+ }
503
+ }
504
+
505
+ if (!suffix) {
506
+ return formatAgentIdentity({ definitionId: canonical.definitionId }, options);
507
+ }
508
+
509
+ return formatAgentIdentity({
510
+ definitionId: canonical.definitionId,
511
+ workspaceQualifier: suffix,
512
+ }, options);
513
+ }
514
+
515
+ export function withAgentReferenceAliases<T extends AgentIdentityCandidate>(
516
+ candidates: T[],
517
+ ): T[] {
518
+ return candidates.map((candidate) => {
519
+ const alias = formatAgentReferenceIdentity(candidate, candidates);
520
+ const aliases = Array.from(new Set([...(candidate.aliases ?? []), alias].filter(Boolean)));
521
+ return {
522
+ ...candidate,
523
+ aliases,
524
+ };
525
+ });
526
+ }
527
+
425
528
  function modelAliasKeys(value: string | undefined): string[] {
426
529
  const normalized = value ? normalizeAgentIdentitySegment(value) : "";
427
530
  if (!normalized) {
@@ -527,8 +630,8 @@ export function diagnoseAgentIdentity<T extends AgentIdentityCandidate>(
527
630
  ): AgentIdentityDiagnosis<T> {
528
631
  const aliasKeys = identityAliasKeys(identity);
529
632
  const exactAliasMatches = candidates.filter((candidate) => {
530
- const candidateAliasKeys = explicitCandidateAliases(candidate).map(canonicalizeAliasValue);
531
- return aliasKeys.some((key) => candidateAliasKeys.includes(key));
633
+ const keys = candidateAliasKeys(candidate);
634
+ return keys.length > 0 && aliasKeys.some((key) => keys.includes(key));
532
635
  });
533
636
  if (exactAliasMatches.length === 1) {
534
637
  return { kind: "resolved", match: exactAliasMatches[0] };
@@ -628,6 +731,26 @@ function buildIdentitySubset(
628
731
  });
629
732
  }
630
733
 
734
+ const peersByDefinitionCache = new WeakMap<AgentIdentityCandidate[], Map<string, AgentIdentityCandidate[]>>();
735
+
736
+ function peersByDefinitionId<T extends AgentIdentityCandidate>(candidates: T[]): Map<string, T[]> {
737
+ const cached = peersByDefinitionCache.get(candidates);
738
+ if (cached) return cached as Map<string, T[]>;
739
+ const groups = new Map<string, T[]>();
740
+ for (const candidate of candidates) {
741
+ const canonical = candidateCanonicalIdentity(candidate);
742
+ if (!canonical) continue;
743
+ const group = groups.get(canonical.definitionId);
744
+ if (group) {
745
+ group.push(candidate);
746
+ } else {
747
+ groups.set(canonical.definitionId, [candidate]);
748
+ }
749
+ }
750
+ peersByDefinitionCache.set(candidates, groups);
751
+ return groups;
752
+ }
753
+
631
754
  export function formatMinimalAgentIdentity<T extends AgentIdentityCandidate>(
632
755
  candidate: T,
633
756
  candidates: T[],
@@ -638,10 +761,7 @@ export function formatMinimalAgentIdentity<T extends AgentIdentityCandidate>(
638
761
  return options.includeSigil === false ? "" : "@";
639
762
  }
640
763
 
641
- const peers = candidates.filter((peer) => {
642
- const peerCanonical = candidateCanonicalIdentity(peer);
643
- return peerCanonical && peerCanonical.definitionId === canonical.definitionId;
644
- });
764
+ const peers = peersByDefinitionId(candidates).get(canonical.definitionId) ?? [];
645
765
 
646
766
  const aliasMatches = explicitCandidateAliases(candidate)
647
767
  .map((alias) => ({ alias, identity: parseAgentIdentity(`@${alias}`) }))
@@ -683,20 +803,35 @@ export function formatMinimalAgentIdentity<T extends AgentIdentityCandidate>(
683
803
  return formatAgentIdentity(canonical, options);
684
804
  }
685
805
 
806
+ /** @deprecated Use {@link AgentIdentity} instead. */
686
807
  export type AgentAddress = AgentIdentity;
808
+ /** @deprecated Use {@link AgentIdentityCandidate} instead. */
687
809
  export type AgentAddressCandidate = AgentIdentityCandidate;
810
+ /** @deprecated Use {@link AgentIdentity} instead. */
688
811
  export type AgentSelector = AgentIdentity;
812
+ /** @deprecated Use {@link AgentIdentityCandidate} instead. */
689
813
  export type AgentSelectorCandidate = AgentIdentityCandidate;
690
814
 
815
+ /** @deprecated Use {@link parseAgentIdentity} instead. */
691
816
  export const parseAgentAddress = parseAgentIdentity;
817
+ /** @deprecated Use {@link formatAgentIdentity} instead. */
692
818
  export const formatAgentAddress = formatAgentIdentity;
819
+ /** @deprecated Use {@link constructAgentIdentity} instead. */
693
820
  export const constructAgentAddress = constructAgentIdentity;
821
+ /** @deprecated Use {@link extractAgentIdentities} instead. */
694
822
  export const extractAgentAddresses = extractAgentIdentities;
823
+ /** @deprecated Use {@link agentIdentityMatches} instead. */
695
824
  export const agentAddressMatches = agentIdentityMatches;
825
+ /** @deprecated Use {@link resolveAgentIdentity} instead. */
696
826
  export const resolveAgentAddress = resolveAgentIdentity;
697
827
 
828
+ /** @deprecated Use {@link parseAgentIdentity} instead. */
698
829
  export const parseAgentSelector = parseAgentIdentity;
830
+ /** @deprecated Use {@link formatAgentIdentity} instead. */
699
831
  export const formatAgentSelector = formatAgentIdentity;
832
+ /** @deprecated Use {@link extractAgentIdentities} instead. */
700
833
  export const extractAgentSelectors = extractAgentIdentities;
834
+ /** @deprecated Use {@link agentIdentityMatches} instead. */
701
835
  export const agentSelectorMatches = agentIdentityMatches;
836
+ /** @deprecated Use {@link resolveAgentIdentity} instead. */
702
837
  export const resolveAgentSelector = resolveAgentIdentity;