@metamynd/mmt-graph 0.2.0 → 0.3.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.
|
@@ -67,15 +67,18 @@ function parseOperatorKey(raw) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
const operatorPrivateKey = parseOperatorKey(operatorKey);
|
|
70
71
|
const client = Client.forName(network);
|
|
71
|
-
client.setOperator(AccountId.fromString(operatorId),
|
|
72
|
+
client.setOperator(AccountId.fromString(operatorId), operatorPrivateKey);
|
|
72
73
|
|
|
73
74
|
async function ensureTopicId() {
|
|
74
75
|
const fromEnv = process.env.MMT_GRAPH_TOPIC_ID;
|
|
75
76
|
if (fromEnv) return fromEnv;
|
|
76
77
|
|
|
77
78
|
console.log('No MMT_GRAPH_TOPIC_ID set — creating a fresh topic (set this env var to reuse it next time).');
|
|
78
|
-
|
|
79
|
+
// Admin key IS set (the operator key) so this topic stays upgradeable later (e.g. an
|
|
80
|
+
// HSuite multisig validator key) — omitting it makes a topic permanently immutable.
|
|
81
|
+
const resp = await new TopicCreateTransaction().setAdminKey(operatorPrivateKey).execute(client);
|
|
79
82
|
const topicId = (await resp.getReceipt(client)).topicId?.toString();
|
|
80
83
|
if (!topicId) throw new Error('topic creation succeeded but returned no topicId');
|
|
81
84
|
return topicId;
|
package/mmt-graph.types.mjs
CHANGED
|
@@ -60,6 +60,25 @@
|
|
|
60
60
|
*/
|
|
61
61
|
/** @typedef {{ op: 'mandate-revoked', policyId: string }} MandateRevoked */
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Owner-initiated agent containment (distinct from a rule-fired suspend/quarantine,
|
|
65
|
+
* neither of which anchor to this graph today). `reason` is the free-text
|
|
66
|
+
* `AgentIdentity.containedReason` at the moment of decommission, capped the same way
|
|
67
|
+
* the DB column is.
|
|
68
|
+
*
|
|
69
|
+
* NOT YET WIRED to a projector or an adapter/backend call site (unlike
|
|
70
|
+
* MandateGranted/MandateRevoked, both of which have engine.mjs `#project()` cases —
|
|
71
|
+
* MandateRevoked's is just never invoked from a backend call site today). Applying
|
|
72
|
+
* AgentReinstated correctly needs a projector that clears just the prior
|
|
73
|
+
* containmentStatus/containmentReason quads for the agent — `apply()`'s only removal
|
|
74
|
+
* primitive today is `{removeSubject}`, which deletes the WHOLE agent node (its type,
|
|
75
|
+
* memberOf, mandates, cohorts…), not a single predicate. Add an
|
|
76
|
+
* `mmt-graph.engine.mjs` case (+ project.mjs projector) with a predicate-scoped
|
|
77
|
+
* removal before wiring an adapter call — until then this is vocabulary-only.
|
|
78
|
+
*/
|
|
79
|
+
/** @typedef {{ op: 'agent-decommissioned', agentDid: string, reason?: string }} AgentDecommissioned */
|
|
80
|
+
/** @typedef {{ op: 'agent-reinstated', agentDid: string }} AgentReinstated */
|
|
81
|
+
|
|
63
82
|
/**
|
|
64
83
|
* Domain H (runtime activity/evidence) — Phase 5's first slice, proving the engine can
|
|
65
84
|
* answer evidence-path.ts's "independently verifiable" question, not a full replacement
|
|
@@ -161,6 +180,20 @@ export function mandateRevoked({ policyId }) {
|
|
|
161
180
|
return ev;
|
|
162
181
|
}
|
|
163
182
|
|
|
183
|
+
/** @returns {AgentDecommissioned} */
|
|
184
|
+
export function agentDecommissioned({ agentDid, reason }) {
|
|
185
|
+
const ev = { op: 'agent-decommissioned', agentDid, reason };
|
|
186
|
+
requireFields(ev, ['agentDid']);
|
|
187
|
+
return ev;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** @returns {AgentReinstated} */
|
|
191
|
+
export function agentReinstated({ agentDid }) {
|
|
192
|
+
const ev = { op: 'agent-reinstated', agentDid };
|
|
193
|
+
requireFields(ev, ['agentDid']);
|
|
194
|
+
return ev;
|
|
195
|
+
}
|
|
196
|
+
|
|
164
197
|
/** @returns {DecisionRecorded} */
|
|
165
198
|
export function decisionRecorded({ decisionId, decisionDigest, agentDid }) {
|
|
166
199
|
const ev = { op: 'decision-recorded', decisionId, decisionDigest, agentDid };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamynd/mmt-graph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Reference trust-graph engine (Oxigraph/SPARQL + SHACL) + HCS-anchor contract: apply mutation events, validate the MMTO §3 authority-chain invariant, batch the changelog into a Merkle root ready to anchor, and verify a disclosed tenant graph with MetaMynd fully offline. Hosting-mode-agnostic — no MetaMynd backend, no Postgres, no MetaMynd credentials anywhere in the code path. See docs/design/metamynd-trust-ontology.md Appendix C.",
|
|
6
6
|
"main": "mmt-graph.engine.mjs",
|