Skip to content

Latest commit

 

History

History
249 lines (205 loc) · 6.31 KB

File metadata and controls

249 lines (205 loc) · 6.31 KB

AdAgents.json Management UI - Port Summary

Overview

Successfully ported the adagents.json management UI from the AdCP testing framework to the main AdCP registry.

Branch

  • Name: adagents-json-generation
  • Location: /Users/brianokelley/Developer/adcp-1/.conductor/tashkent-v2

Issues Fixed

  1. Missing signals directory: Created /registry/signals/ directory to fix startup error:

    Error: ENOENT: no such file or directory, scandir '/registry/signals'
    
  2. Test coverage: Added comprehensive unit tests for AdAgentsManager class (31 tests)

Files Added

1. server/public/adagents.html (3,362 lines)

  • Complete standalone UI for adagents.json management
  • Features:
    • Domain validation with detailed error/warning reporting
    • Agent card endpoint validation
    • JSON creation with schema and timestamp options
    • Professional glass morphism design
    • No external dependencies (embedded CSS/JS)

2. server/src/adagents-manager.ts (466 lines)

  • Core business logic for adagents.json operations
  • Methods:
    • validateDomain() - Validates a domain's adagents.json file
    • validateAgentCards() - Validates agent card endpoints
    • createAdAgentsJson() - Generates properly formatted JSON
    • validateProposed() - Pre-validates before creation
  • Features HTTP fetching, timeout handling, detailed error messages

Files Modified

1. server/src/types.ts

  • Added complete AdCP v2.2.0 type definitions:
    • AuthorizedAgent, AdAgentsJson
    • Property, PropertyIdentifier, PropertyType, PropertyIdentifierType
    • AdAgentsValidationResult, ValidationError, ValidationWarning
    • AgentCardValidationResult
    • API request/response types

2. server/src/http.ts

  • Added import for AdAgentsManager
  • Added private field and initialization in constructor
  • Added three API endpoints:
    • POST /api/adagents/validate - Validates domain's adagents.json
    • POST /api/adagents/create - Creates formatted adagents.json
    • POST /api/adagents/validate-cards - Validates agent cards
  • Added UI route:
    • GET /adagents - Serves the management UI

3. package.json & package-lock.json

  • Added axios: ^1.12.0 dependency

API Endpoints

POST /api/adagents/validate

Validates a domain's adagents.json file and optionally checks agent cards.

Request:

{
  "domain": "example.com"
}

Response:

{
  "success": true,
  "domain": "example.com",
  "found": true,
  "validation": {
    "valid": true,
    "errors": [],
    "warnings": [],
    "domain": "example.com",
    "url": "https://example.com/.well-known/adagents.json",
    "status_code": 200,
    "raw_data": { ... }
  },
  "agent_cards": [ ... ]
}

POST /api/adagents/create

Creates a properly formatted adagents.json file.

Request:

{
  "authorized_agents": [
    {
      "url": "https://agent.example.com",
      "authorized_for": "Publisher Name"
    }
  ],
  "include_schema": true,
  "include_timestamp": true
}

Response:

{
  "success": true,
  "adagents_json": "{ ... formatted JSON ... }",
  "validation": { ... }
}

POST /api/adagents/validate-cards

Validates agent card endpoints for multiple agents.

Request:

{
  "agents": [
    { "url": "https://agent.example.com", "authorized_for": "Publisher" }
  ]
}

Response:

{
  "success": true,
  "results": [
    {
      "agent_url": "https://agent.example.com",
      "valid": true,
      "status_code": 200,
      "card_data": { ... },
      "card_endpoint": "https://agent.example.com/.well-known/agent-card.json",
      "errors": [],
      "response_time_ms": 123
    }
  ]
}

Testing Results

All tests passed successfully:

  • ✅ Schema validation tests (7/7 passed)
  • ✅ Example validation tests (7/7 passed)
  • ✅ TypeScript compilation (no errors)
  • ✅ Unit tests for AdAgentsManager (31/31 passed)
  • ✅ Integration tests (16/16 passed)
  • ✅ Server startup verified

Test Coverage for AdAgentsManager

Comprehensive test suite added in server/tests/unit/adagents-manager.test.ts:

Domain Validation (8 tests):

  • Valid adagents.json validation
  • Domain normalization (protocol/trailing slash)
  • HTTP 404 detection
  • Network connection errors
  • Request timeout handling
  • Missing/invalid authorized_agents
  • Optional field warnings ($schema, last_updated)

Agent Validation (9 tests):

  • Required url field validation
  • URL format validation
  • HTTPS requirement enforcement
  • Required authorized_for field
  • Empty string detection (treated as missing)
  • Length constraint validation (max 500 chars)
  • property_ids array validation
  • Duplicate URL warnings

Agent Card Validation (6 tests):

  • Successful card validation
  • Standard and root endpoint fallback
  • Missing agent card detection
  • Wrong content-type detection
  • HTML vs JSON detection
  • Parallel validation of multiple agents

JSON Creation (4 tests):

  • Complete JSON with all options
  • Optional schema field
  • Optional timestamp field
  • Proper JSON formatting (2-space indent)

Proposed Validation (4 tests):

  • Pre-validation without HTTP requests
  • Invalid agent detection
  • Empty authorized_for detection
  • Duplicate detection

UI Access

Once the server is running, access the UI at:

  • Development: http://localhost:3000/adagents
  • Production: https://<your-domain>/adagents

Next Steps

  1. Start the server to test the UI:

    cd /Users/brianokelley/Developer/adcp-1/.conductor/tashkent-v2
    npm start
  2. Test the UI:

    • Navigate to http://localhost:3000/adagents
    • Try validating a domain (e.g., adcontextprotocol.org)
    • Create a sample adagents.json file
    • Validate agent card endpoints
  3. Create a pull request:

    git push -u origin adagents-ui-port
    gh pr create --title "feat: add adagents.json management UI" --body "Ports the adagents.json management UI from the testing framework"

Commit Details

Commit SHA: 388a560 Message: feat: port adagents.json management UI from testing framework

Files Changed:

  • 6 files changed
  • 4,054 insertions(+)
  • 15 deletions(-)
  • 2 new files created

Source Repository

Original files ported from:

  • Repository: adcp-client-1 (testing framework)
  • Branch: abuja-v2
  • Location: /Users/brianokelley/conductor/adcp-client-1/.conductor/abuja-v2

Generated: 2025-11-16 Status: ✅ Complete