@atlasauth/pca-explain 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Atlas Authorization
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,55 @@
1
- # Temporary Holding Version
1
+ # @atlasauth/pca-explain
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Plain-language proof traces for Proof-Carrying Authority decisions. Given a PCActn and the result of the verifier, it explains why the action was allowed or denied: which checks passed, the first failing check with a concrete fix, which capability granted the action, which caveat narrowed or failed, and the risk, threshold and budget path. It also renders an attenuation trace for a delegation chain.
4
+
5
+ Everything is pure and read-only: it never re-authorizes anything and never throws, so malformed input degrades to a best-effort explanation.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm i @atlasauth/pca-explain
11
+ ```
12
+
13
+ Depends on `@atlasauth/pca`.
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import { explainVerification, explainChain } from '@atlasauth/pca-explain';
19
+ import { verifyPCActnCore } from '@atlasauth/pca';
20
+
21
+ // `pcactn` and `grant` come from your PCA flow.
22
+ const result = await verifyPCActnCore(pcactn, { grant, audience: 'ins_acme' });
23
+ const ex = explainVerification(pcactn, result);
24
+
25
+ console.log(ex.toText());
26
+ // PCA verification - DENY
27
+ // Denied at the "audience binding" check: aud does not match this resource server / instance
28
+ // ...
29
+ // x audience aud does not match this resource server / instance <- DECISIVE
30
+ // fix: build the action with aud = this verifier's instance id ...
31
+
32
+ ex.verdict; // 'allow' | 'deny'
33
+ ex.decisive?.name; // the first failing check, e.g. 'audience'
34
+ ex.decisive?.remedy; // what to change
35
+ ex.passed; // names of the checks that held
36
+
37
+ console.log(explainChain([grant]).toText()); // per-hop attenuation trace
38
+ ```
39
+
40
+ For the policy decision (admit, step-up or deny), pass the PCActn and the `PolicyDecision` to `explainDecision(pcactn, decision, { envelope, context })`. Supplying the envelope and the action and caveat context lets it name the granting predicate and each caveat's individual outcome; without them it falls back to the decision's own reasons. The result exposes `disposition`, `grant`, `caveats`, `risk`, `admission`, `decisive` and `summary`.
41
+
42
+ ## API
43
+
44
+ - `explainVerification(pcactn, verifyResult, { now? })` returns a `VerificationExplanation` with `checks`, `passed`, `failed`, `notEnforced`, `decisive`, `summary` and `toText()`.
45
+ - `explainDecision(pcactn, decision, { envelope?, context? })` returns a `DecisionExplanation`.
46
+ - `explainChain(chain)` returns a `ChainExplanation` with per-hop `hops` and `toText()`.
47
+ - `VERIFY_CHECK_ORDER`: the normative check order used for the trace.
48
+
49
+ ## Status
50
+
51
+ Experimental. The explanation is derived from the verifier's own result and describes it; it is not an authorization decision, and a check shown as "not enforced" means the verifier you ran did not enforce it.
52
+
53
+ ## License
54
+
55
+ MIT - see LICENSE
@@ -0,0 +1,202 @@
1
+ /**
2
+ * `@atlasauth/pca-explain` — make PCA decisions self-explaining.
3
+ *
4
+ * A proof-carrying action is a cryptographic object: when it is allowed you want to know WHICH
5
+ * capability granted it and under what bound; when it is denied you want the ONE decisive reason and a
6
+ * concrete fix — not a boolean. This package turns the core verifier's {@link VerifyResult} (the eight
7
+ * normative checks) and the Policy VM's {@link PolicyDecision} (predicate / caveat / risk / budget) into
8
+ * a precise, human-readable proof-trace, plus an ordered attenuation trace for a delegation chain.
9
+ *
10
+ * Everything here is PURE and READ-ONLY: it consumes the REAL shapes from `@atlasauth/pca`, never
11
+ * re-authorizes anything, and never throws (a malformed input degrades to a best-effort explanation).
12
+ */
13
+ import { type PCActn, type VerifyResult, type CheckStatus, type PolicyDecision, type Envelope, type Predicate, type Caveat, type CapabilityChain, type ActionContext, type CaveatContext, type RequiredThreshold, type TrustBudget, type BudgetAllocNode } from '@atlasauth/pca';
14
+ export type Verdict = 'allow' | 'deny';
15
+ /** The nine checks the offline verifier (`verifyPCActnCore`) evaluates, in NORMATIVE order. */
16
+ export declare const VERIFY_CHECK_ORDER: readonly ["wire", "version", "audience", "validity", "cap_chain", "grant_ref_bound", "plan_inclusion", "leaf_signature", "counter"];
17
+ export type VerifyCheckName = (typeof VERIFY_CHECK_ORDER)[number];
18
+ /** Status of a check as presented: the core statuses plus `skipped` (a terminal earlier failure stopped evaluation). */
19
+ export type PresentedStatus = CheckStatus | 'skipped';
20
+ export interface CheckExplanation {
21
+ name: string;
22
+ status: PresentedStatus;
23
+ title: string;
24
+ /** What held (pass) or precisely what failed (fail), with concrete values from the PCActn. */
25
+ detail: string;
26
+ /** Present on the decisive failing check: a concrete fix. */
27
+ remedy?: string;
28
+ /** The hop index a hop-specific failure (chain / leaf signature) points at. */
29
+ hop?: number;
30
+ /** True for the FIRST failing check (the one that determined the verdict). */
31
+ decisive?: boolean;
32
+ }
33
+ export declare class VerificationExplanation {
34
+ readonly kind: "verification";
35
+ readonly verdict: Verdict;
36
+ readonly allow: boolean;
37
+ readonly checks: CheckExplanation[];
38
+ readonly passed: string[];
39
+ readonly failed: string[];
40
+ readonly notEnforced: string[];
41
+ readonly decisive: CheckExplanation | undefined;
42
+ readonly summary: string;
43
+ constructor(fields: {
44
+ verdict: Verdict;
45
+ allow: boolean;
46
+ checks: CheckExplanation[];
47
+ decisive: CheckExplanation | undefined;
48
+ summary: string;
49
+ });
50
+ toText(): string;
51
+ }
52
+ /**
53
+ * Explain the offline verification of a PCActn: walk the eight normative checks in order; for each PASS
54
+ * summarize what held, and for the FIRST failing check pinpoint it precisely (which hop's signature,
55
+ * which audience mismatch, which validity sub-case, counter replay, …) with a concrete remedy.
56
+ *
57
+ * `opts.now` (epoch ms) lets the `validity` pinpoint distinguish "expired" from "clock-skew" precisely;
58
+ * omit it and the authoritative `verifyResult.reason` is used instead.
59
+ */
60
+ export declare function explainVerification(pcActn: PCActn, verifyResult: VerifyResult, opts?: {
61
+ now?: number;
62
+ }): VerificationExplanation;
63
+ export interface GrantExplanation {
64
+ granted: boolean;
65
+ /** The capability that carries the granting predicate (the root grant). */
66
+ capabilityId?: string;
67
+ /** The predicate (in the grant's envelope) that permitted (verb, resource). */
68
+ predicate?: Predicate;
69
+ predicateIndex?: number;
70
+ /** A readable rendering of that predicate's `where` bound. */
71
+ where?: string;
72
+ reason?: string;
73
+ }
74
+ export interface CaveatOutcome {
75
+ type: string;
76
+ satisfied: boolean;
77
+ /** The caveat's non-`type` fields — the bound it imposes / the offending value. */
78
+ value: Record<string, unknown>;
79
+ detail: string;
80
+ /** Present on a FAILED caveat: a concrete fix. */
81
+ remedy?: string;
82
+ /** True when this caveat came from a delegation hop, not the root grant. */
83
+ delegated: boolean;
84
+ }
85
+ export interface RiskExplanation {
86
+ r: number;
87
+ tier: 1 | 2 | 3;
88
+ proof: RequiredThreshold['proof'];
89
+ optimisticAllowed: boolean;
90
+ theta1?: number;
91
+ theta2?: number;
92
+ /** Which threshold band r landed in, with the boundary values. */
93
+ band: string;
94
+ }
95
+ export interface AdmissionExplanation {
96
+ admit: boolean;
97
+ needStepUp: boolean;
98
+ releaseGuardianShare: boolean;
99
+ /** c(A) = κ·r — what a metered action costs against the trust budget (when the risk policy is known). */
100
+ cost?: number;
101
+ kappa?: number;
102
+ /** The trust budget as returned by decide() (post-leak, post-debit if metered + released). */
103
+ budget: TrustBudget;
104
+ /** Human rendering of the admission path taken. */
105
+ path: string;
106
+ }
107
+ /** The composite context decide() was given, supplied so the explanation can pinpoint precisely. */
108
+ export interface DecisionContext {
109
+ /** The action context (lets `explainDecision` name the granting predicate + evaluate `where`). */
110
+ action?: ActionContext;
111
+ /** The caveat context (now, blastRadius, reversibilityClass, delegationDepth, recentActionTimes). */
112
+ caveat?: CaveatContext;
113
+ /** The delegation chain decide() evaluated — for delegated (post-grant) caveats. */
114
+ chain?: CapabilityChain;
115
+ }
116
+ export declare class DecisionExplanation {
117
+ readonly kind: "decision";
118
+ readonly verdict: Verdict;
119
+ /** auto-admit (no human), step-up (guardian/human co-sign needed), or denied (guardian share withheld). */
120
+ readonly disposition: 'auto-admit' | 'step-up' | 'denied';
121
+ readonly grant: GrantExplanation;
122
+ readonly caveats: CaveatOutcome[];
123
+ readonly risk: RiskExplanation;
124
+ readonly admission: AdmissionExplanation;
125
+ /** The single decisive reason (and remedy) when not auto-admitted. */
126
+ readonly decisive: {
127
+ reason: string;
128
+ remedy?: string;
129
+ } | undefined;
130
+ readonly reasons: string[];
131
+ readonly summary: string;
132
+ constructor(fields: {
133
+ verdict: Verdict;
134
+ disposition: 'auto-admit' | 'step-up' | 'denied';
135
+ grant: GrantExplanation;
136
+ caveats: CaveatOutcome[];
137
+ risk: RiskExplanation;
138
+ admission: AdmissionExplanation;
139
+ decisive: {
140
+ reason: string;
141
+ remedy?: string;
142
+ } | undefined;
143
+ reasons: string[];
144
+ summary: string;
145
+ });
146
+ toText(): string;
147
+ }
148
+ /**
149
+ * Explain a Policy-VM decision: which capability/predicate granted the (verb, resource) and under what
150
+ * `where` bound; which caveats were evaluated and which one (with its type + offending value) narrowed
151
+ * or DENIED; the risk value r, the threshold band/tier it landed in, and the budget/admission path
152
+ * (cost vs budget). For anything short of auto-admit it names the single decisive reason + remedy.
153
+ *
154
+ * Supply `opts.envelope` and `opts.context` to pinpoint precisely (the granting predicate and each
155
+ * caveat's individual outcome are re-derived from the REAL evaluators); without them it falls back to
156
+ * the decision's own `reasons`.
157
+ */
158
+ export declare function explainDecision(pcActn: PCActn, decision: PolicyDecision, opts?: {
159
+ envelope?: Envelope;
160
+ context?: DecisionContext;
161
+ }): DecisionExplanation;
162
+ export interface HopExplanation {
163
+ index: number;
164
+ isRoot: boolean;
165
+ issuer: string;
166
+ holder: string;
167
+ issuerShort: string;
168
+ holderShort: string;
169
+ alg: string;
170
+ /** Caveats introduced AT this hop (the diff against the parent's caveat prefix). */
171
+ addedCaveats: Caveat[];
172
+ addedCaveatTypes: string[];
173
+ /** B_sub carried by a `budget_alloc` added at this hop, if any. */
174
+ budgetAlloc?: number;
175
+ /** Human summary of what this hop granted / narrowed. */
176
+ narrowed: string;
177
+ }
178
+ export declare class ChainExplanation {
179
+ readonly kind: "chain";
180
+ readonly depth: number;
181
+ readonly hops: HopExplanation[];
182
+ readonly rootIssuer: string | undefined;
183
+ readonly leafHolder: string | undefined;
184
+ readonly budgetNodes: BudgetAllocNode[];
185
+ readonly summary: string;
186
+ constructor(fields: {
187
+ depth: number;
188
+ hops: HopExplanation[];
189
+ rootIssuer: string | undefined;
190
+ leafHolder: string | undefined;
191
+ budgetNodes: BudgetAllocNode[];
192
+ summary: string;
193
+ });
194
+ toText(): string;
195
+ }
196
+ /**
197
+ * Render a capability delegation chain as an ordered attenuation trace: issuer→holder per hop and what
198
+ * each hop narrowed (caveats added, budget sub-allocation), so a developer can see how authority flowed
199
+ * from the principal's root grant down to the acting leaf and shrank at every hop. Read-only; does not
200
+ * verify signatures (run `verifyChain` for that).
201
+ */
202
+ export declare function explainChain(chain: CapabilityChain): ChainExplanation;
package/dist/index.js ADDED
@@ -0,0 +1,714 @@
1
+ "use strict";
2
+ /**
3
+ * `@atlasauth/pca-explain` — make PCA decisions self-explaining.
4
+ *
5
+ * A proof-carrying action is a cryptographic object: when it is allowed you want to know WHICH
6
+ * capability granted it and under what bound; when it is denied you want the ONE decisive reason and a
7
+ * concrete fix — not a boolean. This package turns the core verifier's {@link VerifyResult} (the eight
8
+ * normative checks) and the Policy VM's {@link PolicyDecision} (predicate / caveat / risk / budget) into
9
+ * a precise, human-readable proof-trace, plus an ordered attenuation trace for a delegation chain.
10
+ *
11
+ * Everything here is PURE and READ-ONLY: it consumes the REAL shapes from `@atlasauth/pca`, never
12
+ * re-authorizes anything, and never throws (a malformed input degrades to a best-effort explanation).
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ChainExplanation = exports.DecisionExplanation = exports.VerificationExplanation = exports.VERIFY_CHECK_ORDER = void 0;
16
+ exports.explainVerification = explainVerification;
17
+ exports.explainDecision = explainDecision;
18
+ exports.explainChain = explainChain;
19
+ const pca_1 = require("@atlasauth/pca");
20
+ // ---- shared helpers -------------------------------------------------------------------------------
21
+ /** Abbreviate a long b64u key for display: first `n` chars + an ellipsis. */
22
+ function short(key, n = 10) {
23
+ if (typeof key !== 'string' || key.length === 0)
24
+ return '<none>';
25
+ return key.length <= n + 1 ? key : `${key.slice(0, n)}…`;
26
+ }
27
+ /** Compact number: integers stay integers, fractions round to 4 dp (trailing zeros trimmed). */
28
+ function num(x) {
29
+ if (typeof x !== 'number' || !Number.isFinite(x))
30
+ return String(x);
31
+ if (Number.isInteger(x))
32
+ return String(x);
33
+ return String(Math.round(x * 1e4) / 1e4);
34
+ }
35
+ /** A one-line, bounded rendering of a caveat's non-`type` fields (the "offending value"). */
36
+ function valueSummary(rest) {
37
+ const parts = [];
38
+ for (const k of Object.keys(rest).slice(0, 6)) {
39
+ const v = rest[k];
40
+ parts.push(`${k}=${typeof v === 'object' && v !== null ? JSON.stringify(v) : num(v)}`);
41
+ }
42
+ return parts.join(', ');
43
+ }
44
+ /** Split a caveat into its type tag and the rest of its fields. */
45
+ function caveatParts(cv) {
46
+ const type = typeof cv?.type === 'string' ? cv.type : '<malformed>';
47
+ const rest = {};
48
+ if (cv !== null && typeof cv === 'object') {
49
+ for (const k of Object.keys(cv))
50
+ if (k !== 'type')
51
+ rest[k] = cv[k];
52
+ }
53
+ return { type, rest };
54
+ }
55
+ /** Compact, depth-bounded rendering of a `where` condition (leaf or boolean grouping). */
56
+ function condToText(c, depth = 0) {
57
+ if (c === null || typeof c !== 'object')
58
+ return '<malformed>';
59
+ if (depth > 6)
60
+ return '…';
61
+ if ('all_of' in c && Array.isArray(c.all_of))
62
+ return `(${c.all_of.map((x) => condToText(x, depth + 1)).join(' AND ')})`;
63
+ if ('any_of' in c && Array.isArray(c.any_of))
64
+ return `(${c.any_of.map((x) => condToText(x, depth + 1)).join(' OR ')})`;
65
+ if ('not' in c)
66
+ return `NOT ${condToText(c.not, depth + 1)}`;
67
+ const leaf = c;
68
+ const operand = leaf.ref !== undefined ? `→${String(leaf.ref)}` : 'value' in leaf ? num(leaf.value) : '';
69
+ return `${String(leaf.field)} ${String(leaf.op)} ${operand}`.trim();
70
+ }
71
+ function whereSummary(where) {
72
+ if (!Array.isArray(where) || where.length === 0)
73
+ return 'any (no where-bound)';
74
+ return where.map((c) => condToText(c)).join(' AND ');
75
+ }
76
+ // =================================================================================================
77
+ // explainVerification — walk the nine normative checks
78
+ // =================================================================================================
79
+ /** The nine checks the offline verifier (`verifyPCActnCore`) evaluates, in NORMATIVE order. */
80
+ exports.VERIFY_CHECK_ORDER = [
81
+ 'wire',
82
+ 'version',
83
+ 'audience',
84
+ 'validity',
85
+ 'cap_chain',
86
+ 'grant_ref_bound',
87
+ 'plan_inclusion',
88
+ 'leaf_signature',
89
+ 'counter',
90
+ ];
91
+ const CHECK_TITLE = {
92
+ wire: 'wire format',
93
+ version: 'version',
94
+ audience: 'audience binding',
95
+ validity: 'freshness window',
96
+ cap_chain: 'capability chain',
97
+ grant_ref_bound: 'grant reference binding',
98
+ plan_inclusion: 'plan inclusion',
99
+ leaf_signature: 'leaf signature',
100
+ counter: 'counter',
101
+ plan_root_authorized: 'plan-root authorization',
102
+ taint_gate: 'taint gate',
103
+ attestation: 'agent attestation',
104
+ threshold: 'threshold signature',
105
+ revocation: 'revocation',
106
+ zk_compliance: 'zk compliance',
107
+ bond: 'bond',
108
+ malformed: 'structure',
109
+ };
110
+ function reasonTail(name, verifyResult) {
111
+ const r = verifyResult.reason;
112
+ if (typeof r !== 'string')
113
+ return undefined;
114
+ const pre = `${name}: `;
115
+ return r.startsWith(pre) ? r.slice(pre.length) : undefined;
116
+ }
117
+ function validityPinpoint(p, now) {
118
+ const lifetime = p.exp - p.iat;
119
+ if (!(p.exp > p.iat)) {
120
+ return { detail: `exp ${p.exp} ≤ iat ${p.iat}: empty validity window`, remedy: 'set exp strictly greater than iat.' };
121
+ }
122
+ if (lifetime > pca_1.PCACTN_MAX_LIFETIME_MS) {
123
+ return {
124
+ detail: `lifetime ${lifetime}ms exceeds the ${pca_1.PCACTN_MAX_LIFETIME_MS}ms maximum`,
125
+ remedy: `shorten the window to ≤ ${pca_1.PCACTN_MAX_LIFETIME_MS}ms (buildPCActn ttlMs).`,
126
+ };
127
+ }
128
+ if (now !== undefined) {
129
+ if (p.iat > now + pca_1.PCACTN_MAX_SKEW_MS) {
130
+ return {
131
+ detail: `iat ${p.iat} is ${p.iat - now}ms in the future (> ${pca_1.PCACTN_MAX_SKEW_MS}ms clock-skew allowance)`,
132
+ remedy: 'fix the signer clock; do not pre-date actions.',
133
+ };
134
+ }
135
+ if (now > p.exp) {
136
+ return {
137
+ detail: `expired ${now - p.exp}ms ago (exp ${p.exp}, now ${now})`,
138
+ remedy: 'build a fresh action — a PCActn lifetime is short by design.',
139
+ };
140
+ }
141
+ }
142
+ return { detail: 'validity window invalid', remedy: 'build a fresh action with a valid iat/exp window.' };
143
+ }
144
+ function capChainPinpoint(p) {
145
+ const chain = p.cap_chain;
146
+ const res = Array.isArray(chain) ? (0, pca_1.verifyChain)(chain) : { ok: false, reason: 'cap_chain is not an array' };
147
+ const reason = res.ok ? 'chain root is not the grant this verifier expects' : (res.reason ?? 'capability chain invalid');
148
+ let hop;
149
+ const m = /hop (\d+)/.exec(reason);
150
+ if (m && m[1] !== undefined)
151
+ hop = Number(m[1]);
152
+ let remedy = 'rebuild the chain: each hop must be signed by the parent’s bound holder and may only APPEND caveats.';
153
+ if (reason.includes('root issuer') || reason.includes('not the grant')) {
154
+ remedy = 'root the chain at the principal key that minted the grant.';
155
+ }
156
+ else if (reason.includes('widens')) {
157
+ remedy = 'a child budget_alloc may not exceed its parent’s carried allocation; lower the sub-allocation.';
158
+ }
159
+ else if (reason.includes('caveat')) {
160
+ remedy = 'attenuation is append-only: never drop, reorder or edit a parent caveat.';
161
+ }
162
+ else if (reason.includes('signature')) {
163
+ remedy = 're-sign that hop with the parent holder’s secret key (and matching alg/pq_pk for a PQ suite).';
164
+ }
165
+ return hop === undefined ? { detail: reason, remedy } : { detail: reason, remedy, hop };
166
+ }
167
+ function leafSigPinpoint(p) {
168
+ const chain = p.cap_chain;
169
+ const idx = Array.isArray(chain) ? chain.length - 1 : -1;
170
+ const leaf = idx >= 0 ? chain[idx] : undefined;
171
+ const alg = p.alg ?? 'ed25519';
172
+ const remedy = 'sign thresholdMessage(body) with the LEAF holder’s secret key; for a PQ/hybrid suite set alg + pq_pk/pq_sig to match the holder.';
173
+ if (!leaf)
174
+ return { detail: 'no leaf capability to check the signature against (empty/invalid chain)', remedy };
175
+ const base = { detail: `leaf hop #${idx} signature (holder ${short(leaf.holder)}, suite ${alg}) does not verify`, remedy };
176
+ return idx >= 0 ? { ...base, hop: idx } : base;
177
+ }
178
+ /** Pinpoint the decisive (first failing) check with a concrete detail + remedy. */
179
+ function pinpoint(name, p, verifyResult, now) {
180
+ const tail = reasonTail(name, verifyResult);
181
+ switch (name) {
182
+ case 'wire':
183
+ return { detail: tail ?? 'wire structure / strict-canonical-form check failed', remedy: 'do not hand-edit the wire JSON; re-encode via encodePCActn with the current SDK.' };
184
+ case 'version':
185
+ return { detail: tail ?? `unsupported ver ${num(p.ver)} (verifier requires ${pca_1.PCACTN_VERSION})`, remedy: `re-mint the action at wire version ${pca_1.PCACTN_VERSION}.` };
186
+ case 'audience':
187
+ return { detail: tail ?? `aud ${JSON.stringify(p.aud)} does not match this resource server / instance`, remedy: 'build the action with aud = this verifier’s instance id (or verify with audience:null to accept any).' };
188
+ case 'validity': {
189
+ const v = validityPinpoint(p, now);
190
+ return { detail: tail ?? v.detail, remedy: v.remedy };
191
+ }
192
+ case 'cap_chain': {
193
+ const c = capChainPinpoint(p);
194
+ return { detail: tail ?? c.detail, ...(c.hop !== undefined ? { hop: c.hop } : {}), remedy: c.remedy };
195
+ }
196
+ case 'grant_ref_bound':
197
+ return {
198
+ detail: tail ?? `grant_ref ${short(p.grant_ref)} is not the id of the root capability in cap_chain`,
199
+ remedy: 'set grant_ref to the id of the chain root (cap_chain[0].id); buildPCActn does this from the grant.',
200
+ };
201
+ case 'plan_inclusion':
202
+ return {
203
+ detail: tail ?? `action (verb ${JSON.stringify(p.action?.verb)} on ${JSON.stringify(p.action?.resource)}) is not node ${JSON.stringify(p.plan?.node_id)} of committed plan ${short(p.plan?.root)}`,
204
+ remedy: 'rebuild the PCActn from a committed plan node whose verb/resource/params match (buildPCActn).',
205
+ };
206
+ case 'leaf_signature': {
207
+ const l = leafSigPinpoint(p);
208
+ return { detail: tail ?? l.detail, ...(l.hop !== undefined ? { hop: l.hop } : {}), remedy: l.remedy };
209
+ }
210
+ case 'counter':
211
+ return { detail: tail ?? `counter ${num(p.counter)} is missing or not a non-negative safe integer`, remedy: 'use a strictly increasing per-holder counter; a repeated counter is a replay.' };
212
+ case 'malformed':
213
+ return { detail: tail ?? 'the PCActn is structurally malformed', remedy: 'rebuild the action with the SDK; do not construct the wire object by hand.' };
214
+ default:
215
+ return { detail: tail ?? `${name} check failed`, remedy: `satisfy the ${name} requirement (supply the corresponding verifier hook / proof).` };
216
+ }
217
+ }
218
+ /** What held, for a PASS (concise, with the concrete value from the PCActn). */
219
+ function passDetail(name, p) {
220
+ switch (name) {
221
+ case 'wire':
222
+ return 'wire structure + strict canonical form valid';
223
+ case 'version':
224
+ return `ver ${num(p.ver)} supported`;
225
+ case 'audience':
226
+ return `aud ${JSON.stringify(p.aud)} matches this resource server`;
227
+ case 'validity':
228
+ return `fresh: iat/exp window valid (lifetime ${num((p.exp - p.iat) / 1000)}s)`;
229
+ case 'cap_chain': {
230
+ const chain = p.cap_chain;
231
+ const len = Array.isArray(chain) ? chain.length : 0;
232
+ const root = Array.isArray(chain) ? chain[0] : undefined;
233
+ return `${len}-hop chain verifies; root issuer ${short(root?.issuer)}`;
234
+ }
235
+ case 'grant_ref_bound':
236
+ return `grant_ref ${short(p.grant_ref)} is the id of the chain root`;
237
+ case 'plan_inclusion':
238
+ return `action is node ${JSON.stringify(p.plan?.node_id)} of committed plan ${short(p.plan?.root)}`;
239
+ case 'leaf_signature': {
240
+ const chain = p.cap_chain;
241
+ const leaf = Array.isArray(chain) && chain.length > 0 ? chain[chain.length - 1] : undefined;
242
+ return `leaf holder ${short(leaf?.holder)} signature valid (suite ${p.alg ?? 'ed25519'})`;
243
+ }
244
+ case 'counter':
245
+ return `counter ${num(p.counter)} well-formed`;
246
+ default:
247
+ return 'ok';
248
+ }
249
+ }
250
+ class VerificationExplanation {
251
+ kind = 'verification';
252
+ verdict;
253
+ allow;
254
+ checks;
255
+ passed;
256
+ failed;
257
+ notEnforced;
258
+ decisive;
259
+ summary;
260
+ constructor(fields) {
261
+ this.verdict = fields.verdict;
262
+ this.allow = fields.allow;
263
+ this.checks = fields.checks;
264
+ this.passed = fields.checks.filter((c) => c.status === 'pass').map((c) => c.name);
265
+ this.failed = fields.checks.filter((c) => c.status === 'fail').map((c) => c.name);
266
+ this.notEnforced = fields.checks.filter((c) => c.status === 'not-enforced').map((c) => c.name);
267
+ this.decisive = fields.decisive;
268
+ this.summary = fields.summary;
269
+ }
270
+ toText() {
271
+ const glyph = { pass: '✓', fail: '✗', 'not-enforced': '·', skipped: '–' };
272
+ const lines = [];
273
+ lines.push(`PCA verification — ${this.verdict.toUpperCase()}`);
274
+ lines.push(this.summary);
275
+ lines.push('');
276
+ for (const c of this.checks) {
277
+ const mark = c.decisive ? ' ◀ DECISIVE' : '';
278
+ lines.push(` ${glyph[c.status]} ${c.name.padEnd(16)} ${c.detail}${mark}`);
279
+ if (c.decisive && c.remedy)
280
+ lines.push(` ↳ fix: ${c.remedy}`);
281
+ }
282
+ return lines.join('\n');
283
+ }
284
+ }
285
+ exports.VerificationExplanation = VerificationExplanation;
286
+ /**
287
+ * Explain the offline verification of a PCActn: walk the eight normative checks in order; for each PASS
288
+ * summarize what held, and for the FIRST failing check pinpoint it precisely (which hop's signature,
289
+ * which audience mismatch, which validity sub-case, counter replay, …) with a concrete remedy.
290
+ *
291
+ * `opts.now` (epoch ms) lets the `validity` pinpoint distinguish "expired" from "clock-skew" precisely;
292
+ * omit it and the authoritative `verifyResult.reason` is used instead.
293
+ */
294
+ function explainVerification(pcActn, verifyResult, opts = {}) {
295
+ const statuses = verifyResult?.checks ?? {};
296
+ const seen = new Set();
297
+ const ordered = [];
298
+ for (const n of exports.VERIFY_CHECK_ORDER) {
299
+ ordered.push(n);
300
+ seen.add(n);
301
+ }
302
+ // Later-milestone / extra checks (plan_root_authorized, taint_gate, attestation, …, malformed) appended.
303
+ for (const n of Object.keys(statuses))
304
+ if (!seen.has(n))
305
+ ordered.push(n);
306
+ // The decisive check: the first (in normative order) that FAILED.
307
+ let decisiveName;
308
+ for (const n of ordered) {
309
+ if (statuses[n] === 'fail') {
310
+ decisiveName = n;
311
+ break;
312
+ }
313
+ }
314
+ const checks = [];
315
+ let decisive;
316
+ for (const name of ordered) {
317
+ const raw = statuses[name];
318
+ const status = raw ?? 'skipped';
319
+ const title = CHECK_TITLE[name] ?? name;
320
+ let detail;
321
+ let remedy;
322
+ let hop;
323
+ if (status === 'fail') {
324
+ const pin = pinpoint(name, pcActn, verifyResult, opts.now);
325
+ detail = pin.detail;
326
+ remedy = pin.remedy;
327
+ hop = pin.hop;
328
+ }
329
+ else if (status === 'pass') {
330
+ detail = passDetail(name, pcActn);
331
+ }
332
+ else if (status === 'not-enforced') {
333
+ detail = 'not enforced by this verifier (no hook / opt-out)';
334
+ }
335
+ else {
336
+ detail = 'not reached (a terminal earlier check stopped evaluation)';
337
+ }
338
+ const entry = { name, status, title, detail };
339
+ if (remedy !== undefined)
340
+ entry.remedy = remedy;
341
+ if (hop !== undefined)
342
+ entry.hop = hop;
343
+ if (name === decisiveName) {
344
+ entry.decisive = true;
345
+ decisive = entry;
346
+ }
347
+ checks.push(entry);
348
+ }
349
+ const verdict = verifyResult?.allow ? 'allow' : 'deny';
350
+ const summary = verdict === 'allow'
351
+ ? `All ${checks.filter((c) => c.status === 'pass').length} evaluated checks passed (no check failed).`
352
+ : decisive
353
+ ? `Denied at the "${decisive.title}" check: ${decisive.detail}`
354
+ : `Denied: ${verifyResult?.reason ?? 'a check failed'}`;
355
+ return new VerificationExplanation({ verdict, allow: !!verifyResult?.allow, checks, decisive, summary });
356
+ }
357
+ function caveatRemedy(type, rest) {
358
+ switch (type) {
359
+ case 'expires':
360
+ return `the grant expired at ${num(rest.at)} (epoch ms); obtain a fresh grant or re-mint with a later 'expires'.`;
361
+ case 'not_before':
362
+ return `the grant is not valid until ${num(rest.at)} (epoch ms); retry after that time.`;
363
+ case 'rate':
364
+ return `rate limit ${num(rest.max)}/${num(rest.per_secs)}s reached; wait for the window to clear or raise the 'rate' caveat.`;
365
+ case 'max_blast_radius':
366
+ return `the action's blast radius exceeds the caveat max ${num(rest.max)}; narrow the action or raise 'max_blast_radius'.`;
367
+ case 'reversibility_max':
368
+ return `the action is more severe than the allowed class '${String(rest.class)}'; only that class or lower is permitted.`;
369
+ case 'delegation_depth':
370
+ return `delegation depth exceeds max ${num(rest.max)}; act from a shallower hop or raise 'delegation_depth'.`;
371
+ default:
372
+ return `caveat '${type}' is not satisfied; check its parameters against the action/context.`;
373
+ }
374
+ }
375
+ function caveatDetail(type, rest, satisfied) {
376
+ const bound = valueSummary(rest);
377
+ const verb = satisfied ? 'held' : 'NARROWED/DENIED';
378
+ return bound.length > 0 ? `${type}(${bound}) ${verb}` : `${type} ${verb}`;
379
+ }
380
+ /** Parse the caveat types decide() reported as failed, from its `reasons` (grant + delegated). */
381
+ function failedCaveatTypesFromReasons(reasons) {
382
+ const out = new Set();
383
+ for (const r of reasons) {
384
+ const m = /caveat\(s\) not satisfied: (.+)$/.exec(r);
385
+ if (m && m[1] !== undefined)
386
+ for (const t of m[1].split(','))
387
+ if (t.trim())
388
+ out.add(t.trim());
389
+ }
390
+ return out;
391
+ }
392
+ function riskBand(r, theta1, theta2, tier) {
393
+ if (theta1 === undefined || theta2 === undefined)
394
+ return `effective tier t=${tier}`;
395
+ if (r <= theta1)
396
+ return `r ${num(r)} ≤ θ1 ${num(theta1)} → claim band (t=1)`;
397
+ if (r <= theta2)
398
+ return `θ1 ${num(theta1)} < r ${num(r)} ≤ θ2 ${num(theta2)} → standard band (t=2)`;
399
+ return `r ${num(r)} > θ2 ${num(theta2)} → strong band (t=3)`;
400
+ }
401
+ class DecisionExplanation {
402
+ kind = 'decision';
403
+ verdict;
404
+ /** auto-admit (no human), step-up (guardian/human co-sign needed), or denied (guardian share withheld). */
405
+ disposition;
406
+ grant;
407
+ caveats;
408
+ risk;
409
+ admission;
410
+ /** The single decisive reason (and remedy) when not auto-admitted. */
411
+ decisive;
412
+ reasons;
413
+ summary;
414
+ constructor(fields) {
415
+ this.verdict = fields.verdict;
416
+ this.disposition = fields.disposition;
417
+ this.grant = fields.grant;
418
+ this.caveats = fields.caveats;
419
+ this.risk = fields.risk;
420
+ this.admission = fields.admission;
421
+ this.decisive = fields.decisive;
422
+ this.reasons = fields.reasons;
423
+ this.summary = fields.summary;
424
+ }
425
+ toText() {
426
+ const lines = [];
427
+ lines.push(`PCA decision — ${this.verdict.toUpperCase()} (${this.disposition})`);
428
+ lines.push(this.summary);
429
+ lines.push('');
430
+ // Authority
431
+ if (this.grant.granted && this.grant.predicate) {
432
+ const p = this.grant.predicate;
433
+ const verbs = Array.isArray(p.verb) ? p.verb.join('|') : String(p.verb);
434
+ lines.push(` authority : predicate #${this.grant.predicateIndex} of grant ${short(this.grant.capabilityId)} grants ${verbs} on ${p.resource ?? '*'}`);
435
+ lines.push(` where ${this.grant.where}`);
436
+ }
437
+ else {
438
+ lines.push(` authority : NOT granted — ${this.grant.reason ?? 'no predicate permits this action'}`);
439
+ }
440
+ // Caveats
441
+ if (this.caveats.length === 0) {
442
+ lines.push(' caveats : none');
443
+ }
444
+ else {
445
+ for (const c of this.caveats) {
446
+ const mark = c.satisfied ? '✓' : '✗';
447
+ const src = c.delegated ? ' [delegated]' : '';
448
+ lines.push(` caveat ${mark} : ${c.detail}${src}`);
449
+ if (!c.satisfied && c.remedy)
450
+ lines.push(` ↳ fix: ${c.remedy}`);
451
+ }
452
+ }
453
+ // Risk / tier / budget
454
+ lines.push(` risk : ${this.risk.band}; proof=${this.risk.proof}, optimistic=${this.risk.optimisticAllowed}`);
455
+ const a = this.admission;
456
+ const costStr = a.cost !== undefined ? `, cost κ·r=${num(a.cost)} (κ=${num(a.kappa)})` : '';
457
+ lines.push(` budget : ${a.path}${costStr}; B after=${num(a.budget.B)}`);
458
+ if (this.decisive) {
459
+ lines.push('');
460
+ lines.push(` ◀ DECISIVE: ${this.decisive.reason}`);
461
+ if (this.decisive.remedy)
462
+ lines.push(` ↳ fix: ${this.decisive.remedy}`);
463
+ }
464
+ return lines.join('\n');
465
+ }
466
+ }
467
+ exports.DecisionExplanation = DecisionExplanation;
468
+ /**
469
+ * Explain a Policy-VM decision: which capability/predicate granted the (verb, resource) and under what
470
+ * `where` bound; which caveats were evaluated and which one (with its type + offending value) narrowed
471
+ * or DENIED; the risk value r, the threshold band/tier it landed in, and the budget/admission path
472
+ * (cost vs budget). For anything short of auto-admit it names the single decisive reason + remedy.
473
+ *
474
+ * Supply `opts.envelope` and `opts.context` to pinpoint precisely (the granting predicate and each
475
+ * caveat's individual outcome are re-derived from the REAL evaluators); without them it falls back to
476
+ * the decision's own `reasons`.
477
+ */
478
+ function explainDecision(pcActn, decision, opts = {}) {
479
+ const env = opts.envelope;
480
+ const ctx = opts.context ?? {};
481
+ const reasons = Array.isArray(decision?.reasons) ? decision.reasons : [];
482
+ // Disposition + verdict. `admit` = autonomous allow (no human). Otherwise step-up (guardian share
483
+ // released but a co-sign is needed) or denied (policy not satisfied, share withheld).
484
+ const disposition = decision.admit
485
+ ? 'auto-admit'
486
+ : decision.releaseGuardianShare
487
+ ? 'step-up'
488
+ : 'denied';
489
+ const verdict = decision.admit ? 'allow' : 'deny';
490
+ // ---- authority: the granting predicate ----
491
+ const grant = { granted: decision.releaseGuardianShare };
492
+ const rootCap = ctx.chain?.[0];
493
+ if (rootCap)
494
+ grant.capabilityId = rootCap.id;
495
+ if (env && ctx.action) {
496
+ const pr = (0, pca_1.evaluatePredicates)(env.predicates, ctx.action);
497
+ if (pr.allowed && pr.matched) {
498
+ grant.granted = true;
499
+ grant.predicate = pr.matched;
500
+ grant.predicateIndex = env.predicates.indexOf(pr.matched);
501
+ grant.where = whereSummary(pr.matched.where);
502
+ }
503
+ else {
504
+ grant.granted = false;
505
+ grant.reason = pr.reason ?? 'no predicate permits this action';
506
+ }
507
+ }
508
+ else if (!decision.releaseGuardianShare) {
509
+ grant.reason = reasons.find((r) => r.includes('predicate') || r.includes('not permitted')) ?? undefined;
510
+ }
511
+ // ---- caveats: per-caveat outcome ----
512
+ const caveats = [];
513
+ const failedFromReasons = failedCaveatTypesFromReasons(reasons);
514
+ const canEvalIndividually = env !== undefined && ctx.caveat !== undefined && ctx.action !== undefined;
515
+ const grantCaveats = env?.caveats ?? [];
516
+ // Delegated caveats mirror decide()'s `extra`: the LEAF capability's top-level caveats beyond the
517
+ // ROOT capability's count (NOT the envelope's inner caveat count — those are the grant's semantic caveats).
518
+ const rootCapCaveatCount = ctx.chain?.[0]?.caveats.length ?? 0;
519
+ const delegatedCaveats = ctx.chain && ctx.chain.length > 1
520
+ ? (ctx.chain[ctx.chain.length - 1]?.caveats ?? []).slice(rootCapCaveatCount)
521
+ : [];
522
+ const classify = (cv, delegated) => {
523
+ const { type, rest } = caveatParts(cv);
524
+ let satisfied;
525
+ if (canEvalIndividually && ctx.caveat && ctx.action) {
526
+ satisfied = (0, pca_1.evaluateAgentCaveats)([cv], ctx.caveat, ctx.action).ok;
527
+ }
528
+ else {
529
+ // Fall back to the decision's reasons: a type named as failed is unsatisfied; otherwise, if the
530
+ // decision released the guardian share (policy OK), every caveat held.
531
+ satisfied = failedFromReasons.has(type) ? false : decision.releaseGuardianShare;
532
+ }
533
+ const outcome = { type, satisfied, value: rest, detail: caveatDetail(type, rest, satisfied), delegated };
534
+ if (!satisfied)
535
+ outcome.remedy = caveatRemedy(type, rest);
536
+ return outcome;
537
+ };
538
+ for (const cv of grantCaveats)
539
+ caveats.push(classify(cv, false));
540
+ for (const cv of delegatedCaveats)
541
+ caveats.push(classify(cv, true));
542
+ // ---- risk / tier ----
543
+ const rt = decision.requiredThreshold;
544
+ const risk = {
545
+ r: decision.r,
546
+ tier: rt.t,
547
+ proof: rt.proof,
548
+ optimisticAllowed: rt.optimisticAllowed,
549
+ band: riskBand(decision.r, env?.risk_policy.theta1, env?.risk_policy.theta2, rt.t),
550
+ };
551
+ if (env) {
552
+ risk.theta1 = env.risk_policy.theta1;
553
+ risk.theta2 = env.risk_policy.theta2;
554
+ }
555
+ // ---- admission / budget ----
556
+ const kappa = env?.risk_policy.kappa;
557
+ const costVal = kappa !== undefined ? (0, pca_1.cost)(decision.r, kappa) : undefined;
558
+ const budgetDepleted = reasons.some((r) => r.includes('budget depleted'));
559
+ let path;
560
+ if (decision.admit) {
561
+ path = `auto-admitted at t=${rt.t} (${rt.proof}); metered`;
562
+ }
563
+ else if (!decision.releaseGuardianShare) {
564
+ path = 'guardian share withheld — policy not satisfied (no autonomous or guardian path)';
565
+ }
566
+ else if (budgetDepleted) {
567
+ path = `trust budget cannot cover the cost — step-up to t=3 (human recharge) required`;
568
+ }
569
+ else {
570
+ path = `step-up to t=${rt.t} (${rt.proof}) co-signature required`;
571
+ }
572
+ const admission = {
573
+ admit: decision.admit,
574
+ needStepUp: decision.needStepUp,
575
+ releaseGuardianShare: decision.releaseGuardianShare,
576
+ budget: decision.budget,
577
+ path,
578
+ };
579
+ if (costVal !== undefined)
580
+ admission.cost = costVal;
581
+ if (kappa !== undefined)
582
+ admission.kappa = kappa;
583
+ // ---- the single decisive reason ----
584
+ let decisive;
585
+ if (!decision.admit) {
586
+ if (!grant.granted) {
587
+ decisive = { reason: grant.reason ?? 'action not permitted by the envelope predicates (default-deny)', remedy: 'grant a predicate that permits this verb+resource (and satisfies its where bound).' };
588
+ }
589
+ else {
590
+ const firstFailed = caveats.find((c) => !c.satisfied);
591
+ if (firstFailed) {
592
+ decisive = { reason: `caveat '${firstFailed.type}' narrowed the authority away: ${firstFailed.detail}`, ...(firstFailed.remedy ? { remedy: firstFailed.remedy } : {}) };
593
+ }
594
+ else if (budgetDepleted) {
595
+ decisive = { reason: `risk ${num(decision.r)} is admissible but the trust budget cannot cover cost κ·r${costVal !== undefined ? `=${num(costVal)}` : ''}`, remedy: 'recharge the budget with a human co-sign, or lower the action risk.' };
596
+ }
597
+ else {
598
+ decisive = { reason: `risk ${num(decision.r)} exceeds the auto threshold → step-up to t=${rt.t} (${rt.proof})`, remedy: rt.t === 3 ? 'obtain a human step-up co-signature.' : 'obtain the guardian/principal co-signature for this tier.' };
599
+ }
600
+ }
601
+ }
602
+ const summary = decision.admit
603
+ ? `Auto-admitted: ${grant.predicate ? `predicate #${grant.predicateIndex}` : 'policy'} grants it, all caveats held, risk r=${num(decision.r)} is in the t=${rt.t} band and the budget covers it.`
604
+ : decisive
605
+ ? `${verdict === 'deny' && disposition === 'denied' ? 'Denied' : 'Needs step-up'}: ${decisive.reason}`
606
+ : `Not auto-admitted (t=${rt.t}).`;
607
+ return new DecisionExplanation({ verdict, disposition, grant, caveats, risk, admission, decisive, reasons, summary });
608
+ }
609
+ function hopNarrowedSummary(isRoot, added) {
610
+ const bits = [];
611
+ for (const cv of added) {
612
+ const { type, rest } = caveatParts(cv);
613
+ if (type === 'envelope') {
614
+ const predicates = Array.isArray(rest.predicates) ? rest.predicates.length : 0;
615
+ const innerCaveats = Array.isArray(rest.caveats) ? rest.caveats.length : 0;
616
+ bits.push(`envelope (${predicates} predicate(s), ${innerCaveats} caveat(s))`);
617
+ }
618
+ else if ((0, pca_1.isBudgetAllocCaveat)(cv)) {
619
+ bits.push(`budget_alloc(B_sub=${num(cv.limit)})`);
620
+ }
621
+ else {
622
+ const bound = valueSummary(rest);
623
+ bits.push(bound ? `+${type}(${bound})` : `+${type}`);
624
+ }
625
+ }
626
+ if (bits.length === 0)
627
+ return isRoot ? 'root grant (no caveats)' : 'rebind only (no new caveats)';
628
+ return (isRoot ? 'grants ' : 'narrows: ') + bits.join(', ');
629
+ }
630
+ class ChainExplanation {
631
+ kind = 'chain';
632
+ depth;
633
+ hops;
634
+ rootIssuer;
635
+ leafHolder;
636
+ budgetNodes;
637
+ summary;
638
+ constructor(fields) {
639
+ this.depth = fields.depth;
640
+ this.hops = fields.hops;
641
+ this.rootIssuer = fields.rootIssuer;
642
+ this.leafHolder = fields.leafHolder;
643
+ this.budgetNodes = fields.budgetNodes;
644
+ this.summary = fields.summary;
645
+ }
646
+ toText() {
647
+ const lines = [];
648
+ lines.push(`PCA delegation chain — ${this.depth} hop(s) (attenuation trace)`);
649
+ lines.push(this.summary);
650
+ lines.push('');
651
+ for (const h of this.hops) {
652
+ const tag = h.isRoot ? 'root ' : 'deleg';
653
+ lines.push(` #${h.index} ${tag} ${h.issuerShort} ──▶ ${h.holderShort} ${h.narrowed}`);
654
+ }
655
+ if (this.budgetNodes.length > 0) {
656
+ const tree = this.budgetNodes.map((n) => `depth ${n.depth} B_sub=${num(n.limit)}`).join(' → ');
657
+ lines.push('');
658
+ lines.push(` budget subtree: ${tree}`);
659
+ }
660
+ return lines.join('\n');
661
+ }
662
+ }
663
+ exports.ChainExplanation = ChainExplanation;
664
+ /**
665
+ * Render a capability delegation chain as an ordered attenuation trace: issuer→holder per hop and what
666
+ * each hop narrowed (caveats added, budget sub-allocation), so a developer can see how authority flowed
667
+ * from the principal's root grant down to the acting leaf and shrank at every hop. Read-only; does not
668
+ * verify signatures (run `verifyChain` for that).
669
+ */
670
+ function explainChain(chain) {
671
+ const hops = [];
672
+ const safeChain = Array.isArray(chain) ? chain : [];
673
+ for (let i = 0; i < safeChain.length; i++) {
674
+ const cap = safeChain[i];
675
+ if (!cap)
676
+ continue;
677
+ const isRoot = i === 0;
678
+ const parent = i > 0 ? safeChain[i - 1] : undefined;
679
+ const parentLen = parent && Array.isArray(parent.caveats) ? parent.caveats.length : 0;
680
+ const own = Array.isArray(cap.caveats) ? cap.caveats : [];
681
+ const added = isRoot ? own : own.length >= parentLen ? own.slice(parentLen) : [];
682
+ const budgetCv = added.find((cv) => (0, pca_1.isBudgetAllocCaveat)(cv));
683
+ const hop = {
684
+ index: i,
685
+ isRoot,
686
+ issuer: cap.issuer,
687
+ holder: cap.holder,
688
+ issuerShort: short(cap.issuer),
689
+ holderShort: short(cap.holder),
690
+ alg: cap.alg ?? 'ed25519',
691
+ addedCaveats: added,
692
+ addedCaveatTypes: added.map((cv) => caveatParts(cv).type),
693
+ narrowed: hopNarrowedSummary(isRoot, added),
694
+ };
695
+ if (budgetCv && (0, pca_1.isBudgetAllocCaveat)(budgetCv))
696
+ hop.budgetAlloc = budgetCv.limit;
697
+ hops.push(hop);
698
+ }
699
+ const root = safeChain[0];
700
+ const leaf = safeChain.length > 0 ? safeChain[safeChain.length - 1] : undefined;
701
+ const budgetNodes = (0, pca_1.budgetAllocNodes)(safeChain);
702
+ const summary = safeChain.length === 0
703
+ ? 'empty chain (no authority)'
704
+ : `${short(root?.issuer)} (principal) delegated through ${safeChain.length - 1} hop(s) to the acting holder ${short(leaf?.holder)}; ${budgetNodes.length} budget node(s).`;
705
+ return new ChainExplanation({
706
+ depth: safeChain.length,
707
+ hops,
708
+ rootIssuer: root?.issuer,
709
+ leafHolder: leaf?.holder,
710
+ budgetNodes,
711
+ summary,
712
+ });
713
+ }
714
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AA0UH,kDA2DC;AAmMD,0CAkIC;AA2FD,oCA4CC;AA/0BD,wCAyBwB;AAIxB,sGAAsG;AAEtG,6EAA6E;AAC7E,SAAS,KAAK,CAAC,GAAY,EAAE,CAAC,GAAG,EAAE;IACjC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjE,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC;AAC3D,CAAC;AAED,gGAAgG;AAChG,SAAS,GAAG,CAAC,CAAU;IACrB,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,6FAA6F;AAC7F,SAAS,YAAY,CAAC,IAA6B;IACjD,MAAM,KAAK,GAAa,EAAE,CAAC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AAI,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAChF,MAAM,WAAW,GAAG,IAAA,sBAAgB,EAAC,SAAS,CAAC,CAAC;IAChD,MAAM,OAAO,GACX,SAAS,CAAC,MAAM,KAAK,CAAC;QACpB,CAAC,CAAC,4BAA4B;QAC9B,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,kCAAkC,SAAS,CAAC,MAAM,GAAG,CAAC,gCAAgC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,WAAW,CAAC,MAAM,kBAAkB,CAAC;IAE/K,OAAO,IAAI,gBAAgB,CAAC;QAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;QACvB,IAAI;QACJ,UAAU,EAAE,IAAI,EAAE,MAAM;QACxB,UAAU,EAAE,IAAI,EAAE,MAAM;QACxB,WAAW;QACX,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,56 @@
1
1
  {
2
2
  "name": "@atlasauth/pca-explain",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Plain-language proof-trace for PCA decisions: given a PCActn and its verify/decide result, explain exactly why it was allowed or denied — which capability granted it, which caveat narrowed or failed, the risk/threshold/budget path, and the first failing check with a remedy.",
5
+ "keywords": [
6
+ "explainability",
7
+ "decision trace",
8
+ "audit",
9
+ "agent authorization",
10
+ "proof-carrying authority",
11
+ "pca",
12
+ "ai agents"
13
+ ],
14
+ "license": "MIT",
15
+ "homepage": "https://github.com/Atlas-Authorization/pca#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/Atlas-Authorization/pca/issues"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/Atlas-Authorization/pca.git",
22
+ "directory": "packages/pca-explain"
23
+ },
24
+ "main": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "./package.json": "./package.json"
32
+ },
33
+ "dependencies": {
34
+ "@atlasauth/pca": "0.2.0"
35
+ },
36
+ "devDependencies": {
37
+ "typescript": "^5.6.3",
38
+ "vitest": "^2.1.4"
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "README.md",
43
+ "LICENSE"
44
+ ],
45
+ "engines": {
46
+ "node": ">=20"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "scripts": {
52
+ "build": "tsc -p tsconfig.build.json",
53
+ "typecheck": "tsc -p tsconfig.json --noEmit",
54
+ "test": "vitest run"
55
+ }
6
56
  }