@elisym/sdk 0.12.1 → 0.12.2

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.d.cts CHANGED
@@ -404,6 +404,16 @@ declare class DiscoveryService {
404
404
  * provider.
405
405
  */
406
406
  fetchAgents(network?: Network, limit?: number): Promise<Agent[]>;
407
+ /**
408
+ * Fetch a single agent by pubkey, fully enriched (kind:0 metadata,
409
+ * cross-checked `lastPaidJobAt`, rating counters). Returns `null` if the
410
+ * pubkey has no surviving capability cards on the requested network.
411
+ *
412
+ * Use this when navigating directly to an agent's page; running
413
+ * `fetchAgents`/`streamAgents` for that case streams the entire marketplace
414
+ * just to find one author.
415
+ */
416
+ fetchAgent(network: Network, pubkey: string): Promise<Agent | null>;
407
417
  /**
408
418
  * Enrich an agent map with paid-job stats, feedback counters, and kind:0
409
419
  * metadata, then return them sorted by `compareAgentsByRank`. Mutates the
package/dist/index.d.ts CHANGED
@@ -404,6 +404,16 @@ declare class DiscoveryService {
404
404
  * provider.
405
405
  */
406
406
  fetchAgents(network?: Network, limit?: number): Promise<Agent[]>;
407
+ /**
408
+ * Fetch a single agent by pubkey, fully enriched (kind:0 metadata,
409
+ * cross-checked `lastPaidJobAt`, rating counters). Returns `null` if the
410
+ * pubkey has no surviving capability cards on the requested network.
411
+ *
412
+ * Use this when navigating directly to an agent's page; running
413
+ * `fetchAgents`/`streamAgents` for that case streams the entire marketplace
414
+ * just to find one author.
415
+ */
416
+ fetchAgent(network: Network, pubkey: string): Promise<Agent | null>;
407
417
  /**
408
418
  * Enrich an agent map with paid-job stats, feedback counters, and kind:0
409
419
  * metadata, then return them sorted by `compareAgentsByRank`. Mutates the
package/dist/index.js CHANGED
@@ -1261,6 +1261,29 @@ var DiscoveryService = class {
1261
1261
  const agents = Array.from(agentMap.values());
1262
1262
  return this.runEnrichment(agents, agentMap, NEVER_ABORTED_SIGNAL);
1263
1263
  }
1264
+ /**
1265
+ * Fetch a single agent by pubkey, fully enriched (kind:0 metadata,
1266
+ * cross-checked `lastPaidJobAt`, rating counters). Returns `null` if the
1267
+ * pubkey has no surviving capability cards on the requested network.
1268
+ *
1269
+ * Use this when navigating directly to an agent's page; running
1270
+ * `fetchAgents`/`streamAgents` for that case streams the entire marketplace
1271
+ * just to find one author.
1272
+ */
1273
+ async fetchAgent(network, pubkey) {
1274
+ const events = await this.pool.querySync({
1275
+ kinds: [KIND_APP_HANDLER],
1276
+ "#t": ["elisym"],
1277
+ authors: [pubkey]
1278
+ });
1279
+ const agentMap = buildAgentsFromEvents(events, network);
1280
+ if (agentMap.size === 0) {
1281
+ return null;
1282
+ }
1283
+ const agents = Array.from(agentMap.values());
1284
+ await this.runEnrichment(agents, agentMap, NEVER_ABORTED_SIGNAL);
1285
+ return agentMap.get(pubkey) ?? null;
1286
+ }
1264
1287
  /**
1265
1288
  * Enrich an agent map with paid-job stats, feedback counters, and kind:0
1266
1289
  * metadata, then return them sorted by `compareAgentsByRank`. Mutates the