Skip to content

Pretty-print public agent card JSON responses#316

Merged
GsCommand merged 1 commit into
mainfrom
codex/update-agent-card-json-response-format
May 23, 2026
Merged

Pretty-print public agent card JSON responses#316
GsCommand merged 1 commit into
mainfrom
codex/update-agent-card-json-response-format

Conversation

@GsCommand
Copy link
Copy Markdown
Contributor

Motivation

  • Make public agent card JSON returned at .json URLs human-readable in the browser without changing the card schema or DB.
  • Preserve existing HTTP semantics (404/error JSON shape) and ensure the response remains application/json; charset=utf-8 for clients.

Description

  • Serialize successful card payloads with JSON.stringify(rows[0].card_json, null, 2) so responses are pretty-printed for browser inspection.
  • Leave Content-Type as application/json; charset=utf-8 and keep the existing cache header (Cache-Control: public, max-age=300).
  • Add safe fallbacks to write the serialized string using res.send, res.end, or res.json (in that order) to support different response implementations used in tests and runtimes.
  • Preserve all existing 4xx/5xx JSON error responses and card lookup logic.

Testing

  • Ran npm test and fixed an initial failing test caused by the testing harness lacking res.send; after adding fallbacks all tests passed (95 tests, 0 failures).
  • Ran cd examples/webhook-auto-verify && npm run check and it completed successfully.
  • Confirmed the successful public card response is pretty-printed and that Content-Type remains application/json; charset=utf-8.

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
commandlayer-commandlayer-org Ready Ready Preview, Comment May 23, 2026 11:21pm
commandlayer-org Ready Ready Preview, Comment May 23, 2026 11:21pm
commandlayer-org111 Ready Ready Preview, Comment May 23, 2026 11:21pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant