account: show a runnable curl when you mint a key (0.94.0)

minting an agent key showed the key once with no hint of what to do with it —
you had to go dig through the docs to make your first call. great API products
hand you a working example right there.

- after minting, show a ready-to-run curl with YOUR key inlined, hitting a real
  read-only endpoint (GET /agents/classes), plus a one-click copy and a link to
  the API reference
- completes the get-key -> call-the-API loop and reinforces the agent-native pitch
- verified live (throwaway account, cleaned up after): the curl renders with the
  real minted key, copy button + api-reference link present
This commit is contained in:
artheru 2026-06-10 14:16:26 +08:00
parent 66ccd54d21
commit 63b1087042
5 changed files with 22 additions and 4 deletions

View File

@ -17,7 +17,7 @@
@media (prefers-reduced-motion: reduce) { .app-loading-gem { animation: none; transform: rotate(45deg); } } @media (prefers-reduced-motion: reduce) { .app-loading-gem { animation: none; transform: rotate(45deg); } }
</style> </style>
<meta name="description" content="amerc is the agent mercenary tavern — hire, run, publish, and remotely deliver AI agents across software boundaries. No infrastructure, just skills." /> <meta name="description" content="amerc is the agent mercenary tavern — hire, run, publish, and remotely deliver AI agents across software boundaries. No infrastructure, just skills." />
<meta name="version" content="0.93.0-docsearch" /> <meta name="version" content="0.94.0-keytry" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml" /> <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="icon" href="/app-192.png" type="image/png" sizes="192x192" /> <link rel="icon" href="/app-192.png" type="image/png" sizes="192x192" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" /> <link rel="apple-touch-icon" href="/apple-touch-icon.png" />

View File

@ -1,6 +1,6 @@
{ {
"name": "amerc-site", "name": "amerc-site",
"version": "0.93.0-docsearch", "version": "0.94.0-keytry",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {

View File

@ -242,7 +242,18 @@ export function KeysCard() {
<input placeholder="key name (e.g. my-bot)" value={name} onChange={(e) => setName(e.target.value)} required /> <input placeholder="key name (e.g. my-bot)" value={name} onChange={(e) => setName(e.target.value)} required />
<button className="px-action" type="submit">+ Mint key</button> <button className="px-action" type="submit">+ Mint key</button>
</form> </form>
{created && <div className="mn-created"><p> minted copy now, shown once:</p><code className="ap-token" onClick={() => copyToast(created.key)}>{created.key} </code></div>} {created && (
<div className="mn-created">
<p> minted copy now, shown once:</p>
<code className="ap-token" onClick={() => copyToast(created.key)}>{created.key} </code>
<p className="ap-keys-try">Try it your key drives the whole API:</p>
<div className="ap-keys-curl">
<code>{`curl -H "Authorization: Bearer ${created.key}" https://amerc.ai/api/agents/classes`}</code>
<button type="button" className="ap-keys-copy" onClick={() => copyToast(`curl -H "Authorization: Bearer ${created.key}" https://amerc.ai/api/agents/classes`, 'Copied')}>copy</button>
</div>
<p className="ap-hint">Full endpoints in the <a href="https://docs.amerc.ai/#/api-reference">API reference</a>.</p>
</div>
)}
{err && <p className="px-auth-err">{err}</p>} {err && <p className="px-auth-err">{err}</p>}
{keys.map((k) => ( {keys.map((k) => (
<div key={k.id} className="ap-mine-inst"> <div key={k.id} className="ap-mine-inst">

View File

@ -10,7 +10,7 @@ import { api } from './api.js';
const Menu = ({ size = 20 }) => (<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" aria-hidden="true"><line x1="3" y1="6" x2="21" y2="6" /><line x1="3" y1="12" x2="21" y2="12" /><line x1="3" y1="18" x2="21" y2="18" /></svg>); const Menu = ({ size = 20 }) => (<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" aria-hidden="true"><line x1="3" y1="6" x2="21" y2="6" /><line x1="3" y1="12" x2="21" y2="12" /><line x1="3" y1="18" x2="21" y2="18" /></svg>);
const X = ({ size = 20 }) => (<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>); const X = ({ size = 20 }) => (<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>);
const RELEASE = '0.93.0-docsearch'; const RELEASE = '0.94.0-keytry';
const NAV = [ const NAV = [
{ id: 'home', label: 'Tavern' }, { id: 'home', label: 'Tavern' },

View File

@ -1547,3 +1547,10 @@ button {
.docs-result-title { color: #eaf2ff; font-size: 13.5px; font-weight: 600; } .docs-result-title { color: #eaf2ff; font-size: 13.5px; font-weight: 600; }
.docs-result-snip { color: #8595ab; font-size: 12px; line-height: 1.45; } .docs-result-snip { color: #8595ab; font-size: 12px; line-height: 1.45; }
.docs-result-snip mark { background: rgba(39, 216, 255, 0.22); color: #d6f0f8; border-radius: 2px; padding: 0 1px; } .docs-result-snip mark { background: rgba(39, 216, 255, 0.22); color: #d6f0f8; border-radius: 2px; padding: 0 1px; }
/* key-minting "try it" curl example (0.94) */
.ap-keys-try { margin: 13px 0 5px; color: #b6a7d4; font-size: 12.5px; }
.ap-keys-curl { display: flex; align-items: center; gap: 8px; background: #0a0e16; border: 1px solid #20384a; border-radius: 9px; padding: 9px 11px; }
.ap-keys-curl code { flex: 1; min-width: 0; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; color: #cfe2f2; overflow-x: auto; white-space: nowrap; }
.ap-keys-copy { flex: 0 0 auto; background: #46c8e0; color: #07111a; border: none; border-radius: 6px; padding: 5px 11px; font-size: 11px; font-weight: 600; cursor: pointer; }
.ap-keys-copy:hover { background: #6ad6ea; }