@agenticprimitives/witness 0.0.0-alpha.1

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 Agentic Trust Labs
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 ADDED
@@ -0,0 +1,44 @@
1
+ # @agenticprimitives/witness
2
+
3
+ **Evidentiary dispute attestation** — the neutral function that answers, from artifacts alone:
4
+ *was this action inside the delegated relationship at the time it happened — and if not, whose
5
+ check failed?*
6
+
7
+ Spec: [`specs/307-witness.md`](../../specs/307-witness.md) · Consumes:
8
+ [verification receipts (spec 303)](../../specs/303-verification-receipts.md) +
9
+ [relationship records (spec 306)](../../specs/306-relationship-record.md).
10
+
11
+ ## The walk
12
+
13
+ ```ts
14
+ import { evaluateDispute, mintWitnessAttestation } from '@agenticprimitives/witness';
15
+
16
+ const evaluation = await evaluateDispute({
17
+ record, // the spec-306 hash-linked evidence chain
18
+ receipt, // the disputed spec-303 public receipt
19
+ detail, // optional — released to the witness via releaseMode 'witness_escrow'
20
+ verifyReceiptSignature,
21
+ });
22
+ // → { outcome: 'in_scope' | 'out_of_scope' | 'revoked_before_execution'
23
+ // | 'stale_status_used' | 'insufficient_evidence', ... }
24
+
25
+ const attestation = await mintWitnessAttestation(
26
+ { witness: witnessSa, relationshipId, evaluation, receipt, checkedDetail: !!detail, attestedAt },
27
+ { sign: witnessSigner },
28
+ );
29
+ ```
30
+
31
+ The walk is **total and ordered** (evidence integrity → record membership → revocation timeline →
32
+ scope), so two witnesses given the same artifacts produce the same outcome and the same
33
+ attestation hash. Anything unverifiable — a broken chain, an invalid receipt, a receipt that isn't
34
+ an entry of the record, a detail that doesn't open — is `insufficient_evidence`, never a guess.
35
+
36
+ `stale_status_used` is the load-bearing outcome: a revocation entry precedes the receipt in the
37
+ relationship record, yet the verifier allowed on `revocation: 'active'` — the verifier relied on
38
+ stale status, which is exactly the liability trigger the article's procurement checklist assigns.
39
+
40
+ ## Status
41
+
42
+ `w1-evaluate-attest` — the walk + attestation mint/verify, 8-test suite (one per outcome,
43
+ determinism, tamper, no-identity-leak). W2: attestation anchoring + the witness-escrow
44
+ DecryptGrant release path. W3: the G-12 liability schema over these outcomes.
@@ -0,0 +1,81 @@
1
+ import { type RelationshipRecordEntryV1 } from '@agenticprimitives/agreements';
2
+ import { type ReceiptSignatureVerifier, type Sha256, type VerificationReceiptDetailV1, type VerificationReceiptV1 } from '@agenticprimitives/verification-receipts';
3
+ export declare const PACKAGE_NAME = "@agenticprimitives/witness";
4
+ export declare const PACKAGE_STATUS = "w1-evaluate-attest";
5
+ export declare const SPEC_REF = "specs/307-witness.md";
6
+ export type Hex = `0x${string}`;
7
+ export type WitnessOutcome = 'in_scope' | 'out_of_scope' | 'revoked_before_execution' | 'stale_status_used' | 'insufficient_evidence';
8
+ export interface WitnessProof {
9
+ type: string;
10
+ signature: string;
11
+ signer?: string;
12
+ }
13
+ export interface WitnessAttestationV1 {
14
+ type: 'WitnessAttestationV1';
15
+ /** The witness identity (Mode-1 public service/org SA). */
16
+ witness: string;
17
+ relationshipId: Hex;
18
+ /** The verified chain head the walk was performed against. */
19
+ recordHead: Hex;
20
+ /** The disputed receipt. */
21
+ receiptHash: Sha256;
22
+ outcome: WitnessOutcome;
23
+ /** Whether an OPENED detail (witness-escrow release) was part of the walk. */
24
+ checkedDetail: boolean;
25
+ /** Exact time — a dispute-grade artifact, deliberately not bucketed. */
26
+ attestedAt: string;
27
+ /** sha256 over the canonical body (everything except attestationHash + proof). */
28
+ attestationHash: Sha256;
29
+ proof?: WitnessProof;
30
+ }
31
+ export interface DisputeEvaluation {
32
+ outcome: WitnessOutcome;
33
+ /** The typed reason trail for `insufficient_evidence`; 'ok' otherwise. */
34
+ evidenceReason: 'ok' | 'record_invalid' | 'receipt_invalid' | 'receipt_not_in_record' | 'detail_mismatch';
35
+ /** Set when the chain verified. */
36
+ recordHead?: Hex;
37
+ /** The record seq of the receipt's entry, when found. */
38
+ receiptSeq?: number;
39
+ }
40
+ /** Deterministic JSON (sorted keys, undefined dropped) — the repo canonical form. */
41
+ export declare function canonicalize(v: unknown): string;
42
+ export interface EvaluateDisputeInput {
43
+ /** The relationship record the parties agree governs the interaction. */
44
+ record: readonly RelationshipRecordEntryV1[];
45
+ /** The disputed verification receipt (public part). */
46
+ receipt: VerificationReceiptV1;
47
+ /** The opened detail — present ONLY when released to the witness
48
+ * (DecryptGrant `releaseMode: 'witness_escrow'`, spec 307 W2). */
49
+ detail?: VerificationReceiptDetailV1;
50
+ /** Injected receipt-signature check (same port as verification-receipts). */
51
+ verifyReceiptSignature?: ReceiptSignatureVerifier;
52
+ }
53
+ /**
54
+ * The deterministic walk (spec 307 §design). Total + ordered — two witnesses
55
+ * given identical inputs MUST produce the identical outcome (INV-307-1):
56
+ * evidence integrity → record membership → revocation timeline → scope.
57
+ * Every unverifiable input maps to `insufficient_evidence` (INV-307-2).
58
+ */
59
+ export declare function evaluateDispute(input: EvaluateDisputeInput): Promise<DisputeEvaluation>;
60
+ export interface MintWitnessAttestationInput {
61
+ witness: string;
62
+ relationshipId: Hex;
63
+ evaluation: DisputeEvaluation;
64
+ receipt: VerificationReceiptV1;
65
+ checkedDetail: boolean;
66
+ attestedAt: string;
67
+ }
68
+ /** Assemble + hash (+ optionally sign) the attestation over a completed walk. */
69
+ export declare function mintWitnessAttestation(input: MintWitnessAttestationInput, opts?: {
70
+ sign?: (attestationHash: Sha256) => Promise<WitnessProof>;
71
+ }): Promise<WitnessAttestationV1>;
72
+ export type AttestationVerifyReason = 'ok' | 'wrong_type' | 'hash_mismatch' | 'proof_missing' | 'proof_invalid';
73
+ /** Standalone attestation check (hash recompute + injected proof port). */
74
+ export declare function verifyWitnessAttestation(attestation: WitnessAttestationV1, opts?: {
75
+ verifySignature?: (attestationHash: Sha256, proof: WitnessProof) => Promise<boolean>;
76
+ requireProof?: boolean;
77
+ }): Promise<{
78
+ valid: boolean;
79
+ reason: AttestationVerifyReason;
80
+ }>;
81
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,MAAM,EACX,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC3B,MAAM,0CAA0C,CAAC;AAElD,eAAO,MAAM,YAAY,+BAA+B,CAAC;AACzD,eAAO,MAAM,cAAc,uBAAuB,CAAC;AACnD,eAAO,MAAM,QAAQ,yBAAyB,CAAC;AAE/C,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAEhC,MAAM,MAAM,cAAc,GACtB,UAAU,GACV,cAAc,GACd,0BAA0B,GAC1B,mBAAmB,GACnB,uBA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AO,CAAC,iBAAiB,CAAC,CA0C7F;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,GAAG,CAAC;IACpB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,iFAAiF;AACjF,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,2BAA2B,EAClC,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;CAAE,GACnE,OAAO,CAAC,oBAAoB,CAAC,CAkB/B;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,GAAG,YAAY,GAAG,eAAe,GAAG,eAAe,GAAG,eAAe,CAAC;AAEhH,2EAA2E;AAC3E,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,oBAAoB,EACjC,IAAI,CAAC,EAAE;IACL,eAAe,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GACA,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,uBAAuB,CAAA;CAAE,CAAC,CAU9D"}
package/dist/index.js ADDED
@@ -0,0 +1,110 @@
1
+ // @agenticprimitives/witness — spec 307 W1 (G-11).
2
+ // The evidentiary dispute function: given a relationship record (spec 306),
3
+ // a verification receipt (spec 303), and optionally its opened detail, walk
4
+ // the evidence DETERMINISTICALLY and attest one of the article's outcomes.
5
+ // "Evidentiary before adjudicative" — facts, never remedies.
6
+ import { verifyRecordChain, } from '@agenticprimitives/agreements';
7
+ import { openReceipt, verifyVerificationReceipt, } from '@agenticprimitives/verification-receipts';
8
+ export const PACKAGE_NAME = '@agenticprimitives/witness';
9
+ export const PACKAGE_STATUS = 'w1-evaluate-attest';
10
+ export const SPEC_REF = 'specs/307-witness.md';
11
+ const enc = new TextEncoder();
12
+ /** Deterministic JSON (sorted keys, undefined dropped) — the repo canonical form. */
13
+ export function canonicalize(v) {
14
+ if (v === null || typeof v !== 'object')
15
+ return JSON.stringify(v) ?? 'null';
16
+ if (Array.isArray(v))
17
+ return `[${v.map(canonicalize).join(',')}]`;
18
+ const o = v;
19
+ return `{${Object.keys(o)
20
+ .sort()
21
+ .filter((k) => o[k] !== undefined)
22
+ .map((k) => `${JSON.stringify(k)}:${canonicalize(o[k])}`)
23
+ .join(',')}}`;
24
+ }
25
+ async function sha256Hex(input) {
26
+ const digest = await globalThis.crypto.subtle.digest('SHA-256', enc.encode(input));
27
+ const hex = Array.from(new Uint8Array(digest))
28
+ .map((b) => b.toString(16).padStart(2, '0'))
29
+ .join('');
30
+ return `sha256:${hex}`;
31
+ }
32
+ /**
33
+ * The deterministic walk (spec 307 §design). Total + ordered — two witnesses
34
+ * given identical inputs MUST produce the identical outcome (INV-307-1):
35
+ * evidence integrity → record membership → revocation timeline → scope.
36
+ * Every unverifiable input maps to `insufficient_evidence` (INV-307-2).
37
+ */
38
+ export async function evaluateDispute(input) {
39
+ // 1. The record chain must verify end-to-end.
40
+ const chain = verifyRecordChain(input.record);
41
+ if (!chain.valid || !chain.head)
42
+ return { outcome: 'insufficient_evidence', evidenceReason: 'record_invalid' };
43
+ // 2. The receipt must verify (hash + proof when a verifier is supplied).
44
+ const receiptOk = await verifyVerificationReceipt(input.receipt, {
45
+ ...(input.verifyReceiptSignature ? { verifySignature: input.verifyReceiptSignature, requireProof: true } : {}),
46
+ });
47
+ if (!receiptOk.valid)
48
+ return { outcome: 'insufficient_evidence', evidenceReason: 'receipt_invalid', recordHead: chain.head };
49
+ // 3. The receipt must BE an entry of this record.
50
+ const entry = input.record.find((e) => e.kind === 'verification_receipt' && e.artifactCommitment === input.receipt.receiptHash);
51
+ if (!entry)
52
+ return { outcome: 'insufficient_evidence', evidenceReason: 'receipt_not_in_record', recordHead: chain.head };
53
+ // 4. A supplied detail must open the receipt — a lying detail is not evidence.
54
+ if (input.detail) {
55
+ const opened = await openReceipt(input.receipt, input.detail);
56
+ if (!opened.valid)
57
+ return { outcome: 'insufficient_evidence', evidenceReason: 'detail_mismatch', recordHead: chain.head, receiptSeq: entry.seq };
58
+ }
59
+ // 5. Revocation timeline: the earliest revocation_assertion BEFORE the
60
+ // receipt's entry decides between the two revocation outcomes.
61
+ const priorRevocation = input.record.some((e) => e.kind === 'revocation_assertion' && e.seq < entry.seq);
62
+ if (priorRevocation) {
63
+ const outcome = input.receipt.decision === 'deny' ? 'revoked_before_execution' : 'stale_status_used';
64
+ return { outcome, evidenceReason: 'ok', recordHead: chain.head, receiptSeq: entry.seq };
65
+ }
66
+ // A receipt that itself recorded 'revoked' yet ALLOWED is the stale-status
67
+ // contradiction even without a record entry.
68
+ if (input.receipt.status.revocation === 'revoked' && input.receipt.decision === 'allow')
69
+ return { outcome: 'stale_status_used', evidenceReason: 'ok', recordHead: chain.head, receiptSeq: entry.seq };
70
+ // 6. Scope: the receipt's own attested verdict.
71
+ const outcome = input.receipt.scopeDecision === 'in_scope' ? 'in_scope' : 'out_of_scope';
72
+ return { outcome, evidenceReason: 'ok', recordHead: chain.head, receiptSeq: entry.seq };
73
+ }
74
+ /** Assemble + hash (+ optionally sign) the attestation over a completed walk. */
75
+ export async function mintWitnessAttestation(input, opts) {
76
+ if (!input.evaluation.recordHead && input.evaluation.evidenceReason !== 'record_invalid') {
77
+ throw new Error('mintWitnessAttestation: evaluation carries no recordHead');
78
+ }
79
+ const body = {
80
+ type: 'WitnessAttestationV1',
81
+ witness: input.witness,
82
+ relationshipId: input.relationshipId,
83
+ recordHead: input.evaluation.recordHead ?? `0x${'0'.repeat(64)}`,
84
+ receiptHash: input.receipt.receiptHash,
85
+ outcome: input.evaluation.outcome,
86
+ checkedDetail: input.checkedDetail,
87
+ attestedAt: input.attestedAt,
88
+ };
89
+ const attestationHash = await sha256Hex(canonicalize(body));
90
+ const attestation = { ...body, attestationHash };
91
+ if (opts?.sign)
92
+ attestation.proof = await opts.sign(attestationHash);
93
+ return attestation;
94
+ }
95
+ /** Standalone attestation check (hash recompute + injected proof port). */
96
+ export async function verifyWitnessAttestation(attestation, opts) {
97
+ if (attestation.type !== 'WitnessAttestationV1')
98
+ return { valid: false, reason: 'wrong_type' };
99
+ const { attestationHash, proof, ...body } = attestation;
100
+ if ((await sha256Hex(canonicalize(body))) !== attestationHash)
101
+ return { valid: false, reason: 'hash_mismatch' };
102
+ if (opts?.requireProof || opts?.verifySignature) {
103
+ if (!proof)
104
+ return { valid: false, reason: 'proof_missing' };
105
+ if (opts.verifySignature && !(await opts.verifySignature(attestationHash, proof)))
106
+ return { valid: false, reason: 'proof_invalid' };
107
+ }
108
+ return { valid: true, reason: 'ok' };
109
+ }
110
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,6DAA6D;AAE7D,OAAO,EACL,iBAAiB,GAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,WAAW,EACX,yBAAyB,GAK1B,MAAM,0CAA0C,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,4BAA4B,CAAC;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAAC;AACnD,MAAM,CAAC,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AAmD/C,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;AAE9B,qFAAqF;AACrF,MAAM,UAAU,YAAY,CAAC,CAAU;IACrC,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC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ChH,IAAI,IAAI,EAAE,YAAY,IAAI,IAAI,EAAE,eAAe,EAAE,CAAC;QAChD,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;QAC7D,IAAI,IAAI,CAAC,eAAe,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;YAC/E,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IACrD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACvC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@agenticprimitives/witness",
3
+ "version": "0.0.0-alpha.1",
4
+ "description": "Evidentiary dispute attestation (spec 307 / G-11): deterministically walk a relationship record + verification receipt and attest in_scope / out_of_scope / revoked_before_execution / stale_status_used / insufficient_evidence. Facts, never remedies.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/agentictrustlabs/agenticprimitives.git",
9
+ "directory": "packages/witness"
10
+ },
11
+ "homepage": "https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/witness",
12
+ "bugs": {
13
+ "url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
14
+ },
15
+ "type": "module",
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "LICENSE",
26
+ "dist",
27
+ "README.md"
28
+ ],
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "devDependencies": {
33
+ "vitest": "^4.1.8",
34
+ "@types/node": "^22.7.0"
35
+ },
36
+ "keywords": [
37
+ "agentic",
38
+ "primitives",
39
+ "witness",
40
+ "dispute",
41
+ "evidence",
42
+ "attestation"
43
+ ],
44
+ "dependencies": {
45
+ "@agenticprimitives/agreements": "0.0.0-alpha.14",
46
+ "@agenticprimitives/verification-receipts": "0.0.0-alpha.1"
47
+ },
48
+ "scripts": {
49
+ "build": "tsc -p tsconfig.build.json",
50
+ "typecheck": "tsc -p tsconfig.json --noEmit",
51
+ "test": "vitest run",
52
+ "test:unit": "vitest run test/unit --passWithNoTests",
53
+ "test:watch": "vitest",
54
+ "clean": "rm -rf dist"
55
+ }
56
+ }