Plugin API

Build domain-specific governance.

Five-method JavaScript contract. Implement it to add AGTS governance to any domain: supply chain, trading, cybersecurity, or your own.

Normative

What you implement — five methods

const agtsPlugin = { // 1. Unique domain identifier get name() { return 'myDomain'; }, // 2. Called once when plugin is registered // Call onMeasurement() to push events into the clearinghouse async initialize(onMeasurement) { this._emit = onMeasurement; onMeasurement({ type: 'plugin_registered', measurement_source: 'PLUGIN', plugin: this.name, timestamp: new Date().toISOString(), }); }, // 3. Returns current plugin status — synchronous, non-throwing getStatus() { return { name: this.name, initialized: true, lifecycleState: 'ACTIVE', }; }, // 4. Handle messages from the clearinghouse or other plugins async onMessage(msg, sender) { return null; }, // 5. Called on clearinghouse shutdown destroy() { this._emit = null; }, };
// Registration await clearinghouse.pluginRegistry.register(agtsPlugin); // Calls initialize(onMeasurement) automatically. // If initialize() throws, the plugin is not registered.

Emitting governance evidence

When your domain has collected all five gate results, emit agts_governance_evidence:

this._emit({ type: 'agts_governance_evidence', measurement_source: 'PLUGIN', plugin: this.name, timestamp: new Date().toISOString(), subject_id: 'myDomain:action:v2.1', capability_certificate_id: '<sha256-hex>', deployment_artifact_hash: '<sha256-hex>', replay_seed: '<hex-or-uri>', gate_results: { G1: { result: 'PASS', confidence_interval_lower: 0.80, confidence_interval_upper: 0.95 }, G2: { result: 'PASS', causal_attribution: true, ablation_delta: 0.031 }, G3: { result: 'PASS', protected_metrics: { accuracy: 0.93 } }, G4: { result: 'PASS', evidence_class: 'HOOKED' }, G5: { result: 'PASS', operator_id: 'alice@example.com' }, }, evidence: { dataset_provenance_hash: '<sha256-hex>', evaluation_trace_hash: '<sha256-hex>', ablation_execution_log_hash: '<sha256-hex>', capability_certificate_hash: '<sha256-hex>', }, state_before_hash: '<sha256-hex>', state_after_hash: '<sha256-hex>', });

After this call: the clearinghouse assembles the AGTS_PROOF_BUNDLE_V1, initiates the validator round, and — if the quorum approves — submits the Governance Envelope to the transparency log.

Standard measurement types

TypeHCE effectWhen to use
plugin_registeredH↑Plugin initialization complete
plugin_errorH↓Internal plugin error
gate_passH↑ C↑ E↓Any single RTR gate (G1–G5) passes
gate_failH↓ C↓ E↑Any single RTR gate fails
agts_governance_evidenceH↑ C↑ E↓Full G1–G5 evidence set ready for Proof Bundle assembly
agts_envelope_admittedH↑ C↑ E↓Governance Envelope successfully admitted to log
agts_envelope_rejectedH↓ C↓ E↑Governance Envelope rejected by log or validator network
receipt_submittedH↑AGTS_SETTLEMENT_V1 successfully submitted
receipt_errorH↓Settlement receipt submission failed

Plugin lifecycle states

StateMeaningWhat happens
PROPOSEDRegistered, no gate passes yetNo Governance Envelope issuance
ACTIVEOperating normallyFull pipeline: evidence → validators → envelope → log
QUARANTINEDegraded — 3+ consecutive gate failuresEvidence accumulates; validator rounds suspended; alert emitted
LOCKBOXSuspended — 10+ consecutive failuresRead-only forensic state; no new measurements accepted
REJECTEDPermanent policy violationCannot be reactivated without full restart and re-registration

Iframe / postMessage bridge

If your domain UI is hosted in an iframe, bridge events via postMessage:

// From inside the iframe — emit governance evidence window.parent.postMessage({ type: 'AGTS_GOVERNANCE_EVIDENCE', payload: { plugin: 'myDomain', timestamp: new Date().toISOString(), subject_id: 'myDomain:action:id', gate_results: { G1: {...}, G2: {...}, G3: {...}, G4: {...}, G5: {...} }, evidence: { dataset_provenance_hash: '...', /* ... */ }, state_before_hash: '...', state_after_hash: '...', replay_seed: '...', }, }, '*'); // Single gate result window.parent.postMessage({ type: 'AGTS_GATE_RESULT', payload: { gate: 'G4', pass: true, evidence_class: 'HOOKED' }, }, '*');
Full normative plugin API → See domain examples → Start building →