@zanii/constitution 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -60,3 +60,7 @@ The stamp proves an action was *recorded as governed* — act-time **enforcement
60
60
  required approval so the auditor can demand the confirmations. An agent holding raw
61
61
  credentials can still act off the rails entirely — credential custody, unchanged. A
62
62
  constitution binds only when the verifier demands the stamp.
63
+
64
+ ## Changelog
65
+
66
+ - **0.1.2** — Governing the rulebook: `draftRulesFromText` (a model drafts, strict validation, a person signs), `constitutionDiff`, quorum amendments (`proposeAmendment` / `approveAmendment` / `amendmentApproved`), `TEMPLATES` (EU AI Act prohibited practices, HIPAA minimum necessary, financial communications), `simulate`, `conflictCheck` across layered rulebooks, verifiable `violationProof`s, `.well-known` publishing, `explainDecision`, and sunset clauses (`evaluateAt`, `expiringRules`).
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Governing the rulebook itself: drafting rules from plain language (reviewed, never
3
+ * trusted blindly), diffs, amendments that need several approvals, templates for common
4
+ * regimes, simulation against history, conflicts between layered rulebooks, shareable
5
+ * violation proofs, publishing at a well-known URL, plain-language explanations and rules
6
+ * that expire.
7
+ */
8
+ import { type Receipt, type SignedObject } from '@zanii/core';
9
+ import { type Constitution, type ConstitutionInput, type Rule, type RuleEffect } from './index.js';
10
+ /**
11
+ * Turn a written policy into draft rules with a model you supply. The output is validated
12
+ * strictly and bound to the source text's hash; a person must still review and sign it.
13
+ */
14
+ export declare function draftRulesFromText(text: string, llm: (prompt: string) => Promise<string>): Promise<{
15
+ rules: Rule[];
16
+ sourceHash: string;
17
+ issues: string[];
18
+ }>;
19
+ /** What changed between two rulebooks, rule by rule. */
20
+ export declare function constitutionDiff(a: Constitution, b: Constitution): {
21
+ added: string[];
22
+ removed: string[];
23
+ changed: string[];
24
+ reordered: boolean;
25
+ defaultChanged: boolean;
26
+ };
27
+ export type AmendmentApproval = SignedObject<{
28
+ v: 1;
29
+ type: 'constitution.approval';
30
+ proposal: string;
31
+ ts: string;
32
+ }>;
33
+ /** Propose a new rulebook. Its hash is what approvers sign. */
34
+ export declare function proposeAmendment(current: Constitution, next: Omit<ConstitutionInput, 'issuer'>): {
35
+ proposal: {
36
+ v: 1;
37
+ type: "constitution.proposal";
38
+ replaces: string;
39
+ next: Omit<ConstitutionInput, "issuer">;
40
+ };
41
+ hash: string;
42
+ };
43
+ export declare function approveAmendment(proposalHash: string, approverPrivateKey: Uint8Array, ts?: string): AmendmentApproval;
44
+ /** Enough distinct, authorised approvers signed this exact proposal. */
45
+ export declare function amendmentApproved(proposalHash: string, approvals: AmendmentApproval[], opts: {
46
+ approvers: string[];
47
+ quorum: number;
48
+ }): {
49
+ approved: boolean;
50
+ signers: string[];
51
+ };
52
+ /** Starting rules for common regimes. Adapt the target names to your own action namespace. */
53
+ export declare const TEMPLATES: Record<string, Rule[]>;
54
+ /** Replay recorded actions (or targets) against a rulebook: what would have been forbidden or held. */
55
+ export declare function simulate(c: Constitution, targets: string[]): {
56
+ counts: Record<RuleEffect, number>;
57
+ forbidden: {
58
+ target: string;
59
+ rule: string | null;
60
+ }[];
61
+ };
62
+ /** Rules in different rulebooks (organisation, department, agent) that overlap and disagree. */
63
+ export declare function conflictCheck(constitutions: Constitution[]): {
64
+ a: string;
65
+ ruleA: string;
66
+ b: string;
67
+ ruleB: string;
68
+ target: string;
69
+ }[];
70
+ /** A self-contained proof of one violation: the signed rulebook, the signed receipt, the rule it broke. */
71
+ export declare function violationProof(c: Constitution, receipt: Receipt): {
72
+ constitution: Constitution;
73
+ receipt: Receipt;
74
+ rule: string;
75
+ };
76
+ /** Anyone can check it: both signatures valid, the receipt was stamped with this rulebook, and the rule forbids it. */
77
+ export declare function verifyViolationProof(p: ReturnType<typeof violationProof>): boolean;
78
+ /** The document to serve at https://<domain>/.well-known/zanii-constitution.json. */
79
+ export declare function wellKnownDocument(c: Constitution): {
80
+ constitution: Constitution;
81
+ hash: string;
82
+ };
83
+ /** Fetch and verify a published rulebook. Returns null if absent or invalid. */
84
+ export declare function fetchPublicConstitution(domain: string, fetchImpl?: (u: string) => Promise<Response>): Promise<Constitution | null>;
85
+ /** Why this action is allowed, held or forbidden, in a sentence. */
86
+ export declare function explainDecision(c: Constitution, target: string): string;
87
+ /**
88
+ * Evaluate at a point in time, honouring optional `expires` on rules (a sunset clause). An
89
+ * expired rule no longer applies. `evaluate` itself is unchanged and ignores expiry.
90
+ */
91
+ export declare function evaluateAt(c: Constitution, target: string, at: string): import("./index.js").Evaluation;
92
+ /** Rules whose sunset falls within `withinMs` of `now`: renew or let them lapse deliberately. */
93
+ export declare function expiringRules(c: Constitution, now: string, withinMs: number): string[];
94
+ //# sourceMappingURL=governance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../src/governance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAuE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACnI,OAAO,EAAkD,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAInJ;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAkBjK;AAED,wDAAwD;AACxD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY;;;;;;EAWhE;AAED,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;IAAE,CAAC,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,uBAAuB,CAAC;IAAC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,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAmB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CASzJ;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMvE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,mCAGrE;AAED,iGAAiG;AACjG,wBAAgB,aAAa,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YAK3E"}
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Governing the rulebook itself: drafting rules from plain language (reviewed, never
3
+ * trusted blindly), diffs, amendments that need several approvals, templates for common
4
+ * regimes, simulation against history, conflicts between layered rulebooks, shareable
5
+ * violation proofs, publishing at a well-known URL, plain-language explanations and rules
6
+ * that expire.
7
+ */
8
+ import { jcsHash, scopeCovers, signObject, verifyReceipt, verifySignedObject } from '@zanii/core';
9
+ import { constitutionHash, evaluate, verifyConstitution } from './index.js';
10
+ const EFFECTS = ['forbid', 'require_approval', 'allow'];
11
+ /**
12
+ * Turn a written policy into draft rules with a model you supply. The output is validated
13
+ * strictly and bound to the source text's hash; a person must still review and sign it.
14
+ */
15
+ export async function draftRulesFromText(text, llm) {
16
+ const prompt = `Convert this policy into JSON: an array of rules {"id","effect":"forbid"|"require_approval"|"allow","targets":[scope patterns like "payments.*"],"note"}. Output only JSON.\n\n${text}`;
17
+ const raw = await llm(prompt);
18
+ const issues = [];
19
+ let parsed;
20
+ try {
21
+ parsed = JSON.parse(raw.replace(/^```(?:json)?\s*|\s*```$/g, ''));
22
+ }
23
+ catch {
24
+ return { rules: [], sourceHash: jcsHash({ text }), issues: ['the model did not return JSON'] };
25
+ }
26
+ const rules = [];
27
+ for (const [i, r] of (Array.isArray(parsed) ? parsed : []).entries()) {
28
+ const ok = r && typeof r.id === 'string' && EFFECTS.includes(r.effect) && Array.isArray(r.targets) && r.targets.length && r.targets.every((t) => typeof t === 'string' && /^[a-z0-9_*.-]+$/i.test(t));
29
+ if (ok)
30
+ rules.push({ id: r.id, effect: r.effect, targets: r.targets, ...(typeof r.note === 'string' ? { note: r.note } : {}) });
31
+ else
32
+ issues.push(`rule ${i} was malformed and dropped`);
33
+ }
34
+ if (!rules.length)
35
+ issues.push('no usable rules');
36
+ return { rules, sourceHash: jcsHash({ text }), issues };
37
+ }
38
+ /** What changed between two rulebooks, rule by rule. */
39
+ export function constitutionDiff(a, b) {
40
+ const byId = (c) => new Map(c.rules.map((r) => [r.id, r]));
41
+ const A = byId(a);
42
+ const B = byId(b);
43
+ return {
44
+ added: [...B.keys()].filter((k) => !A.has(k)),
45
+ removed: [...A.keys()].filter((k) => !B.has(k)),
46
+ changed: [...A.keys()].filter((k) => B.has(k) && jcsHash(A.get(k)) !== jcsHash(B.get(k))),
47
+ reordered: a.rules.map((r) => r.id).filter((id) => B.has(id)).join() !== b.rules.map((r) => r.id).filter((id) => A.has(id)).join(),
48
+ defaultChanged: a.default !== b.default,
49
+ };
50
+ }
51
+ /** Propose a new rulebook. Its hash is what approvers sign. */
52
+ export function proposeAmendment(current, next) {
53
+ const proposal = { v: 1, type: 'constitution.proposal', replaces: constitutionHash(current), next };
54
+ return { proposal, hash: jcsHash(proposal) };
55
+ }
56
+ export function approveAmendment(proposalHash, approverPrivateKey, ts = new Date().toISOString()) {
57
+ return signObject({ v: 1, type: 'constitution.approval', proposal: proposalHash, ts }, approverPrivateKey);
58
+ }
59
+ /** Enough distinct, authorised approvers signed this exact proposal. */
60
+ export function amendmentApproved(proposalHash, approvals, opts) {
61
+ const valid = new Set(approvals.filter((a) => verifySignedObject(a) && a.proposal === proposalHash && opts.approvers.includes(a.signer)).map((a) => a.signer));
62
+ return { approved: valid.size >= opts.quorum, signers: [...valid] };
63
+ }
64
+ /** Starting rules for common regimes. Adapt the target names to your own action namespace. */
65
+ export const TEMPLATES = {
66
+ 'eu-ai-act-prohibited': [
67
+ { id: 'no-social-scoring', effect: 'forbid', targets: ['scoring.social.*'], note: 'AI Act Art. 5(1)(c)' },
68
+ { id: 'no-untargeted-face-scraping', effect: 'forbid', targets: ['biometric.face.scrape*'], note: 'AI Act Art. 5(1)(e)' },
69
+ { id: 'no-emotion-recognition-work-school', effect: 'forbid', targets: ['emotion.recognition.workplace', 'emotion.recognition.education'], note: 'AI Act Art. 5(1)(f)' },
70
+ { id: 'no-sensitive-biometric-categorisation', effect: 'forbid', targets: ['biometric.categorise.sensitive*'], note: 'AI Act Art. 5(1)(g)' },
71
+ ],
72
+ 'hipaa-minimum-necessary': [
73
+ { id: 'phi-export-needs-approval', effect: 'require_approval', targets: ['phi.export*', 'phi.share*'], note: 'HIPAA minimum necessary standard' },
74
+ { id: 'phi-bulk-read-forbidden', effect: 'forbid', targets: ['phi.read.bulk'], note: 'reads must be per-patient' },
75
+ ],
76
+ 'financial-communications': [
77
+ { id: 'client-comms-reviewed', effect: 'require_approval', targets: ['comms.client.*'], note: 'principal review of client communications' },
78
+ { id: 'no-guarantees', effect: 'forbid', targets: ['comms.client.guarantee*'], note: 'no promises of returns' },
79
+ ],
80
+ };
81
+ /** Replay recorded actions (or targets) against a rulebook: what would have been forbidden or held. */
82
+ export function simulate(c, targets) {
83
+ const counts = { forbid: 0, require_approval: 0, allow: 0 };
84
+ const forbidden = [];
85
+ for (const t of targets) {
86
+ const e = evaluate(c, t);
87
+ counts[e.effect]++;
88
+ if (e.effect === 'forbid')
89
+ forbidden.push({ target: t, rule: e.rule?.id ?? null });
90
+ }
91
+ return { counts, forbidden };
92
+ }
93
+ /** Rules in different rulebooks (organisation, department, agent) that overlap and disagree. */
94
+ export function conflictCheck(constitutions) {
95
+ const out = [];
96
+ for (let i = 0; i < constitutions.length; i++)
97
+ for (let j = i + 1; j < constitutions.length; j++) {
98
+ for (const ra of constitutions[i].rules)
99
+ for (const rb of constitutions[j].rules) {
100
+ if (ra.effect === rb.effect)
101
+ continue;
102
+ for (const ta of ra.targets)
103
+ for (const tb of rb.targets) {
104
+ if (scopeCovers(ta, tb.replace(/\*$/, 'x')) || scopeCovers(tb, ta.replace(/\*$/, 'x'))) {
105
+ out.push({ a: constitutions[i].name, ruleA: ra.id, b: constitutions[j].name, ruleB: rb.id, target: ta.length >= tb.length ? ta : tb });
106
+ }
107
+ }
108
+ }
109
+ }
110
+ return out;
111
+ }
112
+ /** A self-contained proof of one violation: the signed rulebook, the signed receipt, the rule it broke. */
113
+ export function violationProof(c, receipt) {
114
+ const e = evaluate(c, receipt.target);
115
+ if (e.effect !== 'forbid')
116
+ throw new Error('constitution: this action is not forbidden by the rulebook');
117
+ return { constitution: c, receipt, rule: e.rule?.id ?? '(default)' };
118
+ }
119
+ /** Anyone can check it: both signatures valid, the receipt was stamped with this rulebook, and the rule forbids it. */
120
+ export function verifyViolationProof(p) {
121
+ return verifyConstitution(p.constitution) && verifyReceipt(p.receipt).ok && p.receipt.manifest_hash === constitutionHash(p.constitution) &&
122
+ evaluate(p.constitution, p.receipt.target).effect === 'forbid';
123
+ }
124
+ /** The document to serve at https://<domain>/.well-known/zanii-constitution.json. */
125
+ export function wellKnownDocument(c) {
126
+ return { constitution: c, hash: constitutionHash(c) };
127
+ }
128
+ /** Fetch and verify a published rulebook. Returns null if absent or invalid. */
129
+ export async function fetchPublicConstitution(domain, fetchImpl = (u) => fetch(u)) {
130
+ try {
131
+ const res = await fetchImpl(`https://${domain}/.well-known/zanii-constitution.json`);
132
+ if (!res.ok)
133
+ return null;
134
+ const doc = (await res.json());
135
+ return verifyConstitution(doc.constitution) && constitutionHash(doc.constitution) === doc.hash ? doc.constitution : null;
136
+ }
137
+ catch {
138
+ return null;
139
+ }
140
+ }
141
+ /** Why this action is allowed, held or forbidden, in a sentence. */
142
+ export function explainDecision(c, target) {
143
+ const e = evaluate(c, target);
144
+ const verb = { forbid: 'is forbidden', require_approval: 'needs human approval', allow: 'is allowed' }[e.effect];
145
+ return e.rule
146
+ ? `${target} ${verb} by rule "${e.rule.id}" of "${c.name}"${e.rule.note ? ` (${e.rule.note})` : ''}.`
147
+ : `${target} ${verb}: no rule in "${c.name}" covers it, so the default applies.`;
148
+ }
149
+ /**
150
+ * Evaluate at a point in time, honouring optional `expires` on rules (a sunset clause). An
151
+ * expired rule no longer applies. `evaluate` itself is unchanged and ignores expiry.
152
+ */
153
+ export function evaluateAt(c, target, at) {
154
+ const live = { ...c, rules: c.rules.filter((r) => !r.expires || at < r.expires) };
155
+ return evaluate(live, target);
156
+ }
157
+ /** Rules whose sunset falls within `withinMs` of `now`: renew or let them lapse deliberately. */
158
+ export function expiringRules(c, now, withinMs) {
159
+ return c.rules.filter((r) => {
160
+ const exp = r.expires;
161
+ return exp && Date.parse(exp) - Date.parse(now) <= withinMs && exp > now;
162
+ }).map((r) => r.id);
163
+ }
164
+ //# sourceMappingURL=governance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance.js","sourceRoot":"","sources":["../src/governance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,kBAAkB,EAAmC,MAAM,aAAa,CAAC;AACnI,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,kBAAkB,EAAyE,MAAM,YAAY,CAAC;AAEnJ,MAAM,OAAO,GAAiB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAY,EAAE,GAAwC;IAC7F,MAAM,MAAM,GAAG,kLAAkL,IAAI,EAAE,CAAC;IACxM,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG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AAC,KAAK,CAAC,GAAG,CAAC,IAAI,QAAQ,IAAI,GAAG,GAAG,GAAG,CAAC;IAC3E,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -90,4 +90,5 @@ export interface GovernanceTrail {
90
90
  * Pass receipts in ledger (ts) order.
91
91
  */
92
92
  export declare function governanceTrail(receipts: Receipt[]): GovernanceTrail;
93
+ export * from './governance.js';
93
94
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgCA,OAAO,EAA0D,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnG,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,kBAAkB,GAAG,OAAO,CAAC;AAEjE,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,CAAC;IACnB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,CAAC,CAAC;IACL,IAAI,EAAE,cAAc,CAAC;IACrB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,sFAAsF;IACtF,OAAO,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,wEAAwE;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AAM,EAAE,MAAM,CAAC,CAAC;IAC/B,+EAA+E;IAC/E,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,eAAe,CAepE;AACD,cAAc,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -159,4 +159,5 @@ export function governanceTrail(receipts) {
159
159
  }
160
160
  return { manifests: order, counts, interleaved, unstamped };
161
161
  }
162
+ export * from './governance.js';
162
163
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AAoCnG,uDAAuD;AACvD,MAAM,UAAU,kBAAkB,CAAC,KAAwB,EAAE,gBAA4B;IACvF,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACzD,IAAI,CAAC,KAAK,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACrD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC7F,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,CAAC,CAAC,CAAC,EAAE;YAAE,MAAM,I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version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Machine-checkable behavioral constraints as signed policy - publish an agent's rules (forbid / require_approval / allow over scope patterns), stamp the constitution hash on every receipt via the existing manifest_hash field, then PROVE each action was governed: a forbidden action with the stamp is a provable violation, and a rulebook change mid-stream is visible. Generalizes the fta/sca walls into a framework.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://ledger.zanii.agency",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@noble/curves": "^1.8.1",
35
35
  "@noble/hashes": "^1.7.1",
36
- "@zanii/core": "^0.5.2"
36
+ "@zanii/core": "^0.5.4"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsc -p tsconfig.build.json",
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Governing the rulebook itself: drafting rules from plain language (reviewed, never
3
+ * trusted blindly), diffs, amendments that need several approvals, templates for common
4
+ * regimes, simulation against history, conflicts between layered rulebooks, shareable
5
+ * violation proofs, publishing at a well-known URL, plain-language explanations and rules
6
+ * that expire.
7
+ */
8
+ import { jcsHash, scopeCovers, signObject, verifyReceipt, verifySignedObject, type Receipt, type SignedObject } from '@zanii/core';
9
+ import { constitutionHash, evaluate, verifyConstitution, type Constitution, type ConstitutionInput, type Rule, type RuleEffect } from './index.js';
10
+
11
+ const EFFECTS: RuleEffect[] = ['forbid', 'require_approval', 'allow'];
12
+
13
+ /**
14
+ * Turn a written policy into draft rules with a model you supply. The output is validated
15
+ * strictly and bound to the source text's hash; a person must still review and sign it.
16
+ */
17
+ export async function draftRulesFromText(text: string, llm: (prompt: string) => Promise<string>): Promise<{ rules: Rule[]; sourceHash: string; issues: string[] }> {
18
+ const prompt = `Convert this policy into JSON: an array of rules {"id","effect":"forbid"|"require_approval"|"allow","targets":[scope patterns like "payments.*"],"note"}. Output only JSON.\n\n${text}`;
19
+ const raw = await llm(prompt);
20
+ const issues: string[] = [];
21
+ let parsed: unknown;
22
+ try {
23
+ parsed = JSON.parse(raw.replace(/^```(?:json)?\s*|\s*```$/g, ''));
24
+ } catch {
25
+ return { rules: [], sourceHash: jcsHash({ text }), issues: ['the model did not return JSON'] };
26
+ }
27
+ const rules: Rule[] = [];
28
+ for (const [i, r] of (Array.isArray(parsed) ? parsed : []).entries()) {
29
+ const ok = r && typeof r.id === 'string' && EFFECTS.includes(r.effect) && Array.isArray(r.targets) && r.targets.length && r.targets.every((t: unknown) => typeof t === 'string' && /^[a-z0-9_*.-]+$/i.test(t));
30
+ if (ok) rules.push({ id: r.id, effect: r.effect, targets: r.targets, ...(typeof r.note === 'string' ? { note: r.note } : {}) });
31
+ else issues.push(`rule ${i} was malformed and dropped`);
32
+ }
33
+ if (!rules.length) issues.push('no usable rules');
34
+ return { rules, sourceHash: jcsHash({ text }), issues };
35
+ }
36
+
37
+ /** What changed between two rulebooks, rule by rule. */
38
+ export function constitutionDiff(a: Constitution, b: Constitution) {
39
+ const byId = (c: Constitution) => new Map(c.rules.map((r) => [r.id, r]));
40
+ const A = byId(a);
41
+ const B = byId(b);
42
+ return {
43
+ added: [...B.keys()].filter((k) => !A.has(k)),
44
+ removed: [...A.keys()].filter((k) => !B.has(k)),
45
+ changed: [...A.keys()].filter((k) => B.has(k) && jcsHash(A.get(k)!) !== jcsHash(B.get(k)!)),
46
+ reordered: a.rules.map((r) => r.id).filter((id) => B.has(id)).join() !== b.rules.map((r) => r.id).filter((id) => A.has(id)).join(),
47
+ defaultChanged: a.default !== b.default,
48
+ };
49
+ }
50
+
51
+ export type AmendmentApproval = SignedObject<{ v: 1; type: 'constitution.approval'; proposal: string; ts: string }>;
52
+
53
+ /** Propose a new rulebook. Its hash is what approvers sign. */
54
+ export function proposeAmendment(current: Constitution, next: Omit<ConstitutionInput, 'issuer'>) {
55
+ const proposal = { v: 1 as const, type: 'constitution.proposal' as const, replaces: constitutionHash(current), next };
56
+ return { proposal, hash: jcsHash(proposal) };
57
+ }
58
+
59
+ export function approveAmendment(proposalHash: string, approverPrivateKey: Uint8Array, ts = new Date().toISOString()): AmendmentApproval {
60
+ return signObject({ v: 1 as const, type: 'constitution.approval' as const, proposal: proposalHash, ts }, approverPrivateKey);
61
+ }
62
+
63
+ /** Enough distinct, authorised approvers signed this exact proposal. */
64
+ export function amendmentApproved(proposalHash: string, approvals: AmendmentApproval[], opts: { approvers: string[]; quorum: number }) {
65
+ const valid = new Set(approvals.filter((a) => verifySignedObject(a) && a.proposal === proposalHash && opts.approvers.includes(a.signer)).map((a) => a.signer));
66
+ return { approved: valid.size >= opts.quorum, signers: [...valid] };
67
+ }
68
+
69
+ /** Starting rules for common regimes. Adapt the target names to your own action namespace. */
70
+ export const TEMPLATES: Record<string, Rule[]> = {
71
+ 'eu-ai-act-prohibited': [
72
+ { id: 'no-social-scoring', effect: 'forbid', targets: ['scoring.social.*'], note: 'AI Act Art. 5(1)(c)' },
73
+ { id: 'no-untargeted-face-scraping', effect: 'forbid', targets: ['biometric.face.scrape*'], note: 'AI Act Art. 5(1)(e)' },
74
+ { id: 'no-emotion-recognition-work-school', effect: 'forbid', targets: ['emotion.recognition.workplace', 'emotion.recognition.education'], note: 'AI Act Art. 5(1)(f)' },
75
+ { id: 'no-sensitive-biometric-categorisation', effect: 'forbid', targets: ['biometric.categorise.sensitive*'], note: 'AI Act Art. 5(1)(g)' },
76
+ ],
77
+ 'hipaa-minimum-necessary': [
78
+ { id: 'phi-export-needs-approval', effect: 'require_approval', targets: ['phi.export*', 'phi.share*'], note: 'HIPAA minimum necessary standard' },
79
+ { id: 'phi-bulk-read-forbidden', effect: 'forbid', targets: ['phi.read.bulk'], note: 'reads must be per-patient' },
80
+ ],
81
+ 'financial-communications': [
82
+ { id: 'client-comms-reviewed', effect: 'require_approval', targets: ['comms.client.*'], note: 'principal review of client communications' },
83
+ { id: 'no-guarantees', effect: 'forbid', targets: ['comms.client.guarantee*'], note: 'no promises of returns' },
84
+ ],
85
+ };
86
+
87
+ /** Replay recorded actions (or targets) against a rulebook: what would have been forbidden or held. */
88
+ export function simulate(c: Constitution, targets: string[]) {
89
+ const counts: Record<RuleEffect, number> = { forbid: 0, require_approval: 0, allow: 0 };
90
+ const forbidden: Array<{ target: string; rule: string | null }> = [];
91
+ for (const t of targets) {
92
+ const e = evaluate(c, t);
93
+ counts[e.effect]++;
94
+ if (e.effect === 'forbid') forbidden.push({ target: t, rule: e.rule?.id ?? null });
95
+ }
96
+ return { counts, forbidden };
97
+ }
98
+
99
+ /** Rules in different rulebooks (organisation, department, agent) that overlap and disagree. */
100
+ export function conflictCheck(constitutions: Constitution[]) {
101
+ const out: Array<{ a: string; ruleA: string; b: string; ruleB: string; target: string }> = [];
102
+ for (let i = 0; i < constitutions.length; i++) for (let j = i + 1; j < constitutions.length; j++) {
103
+ for (const ra of constitutions[i]!.rules) for (const rb of constitutions[j]!.rules) {
104
+ if (ra.effect === rb.effect) continue;
105
+ for (const ta of ra.targets) for (const tb of rb.targets) {
106
+ if (scopeCovers(ta, tb.replace(/\*$/, 'x')) || scopeCovers(tb, ta.replace(/\*$/, 'x'))) {
107
+ out.push({ a: constitutions[i]!.name, ruleA: ra.id, b: constitutions[j]!.name, ruleB: rb.id, target: ta.length >= tb.length ? ta : tb });
108
+ }
109
+ }
110
+ }
111
+ }
112
+ return out;
113
+ }
114
+
115
+ /** A self-contained proof of one violation: the signed rulebook, the signed receipt, the rule it broke. */
116
+ export function violationProof(c: Constitution, receipt: Receipt) {
117
+ const e = evaluate(c, receipt.target);
118
+ if (e.effect !== 'forbid') throw new Error('constitution: this action is not forbidden by the rulebook');
119
+ return { constitution: c, receipt, rule: e.rule?.id ?? '(default)' };
120
+ }
121
+
122
+ /** Anyone can check it: both signatures valid, the receipt was stamped with this rulebook, and the rule forbids it. */
123
+ export function verifyViolationProof(p: ReturnType<typeof violationProof>): boolean {
124
+ return verifyConstitution(p.constitution) && verifyReceipt(p.receipt).ok && p.receipt.manifest_hash === constitutionHash(p.constitution) &&
125
+ evaluate(p.constitution, p.receipt.target).effect === 'forbid';
126
+ }
127
+
128
+ /** The document to serve at https://<domain>/.well-known/zanii-constitution.json. */
129
+ export function wellKnownDocument(c: Constitution) {
130
+ return { constitution: c, hash: constitutionHash(c) };
131
+ }
132
+
133
+ /** Fetch and verify a published rulebook. Returns null if absent or invalid. */
134
+ export async function fetchPublicConstitution(domain: string, fetchImpl: (u: string) => Promise<Response> = (u) => fetch(u)): Promise<Constitution | null> {
135
+ try {
136
+ const res = await fetchImpl(`https://${domain}/.well-known/zanii-constitution.json`);
137
+ if (!res.ok) return null;
138
+ const doc = (await res.json()) as { constitution: Constitution; hash: string };
139
+ return verifyConstitution(doc.constitution) && constitutionHash(doc.constitution) === doc.hash ? doc.constitution : null;
140
+ } catch {
141
+ return null;
142
+ }
143
+ }
144
+
145
+ /** Why this action is allowed, held or forbidden, in a sentence. */
146
+ export function explainDecision(c: Constitution, target: string): string {
147
+ const e = evaluate(c, target);
148
+ const verb = { forbid: 'is forbidden', require_approval: 'needs human approval', allow: 'is allowed' }[e.effect];
149
+ return e.rule
150
+ ? `${target} ${verb} by rule "${e.rule.id}" of "${c.name}"${e.rule.note ? ` (${e.rule.note})` : ''}.`
151
+ : `${target} ${verb}: no rule in "${c.name}" covers it, so the default applies.`;
152
+ }
153
+
154
+ /**
155
+ * Evaluate at a point in time, honouring optional `expires` on rules (a sunset clause). An
156
+ * expired rule no longer applies. `evaluate` itself is unchanged and ignores expiry.
157
+ */
158
+ export function evaluateAt(c: Constitution, target: string, at: string) {
159
+ const live = { ...c, rules: c.rules.filter((r) => !(r as Rule & { expires?: string }).expires || at < (r as Rule & { expires?: string }).expires!) };
160
+ return evaluate(live, target);
161
+ }
162
+
163
+ /** Rules whose sunset falls within `withinMs` of `now`: renew or let them lapse deliberately. */
164
+ export function expiringRules(c: Constitution, now: string, withinMs: number) {
165
+ return c.rules.filter((r) => {
166
+ const exp = (r as Rule & { expires?: string }).expires;
167
+ return exp && Date.parse(exp) - Date.parse(now) <= withinMs && exp > now;
168
+ }).map((r) => r.id);
169
+ }
package/src/index.ts CHANGED
@@ -213,3 +213,4 @@ export function governanceTrail(receipts: Receipt[]): GovernanceTrail {
213
213
  }
214
214
  return { manifests: order, counts, interleaved, unstamped };
215
215
  }
216
+ export * from './governance.js';