@dupecom/botcha-cloudflare 0.16.0 → 0.19.0

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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/auth.d.ts +48 -3
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +89 -21
  5. package/dist/dashboard/docs.d.ts +15 -0
  6. package/dist/dashboard/docs.d.ts.map +1 -0
  7. package/dist/dashboard/docs.js +556 -0
  8. package/dist/dashboard/layout.d.ts +12 -0
  9. package/dist/dashboard/layout.d.ts.map +1 -1
  10. package/dist/dashboard/layout.js +12 -5
  11. package/dist/dashboard/showcase.d.ts.map +1 -1
  12. package/dist/dashboard/showcase.js +2 -1
  13. package/dist/dashboard/whitepaper.d.ts.map +1 -1
  14. package/dist/dashboard/whitepaper.js +3 -3
  15. package/dist/index.d.ts +2 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +125 -13
  18. package/dist/static.d.ts +592 -2
  19. package/dist/static.d.ts.map +1 -1
  20. package/dist/static.js +422 -9
  21. package/dist/tap-attestation-routes.d.ts +204 -0
  22. package/dist/tap-attestation-routes.d.ts.map +1 -0
  23. package/dist/tap-attestation-routes.js +396 -0
  24. package/dist/tap-attestation.d.ts +178 -0
  25. package/dist/tap-attestation.d.ts.map +1 -0
  26. package/dist/tap-attestation.js +416 -0
  27. package/dist/tap-delegation-routes.d.ts +236 -0
  28. package/dist/tap-delegation-routes.d.ts.map +1 -0
  29. package/dist/tap-delegation-routes.js +378 -0
  30. package/dist/tap-delegation.d.ts +127 -0
  31. package/dist/tap-delegation.d.ts.map +1 -0
  32. package/dist/tap-delegation.js +490 -0
  33. package/dist/tap-jwks.d.ts +2 -1
  34. package/dist/tap-jwks.d.ts.map +1 -1
  35. package/dist/tap-jwks.js +31 -7
  36. package/dist/tap-reputation-routes.d.ts +154 -0
  37. package/dist/tap-reputation-routes.d.ts.map +1 -0
  38. package/dist/tap-reputation-routes.js +341 -0
  39. package/dist/tap-reputation.d.ts +136 -0
  40. package/dist/tap-reputation.d.ts.map +1 -0
  41. package/dist/tap-reputation.js +346 -0
  42. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../src/static.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAkMzD;AAED,eAAO,MAAM,UAAU,85CAuDtB,CAAC;AAEF,eAAO,MAAM,MAAM,ssdAyOlB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;CAsB1B,CAAC;AAEF,eAAO,MAAM,WAAW,kwBA4BvB,CAAC;AAGF,wBAAgB,qBAAqB,IAAI,MAAM,CAiJ9C;AAGD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAm5C7C"}
package/dist/static.js CHANGED
@@ -110,6 +110,35 @@ curl https://botcha.ai/agent-only -H "Authorization: Bearer <token>"
110
110
  |--------|------|-------------|
111
111
  | \`POST\` | \`/v1/verify/consumer\` | Verify Agentic Consumer (Layer 2) |
112
112
  | \`POST\` | \`/v1/verify/payment\` | Verify Agentic Payment Container (Layer 3) |
113
+ | \`POST\` | \`/v1/verify/delegation\` | Verify delegation chain validity |
114
+ | \`POST\` | \`/v1/verify/attestation\` | Verify attestation token + check capability |
115
+
116
+ ### Delegation Chains
117
+
118
+ | Method | Path | Description |
119
+ |--------|------|-------------|
120
+ | \`POST\` | \`/v1/delegations\` | Create delegation (grantor→grantee) |
121
+ | \`GET\` | \`/v1/delegations/:id\` | Get delegation details |
122
+ | \`GET\` | \`/v1/delegations\` | List delegations for agent |
123
+ | \`POST\` | \`/v1/delegations/:id/revoke\` | Revoke delegation (cascades) |
124
+
125
+ ### Capability Attestation
126
+
127
+ | Method | Path | Description |
128
+ |--------|------|-------------|
129
+ | \`POST\` | \`/v1/attestations\` | Issue attestation token (can/cannot rules) |
130
+ | \`GET\` | \`/v1/attestations/:id\` | Get attestation details |
131
+ | \`GET\` | \`/v1/attestations\` | List attestations for agent |
132
+ | \`POST\` | \`/v1/attestations/:id/revoke\` | Revoke attestation |
133
+
134
+ ### Agent Reputation Scoring
135
+
136
+ | Method | Path | Description |
137
+ |--------|------|-------------|
138
+ | \`GET\` | \`/v1/reputation/:agent_id\` | Get agent reputation score |
139
+ | \`POST\` | \`/v1/reputation/events\` | Record a reputation event |
140
+ | \`GET\` | \`/v1/reputation/:agent_id/events\` | List reputation events |
141
+ | \`POST\` | \`/v1/reputation/:agent_id/reset\` | Reset reputation (admin) |
113
142
 
114
143
  ### Challenges
115
144
 
@@ -128,6 +157,7 @@ curl https://botcha.ai/agent-only -H "Authorization: Bearer <token>"
128
157
  | \`POST\` | \`/v1/token/verify\` | Submit solution → access_token (5min) + refresh_token (1hr) |
129
158
  | \`POST\` | \`/v1/token/refresh\` | Refresh access token |
130
159
  | \`POST\` | \`/v1/token/revoke\` | Revoke a token |
160
+ | \`POST\` | \`/v1/token/validate\` | Validate a token remotely (no shared secret needed) |
131
161
 
132
162
  ### Dashboard & Auth
133
163
 
@@ -153,7 +183,17 @@ curl https://botcha.ai/agent-only -H "Authorization: Bearer <token>"
153
183
 
154
184
  **Token lifetimes:** access_token = 5 minutes, refresh_token = 1 hour
155
185
 
156
- **Features:** audience claims, client IP binding, token revocation, refresh tokens
186
+ **Token signing:** ES256 (ECDSA P-256) asymmetric signing. HS256 supported for backward compatibility.
187
+
188
+ **Features:** audience claims, client IP binding, token revocation, refresh tokens, JWKS public key discovery
189
+
190
+ ## Token Verification (for API providers)
191
+
192
+ Three ways to verify incoming BOTCHA tokens:
193
+
194
+ 1. **JWKS (Recommended)** — Fetch public keys from \`GET /.well-known/jwks\` and verify ES256 signatures locally. No shared secret needed.
195
+ 2. **Remote Validation** — \`POST /v1/token/validate\` with \`{"token": "..."}\`. Simplest approach, no SDK needed.
196
+ 3. **Shared Secret (Legacy)** — Verify HS256 tokens with \`BOTCHA_SECRET\`. Requires secret sharing.
157
197
 
158
198
  ## RTT-Aware Challenges
159
199
 
@@ -171,7 +211,7 @@ Formula: \`timeout = 500ms + (2 × RTT) + 100ms buffer\`
171
211
  |----------|---------|---------|
172
212
  | npm | \`@dupecom/botcha\` | \`npm install @dupecom/botcha\` |
173
213
  | PyPI | \`botcha\` | \`pip install botcha\` |
174
- | Verify (TS) | \`@botcha/verify\` | \`npm install @botcha/verify\` |
214
+ | Verify (TS) | \`@dupecom/botcha-verify\` | \`npm install @dupecom/botcha-verify\` |
175
215
  | Verify (Python) | \`botcha-verify\` | \`pip install botcha-verify\` |
176
216
  | TAP middleware | \`@dupecom/botcha/middleware\` | \`import { createTAPVerifyMiddleware } from '@dupecom/botcha/middleware'\` |
177
217
 
@@ -286,6 +326,7 @@ API-Format: OpenAPI 3.1.0
286
326
 
287
327
  # Documentation
288
328
  Docs: https://botcha.ai
329
+ Docs: https://botcha.ai/docs
289
330
  Docs: https://botcha.ai/whitepaper
290
331
  Docs: https://github.com/dupe-com/botcha#readme
291
332
  Docs: https://www.npmjs.com/package/@dupecom/botcha
@@ -302,7 +343,7 @@ Feature: Token Rotation (5-minute access tokens + 1-hour refresh tokens)
302
343
  Feature: Audience Claims (tokens scoped to specific services)
303
344
  Feature: Client IP Binding (optional token-to-IP binding)
304
345
  Feature: Token Revocation (invalidate tokens before expiry)
305
- Feature: Server-Side Verification SDK (@botcha/verify for TS, botcha-verify for Python)
346
+ Feature: Server-Side Verification SDK (@dupecom/botcha-verify for TS, botcha-verify for Python)
306
347
  Feature: Multi-Tenant API Keys (per-app isolation, rate limiting, and token scoping)
307
348
  Feature: Per-App Metrics Dashboard (server-rendered at /dashboard, htmx-powered)
308
349
  Feature: Email-Tied App Creation (email required, 6-digit verification, account recovery)
@@ -314,6 +355,9 @@ Feature: TAP Capabilities (action + resource scoping for agent sessions)
314
355
  Feature: TAP Trust Levels (basic, verified, enterprise)
315
356
  Feature: TAP Showcase Homepage (botcha.ai — one of the first services to implement Visa's Trusted Agent Protocol)
316
357
  Feature: TAP Full Spec v0.16.0 — Ed25519, RFC 9421 full compliance, JWKS infrastructure, Layer 2 Consumer Recognition, Layer 3 Payment Container, 402 micropayments, CDN edge verification, Visa key federation
358
+ Feature: ES256 Asymmetric JWT Signing v0.19.0 — tokens signed with ES256 (ECDSA P-256), public key discovery via JWKS, HS256 still supported for backward compatibility
359
+ Feature: Remote Token Validation v0.19.0 — POST /v1/token/validate for third-party token verification without shared secrets
360
+ Feature: JWKS Public Key Discovery v0.19.0 — GET /.well-known/jwks exposes BOTCHA signing public keys for offline token verification
317
361
 
318
362
  # Endpoints
319
363
  # Challenge Endpoints
@@ -329,6 +373,7 @@ Endpoint: GET https://botcha.ai/v1/token - Get challenge for JWT token flow
329
373
  Endpoint: POST https://botcha.ai/v1/token/verify - Verify challenge and receive JWT token
330
374
  Endpoint: POST https://botcha.ai/v1/token/refresh - Refresh access token using refresh token
331
375
  Endpoint: POST https://botcha.ai/v1/token/revoke - Revoke a token (access or refresh)
376
+ Endpoint: POST https://botcha.ai/v1/token/validate - Validate a BOTCHA token remotely (no shared secret needed)
332
377
 
333
378
  # Multi-Tenant Endpoints
334
379
  Endpoint: POST https://botcha.ai/v1/apps - Create new app (email required, returns app_id + app_secret)
@@ -383,6 +428,26 @@ Endpoint: POST https://botcha.ai/v1/invoices/:id/verify-iou - Verify Browsing IO
383
428
  Endpoint: POST https://botcha.ai/v1/verify/consumer - Verify Agentic Consumer object (Layer 2)
384
429
  Endpoint: POST https://botcha.ai/v1/verify/payment - Verify Agentic Payment Container (Layer 3)
385
430
 
431
+ # TAP Delegation Chains (v0.17.0)
432
+ Endpoint: POST https://botcha.ai/v1/delegations - Create delegation (grantor→grantee with capability subset)
433
+ Endpoint: GET https://botcha.ai/v1/delegations/:id - Get delegation details
434
+ Endpoint: GET https://botcha.ai/v1/delegations - List delegations for agent (?agent_id=&direction=in|out|both)
435
+ Endpoint: POST https://botcha.ai/v1/delegations/:id/revoke - Revoke delegation (cascades to sub-delegations)
436
+ Endpoint: POST https://botcha.ai/v1/verify/delegation - Verify entire delegation chain
437
+
438
+ # TAP Capability Attestation (v0.17.0)
439
+ Endpoint: POST https://botcha.ai/v1/attestations - Issue capability attestation token (can/cannot rules with action:resource patterns)
440
+ Endpoint: GET https://botcha.ai/v1/attestations/:id - Get attestation details
441
+ Endpoint: GET https://botcha.ai/v1/attestations - List attestations for agent (?agent_id=)
442
+ Endpoint: POST https://botcha.ai/v1/attestations/:id/revoke - Revoke attestation (token rejected on future verification)
443
+ Endpoint: POST https://botcha.ai/v1/verify/attestation - Verify attestation token + optionally check specific capability
444
+
445
+ # Agent Reputation Scoring (v0.18.0)
446
+ Endpoint: GET https://botcha.ai/v1/reputation/:agent_id - Get agent reputation score (0-1000, 5 tiers)
447
+ Endpoint: POST https://botcha.ai/v1/reputation/events - Record a reputation event (18 action types, 6 categories)
448
+ Endpoint: GET https://botcha.ai/v1/reputation/:agent_id/events - List reputation events (?category=&limit=)
449
+ Endpoint: POST https://botcha.ai/v1/reputation/:agent_id/reset - Reset reputation to default (admin action)
450
+
386
451
  # Legacy Endpoints
387
452
  Endpoint: GET https://botcha.ai/api/challenge - Generate standard challenge
388
453
  Endpoint: POST https://botcha.ai/api/challenge - Verify standard challenge
@@ -395,7 +460,7 @@ Endpoint: GET https://botcha.ai/agent-only - Protected AI-only resource
395
460
  # Usage
396
461
  Install-NPM: npm install @dupecom/botcha
397
462
  Install-Python: pip install botcha
398
- Verify-NPM: npm install @botcha/verify
463
+ Verify-NPM: npm install @dupecom/botcha-verify
399
464
  Verify-Python: pip install botcha-verify
400
465
  License: MIT
401
466
 
@@ -418,6 +483,10 @@ Content-Negotiation-Example: curl https://botcha.ai -H "Accept: text/markdown"
418
483
  Content-Negotiation-Benefit: 80% fewer tokens vs HTML — ideal for LLM context windows
419
484
 
420
485
  # JWT TOKEN SECURITY
486
+ Token-Signing: ES256 (ECDSA P-256) asymmetric signing by default. HS256 still supported for backward compatibility.
487
+ Token-JWKS: GET /.well-known/jwks — public keys for offline token verification (no shared secret needed)
488
+ Token-Validate: POST /v1/token/validate with {"token": "<token>"} — remote validation without shared secret
489
+ Token-Verify-Modes: 1. JWKS (recommended, offline) 2. Remote validation (/v1/token/validate) 3. Shared secret (legacy HS256)
421
490
  Token-Flow: 1. GET /v1/token (get challenge) → 2. Solve → 3. POST /v1/token/verify (get tokens + human_link)
422
491
  Token-Human-Link: /v1/token/verify response includes human_link — give this URL to your human for one-click browser access
423
492
  Token-Access-Expiry: 5 minutes (short-lived for security)
@@ -461,8 +530,8 @@ TAP-Session-Get: GET /v1/sessions/:id/tap — includes time_remaining
461
530
  TAP-Get-Agent: GET /v1/agents/:id/tap — includes public_key for verification
462
531
  TAP-List-Agents: GET /v1/agents/tap?app_id=...&tap_only=true
463
532
  TAP-Middleware-Modes: tap, signature-only, challenge-only, flexible
464
- TAP-SDK-TS: registerTAPAgent(options), getTAPAgent(agentId), listTAPAgents(tapOnly?), createTAPSession(options), getTAPSession(sessionId), getJWKS(), getKeyById(keyId), rotateAgentKey(agentId), createInvoice(data), getInvoice(id), verifyBrowsingIOU(invoiceId, token)
465
- TAP-SDK-Python: register_tap_agent(name, ...), get_tap_agent(agent_id), list_tap_agents(tap_only?), create_tap_session(agent_id, user_context, intent), get_tap_session(session_id), get_jwks(), get_key_by_id(key_id), rotate_agent_key(agent_id), create_invoice(data), get_invoice(id), verify_browsing_iou(invoice_id, token)
533
+ TAP-SDK-TS: registerTAPAgent(options), getTAPAgent(agentId), listTAPAgents(tapOnly?), createTAPSession(options), getTAPSession(sessionId), getJWKS(), getKeyById(keyId), rotateAgentKey(agentId), createInvoice(data), getInvoice(id), verifyBrowsingIOU(invoiceId, token), createDelegation(options), getDelegation(id), listDelegations(agentId, options?), revokeDelegation(id, reason?), verifyDelegationChain(id), issueAttestation(options), getAttestation(id), listAttestations(agentId), revokeAttestation(id, reason?), verifyAttestation(token, action?, resource?), getReputation(agentId), recordReputationEvent(options), listReputationEvents(agentId, options?), resetReputation(agentId)
534
+ TAP-SDK-Python: register_tap_agent(name, ...), get_tap_agent(agent_id), list_tap_agents(tap_only?), create_tap_session(agent_id, user_context, intent), get_tap_session(session_id), get_jwks(), get_key_by_id(key_id), rotate_agent_key(agent_id), create_invoice(data), get_invoice(id), verify_browsing_iou(invoice_id, token), create_delegation(grantor_id, grantee_id, capabilities, ...), get_delegation(id), list_delegations(agent_id, ...), revoke_delegation(id, reason?), verify_delegation_chain(id), issue_attestation(agent_id, can, cannot?, ...), get_attestation(id), list_attestations(agent_id), revoke_attestation(id, reason?), verify_attestation(token, action?, resource?), get_reputation(agent_id), record_reputation_event(agent_id, category, action, ...), list_reputation_events(agent_id, category?, limit?), reset_reputation(agent_id)
466
535
  TAP-Middleware-Import: import { createTAPVerifyMiddleware } from '@dupecom/botcha/middleware'
467
536
 
468
537
  # TAP FULL SPEC v0.16.0
@@ -476,6 +545,10 @@ TAP-Key-Rotation: POST /v1/agents/:id/tap/rotate-key — rotate keys, invalidate
476
545
  TAP-402-Flow: POST /v1/invoices → GET /v1/invoices/:id → POST /v1/invoices/:id/verify-iou
477
546
  TAP-Edge-Verify: createTAPEdgeMiddleware for Cloudflare Workers CDN edge verification
478
547
  TAP-Visa-Federation: Trust keys from https://mcp.visa.com/.well-known/jwks (3-tier cache: memory → KV → HTTP)
548
+ TAP-Delegation: POST /v1/delegations → GET /v1/delegations/:id → POST /v1/delegations/:id/revoke → POST /v1/verify/delegation
549
+ TAP-Attestation: POST /v1/attestations → GET /v1/attestations/:id → POST /v1/attestations/:id/revoke → POST /v1/verify/attestation
550
+ TAP-Attestation-Patterns: action:resource format with wildcards (*:*, read:*, *:invoices), deny takes precedence over allow
551
+ TAP-Attestation-Middleware: requireCapability('read:invoices') — Hono middleware, extracts token from X-Botcha-Attestation or Authorization: Bearer
479
552
 
480
553
  # EMBEDDED CHALLENGE (for bots visiting HTML pages)
481
554
  Embedded-Challenge: <script type="application/botcha+json">
@@ -540,6 +613,11 @@ export const SITEMAP_XML = `<?xml version="1.0" encoding="UTF-8"?>
540
613
  <changefreq>monthly</changefreq>
541
614
  <priority>0.9</priority>
542
615
  </url>
616
+ <url>
617
+ <loc>https://botcha.ai/docs</loc>
618
+ <changefreq>weekly</changefreq>
619
+ <priority>0.9</priority>
620
+ </url>
543
621
  </urlset>
544
622
  `;
545
623
  // Whitepaper markdown — served at /whitepaper with Accept: text/markdown
@@ -650,7 +728,7 @@ async with BotchaClient() as client:
650
728
 
651
729
  ### Server-side Verification
652
730
 
653
- Express: \`@botcha/verify\` · FastAPI/Django: \`botcha-verify\` · Hono middleware included.
731
+ Express: \`@dupecom/botcha-verify\` · FastAPI/Django: \`botcha-verify\` · Hono middleware included.
654
732
 
655
733
  ### CLI
656
734
 
@@ -682,7 +760,7 @@ MCP gives agents tools. A2A lets agents communicate. TAP proves identity and sco
682
760
 
683
761
  **Shipped:** Challenge types, JWT tokens, multi-tenant apps, agent registry, TAP, dashboard, SDKs (TS/Python), CLI, LangChain, discovery standards.
684
762
 
685
- **Planned:** Delegation chains, capability attestation, agent reputation scoring, Agent SSO (cross-service verification), IETF RFC contribution.
763
+ **Planned:** Agent SSO (cross-service verification), IETF RFC contribution.
686
764
 
687
765
  ---
688
766
 
@@ -708,7 +786,7 @@ export function getOpenApiSpec(version) {
708
786
  "x-sdk": {
709
787
  npm: "@dupecom/botcha",
710
788
  python: "botcha (pip install botcha)",
711
- verify_npm: "@botcha/verify (server-side verification)",
789
+ verify_npm: "@dupecom/botcha-verify (server-side verification)",
712
790
  verify_python: "botcha-verify (pip install botcha-verify)"
713
791
  }
714
792
  },
@@ -944,6 +1022,44 @@ export function getOpenApiSpec(version) {
944
1022
  }
945
1023
  }
946
1024
  },
1025
+ "/v1/token/validate": {
1026
+ post: {
1027
+ summary: "Validate a BOTCHA token remotely",
1028
+ description: "Validate a BOTCHA token without needing the signing secret. Returns the token validity and decoded payload. Supports both ES256 and HS256 tokens.",
1029
+ operationId: "validateToken",
1030
+ requestBody: {
1031
+ required: true,
1032
+ content: {
1033
+ "application/json": {
1034
+ schema: {
1035
+ type: "object",
1036
+ required: ["token"],
1037
+ properties: {
1038
+ "token": { type: "string", description: "The JWT token to validate" }
1039
+ }
1040
+ }
1041
+ }
1042
+ }
1043
+ },
1044
+ responses: {
1045
+ "200": {
1046
+ description: "Token validation result",
1047
+ content: {
1048
+ "application/json": {
1049
+ schema: {
1050
+ type: "object",
1051
+ properties: {
1052
+ "valid": { type: "boolean", description: "Whether the token is valid" },
1053
+ "payload": { type: "object", description: "Decoded token payload (if valid)" },
1054
+ "error": { type: "string", description: "Error message (if invalid)" }
1055
+ }
1056
+ }
1057
+ }
1058
+ }
1059
+ }
1060
+ }
1061
+ }
1062
+ },
947
1063
  "/v1/hybrid": {
948
1064
  get: {
949
1065
  summary: "Get hybrid challenge",
@@ -1752,6 +1868,303 @@ export function getOpenApiSpec(version) {
1752
1868
  "400": { description: "Invalid payment container" }
1753
1869
  }
1754
1870
  }
1871
+ },
1872
+ "/v1/delegations": {
1873
+ post: {
1874
+ summary: "Create delegation",
1875
+ description: "Create a delegation from one agent to another. Grants a subset of the grantor's capabilities to the grantee.",
1876
+ operationId: "createDelegation",
1877
+ parameters: [{ name: "app_id", in: "query", required: true, schema: { type: "string" } }],
1878
+ requestBody: {
1879
+ required: true,
1880
+ content: {
1881
+ "application/json": {
1882
+ schema: {
1883
+ type: "object",
1884
+ required: ["grantor_id", "grantee_id", "capabilities"],
1885
+ properties: {
1886
+ "grantor_id": { type: "string", description: "Agent granting capabilities" },
1887
+ "grantee_id": { type: "string", description: "Agent receiving capabilities" },
1888
+ "capabilities": { type: "array", items: { type: "object" }, description: "Capabilities to delegate (subset of grantor's)" },
1889
+ "duration_seconds": { type: "integer", description: "Duration in seconds (default: 3600)" },
1890
+ "max_depth": { type: "integer", description: "Max sub-delegation depth (default: 3)" },
1891
+ "parent_delegation_id": { type: "string", description: "Parent delegation ID for sub-delegation" },
1892
+ "metadata": { type: "object", description: "Optional context metadata" }
1893
+ }
1894
+ }
1895
+ }
1896
+ }
1897
+ },
1898
+ responses: {
1899
+ "201": { description: "Delegation created" },
1900
+ "400": { description: "Invalid request or capability escalation" },
1901
+ "403": { description: "Insufficient capabilities or depth limit" },
1902
+ "409": { description: "Cycle detected in chain" }
1903
+ }
1904
+ },
1905
+ get: {
1906
+ summary: "List delegations",
1907
+ description: "List delegations for an agent.",
1908
+ operationId: "listDelegations",
1909
+ parameters: [
1910
+ { name: "app_id", in: "query", required: true, schema: { type: "string" } },
1911
+ { name: "agent_id", in: "query", required: true, schema: { type: "string" } },
1912
+ { name: "direction", in: "query", schema: { type: "string", enum: ["in", "out", "both"] } },
1913
+ { name: "include_revoked", in: "query", schema: { type: "boolean" } },
1914
+ { name: "include_expired", in: "query", schema: { type: "boolean" } }
1915
+ ],
1916
+ responses: {
1917
+ "200": { description: "Delegation list" }
1918
+ }
1919
+ }
1920
+ },
1921
+ "/v1/delegations/{id}": {
1922
+ get: {
1923
+ summary: "Get delegation details",
1924
+ operationId: "getDelegation",
1925
+ parameters: [{ name: "id", in: "path", required: true, schema: { type: "string" } }],
1926
+ responses: {
1927
+ "200": { description: "Delegation details" },
1928
+ "404": { description: "Delegation not found or expired" }
1929
+ }
1930
+ }
1931
+ },
1932
+ "/v1/delegations/{id}/revoke": {
1933
+ post: {
1934
+ summary: "Revoke delegation",
1935
+ description: "Revoke a delegation and cascade to all sub-delegations.",
1936
+ operationId: "revokeDelegation",
1937
+ parameters: [
1938
+ { name: "id", in: "path", required: true, schema: { type: "string" } },
1939
+ { name: "app_id", in: "query", required: true, schema: { type: "string" } }
1940
+ ],
1941
+ requestBody: {
1942
+ content: {
1943
+ "application/json": {
1944
+ schema: {
1945
+ type: "object",
1946
+ properties: {
1947
+ "reason": { type: "string", description: "Revocation reason" }
1948
+ }
1949
+ }
1950
+ }
1951
+ }
1952
+ },
1953
+ responses: {
1954
+ "200": { description: "Delegation revoked" },
1955
+ "404": { description: "Delegation not found" }
1956
+ }
1957
+ }
1958
+ },
1959
+ "/v1/verify/delegation": {
1960
+ post: {
1961
+ summary: "Verify delegation chain",
1962
+ description: "Verify an entire delegation chain is valid (not revoked, not expired, capabilities are valid subsets).",
1963
+ operationId: "verifyDelegationChain",
1964
+ requestBody: {
1965
+ required: true,
1966
+ content: {
1967
+ "application/json": {
1968
+ schema: {
1969
+ type: "object",
1970
+ required: ["delegation_id"],
1971
+ properties: {
1972
+ "delegation_id": { type: "string", description: "The leaf delegation to verify" }
1973
+ }
1974
+ }
1975
+ }
1976
+ }
1977
+ },
1978
+ responses: {
1979
+ "200": { description: "Chain is valid — returns chain and effective capabilities" },
1980
+ "400": { description: "Chain is invalid — returns error reason" }
1981
+ }
1982
+ }
1983
+ },
1984
+ "/v1/attestations": {
1985
+ post: {
1986
+ summary: "Issue attestation",
1987
+ description: "Issue a capability attestation token for an agent. Grants fine-grained action:resource permissions with explicit deny.",
1988
+ operationId: "issueAttestation",
1989
+ requestBody: {
1990
+ required: true,
1991
+ content: {
1992
+ "application/json": {
1993
+ schema: {
1994
+ type: "object",
1995
+ required: ["agent_id", "can"],
1996
+ properties: {
1997
+ "agent_id": { type: "string", description: "Agent to issue attestation for" },
1998
+ "can": { type: "array", items: { type: "string" }, description: "Allowed capability patterns (action:resource)" },
1999
+ "cannot": { type: "array", items: { type: "string" }, description: "Denied capability patterns (overrides can)" },
2000
+ "restrictions": { type: "object", description: "Optional restrictions (max_amount, rate_limit)" },
2001
+ "duration_seconds": { type: "integer", description: "Attestation lifetime (default: 3600)" },
2002
+ "delegation_id": { type: "string", description: "Optional link to delegation chain" },
2003
+ "metadata": { type: "object", description: "Optional context metadata" }
2004
+ }
2005
+ }
2006
+ }
2007
+ }
2008
+ },
2009
+ responses: {
2010
+ "201": { description: "Attestation issued — includes signed JWT token" },
2011
+ "400": { description: "Invalid request" },
2012
+ "403": { description: "Agent does not belong to app" },
2013
+ "404": { description: "Agent not found" }
2014
+ }
2015
+ },
2016
+ get: {
2017
+ summary: "List attestations",
2018
+ description: "List attestations for an agent.",
2019
+ operationId: "listAttestations",
2020
+ parameters: [
2021
+ { name: "app_id", in: "query", required: true, schema: { type: "string" } },
2022
+ { name: "agent_id", in: "query", required: true, schema: { type: "string" } }
2023
+ ],
2024
+ responses: {
2025
+ "200": { description: "Attestation list" }
2026
+ }
2027
+ }
2028
+ },
2029
+ "/v1/attestations/{id}": {
2030
+ get: {
2031
+ summary: "Get attestation details",
2032
+ operationId: "getAttestation",
2033
+ parameters: [{ name: "id", in: "path", required: true, schema: { type: "string" } }],
2034
+ responses: {
2035
+ "200": { description: "Attestation details" },
2036
+ "404": { description: "Attestation not found or expired" }
2037
+ }
2038
+ }
2039
+ },
2040
+ "/v1/attestations/{id}/revoke": {
2041
+ post: {
2042
+ summary: "Revoke attestation",
2043
+ description: "Revoke an attestation. Token will be rejected on future verification.",
2044
+ operationId: "revokeAttestation",
2045
+ parameters: [
2046
+ { name: "id", in: "path", required: true, schema: { type: "string" } },
2047
+ { name: "app_id", in: "query", required: true, schema: { type: "string" } }
2048
+ ],
2049
+ requestBody: {
2050
+ content: {
2051
+ "application/json": {
2052
+ schema: {
2053
+ type: "object",
2054
+ properties: {
2055
+ "reason": { type: "string", description: "Revocation reason" }
2056
+ }
2057
+ }
2058
+ }
2059
+ }
2060
+ },
2061
+ responses: {
2062
+ "200": { description: "Attestation revoked" },
2063
+ "404": { description: "Attestation not found" }
2064
+ }
2065
+ }
2066
+ },
2067
+ "/v1/verify/attestation": {
2068
+ post: {
2069
+ summary: "Verify attestation token",
2070
+ description: "Verify an attestation JWT token and optionally check a specific capability.",
2071
+ operationId: "verifyAttestation",
2072
+ requestBody: {
2073
+ required: true,
2074
+ content: {
2075
+ "application/json": {
2076
+ schema: {
2077
+ type: "object",
2078
+ required: ["token"],
2079
+ properties: {
2080
+ "token": { type: "string", description: "Attestation JWT token" },
2081
+ "action": { type: "string", description: "Optional capability action to check (e.g. read)" },
2082
+ "resource": { type: "string", description: "Optional capability resource to check (e.g. invoices)" }
2083
+ }
2084
+ }
2085
+ }
2086
+ }
2087
+ },
2088
+ responses: {
2089
+ "200": { description: "Token valid — returns payload or capability check result" },
2090
+ "401": { description: "Invalid or expired token" },
2091
+ "403": { description: "Capability denied" }
2092
+ }
2093
+ }
2094
+ },
2095
+ "/v1/reputation/{agent_id}": {
2096
+ get: {
2097
+ summary: "Get agent reputation",
2098
+ description: "Get the reputation score for an agent. Returns score (0-1000), tier, event counts, and category breakdown.",
2099
+ operationId: "getReputation",
2100
+ parameters: [
2101
+ { name: "agent_id", in: "path", required: true, schema: { type: "string" }, description: "Agent ID" },
2102
+ { name: "app_id", in: "query", schema: { type: "string" }, description: "App ID for authentication" }
2103
+ ],
2104
+ responses: {
2105
+ "200": { description: "Reputation score with tier and category breakdown" },
2106
+ "404": { description: "Agent not found" }
2107
+ }
2108
+ }
2109
+ },
2110
+ "/v1/reputation/events": {
2111
+ post: {
2112
+ summary: "Record reputation event",
2113
+ description: "Record a behavioral event that affects an agent's reputation score. 18 action types across 6 categories.",
2114
+ operationId: "recordReputationEvent",
2115
+ requestBody: {
2116
+ required: true,
2117
+ content: {
2118
+ "application/json": {
2119
+ schema: {
2120
+ type: "object",
2121
+ required: ["agent_id", "category", "action"],
2122
+ properties: {
2123
+ "agent_id": { type: "string", description: "Agent to record event for" },
2124
+ "category": { type: "string", enum: ["verification", "attestation", "delegation", "session", "violation", "endorsement"], description: "Event category" },
2125
+ "action": { type: "string", description: "Event action (e.g. challenge_solved, abuse_detected)" },
2126
+ "source_agent_id": { type: "string", description: "Source agent for endorsements" },
2127
+ "metadata": { type: "object", additionalProperties: { type: "string" }, description: "Optional key/value metadata" }
2128
+ }
2129
+ }
2130
+ }
2131
+ }
2132
+ },
2133
+ responses: {
2134
+ "201": { description: "Event recorded — returns event details and updated score" },
2135
+ "400": { description: "Invalid category/action or self-endorsement" },
2136
+ "404": { description: "Agent not found" }
2137
+ }
2138
+ }
2139
+ },
2140
+ "/v1/reputation/{agent_id}/events": {
2141
+ get: {
2142
+ summary: "List reputation events",
2143
+ description: "List reputation events for an agent with optional category filter.",
2144
+ operationId: "listReputationEvents",
2145
+ parameters: [
2146
+ { name: "agent_id", in: "path", required: true, schema: { type: "string" }, description: "Agent ID" },
2147
+ { name: "category", in: "query", schema: { type: "string" }, description: "Filter by category" },
2148
+ { name: "limit", in: "query", schema: { type: "integer", maximum: 100 }, description: "Max events (default: 50, max: 100)" }
2149
+ ],
2150
+ responses: {
2151
+ "200": { description: "List of reputation events" }
2152
+ }
2153
+ }
2154
+ },
2155
+ "/v1/reputation/{agent_id}/reset": {
2156
+ post: {
2157
+ summary: "Reset reputation",
2158
+ description: "Reset an agent's reputation to default (500 neutral). Admin action — clears all event history.",
2159
+ operationId: "resetReputation",
2160
+ parameters: [
2161
+ { name: "agent_id", in: "path", required: true, schema: { type: "string" }, description: "Agent ID" }
2162
+ ],
2163
+ responses: {
2164
+ "200": { description: "Reputation reset to default" },
2165
+ "404": { description: "Agent not found" }
2166
+ }
2167
+ }
1755
2168
  }
1756
2169
  },
1757
2170
  components: {