Skip to content

Commit 0a00b41

Browse files
authored
Merge pull request #234 from commandlayer/codex/clean-up-wrap-your-agent.html
docs: align wrap-your-agent with canonical metadata.proof model
2 parents 21cd7ce + 42a2311 commit 0a00b41

1 file changed

Lines changed: 57 additions & 22 deletions

File tree

public/docs/wrap-your-agent.html

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,37 @@
1111
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
1212
<link rel="stylesheet" href="/css/site.css" />
1313
<style>
14-
.brand{gap:0}.brand img{height:68px;width:auto;object-fit:contain}.brand span{display:none}.nav-links a.active{color:var(--text);background:var(--surface)}
15-
.doc-shell{padding:64px 0 88px}.doc-grid{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:28px;align-items:start}.doc-card{background:#fff;border:1px solid var(--border);border-radius:18px;padding:24px;box-shadow:0 1px 2px rgba(15,23,42,.04),0 6px 20px rgba(99,91,255,.04);margin-bottom:18px}.doc-card h2{font-size:1.25rem;margin-bottom:10px;letter-spacing:-.02em}.doc-card h3{font-size:1.02rem;margin:18px 0 8px}.doc-card p,.doc-card li{color:var(--text-2);line-height:1.7}.doc-card ul{padding-left:20px}.code-panel{background:#0E1322;color:#E2E8F0;border-radius:14px;border:1px solid rgba(30,41,59,.3);padding:18px;overflow:auto;font:13px/1.7 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.code-panel code{color:inherit}.side-card{position:sticky;top:112px;background:linear-gradient(180deg,#F9FAFF 0%,#F3F6FF 100%);border:1px solid var(--border);border-radius:18px;padding:20px}.side-card h3{margin-bottom:8px}.side-card p,.side-card li{color:var(--text-2);font-size:.95rem;line-height:1.6}.side-card ul{padding-left:18px;margin-top:8px}.flow{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:28px}.flow-step{background:#fff;border:1px solid var(--border);border-radius:14px;padding:14px;font-weight:700;color:var(--text-2);font-size:13px}.flow-step span{display:block;color:var(--purple);font-size:12px;margin-bottom:4px}.inline-link{color:var(--purple);font-weight:700;text-decoration:none}.inline-link:hover{text-decoration:underline}.path-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.path-card{background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:18px}.path-card strong{display:block;color:var(--text);font-size:1.04rem;margin-bottom:6px}.rule-box{border-left:4px solid var(--purple);background:linear-gradient(180deg,#F9FAFF 0%,#F3F6FF 100%);border-radius:0 14px 14px 0;padding:16px;margin:14px 0}.stack-list{display:grid;gap:10px;margin-top:10px}.stack-item{border:1px solid var(--border);border-radius:14px;padding:14px;background:#fff}.stack-item strong{color:var(--text)}@media(max-width:900px){.doc-grid,.path-grid{grid-template-columns:1fr}.side-card{position:static}.flow{grid-template-columns:1fr}.doc-shell{padding:42px 0 64px}}
14+
.brand{gap:0}.brand img{height:68px;width:auto;object-fit:contain}.brand span{display:none}.nav-links{display:flex;align-items:center;gap:2px;list-style:none;flex-wrap:wrap;margin:0;padding:0}.nav-links a,.nav-drop-toggle{color:var(--muted);text-decoration:none;font-size:14px;font-weight:500;padding:7px 12px;border-radius:8px;background:none;border:none;cursor:pointer;font-family:inherit}.nav-links a:hover,.nav-drop:hover .nav-drop-toggle,.nav-drop:focus-within .nav-drop-toggle,.nav-drop-toggle.active{color:var(--text);background:var(--surface)}.nav-drop{position:relative}.nav-drop-menu{position:absolute;top:calc(100% + 10px);right:0;background:#fff;border:1px solid var(--border);border-radius:12px;box-shadow:0 10px 34px rgba(15,23,42,.12);padding:8px;display:none;min-width:260px;z-index:50}.nav-drop-menu a{display:block;white-space:nowrap}.nav-drop:hover .nav-drop-menu,.nav-drop:focus-within .nav-drop-menu{display:block}
15+
.doc-shell{padding:64px 0 88px}.doc-grid{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:28px;align-items:start}.doc-card{background:#fff;border:1px solid var(--border);border-radius:18px;padding:24px;box-shadow:0 1px 2px rgba(15,23,42,.04),0 6px 20px rgba(99,91,255,.04);margin-bottom:18px}.doc-card h2{font-size:1.25rem;margin-bottom:10px;letter-spacing:-.02em}.doc-card h3{font-size:1.02rem;margin:18px 0 8px}.doc-card p,.doc-card li{color:var(--text-2);line-height:1.7}.doc-card ul{padding-left:20px}.code-panel{background:#0E1322;color:#E2E8F0;border-radius:14px;border:1px solid rgba(30,41,59,.3);padding:18px;overflow:auto;font:13px/1.7 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.code-panel code{color:inherit}.side-card{position:sticky;top:112px;background:linear-gradient(180deg,#F9FAFF 0%,#F3F6FF 100%);border:1px solid var(--border);border-radius:18px;padding:20px}.side-card h3{margin-bottom:8px}.side-card p,.side-card li{color:var(--text-2);font-size:.95rem;line-height:1.6}.side-card ul{padding-left:18px;margin-top:8px}.flow{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:28px}.flow-step{background:#fff;border:1px solid var(--border);border-radius:14px;padding:14px;font-weight:700;color:var(--text-2);font-size:13px}.flow-step span{display:block;color:var(--purple);font-size:12px;margin-bottom:4px}.inline-link{color:var(--purple);font-weight:700;text-decoration:none}.inline-link:hover{text-decoration:underline}.path-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.path-card{background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:18px}.path-card strong{display:block;color:var(--text);font-size:1.04rem;margin-bottom:6px}.rule-box{border-left:4px solid var(--purple);background:linear-gradient(180deg,#F9FAFF 0%,#F3F6FF 100%);border-radius:0 14px 14px 0;padding:16px;margin:14px 0}.stack-list{display:grid;gap:10px;margin-top:10px}.stack-item{border:1px solid var(--border);border-radius:14px;padding:14px;background:#fff}.stack-item strong{color:var(--text)}footer{border-top:1px solid var(--border);background:#fff}.footer-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;padding:36px 0}.footer-grid h4{font-size:14px;margin-bottom:10px}.footer-grid a{display:block;color:var(--text-2);margin:8px 0;font-size:14px}@media(max-width:900px){.doc-grid,.path-grid,.footer-grid{grid-template-columns:1fr}.side-card{position:static}.flow{grid-template-columns:1fr}.doc-shell{padding:42px 0 64px}}
1616
</style>
1717
</head>
1818
<body>
1919
<nav>
2020
<div class="container nav-inner">
2121
<a href="/" class="brand"><img src="/commandlayer-logo.png" alt="CommandLayer" /><span>CommandLayer</span></a>
22-
<div class="nav-links">
23-
<a href="/">Home</a>
24-
<a href="/capabilities.html">Capabilities</a>
25-
<a href="/verify.html">Verifier</a>
26-
<a href="/sdk-records.html">SDK</a>
27-
<a href="/docs/wrap-your-agent.html" class="active">Docs</a>
28-
<a href="/claim.html">Claim</a>
29-
<a href="https://github.com/commandlayer" target="_blank" rel="noopener">GitHub</a>
30-
</div>
22+
<ul class="nav-links">
23+
<li><a href="/">Home</a></li>
24+
<li><a href="/protocol.html">Protocol</a></li>
25+
<li><a href="/capabilities.html">Capabilities</a></li>
26+
<li><a href="/verify.html">Verifier</a></li>
27+
<li><a href="/sdk-records.html">SDK</a></li>
28+
<li class="nav-drop">
29+
<button class="nav-drop-toggle active" type="button" aria-haspopup="true" aria-expanded="false">Docs</button>
30+
<div class="nav-drop-menu">
31+
<a href="/docs.html">Docs Home</a><a href="/docs/wrap-your-agent.html">Wrap Your Agent</a><a href="/stack-proof-demo.html">Production Proof</a><a href="/runtime.html">Runtime</a><a href="/mcp.html">MCP Bridge</a><a href="/schemas.html">Schemas</a><a href="/api.html">API Reference</a><a href="/trust-verification.html">Trust Verification</a><a href="/claim.html">Claim / Namespace Activation</a>
32+
</div>
33+
</li>
34+
<li><a href="/claim.html">Claim</a></li>
35+
<li><a href="https://github.com/commandlayer" target="_blank" rel="noopener">GitHub</a></li>
36+
</ul>
3137
</div>
3238
</nav>
3339

3440
<section class="hero">
3541
<div class="container">
3642
<div class="hero-badge"><span class="badge-dot"></span>Builder Guide</div>
3743
<h1 class="hero-h1">Wrap first. <span class="grad">Use schemas when you need interoperability.</span></h1>
38-
<p class="hero-sub">Most builders do not need to download every schema. Pick the capabilities your agent supports, emit receipts, and verify the proof.</p>
44+
<p class="hero-sub">Most builders only need the schemas for the capabilities they support. Schema validation helps structure receipts, but schema-valid alone is not verified. Verification requires hash and signature checks.</p>
3945
<div class="hero-actions">
4046
<a class="btn btn-primary btn-lg" href="/verify.html">Open verifier</a>
4147
<a class="btn btn-secondary btn-lg" href="/capabilities.html">Explore capabilities</a>
@@ -49,7 +55,7 @@ <h2>Two ways developers use CommandLayer</h2>
4955
<div class="path-grid">
5056
<div class="path-card">
5157
<strong>1. Just wrap my agent</strong>
52-
<p>You already have an agent and just want receipts. Use the SDK wrapper and let CommandLayer handle receipt structure, canonicalization, hash, signature, verifier calls, and proof objects.</p>
58+
<p>You already have an agent and just want receipts. Use the SDK wrapper and let CommandLayer handle receipt structure plus canonical metadata.proof fields: metadata.proof.canonicalization, metadata.proof.hash.alg/value, metadata.proof.signature.alg/value/kid, and metadata.proof.signer_id.</p>
5359
<pre class="code-panel"><code>wrap("summarize", async () => {
5460
return { summary: "..." };
5561
});</code></pre>
@@ -60,18 +66,18 @@ <h2>Two ways developers use CommandLayer</h2>
6066
</div>
6167
</div>
6268
<div class="rule-box">
63-
<strong>The simple rule:</strong> use only the schemas for the capabilities your agent supports. If your agent only summarizes text, you need the summarize request schema, summarize receipt schema, and shared proof schema — not ship, refund, approve, kyc, broadcast, or inventory.
69+
<strong>The simple rule:</strong> use only the schemas for the capabilities your agent supports. If your agent only summarizes text, you need the summarize request schema and summarize receipt schema — not ship, refund, approve, kyc, broadcast, or inventory.
6470
</div>
6571
</section>
6672

6773
<section class="doc-card">
6874
<h2>How the stack fits together</h2>
6975
<p>Capabilities are the menu of possible actions. Schemas are the contracts for each action. The SDK wraps an agent action and emits receipts. The verifier checks those receipts. Your agent only uses the capabilities it actually performs.</p>
7076
<div class="stack-list">
71-
<div class="stack-item"><strong>Layer 1 — Shared proof schema.</strong> Every receipt needs canonicalization, hash, signature_alg, signature, key_id, and signer.</div>
77+
<div class="stack-item"><strong>Layer 1 — Canonical proof envelope.</strong> Every receipt uses metadata.proof with canonicalization, hash, signature, key id, and signer identity.</div>
7278
<div class="stack-item"><strong>Layer 2 — Capability schemas.</strong> Each capability has its own request and receipt shape, such as verify.request.schema.json or authorize.receipt.schema.json.</div>
73-
<div class="stack-item"><strong>Layer 3 — SDK.</strong> The SDK helps developers use schemas without manually assembling every proof object.</div>
74-
<div class="stack-item"><strong>Layer 4 — Verifier.</strong> VerifyAgent checks shape, hash, signature, signer, and whether the capability verb makes sense.</div>
79+
<div class="stack-item"><strong>Layer 3 — SDK wrapper.</strong> The SDK helps wrap actions and emit receipts without manually assembling proof objects.</div>
80+
<div class="stack-item"><strong>Layer 4 — Runtime / verifier.</strong> Runtime signs production receipts. The verifier checks hash, signature, signer identity, and capability verb.</div>
7581
</div>
7682
</section>
7783

@@ -104,13 +110,14 @@ <h2>Install</h2>
104110

105111
<section class="doc-card">
106112
<h2>Wrap an action</h2>
107-
<p>Wrap your function with a capability verb. The wrapped function returns normal output plus a signed receipt that can be independently verified.</p>
113+
<p>Wrap your function with a capability verb. The wrapped function returns normal output plus a signed receipt with metadata.proof using json.sorted_keys.v1 canonicalization, SHA-256 hash, and Ed25519 signatures that can be independently verified.</p>
108114
<pre class="code-panel"><code>import { CommandLayer } from "@commandlayer/agent-sdk";
109115

110116
const cl = new CommandLayer({
111117
agent: "runtime.commandlayer.eth",
112-
privateKey: process.env.CL_PRIVATE_KEY_PEM,
113-
keyId: "vC4WbcNoq2znSCiQ"
118+
privateKeyPem: process.env.CL_PRIVATE_KEY_PEM,
119+
keyId: "vC4WbcNoq2znSCiQ",
120+
verifierUrl: "https://runtime.commandlayer.org/verify"
114121
});
115122

116123
const { output, receipt } = await cl.wrap("summarize", async () => {
@@ -126,16 +133,42 @@ <h2>Verify the receipt</h2>
126133
<p>Use the SDK in-app, or paste the receipt into the public verifier.</p>
127134
<pre class="code-panel"><code>const check = await cl.verify(receipt);
128135

129-
console.log(check.valid);</code></pre>
136+
console.log(check.ok);
137+
console.log(check.status);
138+
console.log(check.checks);</code></pre>
130139
<p style="margin-top:12px">Browser verification: <a class="inline-link" href="/verify.html">/verify.html</a></p>
131140
</section>
132141

142+
<section class="doc-card">
143+
<h2>Tamper test</h2>
144+
<pre class="code-panel"><code>const tampered = structuredClone(receipt);
145+
tampered.result.payload.summary = "changed";
146+
147+
const tamperedCheck = await cl.verify(tampered);
148+
149+
console.log(tamperedCheck.status); // INVALID
150+
console.log(tamperedCheck.errors?.signature_error); // hash_mismatch</code></pre>
151+
</section>
152+
153+
<section class="doc-card">
154+
<h2>Trust boundary</h2>
155+
<div class="rule-box">
156+
<strong>SDK wraps.</strong><br/>
157+
Runtime signs.<br/>
158+
MCP bridges.<br/>
159+
Verifier validates.<br/>
160+
Schema-valid alone is not verified.<br/>
161+
Private keys never go through MCP.
162+
</div>
163+
</section>
164+
133165
<section class="doc-card">
134166
<h2>What you get back</h2>
135167
<ul>
136168
<li><code>output</code>: the result from your wrapped function.</li>
137169
<li><code>receipt</code>: the signed proof payload for verification.</li>
138-
<li><code>check.valid</code>: verifier result for the receipt.</li>
170+
<li><code>check.ok</code> / <code>check.status</code>: whether verification passed.</li>
171+
<li><code>check.checks.hash_matches</code> and <code>check.checks.signature_valid</code>: critical proof checks.</li>
139172
</ul>
140173
</section>
141174
</div>
@@ -156,5 +189,7 @@ <h3>Best developer experience</h3>
156189
</aside>
157190
</div>
158191
</main>
192+
193+
<footer><div class="container footer-grid"><div><h4>Product</h4><a href="/protocol.html">Protocol</a><a href="/capabilities.html">Capabilities</a><a href="/verify.html">Verifier</a><a href="/runtime.html">Runtime</a><a href="/mcp.html">MCP</a><a href="/claim.html">Claim</a></div><div><h4>Developers</h4><a href="/docs/wrap-your-agent.html">Docs</a><a href="/sdk-records.html">SDK</a><a href="/schemas/">Schemas</a><a href="/api/verify">API</a><a href="https://github.com/commandlayer" target="_blank" rel="noopener">GitHub</a></div><div><h4>Proof</h4><a href="/stack-proof-demo.html">Production Proof</a><a href="/verify.html">VerifyAgent</a><a href="/capabilities/trust-verification/">Trust Verification</a><a href="/receipts/">Canonical Receipts</a></div></div></footer>
159194
</body>
160195
</html>

0 commit comments

Comments
 (0)