magenta-canon 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/docs/NPM_PACKAGING.md
CHANGED
|
@@ -67,7 +67,7 @@ verifier behavior.
|
|
|
67
67
|
## What ships in the tarball
|
|
68
68
|
|
|
69
69
|
Controlled by the `files` allowlist in `package.json`. Current contents
|
|
70
|
-
(`magenta-canon-0.1.
|
|
70
|
+
(`magenta-canon-0.1.2.tgz` — 77 files, ~215 KB packed, ~870 KB unpacked):
|
|
71
71
|
|
|
72
72
|
| Path | Why |
|
|
73
73
|
|---|---|
|
|
@@ -78,6 +78,7 @@ Controlled by the `files` allowlist in `package.json`. Current contents
|
|
|
78
78
|
| `examples/` | the demo gateway config + the minimal downstream MCP server |
|
|
79
79
|
| `tsconfig.json` | required so `tsx` resolves the `@shared/*` path alias at runtime |
|
|
80
80
|
| `docs/MAGENTA_VERIFICATION_SPEC.md`, `MCP_GATEWAY.md`, `SECURITY_MODEL.md`, `NPM_PACKAGING.md` | the spec + the docs a CLI user needs |
|
|
81
|
+
| `public/canon/schemas/constitutional-spine.schema.json`, `public/canon/spine/constitutional-spine.v1.json` | the **only** two `public/` files shipped — runtime assets the control plane resolves at `process.cwd()/public/canon/...` to serve `/api/canon/spine`. Omitting them left the package internally inconsistent (referenced but not shipped) and surfaced an `ENOENT` in the control-plane log on a packaged install (0.1.1). The rest of `public/` (website, banner, sitemap) stays excluded. |
|
|
81
82
|
| `README.md`, `LICENSE` | always |
|
|
82
83
|
|
|
83
84
|
Runtime dependency added for packaging: **`tsx`** (moved from devDependencies to
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magenta-canon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "A verifiable MCP accountability gateway for AI-agent tool calls: allows authorized calls, blocks unauthorized calls, records both, and produces cryptographic evidence anyone can verify.",
|
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
"docs/MCP_GATEWAY.md",
|
|
42
42
|
"docs/SECURITY_MODEL.md",
|
|
43
43
|
"docs/NPM_PACKAGING.md",
|
|
44
|
+
"public/canon/schemas/constitutional-spine.schema.json",
|
|
45
|
+
"public/canon/spine/constitutional-spine.v1.json",
|
|
44
46
|
"README.md",
|
|
45
47
|
"LICENSE",
|
|
46
48
|
"!**/*.test.ts",
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://themagentacanon.com/canon/schemas/constitutional-spine.schema.json",
|
|
4
|
+
"title": "Constitutional Spine Declaration Artifact (v1)",
|
|
5
|
+
"description": "Schema for the read-only declarative Constitutional Spine artifact. Validates the enumeration of candidate constitutional invariants with their five-field metadata (purpose, protected surface, drift risk, enforcement posture, severity) plus implementation status. Conformance to this schema does not confer enforcement; the artifact describes, it does not enact.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"schema_version",
|
|
10
|
+
"artifact_version",
|
|
11
|
+
"artifact_id",
|
|
12
|
+
"generated_at_source",
|
|
13
|
+
"authority_status",
|
|
14
|
+
"adoption_status",
|
|
15
|
+
"enforceability_notice",
|
|
16
|
+
"status",
|
|
17
|
+
"enforcement_posture_global",
|
|
18
|
+
"source_design",
|
|
19
|
+
"non_goals",
|
|
20
|
+
"invariants"
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"$schema": { "type": "string" },
|
|
24
|
+
"schema_version": { "type": "string", "const": "constitutional-spine/v1" },
|
|
25
|
+
"artifact_version": { "type": "string", "const": "v1" },
|
|
26
|
+
"artifact_id": { "type": "string", "minLength": 1 },
|
|
27
|
+
"version": { "type": "string", "description": "Artifact version identifier alias (e.g. v1)." },
|
|
28
|
+
"generated_at_source": { "type": "string", "minLength": 1 },
|
|
29
|
+
"source_design": { "type": "string", "minLength": 1 },
|
|
30
|
+
"source_section": { "type": "string" },
|
|
31
|
+
"description": { "type": "string" },
|
|
32
|
+
"authority_status": { "type": "string", "const": "non_authoritative" },
|
|
33
|
+
"adoption_status": { "type": "string", "const": "candidate_only" },
|
|
34
|
+
"status": { "type": "string", "enum": ["declared", "promoted"] },
|
|
35
|
+
"enforcement_posture_global": { "type": "string", "enum": ["non-enforcing", "enforcing"] },
|
|
36
|
+
"enforceability_notice": { "type": "string", "minLength": 1 },
|
|
37
|
+
"promotion_policy": { "type": "string" },
|
|
38
|
+
"severity_legend": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"additionalProperties": false,
|
|
41
|
+
"required": ["advisory", "freeze"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"advisory": { "type": "string" },
|
|
44
|
+
"freeze": { "type": "string" }
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"implementation_status_legend": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"required": ["unimplemented", "partially-implemented", "implemented", "enforced"],
|
|
51
|
+
"properties": {
|
|
52
|
+
"unimplemented": { "type": "string" },
|
|
53
|
+
"partially-implemented": { "type": "string" },
|
|
54
|
+
"implemented": { "type": "string" },
|
|
55
|
+
"enforced": { "type": "string" }
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"non_goals": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"minItems": 1,
|
|
61
|
+
"items": { "type": "string", "minLength": 1 }
|
|
62
|
+
},
|
|
63
|
+
"invariants": {
|
|
64
|
+
"type": "array",
|
|
65
|
+
"minItems": 1,
|
|
66
|
+
"maxItems": 50,
|
|
67
|
+
"items": { "$ref": "#/$defs/invariant" }
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"$defs": {
|
|
71
|
+
"invariant": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"additionalProperties": false,
|
|
74
|
+
"required": [
|
|
75
|
+
"id",
|
|
76
|
+
"name",
|
|
77
|
+
"purpose",
|
|
78
|
+
"protected_surface",
|
|
79
|
+
"drift_risk",
|
|
80
|
+
"enforcement_posture",
|
|
81
|
+
"severity",
|
|
82
|
+
"implementation_status",
|
|
83
|
+
"implementationStatus",
|
|
84
|
+
"authority_status",
|
|
85
|
+
"adoption_status",
|
|
86
|
+
"caveat"
|
|
87
|
+
],
|
|
88
|
+
"properties": {
|
|
89
|
+
"id": { "type": "string", "pattern": "^I-[0-9]+$" },
|
|
90
|
+
"name": { "type": "string", "minLength": 1 },
|
|
91
|
+
"purpose": { "type": "string", "minLength": 1 },
|
|
92
|
+
"protected_surface": { "type": "string", "minLength": 1 },
|
|
93
|
+
"drift_risk": { "type": "string", "minLength": 1 },
|
|
94
|
+
"enforcement_posture": { "type": "string", "minLength": 1 },
|
|
95
|
+
"severity": { "type": "string", "enum": ["advisory", "freeze"] },
|
|
96
|
+
"implementation_status": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"enum": ["unimplemented", "partially_implemented", "implemented", "enforced"],
|
|
99
|
+
"description": "Snake_case rendering of implementation status (HEAD-compatible)."
|
|
100
|
+
},
|
|
101
|
+
"implementationStatus": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"enum": ["unimplemented", "partially-implemented", "implemented", "enforced"],
|
|
104
|
+
"description": "camelCase rendering of implementation status (task-spec literal). Mirrors implementation_status."
|
|
105
|
+
},
|
|
106
|
+
"authority_status": { "type": "string", "const": "non_authoritative" },
|
|
107
|
+
"adoption_status": { "type": "string", "const": "candidate_only" },
|
|
108
|
+
"caveat": { "type": "string", "minLength": 1 },
|
|
109
|
+
"implementation_notes": { "type": "string" }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://themagentacanon.com/canon/schemas/constitutional-spine.schema.json",
|
|
3
|
+
"schema_version": "constitutional-spine/v1",
|
|
4
|
+
"artifact_version": "v1",
|
|
5
|
+
"version": "v1",
|
|
6
|
+
"artifact_id": "constitutional-spine.v1",
|
|
7
|
+
"generated_at_source": "reports/magenta-canon-north-star-constitutional-field-design.md#section-6",
|
|
8
|
+
"source_design": "reports/magenta-canon-north-star-constitutional-field-design.md",
|
|
9
|
+
"source_section": "§6 (invariants), §12 (next-phase scope)",
|
|
10
|
+
"description": "Read-only declarative enumeration of candidate constitutional invariants for Magenta Canon. This artifact describes; it does not enforce. Promotion of any invariant to load-bearing status requires a separate, explicit governance event with evidence bundle.",
|
|
11
|
+
"authority_status": "non_authoritative",
|
|
12
|
+
"adoption_status": "candidate_only",
|
|
13
|
+
"status": "declared",
|
|
14
|
+
"enforcement_posture_global": "non-enforcing",
|
|
15
|
+
"enforceability_notice": "This artifact is a declaration only. It is not enforceable. No invariant listed here may be cited as binding on any actor, layer, or decision until a future, explicit governance event promotes it through the normal Magenta Canon authority process. Reading this artifact creates no authority and confers no permission.",
|
|
16
|
+
"promotion_policy": "Promotion of any invariant from declared to enforced requires a separate governance event, an evidence bundle, and a signed authority binding proof. This artifact's existence does not constitute promotion.",
|
|
17
|
+
"severity_legend": {
|
|
18
|
+
"advisory": "Surface only; no execution behavior change.",
|
|
19
|
+
"freeze": "When promoted, would halt mutating operations within the protected surface."
|
|
20
|
+
},
|
|
21
|
+
"implementation_status_legend": {
|
|
22
|
+
"unimplemented": "No code surface yet enforces or even structurally represents this invariant.",
|
|
23
|
+
"partially-implemented": "Some code paths approximate the invariant; coverage is incomplete or relies on call-site discipline rather than structural enforcement.",
|
|
24
|
+
"implemented": "Code surface exists and consistently honors the invariant in normal operation, but the invariant has not been promoted to a freeze condition.",
|
|
25
|
+
"enforced": "Invariant is promoted to a freeze condition: violations halt mutating operations within the protected surface."
|
|
26
|
+
},
|
|
27
|
+
"non_goals": [
|
|
28
|
+
"This artifact does not enforce any invariant.",
|
|
29
|
+
"This artifact does not modify Gravity Kernel.",
|
|
30
|
+
"This artifact does not change CEAL.",
|
|
31
|
+
"This artifact does not create authority.",
|
|
32
|
+
"This artifact does not write to any ledger.",
|
|
33
|
+
"This artifact does not influence eligibility decisions.",
|
|
34
|
+
"No write endpoints for the spine.",
|
|
35
|
+
"No visualization surface.",
|
|
36
|
+
"No new drift-detection signals.",
|
|
37
|
+
"No claim that the artifact is enforceable until a subsequent governance event explicitly promotes it."
|
|
38
|
+
],
|
|
39
|
+
"invariants": [
|
|
40
|
+
{
|
|
41
|
+
"id": "I-1",
|
|
42
|
+
"name": "Evidence Outranks Assertion",
|
|
43
|
+
"purpose": "No claim may influence a judgment more strongly than its evidence supports.",
|
|
44
|
+
"protected_surface": "Eligibility computation, behavioral vectors, proposal intake, AI-generated content surfaces.",
|
|
45
|
+
"drift_risk": "Confidence inflation; assertions promoted to facts via repetition.",
|
|
46
|
+
"enforcement_posture": "Each input to a judgment carries an evidence-grade tag; ungraded inputs are rejected from ETDP bundles.",
|
|
47
|
+
"severity": "freeze",
|
|
48
|
+
"implementation_status": "unimplemented",
|
|
49
|
+
"implementationStatus": "unimplemented",
|
|
50
|
+
"authority_status": "non_authoritative",
|
|
51
|
+
"adoption_status": "candidate_only",
|
|
52
|
+
"caveat": "Evidence-grade tagging is not uniformly applied across all proposal intake surfaces today; this invariant is aspirational pending a governance event.",
|
|
53
|
+
"implementation_notes": "No evidence-grade tagging schema exists on inputs to eligibility or ETDP bundles today."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "I-2",
|
|
57
|
+
"name": "Provenance Must Remain Preservable",
|
|
58
|
+
"purpose": "Every state-affecting datum must be traceable to its origin receipt.",
|
|
59
|
+
"protected_surface": "Receipt ledger, witnessed mutations, evidence bundles, public verifier surfaces.",
|
|
60
|
+
"drift_risk": "Optimizations that strip provenance for performance.",
|
|
61
|
+
"enforcement_posture": "Witnessed-mutation receipts mandatory; unsigned mutations rejected when trust is configured.",
|
|
62
|
+
"severity": "freeze",
|
|
63
|
+
"implementation_status": "implemented",
|
|
64
|
+
"implementationStatus": "implemented",
|
|
65
|
+
"authority_status": "non_authoritative",
|
|
66
|
+
"adoption_status": "candidate_only",
|
|
67
|
+
"caveat": "Implemented via witnessedMutation/witnessedTrustMutation in server/routes.ts; not promoted to enforced status because this declaration artifact does not itself enforce.",
|
|
68
|
+
"implementation_notes": "witnessedMutation / witnessedTrustMutation in server/routes.ts wrap mutations in snapshot→mutate→receipt→rollback; no mutation persists without a signed receipt when trust is configured."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id": "I-3",
|
|
72
|
+
"name": "Uncertainty Must Remain Representable",
|
|
73
|
+
"purpose": "The system must never collapse a probabilistic claim into a binary one without an explicit governance event.",
|
|
74
|
+
"protected_surface": "All eligibility surfaces, AI-answer endpoints, dashboards.",
|
|
75
|
+
"drift_risk": "Operational simplification (humans/agents prefer binary answers; the system is tempted to oblige).",
|
|
76
|
+
"enforcement_posture": "Probabilistic outputs carry confidence bands through derivation chains; collapse requires a logged promotion event.",
|
|
77
|
+
"severity": "advisory",
|
|
78
|
+
"implementation_status": "unimplemented",
|
|
79
|
+
"implementationStatus": "unimplemented",
|
|
80
|
+
"authority_status": "non_authoritative",
|
|
81
|
+
"adoption_status": "candidate_only",
|
|
82
|
+
"caveat": "No confidence-band propagation exists today across AI-answer or eligibility surfaces; severity per §6 is advisory at low strain (and would escalate to freeze only on silent collapse).",
|
|
83
|
+
"implementation_notes": "No confidence-band propagation exists across endpoints; eligibility is intentionally binary by design (see governance.invariants in system.identity.json)."
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": "I-4",
|
|
87
|
+
"name": "Confidence Must Match Verification",
|
|
88
|
+
"purpose": "Stated confidence may not exceed the strength of underlying verification.",
|
|
89
|
+
"protected_surface": "AI-answer surfaces, drift-detection outputs, behavioral vector reports.",
|
|
90
|
+
"drift_risk": "Verbal confidence inflation; cosmetic certainty.",
|
|
91
|
+
"enforcement_posture": "Confidence-to-verification ratio computed; mismatched outputs annotated with explicit caveat or refused.",
|
|
92
|
+
"severity": "advisory",
|
|
93
|
+
"implementation_status": "unimplemented",
|
|
94
|
+
"implementationStatus": "unimplemented",
|
|
95
|
+
"authority_status": "non_authoritative",
|
|
96
|
+
"adoption_status": "candidate_only",
|
|
97
|
+
"caveat": "No confidence-to-verification ratio is computed today.",
|
|
98
|
+
"implementation_notes": "No confidence-to-verification ratio is computed on AI-answer or drift outputs."
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "I-5",
|
|
102
|
+
"name": "Advisory Systems May Not Self-Promote",
|
|
103
|
+
"purpose": "Memory and evaluation layers (Brain Hub, VERN, precedent memory) may inform; they may not authorize.",
|
|
104
|
+
"protected_surface": "All authorization surfaces (capability grants, baseline commits, policy publishes).",
|
|
105
|
+
"drift_risk": "Pattern-of-use creeping from \"informs\" into \"approves\" via UI defaults or implicit acceptance.",
|
|
106
|
+
"enforcement_posture": "Authorization events require an explicit authority binding proof; advisory inputs are visible but never sufficient.",
|
|
107
|
+
"severity": "freeze",
|
|
108
|
+
"implementation_status": "partially_implemented",
|
|
109
|
+
"implementationStatus": "partially-implemented",
|
|
110
|
+
"authority_status": "non_authoritative",
|
|
111
|
+
"adoption_status": "candidate_only",
|
|
112
|
+
"caveat": "Authority binding proofs are required on capability mutations; precedent and behavioral surfaces are structurally advisory in code, but no surface audit verifies absence of decision-shaped advisory output.",
|
|
113
|
+
"implementation_notes": "Authorization endpoints require sovereign envelopes (server/sovereign-auth.ts); advisory layers (precedent-memory, behavioral-vector) cannot directly authorize. No formal self-promotion detector audits surface styling."
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "I-6",
|
|
117
|
+
"name": "CEAL Cannot Be Bypassed",
|
|
118
|
+
"purpose": "Bounded execution authority is the only path to side-effecting operations; no parallel path may exist.",
|
|
119
|
+
"protected_surface": "All execution surfaces.",
|
|
120
|
+
"drift_risk": "\"Quick path\" optimizations that skip CEAL for trusted callers.",
|
|
121
|
+
"enforcement_posture": "Gravity Kernel rejects mutations lacking a CEAL grant in their evidence bundle.",
|
|
122
|
+
"severity": "freeze",
|
|
123
|
+
"implementation_status": "partially_implemented",
|
|
124
|
+
"implementationStatus": "partially-implemented",
|
|
125
|
+
"authority_status": "non_authoritative",
|
|
126
|
+
"adoption_status": "candidate_only",
|
|
127
|
+
"caveat": "CEAL and Gravity Kernel are external to this repository. Magenta Canon does not currently verify CEAL grants on incoming mutations; proposal containment provides the closest internal analogue.",
|
|
128
|
+
"implementation_notes": "Proposal containment (server/proposal-containment.ts) requires proposal → simulation → eligibility → binding before execution. Gravity Kernel as described in the design is not implemented inside this repository, so CEAL-grant enforcement is not yet structurally complete."
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "I-7",
|
|
132
|
+
"name": "Governance Outranks Optimization",
|
|
133
|
+
"purpose": "When a governance constraint and an optimization metric conflict, governance wins.",
|
|
134
|
+
"protected_surface": "Eligibility computation, freeze conditions, change-management surfaces.",
|
|
135
|
+
"drift_risk": "Subtle refactors that re-order checks so optimization runs first and short-circuits governance.",
|
|
136
|
+
"enforcement_posture": "Governance checks are structurally first in eligibility evaluation; ordering is itself governance-protected.",
|
|
137
|
+
"severity": "freeze",
|
|
138
|
+
"implementation_status": "partially_implemented",
|
|
139
|
+
"implementationStatus": "partially-implemented",
|
|
140
|
+
"authority_status": "non_authoritative",
|
|
141
|
+
"adoption_status": "candidate_only",
|
|
142
|
+
"caveat": "Eligibility evaluation in proposal-containment runs governance checks before precedent influence today, but the ordering is not protected by a build-time invariant test.",
|
|
143
|
+
"implementation_notes": "Governance-first ordering is honored by call-site discipline in server/routes.ts (e.g., sovereign auth and capability checks precede any optimization), but ordering is not itself a governance-protected, structurally enforced invariant."
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "I-8",
|
|
147
|
+
"name": "Memory Cannot Silently Mutate Authority",
|
|
148
|
+
"purpose": "No precedent or behavioral vector may modify an authority grant without an explicit governance event.",
|
|
149
|
+
"protected_surface": "Authority topology, capability grants, delegation edges.",
|
|
150
|
+
"drift_risk": "\"Auto-renewal\" or \"auto-extension\" features added to make operations smoother.",
|
|
151
|
+
"enforcement_posture": "All authority mutations require explicit, signed governance envelopes; no read-derived mutation.",
|
|
152
|
+
"severity": "freeze",
|
|
153
|
+
"implementation_status": "implemented",
|
|
154
|
+
"implementationStatus": "implemented",
|
|
155
|
+
"authority_status": "non_authoritative",
|
|
156
|
+
"adoption_status": "candidate_only",
|
|
157
|
+
"caveat": "Authority mutations in authority-containment.ts and authority-topology.ts require explicit grant calls; no precedent or behavioral pathway can mutate authority records. Not promoted to enforced because this artifact does not enforce.",
|
|
158
|
+
"implementation_notes": "Capability grants and supersessions require sovereign envelopes; capability supersession cascades irreversibly. Precedent memory and behavioral vectors are read-only with respect to authority topology."
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "I-9",
|
|
162
|
+
"name": "Witness Lineage Cannot Be Severed",
|
|
163
|
+
"purpose": "The receipt chain must remain continuous; gaps are themselves invariant violations.",
|
|
164
|
+
"protected_surface": "Execution receipt ledger, ETDP proofs, evidence bundles.",
|
|
165
|
+
"drift_risk": "Pruning, deduplication, or \"compaction\" optimizations that lose chain links.",
|
|
166
|
+
"enforcement_posture": "Hash-chain continuity verified on every ETDP issuance; breaks halt issuance.",
|
|
167
|
+
"severity": "freeze",
|
|
168
|
+
"implementation_status": "implemented",
|
|
169
|
+
"implementationStatus": "implemented",
|
|
170
|
+
"authority_status": "non_authoritative",
|
|
171
|
+
"adoption_status": "candidate_only",
|
|
172
|
+
"caveat": "Hash-chain continuity is verified in execution-receipts.ts and economic-trust.ts (verifyProofChain). Note: receipt ledger is currently in-memory and ephemeral across restarts, which is a separate durability concern from chain continuity.",
|
|
173
|
+
"implementation_notes": "server/execution-receipts.ts maintains a hash-chained, append-only receipt ledger; ETDP proof issuance (server/economic-trust.ts) verifies replayability."
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"id": "I-10",
|
|
177
|
+
"name": "No Layer May Escalate Autonomy Without Explicit Governance Approval",
|
|
178
|
+
"purpose": "Self-modification of authority, scope, or eligibility criteria requires a human-governed event.",
|
|
179
|
+
"protected_surface": "All layers — agents, services, the spine itself.",
|
|
180
|
+
"drift_risk": "Convenience features that let a layer \"tune itself\"; agent self-improvement loops.",
|
|
181
|
+
"enforcement_posture": "Self-modifying changes are detected at proposal intake; flagged at highest severity (D5) if attempted without governance event.",
|
|
182
|
+
"severity": "freeze",
|
|
183
|
+
"implementation_status": "partially_implemented",
|
|
184
|
+
"implementationStatus": "partially-implemented",
|
|
185
|
+
"authority_status": "non_authoritative",
|
|
186
|
+
"adoption_status": "candidate_only",
|
|
187
|
+
"caveat": "Authority topology forbids actors from granting themselves authority through normal capability paths, but no proposal-intake detector explicitly flags self-modification attempts as a distinct drift archetype.",
|
|
188
|
+
"implementation_notes": "Agent proposals enter as non-authoritative ExecutionProposals via /api/mdk/agent/propose and cannot trigger execution. Detection of self-scope-widening proposals (D5 archetype) is not yet a formal proposal-intake check."
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
package/scripts/demo.mjs
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
import { createServer } from "node:net";
|
|
36
36
|
import os from "node:os";
|
|
37
37
|
import path from "node:path";
|
|
38
|
+
import { killChildTree } from "./proc-cleanup.mjs";
|
|
38
39
|
|
|
39
40
|
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
40
41
|
const INTERNAL_KEY = "demo-operator-key";
|
|
@@ -117,22 +118,26 @@ const capture = (cmd, args, opts = {}) =>
|
|
|
117
118
|
});
|
|
118
119
|
|
|
119
120
|
// Run the MCP driver. The driver spawns the gateway (which spawns the downstream)
|
|
120
|
-
// as children, and its kill doesn't always propagate through npx — so
|
|
121
|
-
// whole thing in its own process group
|
|
122
|
-
//
|
|
123
|
-
//
|
|
121
|
+
// as children, and its kill doesn't always propagate through npx — so on POSIX we
|
|
122
|
+
// run the whole thing in its own process group and reap the entire group, while
|
|
123
|
+
// on Windows (no process groups, negative PIDs are invalid) we terminate the
|
|
124
|
+
// child directly. See scripts/proc-cleanup.mjs. We capture only stdout (stderr is
|
|
125
|
+
// discarded so a lingering grandchild can't block us), resolve on `exit`, then
|
|
126
|
+
// clean up. A watchdog guarantees the demo can never hang here.
|
|
127
|
+
const isWindows = process.platform === "win32";
|
|
124
128
|
const runDriver = (configPath, env) =>
|
|
125
129
|
new Promise((resolve) => {
|
|
126
130
|
const ch = spawn("node", ["scripts/mcp-demo-drive.mjs", configPath], {
|
|
127
|
-
|
|
131
|
+
// `detached` only buys us a process group on POSIX; skip it on Windows.
|
|
132
|
+
cwd: ROOT, detached: !isWindows, stdio: ["ignore", "pipe", "ignore"], env,
|
|
128
133
|
});
|
|
129
134
|
let out = "";
|
|
130
135
|
ch.stdout.on("data", (d) => (out += d));
|
|
131
|
-
const
|
|
132
|
-
const watchdog = setTimeout(() => {
|
|
136
|
+
const cleanup = () => killChildTree(ch);
|
|
137
|
+
const watchdog = setTimeout(() => { cleanup(); resolve({ code: 124, out }); }, 30_000);
|
|
133
138
|
ch.on("exit", (code) => {
|
|
134
139
|
clearTimeout(watchdog);
|
|
135
|
-
setTimeout(() => {
|
|
140
|
+
setTimeout(() => { cleanup(); resolve({ code: code ?? 0, out }); }, 150);
|
|
136
141
|
});
|
|
137
142
|
});
|
|
138
143
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform best-effort termination of a detached child process and its
|
|
3
|
+
* process group. Used by the demo driver (scripts/demo.mjs) to reap the MCP
|
|
4
|
+
* driver together with the gateway + downstream it spawns.
|
|
5
|
+
*
|
|
6
|
+
* POSIX: the child is spawned `detached`, so it leads its own process group and
|
|
7
|
+
* we can tear the whole group down with `process.kill(-pid)` (a NEGATIVE pid).
|
|
8
|
+
*
|
|
9
|
+
* Windows: there are no POSIX process groups and a negative pid is invalid —
|
|
10
|
+
* `process.kill(-pid)` throws `EINVAL`/`ESRCH`, which is exactly what broke
|
|
11
|
+
* `npx magenta-canon demo` at step 3/7 on Windows. So on win32 we never use a
|
|
12
|
+
* negative pid; we terminate the child directly via `child.kill()`.
|
|
13
|
+
*
|
|
14
|
+
* Pure and injectable (`platform`, `kill`) so it can be unit-tested without
|
|
15
|
+
* actually spawning processes. No verifier/witness/evidence/gateway semantics.
|
|
16
|
+
*/
|
|
17
|
+
export function killChildTree(
|
|
18
|
+
child,
|
|
19
|
+
{ platform = process.platform, kill = process.kill, signal = "SIGKILL" } = {},
|
|
20
|
+
) {
|
|
21
|
+
const pid = child && child.pid;
|
|
22
|
+
if (pid == null) return;
|
|
23
|
+
if (platform === "win32") {
|
|
24
|
+
// No negative-PID group kill on Windows. Terminate the child directly;
|
|
25
|
+
// Node maps child.kill() to TerminateProcess for the child.
|
|
26
|
+
try { child.kill(signal); } catch { /* already gone */ }
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// POSIX: kill the entire detached process group (negative pid).
|
|
30
|
+
try { kill(-pid, signal); } catch { /* group already gone */ }
|
|
31
|
+
}
|