@agenticprimitives/provenance-node 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 +21 -0
- package/README.md +32 -0
- package/dist/conform.d.ts +27 -0
- package/dist/conform.d.ts.map +1 -0
- package/dist/conform.js +151 -0
- package/dist/conform.js.map +1 -0
- package/dist/file-store.d.ts +9 -0
- package/dist/file-store.d.ts.map +1 -0
- package/dist/file-store.js +51 -0
- package/dist/file-store.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/rdfc.d.ts +21 -0
- package/dist/rdfc.d.ts.map +1 -0
- package/dist/rdfc.js +31 -0
- package/dist/rdfc.js.map +1 -0
- package/dist/shacl.d.ts +9 -0
- package/dist/shacl.d.ts.map +1 -0
- package/dist/shacl.js +63 -0
- package/dist/shacl.js.map +1 -0
- package/package.json +69 -0
- package/spec.md +7 -0
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,32 @@
|
|
|
1
|
+
# @agenticprimitives/provenance-node
|
|
2
|
+
|
|
3
|
+
> Part of **[Agentic Primitives](https://agenticprimitives.dev)** — the open-source trust substrate for agentic applications: identity that can sign, authority checked at act time, evidence the owner carries. [Developer kit](https://github.com/agentictrustlabs/agentic-primitives) · [All packages](https://agenticprimitives.dev/developers)
|
|
4
|
+
|
|
5
|
+
The Node-side reference bindings of the provenance ports, and the conformance suite that proves a store binding keeps a
|
|
6
|
+
run's record intact.
|
|
7
|
+
|
|
8
|
+
A run's provenance is a W3C PROV-O / P-Plan / EP-Plan graph in JSON-LD; its measurements are W3C DQV. Where those
|
|
9
|
+
records are KEPT — an agent's vault, a directory of files, a Solid pod, a Graph Store — is a binding of one port.
|
|
10
|
+
`ap conform provenance` runs any binding through six checks and prints what it broke:
|
|
11
|
+
|
|
12
|
+
| | Check |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| C1 | a record put and got back has the same RDFC-1.0 digest (the graph, not the bytes) |
|
|
15
|
+
| C2 | every predicate and class IRI in it is declared in the published ontology; Turtle is served from it |
|
|
16
|
+
| C3 | it conforms to the published SHACL shapes as returned, and a twin still fails |
|
|
17
|
+
| C4 | it carries no words (no address, no body; a measurement is a number) |
|
|
18
|
+
| C5 | an absent record is absent; a reader without standing is refused — never served empty |
|
|
19
|
+
| C6 | a rollup wiped and rebuilt from the records gives the same numbers |
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
ap conform provenance file:./eval-store # a directory of .jsonld files
|
|
23
|
+
ap conform provenance memory: # the in-memory reference
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
In code: `runProvenanceConformance(store, { stranger, rollup })` for any `ProvenanceStorePort` — the vault binding in
|
|
27
|
+
`apps/demo-a2a` is run through the same suite in its tests.
|
|
28
|
+
|
|
29
|
+
Also exported: `rdfcCanonicalizer` (for `recordDigest`), `validateQuads` (SHACL over the published shapes with the
|
|
30
|
+
subclass closure materialized), `toTurtle`, and `fileProvenanceStore`.
|
|
31
|
+
|
|
32
|
+
Node only. A Worker bundles the zero-dependency `@agenticprimitives/provenance` and never this package.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type HarnessRunProvenanceInput, type ProvenanceStorePort } from '@agenticprimitives/provenance';
|
|
2
|
+
import { type RollupPort } from '@agenticprimitives/evaluation';
|
|
3
|
+
export interface ConformanceCheck {
|
|
4
|
+
id: string;
|
|
5
|
+
level: 'MUST' | 'SHOULD' | 'MAY';
|
|
6
|
+
ok: boolean;
|
|
7
|
+
detail?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ConformanceReport {
|
|
10
|
+
target: string;
|
|
11
|
+
ok: boolean;
|
|
12
|
+
checks: ConformanceCheck[];
|
|
13
|
+
}
|
|
14
|
+
/** The fixture run: an A2A door, a variant, a model call, engagements, a governing skill, a mandated completed step. */
|
|
15
|
+
export declare const CONFORMANCE_RUN: HarnessRunProvenanceInput;
|
|
16
|
+
export interface RunConformanceOptions {
|
|
17
|
+
/** The same store as a reader WITHOUT standing sees it (C5). Absent ⇒ C5 is reported as not exercised (SHOULD). */
|
|
18
|
+
stranger?: ProvenanceStorePort;
|
|
19
|
+
/** The rollup binding under test (C6). Absent ⇒ the reference in-memory rollup. */
|
|
20
|
+
rollup?: RollupPort;
|
|
21
|
+
target?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Run C1–C6 against a store binding. */
|
|
24
|
+
export declare function runProvenanceConformance(store: ProvenanceStorePort, opts?: RunConformanceOptions): Promise<ConformanceReport>;
|
|
25
|
+
/** The devkit entry (`ap conform provenance <target>`): `file:<dir>` (a directory store; a temp dir when empty) or `memory:`. */
|
|
26
|
+
export declare function conformProvenance(target: string): Promise<ConformanceReport>;
|
|
27
|
+
//# sourceMappingURL=conform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conform.d.ts","sourceRoot":"","sources":["../src/conform.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAuD,KAAK,yBAAyB,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAE9J,OAAO,EAAmE,KAAK,UAAU,EAAyB,MAAM,+BAA+B,CAAC;AAKxJ,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;AAK9F,wHAAwH;AACxH,eAAO,MAAM,eAAe,EAAE,yBAa7B,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,mHAAmH;IACnH,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,mFAAmF;IACnF,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,yCAAyC;AACzC,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,mBAAmB,EAAE,IAAI,GAAE,qBAA0B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA4EvI;AAED,iIAAiI;AACjI,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAWlF"}
|
package/dist/conform.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// `ap conform provenance` — THE STORAGE IS A BINDING, PROVED (spec 414 §6). Any `ProvenanceStorePort` binding — the
|
|
2
|
+
// acting agent's vault, a directory of files, a Solid pod, a Graph Store — is run through the same six checks with the
|
|
3
|
+
// same fixtures, and passes or names what it broke:
|
|
4
|
+
//
|
|
5
|
+
// C1 round trip — a record put and got back has the SAME RDFC-1.0 digest (the graph, not the bytes);
|
|
6
|
+
// C2 serialization — what comes back expands under the published context, and every predicate and class IRI in it
|
|
7
|
+
// is declared in the shipped T-box; Turtle is served from it;
|
|
8
|
+
// C3 shapes — the run record conforms to R1–R11 and the measurements to M1–M3 AS RETURNED, and a twin still fails;
|
|
9
|
+
// C4 no words — R6 (no address, no body among the run's members) and M3 (a measurement is a number) hold on it;
|
|
10
|
+
// C5 access — an absent key is `absent`; a reader without standing is `refused`, never served, never "empty";
|
|
11
|
+
// C6 rollup — a rollup wiped and rebuilt from the records gives the numbers the live one held.
|
|
12
|
+
//
|
|
13
|
+
// The report shape is the devkit's (`ConformanceReport`), so `ap conform provenance file:<dir>` prints like `ap conform a2a`.
|
|
14
|
+
import { mkdtemp } from 'node:fs/promises';
|
|
15
|
+
import { tmpdir } from 'node:os';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
import { projectHarnessRunProvenance, toJsonLd, recordDigest } from '@agenticprimitives/provenance';
|
|
18
|
+
import { RUN_PROVENANCE_CONTEXT, RUN_MEASURES_CONTEXT } from '@agenticprimitives/ontology';
|
|
19
|
+
import { measureRun, measuresToJsonLd, memoryRollup, rollupRebuildsEqual } from '@agenticprimitives/evaluation';
|
|
20
|
+
import { rdfcCanonicalizer, quadsOf, toTurtle } from './rdfc.js';
|
|
21
|
+
import { validateQuads, declaredTerms } from './shacl.js';
|
|
22
|
+
import { fileProvenanceStore } from './file-store.js';
|
|
23
|
+
const AGENT = '0xb0d11ce19b756a682e78b4904cd8d832303b3d11';
|
|
24
|
+
const RDF_TYPE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';
|
|
25
|
+
/** The fixture run: an A2A door, a variant, a model call, engagements, a governing skill, a mandated completed step. */
|
|
26
|
+
export const CONFORMANCE_RUN = {
|
|
27
|
+
runRef: 'run-conform', endedAt: '2026-09-25T12:00:10.000Z', agent: AGENT, agentClass: 'person', asker: AGENT, chainId: 34348,
|
|
28
|
+
intentDigest: '0x' + '22'.repeat(32), outcome: 'completed',
|
|
29
|
+
door: { kind: 'a2a-message', messageId: 'm-conform', contextId: 'c-conform', taskId: 't-conform' },
|
|
30
|
+
variant: { digest: 'sha256:' + 'ab'.repeat(32), plannerKind: 'model', routePolicy: 'budget' },
|
|
31
|
+
modelCalls: [{ role: 'plan', model: 'model-x', provider: 'provider-x', tokensIn: 100, tokensOut: 20, startedAt: '2026-09-25T12:00:01.000Z', endedAt: '2026-09-25T12:00:02.000Z' }],
|
|
32
|
+
engagements: [{ capability: 'planner/model', effect: 'changed-plan' }],
|
|
33
|
+
steps: [{
|
|
34
|
+
stepRef: 's0', toolId: 'people.members.list', capability: { id: 'people.members.list', action: 'read' }, status: 'completed',
|
|
35
|
+
startedAt: '2026-09-25T12:00:03.000Z', endedAt: '2026-09-25T12:00:09.000Z', receiptDigest: '0x' + 'd1'.repeat(32),
|
|
36
|
+
authority: { presentedRef: '0x' + '11'.repeat(32), decision: 'allow', afterApproval: false },
|
|
37
|
+
skill: { id: 'skill:people/members', version: '1.0.0', contractDigest: '0x' + '44'.repeat(32) },
|
|
38
|
+
}],
|
|
39
|
+
};
|
|
40
|
+
/** Run C1–C6 against a store binding. */
|
|
41
|
+
export async function runProvenanceConformance(store, opts = {}) {
|
|
42
|
+
const checks = [];
|
|
43
|
+
const add = (id, ok, detail, level = 'MUST') => checks.push({ id, level, ok, ...(detail ? { detail } : {}) });
|
|
44
|
+
const run = toJsonLd(projectHarnessRunProvenance(CONFORMANCE_RUN), { context: RUN_PROVENANCE_CONTEXT['@context'], chainId: 34348 });
|
|
45
|
+
const measurements = measureRun({ runRef: CONFORMANCE_RUN.runRef, outcome: 'completed', startedAt: '2026-09-25T12:00:00.000Z', endedAt: CONFORMANCE_RUN.endedAt, stepsPlanned: 1, modelCalls: [{ tokensIn: 100, tokensOut: 20 }], engagements: 1, steps: CONFORMANCE_RUN.steps.map((s) => ({ stepRef: s.stepRef, status: 'executed', ...(s.startedAt ? { startedAt: s.startedAt } : {}), ...(s.endedAt ? { endedAt: s.endedAt } : {}), ...(s.authority ? { authority: { decision: s.authority.decision, afterApproval: s.authority.afterApproval } } : {}) })) });
|
|
46
|
+
const agentIri = `urn:ap:agent:eip155:34348:${AGENT}`;
|
|
47
|
+
const measures = measuresToJsonLd(CONFORMANCE_RUN.runRef, measurements, { context: RUN_MEASURES_CONTEXT['@context'], agentIri, runtimeIri: `urn:ap:prov:runtime:${agentIri}`, at: CONFORMANCE_RUN.endedAt });
|
|
48
|
+
const refs = { run: { agent: AGENT, key: `run.provenance:${CONFORMANCE_RUN.runRef}` }, measures: { agent: AGENT, key: `run.measures:${CONFORMANCE_RUN.runRef}` } };
|
|
49
|
+
// C1 — the round trip, by the graph's identity.
|
|
50
|
+
const got = { run: null, measures: null };
|
|
51
|
+
try {
|
|
52
|
+
for (const [k, doc] of [['run', run], ['measures', measures]]) {
|
|
53
|
+
const w = await store.put(refs[k], doc);
|
|
54
|
+
if (!w.ok) {
|
|
55
|
+
add(`C1 round trip (${k})`, false, `put refused: ${w.error}`);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const r = await store.get(refs[k]);
|
|
59
|
+
if (r.status !== 'found') {
|
|
60
|
+
add(`C1 round trip (${k})`, false, `get answered ${r.status}${r.status === 'refused' ? `: ${r.reason}` : ''}`);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
got[k] = r.document;
|
|
64
|
+
const [a, b] = [await recordDigest(doc, rdfcCanonicalizer), await recordDigest(r.document, rdfcCanonicalizer)];
|
|
65
|
+
add(`C1 round trip (${k})`, a === b, a === b ? a : `digest changed: ${a} → ${b}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
add('C1 round trip', false, e instanceof Error ? e.message : String(e));
|
|
70
|
+
}
|
|
71
|
+
// C2 — expands under the context; every IRI declared; Turtle served.
|
|
72
|
+
try {
|
|
73
|
+
const declared = await declaredTerms();
|
|
74
|
+
const undeclared = new Set();
|
|
75
|
+
for (const doc of [got.run, got.measures].filter((d) => !!d)) {
|
|
76
|
+
for (const q of await quadsOf(doc)) {
|
|
77
|
+
if (q.predicate.value !== RDF_TYPE && !declared.has(q.predicate.value))
|
|
78
|
+
undeclared.add(q.predicate.value);
|
|
79
|
+
if (q.predicate.value === RDF_TYPE && q.object.termType === 'NamedNode' && !declared.has(q.object.value))
|
|
80
|
+
undeclared.add(q.object.value);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
add('C2 every IRI declared in the T-box', got.run !== null && undeclared.size === 0, undeclared.size ? [...undeclared].slice(0, 5).join(', ') : undefined);
|
|
84
|
+
const ttl = got.run ? await toTurtle(got.run) : '';
|
|
85
|
+
add('C2 Turtle served from the record', ttl.includes('prov#') || ttl.includes('prov:'), ttl ? `${ttl.split('\n').length} lines` : 'no record');
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
add('C2 serialization', false, e instanceof Error ? e.message : String(e));
|
|
89
|
+
}
|
|
90
|
+
// C3 + C4 — the shapes on what came back; a twin still fails.
|
|
91
|
+
try {
|
|
92
|
+
if (got.run) {
|
|
93
|
+
const r = await validateQuads('cbox/run-provenance-shapes.shacl.ttl', await quadsOf(got.run));
|
|
94
|
+
add('C3 run record conforms (R1–R11)', r.conforms, r.messages.slice(0, 2).join(' | ') || undefined);
|
|
95
|
+
add('C4 no words in the run record (R6)', !r.messages.some((m) => m.startsWith('R6')));
|
|
96
|
+
const twin = { ...got.run, graph: got.run['graph'].map((n) => (n['id'] === `urn:ap:prov:act:${CONFORMANCE_RUN.runRef}` ? { ...n, arrivedBy: undefined } : n)) };
|
|
97
|
+
const t = await validateQuads('cbox/run-provenance-shapes.shacl.ttl', await quadsOf(twin));
|
|
98
|
+
add('C3 a twin without its door is refused (R9)', !t.conforms && t.messages.some((m) => m.startsWith('R9')));
|
|
99
|
+
}
|
|
100
|
+
if (got.measures) {
|
|
101
|
+
const m = await validateQuads('cbox/run-measures-shapes.shacl.ttl', await quadsOf(got.measures));
|
|
102
|
+
add('C3 measurements conform (M1–M3)', m.conforms, m.messages.slice(0, 2).join(' | ') || undefined);
|
|
103
|
+
add('C4 no words in the measurements (M3)', !m.messages.some((x) => x.startsWith('M3')));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
add('C3 shapes', false, e instanceof Error ? e.message : String(e));
|
|
108
|
+
}
|
|
109
|
+
// C5 — absent is absent; no standing is refused.
|
|
110
|
+
try {
|
|
111
|
+
const absent = await store.get({ agent: AGENT, key: 'run.provenance:run-that-never-was' });
|
|
112
|
+
add('C5 an absent record is absent (not refused, not thrown)', absent.status === 'absent', absent.status);
|
|
113
|
+
if (opts.stranger) {
|
|
114
|
+
const s = await opts.stranger.get(refs.run);
|
|
115
|
+
add('C5 a reader without standing is refused', s.status === 'refused', s.status);
|
|
116
|
+
}
|
|
117
|
+
else
|
|
118
|
+
add('C5 a reader without standing is refused', false, 'not exercised — no stranger view of this binding was given', 'SHOULD');
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
add('C5 access', false, e instanceof Error ? e.message : String(e));
|
|
122
|
+
}
|
|
123
|
+
// C6 — the rollup rebuilds to the same numbers.
|
|
124
|
+
try {
|
|
125
|
+
const rollup = opts.rollup ?? memoryRollup();
|
|
126
|
+
const facts = [{ runRef: CONFORMANCE_RUN.runRef, agent: AGENT, endedAt: CONFORMANCE_RUN.endedAt, variantDigest: CONFORMANCE_RUN.variant.digest, skillContracts: ['skill:people/members'], capabilities: ['planner/model'], measurements }];
|
|
127
|
+
await rollup.clear();
|
|
128
|
+
for (const f of facts)
|
|
129
|
+
await rollup.add(f);
|
|
130
|
+
const r = await rollupRebuildsEqual(rollup, facts);
|
|
131
|
+
add(`C6 rollup (${rollup.binding}) rebuilds to the same numbers`, r.equal, `${r.live} rows live, ${r.rebuilt} rebuilt`);
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
add('C6 rollup', false, e instanceof Error ? e.message : String(e));
|
|
135
|
+
}
|
|
136
|
+
return { target: opts.target ?? store.binding, ok: checks.every((c) => c.ok || c.level !== 'MUST'), checks };
|
|
137
|
+
}
|
|
138
|
+
/** The devkit entry (`ap conform provenance <target>`): `file:<dir>` (a directory store; a temp dir when empty) or `memory:`. */
|
|
139
|
+
export async function conformProvenance(target) {
|
|
140
|
+
if (target.startsWith('file:')) {
|
|
141
|
+
const dir = target.slice('file:'.length) || (await mkdtemp(join(tmpdir(), 'ap-conform-')));
|
|
142
|
+
return runProvenanceConformance(fileProvenanceStore(dir), { stranger: fileProvenanceStore(dir, { reader: '0x' + '99'.repeat(20) }), target: `file:${dir}` });
|
|
143
|
+
}
|
|
144
|
+
if (target === 'memory:' || target === 'memory') {
|
|
145
|
+
const m = new Map();
|
|
146
|
+
const store = { binding: 'memory', async put(ref, d) { m.set(`${ref.agent}|${ref.key}`, structuredClone(d)); return { ok: true }; }, async get(ref) { const d = m.get(`${ref.agent}|${ref.key}`); return d ? { status: 'found', document: structuredClone(d) } : { status: 'absent' }; } };
|
|
147
|
+
return runProvenanceConformance(store, { target: 'memory:' });
|
|
148
|
+
}
|
|
149
|
+
return { target, ok: false, checks: [{ id: 'target', level: 'MUST', ok: false, detail: 'a provenance target is file:<dir> or memory: — a vault is conformed from its own runtime (runProvenanceConformance)' }] };
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=conform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conform.js","sourceRoot":"","sources":["../src/conform.ts"],"names":[],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IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChT,OAAO,wBAAwB,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,qHAAqH,EAAE,CAAC,EAAE,CAAC;AACpN,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProvenanceStorePort } from '@agenticprimitives/provenance';
|
|
2
|
+
export interface FileStoreOptions {
|
|
3
|
+
/** Who is reading (an agent address). Absent ⇒ the operator of the directory (no standing check). */
|
|
4
|
+
reader?: string;
|
|
5
|
+
/** Agents the reader stewards — may read their records too. */
|
|
6
|
+
stewards?: Record<string, readonly string[]>;
|
|
7
|
+
}
|
|
8
|
+
export declare function fileProvenanceStore(dir: string, opts?: FileStoreOptions): ProvenanceStorePort;
|
|
9
|
+
//# sourceMappingURL=file-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-store.d.ts","sourceRoot":"","sources":["../src/file-store.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAC/B,qGAAqG;IACrG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;CAC9C;AAID,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,mBAAmB,CA4BjG"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// A DIRECTORY OF .jsonld FILES as a `ProvenanceStorePort` (spec 414 §5; 415 §7 — the eval store's first binding). One
|
|
2
|
+
// file per record: `<dir>/<agent>/<key>.jsonld`. Readable only by the agent itself or a named steward when a reader is
|
|
3
|
+
// given — a stranger is REFUSED, never served empty (conformance C5, ADR-0013). Node-side.
|
|
4
|
+
import { mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
const safe = (s) => encodeURIComponent(s);
|
|
7
|
+
export function fileProvenanceStore(dir, opts = {}) {
|
|
8
|
+
const standing = (agent) => !opts.reader || opts.reader.toLowerCase() === agent.toLowerCase() || (opts.stewards?.[opts.reader.toLowerCase()] ?? []).map((a) => a.toLowerCase()).includes(agent.toLowerCase());
|
|
9
|
+
const pathOf = (agent, key) => join(dir, safe(agent.toLowerCase()), `${safe(key)}.jsonld`);
|
|
10
|
+
return {
|
|
11
|
+
binding: 'file',
|
|
12
|
+
async put(ref, document) {
|
|
13
|
+
try {
|
|
14
|
+
await mkdir(join(dir, safe(ref.agent.toLowerCase())), { recursive: true });
|
|
15
|
+
await writeFile(pathOf(ref.agent, ref.key), `${JSON.stringify(document, null, 2)}\n`);
|
|
16
|
+
return { ok: true };
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
async get(ref) {
|
|
23
|
+
if (!standing(ref.agent))
|
|
24
|
+
return { status: 'refused', reason: 'the reader has no standing on this agent\'s records' };
|
|
25
|
+
try {
|
|
26
|
+
return { status: 'found', document: JSON.parse(await readFile(pathOf(ref.agent, ref.key), 'utf8')) };
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
return e.code === 'ENOENT' ? { status: 'absent' } : { status: 'refused', reason: e instanceof Error ? e.message : String(e) };
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
async list(agent, selector) {
|
|
33
|
+
if (!standing(agent))
|
|
34
|
+
return { refused: 'the reader has no standing on this agent\'s records' };
|
|
35
|
+
let names = [];
|
|
36
|
+
try {
|
|
37
|
+
names = await readdir(join(dir, safe(agent.toLowerCase())));
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
if (e.code !== 'ENOENT')
|
|
41
|
+
return { refused: e instanceof Error ? e.message : String(e) };
|
|
42
|
+
}
|
|
43
|
+
const keys = names.filter((n) => n.endsWith('.jsonld')).map((n) => decodeURIComponent(n.slice(0, -'.jsonld'.length))).filter((k) => k.startsWith(selector.keyPrefix)).sort();
|
|
44
|
+
const from = selector.after ? keys.findIndex((k) => k > selector.after) : 0;
|
|
45
|
+
const page = keys.slice(from < 0 ? keys.length : from, (from < 0 ? keys.length : from) + (selector.limit ?? 100));
|
|
46
|
+
const next = keys.length > (from < 0 ? keys.length : from) + page.length ? page[page.length - 1] : undefined;
|
|
47
|
+
return { keys: page, ...(next ? { next } : {}) };
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=file-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-store.js","sourceRoot":"","sources":["../src/file-store.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,uHAAuH;AACvH,2FAA2F;AAC3F,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,IAAI,EA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AM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC7G,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QACnD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const PACKAGE_NAME: "@agenticprimitives/provenance-node";
|
|
2
|
+
export declare const SPEC_REF: "specs/414-tracing-as-the-record-and-skill-effectiveness.md";
|
|
3
|
+
export { rdfcCanonicalizer, quadsOf, toTurtle } from './rdfc.js';
|
|
4
|
+
export { validateQuads, declaredTerms, type ShaclResultV1 } from './shacl.js';
|
|
5
|
+
export { fileProvenanceStore, type FileStoreOptions } from './file-store.js';
|
|
6
|
+
export { runProvenanceConformance, conformProvenance, CONFORMANCE_RUN, type RunConformanceOptions, type ConformanceReport, type ConformanceCheck } from './conform.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,EAAG,oCAA6C,CAAC;AAC1E,eAAO,MAAM,QAAQ,EAAG,4DAAqE,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,eAAe,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @agenticprimitives/provenance-node — the Node-side reference bindings of the provenance ports (spec 414 §5, A2d).
|
|
2
|
+
// The ports and the digest live in the zero-dependency `@agenticprimitives/provenance`; this package fills them with a
|
|
3
|
+
// stock RDF stack (RDFC-1.0, SHACL, Turtle) and a directory store, and carries the conformance suite every binding —
|
|
4
|
+
// the vault included — is run through (`./conform`, `ap conform provenance`). Node only: a Worker carries none of it.
|
|
5
|
+
export const PACKAGE_NAME = '@agenticprimitives/provenance-node';
|
|
6
|
+
export const SPEC_REF = 'specs/414-tracing-as-the-record-and-skill-effectiveness.md';
|
|
7
|
+
export { rdfcCanonicalizer, quadsOf, toTurtle } from './rdfc.js';
|
|
8
|
+
export { validateQuads, declaredTerms } from './shacl.js';
|
|
9
|
+
export { fileProvenanceStore } from './file-store.js';
|
|
10
|
+
export { runProvenanceConformance, conformProvenance, CONFORMANCE_RUN } from './conform.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,uHAAuH;AACvH,qHAAqH;AACrH,sHAAsH;AACtH,MAAM,CAAC,MAAM,YAAY,GAAG,oCAA6C,CAAC;AAC1E,MAAM,CAAC,MAAM,QAAQ,GAAG,4DAAqE,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAsB,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAyB,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,eAAe,EAA6E,MAAM,cAAc,CAAC"}
|
package/dist/rdfc.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RdfCanonicalizer } from '@agenticprimitives/provenance';
|
|
2
|
+
/** W3C RDFC-1.0 over a JSON-LD document. */
|
|
3
|
+
export declare const rdfcCanonicalizer: RdfCanonicalizer;
|
|
4
|
+
/** The document's quads, structurally (for a validator or a graph engine). */
|
|
5
|
+
export declare function quadsOf(document: Record<string, unknown>): Promise<Array<{
|
|
6
|
+
subject: {
|
|
7
|
+
termType: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
predicate: {
|
|
11
|
+
termType: string;
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
object: {
|
|
15
|
+
termType: string;
|
|
16
|
+
value: string;
|
|
17
|
+
};
|
|
18
|
+
}>>;
|
|
19
|
+
/** The same graph as Turtle — the third serialization PROV-AQ content negotiation offers (414 §5). */
|
|
20
|
+
export declare function toTurtle(document: Record<string, unknown>): Promise<string>;
|
|
21
|
+
//# sourceMappingURL=rdfc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rdfc.d.ts","sourceRoot":"","sources":["../src/rdfc.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAUtE,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,EAAE,gBAAyG,CAAC;AAE1I,8EAA8E;AAC9E,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;IAAE,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,SAAS,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,CAAC,CAE9N;AAED,sGAAsG;AACtG,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAOjF"}
|
package/dist/rdfc.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// THE RDFC-1.0 BINDING (spec 414 §2 rule 3). A JSON-LD document → its canonical N-Quads, by a stock RDF stack
|
|
2
|
+
// (@zazuko/env-node: a JSON-LD parser and rdf-ext's canonical form, which is URDNA2015 = W3C RDFC-1.0's output). The
|
|
3
|
+
// provenance package names the seam (`RdfCanonicalizer`) and hashes; this fills it. Node-side: a Worker does not carry it.
|
|
4
|
+
import { Readable } from 'node:stream';
|
|
5
|
+
import rdf from '@zazuko/env-node';
|
|
6
|
+
const TURTLE = 'text/turtle';
|
|
7
|
+
const JSON_LD = 'application/ld+json';
|
|
8
|
+
async function datasetOf(mediaType, text) {
|
|
9
|
+
const quads = rdf.formats.parsers.import(mediaType, Readable.from([text]));
|
|
10
|
+
if (!quads)
|
|
11
|
+
throw new Error(`no parser for ${mediaType}`);
|
|
12
|
+
return rdf.dataset().import(quads);
|
|
13
|
+
}
|
|
14
|
+
/** W3C RDFC-1.0 over a JSON-LD document. */
|
|
15
|
+
export const rdfcCanonicalizer = async (document) => (await datasetOf(JSON_LD, JSON.stringify(document))).toCanonical();
|
|
16
|
+
/** The document's quads, structurally (for a validator or a graph engine). */
|
|
17
|
+
export async function quadsOf(document) {
|
|
18
|
+
return [...(await datasetOf(JSON_LD, JSON.stringify(document)))];
|
|
19
|
+
}
|
|
20
|
+
/** The same graph as Turtle — the third serialization PROV-AQ content negotiation offers (414 §5). */
|
|
21
|
+
export async function toTurtle(document) {
|
|
22
|
+
const ds = await datasetOf(JSON_LD, JSON.stringify(document));
|
|
23
|
+
const out = rdf.formats.serializers.import(TURTLE, ds.toStream());
|
|
24
|
+
if (!out)
|
|
25
|
+
throw new Error('no turtle serializer');
|
|
26
|
+
let text = '';
|
|
27
|
+
for await (const chunk of out)
|
|
28
|
+
text += String(chunk);
|
|
29
|
+
return text;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=rdfc.js.map
|
package/dist/rdfc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rdfc.js","sourceRoot":"","sources":["../src/rdfc.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,qHAAqH;AACrH,2HAA2H;AAC3H,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,GAAG,MAAM,kBAAkB,CAAC;AAEnC,MAAM,MAAM,GAAG,aAAa,CAAC;AAC7B,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAEtC,KAAK,UAAU,SAAS,CAAC,SAAiB,EAAE,IAAY;IACtD,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3E,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,SAAS,EAAE,CAAC,CAAC;IAC1D,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAED,4CAA4C;AAC5C,MAAM,CAAC,MAAM,iBAAiB,GAAqB,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,MAAM,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAE1I,8EAA8E;AAC9E,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,QAAiC;IAC7D,OAAO,CAAC,GAAG,CAAC,MAAM,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAU,CAAC;AAC5E,CAAC;AAED,sGAAsG;AACtG,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,QAAiC;IAC9D,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9D,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAClD,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,GAAgD;QAAE,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAClG,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/shacl.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Every IRI the shipped T-box declares (a subject with an rdf:type). */
|
|
2
|
+
export declare function declaredTerms(): Promise<Set<string>>;
|
|
3
|
+
export interface ShaclResultV1 {
|
|
4
|
+
conforms: boolean;
|
|
5
|
+
messages: string[];
|
|
6
|
+
}
|
|
7
|
+
/** Validate a record's quads against one published shapes file (`cbox/run-provenance-shapes.shacl.ttl`, …). */
|
|
8
|
+
export declare function validateQuads(shapesRel: string, quads: Iterable<unknown>): Promise<ShaclResultV1>;
|
|
9
|
+
//# sourceMappingURL=shacl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shacl.d.ts","sourceRoot":"","sources":["../src/shacl.ts"],"names":[],"mappings":"AA8BA,yEAAyE;AACzE,wBAAsB,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAI1D;AAED,MAAM,WAAW,aAAa;IAAG,QAAQ,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE;AAIxE,+GAA+G;AAC/G,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAWvG"}
|
package/dist/shacl.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// SHACL VALIDATION over the published run shapes (spec 389 R1–R6, 414 R7–R11, M1–M3), with the SHIPPED T-box and the
|
|
2
|
+
// codelists as the data graph's context and the rdfs:subClassOf* closure materialized (shacl-engine does not compute
|
|
3
|
+
// SHACL-instance-of; without the closure a shape targeting a superclass matches nothing and passes by not looking).
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
import { Readable } from 'node:stream';
|
|
6
|
+
import rdf from '@zazuko/env-node';
|
|
7
|
+
import { Validator } from 'shacl-engine';
|
|
8
|
+
import { targetResolvers, validations } from 'shacl-engine/sparql.js';
|
|
9
|
+
import { ARTIFACTS, artifactPath } from '@agenticprimitives/ontology/artifacts';
|
|
10
|
+
const TURTLE = 'text/turtle';
|
|
11
|
+
const JSON_LD = 'application/ld+json';
|
|
12
|
+
const RDF_TYPE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';
|
|
13
|
+
const SUBCLASS_OF = 'http://www.w3.org/2000/01/rdf-schema#subClassOf';
|
|
14
|
+
const CODELISTS = ['cbox/controlled-vocabularies.ttl', 'cbox/registry-vocabulary.ttl'];
|
|
15
|
+
async function turtle(ttl) {
|
|
16
|
+
const q = rdf.formats.parsers.import(TURTLE, Readable.from([ttl]));
|
|
17
|
+
if (!q)
|
|
18
|
+
throw new Error('no turtle parser');
|
|
19
|
+
return rdf.dataset().import(q);
|
|
20
|
+
}
|
|
21
|
+
let tboxCache;
|
|
22
|
+
async function tbox() {
|
|
23
|
+
if (tboxCache)
|
|
24
|
+
return tboxCache;
|
|
25
|
+
const ttl = [...ARTIFACTS.tbox, ...CODELISTS].map((rel) => readFileSync(artifactPath(rel), 'utf8')).join('\n');
|
|
26
|
+
tboxCache = [...(await turtle(ttl))];
|
|
27
|
+
return tboxCache;
|
|
28
|
+
}
|
|
29
|
+
/** Every IRI the shipped T-box declares (a subject with an rdf:type). */
|
|
30
|
+
export async function declaredTerms() {
|
|
31
|
+
const out = new Set();
|
|
32
|
+
for (const q of (await tbox()))
|
|
33
|
+
if (q.subject.termType === 'NamedNode' && q.predicate.value === RDF_TYPE)
|
|
34
|
+
out.add(q.subject.value);
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
/** Validate a record's quads against one published shapes file (`cbox/run-provenance-shapes.shacl.ttl`, …). */
|
|
38
|
+
export async function validateQuads(shapesRel, quads) {
|
|
39
|
+
const validator = new Validator(await turtle(readFileSync(artifactPath(shapesRel), 'utf8')), { factory: rdf, targetResolvers, validations });
|
|
40
|
+
const data = rdf.dataset();
|
|
41
|
+
for (const q of await tbox())
|
|
42
|
+
data.add(q);
|
|
43
|
+
for (const q of quads) {
|
|
44
|
+
const x = q;
|
|
45
|
+
data.add(rdf.quad(x.subject, x.predicate, x.object));
|
|
46
|
+
}
|
|
47
|
+
const parents = new Map();
|
|
48
|
+
for (const q of data)
|
|
49
|
+
if (q.predicate.value === SUBCLASS_OF)
|
|
50
|
+
parents.set(q.subject.value, [...(parents.get(q.subject.value) ?? []), q.object.value]);
|
|
51
|
+
const ancestors = (c, seen = new Set()) => { for (const p of parents.get(c) ?? [])
|
|
52
|
+
if (!seen.has(p)) {
|
|
53
|
+
seen.add(p);
|
|
54
|
+
ancestors(p, seen);
|
|
55
|
+
} return [...seen]; };
|
|
56
|
+
for (const q of [...data])
|
|
57
|
+
if (q.predicate.value === RDF_TYPE)
|
|
58
|
+
for (const a of ancestors(q.object.value))
|
|
59
|
+
data.add(rdf.quad(q.subject, q.predicate, rdf.namedNode(a)));
|
|
60
|
+
const r = await validator.validate({ dataset: data });
|
|
61
|
+
return { conforms: r.conforms, messages: r.results.flatMap((x) => (Array.isArray(x.message) ? x.message.map((m) => m.value) : [])) };
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=shacl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shacl.js","sourceRoot":"","sources":["../src/shacl.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,qHAAqH;AACrH,oHAAoH;AACpH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,GAAG,MAAM,kBAAkB,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAChF,MAAM,MAAM,GAAG,aAAa,CAAC;AAC7B,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAEtC,MAAM,QAAQ,GAAG,iDAAiD,CAAC;AACnE,MAAM,WAAW,GAAG,iDAAiD,CAAC;AACtE,MAAM,SAAS,GAAG,CAAC,kCAAkC,EAAE,8BAA8B,CAAU,CAAC;AAEhG,KAAK,UAAU,MAAM,CAAC,GAAW;IAC/B,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC5C,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,IAAI,SAAgC,CAAC;AACrC,KAAK,UAAU,IAAI;IACjB,IAAI,SAAS;QAAE,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AC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1M,MAAM,CAAC,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACvI,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agenticprimitives/provenance-node",
|
|
3
|
+
"version": "0.0.0-alpha.1",
|
|
4
|
+
"description": "Node-side reference bindings of the provenance ports (spec 414 §5): the W3C RDFC-1.0 canonicalizer, SHACL validation over the published run shapes, a directory store, and the `ap conform provenance` suite (C1–C6) any binding is run through.",
|
|
5
|
+
"homepage": "https://agenticprimitives.dev",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
|
|
8
|
+
},
|
|
9
|
+
"author": {
|
|
10
|
+
"name": "Agentic Trust Labs",
|
|
11
|
+
"url": "https://agenticprimitives.dev"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/agentictrustlabs/agenticprimitives.git",
|
|
17
|
+
"directory": "packages/provenance-node"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./conform": {
|
|
28
|
+
"types": "./dist/conform.d.ts",
|
|
29
|
+
"import": "./dist/conform.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"dist",
|
|
35
|
+
"spec.md",
|
|
36
|
+
"README.md"
|
|
37
|
+
],
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@zazuko/env-node": "^2.1.1",
|
|
40
|
+
"shacl-engine": "^1.1.2",
|
|
41
|
+
"@agenticprimitives/evaluation": "0.0.0-alpha.4",
|
|
42
|
+
"@agenticprimitives/ontology": "1.0.0-alpha.26",
|
|
43
|
+
"@agenticprimitives/provenance": "0.0.0-alpha.4"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^22.7.0",
|
|
47
|
+
"vitest": "^4.1.8"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"agentic",
|
|
54
|
+
"primitives",
|
|
55
|
+
"provenance",
|
|
56
|
+
"prov-o",
|
|
57
|
+
"rdfc",
|
|
58
|
+
"shacl",
|
|
59
|
+
"conformance",
|
|
60
|
+
"agenticprimitives"
|
|
61
|
+
],
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsc -p tsconfig.build.json",
|
|
64
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"test:unit": "vitest run test/unit --passWithNoTests",
|
|
67
|
+
"clean": "rm -rf dist"
|
|
68
|
+
}
|
|
69
|
+
}
|
package/spec.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @agenticprimitives/provenance-node — package spec
|
|
2
|
+
|
|
3
|
+
Spec of record: [specs/414-tracing-as-the-record-and-skill-effectiveness.md](../../specs/414-tracing-as-the-record-and-skill-effectiveness.md)
|
|
4
|
+
§5 (ports and bindings) and §6 (conformance), sequenced by [specs/415-skills-assessment-program.md](../../specs/415-skills-assessment-program.md) A2d.
|
|
5
|
+
|
|
6
|
+
Owns the Node-side reference bindings (RDFC-1.0, SHACL, a directory store) and the conformance suite C1–C6. Does not own
|
|
7
|
+
the ports or the digest (`provenance`), the shapes or the T-box (`ontology`), or the measurements and rollup (`evaluation`).
|