Repository navigation
feat(server): add agent catalog endpoint backed by registry metadata - #88
Conversation
TOMOKI977
left a comment
There was a problem hiding this comment.
La implementación del catálogo está bien resuelta: caché de 60 s, fallback a datos stale, agentes inválidos omitidos y excepción tipada cuando no hay datos. Los criterios del issue se cumplen.
El punto pendiente es de diseño, no de código: el endpoint no coincide con el contrato de API propuesto en #77 (docs/architecture/api.md).
- Contrato:
CatalogEndpoint.listAgents/getAgent(int), que devuelve unAgentSummaryconagent,rating,paidHireCountyactive. - Este PR:
AgentEndpoint.list/get(String), con un modelo plano (registryId,skills: List<String>,priceUsdcStroops).
Antes de mergear necesitamos decidir cuál de los dos manda y alinear el otro, para no tener cliente, servidor y documentación diciendo cosas distintas. Lo coordinamos en #77.
TOMOKI977
left a comment
There was a problem hiding this comment.
Approving. We decided to keep your AgentEndpoint design and align the contract to it instead: #99 updates docs/architecture/api.md to AgentEndpoint.list() / get(id) and copies AgentSummary and AgentCatalogUnavailable exactly, so no changes are needed here.
One thing the contract now states explicitly, worth keeping in mind for #96 and #92: createHire takes the on-chain registryId as agentId, while get takes the metadata id (agt-001).
Merge note: retarget this to main once #86 merges, so CI runs before merging.
# Conflicts: # puls3_server/lib/src/ledger/soroban_ledger.dart # puls3_server/lib/src/ledger/xdr_invoke_encoder.dart # puls3_server/pubspec.yaml # puls3_server/test/unit/ledger/soroban_ledger_test.dart # puls3_server/test/unit/ledger/xdr_invoke_encoder_test.dart
Closes #87
Stacked on #86 (which is stacked on #84); retarget to
mainas each one merges.Summary
Adds a read-only Serverpod
agentendpoint (listandget) that serves anAgentSummarycatalog built from the Identity Registry metadata through the Soroban ledger adapter from #86.SorobanLedgergainstotalAgentsandagentMetadata, and the XDR encoder gains a string argument.AgentCatalogService(pure Dart) enumerates ids0..total-1with 4 workers, skips agents with missing or invalid metadata (this drops the superseded demo agents 0-6), keeps the highestregistryIdwhen a metadataidrepeats, and caches the list for 60 s.AgentCatalogUnavailable. An outage never produces an empty or partial list.PULS3_STELLAR_*env vars, an 8 s RPC timeout) and has a test override, because the generatedEndpoints()only calls no-argument constructors.serverpod_cli3.4.13).Acceptance criteria
agentendpoint withlistandgetreturningAgentSummary(no rating).AgentCatalogUnavailable.serverpod generateleaves no diff.Verification evidence
total_agents= 15, agent 7name= "Ledger Scout", agent 7id= "agt-001"). Nothing was signed or broadcast.Notes for reviewers
size:exception.reputation_registryis not deployed), soAgentSummaryhas none; the Flutter change decides the display default.meta: ^1.17.0dependency (already in the lock) for@visibleForTesting.