@agenticprimitives/devkit 0.0.0-alpha.7 → 0.0.0-alpha.8
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/bin/ap.mjs +496 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/dispatch.d.ts +87 -0
- package/dist/dispatch.d.ts.map +1 -1
- package/dist/dispatch.js +29 -1
- package/dist/dispatch.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/rules/web-no-direct-mcp.d.ts.map +1 -1
- package/dist/rules/web-no-direct-mcp.js +2 -1
- package/dist/rules/web-no-direct-mcp.js.map +1 -1
- package/package.json +13 -5
- package/rules/hard-rules.md +2 -2
- package/rules/vault-is-the-record-apps-hold-references.md +47 -0
package/bin/ap.mjs
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// ap upgrade --canary | --pin <version|tag> [--dry-run] [--no-install] [--accept-definitions] [--json]
|
|
7
7
|
// ap upgrade --pin-definitions <registry> <ctx>/<archetype>[,…] pin the contracts the product relies on (398 §10.3)
|
|
8
8
|
// ap conform a2a|mcp <url> [--bearer <token>] [--timeout <ms>] [--json]
|
|
9
|
+
// ap conform provenance file:<dir>|memory: [--json] (spec 414 §6 — a provenance store binding, C1–C6)
|
|
9
10
|
// ap test --live-gates <ledger.json> [--only a,b] [--json]
|
|
10
11
|
// ap create <dir> --template product-repo [--name <n>] [--pin <version>] [--json]
|
|
11
12
|
// ap mcp [--root <dir>] the read-only Developer MCP on stdio (spec 398 §10.4)
|
|
@@ -13,6 +14,22 @@
|
|
|
13
14
|
// ap eval <cases.eval.json> --home <url> [--persona <handle> [--client <id>] | --session <bearer>] [--report out.json] [--json]
|
|
14
15
|
// cases as data against a live Home; deterministic judge; exit 1 on a failing case
|
|
15
16
|
// ap eval --from-runs --home <url> --persona <handle> [--addressee <name|0x>] [--out cases.eval.json] a dataset from the agent's live runs
|
|
17
|
+
// ap eval window open --store <dir> --home <url> --roster <handle,…> --level L0|L1|L2 [--hours 24] [--purpose …] (spec 414 §8) open a capture window
|
|
18
|
+
// ap eval window close --store <dir> close it: the salt is purged, nothing exported can be re-linked
|
|
19
|
+
// ap eval rescore --store <dir> --plan-id <id> --replay <set.json> --criterion <gold.json> score a stored experiment again (the runs are not re-run)
|
|
20
|
+
// ap eval report --store <dir> --sets <dir> --out <report.json> [--definition <url|file>] (spec 415 §5b; --definition flags test sentences the skills carry as examples) what was tested, whether each intent got the right skill,
|
|
21
|
+
// per-skill results, comparisons in words, and recommendations — what the Lab and skill-web render
|
|
22
|
+
// ap eval gates --store <dir> [--plan-id <id>,… | --all] --sets <dir> --definition <url|file> [--gate rbox|calibration|consistency|recall|behaviour|conformal --map <map.json> [--variant v] | outcome --outcome-gold <file>]
|
|
23
|
+
// ap eval scorecard --store <dir> --sets <dir> --plan-id a,b [--out f.json] (spec 416 §4g) the selection scorecard per experiment × variant
|
|
24
|
+
// ap eval calibrate --store <dir> --plan-id a,b --variant v --sets <dir> --definition <url|file> --alpha 0.05 --out <map.json> (spec 416 W3) fit a calibration map on labelled runs (spec 415 A4)
|
|
25
|
+
// rbox agreement (the exact half re-derives) + judgment calibration (the probabilistic half); exit 1 on FAIL
|
|
26
|
+
// ap eval diff --store <dir> --before <plan-id> --after <plan-id> --replay <set.json> --criterion <gold.json> [--variant model | --variant-before a --variant-after b] [--repaired-pair a,b]
|
|
27
|
+
// two stored experiments on the same set: McNemar on the paired cases, Δ macro with its CI, collateral
|
|
28
|
+
// ap eval compare --replay <set.json> --criterion <gold.json> --variants <name|file,…> --store <dir> --home <url> [--fixtures <starting-states.json>]
|
|
29
|
+
// --persona <handle> --addressee <name|0x> [--split held-out|development|all] [--repeat n] [--skill-map <map.json>]
|
|
30
|
+
// [--plan-id <id>] [--policy primary|any-fire] [--json] (spec 415 A4) a pre-registered comparison, judged from the traces
|
|
31
|
+
// [--keep-text <dir>] keep every case's REPLY and ACTIVITY TREE under <dir>/<plan-id>/ — words included, OUTSIDE the
|
|
32
|
+
// store (which never holds them); only when the open window admits the addressee (a sandbox org)
|
|
16
33
|
// ap generate client|cli|parity --registry <url> --definition <ctx>/<archetype> | --file <definition.json> [--out <path>] [--only a,b]
|
|
17
34
|
// the typed client / CLI schema / parity cases FROM the compiled contract (spec 398 §7.2)
|
|
18
35
|
//
|
|
@@ -23,7 +40,7 @@ import { resolve } from 'node:path';
|
|
|
23
40
|
import {
|
|
24
41
|
DevkitError, EXIT, RULE_IDS, runDoctor, formatDoctorReport, loadDoctorConfig, loadRulesCorpus, projectRules, rulesLockEntries,
|
|
25
42
|
readLock, writeLock, planUpgrade, applyUpgradePlan, formatUpgradePlan, loadConform, loadLiveGatesRunner, loadCreateApp, loadRuntimeCli, formatConformanceReport,
|
|
26
|
-
runDeveloperMcpStdio, reviewDefinitions, pinDefinition, definitionKey, formatAuthorityChanges, loadHarnessProjections, fetchDefinitionFromRegistry, loadEval,
|
|
43
|
+
runDeveloperMcpStdio, reviewDefinitions, pinDefinition, definitionKey, formatAuthorityChanges, loadHarnessProjections, fetchDefinitionFromRegistry, loadEval, loadCompare, loadEvalStore, loadDecideFromGrounding, loadProposeFromGrounding, loadHarnessCalibration,
|
|
27
44
|
} from '../dist/index.js';
|
|
28
45
|
|
|
29
46
|
const argv = process.argv.slice(2);
|
|
@@ -137,7 +154,7 @@ async function upgrade() {
|
|
|
137
154
|
|
|
138
155
|
async function conform() {
|
|
139
156
|
const [kind, url] = positional();
|
|
140
|
-
if (!['a2a', 'mcp'].includes(kind) || !url) throw new DevkitError('E_USAGE', 'ap conform a2a|mcp <url>');
|
|
157
|
+
if (!['a2a', 'mcp', 'provenance'].includes(kind) || !url) throw new DevkitError('E_USAGE', 'ap conform a2a|mcp <url> | ap conform provenance file:<dir>|memory:');
|
|
141
158
|
const fn = await loadConform(kind);
|
|
142
159
|
const report = await fn(url, { bearer: opt('bearer') ?? process.env.AP_CONFORM_BEARER, timeoutMs: opt('timeout') ? Number(opt('timeout')) : undefined });
|
|
143
160
|
out({ ok: report.ok, report }, formatConformanceReport(report));
|
|
@@ -208,6 +225,16 @@ async function generate() {
|
|
|
208
225
|
// estate's demo-signin) or a session bearer the developer holds; the judge is deterministic. An eval never signs: an
|
|
209
226
|
// act's right outcome is `authority_required`, asserted as a check.
|
|
210
227
|
async function evalCmd() {
|
|
228
|
+
const sub = positional()[0];
|
|
229
|
+
if (sub === 'window') return evalWindow();
|
|
230
|
+
if (sub === 'compare') return evalCompare();
|
|
231
|
+
if (sub === 'rescore') return evalRescore();
|
|
232
|
+
if (sub === 'diff') return evalDiff();
|
|
233
|
+
if (sub === 'report') return evalReport();
|
|
234
|
+
if (sub === 'gates') return evalGates();
|
|
235
|
+
if (sub === 'calibrate') return evalCalibrate();
|
|
236
|
+
if (sub === 'scorecard') return evalScorecard();
|
|
237
|
+
if (sub === 'ledger') return evalLedger();
|
|
211
238
|
const home = (opt('home') ?? process.env.HOME_URL ?? '').replace(/\/$/, '');
|
|
212
239
|
if (!home) throw new DevkitError('E_USAGE', '--home <url> (or HOME_URL) is required');
|
|
213
240
|
const ev = await loadEval();
|
|
@@ -253,6 +280,473 @@ async function evalCmd() {
|
|
|
253
280
|
const resolve_ = (p) => resolve(root, p);
|
|
254
281
|
const out_ = out;
|
|
255
282
|
|
|
283
|
+
// ── Spec 414 §8 / 415 A4 — THE ESTATE, AS A COMPARISON RUNNER SEES IT: the persona sign-in, the CSRF pair and the three
|
|
284
|
+
// reads (ask · provenance · measures), shared by `compare` and `window`. Names resolve to addresses at the Home; the
|
|
285
|
+
// runner holds no key and signs nothing — a run that needs authority parks at the Home like any other.
|
|
286
|
+
async function estateClient(home) {
|
|
287
|
+
const j = async (r) => { const t = await r.text(); try { return JSON.parse(t); } catch { return { _raw: t.slice(0, 200), _status: r.status }; } };
|
|
288
|
+
const sessions = new Map();
|
|
289
|
+
const signin = async (handle) => {
|
|
290
|
+
if (sessions.has(handle)) return sessions.get(handle);
|
|
291
|
+
const s = await j(await fetch(`${home}/connect/demo-signin`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ handle, client_id: opt('client') ?? 'demo-jp' }) }));
|
|
292
|
+
if (!s.homeSession) throw new DevkitError('E_INPUT_MISSING', `${home} did not sign ${handle} in (a persona path exists on development estates only): ${JSON.stringify(s).slice(0, 160)}`);
|
|
293
|
+
const v = { token: String(s.homeSession), agent: String(s.agent).toLowerCase() }; sessions.set(handle, v); return v;
|
|
294
|
+
};
|
|
295
|
+
// The CSRF pair is cookie-bound and EXPIRES: a comparison longer than its lifetime once recorded 572 runs refused
|
|
296
|
+
// with "csrf invalid". A refusal naming the CSRF fetches a fresh pair and sends the SAME request once more — a
|
|
297
|
+
// bounded retry of the same call, never a different mechanism (ADR-0013).
|
|
298
|
+
const H = { 'content-type': 'application/json', origin: home, cookie: '', 'x-csrf-token': '' };
|
|
299
|
+
const refreshCsrf = async () => {
|
|
300
|
+
const csrfRes = await fetch(`${home}/a2a/auth/csrf`, { headers: { origin: home } });
|
|
301
|
+
const csrf = await j(csrfRes);
|
|
302
|
+
H.cookie = (csrfRes.headers.get('set-cookie') ?? '').split(';')[0] ?? ''; H['x-csrf-token'] = csrf.token ?? '';
|
|
303
|
+
};
|
|
304
|
+
await refreshCsrf();
|
|
305
|
+
const post = async (path, body) => {
|
|
306
|
+
const once = async () => j(await fetch(`${home}/a2a${path}`, { method: 'POST', headers: H, body: JSON.stringify(body) }));
|
|
307
|
+
const r = await once();
|
|
308
|
+
if (r && r.ok !== true && /csrf/i.test(String(r.error ?? r._raw ?? ''))) { await refreshCsrf(); return once(); }
|
|
309
|
+
return r;
|
|
310
|
+
};
|
|
311
|
+
const resolveName = async (name) => {
|
|
312
|
+
if (/^0x[0-9a-fA-F]{40}$/.test(name)) return name.toLowerCase();
|
|
313
|
+
const r = await j(await fetch(`${home}/connect/name-info?name=${encodeURIComponent(name)}`));
|
|
314
|
+
if (r.agent) return String(r.agent).toLowerCase();
|
|
315
|
+
// a persona handle: its own agent
|
|
316
|
+
try { return (await signin(name)).agent; } catch { throw new DevkitError('E_INPUT_MISSING', `${name} does not resolve at ${home}`); }
|
|
317
|
+
};
|
|
318
|
+
const comparison = await j(await fetch(`${home}/a2a/harness/comparison`).catch(() => new Response('{}')));
|
|
319
|
+
return { j, signin, post, resolveName, evalCapture: comparison?.evalCapture === 'on' ? 'on' : 'off', knob: comparison };
|
|
320
|
+
}
|
|
321
|
+
const windowPaths = (store) => ({ dir: resolve_(store.replace(/^file:/, '')), window: resolve(resolve_(store.replace(/^file:/, '')), 'window.json'), salt: resolve(resolve_(store.replace(/^file:/, '')), 'window.salt') });
|
|
322
|
+
|
|
323
|
+
async function evalWindow() {
|
|
324
|
+
const [, action] = positional();
|
|
325
|
+
const store = opt('store');
|
|
326
|
+
if (!store || !['open', 'close'].includes(action ?? '')) throw new DevkitError('E_USAGE', 'ap eval window open|close --store <dir> …');
|
|
327
|
+
const { mkdirSync, writeFileSync, unlinkSync, readFileSync: rf, existsSync: ex } = await import('node:fs');
|
|
328
|
+
const { randomBytes } = await import('node:crypto');
|
|
329
|
+
const cm = await loadCompare();
|
|
330
|
+
const paths = windowPaths(store);
|
|
331
|
+
if (action === 'close') {
|
|
332
|
+
if (!ex(paths.window)) throw new DevkitError('E_INPUT_MISSING', `no window at ${paths.window}`);
|
|
333
|
+
const w = JSON.parse(rf(paths.window, 'utf8'));
|
|
334
|
+
w.expiresAt = new Date().toISOString();
|
|
335
|
+
writeFileSync(paths.window, `${JSON.stringify(w, null, 2)}\n`);
|
|
336
|
+
if (ex(paths.salt)) unlinkSync(paths.salt);
|
|
337
|
+
out_({ ok: true, closed: w.id, saltPurged: true }, `ap eval window · closed ${w.id} — the salt is purged; nothing exported under it can be re-linked`);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const home = (opt('home') ?? process.env.HOME_URL ?? '').replace(/\/$/, '');
|
|
341
|
+
if (!home) throw new DevkitError('E_USAGE', '--home <url> (or HOME_URL) is required');
|
|
342
|
+
const level = opt('level') ?? 'L1';
|
|
343
|
+
const roster = (opt('roster') ?? '').split(',').map((s) => s.trim()).filter(Boolean);
|
|
344
|
+
if (!roster.length) throw new DevkitError('E_USAGE', '--roster <handle|name|0x,…> names the test personas and the sandbox org the window admits');
|
|
345
|
+
const est = await estateClient(home);
|
|
346
|
+
const addresses = [];
|
|
347
|
+
for (const n of roster) addresses.push(await est.resolveName(n));
|
|
348
|
+
const hours = Number(opt('hours') ?? 24);
|
|
349
|
+
const opensAt = new Date();
|
|
350
|
+
const w = { type: 'ap.eval-capture-window.v1', id: `w-${opensAt.toISOString().slice(0, 19).replace(/[-:T]/g, '')}`, store: `file:${paths.dir}`, level, roster: addresses, estate: home, opensAt: opensAt.toISOString(), expiresAt: new Date(opensAt.getTime() + hours * 3600_000).toISOString(), ...(opt('purpose') ? { purpose: opt('purpose') } : {}), ...(flag('synthetic') ? { synthetic: true } : {}) };
|
|
351
|
+
const v = cm.validateCaptureWindow(w);
|
|
352
|
+
if (!v.ok) throw new DevkitError('E_USAGE', `the window is not valid: ${v.errors.join('; ')}`);
|
|
353
|
+
mkdirSync(paths.dir, { recursive: true });
|
|
354
|
+
writeFileSync(paths.window, `${JSON.stringify(w, null, 2)}\n`);
|
|
355
|
+
writeFileSync(paths.salt, randomBytes(32).toString('hex'), { mode: 0o600 });
|
|
356
|
+
const digest = await cm.windowDigest(w);
|
|
357
|
+
out_({ ok: true, window: w, digest, estateCapture: est.evalCapture }, `ap eval window · opened ${w.id} (${digest.slice(0, 18)}…) at ${level} for ${hours} h · roster ${roster.join(', ')} · estate ${home} (EVAL_CAPTURE ${est.evalCapture})${est.evalCapture !== 'on' ? '\n ! this estate does not run comparisons: every export will be refused (estate.capture-off) until EVAL_CAPTURE=on' : ''}`);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// Spec 415 A4 — SCORE A STORED EXPERIMENT AGAIN. The runs, the judgments and the export are what they were; only the
|
|
361
|
+
// scoring step re-runs (a scorer fix, a threshold change). A run's evidence KIND is a property of how the trace was
|
|
362
|
+
// read — a stamping harness that selected nothing is a stamped observation of no selection — so a record written before
|
|
363
|
+
// that rule ("none" on a `tn` run) is read under it here, and the record says it was rescored.
|
|
364
|
+
async function evalRescore() {
|
|
365
|
+
const store = opt('store'); const planId = opt('plan-id');
|
|
366
|
+
for (const [k, v] of [['store', store], ['plan-id', planId], ['replay', opt('replay')], ['criterion', opt('criterion')]]) if (!v) throw new DevkitError('E_USAGE', `--${k} is required (ap eval rescore --store <dir> --plan-id <id> --replay <set> --criterion <gold>)`);
|
|
367
|
+
const { readFileSync: rf, writeFileSync } = await import('node:fs');
|
|
368
|
+
const cm = await loadCompare();
|
|
369
|
+
const dir = resolve_(store.replace(/^file:/, ''));
|
|
370
|
+
const path = resolve(dir, 'experiments', `${encodeURIComponent(`experiment:${planId}`)}.jsonld`);
|
|
371
|
+
const doc = JSON.parse(rf(path, 'utf8'));
|
|
372
|
+
const rec = doc.record;
|
|
373
|
+
if (!rec?.plan) throw new DevkitError('E_INPUT_MISSING', `${path} holds no experiment record`);
|
|
374
|
+
const setR = cm.validateReplaySet(JSON.parse(rf(resolve_(opt('replay')), 'utf8')));
|
|
375
|
+
if (!setR.ok) throw new DevkitError('E_USAGE', `the replay set is not valid: ${setR.errors.join('; ')}`);
|
|
376
|
+
const criterion = JSON.parse(rf(resolve_(opt('criterion')), 'utf8'));
|
|
377
|
+
const setDigest = await cm.replaySetDigest(setR.set);
|
|
378
|
+
if (rec.plan.replaySetDigest !== setDigest || rec.plan.criterionDigest !== await cm.criterionDigest(criterion)) throw new DevkitError('E_USAGE', 'the set or the criterion is not the one this experiment pre-registered; a rescore never changes what was judged against');
|
|
379
|
+
const { cases, skillIds } = cm.casesOf(setR.set, criterion, rec.plan.split);
|
|
380
|
+
const runs = rec.runs.map((r) => (r.status === 'ok' && r.evidence === 'none' ? { ...r, evidence: 'stamped' } : r));
|
|
381
|
+
const scored = await cm.scoreExperimentRuns({ plan: rec.plan, setDigest, cases, skillIds, pairs: criterion.collisionPairs ?? [], runs, log: (line) => { if (!json) console.error(` ${line}`); } });
|
|
382
|
+
const next = { ...rec, runs, ...scored, rescoredAt: new Date().toISOString() };
|
|
383
|
+
writeFileSync(path, `${JSON.stringify({ ...doc, record: next }, null, 2)}\n`);
|
|
384
|
+
out_({ ok: true, plan: next.plan, planDigest: next.planDigest, runs: next.runs.length, scores: Object.fromEntries(Object.entries(next.scores).map(([k, v]) => [k, v.aggregate])), perSkill: Object.fromEntries(Object.entries(next.scores).map(([k, v]) => [k, v.perSkill])), verdicts: Object.fromEntries(Object.entries(next.verdicts).map(([k, v]) => [k, { status: v.status, reason: v.binding_reason }])), comparisons: next.comparisons }, `ap eval rescore · ${path}\n${cm.formatExperiment(next)}`);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// Spec 415 §5b — THE REPORT: every experiment in the store, read with the replay sets and criteria it pre-registered
|
|
388
|
+
// (found in --sets by digest), folded into one deterministic file. Numbers, ids, verdicts and the sets' AUTHORED test
|
|
389
|
+
// sentences — the eval store holds no person's words, so neither does this.
|
|
390
|
+
async function evalReport() {
|
|
391
|
+
const store = opt('store'); const setsDir = opt('sets'); const outPath = opt('out');
|
|
392
|
+
for (const [k, v] of [['store', store], ['sets', setsDir], ['out', outPath]]) if (!v) throw new DevkitError('E_USAGE', `--${k} is required (ap eval report --store <dir> --sets <dir> --out <report.json>)`);
|
|
393
|
+
const { readFileSync: rf, readdirSync, writeFileSync, mkdirSync } = await import('node:fs');
|
|
394
|
+
const { dirname } = await import('node:path');
|
|
395
|
+
const cm = await loadCompare();
|
|
396
|
+
const dir = resolve_(store.replace(/^file:/, ''));
|
|
397
|
+
const expDir = resolve(dir, 'experiments');
|
|
398
|
+
const experiments = readdirSync(expDir).filter((f) => f.startsWith(encodeURIComponent('experiment:')) && f.endsWith('.jsonld'))
|
|
399
|
+
.map((f) => JSON.parse(rf(resolve(expDir, f), 'utf8')).record).filter((r) => r?.plan);
|
|
400
|
+
const sets = {}; const criteria = {};
|
|
401
|
+
const walk = (d) => { for (const e of readdirSync(d, { withFileTypes: true })) { const p = resolve(d, e.name); if (e.isDirectory()) walk(p); else if (e.name.endsWith('.replay.json') || e.name.endsWith('.gold.json')) { const j = JSON.parse(rf(p, 'utf8')); if (j.type === 'ap.replay-set.v1') sets[p] = j; if (j.type === 'ap.selection-criterion.v1') criteria[j.replaySetDigest] = j; } } };
|
|
402
|
+
walk(resolve_(setsDir));
|
|
403
|
+
const byDigest = {};
|
|
404
|
+
for (const s of Object.values(sets)) byDigest[await cm.replaySetDigest(s)] = s;
|
|
405
|
+
// The examples the skills under test declare (their `utterances`, as the compiled playbook carries them) — so a test
|
|
406
|
+
// sentence that nearly repeats one is flagged as measuring the example, not selection. A URL or a file.
|
|
407
|
+
let examples; let toolToSkillForReport;
|
|
408
|
+
if (opt('definition')) {
|
|
409
|
+
const src = opt('definition');
|
|
410
|
+
const d = /^https?:/.test(src) ? await (await fetch(src, { headers: { 'user-agent': 'Mozilla/5.0 (ap eval report)' } })).json() : JSON.parse(rf(resolve_(src), 'utf8'));
|
|
411
|
+
const tools = (d.definition ?? d).tools ?? [];
|
|
412
|
+
examples = tools.flatMap((t) => (t.utterances ?? []).map((u) => ({ skill: t.source?.skillId ?? t.id, says: u.says, ...(u.isNot ? { isNot: true } : {}) })));
|
|
413
|
+
toolToSkillForReport = Object.fromEntries(tools.filter((t) => t.source?.skillId).map((t) => [t.id, t.source.skillId]));
|
|
414
|
+
}
|
|
415
|
+
// `--alias <experiment>:<variant>=<name>[,…]` — a knob value whose meaning changed after the experiment ran is shown
|
|
416
|
+
// as what actually ran. The record is never edited.
|
|
417
|
+
const aliases = {};
|
|
418
|
+
for (const a of (opt('alias') ?? '').split(',').filter(Boolean)) { const m = /^([^:]+):([^=]+)=(.+)$/.exec(a); if (!m) throw new DevkitError('E_USAGE', `--alias ${a}: expected <experiment>:<variant>=<name>`); (aliases[m[1]] ??= {})[m[2]] = m[3]; }
|
|
419
|
+
const report = cm.skillAssessmentReportOf({ experiments, sets: byDigest, criteria, ...(examples ? { examples } : {}), ...(Object.keys(aliases).length ? { aliases } : {}), ...(toolToSkillForReport ? { toolToSkill: toolToSkillForReport } : {}) });
|
|
420
|
+
mkdirSync(dirname(resolve_(outPath)), { recursive: true });
|
|
421
|
+
writeFileSync(resolve_(outPath), `${JSON.stringify(report, null, 2)}\n`);
|
|
422
|
+
const recs = report.recommendations;
|
|
423
|
+
out_({ ok: true, out: resolve_(outPath), experiments: report.experiments.length, recommendations: recs.length, headline: report.headline }, `ap eval report · ${report.experiments.length} experiment(s) · ${recs.length} recommendation(s) → ${resolve_(outPath)}\n${report.headline.map((h) => ` ${h}`).join('\n')}\n${recs.filter((r) => r.severity === 'act').slice(0, 8).map((r) => ` ▸ ${r.title}`).join('\n')}`);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// Spec 415 A4 — THE SELECTION GATES over stored experiments: rbox agreement (every ontology decision re-derives from its
|
|
427
|
+
// recorded grounding under the playbook it ran with) and judgment calibration (the judge's confidence against being right).
|
|
428
|
+
// FAIL exits 1; INCOMPLETE (nothing to check, or too few judged runs) is said and exits 0 — never reported as a pass.
|
|
429
|
+
async function evalGates() {
|
|
430
|
+
const store = opt('store'); const setsDir = opt('sets'); const defSrc = opt('definition');
|
|
431
|
+
for (const [k, v] of [['store', store], ['sets', setsDir], ['definition', defSrc]]) if (!v) throw new DevkitError('E_USAGE', `--${k} is required (ap eval gates --store <dir> --sets <dir> --definition <url|file> [--plan-id a,b | --all])`);
|
|
432
|
+
const { readFileSync: rf, readdirSync } = await import('node:fs');
|
|
433
|
+
const cm = await loadCompare();
|
|
434
|
+
const decide = await loadDecideFromGrounding();
|
|
435
|
+
const propose = await loadProposeFromGrounding();
|
|
436
|
+
const dir = resolve(resolve_(store.replace(/^file:/, '')), 'experiments');
|
|
437
|
+
const want = opt('plan-id') ? new Set(opt('plan-id').split(',')) : null;
|
|
438
|
+
const records = readdirSync(dir).filter((f) => f.startsWith(encodeURIComponent('experiment:'))).map((f) => JSON.parse(rf(resolve(dir, f), 'utf8')).record).filter((r) => r?.plan && (!want || want.has(r.plan.id)));
|
|
439
|
+
const d = /^https?:/.test(defSrc) ? await (await fetch(defSrc, { headers: { 'user-agent': 'Mozilla/5.0 (ap eval gates)' } })).json() : JSON.parse(rf(resolve_(defSrc), 'utf8'));
|
|
440
|
+
const definition = d.definition ?? d;
|
|
441
|
+
const toolToSkill = Object.fromEntries((definition.tools ?? []).filter((t) => t.source?.skillId).map((t) => [t.id, t.source.skillId]));
|
|
442
|
+
const criteria = {};
|
|
443
|
+
const walk = (p) => { for (const e of readdirSync(p, { withFileTypes: true })) { const q = resolve(p, e.name); if (e.isDirectory()) walk(q); else if (e.name.endsWith('.gold.json')) { const j = JSON.parse(rf(q, 'utf8')); if (j.type === 'ap.selection-criterion.v1') criteria[j.replaySetDigest] = j; } } };
|
|
444
|
+
walk(resolve_(setsDir));
|
|
445
|
+
const which = opt('gate');
|
|
446
|
+
const only = (g) => !which || which === g;
|
|
447
|
+
const rbox = !only('rbox') ? null : cm.rboxAgreementOf({ experiment: { runs: records.flatMap((r) => r.runs) }, definition, decide, propose });
|
|
448
|
+
const calRuns = records.flatMap((r) => r.runs.map((x) => ({ ...x, __crit: criteria[r.plan.replaySetDigest] })));
|
|
449
|
+
const casesUnion = { cases: Object.assign({}, ...Object.values(criteria).map((c) => c.cases)) };
|
|
450
|
+
// Repeats count only WITHIN one experiment: across experiments the playbook, the judge or the model may differ.
|
|
451
|
+
const consistency = !only('consistency') ? null : cm.judgmentConsistencyOf({ experiment: { runs: records.flatMap((r) => r.runs.map((x) => ({ ...x, variant: `${r.plan.id}/${x.variant}` }))) } });
|
|
452
|
+
const calibration = !only('calibration') ? null : cm.judgmentCalibrationOf({ experiment: { runs: calRuns }, criterion: casesUnion, toolToSkill });
|
|
453
|
+
// Spec 416 W3 — conformal coverage of a fitted map, on runs of ONE variant (the map's binding), through the harness's set.
|
|
454
|
+
let conformal = null;
|
|
455
|
+
if (which === 'conformal') {
|
|
456
|
+
if (!opt('map')) throw new DevkitError('E_USAGE', '--gate conformal needs --map <map.json> (ap eval calibrate writes one)');
|
|
457
|
+
const map = JSON.parse(rf(resolve_(opt('map')), 'utf8'));
|
|
458
|
+
const fns = await loadHarnessCalibration();
|
|
459
|
+
const variant = opt('variant') ?? map.binding?.variant;
|
|
460
|
+
const fitted = new Set(map.fittedOn ?? []);
|
|
461
|
+
const overlap = records.filter((r) => fitted.has(r.plan.id)).map((r) => r.plan.id);
|
|
462
|
+
if (overlap.length) throw new DevkitError('E_USAGE', `coverage must be measured on runs the map was NOT fitted on — ${overlap.join(', ')} ${overlap.length === 1 ? 'is' : 'are'} in its fittedOn`);
|
|
463
|
+
conformal = cm.conformalCoverageOf({ experiment: { runs: calRuns.filter((x) => !variant || x.variant === variant) }, criterion: casesUnion, toolToSkill, map, fns });
|
|
464
|
+
}
|
|
465
|
+
const behaviour = !only('behaviour') ? null : cm.selectionBehaviourOf({ experiment: { runs: calRuns }, criterion: casesUnion });
|
|
466
|
+
// Spec 417 — OUTCOME PLANS: each variant's chains against gold plans (`--outcome-gold <file>`: { intentId: { plan, missing? } }).
|
|
467
|
+
// A measurement, not a pass/fail yet: the gate the spec names (plan-exact ≥ 0.8, no needless step on held inputs) is read off it.
|
|
468
|
+
let outcome = null;
|
|
469
|
+
if (which === 'outcome') {
|
|
470
|
+
if (!opt('outcome-gold')) throw new DevkitError('E_USAGE', '--gate outcome needs --outcome-gold <file>');
|
|
471
|
+
const gold = JSON.parse(rf(resolve_(opt('outcome-gold')), 'utf8')).cases;
|
|
472
|
+
const rows = cm.outcomePlanScoresOf(records.flatMap((r) => r.runs.map((x) => ({ ...x, variant: `${r.plan.id}/${x.variant}` }))), gold);
|
|
473
|
+
const pct = (a, b) => (b ? `${a}/${b}` : '—');
|
|
474
|
+
const planExact = rows.length ? Math.min(...rows.filter((r) => /outcome/.test(r.variant)).map((r) => r.exact / Math.max(1, r.n))) : 0;
|
|
475
|
+
outcome = { status: rows.length ? 'MEASURED' : 'INCOMPLETE', rows, reason: rows.length ? `outcome-arm plan-exact min ${planExact.toFixed(2)}` : 'no run of a gold intent' };
|
|
476
|
+
}
|
|
477
|
+
const lines = [`ap eval gates · ${records.length} experiment(s) · playbook ${String(d.digest ?? '').slice(0, 14)}`];
|
|
478
|
+
if (rbox) lines.push(` check:rbox-agreement ${rbox.status} — ${rbox.reason}${rbox.disagreements.length ? `\n${rbox.disagreements.slice(0, 8).map((x) => ` ✗ ${x.intentId} (${x.variant}) ${x.field}: recorded ${JSON.stringify(x.recorded)} ≠ derived ${JSON.stringify(x.derived)}`).join('\n')}` : ''}`);
|
|
479
|
+
if (calibration) lines.push(` check:judgment-calibration ${calibration.status} — ${calibration.reason}${calibration.n ? ` · accuracy ${(calibration.accuracy * 100).toFixed(0)}% at mean confidence ${(calibration.meanConfidence * 100).toFixed(0)}%` : ''}${calibration.overconfident.length ? `\n confident and wrong (p ≥ 0.8): ${calibration.overconfident.slice(0, 6).map((x) => `${x.intentId}→${x.predicted.split('/').pop()} (${x.p.toFixed(2)})`).join(', ')}` : ''}`);
|
|
480
|
+
if (consistency) lines.push(` check:judgment-consistency ${consistency.status} — ${consistency.reason}${consistency.unstable.length ? `\n changed its answer: ${consistency.unstable.slice(0, 6).map((x) => `${x.intentId} (${x.variant}) ${x.tops.map((t) => t.split('.').pop()).join('/')}`).join(', ')}` : ''}`);
|
|
481
|
+
const recall = !only('recall') ? null : cm.candidateRecallOf({ experiment: { runs: calRuns }, criterion: casesUnion, toolToSkill });
|
|
482
|
+
if (recall) lines.push(` check:candidate-recall ${recall.status} — ${recall.reason}${recall.n ? ` · mean ${recall.meanProposed.toFixed(1)} proposed · gold reached by ${Object.entries(recall.byVia).map(([k, v]) => `${k} ${v}`).join(', ')}` : ''}${recall.missed.length ? `\n never proposed: ${recall.missed.slice(0, 8).map((x) => `${x.intentId}→${x.gold.split('/').pop()}`).join(', ')}` : ''}`);
|
|
483
|
+
if (conformal) lines.push(` check:conformal-coverage ${conformal.status} — ${conformal.reason}${conformal.n ? ` · mean set size ${conformal.meanSetSize.toFixed(2)} · sizes ${JSON.stringify(conformal.sizes)}` : ''}${conformal.uncovered.length ? `\n not covered: ${conformal.uncovered.slice(0, 8).map((x) => `${x.intentId} gold ${x.gold.split('.').pop()} set [${x.set.join(', ')}]`).join('; ')}` : ''}`);
|
|
484
|
+
if (behaviour) lines.push(` check:selection-behaviour ${behaviour.status} — ${behaviour.reason}${behaviour.n ? ` · ${Object.entries(behaviour.counts).map(([k, v]) => `${k} ${v}`).join(', ')}` : ''}${behaviour.wrong.length ? `\n not right: ${behaviour.wrong.slice(0, 8).map((x) => `${x.intentId} (${x.behaviour}) ${x.outcome}${x.chose ? ` ${x.chose}` : ''}`).join(', ')}` : ''}`);
|
|
485
|
+
if (outcome) lines.push(` outcome-plans ${outcome.status} — ${outcome.reason}\n${outcome.rows.map((r) => ` ${r.variant}: exact ${r.exact}/${r.n} · needless ${r.needless} · short ${r.short} · asked ${r.asked.right}/${r.asked.of} · steps ${r.stepsScore} · ${Object.entries(r.bySteps).map(([k, v]) => `${k} ${v.exact}/${v.n}`).join(', ')}`).join('\n')}`);
|
|
486
|
+
const failed = [rbox, calibration, consistency, recall, conformal, behaviour].some((g) => g?.status === 'FAIL');
|
|
487
|
+
out_({ ok: !failed, rbox, calibration, consistency, recall, conformal, behaviour, outcome }, lines.join('\n'));
|
|
488
|
+
process.exit(failed ? EXIT.FINDINGS : EXIT.OK);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Spec 416 §4g — THE SELECTION SCORECARD: the same table every iteration (right, declines, ask p50/p90, time to pick,
|
|
492
|
+
// tokens to pick / in total / cached, model calls and plan steps per ask), over stored experiments; `--out` keeps it, so
|
|
493
|
+
// improvements are tracked as data, not remembered.
|
|
494
|
+
// Spec 418 §4 — THE TECHNIQUE LEDGER: every technique's paired comparisons (quality by McNemar, cost by paired
|
|
495
|
+
// bootstrap medians) from the stored experiments, with a declared verdict rule. Gold plans are read from the sets'
|
|
496
|
+
// *.outcome-gold.json files. `ap eval ledger --store <dir> --techniques <file> --sets <dir> --out <file>`.
|
|
497
|
+
async function evalLedger() {
|
|
498
|
+
const store = opt('store'); const techFile = opt('techniques'); const setsDir = opt('sets'); const outPath = opt('out');
|
|
499
|
+
for (const [k, v] of [['store', store], ['techniques', techFile], ['sets', setsDir], ['out', outPath]]) if (!v) throw new DevkitError('E_USAGE', `--${k} is required (ap eval ledger --store <dir> --techniques <file> --sets <dir> --out <file>)`);
|
|
500
|
+
const { readFileSync: rf, readdirSync, writeFileSync, mkdirSync } = await import('node:fs');
|
|
501
|
+
const { dirname } = await import('node:path');
|
|
502
|
+
const cm = await loadCompare();
|
|
503
|
+
const dir = resolve(resolve_(store.replace(/^file:/, '')), 'experiments');
|
|
504
|
+
const records = readdirSync(dir).filter((f) => f.startsWith(encodeURIComponent('experiment:'))).map((f) => JSON.parse(rf(resolve(dir, f), 'utf8')).record).filter((r) => r?.plan);
|
|
505
|
+
const goldBySet = {};
|
|
506
|
+
const walk = (p) => { for (const e of readdirSync(p, { withFileTypes: true })) { const q = resolve(p, e.name); if (e.isDirectory()) walk(q); else if (e.name.endsWith('.outcome-gold.json')) { const j = JSON.parse(rf(q, 'utf8')); if (j.replaySetDigest) goldBySet[j.replaySetDigest] = j.cases; } } };
|
|
507
|
+
walk(resolve_(setsDir));
|
|
508
|
+
const techniques = JSON.parse(rf(resolve_(techFile), 'utf8')).techniques;
|
|
509
|
+
const ledger = cm.techniqueLedgerOf({ records, techniques, goldBySet });
|
|
510
|
+
mkdirSync(dirname(resolve_(outPath)), { recursive: true });
|
|
511
|
+
writeFileSync(resolve_(outPath), `${JSON.stringify(ledger, null, 2)}\n`);
|
|
512
|
+
const f = (c) => (c?.deltaPct === null || c?.deltaPct === undefined ? '—' : `${c.deltaPct > 0 ? '+' : ''}${c.deltaPct}%`);
|
|
513
|
+
const lines = ledger.rows.map((r) => ` ${r.verdict.padEnd(24)} ${r.technique.name}${r.technique.ontologyDriven ? ' ◆' : ''}${r.comparisons.map((c) => `\n ${c.experiment} ${c.baseline}→${c.treatment} n=${c.n} · ${c.quality.metric} ${c.quality.base}→${c.quality.treat} (+${c.quality.fixed}/−${c.quality.broken} p=${c.quality.p}) · pick tok ${f(c.cost.pickTokens)} · pick ms ${f(c.cost.pickMs)} · ask ms ${f(c.cost.askMs)} · ${c.verdict}`).join('')}${(r.pooled ?? []).map((q) => `\n POOLED vs ${q.baseline} (${q.experiments} experiments, n=${q.n}): +${q.fixed}/−${q.broken} p=${q.p} · pick tok ${q.pickTokensPct ?? '—'}% · ask ms ${q.askMsPct ?? '—'}% · ${q.verdict}`).join('')}${r.missing.length ? `\n missing: ${r.missing.join(', ')}` : ''}`);
|
|
514
|
+
out_({ ok: true, out: resolve_(outPath), rows: ledger.rows.length }, `ap eval ledger · ${ledger.rows.length} technique(s) → ${resolve_(outPath)} (◆ ontology-driven)\n${lines.join('\n')}\n rule: ${ledger.rule}`);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
async function evalScorecard() {
|
|
518
|
+
const store = opt('store'); const setsDir = opt('sets'); const planIds = opt('plan-id');
|
|
519
|
+
for (const [k, v] of [['store', store], ['sets', setsDir], ['plan-id', planIds]]) if (!v) throw new DevkitError('E_USAGE', `--${k} is required (ap eval scorecard --store <dir> --sets <dir> --plan-id a,b [--out <file.json>])`);
|
|
520
|
+
const { readFileSync: rf, readdirSync, writeFileSync, mkdirSync } = await import('node:fs');
|
|
521
|
+
const { dirname } = await import('node:path');
|
|
522
|
+
const cm = await loadCompare();
|
|
523
|
+
const dir = resolve(resolve_(store.replace(/^file:/, '')), 'experiments');
|
|
524
|
+
const order = planIds.split(',');
|
|
525
|
+
const records = order.map((id) => { const f = resolve(dir, `${encodeURIComponent('experiment:' + id)}.jsonld`); try { return JSON.parse(rf(f, 'utf8')).record; } catch { throw new DevkitError('E_INPUT_MISSING', `no stored experiment ${id}`); } });
|
|
526
|
+
const criteria = {};
|
|
527
|
+
const walk = (p) => { for (const e of readdirSync(p, { withFileTypes: true })) { const q = resolve(p, e.name); if (e.isDirectory()) walk(q); else if (e.name.endsWith('.gold.json')) { const j = JSON.parse(rf(q, 'utf8')); if (j.type === 'ap.selection-criterion.v1') Object.assign(criteria, j.cases); } } };
|
|
528
|
+
walk(resolve_(setsDir));
|
|
529
|
+
const rows = cm.scorecardOf(records, criteria);
|
|
530
|
+
const s = (ms) => (ms === null || ms === undefined ? '—' : `${(ms / 1000).toFixed(1)}s`);
|
|
531
|
+
const k = (n) => (n === null || n === undefined ? '—' : n >= 1000 ? `${(n / 1000).toFixed(1)}k` : String(Math.round(n)));
|
|
532
|
+
const lines = [`ap eval scorecard · ${records.length} experiment(s)`, ` ${'experiment/variant'.padEnd(46)} right pos neg ask p50/p90 pick pick tok in/out total in/out cached calls steps quality`];
|
|
533
|
+
for (const r of rows) lines.push(` ${`${r.experiment}/${r.variant}`.slice(0, 46).padEnd(46)} ${`${r.right}/${r.runs}`.padEnd(6)} ${`${r.rightOnPositives}/${r.positives}`.padEnd(6)} ${`${r.declined}/${r.negatives}`.padEnd(6)} ${`${s(r.askP50)}/${s(r.askP90)}`.padEnd(13)} ${s(r.pickP50).padEnd(5)} ${`${k(r.selectionIn)}/${k(r.selectionOut)}`.padEnd(15)} ${`${k(r.totalIn)}/${k(r.totalOut)}`.padEnd(13)} ${k(r.cachedIn).padEnd(6)} ${String(r.modelCalls ?? '—').padEnd(5)} ${String(r.planSteps ?? '—').padEnd(5)} ${r.quality === null || r.quality === undefined ? '—' : `${r.quality.toFixed(2)} (${r.qualityRuns})`}`);
|
|
534
|
+
for (const r of rows) if (r.preference) lines.push(` ${r.variant} side by side (${r.preferenceRuns}): ${Object.entries(r.preference).map(([k, v]) => `${k} ${(v * 100).toFixed(0)}%`).join(' · ')}`);
|
|
535
|
+
for (const r of rows) { const st = Object.entries(r.stagesP50 ?? {}).slice(0, 6); if (st.length) lines.push(` ${r.variant} stages p50: ${st.map(([n, v]) => `${n} ${s(v)}`).join(' · ')}`); }
|
|
536
|
+
if (opt('out')) { mkdirSync(dirname(resolve_(opt('out'))), { recursive: true }); writeFileSync(resolve_(opt('out')), `${JSON.stringify({ type: 'ap.selection-scorecard.v1', at: new Date().toISOString(), rows }, null, 2)}\n`); lines.push(` → ${resolve_(opt('out'))}`); }
|
|
537
|
+
out_({ ok: true, rows }, lines.join('\n'));
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// Spec 416 W3 — FIT A CALIBRATION MAP on labelled runs of one variant (one binding): a temperature and a conformal q̂ at
|
|
541
|
+
// level alpha, through the harness's own math. The map is data with a digest; `ap eval compare` passes it as the variant's
|
|
542
|
+
// `acceptance`, and `ap eval gates --gate conformal --map` measures it on runs it was not fitted on.
|
|
543
|
+
async function evalCalibrate() {
|
|
544
|
+
const store = opt('store'); const setsDir = opt('sets'); const defSrc = opt('definition'); const planIds = opt('plan-id'); const variant = opt('variant'); const out = opt('out');
|
|
545
|
+
for (const [k, v] of [['store', store], ['sets', setsDir], ['definition', defSrc], ['plan-id', planIds], ['variant', variant], ['out', out]]) if (!v) throw new DevkitError('E_USAGE', `--${k} is required (ap eval calibrate --store <dir> --plan-id a,b --variant v --sets <dir> --definition <url|file> --alpha 0.05 --out <map.json>)`);
|
|
546
|
+
const { readFileSync: rf, readdirSync, writeFileSync, mkdirSync } = await import('node:fs');
|
|
547
|
+
const { dirname } = await import('node:path');
|
|
548
|
+
const cm = await loadCompare();
|
|
549
|
+
const fns = await loadHarnessCalibration();
|
|
550
|
+
const dir = resolve(resolve_(store.replace(/^file:/, '')), 'experiments');
|
|
551
|
+
const want = new Set(planIds.split(','));
|
|
552
|
+
const records = readdirSync(dir).filter((f) => f.startsWith(encodeURIComponent('experiment:'))).map((f) => JSON.parse(rf(resolve(dir, f), 'utf8')).record).filter((r) => r?.plan && want.has(r.plan.id));
|
|
553
|
+
const missing = [...want].filter((id) => !records.some((r) => r.plan.id === id));
|
|
554
|
+
if (missing.length) throw new DevkitError('E_INPUT_MISSING', `no stored experiment ${missing.join(', ')}`);
|
|
555
|
+
const providers = [...new Set(records.map((r) => r.plan.variants?.[variant]?.provider ?? null))];
|
|
556
|
+
if (providers.length > 1) throw new DevkitError('E_USAGE', `the experiments ran ${variant} on different providers (${providers.join(', ')}) — a map is fitted for ONE binding`);
|
|
557
|
+
const d = /^https?:/.test(defSrc) ? await (await fetch(defSrc, { headers: { 'user-agent': 'Mozilla/5.0 (ap eval calibrate)' } })).json() : JSON.parse(rf(resolve_(defSrc), 'utf8'));
|
|
558
|
+
const definition = d.definition ?? d;
|
|
559
|
+
const toolToSkill = Object.fromEntries((definition.tools ?? []).filter((t) => t.source?.skillId).map((t) => [t.id, t.source.skillId]));
|
|
560
|
+
const criteria = {};
|
|
561
|
+
const walk = (p) => { for (const e of readdirSync(p, { withFileTypes: true })) { const q = resolve(p, e.name); if (e.isDirectory()) walk(q); else if (e.name.endsWith('.gold.json')) { const j = JSON.parse(rf(q, 'utf8')); if (j.type === 'ap.selection-criterion.v1') criteria[j.replaySetDigest] = j; } } };
|
|
562
|
+
walk(resolve_(setsDir));
|
|
563
|
+
const criterion = { cases: Object.assign({}, ...records.map((r) => criteria[r.plan.replaySetDigest]?.cases ?? {})) };
|
|
564
|
+
const map = await cm.fitConformalMap({ experiments: records, variant, judge: fns.judge, ...(providers[0] ? { provider: providers[0] } : {}), criterion, toolToSkill, alpha: Number(opt('alpha') ?? 0.05), fns });
|
|
565
|
+
mkdirSync(dirname(resolve_(out)), { recursive: true });
|
|
566
|
+
writeFileSync(resolve_(out), `${JSON.stringify(map, null, 2)}\n`);
|
|
567
|
+
out_({ ok: true, out: resolve_(out), map }, `ap eval calibrate · ${map.binding.judge} on ${map.binding.provider ?? 'the default provider'} · ${map.n} labelled runs from ${map.fittedOn.join(', ')}\n temperature ${map.temperature} · q̂ ${map.qhat} at α ${map.alpha} (set threshold ${(1 - map.qhat).toFixed(3)}) · ${map.mapDigest}\n → ${resolve_(out)}`);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// Spec 415 A4 / methodology §4.3 — A REPAIR, VALIDATED: the same set judged before and after ONE change (a description,
|
|
571
|
+
// a doctrine line, a playbook version), compared on the paired cases. The two experiments are what they were; the
|
|
572
|
+
// comparison refuses a different set or criterion, and says when the validating split is not locked.
|
|
573
|
+
async function evalDiff() {
|
|
574
|
+
const store = opt('store');
|
|
575
|
+
for (const [k, v] of [['store', store], ['before', opt('before')], ['after', opt('after')], ['replay', opt('replay')], ['criterion', opt('criterion')]]) if (!v) throw new DevkitError('E_USAGE', `--${k} is required (ap eval diff --store <dir> --before <plan-id> --after <plan-id> --replay <set> --criterion <gold>)`);
|
|
576
|
+
const { readFileSync: rf } = await import('node:fs');
|
|
577
|
+
const cm = await loadCompare();
|
|
578
|
+
const dir = resolve_(store.replace(/^file:/, ''));
|
|
579
|
+
const load = (id) => { const path = resolve(dir, 'experiments', `${encodeURIComponent(`experiment:${id}`)}.jsonld`); const doc = JSON.parse(rf(path, 'utf8')); if (!doc.record?.plan) throw new DevkitError('E_INPUT_MISSING', `${path} holds no experiment record`); return doc.record; };
|
|
580
|
+
const before = load(opt('before')); const after = load(opt('after'));
|
|
581
|
+
const setR = cm.validateReplaySet(JSON.parse(rf(resolve_(opt('replay')), 'utf8')));
|
|
582
|
+
if (!setR.ok) throw new DevkitError('E_USAGE', `the replay set is not valid: ${setR.errors.join('; ')}`);
|
|
583
|
+
const criterion = JSON.parse(rf(resolve_(opt('criterion')), 'utf8'));
|
|
584
|
+
const setDigest = await cm.replaySetDigest(setR.set); const critDigest = await cm.criterionDigest(criterion);
|
|
585
|
+
for (const [n, r] of [['before', before], ['after', after]]) if (r.plan.replaySetDigest !== setDigest || r.plan.criterionDigest !== critDigest) throw new DevkitError('E_USAGE', `${n} (${r.plan.id}) pre-registered a different set or criterion; a diff never crosses them`);
|
|
586
|
+
if (before.plan.split !== after.plan.split) throw new DevkitError('E_USAGE', `the splits differ (${before.plan.split} vs ${after.plan.split}); paired cases need the same split`);
|
|
587
|
+
const vBefore = opt('variant-before') ?? opt('variant') ?? 'model';
|
|
588
|
+
const vAfter = opt('variant-after') ?? opt('variant') ?? 'model';
|
|
589
|
+
for (const [n, r, v] of [['before', before, vBefore], ['after', after, vAfter]]) if (!r.scores?.[v]) throw new DevkitError('E_INPUT_MISSING', `${n} (${r.plan.id}) has no scored variant "${v}" — ap eval rescore it first`);
|
|
590
|
+
const variant = `${vBefore} → ${vAfter}`;
|
|
591
|
+
const { cases } = cm.casesOf(setR.set, criterion, before.plan.split);
|
|
592
|
+
const side = async (r, v) => ({ datasetDigest: setDigest, variantDigest: await cm.variantRequestDigest(r.plan.variants[v]), split: r.plan.split === 'held-out' ? 'held-out' : 'development', score: r.scores[v], cases });
|
|
593
|
+
const pair = opt('repaired-pair') ? opt('repaired-pair').split(',').map((x) => x.trim()).filter(Boolean) : undefined;
|
|
594
|
+
const cmp = cm.compareSelectionRuns(await side(before, vBefore), await side(after, vAfter), pair ? { repairedPair: pair } : {});
|
|
595
|
+
const f = (v) => (v === null || v === undefined ? 'n/a' : Number(v).toFixed(3));
|
|
596
|
+
const a = before.scores[vBefore].aggregate, b = after.scores[vAfter].aggregate;
|
|
597
|
+
const line = (k) => ` ${k.padEnd(22)} ${f(a[k]?.value)} → ${f(b[k]?.value)}`;
|
|
598
|
+
out_({ ok: true, before: before.plan.id, after: after.plan.id, variant, comparison: cmp, aggregates: { before: a, after: b } }, `ap eval diff · ${before.plan.id} → ${after.plan.id} (${variant}, split ${before.plan.split})\n${['macro_ta', 'micro_ta', 'hold_rate', 'routing_purity', 'collision_containment', 'over_fire_rate'].map(line).join('\n')}\n Δ macro ${f(cmp.delta_macro)} [${f(cmp.ci_delta?.[0])}, ${f(cmp.ci_delta?.[1])}] · McNemar fixed ${cmp.fixed} broken ${cmp.broken} p=${Number(cmp.p_value).toFixed(4)} (${cmp.mcnemar_scope}, n=${cmp.n_paired})${cmp.regression ? ' · REGRESSION' : cmp.degraded ? ' · degraded' : ''}${cmp.warnings.length ? `\n ! ${cmp.warnings.join('; ')}` : ''}${cmp.note ? `\n ${cmp.note}` : ''}`);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
const VARIANT_PRESETS = { model: {}, declared: { selection: 'declared' }, ontology: { selection: 'ontology' }, judgment: { selection: 'judgment' }, 'ontology+judgment': { selection: 'ontology+judgment' }, 'propose+judgment': { selection: 'propose+judgment' }, 'ontology-first': { selection: 'ontology-first' }, 'framed-judgment': { selection: 'framed-judgment' }, outcome: { selection: 'outcome', judgeProfile: 'fast' }, 'outcome-selective': { selection: 'outcome-selective', judgeProfile: 'fast' }, rules: { plannerKind: 'rule-based' }, 'kb-off': { toggles: { 'retrieval/kb': 'off' } }, 'kb-tool': { toggles: { 'retrieval/kb': 'tool' } }, 'kb-playbook': { toggles: { 'retrieval/kb': 'playbook' } } };
|
|
602
|
+
|
|
603
|
+
/** THE ACTIVITIES A RUN SPAWNED, from its PROV bundle: the run (ServiceExecution) at the root, under it every
|
|
604
|
+
* SkillExecution (a step; wasInformedBy / isStepOfPlan say which) and every ModelInvocation, each with what it
|
|
605
|
+
* generated (receipts, results) and who it ran as. A handed-off or routed step appears as its own activity under the
|
|
606
|
+
* step that spawned it. Read from `graph`; nothing is inferred that the bundle does not say. */
|
|
607
|
+
function activityTreeOf(bundle, record) {
|
|
608
|
+
const nodes = Array.isArray(bundle?.graph) ? bundle.graph : Array.isArray(bundle?.['@graph']) ? bundle['@graph'] : [];
|
|
609
|
+
const stepAt = (id) => { const m = /:s(\d+)$/.exec(String(id)); return m && record?.steps ? record.steps[Number(m[1])] : undefined; };
|
|
610
|
+
const callAt = (id) => { const m = /:model:(\d+)$/.exec(String(id)); return m && record?.modelCalls ? record.modelCalls[Number(m[1])] : undefined; };
|
|
611
|
+
const byId = new Map(nodes.map((n) => [n.id ?? n['@id'], n]));
|
|
612
|
+
const types = (n) => [].concat(n.type ?? n['@type'] ?? []);
|
|
613
|
+
const acts = nodes.filter((n) => types(n).includes('Activity'));
|
|
614
|
+
const generated = (id) => nodes.filter((n) => n.wasGeneratedBy === id).map((n) => ({ id: n.id, type: types(n).filter((t) => t !== 'Entity'), ...(n.digest ? { digest: n.digest } : {}), ...(n.commitment ? { commitment: n.commitment } : {}) }));
|
|
615
|
+
const parentOf = (n) => n.wasInformedBy ?? n.wasStartedBy ?? n.partOf ?? (typeof n.id === 'string' && /:(s\d+|model:\d+)$/.test(n.id) ? n.id.replace(/:(s\d+|model:\d+)$/, '') : undefined);
|
|
616
|
+
const node = (n) => ({
|
|
617
|
+
id: n.id, kind: types(n).filter((t) => t !== 'Activity')[0] ?? 'Activity',
|
|
618
|
+
...(n.startedAtTime ? { startedAt: n.startedAtTime } : {}), ...(n.endedAtTime ? { endedAt: n.endedAtTime } : {}),
|
|
619
|
+
...(n.wasAssociatedWith ? { ranAs: n.wasAssociatedWith } : {}), ...(n.used ? { used: [].concat(n.used) } : {}),
|
|
620
|
+
...(n.hadPlan ? { plan: n.hadPlan } : {}), ...(n.model ? { model: n.model } : {}), ...(n.provider ? { provider: n.provider } : {}), ...(n.role ? { role: n.role } : {}),
|
|
621
|
+
...(n.status ? { status: n.status } : {}), ...(n.toolId ? { toolId: n.toolId } : {}),
|
|
622
|
+
...((s) => s ? { toolId: s.toolId, status: s.status, ...(s.risk ? { risk: s.risk } : {}) } : {})(stepAt(n.id)),
|
|
623
|
+
...((c) => c ? { role: c.role, provider: c.provider, model: c.model, ...(c.tokensIn !== undefined ? { tokensIn: c.tokensIn, tokensOut: c.tokensOut } : {}), ...(c.routeReason ? { because: c.routeReason } : {}), ...(c.stepRef ? { forStep: c.stepRef } : {}) } : {})(callAt(n.id)),
|
|
624
|
+
generated: generated(n.id), children: [],
|
|
625
|
+
});
|
|
626
|
+
const built = new Map(acts.map((a) => [a.id, node(a)]));
|
|
627
|
+
const roots = [];
|
|
628
|
+
for (const a of acts) { const p = parentOf(a); if (p && built.has(p) && p !== a.id) built.get(p).children.push(built.get(a.id)); else roots.push(built.get(a.id)); }
|
|
629
|
+
const order = (xs) => { xs.sort((x, y) => String(x.startedAt ?? '').localeCompare(String(y.startedAt ?? ''))); for (const x of xs) order(x.children); return xs; };
|
|
630
|
+
void byId;
|
|
631
|
+
return order(roots);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
function keptRunMarkdown(planId, entry, tree) {
|
|
635
|
+
const lines = [`# ${entry.intentId} · ${entry.variant} · repeat ${entry.repeat}`, '', `plan \`${planId}\` · run \`${entry.runRef}\` · selection **${entry.verdict?.outcome ?? '?'}** (${entry.selected.join(', ') || 'nothing chosen'})${entry.outcome ? ` · outcome check **${entry.outcome.score}**` : ''}${entry.quality ? ` · quality ${entry.quality.score}` : ''}`, '', '## The ask', '', `> ${entry.message.replace(/\n/g, '\n> ')}`, ''];
|
|
636
|
+
if (entry.outcome) lines.push('## Outcome check — classes delivered', '', ...Object.entries(entry.outcome.classes).map(([k, v]) => `- ${v.toFixed(2)} ${k.split('#').pop()}`), '');
|
|
637
|
+
if (entry.reply?.results && Array.isArray(entry.reply.results)) { lines.push('## Results per step', ''); for (const r of entry.reply.results) lines.push(`### ${r.toolId ?? r.stepRef ?? 'step'}`, '', '```json', JSON.stringify(r.result ?? r, null, 2).slice(0, 20000), '```', ''); }
|
|
638
|
+
lines.push('## The reply', '', entry.reply?.text ?? entry.reply?.error ?? '(the ask port carried no reply)', '');
|
|
639
|
+
lines.push('## Activities the run spawned', '');
|
|
640
|
+
const walk = (xs, depth) => { for (const x of xs) { lines.push(`${' '.repeat(depth)}- **${x.kind}** \`${String(x.id).replace(/^urn:ap:prov:act:/, '')}\`${x.toolId ? ` · ${x.toolId}${x.status ? ` (${x.status})` : ''}` : ''}${x.role ? ` · ${x.role}` : ''}${x.model ? ` · ${x.provider ?? ''} ${x.model}` : ''}${x.tokensIn !== undefined ? ` · ${x.tokensIn} → ${x.tokensOut} tokens` : ''}${x.startedAt && x.endedAt ? ` · ${Math.max(0, Date.parse(x.endedAt) - Date.parse(x.startedAt))} ms` : ''}${x.generated.length ? ` → generated ${x.generated.map((g) => `${g.type.join('/')} ${String(g.id).replace(/^urn:ap:prov:/, '').slice(0, 40)}…`).join(', ')}` : ''}`); walk(x.children, depth + 1); } };
|
|
641
|
+
if (tree.length) walk(tree, 0); else lines.push('(no provenance bundle)');
|
|
642
|
+
lines.push('');
|
|
643
|
+
return lines.join('\n');
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
async function evalCompare() {
|
|
647
|
+
const home = (opt('home') ?? process.env.HOME_URL ?? '').replace(/\/$/, '');
|
|
648
|
+
const store = opt('store');
|
|
649
|
+
for (const [k, v] of [['home', home], ['replay', opt('replay')], ['criterion', opt('criterion')], ['variants', opt('variants')], ['store', store], ['persona', opt('persona')], ['addressee', opt('addressee')]]) if (!v) throw new DevkitError('E_USAGE', `--${k} is required (ap eval compare --replay <set> --criterion <gold> --variants a,b --store <dir> --home <url> --persona <handle> --addressee <name>)`);
|
|
650
|
+
const { existsSync: ex, readFileSync: rf } = await import('node:fs');
|
|
651
|
+
const cm = await loadCompare();
|
|
652
|
+
const fileStore = await loadEvalStore();
|
|
653
|
+
const setR = cm.validateReplaySet(JSON.parse(rf(resolve_(opt('replay')), 'utf8')));
|
|
654
|
+
if (!setR.ok) throw new DevkitError('E_USAGE', `the replay set is not valid: ${setR.errors.join('; ')}`);
|
|
655
|
+
const criterion = JSON.parse(rf(resolve_(opt('criterion')), 'utf8'));
|
|
656
|
+
if (criterion?.type !== 'ap.selection-criterion.v1') throw new DevkitError('E_USAGE', 'the criterion is not an ap.selection-criterion.v1 record');
|
|
657
|
+
const variants = {};
|
|
658
|
+
for (const nameOrFile of opt('variants').split(',').map((s) => s.trim()).filter(Boolean)) {
|
|
659
|
+
if (VARIANT_PRESETS[nameOrFile]) variants[nameOrFile] = VARIANT_PRESETS[nameOrFile];
|
|
660
|
+
else if (ex(resolve_(nameOrFile))) variants[nameOrFile.replace(/^.*\//, '').replace(/\.json$/, '')] = JSON.parse(rf(resolve_(nameOrFile), 'utf8'));
|
|
661
|
+
else throw new DevkitError('E_USAGE', `variant "${nameOrFile}" is neither a preset (${Object.keys(VARIANT_PRESETS).join(', ')}) nor a file`);
|
|
662
|
+
}
|
|
663
|
+
const split = opt('split') ?? 'held-out';
|
|
664
|
+
const repeats = Number(opt('repeat') ?? 1);
|
|
665
|
+
const skillMap = opt('skill-map') ? JSON.parse(rf(resolve_(opt('skill-map')), 'utf8')) : undefined;
|
|
666
|
+
const actGoldRaw = opt('act-gold') ? JSON.parse(rf(resolve_(opt('act-gold')), 'utf8')) : undefined;
|
|
667
|
+
if (actGoldRaw && actGoldRaw.type !== 'ap.act-gold.v1') throw new DevkitError('E_USAGE', 'the act gold is not an ap.act-gold.v1 record');
|
|
668
|
+
const paths = windowPaths(store);
|
|
669
|
+
const windowRaw = ex(paths.window) ? JSON.parse(rf(paths.window, 'utf8')) : null;
|
|
670
|
+
const wv = windowRaw ? cm.validateCaptureWindow(windowRaw) : null;
|
|
671
|
+
if (wv && !wv.ok) throw new DevkitError('E_USAGE', `the window at ${paths.window} is not valid: ${wv.errors.join('; ')}`);
|
|
672
|
+
const salt = ex(paths.salt) ? rf(paths.salt, 'utf8').trim() : null;
|
|
673
|
+
const est = await estateClient(home);
|
|
674
|
+
const me = await est.signin(opt('persona'));
|
|
675
|
+
const addressee = await est.resolveName(opt('addressee'));
|
|
676
|
+
// Spec 418 §12 — the act gold names the estate's agents; resolved once, here, by the estate's own resolver.
|
|
677
|
+
const actGold = actGoldRaw ? await cm.resolveActGold(actGoldRaw, (n) => est.resolveName(n)) : undefined;
|
|
678
|
+
const plan = cm.experimentPlan({ id: opt('plan-id') ?? `${setR.set.id}@${setR.set.version}-${Object.keys(variants).join('+')}-${split}-r${repeats}`, replaySetDigest: await cm.replaySetDigest(setR.set), criterionDigest: await cm.criterionDigest(criterion), split, repeats, variants, ...(opt('policy') ? { policy: opt('policy') } : {}) });
|
|
679
|
+
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
680
|
+
// --keep-text <dir>: the reply's words and the run's activity tree, per case, on this disk and nowhere else. The store
|
|
681
|
+
// never holds words (415 S6); this is the one door for them, and it opens only onto a synthetic estate — the open
|
|
682
|
+
// window must admit the addressee (a domain sandbox org), the same test the capture firewall applies.
|
|
683
|
+
const keepDir = opt('keep-text') ? resolve_(opt('keep-text')) : null;
|
|
684
|
+
if (keepDir) {
|
|
685
|
+
const admitted = wv?.ok && wv.window.roster.map((a) => a.toLowerCase()).includes(addressee.toLowerCase());
|
|
686
|
+
if (!admitted) throw new DevkitError('E_USAGE', `--keep-text keeps words: the open window at ${paths.window} must admit ${opt('addressee')} (${addressee}) — open one with it on the roster (ap eval window open … --roster <persona>,${opt('addressee')})`);
|
|
687
|
+
}
|
|
688
|
+
const ports = {
|
|
689
|
+
ask: async ({ intentId, message, variant, variantName, repeat }) => {
|
|
690
|
+
const runRef = `cmp-${Date.now().toString(36)}-${variantName}-${intentId}-${repeat}`.replace(/[^A-Za-z0-9._:-]/g, '-');
|
|
691
|
+
// Spec 420 W4 — a UX ACTION case supplies the plan its Home button sends; its words ride as the message.
|
|
692
|
+
const supplied = actGold?.cases?.[intentId]?.supplied;
|
|
693
|
+
// A LIVE arm (an empty variant `{}`) sends no variant at all: the estate accepts variants only from the agent or its
|
|
694
|
+
// steward, so a MEMBER's cases (spec 420 set 5a) run as plain asks under the deployment's defaults — paired across two
|
|
695
|
+
// deployments by case, never within one run.
|
|
696
|
+
const live = variant && typeof variant === 'object' && Object.keys(variant).length === 0;
|
|
697
|
+
const r = await est.post('/harness/ask', { session: me.token, addressee, message, ...(live ? {} : { variant }), runRef, ...(supplied ? { plan: supplied } : {}) });
|
|
698
|
+
if (r?.ok === false || r?.error) return { ok: false, error: `${r.refused ? `${r.refused}: ` : ''}${r.error ?? JSON.stringify(r).slice(0, 160)}` };
|
|
699
|
+
// A turn the MODEL HOST refused (overloaded, rate-limited) never planned: a failed run, named as the provider's — it
|
|
700
|
+
// says nothing about the harness under test and must not be scored as its miss (spec 418 §12, seen 2026-09-28).
|
|
701
|
+
const said = String(r?.reply?.error ?? r?.reply?.text ?? '');
|
|
702
|
+
if (r?.reply?.kind === 'refused' && /planner_failed:.*HTTP (402|429|5\d\d)/.test(said)) return { ok: false, error: `provider: ${said.slice(0, 160)}` };
|
|
703
|
+
const rt = r?.hasProvenance?.recordType;
|
|
704
|
+
return { ok: true, runRef: typeof rt === 'string' && rt.startsWith('run.provenance:') ? rt.slice('run.provenance:'.length) : runRef, ...(r?.reply?.plannerTrace?.selection ? { selection: r.reply.plannerTrace.selection } : {}), ...(r?.reply?.plannerTrace ? { trace: r.reply.plannerTrace } : {}), ...(keepDir && r?.reply ? { reply: r.reply } : {}), ...(actGold ? { act: cm.actCaptureOf(r?.reply) } : {}) };
|
|
705
|
+
},
|
|
706
|
+
...(keepDir ? { keep: async (entry) => {
|
|
707
|
+
const { mkdirSync, writeFileSync } = await import('node:fs');
|
|
708
|
+
const dir = `${keepDir}/${plan.id}/${entry.variant}`; mkdirSync(dir, { recursive: true });
|
|
709
|
+
const safe = (s) => String(s).replace(/[^A-Za-z0-9._-]/g, '-');
|
|
710
|
+
const base = `${dir}/${safe(entry.intentId)}#${entry.repeat}`;
|
|
711
|
+
// The record view says what the bundle's activities do not: each step's tool and status, each model call's role,
|
|
712
|
+
// provider, model and tokens. Merged by position (`:s<n>` ↔ steps[n]; `:model:<n>` ↔ modelCalls[n]).
|
|
713
|
+
const rv = await est.post('/harness/provenance', { session: me.token, addressee, runRef: entry.runRef, format: 'record' }).catch(() => null);
|
|
714
|
+
const tree = activityTreeOf(entry.provenance, rv?.ok ? rv.record : null);
|
|
715
|
+
writeFileSync(`${base}.json`, `${JSON.stringify({ type: 'ap.kept-run.v1', planId: plan.id, ...entry, ...(rv?.ok ? { record: rv.record } : {}), activities: tree }, null, 2)}\n`);
|
|
716
|
+
writeFileSync(`${base}.md`, keptRunMarkdown(plan.id, entry, tree));
|
|
717
|
+
} } : {}),
|
|
718
|
+
readProvenance: async (runRef) => {
|
|
719
|
+
for (let i = 0; i < 20; i++) {
|
|
720
|
+
const r = await est.post('/harness/provenance', { session: me.token, addressee, runRef });
|
|
721
|
+
if (r?.ok && r.provenance) return r.provenance;
|
|
722
|
+
await wait(3000);
|
|
723
|
+
}
|
|
724
|
+
return null;
|
|
725
|
+
},
|
|
726
|
+
readMeasures: async (runRef) => {
|
|
727
|
+
for (let i = 0; i < 10; i++) {
|
|
728
|
+
const r = await est.post('/harness/provenance', { session: me.token, addressee, runRef, format: 'measures' });
|
|
729
|
+
if (r?.ok && r.measures) return r.measures;
|
|
730
|
+
if (r?.status === 'refused') return null;
|
|
731
|
+
await wait(3000);
|
|
732
|
+
}
|
|
733
|
+
return null;
|
|
734
|
+
},
|
|
735
|
+
};
|
|
736
|
+
const rec = await cm.runComparison({ ...(opt('fixtures') ? { fixtures: JSON.parse(rf(resolve_(opt('fixtures')), 'utf8')).fixtures } : {}),
|
|
737
|
+
set: setR.set, criterion, plan, window: wv ? wv.window : null, estate: home, estateCapture: est.evalCapture, asker: me.agent, addressee,
|
|
738
|
+
store: fileStore(paths.dir), pseudo: cm.pseudonymiser(salt ?? 'no-window'), ports, ...(skillMap ? { skillMap } : {}), ...(actGold ? { actGold } : {}),
|
|
739
|
+
log: (line) => { if (!json) console.error(` ${line}`); },
|
|
740
|
+
});
|
|
741
|
+
// Spec 420 — the act laboratory's verdicts per DOMAIN PRINCIPLE (each case counts toward every principle it cites).
|
|
742
|
+
if (actGold && !json) {
|
|
743
|
+
const cov = cm.principleCoverageOf(rec.runs.map((r) => r.act));
|
|
744
|
+
const rows = Object.entries(cov).sort(([a], [b]) => a.localeCompare(b));
|
|
745
|
+
if (rows.length) console.error(` principles: ${rows.map(([p, v]) => `${p} ${v.right}/${v.total}`).join(' · ')}`);
|
|
746
|
+
}
|
|
747
|
+
out_({ ok: true, plan: rec.plan, planDigest: rec.planDigest, runs: rec.runs.length, refused: rec.refused, scores: Object.fromEntries(Object.entries(rec.scores).map(([k, v]) => [k, v.aggregate])), verdicts: Object.fromEntries(Object.entries(rec.verdicts).map(([k, v]) => [k, { status: v.status, reason: v.binding_reason }])), comparisons: rec.comparisons }, `ap eval compare · ${home} · store ${paths.dir}\n${cm.formatExperiment(rec)}`);
|
|
748
|
+
}
|
|
749
|
+
|
|
256
750
|
const commands = { doctor, upgrade, conform, test, create, mcp, runtime, generate, eval: evalCmd };
|
|
257
751
|
try {
|
|
258
752
|
if (!cmd || flag('help') || cmd === '--help' || !commands[cmd]) {
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA;;yDAEyD;AACzD,MAAM,WAAW,SAAS;IAAG,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;AAC5C,MAAM,WAAW,QAAQ;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE;AACvD,MAAM,WAAW,SAAS;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE;AAEtE,MAAM,WAAW,YAAY;IAE3B,8DAA8D;IAC9D,cAAc,EAAE,SAAS,GAAG;QAAE,WAAW,EAAE,MAAM,EAAE,CAAC;QAAC,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC9E,gEAAgE;IAChE,aAAa,EAAE,SAAS,GAAG;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,QAAQ,EAAE,CAAC;QAAC,iBAAiB,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;IAC/H,sGAAsG;IACtG,gBAAgB,EAAE,SAAS,GAAG;QAAE,GAAG,EAAE,MAAM,C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MAAM,qBAAqB,GAAG;KAAG,CAAC,IAAI,MAAM,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;CAAE,CAAC;AAEvG;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,YA0EjC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,0BAA0B,GAAG,wBAAwB,CAAC;AAEpG,MAAM,WAAW,YAAY;IAAG,MAAM,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,YAAY,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE;AAIjG,4GAA4G;AAC5G,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,qBAAqB,GAAG;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAYnI;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAiB3D"}
|
package/dist/config.js
CHANGED
|
@@ -21,6 +21,7 @@ export const RING0_DOCTOR_CONFIG = {
|
|
|
21
21
|
{ file: 'apps/demo-a2a/src/config.ts', why: 'local-aes dev backend reads A2A_MASTER_PRIVATE_KEY only when A2A_KMS_BACKEND=local-aes; production is gcp-kms (deferred KMS migration, memory project_demo_a2a_kms_deferred)' },
|
|
22
22
|
{ file: 'apps/demo-a2a/scripts/canonical-a2a-e2e.ts', why: 'e2e harness mints an ephemeral SIWE persona; never an identity, never deployed' },
|
|
23
23
|
{ file: 'apps/demo-discovery-connector/src/gateway/tools.ts', why: 'gateway-raw-delegate-key (findings.yaml, accepted-risk): the gateway agent\'s own session-wire delegate key (spec 387); KMS signer + re-issued wire scheduled' },
|
|
24
|
+
{ file: 'apps/home-mcp/src/act.ts', why: 'home-mcp-raw-act-key (findings.yaml, accepted-risk): the act-as-me key is the delegate of the person\'s capped, per-wire-revocable standing wires (spec 397 §11); KMS signer + re-issued wires scheduled with the ask key' },
|
|
24
25
|
{ file: 'apps/home-mcp/src/index.ts', why: 'home-mcp-raw-delegate-key (findings.yaml, accepted-risk): the ask-as-me delegate key holds no authority of its own; KMS signer + client re-registration scheduled (spec 397)' },
|
|
25
26
|
{ file: 'apps/demo-sso-next/scripts/provision-demo-personas-local.ts', why: 'local-chain provisioner with published dev keys' },
|
|
26
27
|
{ file: 'apps/demo-sso-next/scripts/provision-service-agent-local.ts', why: 'local-chain provisioner with published dev keys' },
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,4GAA4G;AAC5G,6GAA6G;AAC7G,qBAAqB;AACrB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA8CvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,cAAc,EAAE;QACd,WAAW,EAAE,CAAC,eAAe,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,CAAC;QAC7K,YAAY,EAAE,CAAC,2BAA2B,CAAC;KAC5C;IACD,aAAa,EAAE;QACb,KAAK,EAAE,CAAC,MAAM,CAAC;QACf,SAAS,EAAE;YACT,EAAE,IAAI,EAAE,6BAA6B,EAAE,GAAG,EAAE,8KAA8K,EAAE;YAC5N,EAAE,IAAI,EAAE,4CAA4C,EAAE,GAAG,EAAE,gFAAgF,EAAE;YAC7I,EAAE,IAAI,EAAE,oDAAoD,EAAE,GAAG,EAAE,+JAA+J,EAAE;YACpO,EAAE,IAAI,EAAE,4BAA4B,EAAE,GAAG,EAAE,8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,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;IACvD,CAAC,CAAC;IACF,OAAO,WAAW,CAAC,QAAQ,EAAE,gBAAgB,CAAC,IAAI,WAAW,CAAC,IAAI,EAAE,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,wBAAwB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AACtL,CAAC"}
|
package/dist/dispatch.d.ts
CHANGED
|
@@ -28,6 +28,10 @@ export declare const CONFORM_MODULES: {
|
|
|
28
28
|
readonly spec: "@agenticprimitives/mcp-protocol/conform";
|
|
29
29
|
readonly fn: "conformMcp";
|
|
30
30
|
};
|
|
31
|
+
readonly provenance: {
|
|
32
|
+
readonly spec: "@agenticprimitives/provenance-node/conform";
|
|
33
|
+
readonly fn: "conformProvenance";
|
|
34
|
+
};
|
|
31
35
|
};
|
|
32
36
|
export declare function loadConform(kind: keyof typeof CONFORM_MODULES): Promise<ConformFn>;
|
|
33
37
|
export declare const LIVE_GATES_MODULE: {
|
|
@@ -110,4 +114,87 @@ export interface EvalModule {
|
|
|
110
114
|
casesFromRunRecords: (records: unknown[], opts?: Record<string, unknown>) => unknown;
|
|
111
115
|
}
|
|
112
116
|
export declare function loadEval(): Promise<EvalModule>;
|
|
117
|
+
/** Spec 415 A4 — `ap eval compare` / `ap eval window`: the comparison runner, the capture window and the pre-registered
|
|
118
|
+
* plan from `@agenticprimitives/evaluation`; the eval store's file binding from `@agenticprimitives/provenance-node`. */
|
|
119
|
+
export declare const COMPARE_MODULE: {
|
|
120
|
+
readonly spec: "@agenticprimitives/evaluation";
|
|
121
|
+
};
|
|
122
|
+
export declare const EVAL_STORE_MODULE: {
|
|
123
|
+
readonly spec: "@agenticprimitives/provenance-node";
|
|
124
|
+
readonly fn: "fileProvenanceStore";
|
|
125
|
+
};
|
|
126
|
+
export interface CompareModule {
|
|
127
|
+
runComparison: (input: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
128
|
+
formatExperiment: (rec: unknown) => string;
|
|
129
|
+
experimentPlan: (input: Record<string, unknown>) => Record<string, unknown>;
|
|
130
|
+
validateReplaySet: (raw: unknown) => {
|
|
131
|
+
ok: true;
|
|
132
|
+
set: Record<string, unknown>;
|
|
133
|
+
} | {
|
|
134
|
+
ok: false;
|
|
135
|
+
errors: string[];
|
|
136
|
+
};
|
|
137
|
+
replaySetDigest: (set: unknown) => Promise<string>;
|
|
138
|
+
criterionDigest: (c: unknown) => Promise<string>;
|
|
139
|
+
validateCaptureWindow: (raw: unknown) => {
|
|
140
|
+
ok: true;
|
|
141
|
+
window: Record<string, unknown>;
|
|
142
|
+
} | {
|
|
143
|
+
ok: false;
|
|
144
|
+
errors: string[];
|
|
145
|
+
};
|
|
146
|
+
windowDigest: (w: unknown) => Promise<string>;
|
|
147
|
+
pseudonymiser: (salt: string) => unknown;
|
|
148
|
+
/** `ap eval rescore` — the scoring step alone, over a stored experiment record. */
|
|
149
|
+
scoreExperimentRuns: (input: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
150
|
+
casesOf: (set: unknown, criterion: unknown, split: string) => {
|
|
151
|
+
intents: unknown[];
|
|
152
|
+
cases: unknown[];
|
|
153
|
+
skillIds: string[];
|
|
154
|
+
};
|
|
155
|
+
/** `ap eval diff` — two stored experiments on their paired cases (McNemar, Δ macro, collateral). */
|
|
156
|
+
compareSelectionRuns: (before: Record<string, unknown>, after: Record<string, unknown>, opts?: Record<string, unknown>) => Record<string, unknown>;
|
|
157
|
+
variantRequestDigest: (v: unknown) => Promise<string>;
|
|
158
|
+
/** `ap eval report` — the skill assessment report the Lab and skill-web render (spec 415 §5b). */
|
|
159
|
+
skillAssessmentReportOf: (input: Record<string, unknown>) => Record<string, unknown>;
|
|
160
|
+
/** `ap eval gates` — the two selection gates (spec 415 A4). */
|
|
161
|
+
rboxAgreementOf: (input: Record<string, unknown>) => Record<string, unknown>;
|
|
162
|
+
judgmentCalibrationOf: (input: Record<string, unknown>) => Record<string, unknown>;
|
|
163
|
+
judgmentConsistencyOf: (input: Record<string, unknown>) => Record<string, unknown>;
|
|
164
|
+
candidateRecallOf: (input: Record<string, unknown>) => Record<string, unknown>;
|
|
165
|
+
fitConformalMap: (input: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
166
|
+
conformalCoverageOf: (input: Record<string, unknown>) => Record<string, unknown>;
|
|
167
|
+
riskCoverageOf: (input: Record<string, unknown>) => Record<string, unknown>;
|
|
168
|
+
selectionBehaviourOf: (input: Record<string, unknown>) => Record<string, unknown>;
|
|
169
|
+
outcomePlanScoresOf: (runs: unknown[], gold: Record<string, unknown>) => Array<Record<string, unknown>>;
|
|
170
|
+
techniqueLedgerOf: (input: Record<string, unknown>) => {
|
|
171
|
+
rows: Array<Record<string, unknown>>;
|
|
172
|
+
rule: string;
|
|
173
|
+
};
|
|
174
|
+
/** Spec 418 §12 — the act laboratory: gold names resolved by the estate; the reply read for the act. */
|
|
175
|
+
resolveActGold: (gold: Record<string, unknown>, resolveName: (name: string) => Promise<string | null>) => Promise<Record<string, unknown>>;
|
|
176
|
+
actCaptureOf: (reply: unknown) => Record<string, unknown>;
|
|
177
|
+
principleCoverageOf: (verdicts: ReadonlyArray<unknown>) => Record<string, {
|
|
178
|
+
right: number;
|
|
179
|
+
total: number;
|
|
180
|
+
}>;
|
|
181
|
+
scorecardOf: (experiments: unknown[], criteria: Record<string, unknown>) => Array<Record<string, unknown>>;
|
|
182
|
+
}
|
|
183
|
+
export declare function loadCompare(): Promise<CompareModule>;
|
|
184
|
+
export declare function loadEvalStore(): Promise<(dir: string, opts?: Record<string, unknown>) => unknown>;
|
|
185
|
+
/** Spec 415 A4 — the exact half's decision function, re-run by `ap eval gates` (orchestration's `decideFromGrounding`). */
|
|
186
|
+
export declare const ORCHESTRATION_MODULE: {
|
|
187
|
+
readonly spec: "@agenticprimitives/orchestration";
|
|
188
|
+
readonly fn: "decideFromGrounding";
|
|
189
|
+
};
|
|
190
|
+
export declare function loadDecideFromGrounding(): Promise<(...args: unknown[]) => unknown>;
|
|
191
|
+
/** Spec 416 W3 — the harness's own calibration math (temperature scaling + the conformal set) and the judge's name,
|
|
192
|
+
* injected into map fitting and the coverage gate so they measure the rule that runs. */
|
|
193
|
+
export declare function loadHarnessCalibration(): Promise<{
|
|
194
|
+
calibrate: (...args: unknown[]) => unknown;
|
|
195
|
+
setOf: (...args: unknown[]) => unknown;
|
|
196
|
+
judge: string;
|
|
197
|
+
}>;
|
|
198
|
+
/** Spec 416 W1 — the proposal, re-derived by the rbox gate from a `propose+judgment` run's recorded grounding. */
|
|
199
|
+
export declare function loadProposeFromGrounding(): Promise<(...args: unknown[]) => unknown>;
|
|
113
200
|
//# sourceMappingURL=dispatch.d.ts.map
|
package/dist/dispatch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;AAChH,MAAM,WAAW,iBAAiB;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,gBAAgB,EAAE,CAAA;CAAE;AAC9F,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEpH,MAAM,WAAW,eAAe;IAC9B,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;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ED
|
@@ -21,7 +21,7 @@ function pick(mod, name, spec) {
|
|
|
21
21
|
throw new DevkitError(ERROR_CODES.E_MODULE_SHAPE, `${spec} does not export ${name}() — upgrade the package or this kit so their contracts agree`);
|
|
22
22
|
return fn;
|
|
23
23
|
}
|
|
24
|
-
export const CONFORM_MODULES = { a2a: { spec: '@agenticprimitives/a2a/conform', fn: 'conformA2a' }, mcp: { spec: '@agenticprimitives/mcp-protocol/conform', fn: 'conformMcp' } };
|
|
24
|
+
export const CONFORM_MODULES = { a2a: { spec: '@agenticprimitives/a2a/conform', fn: 'conformA2a' }, mcp: { spec: '@agenticprimitives/mcp-protocol/conform', fn: 'conformMcp' }, /** Spec 414 §6 — a provenance store binding (`file:<dir>` · `memory:`), C1–C6. */ provenance: { spec: '@agenticprimitives/provenance-node/conform', fn: 'conformProvenance' } };
|
|
25
25
|
export async function loadConform(kind) {
|
|
26
26
|
const m = CONFORM_MODULES[kind];
|
|
27
27
|
return pick(await loadModule(m.spec, `ap conform ${kind}`), m.fn, m.spec);
|
|
@@ -66,4 +66,32 @@ export async function loadEval() {
|
|
|
66
66
|
outcomeOfReply: pick(m, 'outcomeOfReply', EVAL_MODULE.spec), casesFromRunRecords: pick(m, 'casesFromRunRecords', EVAL_MODULE.spec),
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
+
/** Spec 415 A4 — `ap eval compare` / `ap eval window`: the comparison runner, the capture window and the pre-registered
|
|
70
|
+
* plan from `@agenticprimitives/evaluation`; the eval store's file binding from `@agenticprimitives/provenance-node`. */
|
|
71
|
+
export const COMPARE_MODULE = { spec: '@agenticprimitives/evaluation' };
|
|
72
|
+
export const EVAL_STORE_MODULE = { spec: '@agenticprimitives/provenance-node', fn: 'fileProvenanceStore' };
|
|
73
|
+
export async function loadCompare() {
|
|
74
|
+
const m = await loadModule(COMPARE_MODULE.spec, 'ap eval compare');
|
|
75
|
+
const p = (n) => pick(m, n, COMPARE_MODULE.spec);
|
|
76
|
+
return { runComparison: p('runComparison'), formatExperiment: p('formatExperiment'), experimentPlan: p('experimentPlan'), validateReplaySet: p('validateReplaySet'), replaySetDigest: p('replaySetDigest'), criterionDigest: p('criterionDigest'), validateCaptureWindow: p('validateCaptureWindow'), windowDigest: p('windowDigest'), pseudonymiser: p('pseudonymiser'), scoreExperimentRuns: p('scoreExperimentRuns'), casesOf: p('casesOf'), compareSelectionRuns: p('compareSelectionRuns'), variantRequestDigest: p('variantRequestDigest'), skillAssessmentReportOf: p('skillAssessmentReportOf'), rboxAgreementOf: p('rboxAgreementOf'), judgmentCalibrationOf: p('judgmentCalibrationOf'), judgmentConsistencyOf: p('judgmentConsistencyOf'), candidateRecallOf: p('candidateRecallOf'), fitConformalMap: p('fitConformalMap'), conformalCoverageOf: p('conformalCoverageOf'), riskCoverageOf: p('riskCoverageOf'), selectionBehaviourOf: p('selectionBehaviourOf'), outcomePlanScoresOf: p('outcomePlanScoresOf'), techniqueLedgerOf: p('techniqueLedgerOf'), scorecardOf: p('scorecardOf'), resolveActGold: p('resolveActGold'), actCaptureOf: p('actCaptureOf'), principleCoverageOf: p('principleCoverageOf') };
|
|
77
|
+
}
|
|
78
|
+
export async function loadEvalStore() {
|
|
79
|
+
return pick(await loadModule(EVAL_STORE_MODULE.spec, 'ap eval compare'), EVAL_STORE_MODULE.fn, EVAL_STORE_MODULE.spec);
|
|
80
|
+
}
|
|
81
|
+
/** Spec 415 A4 — the exact half's decision function, re-run by `ap eval gates` (orchestration's `decideFromGrounding`). */
|
|
82
|
+
export const ORCHESTRATION_MODULE = { spec: '@agenticprimitives/orchestration', fn: 'decideFromGrounding' };
|
|
83
|
+
export async function loadDecideFromGrounding() {
|
|
84
|
+
return pick(await loadModule(ORCHESTRATION_MODULE.spec, 'ap eval gates'), ORCHESTRATION_MODULE.fn, ORCHESTRATION_MODULE.spec);
|
|
85
|
+
}
|
|
86
|
+
/** Spec 416 W3 — the harness's own calibration math (temperature scaling + the conformal set) and the judge's name,
|
|
87
|
+
* injected into map fitting and the coverage gate so they measure the rule that runs. */
|
|
88
|
+
export async function loadHarnessCalibration() {
|
|
89
|
+
const m = await loadModule(ORCHESTRATION_MODULE.spec, 'ap eval calibrate');
|
|
90
|
+
const judge = m.SELECTION_JUDGE?.name ?? 'unknown';
|
|
91
|
+
return { calibrate: pick(m, 'calibrateByTemperature', ORCHESTRATION_MODULE.spec), setOf: pick(m, 'conformalSetOf', ORCHESTRATION_MODULE.spec), judge };
|
|
92
|
+
}
|
|
93
|
+
/** Spec 416 W1 — the proposal, re-derived by the rbox gate from a `propose+judgment` run's recorded grounding. */
|
|
94
|
+
export async function loadProposeFromGrounding() {
|
|
95
|
+
return pick(await loadModule(ORCHESTRATION_MODULE.spec, 'ap eval gates'), 'proposeFromGrounding', ORCHESTRATION_MODULE.spec);
|
|
96
|
+
}
|
|
69
97
|
//# sourceMappingURL=dispatch.js.map
|
package/dist/dispatch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,6GAA6G;AAC7G,+GAA+G;AAC/G,8GAA8G;AAC9G,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAUvD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,sBAAsB,EAAE,+BAA+B,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEhH,KAAK,UAAU,UAAU,CAAC,IAAY,EAAE,IAAY;IAClD,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAA4B,CAAC;IACzD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,GAAI,CAAuB,CAAC,IAAI,IAAI,EAAE,CAAC;QACjD,IAAI,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,WAAW,CAAC,WAAW,CAAC,eAAe,EAAE,GAAG,IAAI,UAA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U,CAAC,oBAAoB,CAAC,IAAI,EAAE,eAAe,CAAC,EAAE,oBAAoB,CAAC,EAAE,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAChI,CAAC;AACD;0FAC0F;AAC1F,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,MAAM,CAAC,GAAG,MAAM,UAAU,CAAC,oBAAoB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAC3E,MAAM,KAAK,GAAI,CAA6C,CAAC,eAAe,EAAE,IAAI,IAAI,SAAS,CAAC;IAChG,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,EAAE,wBAAwB,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;AACzJ,CAAC;AACD,kHAAkH;AAClH,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,OAAO,IAAI,CAAC,MAAM,UAAU,CAAC,oBAAoB,CAAC,IAAI,EAAE,eAAe,CAAC,EAAE,sBAAsB,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAC/H,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export { workspaceGlobs, workspaceManifests } from './workspace.js';
|
|
|
19
19
|
export type { PackageManifest, WorkspaceManifest } from './workspace.js';
|
|
20
20
|
export { planUpgrade, applyUpgradePlan, formatUpgradePlan, npmDistTags } from './upgrade.js';
|
|
21
21
|
export type { UpgradeMode, UpgradeChange, UpgradePlan, DistTagResolver } from './upgrade.js';
|
|
22
|
-
export { CONFORM_MODULES, LIVE_GATES_MODULE, CREATE_APP_MODULE, RUNTIME_MODULE, loadConform, loadLiveGatesRunner, loadCreateApp, loadRuntimeCli, loadHarnessProjections, loadEval, formatConformanceReport } from './dispatch.js';
|
|
22
|
+
export { CONFORM_MODULES, LIVE_GATES_MODULE, CREATE_APP_MODULE, RUNTIME_MODULE, loadConform, loadLiveGatesRunner, loadCreateApp, loadRuntimeCli, loadHarnessProjections, loadEval, formatConformanceReport, COMPARE_MODULE, EVAL_STORE_MODULE, loadCompare, loadEvalStore, ORCHESTRATION_MODULE, loadDecideFromGrounding, loadProposeFromGrounding, loadHarnessCalibration } from './dispatch.js';
|
|
23
23
|
export type { RuntimeCli } from './dispatch.js';
|
|
24
24
|
export type { ConformanceCheck, ConformanceReport, ConformFn, LiveGatesRunner } from './dispatch.js';
|
|
25
25
|
export { createDeveloperMcp, runDeveloperMcpStdio, DEVELOPER_MCP_DOCTRINE } from './developer-mcp.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,EAAG,2BAAoC,CAAC;AACjE,eAAO,MAAM,cAAc,EAAG,yBAAkC,CAAC;AACjE,eAAO,MAAM,QAAQ,EAAG,uCAAgD,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACvF,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnI,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC1D,YAAY,EAAE,cAAc,EAAE,M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spaceManifests } from './workspace.js';
|
|
17
17
|
export { planUpgrade, applyUpgradePlan, formatUpgradePlan, npmDistTags } from './upgrade.js';
|
|
18
|
-
export { CONFORM_MODULES, LIVE_GATES_MODULE, CREATE_APP_MODULE, RUNTIME_MODULE, loadConform, loadLiveGatesRunner, loadCreateApp, loadRuntimeCli, loadHarnessProjections, loadEval, formatConformanceReport } from './dispatch.js';
|
|
18
|
+
export { CONFORM_MODULES, LIVE_GATES_MODULE, CREATE_APP_MODULE, RUNTIME_MODULE, loadConform, loadLiveGatesRunner, loadCreateApp, loadRuntimeCli, loadHarnessProjections, loadEval, formatConformanceReport, COMPARE_MODULE, EVAL_STORE_MODULE, loadCompare, loadEvalStore, ORCHESTRATION_MODULE, loadDecideFromGrounding, loadProposeFromGrounding, loadHarnessCalibration } from './dispatch.js';
|
|
19
19
|
// Spec 398 §10.4 — the read-only Developer MCP (the THIRD MCP; never the runtime's, never the Home's).
|
|
20
20
|
export { createDeveloperMcp, runDeveloperMcpStdio, DEVELOPER_MCP_DOCTRINE } from './developer-mcp.js';
|
|
21
21
|
// Spec 398 §10.3 — the pinned definitions and the review `ap upgrade` stops for.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,+GAA+G;AAC/G,0GAA0G;AAC1G,+GAA+G;AAC/G,yFAAyF;AACzF,MAAM,CAAC,MAAM,YAAY,GAAG,2BAAoC,CAAC;AACjE,MAAM,CAAC,MAAM,cAAc,GAAG,yBAAkC,CAAC;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG,uCAAgD,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,gBAAgB,E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":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"web-no-direct-mcp.d.ts","sourceRoot":"","sources":["../../src/rules/web-no-direct-mcp.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAU1D,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAuBrE,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { isCommentLine } from '../fs.js';
|
|
2
2
|
const FORBIDDEN = [
|
|
3
3
|
{ re: /(?<!\/a2a)\/mcp\/native/, what: 'native MCP tool ingress (/mcp/native) — go through /a2a/*' },
|
|
4
|
-
|
|
4
|
+
// A literal that begins under `/a2a/` is through a2a whatever it ends in (`/a2a/harness/connectors/mcp`, spec 404).
|
|
5
|
+
{ re: /(?<!\/a2a)(?<!\/a2a\/[^"'`]*)\/mcp(["'`])/, what: 'OAuth MCP tool ingress (POST /mcp) — go through /a2a/*' },
|
|
5
6
|
{ re: /(?<!\/a2a)\/tools\//, what: 'raw MCP tool path (/tools/...) — go through /a2a/tools/... instead' },
|
|
6
7
|
];
|
|
7
8
|
const SKIP = new Set(['dist', 'node_modules', 'coverage', 'test', 'tests', '__tests__', '.next']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-no-direct-mcp.js","sourceRoot":"","sources":["../../src/rules/web-no-direct-mcp.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,SAAS,GAAgD;IAC7D,EAAE,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE,2DAA2D,EAAE;IACpG,EAAE,EAAE,EAAE,
|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,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;gBACrC,IAAI,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;oBAAE,SAAS;gBAC7D,OAAO,IAAI,CAAC,CAAC;gBACb,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;oBACnC,IAAI,aAAa,CAAC,IAAI,CAAC;wBAAE,OAAO;oBAChC,KAAK,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,SAAS;wBAAE,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;4BAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,CAAC;gBACjJ,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,0CAA0C,CAAC,CAAC,CAAC,GAAG,OAAO,0CAA0C,EAAE,QAAQ,EAAE,CAAC;IACtK,CAAC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agenticprimitives/devkit",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.8",
|
|
4
4
|
"description": "The Developer Kit core (spec 398 §10 / spec 399 §3): `ap doctor` runs the doctrine gates as data + pure rules over any tree, `ap doctor --rules` projects one pinned rules source into AGENTS.md / CLAUDE.md / .cursor/rules by digest, `ap upgrade` rewrites every @agenticprimitives/* pin to one coherent exact set, and `ap conform` / `ap test` dispatch to the packages that own conformance and live gates.",
|
|
5
5
|
"homepage": "https://agenticprimitives.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -40,13 +40,15 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@agenticprimitives/capability-claims": "0.0.0-alpha.
|
|
43
|
+
"@agenticprimitives/capability-claims": "0.0.0-alpha.25",
|
|
44
44
|
"@agenticprimitives/mcp-protocol": "0.0.0-alpha.4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@agenticprimitives/a2a": "0.0.0-alpha.
|
|
47
|
+
"@agenticprimitives/a2a": "0.0.0-alpha.25",
|
|
48
48
|
"@agenticprimitives/evaluation": "0.0.0-alpha.4",
|
|
49
|
-
"@agenticprimitives/harness": "0.0.0-alpha.
|
|
49
|
+
"@agenticprimitives/harness": "0.0.0-alpha.7",
|
|
50
|
+
"@agenticprimitives/orchestration": "0.0.0-alpha.6",
|
|
51
|
+
"@agenticprimitives/provenance-node": "0.0.0-alpha.2"
|
|
50
52
|
},
|
|
51
53
|
"peerDependenciesMeta": {
|
|
52
54
|
"@agenticprimitives/a2a": {
|
|
@@ -57,11 +59,17 @@
|
|
|
57
59
|
},
|
|
58
60
|
"@agenticprimitives/harness": {
|
|
59
61
|
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"@agenticprimitives/orchestration": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"@agenticprimitives/provenance-node": {
|
|
67
|
+
"optional": true
|
|
60
68
|
}
|
|
61
69
|
},
|
|
62
70
|
"devDependencies": {
|
|
63
71
|
"vitest": "^4.1.8",
|
|
64
|
-
"@agenticprimitives/harness": "0.0.0-alpha.
|
|
72
|
+
"@agenticprimitives/harness": "0.0.0-alpha.7"
|
|
65
73
|
},
|
|
66
74
|
"keywords": [
|
|
67
75
|
"agentic",
|
package/rules/hard-rules.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
- **Smart Agent address is the canonical identifier.** Every person, org, service agent, and treasury IS its ERC-4337 SA address. Names, profiles, ERC-8004 entries, ANS handles, HCS topics — all facets pointing AT the canonical address. Cross-package APIs take `Address`, not names. See [ADR-0010](docs/architecture/decisions/0010-smart-agent-canonical-identifier.md) + [spec 220](specs/220-agent-identity-bootstrap.md) for the bootstrap process (deploy → forced-unique name → custody → optional facets).
|
|
4
4
|
- **Every Smart Agent is a Person, an Organization, or a Service — nothing else.** PROV-O's trichotomy (`prov:Person`/`prov:Organization`/`prov:SoftwareAgent`), mirrored by `AgentType = 'person' | 'org' | 'service'` in `@agenticprimitives/types`. Treasury, indexer, relay, marketplace, data-source are **Service roles** (profile `serviceType` / app-level kinds), never new classes; UI groups by class and labels by role; app kinds map DOWN to a class, never up into the enum ([ADR-0046](docs/architecture/decisions/0046-agent-classification-person-org-service.md), specs 217/225 §6). **A demo person SA is never also their org SA** — do not reuse “his own SA” as the organization ([agent-rules/demo-person-org-distinct.md](docs/architecture/agent-rules/demo-person-org-distinct.md), `pnpm check:demo-person-org-distinct`).
|
|
5
|
-
- **Canonical identity persists; credentials rotate.** Passkeys, SIWE EOAs, hardware wallets are control credential facets — replaceable, not the identity. Credential add / replace / remove is a custody-policy-governed operation (trustee quorum, guardian quorum, multi-credential self-recovery, or multi-sig), NEVER a delegation. The SA address NEVER changes during credential recovery.
|
|
5
|
+
- **Canonical identity persists; credentials rotate.** Passkeys, SIWE EOAs, hardware wallets are control credential facets — replaceable, not the identity. Credential add / replace / remove is a custody-policy-governed operation (trustee quorum, guardian quorum, multi-credential self-recovery, or multi-sig), NEVER a delegation. The SA address NEVER changes during credential recovery. **Every standing grant is re-approved by the ROTATION ceremony under the new custody epoch, and never by recovery** (spec 410 §1; the pre-epoch sentence "delegations remain valid after rotation" is retired): a rotation is `add → retire → approveDigest×N` in one transaction, a recovery is `add → retire → revokeAll` and the person re-issues from a reviewed list; only the account computes an approved-hash key (`approveDigest`), the registry is never an execute target. See [ADR-0011](docs/architecture/decisions/0011-credential-recovery-and-re-association.md) + [spec 221](specs/221-credential-recovery.md).
|
|
6
6
|
- **Specs precede non-trivial code.** New `specs/2XX-*.md` before architecture changes; the spec is the architect-of-record.
|
|
7
7
|
- **Always check smart-agent first.** Before designing any non-trivial capability look at the analog in `/home/barb/smart-agent`. New specs MUST include a "Reference: smart-agent patterns to port" section. Deliberate divergence must say why.
|
|
8
8
|
- **Package boundaries** are one-directional: `types ← identity-auth ← agent-account ← delegation ← mcp-runtime`, plus `key-custody → delegation`, `tool-policy → mcp-runtime`, and the custody-layer fork `types ← custody` (depended on by `agent-account` and `delegation`; see [spec 213](specs/213-custody-layer-carve-out.md) for the firewall). No back-edges. `tool-policy` and `types` are transport-agnostic (no MCP/A2A/LangChain/Vercel imports).
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
- **Per-package context budget:** `CLAUDE.md` ≤ 60 lines, `AUDIT.md` ≤ 150 lines, `README.md` ≤ 1800 words. If you're tempted to bloat one, fix the package shape.
|
|
42
42
|
- **No `eth_getLogs` in product read paths.** Package and app hot paths use `readContract` only; chain history and human-readable reverse strings come from on-chain storage, an explicit indexer, or app cache — never inline log scans ([ADR-0012](docs/architecture/decisions/0012-no-eth-getlogs-in-product-read-paths.md)). No exceptions: the last walker (`agent-naming` `reverseResolve` log fallback) was removed once spec/222 `reverseResolveString` landed.
|
|
43
43
|
- **No silent fallbacks.** A read/auth path has exactly ONE mechanism. If the canonical path has no answer it returns `null`/empty or throws — it does NOT escalate to a second, different, more expensive mechanism (`try fast catch slow`, empty-result → log walk, strong-check → weak-check). Empty is an answer, not a trigger. Bounded retries of the *same* call and cache-first reads (cache holds the canonical answer) are fine; switching mechanism is not ([ADR-0013](docs/architecture/decisions/0013-no-silent-fallbacks.md)).
|
|
44
|
-
- **The discovery knowledge base holds ONLY public, on-chain-derivable data.** The GraphDB A-box (projected by `demo-discovery-indexer`, read by `demo-discovery-mcp`/`-a2a`) is a world-readable read tier — populate it ONLY with facts any party could reproduce from on-chain state, transactions, or event logs (naming, registry entries, profile, relationships, attestations, custodian/passkey membership from `CustodianAdded`/`PasskeyAdded` logs). NEVER per-viewer state, session/credential secrets, off-chain/relying-app-local data, vault contents, PII, or private linkage ([ADR-0025](docs/architecture/decisions/0025-related-agents-are-private-vault-credentials.md)) — not even hashed, not even temporarily, not even to make a check faster. No secret-derived rows: any opaque form (e.g. custody membership as `sha256(credential‖smartAgent)`) MUST be a public, unsalted, on-chain-*reproducible* function — no server pepper. The indexer is the only writer; consumer services MUST NOT write viewer-/request-derived facts back. The claim: reading the whole KB reveals nothing reading the chain wouldn't ([ADR-0040](docs/architecture/decisions/0040-knowledge-base-only-public-onchain-data.md)).
|
|
44
|
+
- **The discovery knowledge base holds ONLY public, on-chain-derivable data.** The GraphDB A-box (projected by `demo-discovery-indexer`, read by `demo-discovery-mcp`/`-a2a`) is a world-readable read tier — populate it ONLY with facts any party could reproduce from on-chain state, transactions, or event logs (naming, registry entries, profile, relationships, attestations, custodian/passkey membership from `CustodianAdded`/`PasskeyAdded` logs). NEVER per-viewer state, session/credential secrets, off-chain/relying-app-local data, vault contents, PII, or private linkage ([ADR-0025](docs/architecture/decisions/0025-related-agents-are-private-vault-credentials.md)) — not even hashed, not even temporarily, not even to make a check faster. No secret-derived rows: any opaque form (e.g. custody membership as `sha256(credential‖smartAgent)`) MUST be a public, unsalted, on-chain-*reproducible* function — no server pepper. The indexer is the only writer; consumer services MUST NOT write viewer-/request-derived facts back. The claim: reading the whole KB reveals nothing reading the chain wouldn't ([ADR-0040](docs/architecture/decisions/0040-knowledge-base-only-public-onchain-data.md)). Amended carve-outs, each opt-in, signed or verified, and read the way a stranger would read it: A2A cards (286), signed Home manifests (323), and **public + owner-released shelf works** with their retrieval index (413; the index is never bound beside a vault, `check:no-vector-over-vault`).
|
|
45
45
|
- **On the A2A→MCP hop, Web3 is the authority; MCP OAuth is only the ingress envelope.** When an A2A service agent calls an MCP service, the authorization decision is ALWAYS the Web3 chain — on-chain delegation + signature validation (ERC-1271/6492/ECDSA/WebAuthn via `UniversalSignatureValidator`) + entitlement + tool policy (+ key-release grant + audit for data) — re-run server-side against the principal SA. We ship MCP's OAuth (RFC 9728 bearer / protected-resource metadata) as a generic ingress *adapter* so external MCP clients interoperate, but the bearer is at most a transport envelope: it carries only `ap_principal` + a `ap_grant_ref`/`ap_grant_hash` to an encrypted grant bundle, NEVER delegation/entitlement payload or field-level authority. Do NOT let OAuth drift inward: field/record access is never encoded in scopes (`vault:read` ≠ "decrypt all PII"), OAuth claims (`scope`/`aud`/`client_id`) are never trusted *as* the grant, an inbound MCP token is never reused for the next hop (fresh token / RFC 8693 exchange), and the Web3 gates are never skipped because "OAuth already authenticated the caller." For internal A2A→MCP hops the public OAuth ingress may be absent/skipped (the A2A bridge handles MCP tokens server-side, never exposing them downstream) — the delegation+signature+entitlement+policy gates are not. One mechanism (ADR-0013): OAuth-fail rejects, it does not fall back to a weaker token-trust path. When the standard and the substrate conflict, the substrate wins. ERC-4337 SA-bound, signature-verified, on-chain-revocable delegation is our differentiator from OAuth — never trade it for an opaque issuer-granted scope ([ADR-0041](docs/architecture/decisions/0041-web3-authority-not-oauth-on-a2a-to-mcp.md) + [spec 277](specs/277-mcp-delegated-vault-authorization.md) + [spec 269](specs/269-async-delegation-authorized-a2a.md) + [spec 270](specs/270-del-001-activation.md)).
|
|
46
46
|
- **Agentic architecture: first-party web expresses INTENTS to an A2A agent; it NEVER drives MCP directly.** A2A is the orchestration / intelligence / discovery layer — it discovers which capability satisfies a declarative goal, plans (planner/LLM/LangChain), assembles authority (delegation/entitlement), and composes MCP tools AS PRIMITIVES. A first-party UI (demo-web-pro, demo-sso-next) says "rebalance the treasury" / "read Alice's PII for purpose X" — a goal, not a tool name, payload, or call sequence — and posts it to an a2a agent. **`web → (edge) → MCP /tools|/mcp|/mcp/native` directly is the anti-pattern (RPC with extra steps) for first-party apps.** The public MCP ingress (`/mcp`, `/mcp/native`) is interop for EXTERNAL agents/clients only; the Act6 OAuth/Native panels are external-MCP-client *demonstrations of a primitive*, NOT a product-UX model (keep them labelled as such). **Orchestration is a Ring-0 primitive, not external** — the agentic loop (intent→plan→compose→observe→re-plan), the planner/reasoner PORT, and the tool/skill model live in a pure `packages/*` orchestration core; ONLY the concrete LLM-framework binding (LangChain/OpenAI/Anthropic SDK) lives in a dedicated in-repo adapter behind the port — the `chain-state` + `chain-state-viem` pattern (ADR-0037 exiles protocol-conformance + deployed-infra, NOT libraries). `service-agent` stays the deterministic compile/run target; the Ring-0 orchestration core PRODUCES its plans. Apps wire model creds/config; they don't re-implement the loop. The edge is orthogonal: it admits, it does not orchestrate (ADR-0043). Honest tension: the first-party web↔a2a surface is RPC-shaped TODAY (`/session/*`, `/account/*`, `/mcp/person/pii` — verbs); the intent layer (A2A messages/tasks against `A2aTaskDO` + `service-agent` plans) is the objective — build NEW first-party surfaces intent-first; the relayer verbs are legacy. Enforced by review + `check:no-direct-mcp-in-web` (browser-app source; allowlist the labelled external-client demo panels) ([ADR-0044](docs/architecture/decisions/0044-a2a-is-the-agentic-orchestration-layer.md) + [docs/architecture/principles.md](docs/architecture/principles.md)).
|
|
47
47
|
- **Packages are GENERIC trust building blocks; white-label / vertical / deployment code lives in apps.** `packages/*` are reusable + vertical-agnostic. They MUST NOT contain (a) **branding / vertical content** — faith vocabulary (ministry, congregation, discipleship, parish, denomination, gospel, scripture — **`church`/`circle` are the one carve-out: Ring-0 derived AGENT TYPES since 2026-08-30, ADR-0061 amendment; the KIND is generic, the content is not**), white-label/product names, marketing copy, themes; (b) **vertical-specific flows** — faith onboarding steps, impact-portal features; (c) **deployment specifics** — concrete hostnames (`impact-agent.me`/`.io`), the `demo.agent` subregistry, hosting providers (`*.pages.dev`/`*.workers.dev`/`vercel`), host/subdomain parsing. All of that is the **app** layer's job, supplied as an **app-level white-label config object** (spec 234) the generic core consumes. The `.agent` TLD itself is the naming protocol (owned by `agent-naming`) and is allowed. Enforced by `pnpm check:no-domain-in-packages` (hostnames + `demo.agent` + faith vocab) + `check:forbidden-terms`; the rest is doctrine ([ADR-0021](docs/architecture/decisions/0021-generic-packages-vs-white-label-apps.md)). Each app centralizes its domain/white-label literals in one module (e.g. `src/lib/domain.ts`), never scattered.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# The vault is the record; an app holds references, never copies
|
|
2
|
+
|
|
3
|
+
**Binding rule for every product app on the substrate (Source Publishing, Field, Skills, Gather, the Home's own
|
|
4
|
+
serving planes) and for the A2A runtime.** Canonical copy; Cursor has no `.mdc` for it yet.
|
|
5
|
+
|
|
6
|
+
## The rule
|
|
7
|
+
|
|
8
|
+
1. **A person's data lives in their vault, behind MCP, under their own key.** Name, email, phone, location, the
|
|
9
|
+
publisher card, a work's text, a profile of any kind — one record, in the owner's vault, reachable only through a
|
|
10
|
+
delegation the owner signed. Nothing about a person is authoritative anywhere else.
|
|
11
|
+
2. **An app keeps REFERENCE facts and its own operational records — nothing that is the person's.** Reference: the Smart
|
|
12
|
+
Agent address, the handle the app assigned, the client's own wire (ask-as-me) and grants, ids of records it wrote
|
|
13
|
+
through the owner's agent. Operational: what the app itself produced and must serve (a public replica of a SIGNED,
|
|
14
|
+
PUBLIC artifact; an archive the product exists to keep; verification results). Never a copy of a private field
|
|
15
|
+
because it was convenient to have beside the id.
|
|
16
|
+
3. **A copy that exists for speed is a cache with a source, never a second record.** The Home's KV Library cache is
|
|
17
|
+
rebuildable from the vault and says `source: cache` on the wire; the runtime's DO storage is a serving plane
|
|
18
|
+
(ADR-0055). If wiping it is a bereavement and not a rebuild, it belonged in the vault.
|
|
19
|
+
4. **Reads are fast by GRANT, not by copying.** An app that needs a person's record at request latency holds a scoped,
|
|
20
|
+
revocable **read grant** the person signed at connect (registry `read_grant.resources`; spec 341 §4.3b) and reads
|
|
21
|
+
it in one call under its own bearer — no harness, no model. What is public is read through the owner's agent's
|
|
22
|
+
public lane (spec 412) — no credential at all. The one thing an app never does is answer speed by storing.
|
|
23
|
+
5. **Writes go through the owner's agent, as the owner.** An app never writes a vault. It asks the person's agent
|
|
24
|
+
(`ask-as-me` → `harness.ask` → a self-acting capability such as `profile.contact.update`, `library.file.save`), and
|
|
25
|
+
the agent writes as the person, into the person's vault, leaving a run of theirs. A form in an app that collects a
|
|
26
|
+
person's name is a form that writes it to their Home — the app forgets it the moment the write lands.
|
|
27
|
+
6. **The A2A runtime is the same.** It reads and writes the owner's records under the owner's grants; it holds serving
|
|
28
|
+
state, receipts, cursors and caches, never the person's data as its own.
|
|
29
|
+
|
|
30
|
+
## Why
|
|
31
|
+
|
|
32
|
+
Every copy is a second enforcement point with a second authority model, and a record nobody can carry to another Home.
|
|
33
|
+
The publishing app kept a directory row with the person's name, organization, byline and topics beside their address,
|
|
34
|
+
and a profile document with their email — three copies of things the Home knew, each drifting the day the Home changed
|
|
35
|
+
(2026-09-21). The doctrine that made revocation real (per-app grants, ADR-0041) is undone by a copy that survives the
|
|
36
|
+
revoke.
|
|
37
|
+
|
|
38
|
+
## How to apply
|
|
39
|
+
|
|
40
|
+
- Designing a table: for each column ask *whose fact is this?* A person's → not here; read it under a grant or through
|
|
41
|
+
the public lane. The app's own → fine.
|
|
42
|
+
- Designing a form: if it collects a person's fact, its submit is a write to their Home through their agent, and the
|
|
43
|
+
page re-reads it from there.
|
|
44
|
+
- Reviewing an app: `grep` its schema and browser storage for names, emails, phones, addresses, profile text. Each hit
|
|
45
|
+
is a finding unless it is inside a signed public artifact the app exists to serve.
|
|
46
|
+
- Performance complaint about a person's data: the answer is a read grant (private) or the public lane (public),
|
|
47
|
+
declared in the registry — never a local copy.
|