@agent-custody/receipts 0.14.0 → 0.16.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.
- package/README.md +48 -21
- package/dist/acs.d.ts +47 -0
- package/dist/acs.js +235 -0
- package/dist/addresses.d.ts +6 -0
- package/dist/addresses.js +90 -0
- package/dist/check.d.ts +10 -0
- package/dist/check.js +179 -3
- package/dist/cli.js +147 -12
- package/dist/config.d.ts +198 -1
- package/dist/config.js +154 -3
- package/dist/console.js +16 -7
- package/dist/deny-report.js +1 -1
- package/dist/door.d.ts +203 -0
- package/dist/door.js +712 -0
- package/dist/egress-draft.d.ts +43 -0
- package/dist/egress-draft.js +153 -0
- package/dist/egress.d.ts +116 -0
- package/dist/egress.js +585 -0
- package/dist/export.d.ts +39 -0
- package/dist/export.js +95 -0
- package/dist/gateway.js +53 -21
- package/dist/index.d.ts +15 -0
- package/dist/index.js +10 -0
- package/dist/issue.js +5 -65
- package/dist/lock.d.ts +12 -0
- package/dist/lock.js +124 -0
- package/dist/log.d.ts +11 -5
- package/dist/log.js +63 -43
- package/dist/opa-server.d.ts +34 -0
- package/dist/opa-server.js +93 -0
- package/dist/policy-rego.d.ts +30 -0
- package/dist/policy-rego.js +116 -0
- package/dist/portal.js +147 -41
- package/dist/pr-summary.d.ts +25 -0
- package/dist/pr-summary.js +87 -0
- package/dist/receipt.d.ts +8 -2
- package/dist/retention.d.ts +1 -1
- package/dist/retention.js +14 -4
- package/dist/sdk/index.js +10 -3
- package/dist/simulate.d.ts +3 -1
- package/dist/simulate.js +15 -7
- package/dist/verify.js +35 -4
- package/docs/acs.md +107 -0
- package/docs/configuration.md +3 -3
- package/docs/door-signals.md +66 -0
- package/docs/door.md +168 -0
- package/docs/egress.md +177 -0
- package/docs/github-action.md +164 -0
- package/docs/policies.md +112 -1
- package/docs/sdk.md +25 -9
- package/docs/threat-model.md +1 -1
- package/docs/tutorials.md +7 -0
- package/docs/usage.md +2 -2
- package/docs/verification.md +16 -2
- package/package.json +14 -13
- package/templates/claude-code.cedar +287 -10
- package/vectors/audit.json +27 -27
- package/vectors/canonical.json +5 -5
- package/vectors/merkle.json +123 -0
- package/vectors/receipts.json +1951 -1005
package/dist/portal.js
CHANGED
|
@@ -577,7 +577,7 @@ export function portalHandler(o) {
|
|
|
577
577
|
};
|
|
578
578
|
const page = (status, title, body, headers = {}) => {
|
|
579
579
|
res.writeHead(status, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", "content-security-policy": "default-src 'none'; style-src 'unsafe-inline'", ...headers });
|
|
580
|
-
res.end(
|
|
580
|
+
res.end(resultPage(title, `<p>${body}</p>`));
|
|
581
581
|
};
|
|
582
582
|
const esc = (v) => v.replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
583
583
|
const setCookie = (value) => `${cookieName}=${value ?? ""}; Path=/; HttpOnly; SameSite=Strict${o.trustProxy ? "; Secure" : ""}; Max-Age=${value ? 14 * 86_400 : 0}`;
|
|
@@ -590,7 +590,7 @@ export function portalHandler(o) {
|
|
|
590
590
|
// would not carry it. The page's own navigation to / does.
|
|
591
591
|
const signedInPage = (who, next, setCookies, lead) => {
|
|
592
592
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", "set-cookie": setCookies, "content-security-policy": "default-src 'none'; style-src 'unsafe-inline'" });
|
|
593
|
-
res.end(
|
|
593
|
+
res.end(resultPage("Signed in", `<p>${lead} ${esc(who)}. <a href="${next}">Continue</a>.</p>`, `<meta http-equiv="refresh" content="0;url=${next}">`));
|
|
594
594
|
};
|
|
595
595
|
const enforcedFor = async (id) => {
|
|
596
596
|
const t = await store.tenantOf(id);
|
|
@@ -754,7 +754,7 @@ export function portalHandler(o) {
|
|
|
754
754
|
// Opening the link proves nothing: an attacker may have registered the address, and its owner may click the link. Only the account's own session confirms it, through POST /api/verify-email.
|
|
755
755
|
const token = url.searchParams.get("token");
|
|
756
756
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", "content-security-policy": "default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; connect-src 'self'" });
|
|
757
|
-
return void res.end(
|
|
757
|
+
return void res.end(`${resultPage("Confirm your address", `<p id="m" aria-live="polite">Confirming ${esc(u.email)}...</p>`)}<script>
|
|
758
758
|
fetch("/api/verify-email", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ token: ${JSON.stringify(token).replace(/</g, "\\u003c")} }) }).then(async (r) => {
|
|
759
759
|
const b = await r.json().catch(() => ({}));
|
|
760
760
|
const m = document.getElementById("m");
|
|
@@ -1218,15 +1218,31 @@ export function servePortal(o, opts) {
|
|
|
1218
1218
|
}
|
|
1219
1219
|
// ---- the page: one file, no framework, no outside requests ----
|
|
1220
1220
|
const FAVICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#b45309"/><path d="M19 11H45V45L41.75 48 38.5 45 35.25 48 32 45 28.75 48 25.5 45 22.25 48 19 45Z" fill="#fff"/><path d="M25 20h14M25 27h14" stroke="#b45309" stroke-width="2.6" stroke-linecap="round"/><path d="M25 37.5l5 4.5 9.5-10" fill="none" stroke="#b45309" stroke-width="3.4" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
1221
|
+
const MARK = '<svg class="mark" viewBox="0 0 64 64" aria-hidden="true"><rect class="tile" width="64" height="64" rx="14"/><path d="M19 11H45V45L41.75 48 38.5 45 35.25 48 32 45 28.75 48 25.5 45 22.25 48 19 45Z" fill="#fff"/><path class="ink" d="M25 20h14M25 27h14" stroke-width="2.6" stroke-linecap="round"/><path class="ink" d="M25 37.5l5 4.5 9.5-10" fill="none" stroke-width="3.4" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
1222
|
+
// The small pages outside the app (errors, results, the address check) share the brand without the app's script.
|
|
1223
|
+
const RESULT_STYLE = `<style>
|
|
1224
|
+
:root { color-scheme: light dark; --ink: #1b2430; --ink2: #5b6b7a; --line: #d7dfe5; --bg: #f5f7f9; --panel: #ffffff; --accent: #b45309; --accent-bg: #fbf1dc; }
|
|
1225
|
+
@media (prefers-color-scheme: dark) { :root { --ink: #e6ecf0; --ink2: #9fb0bd; --line: #27333c; --bg: #0e1418; --panel: #151d23; --accent: #f59e0b; --accent-bg: #2d2412; } }
|
|
1226
|
+
* { box-sizing: border-box; }
|
|
1227
|
+
body { margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 1.5rem .75rem; color: var(--ink); font: 15px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; background-color: var(--bg); background-image: radial-gradient(56rem 26rem at 50% -8rem, var(--accent-bg), transparent 72%), radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink2) 20%, transparent) 1px, transparent 0); background-size: 100% 100%, 22px 22px; background-repeat: no-repeat, repeat; }
|
|
1228
|
+
main { position: relative; width: 100%; max-width: 27rem; padding: 2rem 2.25rem; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 14px; box-shadow: 0 1px 2px rgb(0 0 0 / .05), 0 18px 40px -18px rgb(0 0 0 / .25); }
|
|
1229
|
+
.brand { display: inline-flex; align-items: center; gap: .55rem; margin: 0 0 1.25rem; color: var(--ink); font-weight: 700; letter-spacing: .04em; text-decoration: none; }
|
|
1230
|
+
.mark { width: 28px; height: 28px; display: block; } .mark .tile { fill: var(--accent); } .mark .ink { stroke: var(--accent); }
|
|
1231
|
+
h1 { margin: 0 0 .5rem; font-size: 1.4rem; line-height: 1.25; letter-spacing: -.02em; }
|
|
1232
|
+
p { margin: 0; color: var(--ink2); overflow-wrap: anywhere; }
|
|
1233
|
+
a { color: var(--accent); font-weight: 600; text-underline-offset: 3px; } a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
|
|
1234
|
+
@media (max-width: 30rem) { main { padding: 1.5rem 1.25rem; } }
|
|
1235
|
+
</style>`;
|
|
1236
|
+
const resultPage = (title, body, head = "") => `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">${head}<title>${title}</title>${RESULT_STYLE}<main><a class="brand" href="/">${MARK}agent-custody</a><h1>${title}</h1>${body}</main>`;
|
|
1221
1237
|
const PORTAL_PAGE = `<!doctype html>
|
|
1222
1238
|
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1223
1239
|
<title>agent-custody</title>
|
|
1224
1240
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
1225
1241
|
<script>(() => { try { const t = localStorage.getItem("agent-custody-theme"); if (t === "dark" || t === "light") document.documentElement.dataset.theme = t; } catch {} })();</script>
|
|
1226
1242
|
<style>
|
|
1227
|
-
:root { color-scheme: light dark; --ink: #1b2430; --ink2: #5b6b7a; --line: #d7dfe5; --bg: #f5f7f9; --panel: #ffffff; --accent: #b45309; --accent-bg: #fbf1dc; --warn: #8a5a00; --bad: #b3261e; --ok: #1f7a4d; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
|
|
1228
|
-
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ink: #e6ecf0; --ink2: #9fb0bd; --line: #27333c; --bg: #0e1418; --panel: #151d23; --accent: #f59e0b; --accent-bg: #2d2412; --warn: #e2b862; --bad: #ff8a80; --ok: #6fd39a; } }
|
|
1229
|
-
:root[data-theme="dark"] { --ink: #e6ecf0; --ink2: #9fb0bd; --line: #27333c; --bg: #0e1418; --panel: #151d23; --accent: #f59e0b; --accent-bg: #2d2412; --warn: #e2b862; --bad: #ff8a80; --ok: #6fd39a; }
|
|
1243
|
+
:root { color-scheme: light dark; --ink: #1b2430; --ink2: #5b6b7a; --line: #d7dfe5; --bg: #f5f7f9; --panel: #ffffff; --accent: #b45309; --accent-bg: #fbf1dc; --warn: #8a5a00; --bad: #b3261e; --ok: #1f7a4d; --accent-ink: #ffffff; --accent-hover: #92400e; --field: #a9b4bd; --lift: 0 1px 2px rgb(0 0 0 / .04); --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
|
|
1244
|
+
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ink: #e6ecf0; --ink2: #9fb0bd; --line: #27333c; --bg: #0e1418; --panel: #151d23; --accent: #f59e0b; --accent-bg: #2d2412; --warn: #e2b862; --bad: #ff8a80; --ok: #6fd39a; --accent-ink: #1c1917; --accent-hover: #fbbf24; --field: #3d4c57; --lift: none; } }
|
|
1245
|
+
:root[data-theme="dark"] { --ink: #e6ecf0; --ink2: #9fb0bd; --line: #27333c; --bg: #0e1418; --panel: #151d23; --accent: #f59e0b; --accent-bg: #2d2412; --warn: #e2b862; --bad: #ff8a80; --ok: #6fd39a; --accent-ink: #1c1917; --accent-hover: #fbbf24; --field: #3d4c57; --lift: none; }
|
|
1230
1246
|
* { box-sizing: border-box; }
|
|
1231
1247
|
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
|
|
1232
1248
|
.top { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--panel); }
|
|
@@ -1235,102 +1251,191 @@ const PORTAL_PAGE = `<!doctype html>
|
|
|
1235
1251
|
.top .who { color: var(--ink2); font-size: .9rem; margin-left: .5rem; }
|
|
1236
1252
|
button.theme { background: transparent; color: var(--ink2); border: 1px solid var(--line); padding: .25rem .6rem; font-size: .8rem; border-radius: 4px; } button.theme:hover { color: var(--ink); }
|
|
1237
1253
|
.pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font: 600 .72rem/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; background: var(--accent-bg); color: var(--accent); }
|
|
1238
|
-
.notice {
|
|
1254
|
+
.notice { padding: .6rem 1.25rem; font-size: .9rem; color: var(--ink); background: var(--accent-bg); border-bottom: 1px solid var(--line); } .notice a, .notice button { margin-left: .6rem; } .notice button { font: inherit; background: none; border: 1px solid var(--line); border-radius: 4px; padding: .1rem .5rem; color: var(--ink); cursor: pointer; }
|
|
1255
|
+
.notice button:hover { background: var(--panel); border-color: var(--line); }
|
|
1256
|
+
a { color: var(--accent); text-underline-offset: 3px; }
|
|
1257
|
+
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
1239
1258
|
.layout { display: grid; grid-template-columns: 15rem 1fr; min-height: calc(100vh - 3.3rem); }
|
|
1240
1259
|
nav { border-right: 1px solid var(--line); background: var(--panel); padding: 1rem 0; }
|
|
1241
1260
|
nav .group { font: 600 .68rem/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); padding: 1rem 1.25rem .35rem; }
|
|
1242
|
-
nav a { display: flex; justify-content: space-between; padding: .45rem 1.25rem; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
|
|
1243
|
-
nav a.on { border-left-color: var(--accent); background: var(--accent-bg); }
|
|
1261
|
+
nav a { display: flex; justify-content: space-between; gap: .5rem; padding: .45rem 1.25rem; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
|
|
1262
|
+
nav a:hover { background: var(--bg); } nav a.on { border-left-color: var(--accent); background: var(--accent-bg); font-weight: 600; }
|
|
1244
1263
|
nav a span.n { color: var(--ink2); font-family: var(--mono); font-size: .8rem; }
|
|
1245
|
-
main { padding:
|
|
1246
|
-
h1 { font-size: 1.
|
|
1264
|
+
main { padding: 2rem 2rem 3rem; max-width: 72rem; min-width: 0; }
|
|
1265
|
+
h1 { font-size: 1.5rem; letter-spacing: -.02em; margin: 0 0 1rem; } h2 { font: 600 .72rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); margin: 1.5rem 0 .6rem; }
|
|
1247
1266
|
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .9rem; }
|
|
1248
|
-
.card { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius:
|
|
1267
|
+
.card { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 10px; box-shadow: var(--lift); padding: 1rem 1.1rem; }
|
|
1249
1268
|
.card.warn { border-top-color: var(--warn); } .card.bad { border-top-color: var(--bad); } .card.ok { border-top-color: var(--ok); }
|
|
1250
1269
|
.card .k { font: 600 .68rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
|
|
1251
1270
|
.card .v { font-size: 1.9rem; font-weight: 700; margin: .2rem 0 0; font-variant-numeric: tabular-nums; }
|
|
1252
1271
|
.card .s { color: var(--ink2); font-size: .88rem; }
|
|
1253
|
-
.panel { background: var(--panel); border: 1px solid var(--line); border-radius:
|
|
1272
|
+
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem; margin-top: .9rem; box-shadow: var(--lift); overflow-x: auto; } .panel > h2:first-child { margin-top: 0; }
|
|
1254
1273
|
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
|
|
1255
|
-
th, td { text-align: left; padding: .
|
|
1274
|
+
th, td { text-align: left; padding: .55rem .75rem .55rem 0; border-bottom: 1px solid var(--line); vertical-align: middle; } tbody tr:last-child > * { border-bottom: 0; }
|
|
1275
|
+
td button:not(.link) { padding: .25rem .7rem; font-size: .85rem; } td select { padding: .3rem .5rem; }
|
|
1276
|
+
#audit td:nth-child(-n+3) { white-space: nowrap; } #audit td:last-child { min-width: 16rem; overflow-wrap: anywhere; font-size: .86rem; }
|
|
1256
1277
|
th { font: 600 .68rem/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
|
|
1257
1278
|
code, pre, .mono { font-family: var(--mono); font-size: .86em; }
|
|
1258
|
-
pre { background: var(--bg); border: 1px solid var(--line); border-radius:
|
|
1279
|
+
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .8rem .9rem; overflow-x: auto; white-space: pre-wrap; }
|
|
1259
1280
|
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: .6rem; align-items: end; height: 9rem; }
|
|
1260
1281
|
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; font-size: .75rem; color: var(--ink2); }
|
|
1261
|
-
.bar i { display: block; width: 70%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
|
|
1282
|
+
.bar i { display: block; width: 70%; max-width: 4rem; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
|
|
1262
1283
|
.bar b { font-family: var(--mono); font-weight: 400; margin-top: .3rem; }
|
|
1263
1284
|
label { display: grid; gap: .25rem; font-size: .85rem; color: var(--ink2); margin: 0 0 .8rem; }
|
|
1264
1285
|
label .opt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; margin-left: .3rem; } label .hint { font-size: .8rem; line-height: 1.45; } label .hint code { font-family: var(--mono); font-size: .9em; }
|
|
1265
|
-
textarea { font: .86rem/1.5 var(--mono); padding: .5rem .6rem;
|
|
1266
|
-
input, select { font: inherit; padding: .5rem .6rem;
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
.
|
|
1272
|
-
.
|
|
1273
|
-
.
|
|
1286
|
+
textarea { font: .86rem/1.5 var(--mono); padding: .5rem .6rem; width: 100%; }
|
|
1287
|
+
input, select { font: inherit; padding: .5rem .6rem; }
|
|
1288
|
+
input, select, textarea { border: 1px solid var(--field); border-radius: 8px; background: var(--bg); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
|
|
1289
|
+
input::placeholder, textarea::placeholder { color: var(--ink2); opacity: .8; }
|
|
1290
|
+
input:focus, select:focus, textarea:focus { outline: 2px solid transparent; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
|
|
1291
|
+
button { font: inherit; font-weight: 600; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; transition: background-color .15s, border-color .15s; }
|
|
1292
|
+
button:not(.quiet, .link, .theme):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
|
|
1293
|
+
button.quiet { background: transparent; color: var(--accent); } button.quiet:hover { background: var(--accent-bg); }
|
|
1294
|
+
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
|
|
1295
|
+
button:disabled { opacity: .55; cursor: default; }
|
|
1296
|
+
body:has(> .auth:not([hidden])) { min-height: 100vh; background-color: var(--bg); background-image: radial-gradient(56rem 26rem at 50% -8rem, var(--accent-bg), transparent 72%), radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink2) 20%, transparent) 1px, transparent 0); background-size: 100% 100%, 22px 22px; background-repeat: no-repeat, repeat; }
|
|
1297
|
+
.auth { --pad: 2.25rem; position: relative; max-width: 27rem; margin: 3.5rem auto 4rem; padding: var(--pad) var(--pad) 1.75rem; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgb(0 0 0 / .05), 0 18px 40px -18px rgb(0 0 0 / .25); }
|
|
1298
|
+
.auth::before { content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 4px; border-radius: 14px 14px 0 0; background: var(--accent); }
|
|
1299
|
+
#onboard { max-width: 31rem; } .auth.wide { max-width: 44rem; }
|
|
1300
|
+
.auth.split { padding: 0; } .auth.split > .pane { padding: var(--pad) var(--pad) 1.75rem; } .pitch { display: none; }
|
|
1301
|
+
.pitch .eyebrow { color: #f59e0b; }
|
|
1302
|
+
.pitch h2 { margin: 0 0 1rem; font: 700 2rem/1.15 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: -.025em; text-transform: none; color: #fff; }
|
|
1303
|
+
.pitch > p { margin: 0 0 2rem; max-width: 30rem; color: #9fb0bd; }
|
|
1304
|
+
.flow { list-style: none; counter-reset: flow; display: grid; gap: 1.1rem; margin: 0; padding: 0; }
|
|
1305
|
+
.flow li { counter-increment: flow; display: grid; grid-template-columns: 2rem 1fr; gap: .1rem .85rem; }
|
|
1306
|
+
.flow li::before { content: counter(flow); grid-row: span 2; display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid rgb(255 255 255 / .2); border-radius: 50%; color: #9fb0bd; font: 700 .8rem var(--mono); }
|
|
1307
|
+
.flow li.now::before { background: #f59e0b; border-color: #f59e0b; color: #1c1917; }
|
|
1308
|
+
.flow b { color: #fff; font-weight: 600; } .flow span { color: #9fb0bd; font-size: .9rem; }
|
|
1309
|
+
@media (min-width: 60rem) {
|
|
1310
|
+
.auth.split { display: grid; grid-template-columns: minmax(0, 1fr) 27rem; max-width: 64rem; overflow: hidden; }
|
|
1311
|
+
#onboard.split { grid-template-columns: minmax(0, 1fr) 31rem; max-width: 68rem; }
|
|
1312
|
+
.pitch { display: flex; flex-direction: column; justify-content: center; padding: 3rem; background: radial-gradient(circle at 1px 1px, rgb(255 255 255 / .07) 1px, transparent 0) 0 0 / 22px 22px, linear-gradient(160deg, #1f2a35, #0e1418); }
|
|
1313
|
+
#onboard .pitch { justify-content: flex-start; padding-top: 4.5rem; }
|
|
1314
|
+
.split .fine { border-radius: 0; }
|
|
1315
|
+
.auth.wide { display: grid; grid-template-columns: 21rem minmax(0, 1fr); gap: 0 2.5rem; align-items: start; max-width: 72rem; }
|
|
1316
|
+
.wide .side { position: sticky; top: 1.5rem; } .wide #firstSetup > .step:first-child { border-top: 0; padding-top: 0; }
|
|
1317
|
+
}
|
|
1318
|
+
.auth .mark { display: block; width: 40px; height: 40px; margin: 0 0 1rem; } .mark .tile { fill: var(--accent); } .mark .ink { stroke: var(--accent); }
|
|
1319
|
+
.auth .eyebrow { margin: 0 0 .3rem; font: 600 .7rem/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
|
|
1320
|
+
.auth h1 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 1.5rem; }
|
|
1321
|
+
.auth h1 + .muted { margin-top: -.75rem; }
|
|
1322
|
+
.auth label { color: var(--ink); font-weight: 600; font-size: .85rem; gap: .4rem; margin: 0 0 1rem; }
|
|
1323
|
+
.auth label { position: relative; } .auth label .opt { position: absolute; top: .1rem; right: 0; margin: 0; }
|
|
1324
|
+
.auth label .opt, .auth label .hint { font-weight: 400; color: var(--ink2); }
|
|
1325
|
+
.auth input, .auth select { width: 100%; min-height: 2.75rem; padding: .6rem .8rem; font-size: 1rem; font-weight: 400; }
|
|
1326
|
+
.auth form > button[type="submit"] { display: block; width: 100%; min-height: 2.75rem; margin-top: .25rem; }
|
|
1327
|
+
.providers { display: grid; gap: .6rem; margin: 0 0 1.25rem; }
|
|
1328
|
+
.providers a { display: flex; align-items: center; justify-content: center; gap: .6rem; min-height: 2.75rem; padding: .55rem .9rem; border: 1px solid var(--field); border-radius: 8px; background: var(--panel); color: var(--ink); text-decoration: none; font-weight: 600; transition: border-color .15s, background-color .15s; }
|
|
1329
|
+
.providers a:hover { border-color: var(--accent); background: var(--bg); } .providers svg { width: 18px; height: 18px; flex: none; }
|
|
1330
|
+
.or { display: flex; align-items: center; gap: .75rem; margin: .4rem 0 0; color: var(--ink2); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
|
|
1331
|
+
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
|
|
1332
|
+
#authNote { margin: 1rem 0 0; padding: .65rem .85rem; border-radius: 8px; background: var(--accent-bg); color: var(--ink); font-size: .88rem; }
|
|
1333
|
+
#ssoForm { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); } #ssoForm button { margin-top: .25rem; }
|
|
1334
|
+
.auth .swap { text-align: center; margin: 1.25rem 0 0; }
|
|
1335
|
+
.auth .fine { margin: 1.5rem calc(-1 * var(--pad)) -1.75rem; padding: 1rem var(--pad); border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; background: var(--bg); font-size: .82rem; line-height: 1.55; }
|
|
1336
|
+
.auth .msg { min-height: 0; margin: .75rem 0 0; font-size: .9rem; } .auth .msg:empty { margin: 0; }
|
|
1337
|
+
.auth .msg.err:not(:empty), .auth .msg.ok:not(:empty) { padding: .55rem .8rem; border-radius: 8px; border: 1px solid; }
|
|
1338
|
+
.auth .msg.err:not(:empty) { border-color: color-mix(in srgb, var(--bad) 40%, var(--panel)); background: color-mix(in srgb, var(--bad) 8%, var(--panel)); }
|
|
1339
|
+
.auth .msg.ok:not(:empty) { border-color: color-mix(in srgb, var(--ok) 40%, var(--panel)); background: color-mix(in srgb, var(--ok) 8%, var(--panel)); }
|
|
1340
|
+
@media (max-width: 30rem) { .top { flex-wrap: wrap; row-gap: .4rem; } .brand, button.theme { white-space: nowrap; } button.theme { margin-left: auto; } .top .links { order: 1; flex-basis: 100%; margin-left: 0; font-size: .85rem; } .top .who, #planTag { display: none !important; } .auth { --pad: 1.25rem; margin: 1rem .75rem 2rem; border-radius: 12px; } .auth::before { border-radius: 12px 12px 0 0; } .auth .fine { border-radius: 0 0 12px 12px; } .auth h1 { font-size: 1.4rem; } }
|
|
1274
1341
|
.step { display: grid; grid-template-columns: 2rem 1fr; gap: .2rem .8rem; padding: 1rem 0; border-top: 1px solid var(--line); }
|
|
1275
1342
|
.step .n { font: 700 .85rem/1.6 var(--mono); color: var(--accent); }
|
|
1276
1343
|
.step h3 { margin: 0 0 .3rem; font-size: 1rem; } .step p { margin: 0 0 .5rem; color: var(--ink2); font-size: .92rem; }
|
|
1277
1344
|
.snip { position: relative; margin: .4rem 0 .6rem; } .snip pre { margin: 0; padding-right: 4.5rem; font-family: var(--mono); font-size: .84rem; }
|
|
1278
1345
|
.snip button { position: absolute; top: .45rem; right: .45rem; padding: .2rem .6rem; font-size: .8rem; }
|
|
1279
1346
|
.addr th { text-align: left; font-weight: 600; padding-right: 1rem; white-space: nowrap; } .addr td { word-break: break-all; }
|
|
1280
|
-
.once { border: 1px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); border-radius:
|
|
1281
|
-
.tok { font-family: var(--mono); word-break: break-all; padding: .6rem; background: var(--bg); border-radius:
|
|
1282
|
-
.msg { min-height: 1.4rem; margin: .6rem 0; color: var(--ink2); } .msg.err { color: var(--bad); } .msg.ok { color: var(--ok); }
|
|
1347
|
+
.once { border: 1px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); border-radius: 10px; padding: 1rem 1.1rem; margin: 1rem 0; }
|
|
1348
|
+
.tok { font-family: var(--mono); word-break: break-all; padding: .6rem .75rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
|
|
1349
|
+
.msg { min-height: 1.4rem; margin: .6rem 0; color: var(--ink2); } .panel > .msg:empty { display: none; } .msg.err { color: var(--bad); } .msg.ok { color: var(--ok); }
|
|
1283
1350
|
.muted { color: var(--ink2); }
|
|
1284
1351
|
[hidden] { display: none !important; }
|
|
1285
|
-
@media (max-width: 48rem) { .layout { grid-template-columns: 1fr; } nav { display: flex;
|
|
1352
|
+
@media (max-width: 48rem) { .layout { grid-template-columns: 1fr; } nav { display: flex; overflow-x: auto; padding: 0 .3rem; border-right: 0; border-bottom: 1px solid var(--line); } nav .group { display: none; } nav a { flex: none; white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; } main { padding: 1.25rem 1rem 2rem; } nav a.on { border-bottom-color: var(--accent); }
|
|
1353
|
+
.cards { grid-template-columns: 1fr 1fr; gap: .6rem; } .card { padding: .75rem .85rem; } .card .k { font-size: .6rem; letter-spacing: .06em; } .card .v { font-size: 1.4rem; } .card .s { font-size: .8rem; line-height: 1.35; }
|
|
1354
|
+
table:has(#urls), #urls, table:has(#audit), #audit { display: block; } table:has(#audit) thead { display: none; }
|
|
1355
|
+
#urls tr { display: grid; gap: .15rem; padding: .55rem 0; border-bottom: 1px solid var(--line); } #urls tr:last-child { border-bottom: 0; }
|
|
1356
|
+
#urls th, #urls td { padding: 0; border: 0; } #urls td { overflow-wrap: anywhere; font-size: .8rem; }
|
|
1357
|
+
#audit tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .75rem; padding: .65rem 0; border-bottom: 1px solid var(--line); } #audit tr:last-child { border-bottom: 0; }
|
|
1358
|
+
#audit td { min-width: 0; padding: 0; border: 0; white-space: normal; }
|
|
1359
|
+
#audit td:nth-child(3) { grid-area: 1 / 1; font-weight: 600; } #audit td:nth-child(1) { grid-area: 1 / 2; color: var(--ink2); font-size: .8rem; white-space: nowrap; }
|
|
1360
|
+
#audit td:nth-child(2), #audit td:nth-child(4), #audit td[colspan] { grid-column: 1 / -1; font-size: .8rem; } #audit td:nth-child(2) { color: var(--ink2); } }
|
|
1286
1361
|
</style>
|
|
1287
1362
|
<div class="top"><a class="brand" href="https://agent-custody.dev/"><svg viewBox="0 0 64 64" aria-hidden="true"><rect width="64" height="64" rx="14"/><path d="M19 11H45V45L41.75 48 38.5 45 35.25 48 32 45 28.75 48 25.5 45 22.25 48 19 45Z" fill="#fff"/><path d="M25 20h14M25 27h14" stroke="var(--accent)" stroke-width="2.6" stroke-linecap="round"/><path d="M25 37.5l5 4.5 9.5-10" fill="none" stroke="var(--accent)" stroke-width="3.4" stroke-linecap="round" stroke-linejoin="round"/></svg>agent-custody</a><span id="tenantTag" class="pill" hidden></span><span id="planTag" class="pill" hidden></span><span class="links"><a href="https://agent-custody.dev/guide/getting-started">Guide</a><a href="https://docs.agent-custody.dev/reference/">Docs</a><a href="https://agent-custody.dev/verify">Verify a receipt</a></span><span class="who" id="who"></span><button class="theme" id="themeToggle" type="button">Dark mode</button></div>
|
|
1288
1363
|
<div id="notice" class="notice" hidden></div>
|
|
1289
|
-
<section id="auth" class="auth" hidden>
|
|
1364
|
+
<section id="auth" class="auth split" hidden>
|
|
1365
|
+
<aside class="pitch">
|
|
1366
|
+
<p class="eyebrow">agent-custody hosted log</p>
|
|
1367
|
+
<h2>Proof of what your AI agents did.</h2>
|
|
1368
|
+
<p>Your gateway signs a receipt for each tool call that it checks. This log keeps the hash of each receipt in a Merkle tree with signed heads, so a changed or removed receipt shows.</p>
|
|
1369
|
+
<ol class="flow">
|
|
1370
|
+
<li><b>Your agent calls a tool</b><span>The gateway checks the call against your policy before it runs.</span></li>
|
|
1371
|
+
<li><b>The gateway signs a receipt</b><span>The receipt stays on your machines.</span></li>
|
|
1372
|
+
<li><b>Its hash comes to this log</b><span>Anyone with the public keys can verify the receipt and its place in the log.</span></li>
|
|
1373
|
+
</ol>
|
|
1374
|
+
</aside>
|
|
1375
|
+
<div class="pane">
|
|
1376
|
+
${MARK}
|
|
1377
|
+
<p class="eyebrow">Hosted log</p>
|
|
1290
1378
|
<h1 id="authTitle">Sign in</h1>
|
|
1291
1379
|
<div id="providers" class="providers" hidden></div>
|
|
1292
1380
|
<form id="authForm">
|
|
1293
1381
|
<label>Work email<input id="email" type="email" autocomplete="email" required></label>
|
|
1294
1382
|
<label>Password<input id="password" type="password" autocomplete="current-password" minlength="10" required></label>
|
|
1295
1383
|
<button id="authGo" type="submit">Sign in</button>
|
|
1296
|
-
<p class="msg" id="authMsg"></p>
|
|
1384
|
+
<p class="msg" id="authMsg" aria-live="polite"></p>
|
|
1297
1385
|
</form>
|
|
1298
1386
|
<form id="mfaForm" hidden>
|
|
1299
1387
|
<p class="muted">Your account has two-step sign-in. Enter the six-digit code from your authenticator app.</p>
|
|
1300
1388
|
<label>Code<input id="mfaCode" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" maxlength="6" required></label>
|
|
1301
1389
|
<button type="submit">Verify</button>
|
|
1302
|
-
<p class="msg" id="mfaMsg"></p>
|
|
1390
|
+
<p class="msg" id="mfaMsg" aria-live="polite"></p>
|
|
1303
1391
|
</form>
|
|
1304
1392
|
<p class="muted" id="authNote" hidden>Next you name your organisation and get your tenant and its first key. Two minutes.</p>
|
|
1305
1393
|
<form id="ssoForm" action="/auth/sso" method="get">
|
|
1306
1394
|
<label>Work email for single sign-on<input name="email" type="email" autocomplete="email" required></label>
|
|
1307
1395
|
<button class="quiet" type="submit">Sign in with single sign-on</button>
|
|
1308
1396
|
</form>
|
|
1309
|
-
<p class="muted"><button class="link" id="authSwap" type="button">Create an account instead</button></p>
|
|
1310
|
-
<p class="muted">The free plan is ten thousand appends a month, no card. Your gateway sends only hashes; nothing you log here can be read by us.</p>
|
|
1397
|
+
<p class="muted swap"><button class="link" id="authSwap" type="button">Create an account instead</button></p>
|
|
1398
|
+
<p class="muted fine">The free plan is ten thousand appends a month, no card. Your gateway sends only hashes; nothing you log here can be read by us.</p>
|
|
1399
|
+
</div>
|
|
1311
1400
|
</section>
|
|
1312
|
-
<section id="onboard" class="auth" hidden>
|
|
1401
|
+
<section id="onboard" class="auth split" hidden>
|
|
1402
|
+
<aside class="pitch">
|
|
1403
|
+
<p class="eyebrow">Setup, step 1 of 4</p>
|
|
1404
|
+
<h2>Your own log, in about two minutes.</h2>
|
|
1405
|
+
<ol class="flow">
|
|
1406
|
+
<li class="now"><b>Create your tenant</b><span>Name your organisation. The tenant id becomes the path of your log.</span></li>
|
|
1407
|
+
<li><b>Copy your first API key</b><span>We show it once and keep only its hash.</span></li>
|
|
1408
|
+
<li><b>Point your gateway at the log</b><span>One config entry and one environment variable.</span></li>
|
|
1409
|
+
<li><b>Send your first receipt</b><span>The dashboard shows the append within seconds.</span></li>
|
|
1410
|
+
</ol>
|
|
1411
|
+
</aside>
|
|
1412
|
+
<div class="pane">
|
|
1413
|
+
${MARK}
|
|
1313
1414
|
<h1>Set up your tenant</h1>
|
|
1314
1415
|
<p class="muted">Signed in as <b id="onboardWho"></b>. A tenant is your own log on this service, with its own keys and its own path.</p>
|
|
1315
1416
|
<div id="invites" class="panel" hidden><p><b>You are invited to join a tenant.</b> Your email address must be verified first.</p><div id="inviteList"></div></div>
|
|
1316
1417
|
<form id="onboardForm">
|
|
1317
1418
|
<label>Your name<input id="name" autocomplete="name" maxlength="120" required></label>
|
|
1318
1419
|
<label>Company or organisation<input id="company" autocomplete="organization" maxlength="160" required></label>
|
|
1319
|
-
<label>Tenant id<input id="tenant" placeholder="acme" pattern="[a-z0-9][a-z0-9
|
|
1420
|
+
<label>Tenant id<input id="tenant" placeholder="acme" pattern="[a-z0-9][a-z0-9\\-]{1,38}[a-z0-9]" required><span class="hint">A short name for your organisation, filled in from the company name; change it if you like. It becomes the path of your log, which your gateway config and your auditors will use: <code id="tenantPreview">__LOG_BASE__t/<tenant>/</code></span></label>
|
|
1320
1421
|
<label>Your role <span class="opt">optional</span><input id="role" autocomplete="organization-title" maxlength="120" placeholder="Head of Platform"></label>
|
|
1321
1422
|
<label>Phone <span class="opt">optional</span><input id="phone" type="tel" autocomplete="tel" maxlength="40" placeholder="+44 20 …"></label>
|
|
1322
1423
|
<label>Telegram username <span class="opt">optional</span><input id="telegram" maxlength="40" placeholder="@yourname"><span class="hint">Your handle in Telegram, under Settings, if you would rather we reach you there than by email.</span></label>
|
|
1323
1424
|
<button type="submit">Create tenant</button>
|
|
1324
|
-
<p class="msg" id="onboardMsg"></p>
|
|
1425
|
+
<p class="msg" id="onboardMsg" aria-live="polite"></p>
|
|
1325
1426
|
</form>
|
|
1326
1427
|
<p class="muted"><a href="#" id="signoutOnboard">Sign out</a></p>
|
|
1428
|
+
</div>
|
|
1327
1429
|
</section>
|
|
1328
1430
|
<section id="welcome" class="auth wide" hidden>
|
|
1431
|
+
<div class="side">
|
|
1432
|
+
${MARK}
|
|
1329
1433
|
<h1>Your tenant is ready</h1>
|
|
1330
1434
|
<p class="muted">Three steps to your first receipt in this log. Everything here is under <b>Setup</b> in the dashboard whenever you need it again.</p>
|
|
1331
1435
|
<div class="once"><p><b>Your first API key, shown once.</b> Put it in the environment your gateway reads as <code>AGENT_CUSTODY_LOG_TOKEN</code>. We keep only its hash.</p><p class="tok" id="firstToken"></p><button class="quiet" id="copyFirst">Copy key</button></div>
|
|
1332
|
-
<div id="firstSetup"></div>
|
|
1333
1436
|
<p><button id="toDash">Go to the dashboard</button></p>
|
|
1437
|
+
</div>
|
|
1438
|
+
<div id="firstSetup"></div>
|
|
1334
1439
|
</section>
|
|
1335
1440
|
<div class="layout" id="app" hidden>
|
|
1336
1441
|
<nav>
|
|
@@ -1444,13 +1549,14 @@ const PORTAL_PAGE = `<!doctype html>
|
|
|
1444
1549
|
const note = (id, text, ok) => { $(id).className = "msg " + (ok ? "ok" : "err"); $(id).textContent = text; };
|
|
1445
1550
|
const show = (id) => { for (const s of ["auth", "onboard", "welcome", "app"]) $(s).hidden = s !== id; };
|
|
1446
1551
|
const PROVIDERS = __PROVIDERS__;
|
|
1447
|
-
|
|
1552
|
+
const ICONS = { github: "<svg viewBox='0 0 16 16' aria-hidden='true'><path fill='currentColor' d='M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z'/></svg>", google: "<svg viewBox='0 0 48 48' aria-hidden='true'><path fill='#EA4335' d='M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z'/><path fill='#4285F4' d='M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z'/><path fill='#FBBC05' d='M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z'/><path fill='#34A853' d='M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z'/></svg>" };
|
|
1553
|
+
if (PROVIDERS.length) { $("providers").innerHTML = PROVIDERS.map((p) => "<a href='/auth/" + p + "'>" + ICONS[p] + "Continue with " + (p === "github" ? "GitHub" : "Google") + "</a>").join("") + "<p class=or>or with email</p>"; $("providers").hidden = false; }
|
|
1448
1554
|
const view = (name) => {
|
|
1449
1555
|
for (const p of document.querySelectorAll("[data-pane]")) p.hidden = p.dataset.pane !== name;
|
|
1450
1556
|
for (const a of document.querySelectorAll("nav a[data-view]")) a.classList.toggle("on", a.dataset.view === name);
|
|
1451
1557
|
location.hash = name;
|
|
1452
1558
|
};
|
|
1453
|
-
const LOG_BASE = "
|
|
1559
|
+
const LOG_BASE = $("tenantPreview").textContent.replace("t/<tenant>/", "");
|
|
1454
1560
|
const slug = (s) => s.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
|
|
1455
1561
|
let tenantEdited = false;
|
|
1456
1562
|
const previewTenant = () => { $("tenantPreview").textContent = LOG_BASE + "t/" + ($("tenant").value || "<tenant>") + "/"; };
|
|
@@ -1489,7 +1595,7 @@ const PORTAL_PAGE = `<!doctype html>
|
|
|
1489
1595
|
const step = (n, title, body) => "<div class=step><span class=n>" + n + "</span><div><h3>" + title + "</h3>" + body + "</div></div>";
|
|
1490
1596
|
const renderSetup = (el, s, atRegistration) => {
|
|
1491
1597
|
el.innerHTML =
|
|
1492
|
-
step(1, "Keep the key where your gateway runs", (atRegistration ? "<p>
|
|
1598
|
+
step(1, "Keep the key where your gateway runs", (atRegistration ? "<p>Your first key is shown once; we keep only its hash. Put it in the environment of the machine that runs your gateway or SDK:</p>" : "<p>Your key was shown once at registration. If it is gone, mint another under <a href=\\"#keys\\" data-view=\\"keys\\">API keys</a>. It lives in the environment of the machine that runs your gateway or SDK:</p>") + snip(s.env)) +
|
|
1493
1599
|
step(2, "Point your gateway or SDK at your log", "<p>Add this to <code>gateway.json</code> or <code>sdk.json</code>. <code>hashOnly</code> means this log receives the hash of each receipt and never the receipt.</p>" + snip(s.config)) +
|
|
1494
1600
|
step(3, "Send the first receipt", "<p>Run your agent through the gateway once. The <a href=\\"#overview\\" data-view=\\"overview\\">Overview</a> shows the append within seconds, and the first signed checkpoint follows within minutes. New to the gateway? <a href=\\"https://agent-custody.dev/guide/getting-started\\">Getting started</a> takes ten minutes.</p>") +
|
|
1495
1601
|
step(4, "Hand this to whoever verifies your receipts", "<p>Both commands fetch this log's published keys and pin them; <code>--log-id</code> makes sure the tree heads are this log's.</p>" + snip(s.verify) + snip(s.audit)) +
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type VerifyOptions } from "./verify.ts";
|
|
2
|
+
/** The action finds its own comment again by this line, so it edits one comment and never adds a second. */
|
|
3
|
+
export declare const SUMMARY_MARKER = "<!-- agent-custody -->";
|
|
4
|
+
export interface SummaryRow {
|
|
5
|
+
file: string;
|
|
6
|
+
receiptId: string;
|
|
7
|
+
tool: string;
|
|
8
|
+
/** the execution status in the signed receipt, or "-" when the signature fails and nothing in the receipt is trusted */
|
|
9
|
+
status: string;
|
|
10
|
+
/** "verified", or the names of the checks that failed, joined with "; " */
|
|
11
|
+
result: string;
|
|
12
|
+
ok: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PrSummary {
|
|
15
|
+
ok: boolean;
|
|
16
|
+
rows: SummaryRow[];
|
|
17
|
+
/** set when no receipt was read */
|
|
18
|
+
problem?: string;
|
|
19
|
+
}
|
|
20
|
+
/** The bundle files of a directory (not the `<id>.authorization.json` files, not the subdirectories, not the symbolic links), or the one file given. A path that does not exist holds no receipts. */
|
|
21
|
+
export declare function receiptFiles(path: string): string[];
|
|
22
|
+
/** Verifies each file. Fails when a receipt does not verify, and when there is no receipt at all. */
|
|
23
|
+
export declare function summarizeReceipts(files: string[], opts: VerifyOptions): PrSummary;
|
|
24
|
+
/** The pull request comment and the job summary. It starts with the marker line. */
|
|
25
|
+
export declare function formatSummaryMarkdown(s: PrSummary): string;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// `agent-custody verify --markdown`: verifies every receipt bundle in a directory and prints one table for a pull request.
|
|
2
|
+
// The GitHub Action in action.yml posts this table. The module reads files and calls the verifier. It never uses the network.
|
|
3
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
4
|
+
import { basename, join } from "node:path";
|
|
5
|
+
import { verifyBundle } from "./verify.js";
|
|
6
|
+
/** The action finds its own comment again by this line, so it edits one comment and never adds a second. */
|
|
7
|
+
export const SUMMARY_MARKER = "<!-- agent-custody -->";
|
|
8
|
+
const AUTHORIZATION = ".authorization.json";
|
|
9
|
+
const MAX_ROWS = 200;
|
|
10
|
+
const MAX_NAMES = 3;
|
|
11
|
+
const KNOWN_STATUS = new Set(["executed", "denied", "failed", "error", "withheld"]);
|
|
12
|
+
/** The bundle files of a directory (not the `<id>.authorization.json` files, not the subdirectories, not the symbolic links), or the one file given. A path that does not exist holds no receipts. */
|
|
13
|
+
export function receiptFiles(path) {
|
|
14
|
+
if (!existsSync(path))
|
|
15
|
+
return [];
|
|
16
|
+
if (!statSync(path).isDirectory())
|
|
17
|
+
return [path];
|
|
18
|
+
return readdirSync(path, { withFileTypes: true })
|
|
19
|
+
.filter((e) => e.isFile() && e.name.endsWith(".json") && !e.name.endsWith(AUTHORIZATION))
|
|
20
|
+
.map((e) => join(path, e.name))
|
|
21
|
+
.sort();
|
|
22
|
+
}
|
|
23
|
+
function rowOf(file, opts) {
|
|
24
|
+
const stem = basename(file).replace(/\.json$/, "");
|
|
25
|
+
const fail = (result) => ({ file, receiptId: stem, tool: "-", status: "-", result, ok: false });
|
|
26
|
+
let bundle;
|
|
27
|
+
try {
|
|
28
|
+
bundle = JSON.parse(readFileSync(file, "utf8"));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// the comment is public: a parser message can quote the first bytes of the file
|
|
32
|
+
return fail("not a JSON file");
|
|
33
|
+
}
|
|
34
|
+
let result;
|
|
35
|
+
try {
|
|
36
|
+
result = verifyBundle(bundle, opts);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return fail("not a receipt bundle");
|
|
40
|
+
}
|
|
41
|
+
const failed = result.checks.filter((c) => !c.ok).map((c) => c.name);
|
|
42
|
+
const p = result.statement?.predicate;
|
|
43
|
+
if (!p)
|
|
44
|
+
return fail(failed.length ? failed.join("; ") : "no receipt in the bundle");
|
|
45
|
+
// the gateway names each file by its receipt id, so a valid receipt under another name does not stand in for that one
|
|
46
|
+
if (basename(file) !== `${p.receiptId}.json`)
|
|
47
|
+
failed.push("file name matches receipt id");
|
|
48
|
+
return { file, receiptId: p.receiptId, tool: p.tool.name, status: p.execution.status, result: failed.length ? failed.join("; ") : "verified", ok: failed.length === 0 };
|
|
49
|
+
}
|
|
50
|
+
/** Verifies each file. Fails when a receipt does not verify, and when there is no receipt at all. */
|
|
51
|
+
export function summarizeReceipts(files, opts) {
|
|
52
|
+
if (files.length === 0)
|
|
53
|
+
return { ok: false, rows: [], problem: "No receipt bundles found." };
|
|
54
|
+
const rows = files.map((f) => rowOf(f, opts));
|
|
55
|
+
return { ok: rows.every((r) => r.ok), rows };
|
|
56
|
+
}
|
|
57
|
+
/** Receipt data is text from the agent. Remove what could break a table cell or inject Markdown or HTML. */
|
|
58
|
+
function code(text, max = 80) {
|
|
59
|
+
if (text === "-")
|
|
60
|
+
return text;
|
|
61
|
+
const clean = text.replace(/[^\x20-\x7e]|[|`<>\\]/g, "?");
|
|
62
|
+
return `\`${clean.length > max ? `${clean.slice(0, max - 3)}...` : clean}\``;
|
|
63
|
+
}
|
|
64
|
+
function resultCell(r) {
|
|
65
|
+
if (r.ok)
|
|
66
|
+
return "verified";
|
|
67
|
+
const names = r.result.split("; ");
|
|
68
|
+
const shown = names.slice(0, MAX_NAMES).map((n) => code(n)).join("; ");
|
|
69
|
+
return names.length > MAX_NAMES ? `${shown} (+${names.length - MAX_NAMES} more)` : shown;
|
|
70
|
+
}
|
|
71
|
+
/** The pull request comment and the job summary. It starts with the marker line. */
|
|
72
|
+
export function formatSummaryMarkdown(s) {
|
|
73
|
+
const lines = [SUMMARY_MARKER, "## agent-custody receipts", ""];
|
|
74
|
+
if (s.rows.length === 0) {
|
|
75
|
+
lines.push(`**Not verified.** ${s.problem ?? "No receipt bundles found."}`);
|
|
76
|
+
return lines.join("\n") + "\n";
|
|
77
|
+
}
|
|
78
|
+
const failed = s.rows.filter((r) => !r.ok).length;
|
|
79
|
+
lines.push(failed === 0 ? `**Verified.** All ${s.rows.length} receipts verify.` : `**Not verified.** ${failed} of ${s.rows.length} receipts do not verify.`, "");
|
|
80
|
+
lines.push("| Receipt | Tool | Status | Result |", "| --- | --- | --- | --- |");
|
|
81
|
+
const shown = [...s.rows.filter((r) => !r.ok), ...s.rows.filter((r) => r.ok)].slice(0, MAX_ROWS);
|
|
82
|
+
for (const r of shown)
|
|
83
|
+
lines.push(`| ${code(r.receiptId)} | ${code(r.tool)} | ${KNOWN_STATUS.has(r.status) ? r.status : code(r.status)} | ${resultCell(r)} |`);
|
|
84
|
+
if (s.rows.length > shown.length)
|
|
85
|
+
lines.push("", `${s.rows.length - shown.length} more receipts are not shown. Every receipt that does not verify is listed first.`);
|
|
86
|
+
return lines.join("\n") + "\n";
|
|
87
|
+
}
|
package/dist/receipt.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const TREEHEAD_TYPE = "application/vnd.agent-custody.treehead+jso
|
|
|
13
13
|
/**
|
|
14
14
|
* Provenance of a receipt field. This is the honest part of the design.
|
|
15
15
|
* - attested: signed by a key other than the issuer's (today: the principal's delegation key)
|
|
16
|
-
* - observed: the issuer obtained this deterministically, outside the agent's control (
|
|
16
|
+
* - observed: the issuer obtained this deterministically, outside the agent's control (an out-of-process issuer only; an egress witness marks the agent observed when it checked the agent's proxy credential)
|
|
17
17
|
* - claimed: originates from the agent, the model, or the agent's own process, with no independent check
|
|
18
18
|
*/
|
|
19
19
|
export type Provenance = "attested" | "observed" | "claimed";
|
|
@@ -21,8 +21,14 @@ export type Provenance = "attested" | "observed" | "claimed";
|
|
|
21
21
|
* Who produced the receipt. This is the first thing a verifier should read.
|
|
22
22
|
* - gateway: an out-of-process enforcement point; the agent could neither skip nor forge it
|
|
23
23
|
* - sdk: an interceptor inside the agent's own process; self-reported, tamper-evident after issue but not before
|
|
24
|
+
* - door: an out-of-process enforcement point in front of a business's own HTTP surface; the arriving agent, caller,
|
|
25
|
+
* or browser could neither skip nor forge it, and has no grant unless it presented one
|
|
26
|
+
* - egress: a forward proxy in a locked-down agent's network path, for connections that do not go to the gateway; it
|
|
27
|
+
* saw where traffic went and how much, never what was sent. Each receipt is an observed bypass of the gateway
|
|
28
|
+
* - guardian: an OWASP ACS Guardian outside the agent's process. The decision is its own and signed with its key; the
|
|
29
|
+
* call is the agent's report. The agent could skip asking or ignore the answer, so nothing here was enforced
|
|
24
30
|
*/
|
|
25
|
-
export type IssuerKind = "gateway" | "sdk";
|
|
31
|
+
export type IssuerKind = "gateway" | "sdk" | "door" | "egress" | "guardian";
|
|
26
32
|
export interface FactRecord {
|
|
27
33
|
tool: string;
|
|
28
34
|
args: Record<string, unknown>;
|
package/dist/retention.d.ts
CHANGED
|
@@ -16,6 +16,6 @@ export interface PruneResult {
|
|
|
16
16
|
/**
|
|
17
17
|
* Prunes every leaf whose receipt timestamp is before the cutoff. Leaves already pruned, and leaves that are not
|
|
18
18
|
* receipts, are left as they are. Rewrites the log file in place and deletes the pruned receipts' bundle files, and
|
|
19
|
-
* the salts the issuer kept for them.
|
|
19
|
+
* the salts the issuer kept for them. It holds the log lock, so a receipt that a hook appends during the prune is not lost.
|
|
20
20
|
*/
|
|
21
21
|
export declare function pruneLog(logFile: string, before: string, receiptsDir?: string): PruneResult;
|
package/dist/retention.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
// the Merkle tree, every root, and every inclusion and consistency proof for the remaining leaves are unchanged, while
|
|
4
4
|
// the pruned receipt's content is gone from the log and its bundle file is removed. A verifier holding a pruned
|
|
5
5
|
// receipt's bundle can still prove inclusion; nobody holding only the log can recover what the receipt said.
|
|
6
|
-
import { existsSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { appendFileSync, existsSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
|
-
import { leafHash } from "./log.js";
|
|
8
|
+
import { leafHash, logLocked } from "./log.js";
|
|
9
9
|
/** where the issuer keeps the salts behind a receipt's commitments, under the receipts directory; private, pruned with the receipt */
|
|
10
10
|
export const SALTS_DIR = "salts";
|
|
11
11
|
/** a receipt id as the issuer mints it; anything else never becomes part of a path */
|
|
@@ -29,10 +29,20 @@ function receiptOf(leaf) {
|
|
|
29
29
|
/**
|
|
30
30
|
* Prunes every leaf whose receipt timestamp is before the cutoff. Leaves already pruned, and leaves that are not
|
|
31
31
|
* receipts, are left as they are. Rewrites the log file in place and deletes the pruned receipts' bundle files, and
|
|
32
|
-
* the salts the issuer kept for them.
|
|
32
|
+
* the salts the issuer kept for them. It holds the log lock, so a receipt that a hook appends during the prune is not lost.
|
|
33
33
|
*/
|
|
34
34
|
export function pruneLog(logFile, before, receiptsDir) {
|
|
35
|
-
|
|
35
|
+
return logLocked(logFile, () => pruneLocked(logFile, before, receiptsDir));
|
|
36
|
+
}
|
|
37
|
+
function pruneLocked(logFile, before, receiptsDir) {
|
|
38
|
+
let text = readFileSync(logFile, "utf8");
|
|
39
|
+
const whole = text.lastIndexOf("\n") + 1;
|
|
40
|
+
if (whole < text.length) {
|
|
41
|
+
// the remains of a writer that died in its write: kept apart, as an append keeps them
|
|
42
|
+
appendFileSync(`${logFile}.torn`, text.slice(whole), { mode: 0o600 });
|
|
43
|
+
text = text.slice(0, whole);
|
|
44
|
+
}
|
|
45
|
+
const lines = text.split("\n").filter((l) => l.trim());
|
|
36
46
|
const out = [];
|
|
37
47
|
const result = { pruned: [], kept: 0, bundlesRemoved: 0 };
|
|
38
48
|
lines.forEach((line, i) => {
|
package/dist/sdk/index.js
CHANGED
|
@@ -7,7 +7,8 @@ import { digestOf, loadPrivateKey } from "../crypto.js";
|
|
|
7
7
|
import { createIssuer } from "../issue.js";
|
|
8
8
|
import { openExporter } from "../otel.js";
|
|
9
9
|
import { openLog } from "../log-sink.js";
|
|
10
|
-
import { evaluate, policyReasons } from "../policy.js";
|
|
10
|
+
import { evaluate, policyDigest, policyReasons } from "../policy.js";
|
|
11
|
+
import { compileRego, evaluateRego, isRegoFile } from "../policy-rego.js";
|
|
11
12
|
export const SDK_VERSION = "0.1.0";
|
|
12
13
|
/** True when a decision is a deny that must be enforced: a deny made in observe mode (`enforced: false`) is recorded, not acted on. */
|
|
13
14
|
export function denies(policy) {
|
|
@@ -36,11 +37,17 @@ export function createSdkIssuer(cfg) {
|
|
|
36
37
|
// the capture rules are applied by the issuer to every statement it signs, so every adapter's receipt gets them
|
|
37
38
|
const issuer = createIssuer(key, cfg.receiptsDir, openLog(cfg, key), { exporter: openExporter(cfg), capture: { rules: cfg.capture, key: captureKey } });
|
|
38
39
|
const policyText = cfg.policyFile ? readFileSync(cfg.policyFile, "utf8") : null;
|
|
39
|
-
|
|
40
|
+
// a Rego file is compiled once, here: one that does not compile stops the issuer from being created
|
|
41
|
+
const rego = policyText !== null && isRegoFile(cfg.policyFile) ? compileRego(policyText) : undefined;
|
|
42
|
+
if (rego && !rego.policy)
|
|
43
|
+
throw new Error(`${cfg.policyFile} does not compile: ${rego.errors.join("; ")}`);
|
|
44
|
+
const regoDigest = rego ? policyDigest(policyText) : "";
|
|
45
|
+
const ruleReasons = policyText === null || rego ? [] : policyReasons(policyText);
|
|
40
46
|
const decide = (ev) => {
|
|
41
47
|
if (policyText === null)
|
|
42
48
|
return null;
|
|
43
|
-
const
|
|
49
|
+
const request = { agentId: cfg.agentId, tool: ev.tool, context: { args: ev.args, facts: {} } };
|
|
50
|
+
const d = rego?.policy ? evaluateRego(rego.policy, regoDigest, request) : evaluate(policyText, request);
|
|
44
51
|
return cfg.mode === "observe" ? { ...d, enforced: false } : d;
|
|
45
52
|
};
|
|
46
53
|
function record(ev, outcome, policy = null) {
|
package/dist/simulate.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export interface SimulationOptions {
|
|
|
42
42
|
disclosures?: ReadonlyMap<string, unknown>;
|
|
43
43
|
/** Calls that have no receipt to replay. Each counts in `total` and is reported as skipped. */
|
|
44
44
|
unreplayable?: SimulationSkip[];
|
|
45
|
+
/** The proposed policy's language. Rego is compiled once with the opa binary on PATH. Default cedar. */
|
|
46
|
+
language?: "cedar" | "rego";
|
|
45
47
|
}
|
|
46
48
|
/**
|
|
47
49
|
* Check an authorization bundle that has no receipt, as the verifier does for an embedded one: the issuer signed it, it
|
|
@@ -50,7 +52,7 @@ export interface SimulationOptions {
|
|
|
50
52
|
*/
|
|
51
53
|
export declare function verifyOrphanAuthorization(bundle: AuthorizationBundle, issuerKeys: PublicKeyRef[], logKeys: PublicKeyRef[]): AuthorizationStatement["predicate"];
|
|
52
54
|
/**
|
|
53
|
-
* Compare a proposed Cedar policy with recorded policy decisions, using each receipt's original arguments, fact
|
|
55
|
+
* Compare a proposed Cedar or Rego policy with recorded policy decisions, using each receipt's original arguments, fact
|
|
54
56
|
* values, agent, and (for gateways) grant context. Observe-mode decisions are the baseline even when the call ran.
|
|
55
57
|
* Receipts are not signature-verified here; verify their bundles separately when their authenticity matters. A
|
|
56
58
|
* reconciliation receipt is trusted as a provider read only after `verifyBundle` accepts it: the library checks no more
|