mirror of
https://github.com/Permissionless-Software-Foundation/psf-bch-api.git
synced 2026-09-21 16:52:00 -07:00
2.8 KiB
2.8 KiB
2026-04-01 Update Log
Summary
Added x402-gated discovery endpoints for agent/tool self-discovery, built a docs-derived artifact pipeline from apiDoc annotations, and documented the new flow and behavior.
Changes Made
- Added new discovery controller/router:
src/controllers/discovery/controller.jssrc/controllers/discovery/router.js
- Added five root-path discovery endpoints:
GET /.well-known/x402GET /openapi.jsonGET /swagger.jsonGET /llms.txtGET /.well-known/agent.json
- Added x402-enabled gating:
- All five endpoints now return
404whenX402_ENABLED=false. - When enabled, payloads are returned with x402-bch v2-oriented metadata.
- All five endpoints now return
- Added apiDoc-derived document builder:
src/discovery/build-documents.js- Parses
@apiannotations and builds OpenAPI, Swagger, llms, and agent documents. - Uses
docs/discovery-artifacts.jsonif present, otherwise builds in-process.
- Added artifact generation script:
scripts/build-discovery-artifacts.js- Writes
docs/discovery-artifacts.json
- Updated npm scripts in
package.json:docs:discoverydocs:all(runsdocsthendocs:discovery)
- Wired discovery routes into server bootstrap:
bin/server.js
- Added tests:
test/unit/controllers/discovery-controller-unit.jstest/unit/controllers/discovery-router-unit.jstest/unit/controllers/discovery-documents-unit.js
- Updated docs/config examples:
README.md(discovery endpoints + docs workflow).env-example(x402 gating note for discovery endpoints)
Why This Was Changed
- Endpoint probes for discovery paths are common from API tooling and AI agents.
- Serving structured discovery metadata improves machine interoperability for:
- API clients and SDK tooling (
openapi.json,swagger.json) - LLM retrieval workflows (
llms.txt) - Agent capability discovery (
agent.json) - x402 payment discovery (
/.well-known/x402)
- API clients and SDK tooling (
- Gating by
X402_ENABLEDkeeps discovery aligned with monetization mode and avoids advertising payment surfaces when x402 is disabled.
Validation Notes
- Lint passed.
- New discovery-focused unit tests passed.
- Full
npm testrun showed one pre-existing timeout failure intest/unit/use-cases/price-use-cases-unit.jsunrelated to discovery endpoint changes.
References
- Local protocol spec:
../x402-bch/specs/x402-bch-specification-v2.2.md
- OpenAPI Specification:
- Swagger / OpenAPI 2.0:
- llms.txt proposal:
- Agent manifest draft reference:
- x402 HTTP 402 background:
- x402 DNS discovery draft: