@dupecom/botcha-cloudflare 0.20.2 → 0.23.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 (88) hide show
  1. package/README.md +74 -9
  2. package/dist/agent-auth.d.ts +129 -0
  3. package/dist/agent-auth.d.ts.map +1 -0
  4. package/dist/agent-auth.js +210 -0
  5. package/dist/agents.d.ts +10 -0
  6. package/dist/agents.d.ts.map +1 -1
  7. package/dist/agents.js +51 -1
  8. package/dist/app-gate.d.ts +6 -0
  9. package/dist/app-gate.d.ts.map +1 -0
  10. package/dist/app-gate.js +69 -0
  11. package/dist/apps.d.ts +13 -4
  12. package/dist/apps.d.ts.map +1 -1
  13. package/dist/apps.js +30 -4
  14. package/dist/dashboard/account.d.ts +63 -0
  15. package/dist/dashboard/account.d.ts.map +1 -0
  16. package/dist/dashboard/account.js +488 -0
  17. package/dist/dashboard/api.js +15 -68
  18. package/dist/dashboard/auth.d.ts.map +1 -1
  19. package/dist/dashboard/auth.js +14 -14
  20. package/dist/dashboard/docs.d.ts.map +1 -1
  21. package/dist/dashboard/docs.js +146 -3
  22. package/dist/dashboard/layout.d.ts.map +1 -1
  23. package/dist/dashboard/layout.js +2 -2
  24. package/dist/dashboard/mcp-setup.d.ts +15 -0
  25. package/dist/dashboard/mcp-setup.d.ts.map +1 -0
  26. package/dist/dashboard/mcp-setup.js +391 -0
  27. package/dist/dashboard/showcase.d.ts +6 -10
  28. package/dist/dashboard/showcase.d.ts.map +1 -1
  29. package/dist/dashboard/showcase.js +67 -991
  30. package/dist/dashboard/whitepaper.d.ts.map +1 -1
  31. package/dist/dashboard/whitepaper.js +42 -4
  32. package/dist/index.d.ts +5 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +660 -83
  35. package/dist/mcp.d.ts +20 -0
  36. package/dist/mcp.d.ts.map +1 -0
  37. package/dist/mcp.js +1290 -0
  38. package/dist/oauth-agent.d.ts +130 -0
  39. package/dist/oauth-agent.d.ts.map +1 -0
  40. package/dist/oauth-agent.js +194 -0
  41. package/dist/static.d.ts +781 -5
  42. package/dist/static.d.ts.map +1 -1
  43. package/dist/static.js +790 -111
  44. package/dist/tap-a2a-routes.d.ts +355 -0
  45. package/dist/tap-a2a-routes.d.ts.map +1 -0
  46. package/dist/tap-a2a-routes.js +475 -0
  47. package/dist/tap-a2a.d.ts +199 -0
  48. package/dist/tap-a2a.d.ts.map +1 -0
  49. package/dist/tap-a2a.js +502 -0
  50. package/dist/tap-agents.d.ts +15 -0
  51. package/dist/tap-agents.d.ts.map +1 -1
  52. package/dist/tap-agents.js +31 -1
  53. package/dist/tap-ans-routes.d.ts +302 -0
  54. package/dist/tap-ans-routes.d.ts.map +1 -0
  55. package/dist/tap-ans-routes.js +535 -0
  56. package/dist/tap-ans.d.ts +241 -0
  57. package/dist/tap-ans.d.ts.map +1 -0
  58. package/dist/tap-ans.js +481 -0
  59. package/dist/tap-delegation-routes.d.ts.map +1 -1
  60. package/dist/tap-delegation-routes.js +11 -0
  61. package/dist/tap-did.d.ts +140 -0
  62. package/dist/tap-did.d.ts.map +1 -0
  63. package/dist/tap-did.js +262 -0
  64. package/dist/tap-oidca-routes.d.ts +383 -0
  65. package/dist/tap-oidca-routes.d.ts.map +1 -0
  66. package/dist/tap-oidca-routes.js +597 -0
  67. package/dist/tap-oidca.d.ts +288 -0
  68. package/dist/tap-oidca.d.ts.map +1 -0
  69. package/dist/tap-oidca.js +461 -0
  70. package/dist/tap-routes.d.ts +24 -8
  71. package/dist/tap-routes.d.ts.map +1 -1
  72. package/dist/tap-routes.js +169 -23
  73. package/dist/tap-vc-routes.d.ts +358 -0
  74. package/dist/tap-vc-routes.d.ts.map +1 -0
  75. package/dist/tap-vc-routes.js +367 -0
  76. package/dist/tap-vc.d.ts +125 -0
  77. package/dist/tap-vc.d.ts.map +1 -0
  78. package/dist/tap-vc.js +245 -0
  79. package/dist/tap-x402-routes.d.ts +89 -0
  80. package/dist/tap-x402-routes.d.ts.map +1 -0
  81. package/dist/tap-x402-routes.js +579 -0
  82. package/dist/tap-x402.d.ts +222 -0
  83. package/dist/tap-x402.d.ts.map +1 -0
  84. package/dist/tap-x402.js +546 -0
  85. package/dist/webhooks.d.ts +99 -0
  86. package/dist/webhooks.d.ts.map +1 -0
  87. package/dist/webhooks.js +642 -0
  88. package/package.json +3 -1
@@ -471,83 +471,30 @@ function formatTimeBucket(timestamp, period) {
471
471
  return timestamp.substring(0, 16);
472
472
  }
473
473
  }
474
- // ============ MOCK DATA (when CF_API_TOKEN not configured) ============
475
- function renderSampleBanner() {
476
- return `<div class="sample-banner">Sample data — analytics will appear here once production traffic flows</div>`;
477
- }
478
- function renderSampleLegend(title, period) {
479
- return `${title} (${period})<span class="sample-tag">SAMPLE</span>`;
480
- }
481
- function renderMockOverview(period) {
482
- return `${renderSampleBanner()}
483
- <div class="dashboard-grid">
484
- ${renderStatCard('1,247', 'Challenges Generated')}
485
- ${renderStatCard('1,089', 'Verifications')}
486
- ${renderStatCard('94%', 'Success Rate', 'text-success')}
487
- ${renderStatCard('127ms', 'Avg Solve Time')}
488
- ${renderStatCard('3', 'Rate Limits Hit', 'text-warning')}
489
- ${renderStatCard('0', 'Errors')}
474
+ // ============ EMPTY STATES (when CF_API_TOKEN not configured or no data yet) ============
475
+ const EMPTY_MSG = `<div style="color:var(--text-muted);font-size:0.75rem;padding:1.5rem 0;text-align:center;">No data yet — analytics will appear here once traffic flows.</div>`;
476
+ function renderMockOverview(_period) {
477
+ return `<div class="dashboard-grid">
478
+ ${renderStatCard('—', 'Challenges Generated')}
479
+ ${renderStatCard('—', 'Verifications')}
480
+ ${renderStatCard('—', 'Success Rate')}
481
+ ${renderStatCard('—', 'Avg Solve Time')}
482
+ ${renderStatCard('—', 'Rate Limits Hit')}
483
+ ${renderStatCard('—', 'Errors')}
490
484
  </div>`;
491
485
  }
492
486
  function renderMockVolume(period) {
493
- const items = [
494
- { name: '00:00', value: 42, maxValue: 89 },
495
- { name: '04:00', value: 15, maxValue: 89 },
496
- { name: '08:00', value: 67, maxValue: 89 },
497
- { name: '12:00', value: 89, maxValue: 89 },
498
- { name: '16:00', value: 73, maxValue: 89 },
499
- { name: '20:00', value: 55, maxValue: 89 },
500
- ];
501
- return `<fieldset>
502
- <legend>${renderSampleLegend('Request Volume', period)}</legend>
503
- ${renderBarChart(items)}
504
- </fieldset>`;
487
+ return `<fieldset><legend>Request Volume (${period})</legend>${EMPTY_MSG}</fieldset>`;
505
488
  }
506
489
  function renderMockTypes(period) {
507
- const items = [
508
- { name: 'hybrid (412 ok / 18 fail)', value: 430, maxValue: 430 },
509
- { name: 'speed (389 ok / 12 fail)', value: 401, maxValue: 430 },
510
- { name: 'reasoning (256 ok / 45 fail)', value: 301, maxValue: 430 },
511
- { name: 'standard (22 ok / 5 fail)', value: 27, maxValue: 430 },
512
- ];
513
- return `<fieldset>
514
- <legend>${renderSampleLegend('Challenge Types', period)}</legend>
515
- ${renderBarChart(items)}
516
- </fieldset>`;
490
+ return `<fieldset><legend>Challenge Types (${period})</legend>${EMPTY_MSG}</fieldset>`;
517
491
  }
518
492
  function renderMockPerformance(period) {
519
- return `<fieldset>
520
- <legend>${renderSampleLegend('Performance', period)}</legend>
521
- <table>
522
- <thead>
523
- <tr>
524
- <th>Type</th><th>Count</th><th>Avg Solve</th><th>p50</th><th>p95</th><th>Min</th><th>Max</th><th>Avg Response</th>
525
- </tr>
526
- </thead>
527
- <tbody>
528
- <tr><td><span class="badge badge-info">speed</span></td><td>389</td><td>127ms</td><td>112ms</td><td>289ms</td><td>45ms</td><td>498ms</td><td>12ms</td></tr>
529
- <tr><td><span class="badge badge-info">hybrid</span></td><td>412</td><td>1,845ms</td><td>1,620ms</td><td>4,200ms</td><td>890ms</td><td>8,500ms</td><td>15ms</td></tr>
530
- <tr><td><span class="badge badge-info">reasoning</span></td><td>256</td><td>4,230ms</td><td>3,800ms</td><td>8,900ms</td><td>1,200ms</td><td>28,000ms</td><td>18ms</td></tr>
531
- </tbody>
532
- </table>
533
- </fieldset>`;
493
+ return `<fieldset><legend>Performance (${period})</legend>${EMPTY_MSG}</fieldset>`;
534
494
  }
535
495
  function renderMockErrors(period) {
536
- return `<fieldset>
537
- <legend>${renderSampleLegend('Errors & Rate Limits', period)}</legend>
538
- <div class="alert alert-success">No errors or rate limits</div>
539
- </fieldset>`;
496
+ return `<fieldset><legend>Errors & Rate Limits (${period})</legend>${EMPTY_MSG}</fieldset>`;
540
497
  }
541
498
  function renderMockGeo(period) {
542
- const items = [
543
- { name: 'US', value: 523, maxValue: 523 },
544
- { name: 'DE', value: 189, maxValue: 523 },
545
- { name: 'JP', value: 134, maxValue: 523 },
546
- { name: 'GB', value: 98, maxValue: 523 },
547
- { name: 'FR', value: 67, maxValue: 523 },
548
- ];
549
- return `<fieldset>
550
- <legend>${renderSampleLegend('Top Countries', period)}</legend>
551
- ${renderBarChart(items)}
552
- </fieldset>`;
499
+ return `<fieldset><legend>Top Countries (${period})</legend>${EMPTY_MSG}</fieldset>`;
553
500
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/dashboard/auth.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAOvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAKjD,KAAK,QAAQ,GAAG;IACd,UAAU,EAAE,WAAW,CAAC;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF,KAAK,SAAS,GAAG;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAIF;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,MAAM,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AE,QAAQ,CAAA;CAAE,CAAC,qBA4CvE"}
@@ -6,7 +6,7 @@ import { validateAppSecret, getAppByEmail } from '../apps';
6
6
  import { sendEmail, recoveryEmail } from '../email';
7
7
  import { checkRateLimit, getClientIP } from '../rate-limit';
8
8
  import { generateDeviceCode, storeDeviceCode, redeemDeviceCode } from './device-code';
9
- import { LoginLayout, Card, Divider } from './layout';
9
+ import { LoginLayout, Card } from './layout';
10
10
  // ============ SESSION HELPERS ============
11
11
  /**
12
12
  * Generate a 1-hour dashboard session JWT for the given app_id.
@@ -31,7 +31,7 @@ export async function generateSessionToken(appId, jwtSecret) {
31
31
  */
32
32
  export function setSessionCookie(c, token) {
33
33
  setCookie(c, 'botcha_session', token, {
34
- path: '/dashboard',
34
+ path: '/',
35
35
  httpOnly: true,
36
36
  secure: true,
37
37
  sameSite: 'Lax',
@@ -63,19 +63,19 @@ export const requireDashboardAuth = async (c, next) => {
63
63
  const isApi = c.req.header('Accept')?.includes('application/json') ||
64
64
  c.req.header('HX-Request');
65
65
  if (isApi) {
66
- return c.json({ error: 'Authentication required', login: '/dashboard/login' }, 401);
66
+ return c.json({ error: 'Authentication required', login: '/login' }, 401);
67
67
  }
68
- return c.redirect('/dashboard/login');
68
+ return c.redirect('/login');
69
69
  }
70
70
  const result = await verifyToken(sessionToken, c.env.JWT_SECRET, c.env);
71
71
  if (!result.valid || !result.payload?.app_id) {
72
- deleteCookie(c, 'botcha_session', { path: '/dashboard' });
72
+ deleteCookie(c, 'botcha_session', { path: '/' });
73
73
  const isApi = c.req.header('Accept')?.includes('application/json') ||
74
74
  c.req.header('HX-Request');
75
75
  if (isApi) {
76
- return c.json({ error: 'Session expired', login: '/dashboard/login' }, 401);
76
+ return c.json({ error: 'Session expired', login: '/login' }, 401);
77
77
  }
78
- return c.redirect('/dashboard/login');
78
+ return c.redirect('/login');
79
79
  }
80
80
  c.set('dashboardAppId', result.payload.app_id);
81
81
  await next();
@@ -284,7 +284,7 @@ export async function handleDeviceCodeRedeem(c) {
284
284
  }
285
285
  const sessionToken = await generateSessionToken(data.app_id, c.env.JWT_SECRET);
286
286
  setSessionCookie(c, sessionToken);
287
- return c.redirect('/dashboard');
287
+ return c.redirect('/account');
288
288
  }
289
289
  // ============ LEGACY LOGIN (app_id + app_secret) ============
290
290
  /**
@@ -309,7 +309,7 @@ export async function handleLogin(c) {
309
309
  }
310
310
  const sessionToken = await generateSessionToken(trimmedAppId, c.env.JWT_SECRET);
311
311
  setSessionCookie(c, sessionToken);
312
- return c.redirect('/dashboard');
312
+ return c.redirect('/account');
313
313
  }
314
314
  catch (error) {
315
315
  console.error('Login error:', error);
@@ -320,8 +320,8 @@ export async function handleLogin(c) {
320
320
  * GET /dashboard/logout
321
321
  */
322
322
  export async function handleLogout(c) {
323
- deleteCookie(c, 'botcha_session', { path: '/dashboard' });
324
- return c.redirect('/dashboard/login');
323
+ deleteCookie(c, 'botcha_session', { path: '/' });
324
+ return c.redirect('/login');
325
325
  }
326
326
  // ============ EMAIL LOGIN (session re-entry) ============
327
327
  /**
@@ -361,7 +361,7 @@ export async function handleEmailLogin(c) {
361
361
  return c.redirect('/dashboard/code?email_sent=1');
362
362
  }
363
363
  // ============ LOGIN PAGE ============
364
- const DASHBOARD_PROMPT = `Run: curl -s https://botcha.ai -H 'Accept: application/json' — then follow the instructions to verify yourself and get me a dashboard login code for botcha.ai.`;
364
+ const DASHBOARD_PROMPT = `Run: curl -s https://botcha.ai -H 'Accept: application/json' — then follow the instructions to verify yourself and get me a login code for botcha.ai.`;
365
365
  const COPY_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"><rect x="9" y="9" width="13" height="13" rx="0"/><path d="M5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1"/></svg>`;
366
366
  const CHECK_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="square" stroke-linejoin="miter"><polyline points="20 6 9 17 4 12"/></svg>`;
367
367
  const LOGIN_COPY_SCRIPT = `
@@ -395,10 +395,10 @@ export async function renderLoginPage(c) {
395
395
  const errorMap = {
396
396
  email_missing: 'Please enter your email address.',
397
397
  };
398
- return c.html(_jsxs(LoginLayout, { title: "Dashboard Login - BOTCHA", children: [_jsx("a", { href: "/", class: "ascii-logo", children: `██████╗ ██████╗ ████████╗ ██████╗██╗ ██╗ █████╗
398
+ return c.html(_jsxs(LoginLayout, { title: "Login - BOTCHA", children: [_jsx("a", { href: "/", class: "ascii-logo", children: `██████╗ ██████╗ ████████╗ ██████╗██╗ ██╗ █████╗
399
399
  ██╔══██╗██╔═══██╗╚══██╔══╝██╔════╝██║ ██║██╔══██╗
400
400
  ██████╔╝██║ ██║ ██║ ██║ ███████║███████║
401
401
  ██╔══██╗██║ ██║ ██║ ██║ ██╔══██║██╔══██║
402
402
  ██████╔╝╚██████╔╝ ██║ ╚██████╗██║ ██║██║ ██║
403
- ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝` }), _jsxs("p", { class: "text-muted", style: "text-align: center; font-size: 0.75rem; margin: -1rem 0 2rem;", children: ['>', "_\u00A0dashboard login"] }), _jsx("p", { class: "text-muted", style: "font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.15em; text-align: center; margin-bottom: 0.625rem;", children: "Paste this into your AI agent" }), _jsx("div", { class: "card", style: "margin-bottom: 1.5rem;", children: _jsx("div", { class: "card-body", children: _jsxs("button", { id: "dash-prompt-btn", onclick: "copyDashPrompt()", type: "button", class: "card-inner", style: "display: block; width: 100%; padding: 1.5rem; border: none; border-radius: 0; cursor: pointer; font-family: var(--font); text-align: left; text-transform: none; letter-spacing: normal; box-shadow: none; transition: background 0.2s;", children: [_jsx("code", { id: "dash-prompt", style: "font-size: 0.9375rem; font-weight: 700; color: var(--accent); line-height: 1.5; display: block; background: none; border: none; padding: 0;", children: DASHBOARD_PROMPT }), _jsxs("span", { id: "dash-copy-label", style: "display: flex; align-items: center; gap: 0.375rem; margin-top: 1rem; font-size: 0.6875rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; transition: color 0.2s;", children: [_jsx("span", { id: "dash-copy-icon", style: "display: flex; transition: color 0.2s;", dangerouslySetInnerHTML: { __html: COPY_ICON_SVG } }), _jsx("span", { id: "dash-copy-text", children: "Click to copy" })] })] }) }) }), _jsx("p", { class: "text-muted", style: "font-size: 0.75rem; text-align: center; line-height: 1.8; margin-bottom: 1.5rem; padding: 0 2rem;", children: "Your agent solves a challenge, gets a code, and gives you a link." }), _jsx(Divider, { text: "returning user?" }), _jsx("form", { method: "post", action: "/dashboard/email-login", children: _jsxs(Card, { title: "Email Login", children: [error === 'email_missing' && (_jsx("div", { class: "error-message", children: errorMap[error] })), _jsx("p", { class: "text-muted mb-2", style: "font-size: 0.75rem;", children: "Enter the email you used when creating your app. We'll send a login code to your inbox." }), _jsxs("div", { class: "form-group", children: [_jsx("label", { for: "email", children: "Email" }), _jsx("input", { type: "email", id: "email", name: "email", placeholder: "you@example.com", required: true, autocomplete: "email" })] }), _jsxs("button", { type: "submit", children: ["Email Me a Code ", '>'] })] }) }), _jsx("script", { dangerouslySetInnerHTML: { __html: LOGIN_COPY_SCRIPT } })] }));
403
+ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝` }), _jsxs("p", { class: "text-muted", style: "text-align: center; font-size: 0.75rem; margin: -1rem 0 2rem;", children: ['>', "_\u00A0login"] }), _jsx("form", { method: "post", action: "/dashboard/email-login", children: _jsxs(Card, { title: "Email Login", children: [error === 'email_missing' && (_jsx("div", { class: "error-message", children: errorMap[error] })), _jsx("p", { class: "text-muted mb-2", style: "font-size: 0.75rem;", children: "Enter the email you used when creating your app. We'll send a login code to your inbox." }), _jsxs("div", { class: "form-group", children: [_jsx("label", { for: "email", children: "Email" }), _jsx("input", { type: "email", id: "email", name: "email", placeholder: "you@example.com", required: true, autocomplete: "email" })] }), _jsxs("button", { type: "submit", children: ["Email Me a Code ", '>'] })] }) }), _jsxs("p", { class: "text-muted", style: "font-size: 0.75rem; text-align: center; margin-top: 1.5rem;", children: ["New here? ", _jsx("a", { href: "/", children: "Get started \u2192" })] })] }));
404
404
  }
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/dashboard/docs.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAsbnC,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAqpB5C,CAAC"}
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/dashboard/docs.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAsbnC,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CA2lC5C,CAAC"}
@@ -411,7 +411,7 @@ const Endpoint = ({ method, path, desc, children }) => {
411
411
  };
412
412
  // ============ PAGE COMPONENT ============
413
413
  export const DocsPage = ({ version }) => {
414
- return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: "BOTCHA API Documentation" }), _jsx("meta", { name: "description", content: "Complete API documentation for BOTCHA \u2014 the reverse CAPTCHA for AI agents. Endpoints, SDKs, authentication flows, and code examples." }), _jsx("meta", { name: "keywords", content: "BOTCHA, API documentation, AI agents, reverse CAPTCHA, TAP, Trusted Agent Protocol, SDK" }), _jsx("link", { rel: "alternate", type: "application/json", href: "/openapi.json", title: "OpenAPI Specification" }), _jsx("meta", { name: "ai-agent-welcome", content: "true" }), _jsx(OGMeta, { title: "BOTCHA API Documentation", description: "Complete API reference for BOTCHA \u2014 the identity layer for AI agents. Endpoints, SDKs, and code examples.", url: "https://botcha.ai/docs" }), _jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { href: "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap", rel: "stylesheet" }), _jsx("style", { dangerouslySetInnerHTML: { __html: DOCS_PAGE_CSS } })] }), _jsxs("body", { children: [_jsxs("article", { class: "docs", children: [_jsxs("header", { class: "docs-header", children: [_jsxs("div", { class: "docs-badge", children: ["API Reference v", version] }), _jsx("h1", { class: "docs-title", children: "BOTCHA API Documentation" }), _jsx("p", { class: "docs-subtitle", children: "Prove you're a bot. Humans need not apply. Complete endpoint reference, SDK install instructions, and integration guides." }), _jsxs("div", { class: "docs-meta", children: [_jsx("a", { href: "/", children: "Home" }), _jsx("span", { style: "margin: 0 0.375rem;", children: "\u00B7" }), _jsx("a", { href: "/openapi.json", children: "OpenAPI Spec" }), _jsx("span", { style: "margin: 0 0.375rem;", children: "\u00B7" }), _jsx("a", { href: "/whitepaper", children: "Whitepaper" }), _jsx("span", { style: "margin: 0 0.375rem;", children: "\u00B7" }), _jsx("a", { href: "/ai.txt", children: "ai.txt" })] })] }), _jsxs("nav", { class: "docs-toc", children: [_jsx("div", { class: "docs-toc-title", children: "Contents" }), _jsxs("ul", { class: "docs-toc-list", children: [_jsx("li", { children: _jsx("a", { href: "#install", children: "Installation" }) }), _jsx("li", { children: _jsx("a", { href: "#quickstart", children: "Quick Start" }) }), _jsx("li", { children: _jsx("a", { href: "#challenges", children: "Challenges" }) }), _jsx("li", { children: _jsx("a", { href: "#authentication", children: "Authentication (Tokens)" }) }), _jsx("li", { children: _jsx("a", { href: "#apps", children: "Apps (Multi-Tenant)" }) }), _jsx("li", { children: _jsx("a", { href: "#agents", children: "Agent Registry" }) }), _jsx("li", { children: _jsx("a", { href: "#tap", children: "TAP (Trusted Agent Protocol)" }) }), _jsx("li", { children: _jsx("a", { href: "#delegation", children: "Delegation Chains" }) }), _jsx("li", { children: _jsx("a", { href: "#attestation", children: "Capability Attestation" }) }), _jsx("li", { children: _jsx("a", { href: "#reputation", children: "Agent Reputation" }) }), _jsx("li", { children: _jsx("a", { href: "#invoices", children: "Invoices (402 Micropayments)" }) }), _jsx("li", { children: _jsx("a", { href: "#verification", children: "Verification" }) }), _jsx("li", { children: _jsx("a", { href: "#discovery", children: "Discovery & Keys" }) }), _jsx("li", { children: _jsx("a", { href: "#ratelimits", children: "Rate Limits" }) })] })] }), _jsxs("section", { id: "install", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Installation" }), _jsx("p", { class: "docs-section-desc", children: "Client SDKs for TypeScript and Python. Server-side verification middleware available separately." }), _jsxs("div", { class: "docs-install-grid", children: [_jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "npm (TypeScript)" }), _jsx("pre", { children: _jsx("code", { children: "npm install @dupecom/botcha" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "PyPI (Python)" }), _jsx("pre", { children: _jsx("code", { children: "pip install botcha" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "Verify Middleware (TS)" }), _jsx("pre", { children: _jsx("code", { children: "npm install @dupecom/botcha-verify" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "Verify Middleware (Python)" }), _jsx("pre", { children: _jsx("code", { children: "pip install botcha-verify" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "CLI" }), _jsx("pre", { children: _jsx("code", { children: "npm install -g @dupecom/botcha-cli" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "Base URL" }), _jsx("pre", { children: _jsx("code", { children: "https://botcha.ai" }) })] })] })] }), _jsxs("section", { id: "quickstart", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Quick Start" }), _jsx("p", { class: "docs-section-desc", children: "Verify yourself as an AI agent in four steps. No registration required." }), _jsxs("div", { class: "docs-quickstart-step", children: [_jsx("span", { class: "docs-quickstart-num", children: "1" }), _jsxs("div", { class: "docs-quickstart-content", children: [_jsx("p", { children: "Get a challenge (hybrid by default \u2014 speed + reasoning)" }), _jsx("pre", { children: _jsx("code", { children: "curl https://botcha.ai/v1/challenges" }) })] })] }), _jsxs("div", { class: "docs-quickstart-step", children: [_jsx("span", { class: "docs-quickstart-num", children: "2" }), _jsxs("div", { class: "docs-quickstart-content", children: [_jsx("p", { children: "Solve the speed component: compute SHA-256 of each number, return first 8 hex chars" }), _jsx("pre", { children: _jsx("code", { children: `# For each problem.num, compute:
414
+ return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: "BOTCHA API Documentation" }), _jsx("meta", { name: "description", content: "Complete API documentation for BOTCHA \u2014 the reverse CAPTCHA for AI agents. Endpoints, SDKs, authentication flows, and code examples." }), _jsx("meta", { name: "keywords", content: "BOTCHA, API documentation, AI agents, reverse CAPTCHA, TAP, Trusted Agent Protocol, SDK" }), _jsx("link", { rel: "alternate", type: "application/json", href: "/openapi.json", title: "OpenAPI Specification" }), _jsx("meta", { name: "ai-agent-welcome", content: "true" }), _jsx(OGMeta, { title: "BOTCHA API Documentation", description: "Complete API reference for BOTCHA \u2014 the identity layer for AI agents. Endpoints, SDKs, and code examples.", url: "https://botcha.ai/docs" }), _jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { href: "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap", rel: "stylesheet" }), _jsx("style", { dangerouslySetInnerHTML: { __html: DOCS_PAGE_CSS } })] }), _jsxs("body", { children: [_jsxs("article", { class: "docs", children: [_jsxs("header", { class: "docs-header", children: [_jsxs("div", { class: "docs-badge", children: ["API Reference v", version] }), _jsx("h1", { class: "docs-title", children: "BOTCHA API Documentation" }), _jsx("p", { class: "docs-subtitle", children: "Prove you're a bot. Humans need not apply. Complete endpoint reference, SDK install instructions, and integration guides." }), _jsxs("div", { class: "docs-meta", children: [_jsx("a", { href: "/", children: "Home" }), _jsx("span", { style: "margin: 0 0.375rem;", children: "\u00B7" }), _jsx("a", { href: "/openapi.json", children: "OpenAPI Spec" }), _jsx("span", { style: "margin: 0 0.375rem;", children: "\u00B7" }), _jsx("a", { href: "/whitepaper", children: "Whitepaper" }), _jsx("span", { style: "margin: 0 0.375rem;", children: "\u00B7" }), _jsx("a", { href: "/ai.txt", children: "ai.txt" })] })] }), _jsxs("nav", { class: "docs-toc", children: [_jsx("div", { class: "docs-toc-title", children: "Contents" }), _jsxs("ul", { class: "docs-toc-list", children: [_jsx("li", { children: _jsx("a", { href: "#install", children: "Installation" }) }), _jsx("li", { children: _jsx("a", { href: "#quickstart", children: "Quick Start" }) }), _jsx("li", { children: _jsx("a", { href: "#challenges", children: "Challenges" }) }), _jsx("li", { children: _jsx("a", { href: "#authentication", children: "Authentication (Tokens)" }) }), _jsx("li", { children: _jsx("a", { href: "#apps", children: "Apps (Multi-Tenant)" }) }), _jsx("li", { children: _jsx("a", { href: "#agents", children: "Agent Registry" }) }), _jsx("li", { children: _jsx("a", { href: "#tap", children: "TAP (Trusted Agent Protocol)" }) }), _jsx("li", { children: _jsx("a", { href: "#delegation", children: "Delegation Chains" }) }), _jsx("li", { children: _jsx("a", { href: "#attestation", children: "Capability Attestation" }) }), _jsx("li", { children: _jsx("a", { href: "#reputation", children: "Agent Reputation" }) }), _jsx("li", { children: _jsx("a", { href: "#webhooks", children: "Webhooks" }) }), _jsx("li", { children: _jsx("a", { href: "#x402", children: "x402 Payment Gating" }) }), _jsx("li", { children: _jsx("a", { href: "#ans", children: "Agent Name Service (ANS)" }) }), _jsx("li", { children: _jsx("a", { href: "#didvc", children: "DID / Verifiable Credentials" }) }), _jsx("li", { children: _jsx("a", { href: "#a2a", children: "A2A Agent Card Attestation" }) }), _jsx("li", { children: _jsx("a", { href: "#oidca", children: "OIDC-A Attestation" }) }), _jsx("li", { children: _jsx("a", { href: "#invoices", children: "Invoices (402 Micropayments)" }) }), _jsx("li", { children: _jsx("a", { href: "#verification", children: "Verification" }) }), _jsx("li", { children: _jsx("a", { href: "#discovery", children: "Discovery & Keys" }) }), _jsx("li", { children: _jsx("a", { href: "#mcp", children: "MCP Server" }) }), _jsx("li", { children: _jsx("a", { href: "#ratelimits", children: "Rate Limits" }) })] })] }), _jsxs("section", { id: "install", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Installation" }), _jsx("p", { class: "docs-section-desc", children: "Client SDKs for TypeScript and Python. Server-side verification middleware available separately." }), _jsxs("div", { class: "docs-install-grid", children: [_jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "npm (TypeScript)" }), _jsx("pre", { children: _jsx("code", { children: "npm install @dupecom/botcha" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "PyPI (Python)" }), _jsx("pre", { children: _jsx("code", { children: "pip install botcha" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "Verify Middleware (TS)" }), _jsx("pre", { children: _jsx("code", { children: "npm install @dupecom/botcha-verify" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "Verify Middleware (Python)" }), _jsx("pre", { children: _jsx("code", { children: "pip install botcha-verify" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "CLI" }), _jsx("pre", { children: _jsx("code", { children: "npm install -g @dupecom/botcha-cli" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "Base URL" }), _jsx("pre", { children: _jsx("code", { children: "https://botcha.ai" }) })] })] })] }), _jsxs("section", { id: "quickstart", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Quick Start" }), _jsx("p", { class: "docs-section-desc", children: "Verify yourself as an AI agent in four steps. No registration required." }), _jsxs("div", { class: "docs-quickstart-step", children: [_jsx("span", { class: "docs-quickstart-num", children: "1" }), _jsxs("div", { class: "docs-quickstart-content", children: [_jsx("p", { children: "Get a challenge (hybrid by default \u2014 speed + reasoning)" }), _jsx("pre", { children: _jsx("code", { children: "curl https://botcha.ai/v1/challenges" }) })] })] }), _jsxs("div", { class: "docs-quickstart-step", children: [_jsx("span", { class: "docs-quickstart-num", children: "2" }), _jsxs("div", { class: "docs-quickstart-content", children: [_jsx("p", { children: "Solve the speed component: compute SHA-256 of each number, return first 8 hex chars" }), _jsx("pre", { children: _jsx("code", { children: `# For each problem.num, compute:
415
415
  echo -n "42" | sha256sum | cut -c1-8
416
416
  # => "73475cb4"` }) })] })] }), _jsxs("div", { class: "docs-quickstart-step", children: [_jsx("span", { class: "docs-quickstart-num", children: "3" }), _jsxs("div", { class: "docs-quickstart-content", children: [_jsx("p", { children: "Submit your solution" }), _jsx("pre", { children: _jsx("code", { children: `curl -X POST https://botcha.ai/v1/challenges/{id}/verify \\
417
417
  -H "Content-Type: application/json" \\
@@ -507,7 +507,7 @@ async with BotchaClient() as client:
507
507
  "operator": "my-company",
508
508
  "version": "1.0.0",
509
509
  "app_id": "app_..."
510
- }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/agents/:id", desc: "Get agent by ID (public, no auth)" }), _jsx(Endpoint, { method: "GET", path: "/v1/agents", desc: "List agents for your app (auth required)" })] }), _jsxs("section", { id: "tap", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "TAP (Trusted Agent Protocol)" }), _jsxs("p", { class: "docs-section-desc", children: ["Enterprise-grade cryptographic agent auth using HTTP Message Signatures (RFC 9421). Register agents with public keys, scope capabilities, and create time-limited sessions. Based on ", _jsx("a", { href: "https://developer.visa.com/capabilities/trusted-agent-protocol/overview", children: "Visa's TAP" }), "."] }), _jsxs(Endpoint, { method: "POST", path: "/v1/agents/register/tap", desc: "Register TAP agent with public key", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
510
+ }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/agents/:id", desc: "Get agent by ID (public, no auth)" }), _jsx(Endpoint, { method: "GET", path: "/v1/agents", desc: "List agents for your app (auth required)" })] }), _jsxs("section", { id: "tap", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "TAP (Trusted Agent Protocol)" }), _jsxs("p", { class: "docs-section-desc", children: ["Enterprise-grade cryptographic agent auth using", ' ', _jsx("a", { href: "https://www.rfc-editor.org/rfc/rfc9421", target: "_blank", rel: "noopener", children: "HTTP Message Signatures (RFC 9421)" }), ". Register agents with public keys, scope capabilities, and create time-limited sessions. Based on ", _jsx("a", { href: "https://developer.visa.com/capabilities/trusted-agent-protocol/overview", target: "_blank", rel: "noopener", children: "Visa's TAP" }), "."] }), _jsxs(Endpoint, { method: "POST", path: "/v1/agents/register/tap", desc: "Register TAP agent with public key", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
511
511
  "name": "shopping-agent",
512
512
  "public_key": "<Ed25519 public key>",
513
513
  "signature_algorithm": "ed25519",
@@ -547,7 +547,150 @@ async with BotchaClient() as client:
547
547
  "category": "commerce",
548
548
  "action": "purchase_completed",
549
549
  "metadata": { "amount": 29.99 }
550
- }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/reputation/:agent_id/events", desc: "List events (?category=&limit=)" }), _jsx(Endpoint, { method: "POST", path: "/v1/reputation/:agent_id/reset", desc: "Reset reputation (admin)" })] }), _jsxs("section", { id: "invoices", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Invoices (402 Micropayments)" }), _jsx("p", { class: "docs-section-desc", children: "Create invoices for gated content using the 402 Payment Required flow. Supports Browsing IOU verification for agent commerce." }), _jsx(Endpoint, { method: "POST", path: "/v1/invoices", desc: "Create invoice for gated content" }), _jsx(Endpoint, { method: "GET", path: "/v1/invoices/:id", desc: "Get invoice details" }), _jsx(Endpoint, { method: "POST", path: "/v1/invoices/:id/verify-iou", desc: "Verify Browsing IOU" })] }), _jsxs("section", { id: "verification", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Verification" }), _jsx("p", { class: "docs-section-desc", children: "Cross-cutting verification endpoints for validating delegation chains, attestation tokens, consumer identities, and payment containers." }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/delegation", desc: "Verify entire delegation chain" }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/attestation", desc: "Verify attestation + check capability" }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/consumer", desc: "Verify Agentic Consumer (Layer 2)" }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/payment", desc: "Verify Payment Container (Layer 3)" })] }), _jsxs("section", { id: "discovery", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Discovery & Keys" }), _jsx("p", { class: "docs-section-desc", children: "Standard discovery endpoints for AI agents and key management infrastructure." }), _jsx(Endpoint, { method: "GET", path: "/.well-known/jwks", desc: "JWK Set for TAP agents (Visa spec)" }), _jsx(Endpoint, { method: "GET", path: "/v1/keys", desc: "List keys (?keyID= for Visa compat)" }), _jsx(Endpoint, { method: "GET", path: "/v1/keys/:keyId", desc: "Get specific key by ID" }), _jsx(Endpoint, { method: "GET", path: "/openapi.json", desc: "OpenAPI 3.1.0 specification" }), _jsx(Endpoint, { method: "GET", path: "/ai.txt", desc: "AI agent discovery file" }), _jsx(Endpoint, { method: "GET", path: "/.well-known/ai-plugin.json", desc: "AI plugin manifest" }), _jsx(Endpoint, { method: "GET", path: "/health", desc: "Health check" })] }), _jsxs("section", { id: "dashboard-auth", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Dashboard Auth" }), _jsx("p", { class: "docs-section-desc", children: "Agent-first authentication for the metrics dashboard. Agents solve challenges and generate device codes for their human operators." }), _jsx(Endpoint, { method: "POST", path: "/v1/auth/device-code", desc: "Get challenge for device code flow" }), _jsx(Endpoint, { method: "POST", path: "/v1/auth/device-code/verify", desc: "Solve challenge, get BOTCHA-XXXX code" }), _jsx(Endpoint, { method: "GET", path: "/dashboard", desc: "Metrics dashboard (login required)" })] }), _jsxs("section", { id: "ratelimits", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Rate Limits" }), _jsx("p", { class: "docs-section-desc", children: "Free tier includes generous rate limits. Each app gets an isolated rate limit bucket. Rate limit headers are included on every response." }), _jsxs("div", { class: "docs-rate-limit", children: [_jsxs("div", { class: "docs-rate-limit-item", children: [_jsx("div", { class: "docs-rate-limit-value", children: "100" }), "challenges / hour / IP"] }), _jsxs("div", { class: "docs-rate-limit-item", children: [_jsx("div", { class: "docs-rate-limit-value", children: "1 hr" }), "access token lifetime"] }), _jsxs("div", { class: "docs-rate-limit-item", children: [_jsx("div", { class: "docs-rate-limit-value", children: "1 hr" }), "refresh token lifetime"] })] }), _jsxs("div", { class: "docs-flow", children: [_jsx("div", { class: "docs-flow-title", children: "Response Headers" }), _jsx("pre", { children: _jsx("code", { children: `X-RateLimit-Limit: 100
550
+ }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/reputation/:agent_id/events", desc: "List events (?category=&limit=)" }), _jsx(Endpoint, { method: "POST", path: "/v1/reputation/:agent_id/reset", desc: "Reset reputation (admin)" })] }), _jsxs("section", { id: "webhooks", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Webhooks" }), _jsxs("p", { class: "docs-section-desc", children: ["Register per-app webhook endpoints to receive signed event deliveries. Events are delivered as HTTP POST with an ", _jsx("code", { children: "X-Botcha-Signature" }), " header (HMAC-SHA256). Supported events: ", _jsx("code", { children: "agent.tap.registered" }), ", ", _jsx("code", { children: "token.created" }), ",", ' ', _jsx("code", { children: "token.revoked" }), ", ", _jsx("code", { children: "tap.session.created" }), ",", ' ', _jsx("code", { children: "delegation.created" }), ", ", _jsx("code", { children: "delegation.revoked" }), "."] }), _jsxs(Endpoint, { method: "POST", path: "/v1/webhooks", desc: "Register webhook endpoint", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
551
+ "url": "https://my-app.example/webhooks/botcha",
552
+ "events": ["token.created", "delegation.created"],
553
+ "app_id": "app_..."
554
+ }` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
555
+ "webhook_id": "wh_...",
556
+ "url": "https://my-app.example/webhooks/botcha",
557
+ "signing_secret": "whsec_...", // shown ONCE — save it!
558
+ "events": ["token.created", "delegation.created"],
559
+ "enabled": true
560
+ }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/webhooks", desc: "List webhooks for your app" }), _jsx(Endpoint, { method: "GET", path: "/v1/webhooks/:id", desc: "Get webhook details" }), _jsxs(Endpoint, { method: "PUT", path: "/v1/webhooks/:id", desc: "Update webhook (URL, events, enabled)", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
561
+ "url": "https://my-app.example/webhooks/botcha-v2",
562
+ "events": ["token.created", "tap.session.created"],
563
+ "enabled": true
564
+ }` }) })] }), _jsx(Endpoint, { method: "DELETE", path: "/v1/webhooks/:id", desc: "Delete webhook + secret + delivery logs" }), _jsxs(Endpoint, { method: "POST", path: "/v1/webhooks/:id/test", desc: "Send signed test event", children: [_jsx("p", { children: "Sends a test payload to your endpoint so you can verify signature verification logic." }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{ "success": true, "delivery_id": "dlv_..." }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/webhooks/:id/deliveries", desc: "List last 100 delivery attempts" }), _jsxs("div", { class: "docs-flow", children: [_jsx("div", { class: "docs-flow-title", children: "Signature Verification (Node.js)" }), _jsx("pre", { children: _jsx("code", { children: `import crypto from 'crypto';
565
+
566
+ function verifyBotchaWebhook(body: string, signature: string, secret: string): boolean {
567
+ const expected = crypto
568
+ .createHmac('sha256', secret)
569
+ .update(body)
570
+ .digest('hex');
571
+ return crypto.timingSafeEqual(
572
+ Buffer.from(signature),
573
+ Buffer.from(expected)
574
+ );
575
+ }` }) })] })] }), _jsxs("section", { id: "x402", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "x402 Payment Gating" }), _jsxs("p", { class: "docs-section-desc", children: [_jsx("a", { href: "https://x402.org/", target: "_blank", rel: "noopener", children: "x402" }), " micropayment flow using USDC on Base. Agents pay $0.001 USDC instead of solving a challenge. Full x402 standard compatibility \u2014 no puzzle required when payment proof is included."] }), _jsxs("div", { class: "docs-flow", children: [_jsx("div", { class: "docs-flow-title", children: "x402 Payment Flow" }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "1." }), _jsxs("span", { children: [_jsx("code", { children: "GET /v1/x402/challenge" }), " \u2014 receive 402 with payment terms"] })] }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "2." }), _jsx("span", { children: "Agent pays $0.001 USDC on Base to BOTCHA's address" })] }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "3." }), _jsxs("span", { children: ["Retry with ", _jsx("code", { children: "X-Payment: <proof>" }), " header"] })] }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "4." }), _jsxs("span", { children: ["Receive ", _jsx("code", { children: "access_token" }), " \u2014 no puzzle solved"] })] })] }), _jsxs(Endpoint, { method: "GET", path: "/v1/x402/info", desc: "Payment config discovery", children: [_jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
576
+ "amount": "0.001",
577
+ "currency": "USDC",
578
+ "chain": "base",
579
+ "recipient": "0xBOTCHA..."
580
+ }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/x402/challenge", desc: "Initiate x402 payment flow", children: _jsxs("p", { children: ["Returns a ", _jsx("code", { children: "402 Payment Required" }), " with payment terms on first call. Re-request with ", _jsx("code", { children: "X-Payment" }), " header to receive a BOTCHA token."] }) }), _jsxs(Endpoint, { method: "POST", path: "/v1/x402/verify-payment", desc: "Verify raw x402 payment proof", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{ "payment_proof": "0x...", "chain": "base" }` }) })] }), _jsx(Endpoint, { method: "POST", path: "/v1/x402/webhook", desc: "Settlement notifications from x402 facilitators" }), _jsx(Endpoint, { method: "GET", path: "/agent-only/x402", desc: "Demo: requires BOTCHA token AND x402 payment" })] }), _jsxs("section", { id: "ans", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Agent Name Service (ANS)" }), _jsxs("p", { class: "docs-section-desc", children: ["BOTCHA as a verification layer for the", ' ', _jsx("a", { href: "https://www.godaddy.com/engineering/2024/12/16/agent-name-service/", target: "_blank", rel: "noopener", children: "GoDaddy-led ANS standard" }), ". DNS-based agent identity lookup with BOTCHA-issued ownership badges."] }), _jsx(Endpoint, { method: "GET", path: "/v1/ans/botcha", desc: "BOTCHA's own ANS identity record" }), _jsxs(Endpoint, { method: "GET", path: "/v1/ans/resolve/:name", desc: "DNS-based ANS lookup by name", children: [_jsx("p", { children: "Resolves an agent name to its ANS record via DNS TXT lookup." }), _jsx("div", { class: "docs-label", children: "Response Example" }), _jsx("pre", { children: _jsx("code", { children: `{
581
+ "name": "my-agent.agents",
582
+ "agent_url": "https://myagent.example",
583
+ "botcha_verified": true,
584
+ "badge": "eyJ..."
585
+ }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/ans/resolve/lookup", desc: "Alternate DNS lookup via ?name= query param" }), _jsx(Endpoint, { method: "GET", path: "/v1/ans/discover", desc: "List BOTCHA-verified ANS agents" }), _jsx(Endpoint, { method: "GET", path: "/v1/ans/nonce/:name", desc: "Get nonce for ownership proof (auth required)", children: _jsxs("p", { children: ["Requires ", _jsx("code", { children: "Authorization: Bearer" }), " token. Returns a one-time nonce for ownership verification."] }) }), _jsxs(Endpoint, { method: "POST", path: "/v1/ans/verify", desc: "Verify ANS ownership \u2192 issue BOTCHA badge", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
586
+ "name": "my-agent.agents",
587
+ "agent_url": "https://myagent.example",
588
+ "nonce": "<nonce from GET /v1/ans/nonce/:name>",
589
+ "proof": "<signed nonce>"
590
+ }` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
591
+ "success": true,
592
+ "badge": "eyJ...", // BOTCHA-issued ANS badge JWT
593
+ "name": "my-agent.agents"
594
+ }` }) })] })] }), _jsxs("section", { id: "didvc", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "DID / Verifiable Credentials" }), _jsxs("p", { class: "docs-section-desc", children: ["BOTCHA as a", ' ', _jsx("a", { href: "https://www.w3.org/TR/did-core/", target: "_blank", rel: "noopener", children: "W3C DID" }), ' ', "/", ' ', _jsx("a", { href: "https://www.w3.org/TR/vc-data-model/", target: "_blank", rel: "noopener", children: "VC" }), ' ', "issuer (", _jsx("code", { children: "did:web:botcha.ai" }), "). Issues portable W3C Verifiable Credential JWTs that any party can verify without contacting BOTCHA \u2014 just resolve the DID Document and check against the JWKS."] }), _jsxs("div", { class: "docs-flow", children: [_jsx("div", { class: "docs-flow-title", children: "VC Issuance Flow" }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "1." }), _jsx("span", { children: "Solve a BOTCHA challenge \u2192 receive Bearer token" })] }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "2." }), _jsxs("span", { children: [_jsx("code", { children: "POST /v1/credentials/issue" }), " \u2192 receive VC JWT"] })] }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "3." }), _jsx("span", { children: "Present VC JWT to any relying party" })] }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "4." }), _jsxs("span", { children: ["Relying party verifies via ", _jsx("code", { children: "POST /v1/credentials/verify" }), " (or local JWK verification)"] })] })] }), _jsxs(Endpoint, { method: "GET", path: "/.well-known/did.json", desc: "BOTCHA DID Document (did:web:botcha.ai)", children: [_jsx("div", { class: "docs-label", children: "Response Shape" }), _jsx("pre", { children: _jsx("code", { children: `{
595
+ "@context": ["https://www.w3.org/ns/did/v1", "https://w3id.org/security/suites/jws-2020/v1"],
596
+ "id": "did:web:botcha.ai",
597
+ "verificationMethod": [{
598
+ "id": "did:web:botcha.ai#key-1",
599
+ "type": "JsonWebKey2020",
600
+ "controller": "did:web:botcha.ai",
601
+ "publicKeyJwk": { ... }
602
+ }],
603
+ "authentication": ["did:web:botcha.ai#key-1"],
604
+ "assertionMethod": ["did:web:botcha.ai#key-1"]
605
+ }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/.well-known/jwks", desc: "JWK Set (used for VC verification)" }), _jsx(Endpoint, { method: "GET", path: "/.well-known/jwks.json", desc: "JWK Set alias (some resolvers append .json)" }), _jsxs(Endpoint, { method: "POST", path: "/v1/credentials/issue", desc: "Issue a W3C VC JWT", children: [_jsxs("p", { children: ["Requires ", _jsx("code", { children: "Authorization: Bearer <botcha-token>" }), "."] }), _jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
606
+ "subject": {
607
+ "agentType": "llm",
608
+ "verifiedAt": "2026-02-20T00:00:00Z"
609
+ },
610
+ "type": ["VerifiableCredential", "BotchaVerification"],
611
+ "ttl_seconds": 3600
612
+ }` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
613
+ "vc": "eyJ...", // signed W3C VC JWT
614
+ "expires_at": 1770940000
615
+ }` }) })] }), _jsxs(Endpoint, { method: "POST", path: "/v1/credentials/verify", desc: "Verify any BOTCHA-issued VC JWT", children: [_jsx("p", { children: "Public endpoint \u2014 no auth required. Verifies signature and expiry." }), _jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{ "vc": "eyJ..." }` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
616
+ "valid": true,
617
+ "payload": {
618
+ "iss": "did:web:botcha.ai",
619
+ "sub": "agent_abc123",
620
+ "vc": { "type": ["VerifiableCredential", "BotchaVerification"], ... }
621
+ }
622
+ }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/dids/:did/resolve", desc: "Resolve did:web DIDs", children: _jsxs("p", { children: ["Resolves any ", _jsx("code", { children: "did:web" }), " DID to its DID Document via HTTP discovery."] }) })] }), _jsxs("section", { id: "a2a", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "A2A Agent Card Attestation" }), _jsxs("p", { class: "docs-section-desc", children: ["BOTCHA as a trust seal issuer for the", ' ', _jsx("a", { href: "https://google.github.io/A2A/", target: "_blank", rel: "noopener", children: "Google A2A protocol" }), ". Any agent with an A2A Agent Card can submit it to BOTCHA for a tamper-evident trust seal that third parties can verify without contacting BOTCHA again."] }), _jsx(Endpoint, { method: "GET", path: "/.well-known/agent.json", desc: "BOTCHA's own A2A Agent Card" }), _jsx(Endpoint, { method: "GET", path: "/v1/a2a/agent-card", desc: "BOTCHA's A2A Agent Card (alias)" }), _jsxs(Endpoint, { method: "POST", path: "/v1/a2a/attest", desc: "Attest an agent card \u2192 receive trust seal", children: [_jsxs("p", { children: ["Requires ", _jsx("code", { children: "Authorization: Bearer" }), " token."] }), _jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
623
+ "card": {
624
+ "name": "My Commerce Agent",
625
+ "url": "https://myagent.example",
626
+ "version": "1.0.0",
627
+ "capabilities": { "streaming": false },
628
+ "skills": [{ "id": "browse", "name": "Browse" }]
629
+ },
630
+ "duration_seconds": 86400,
631
+ "trust_level": "verified"
632
+ }` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
633
+ "success": true,
634
+ "attestation": {
635
+ "attestation_id": "...",
636
+ "trust_level": "verified",
637
+ "token": "eyJ..."
638
+ },
639
+ "attested_card": {
640
+ "name": "My Commerce Agent",
641
+ "extensions": {
642
+ "botcha_attestation": { "token": "eyJ...", "card_hash": "..." }
643
+ }
644
+ }
645
+ }` }) })] }), _jsxs(Endpoint, { method: "POST", path: "/v1/a2a/verify-card", desc: "Verify an attested card (tamper-evident check)", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
646
+ "card": {
647
+ "...": "...",
648
+ "extensions": { "botcha_attestation": { "token": "eyJ..." } }
649
+ }
650
+ }` }) })] }), _jsx(Endpoint, { method: "POST", path: "/v1/a2a/verify-agent", desc: "Verify agent by card or agent_url" }), _jsx(Endpoint, { method: "GET", path: "/v1/a2a/trust-level/:agent_url", desc: "Get current trust level for an agent URL" }), _jsx(Endpoint, { method: "GET", path: "/v1/a2a/cards", desc: "Registry browse \u2014 list all attested cards" }), _jsx(Endpoint, { method: "GET", path: "/v1/a2a/cards/:id", desc: "Get specific attested card by ID" })] }), _jsxs("section", { id: "oidca", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "OIDC-A Attestation" }), _jsxs("p", { class: "docs-section-desc", children: ["Enterprise agent authentication chains using", ' ', _jsx("a", { href: "https://www.rfc-editor.org/rfc/rfc9334", target: "_blank", rel: "noopener", children: "Entity Attestation Tokens (EAT / RFC 9334)" }), ' ', "and", ' ', _jsx("a", { href: "https://openid.net/specs/openid-connect-core-1_0.html", target: "_blank", rel: "noopener", children: "OIDC-A" }), ' ', "agent claims. Enables the chain: human \u2192 enterprise IdP \u2192 BOTCHA \u2192 agent."] }), _jsx(Endpoint, { method: "GET", path: "/.well-known/oauth-authorization-server", desc: "OAuth/OIDC-A discovery document" }), _jsxs(Endpoint, { method: "POST", path: "/v1/attestation/eat", desc: "Issue Entity Attestation Token (EAT)", children: [_jsxs("p", { children: ["Requires ", _jsx("code", { children: "Authorization: Bearer" }), " token. Returns a signed ", _jsx("a", { href: "https://www.rfc-editor.org/rfc/rfc9334", target: "_blank", rel: "noopener", children: "EAT JWT (RFC 9334)" }), " for presentation to relying parties."] }), _jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
651
+ "nonce": "optional-client-nonce",
652
+ "agent_model": "gpt-5",
653
+ "ttl_seconds": 900,
654
+ "verification_method": "speed-challenge"
655
+ }` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
656
+ "token": "eyJ...", // EAT JWT (RFC 9334)
657
+ "expires_at": 1770937000
658
+ }` }) })] }), _jsxs(Endpoint, { method: "POST", path: "/v1/attestation/oidc-agent-claims", desc: "Issue OIDC-A agent claims block", children: [_jsxs("p", { children: ["Returns an ", _jsx("a", { href: "https://openid.net/specs/openid-connect-core-1_0.html", target: "_blank", rel: "noopener", children: "OIDC-A" }), " claims block JWT suitable for inclusion in OAuth2 token responses."] }), _jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
659
+ "agent_model": "gpt-5",
660
+ "agent_version": "1.0.0",
661
+ "agent_capabilities": ["agent:tool-use"],
662
+ "agent_operator": "Acme Corp",
663
+ "human_oversight_required": true,
664
+ "task_id": "task-123",
665
+ "task_purpose": "invoice reconciliation",
666
+ "nonce": "optional-client-nonce"
667
+ }` }) })] }), _jsxs(Endpoint, { method: "POST", path: "/v1/auth/agent-grant", desc: "Initiate OAuth2-style agent grant flow", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
668
+ "scope": "agent:read openid",
669
+ "human_oversight_required": true,
670
+ "agent_model": "gpt-5",
671
+ "agent_operator": "Acme Corp",
672
+ "task_purpose": "invoice reconciliation"
673
+ }` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
674
+ "grant_id": "grant_...",
675
+ "token": "eyJ...", // signed grant token
676
+ "status": "pending",
677
+ "oversight_url": "https://botcha.ai/oversight/GRANT-XXXX"
678
+ }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/auth/agent-grant/:id/status", desc: "Poll agent grant status" }), _jsxs(Endpoint, { method: "POST", path: "/v1/auth/agent-grant/:id/resolve", desc: "Approve or reject grant", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{ "decision": "approved" }` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/oidc/userinfo", desc: "OIDC-A UserInfo endpoint", children: _jsxs("p", { children: ["Requires ", _jsx("code", { children: "Authorization: Bearer" }), " token. Returns OIDC-A UserInfo claims for the authenticated agent."] }) })] }), _jsxs("section", { id: "invoices", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Invoices (402 Micropayments)" }), _jsx("p", { class: "docs-section-desc", children: "Create invoices for gated content using the 402 Payment Required flow. Supports Browsing IOU verification for agent commerce." }), _jsx(Endpoint, { method: "POST", path: "/v1/invoices", desc: "Create invoice for gated content" }), _jsx(Endpoint, { method: "GET", path: "/v1/invoices/:id", desc: "Get invoice details" }), _jsx(Endpoint, { method: "POST", path: "/v1/invoices/:id/verify-iou", desc: "Verify Browsing IOU" })] }), _jsxs("section", { id: "verification", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Verification" }), _jsx("p", { class: "docs-section-desc", children: "Cross-cutting verification endpoints for validating delegation chains, attestation tokens, consumer identities, and payment containers." }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/delegation", desc: "Verify entire delegation chain" }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/attestation", desc: "Verify attestation + check capability" }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/consumer", desc: "Verify Agentic Consumer (Layer 2)" }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/payment", desc: "Verify Payment Container (Layer 3)" })] }), _jsxs("section", { id: "discovery", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Discovery & Keys" }), _jsx("p", { class: "docs-section-desc", children: "Standard discovery endpoints for AI agents and key management infrastructure." }), _jsx(Endpoint, { method: "GET", path: "/.well-known/jwks", desc: "JWK Set for TAP agents (Visa spec)" }), _jsx(Endpoint, { method: "GET", path: "/v1/keys", desc: "List keys (?keyID= for Visa compat)" }), _jsx(Endpoint, { method: "GET", path: "/v1/keys/:keyId", desc: "Get specific key by ID" }), _jsx(Endpoint, { method: "GET", path: "/openapi.json", desc: "OpenAPI 3.1.0 specification" }), _jsx(Endpoint, { method: "GET", path: "/ai.txt", desc: "AI agent discovery file" }), _jsx(Endpoint, { method: "GET", path: "/.well-known/ai-plugin.json", desc: "AI plugin manifest" }), _jsx(Endpoint, { method: "GET", path: "/health", desc: "Health check" })] }), _jsxs("section", { id: "mcp", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "MCP Server" }), _jsxs("p", { class: "docs-section-desc", children: ["BOTCHA exposes its full API reference as a", ' ', _jsx("a", { href: "https://modelcontextprotocol.io/specification/2025-03-26", target: "_blank", rel: "noopener", children: "Model Context Protocol (MCP 2025-03-26)" }), ' ', "server. Point any MCP-compatible client at", ' ', _jsx("code", { children: "https://botcha.ai/mcp" }), " to ask questions about features, endpoints, and get code examples. No authentication required \u2014 it's a read-only documentation server."] }), _jsx(Endpoint, { method: "GET", path: "/.well-known/mcp.json", desc: "MCP discovery document \u2014 lists server name, version, transport, and available tools" }), _jsx(Endpoint, { method: "GET", path: "/mcp", desc: "MCP server info (server name, version, tool list) \u2014 useful for debugging" }), _jsx(Endpoint, { method: "POST", path: "/mcp", desc: "MCP JSON-RPC 2.0 endpoint \u2014 all tool calls go here" }), _jsx("h3", { class: "docs-subsection-title", style: "margin-top: 1.5rem;", children: "Available Tools" }), _jsx("div", { class: "docs-table-wrap", children: _jsxs("table", { class: "docs-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Tool" }), _jsx("th", { children: "Description" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "list_features" }) }), _jsx("td", { children: "List all 17 BOTCHA features with category and summary" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "get_feature" }) }), _jsx("td", { children: "Full detail on a feature \u2014 endpoints, spec links, usage notes" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "search_docs" }) }), _jsx("td", { children: "Keyword search across all features and endpoint descriptions" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "list_endpoints" }) }), _jsx("td", { children: "All 25+ API endpoints grouped by category" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "get_endpoint" }) }), _jsx("td", { children: "Auth requirements, parameters, request/response shape for one endpoint" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "get_example" }) }), _jsx("td", { children: "Code example for a feature in TypeScript, Python, or curl" })] })] })] }) }), _jsx("h3", { class: "docs-subsection-title", style: "margin-top: 1.5rem;", children: "Quick Start" }), _jsx("p", { class: "docs-section-desc", children: "Add to your Claude Desktop or Claude Code config:" }), _jsx("pre", { children: _jsx("code", { children: `{
679
+ "mcpServers": {
680
+ "botcha": {
681
+ "type": "http",
682
+ "url": "https://botcha.ai/mcp"
683
+ }
684
+ }
685
+ }` }) }), _jsx("p", { class: "docs-section-desc", style: "margin-top: 1rem;", children: "Or call it directly with curl:" }), _jsx("pre", { children: _jsx("code", { children: `# List all features
686
+ curl -X POST https://botcha.ai/mcp \\
687
+ -H "Content-Type: application/json" \\
688
+ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_features","arguments":{}}}'
689
+
690
+ # Get code example in Python
691
+ curl -X POST https://botcha.ai/mcp \\
692
+ -H "Content-Type: application/json" \\
693
+ -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_example","arguments":{"feature":"tap","language":"python"}}}'` }) })] }), _jsxs("section", { id: "dashboard-auth", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Dashboard Auth" }), _jsx("p", { class: "docs-section-desc", children: "Agent-first authentication for the metrics dashboard. Agents solve challenges and generate device codes for their human operators." }), _jsx(Endpoint, { method: "POST", path: "/v1/auth/device-code", desc: "Get challenge for device code flow" }), _jsx(Endpoint, { method: "POST", path: "/v1/auth/device-code/verify", desc: "Solve challenge, get BOTCHA-XXXX code" }), _jsx(Endpoint, { method: "GET", path: "/dashboard", desc: "Metrics dashboard (login required)" })] }), _jsxs("section", { id: "ratelimits", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Rate Limits" }), _jsx("p", { class: "docs-section-desc", children: "Free tier includes generous rate limits. Each app gets an isolated rate limit bucket. Rate limit headers are included on every response." }), _jsxs("div", { class: "docs-rate-limit", children: [_jsxs("div", { class: "docs-rate-limit-item", children: [_jsx("div", { class: "docs-rate-limit-value", children: "100" }), "challenges / hour / IP"] }), _jsxs("div", { class: "docs-rate-limit-item", children: [_jsx("div", { class: "docs-rate-limit-value", children: "1 hr" }), "access token lifetime"] }), _jsxs("div", { class: "docs-rate-limit-item", children: [_jsx("div", { class: "docs-rate-limit-value", children: "1 hr" }), "refresh token lifetime"] })] }), _jsxs("div", { class: "docs-flow", children: [_jsx("div", { class: "docs-flow-title", children: "Response Headers" }), _jsx("pre", { children: _jsx("code", { children: `X-RateLimit-Limit: 100
551
694
  X-RateLimit-Remaining: 97
552
695
  X-RateLimit-Reset: 2026-02-15T12:00:00.000Z
553
696
  X-Botcha-Version: ${version}
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/dashboard/layout.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OA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G;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,iBAAiB,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAiDpE,CAAC"}
@@ -32,7 +32,7 @@ export const Card = ({ children, title, badge, class: className, }) => {
32
32
  */
33
33
  export const GlobalFooter = ({ version = '0.15.0' }) => {
34
34
  const year = new Date().getFullYear();
35
- return (_jsx("footer", { class: "global-footer", children: _jsxs("div", { class: "global-footer-inner", children: [_jsx("a", { href: "/dashboard", class: "global-footer-dashboard", children: "Dashboard" }), _jsxs("div", { class: "global-footer-links", children: [_jsxs("span", { children: ["v", version] }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://botcha.ai", children: "botcha.ai" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/docs", children: "Docs" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/whitepaper", children: "Whitepaper" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/openapi.json", children: "OpenAPI" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/ai.txt", children: "ai.txt" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://github.com/dupe-com/botcha", children: "GitHub" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://www.npmjs.com/package/@dupecom/botcha", children: "npm" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://pypi.org/project/botcha/", children: "PyPI" })] }), _jsxs("div", { class: "global-footer-legal", children: ["\u00A9 ", year, " ", _jsx("a", { href: "https://dupe.com", children: "Dupe.com" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), "Free and open source", _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://github.com/i8ramin", children: "@i8ramin" })] })] }) }));
35
+ return (_jsx("footer", { class: "global-footer", children: _jsxs("div", { class: "global-footer-inner", children: [_jsx("a", { href: "/account", class: "global-footer-dashboard", children: "Account" }), _jsxs("div", { class: "global-footer-links", children: [_jsxs("span", { children: ["v", version] }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://botcha.ai", children: "botcha.ai" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/docs", children: "Docs" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/whitepaper", children: "Whitepaper" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/openapi.json", children: "OpenAPI" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/ai.txt", children: "ai.txt" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://github.com/dupe-com/botcha", children: "GitHub" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://www.npmjs.com/package/@dupecom/botcha", children: "npm" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://pypi.org/project/botcha/", children: "PyPI" })] }), _jsxs("div", { class: "global-footer-legal", children: ["\u00A9 ", year, " ", _jsx("a", { href: "https://dupe.com", children: "Dupe.com" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), "Free and open source", _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://github.com/i8ramin", children: "@i8ramin" })] })] }) }));
36
36
  };
37
37
  /**
38
38
  * Divider with centered text, used between sections on auth pages.
@@ -43,7 +43,7 @@ export const Divider = ({ text }) => (_jsx("div", { class: "divider", children:
43
43
  * Used for authenticated dashboard pages
44
44
  */
45
45
  export const DashboardLayout = ({ children, title, appId, version }) => {
46
- return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: title || 'BOTCHA Dashboard' }), _jsx(OGMeta, { url: "https://botcha.ai/dashboard" }), _jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { href: "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap", rel: "stylesheet" }), _jsx("style", { dangerouslySetInnerHTML: { __html: DASHBOARD_CSS } }), _jsx("script", { src: "https://unpkg.com/htmx.org@2.0.4" })] }), _jsxs("body", { children: [_jsx("nav", { class: "dashboard-nav", children: _jsxs("div", { class: "nav-container", children: [_jsx("a", { href: "/dashboard", class: "nav-logo", children: "BOTCHA" }), appId && (_jsxs(_Fragment, { children: [_jsx("span", { class: "nav-app-id", children: appId }), _jsx("a", { href: "/dashboard/logout", class: "nav-link", children: "Logout" })] }))] }) }), _jsx("main", { class: "dashboard-main", children: children }), _jsx(GlobalFooter, { version: version })] })] }));
46
+ return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: title || 'BOTCHA Dashboard' }), _jsx(OGMeta, { url: "https://botcha.ai/dashboard" }), _jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { href: "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap", rel: "stylesheet" }), _jsx("style", { dangerouslySetInnerHTML: { __html: DASHBOARD_CSS } }), _jsx("script", { src: "https://unpkg.com/htmx.org@2.0.4" })] }), _jsxs("body", { children: [_jsx("nav", { class: "dashboard-nav", children: _jsxs("div", { class: "nav-container", children: [_jsx("a", { href: "/dashboard", class: "nav-logo", children: "BOTCHA" }), appId && (_jsxs(_Fragment, { children: [_jsx("span", { class: "nav-app-id", children: appId }), _jsx("a", { href: "/account", class: "nav-link", children: "Account" }), _jsx("a", { href: "/dashboard/logout", class: "nav-link", children: "Logout" })] }))] }) }), _jsx("main", { class: "dashboard-main", children: children }), _jsx(GlobalFooter, { version: version })] })] }));
47
47
  };
48
48
  /**
49
49
  * Login/auth layout without navigation
@@ -0,0 +1,15 @@
1
+ /**
2
+ * BOTCHA MCP Setup Page
3
+ *
4
+ * Served at GET /mcp for browser (HTML) requests via content negotiation.
5
+ * MCP clients hitting POST /mcp get the JSON-RPC server instead.
6
+ *
7
+ * Shows one-liner install commands and per-tool config snippets with
8
+ * copy-to-clipboard buttons for Claude Code, Claude Desktop, OpenCode,
9
+ * Cursor, Windsurf, and generic .mcp.json.
10
+ */
11
+ import type { FC } from 'hono/jsx';
12
+ export declare const MCPSetupPage: FC<{
13
+ version?: string;
14
+ }>;
15
+ //# sourceMappingURL=mcp-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-setup.d.ts","sourceRoot":"","sources":["../../src/dashboard/mcp-setup.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAgXnC,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAkQjD,CAAC"}