@vorionsys/cognigate 1.0.0 → 1.0.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
@@ -1,270 +1,460 @@
1
- # @vorion/cognigate
2
-
3
- Official TypeScript SDK for the [Cognigate](https://cognigate.dev) AI Governance API.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @vorionsys/cognigate
9
- ```
10
-
11
- ## Quick Start
12
-
13
- ```typescript
14
- import { Cognigate } from '@vorionsys/cognigate';
15
-
16
- const client = new Cognigate({
17
- apiKey: process.env.COGNIGATE_API_KEY,
18
- });
19
-
20
- // Get trust status for an agent
21
- const status = await client.trust.getStatus('agent-123');
22
- console.log(`Trust Score: ${status.trustScore}`);
23
- console.log(`Tier: ${status.tierName}`);
24
- console.log(`Capabilities: ${status.capabilities.join(', ')}`);
25
- ```
26
-
27
- ## Features
28
-
29
- - **Full TypeScript Support**: Complete type definitions with Zod runtime validation
30
- - **Trust Management**: Query and update agent trust scores
31
- - **Governance Enforcement**: Parse intents and enforce governance rules
32
- - **Proof Chain**: Immutable audit trail for all agent actions
33
- - **Webhook Support**: Handle Cognigate webhooks with signature verification
34
-
35
- ## API Reference
36
-
37
- ### Initialization
38
-
39
- ```typescript
40
- const client = new Cognigate({
41
- apiKey: 'your-api-key', // Required
42
- baseUrl: 'https://...', // Optional: custom API URL
43
- timeout: 30000, // Optional: request timeout in ms
44
- retries: 3, // Optional: number of retries
45
- debug: false, // Optional: enable debug logging
46
- webhookSecret: 'secret', // Optional: for webhook verification
47
- });
48
- ```
49
-
50
- ### Agents
51
-
52
- ```typescript
53
- // List agents
54
- const agents = await client.agents.list({ status: 'ACTIVE' });
55
-
56
- // Get agent
57
- const agent = await client.agents.get('agent-123');
58
-
59
- // Create agent
60
- const newAgent = await client.agents.create({
61
- name: 'DataProcessor',
62
- description: 'Processes data pipelines',
63
- template: 'data-processor',
64
- });
65
-
66
- // Update agent
67
- await client.agents.update('agent-123', { name: 'New Name' });
68
-
69
- // Pause/Resume
70
- await client.agents.pause('agent-123');
71
- await client.agents.resume('agent-123');
72
-
73
- // Delete agent
74
- await client.agents.delete('agent-123');
75
- ```
76
-
77
- ### Trust
78
-
79
- ```typescript
80
- // Get trust status
81
- const status = await client.trust.getStatus('agent-123');
82
- // Returns: { trustScore, trustTier, tierName, capabilities, factorScores, ... }
83
-
84
- // Get trust history
85
- const history = await client.trust.getHistory('agent-123', {
86
- from: new Date('2024-01-01'),
87
- limit: 100,
88
- });
89
-
90
- // Submit outcome (updates trust score)
91
- const updated = await client.trust.submitOutcome('agent-123', 'proof-456', {
92
- success: true,
93
- metrics: { latency: 234, accuracy: 0.98 },
94
- });
95
- ```
96
-
97
- ### Governance
98
-
99
- ```typescript
100
- // Parse intent
101
- const parsed = await client.governance.parseIntent(
102
- 'agent-123',
103
- 'Read customer data from the sales database'
104
- );
105
-
106
- // Enforce governance
107
- const result = await client.governance.enforce(parsed.intent);
108
- // Returns: { decision, trustScore, grantedCapabilities, reasoning, proofId }
109
-
110
- // Combined: parse + enforce
111
- const { intent, result } = await client.governance.evaluate(
112
- 'agent-123',
113
- 'Send email to customer'
114
- );
115
-
116
- if (result.decision === 'ALLOW') {
117
- // Proceed with action
118
- } else if (result.decision === 'ESCALATE') {
119
- // Request human approval
120
- } else {
121
- // Action denied
122
- console.log(result.reasoning);
123
- }
124
-
125
- // Check capability without creating proof
126
- const check = await client.governance.canPerform(
127
- 'agent-123',
128
- 'write_file',
129
- ['file_write', 'approved_directories']
130
- );
131
- ```
132
-
133
- ### Proofs
134
-
135
- ```typescript
136
- // Get proof record
137
- const proof = await client.proofs.get('proof-123');
138
-
139
- // List proofs for entity
140
- const proofs = await client.proofs.list('agent-123', {
141
- from: new Date('2024-01-01'),
142
- outcome: 'SUCCESS',
143
- });
144
-
145
- // Get chain statistics
146
- const stats = await client.proofs.getStats('agent-123');
147
- // Returns: { totalRecords, successRate, averageTrustScore, chainIntegrity }
148
-
149
- // Verify chain integrity
150
- const verification = await client.proofs.verify('agent-123');
151
- ```
152
-
153
- ### Webhooks
154
-
155
- ```typescript
156
- import { WebhookRouter, parseWebhookPayload } from '@vorionsys/cognigate';
157
-
158
- const router = new WebhookRouter();
159
-
160
- // Handle specific events
161
- router.on('trust.tier_changed', async (event) => {
162
- console.log(`Agent ${event.entityId} tier changed:`, event.payload);
163
- });
164
-
165
- router.on('governance.decision', async (event) => {
166
- if (event.payload.decision === 'ESCALATE') {
167
- // Alert human reviewer
168
- }
169
- });
170
-
171
- // Handle all events
172
- router.onAll(async (event) => {
173
- await logEvent(event);
174
- });
175
-
176
- // Express middleware
177
- app.post('/webhooks/cognigate', router.middleware(process.env.WEBHOOK_SECRET));
178
-
179
- // Or manual verification
180
- app.post('/webhooks/cognigate', async (req, res) => {
181
- try {
182
- const event = await parseWebhookPayload(
183
- req.body,
184
- req.headers['x-cognigate-signature'],
185
- process.env.WEBHOOK_SECRET
186
- );
187
- await router.handle(event);
188
- res.json({ received: true });
189
- } catch (error) {
190
- res.status(400).json({ error: error.message });
191
- }
192
- });
193
- ```
194
-
195
- ### Trust Tiers
196
-
197
- ```typescript
198
- import { Cognigate, TrustTier, TIER_THRESHOLDS } from '@vorionsys/cognigate';
199
-
200
- // Get tier from score
201
- const tier = Cognigate.getTierFromScore(750);
202
- // Returns: TrustTier.T4_OPERATIONAL
203
-
204
- // Get tier name
205
- const name = Cognigate.getTierName(TrustTier.T5_TRUSTED);
206
- // Returns: "Trusted"
207
-
208
- // Get tier thresholds
209
- const thresholds = Cognigate.getTierThresholds(TrustTier.T4_OPERATIONAL);
210
- // Returns: { min: 650, max: 799, name: "Operational" }
211
-
212
- // All tiers
213
- console.log(TIER_THRESHOLDS);
214
- // T0_SANDBOX: 0-199
215
- // T1_OBSERVED: 200-349
216
- // T2_PROVISIONAL: 350-499
217
- // T3_VERIFIED: 500-649
218
- // T4_OPERATIONAL: 650-799
219
- // T5_TRUSTED: 800-875
220
- // T6_CERTIFIED: 876-949
221
- // T7_AUTONOMOUS: 950-1000
222
- ```
223
-
224
- ## Error Handling
225
-
226
- ```typescript
227
- import { Cognigate, CognigateError } from '@vorionsys/cognigate';
228
-
229
- try {
230
- const status = await client.trust.getStatus('invalid-id');
231
- } catch (error) {
232
- if (error instanceof CognigateError) {
233
- console.log('Code:', error.code);
234
- console.log('Message:', error.message);
235
- console.log('Status:', error.status);
236
- console.log('Details:', error.details);
237
- }
238
- }
239
- ```
240
-
241
- ## TypeScript Types
242
-
243
- All types are exported and can be imported:
244
-
245
- ```typescript
246
- import type {
247
- Agent,
248
- TrustStatus,
249
- GovernanceResult,
250
- Intent,
251
- ProofRecord,
252
- WebhookEvent,
253
- TrustTier,
254
- GovernanceDecision,
255
- } from '@vorionsys/cognigate';
256
- ```
257
-
258
- ## Runtime Validation
259
-
260
- Zod schemas are exported for runtime validation:
261
-
262
- ```typescript
263
- import { TrustStatusSchema, AgentSchema } from '@vorionsys/cognigate';
264
-
265
- const validatedStatus = TrustStatusSchema.parse(untrustedData);
266
- ```
267
-
268
- ## License
269
-
270
- MIT
1
+ # @vorionsys/cognigate
2
+
3
+ Real-time AI governance decision engine -- the TypeScript SDK for the [Cognigate](https://cognigate.dev) API.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@vorionsys/cognigate)](https://www.npmjs.com/package/@vorionsys/cognigate)
6
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
+
8
+ ---
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @vorionsys/cognigate
14
+ ```
15
+
16
+ ## What is Cognigate?
17
+
18
+ **Cognigate** is Vorion's real-time AI governance decision engine. It sits between your AI agents and the actions they want to perform, evaluating every request against trust scores, capability policies, and risk levels before granting or denying permission. Every decision is recorded as an immutable proof record, creating a tamper-evident audit trail.
19
+
20
+ Cognigate implements the trust-tier model defined by the **BASIS** (Baseline Authority for Safe & Interoperable Systems) specification. BASIS defines eight trust tiers (T0 through T7) that govern what an AI agent is allowed to do based on its demonstrated track record. As agents prove reliability, they earn higher trust scores and unlock broader capabilities -- all enforced automatically by Cognigate.
21
+
22
+ ### Core concepts
23
+
24
+ | Concept | Description |
25
+ |---|---|
26
+ | **Trust Score** | A 0--1000 numeric score reflecting an agent's reliability. Computed from outcomes, compliance, and behavioral signals. |
27
+ | **Trust Tier** | One of eight BASIS tiers (T0 Sandbox through T7 Autonomous) derived from the trust score. Each tier grants a specific set of capabilities. |
28
+ | **Governance Decision** | The verdict for a requested action: `ALLOW`, `DENY`, `ESCALATE` (requires human approval), or `DEGRADE` (partial access). |
29
+ | **Intent** | A structured representation of what an agent wants to do, parsed from natural-language input. |
30
+ | **Proof Record** | An immutable, hash-chained audit entry recording each governance decision and its outcome. |
31
+ | **Proof Bridge** | Optional integration that forwards Cognigate decisions to the Vorion Proof Plane for cross-system audit trails. |
32
+
33
+ ---
34
+
35
+ ## Quick start
36
+
37
+ ```typescript
38
+ import { Cognigate } from '@vorionsys/cognigate';
39
+
40
+ const client = new Cognigate({
41
+ apiKey: process.env.COGNIGATE_API_KEY!,
42
+ });
43
+
44
+ // 1. Register an agent
45
+ const agent = await client.agents.create({
46
+ name: 'DataProcessor',
47
+ description: 'ETL pipeline agent',
48
+ initialCapabilities: ['read_database', 'write_s3'],
49
+ });
50
+
51
+ // 2. Check trust status
52
+ const status = await client.trust.getStatus(agent.id);
53
+ console.log(`Trust Score: ${status.trustScore}`);
54
+ console.log(`Tier: ${status.tierName}`);
55
+ console.log(`Capabilities: ${status.capabilities.join(', ')}`);
56
+
57
+ // 3. Evaluate a governance request (parse intent + enforce)
58
+ const { intent, result } = await client.governance.evaluate(
59
+ agent.id,
60
+ 'Read customer data from the sales database'
61
+ );
62
+
63
+ if (result.decision === 'ALLOW') {
64
+ console.log('Proceeding -- granted:', result.grantedCapabilities);
65
+ } else if (result.decision === 'ESCALATE') {
66
+ console.log('Needs human approval:', result.reasoning);
67
+ } else {
68
+ console.log('Blocked:', result.reasoning);
69
+ }
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Usage examples
75
+
76
+ ### Creating and managing agents
77
+
78
+ ```typescript
79
+ import { Cognigate } from '@vorionsys/cognigate';
80
+
81
+ const client = new Cognigate({ apiKey: process.env.COGNIGATE_API_KEY! });
82
+
83
+ // List all active agents
84
+ const agents = await client.agents.list({ status: 'ACTIVE' });
85
+ console.log(`Found ${agents.total} active agents`);
86
+
87
+ // Get a specific agent
88
+ const agent = await client.agents.get('agent-123');
89
+
90
+ // Create an agent
91
+ const newAgent = await client.agents.create({
92
+ name: 'DataProcessor',
93
+ description: 'Processes data pipelines',
94
+ template: 'data-processor',
95
+ initialCapabilities: ['read_database'],
96
+ });
97
+
98
+ // Update an agent
99
+ await client.agents.update('agent-123', { name: 'RenamedAgent' });
100
+
101
+ // Pause / Resume
102
+ await client.agents.pause('agent-123');
103
+ await client.agents.resume('agent-123');
104
+
105
+ // Delete an agent
106
+ await client.agents.delete('agent-123');
107
+ ```
108
+
109
+ ### Querying trust status and history
110
+
111
+ ```typescript
112
+ // Get current trust status
113
+ const status = await client.trust.getStatus('agent-123');
114
+ // Returns: { trustScore, trustTier, tierName, capabilities, factorScores, compliant, warnings, ... }
115
+
116
+ // Get trust history over a time range
117
+ const history = await client.trust.getHistory('agent-123', {
118
+ from: new Date('2026-01-01'),
119
+ limit: 100,
120
+ });
121
+
122
+ // Submit an outcome to update the trust score
123
+ const updated = await client.trust.submitOutcome('agent-123', 'proof-456', {
124
+ success: true,
125
+ metrics: { latency: 234, accuracy: 0.98 },
126
+ notes: 'Completed ETL run without errors',
127
+ });
128
+ ```
129
+
130
+ ### Submitting governance requests and checking decisions
131
+
132
+ ```typescript
133
+ // Option A: Parse intent, then enforce separately
134
+ const parsed = await client.governance.parseIntent(
135
+ 'agent-123',
136
+ 'Read customer data from the sales database'
137
+ );
138
+ console.log(`Parsed action: ${parsed.intent.parsedAction}`);
139
+ console.log(`Risk level: ${parsed.intent.riskLevel}`);
140
+ console.log(`Confidence: ${parsed.confidence}`);
141
+
142
+ const result = await client.governance.enforce(parsed.intent);
143
+ // result.decision is 'ALLOW' | 'DENY' | 'ESCALATE' | 'DEGRADE'
144
+
145
+ // Option B: Combined parse + enforce in one call
146
+ const { intent, result: govResult } = await client.governance.evaluate(
147
+ 'agent-123',
148
+ 'Send email to customer'
149
+ );
150
+
151
+ if (govResult.decision === 'ALLOW') {
152
+ // Proceed -- action is permitted
153
+ } else if (govResult.decision === 'ESCALATE') {
154
+ // Request human approval
155
+ } else if (govResult.decision === 'DEGRADE') {
156
+ // Partial access: check govResult.grantedCapabilities
157
+ } else {
158
+ // DENY
159
+ console.log('Denied:', govResult.reasoning);
160
+ }
161
+
162
+ // Quick capability check (no proof record created)
163
+ const check = await client.governance.canPerform(
164
+ 'agent-123',
165
+ 'write_file',
166
+ ['file_write', 'approved_directories']
167
+ );
168
+ console.log(check.allowed, check.reason);
169
+ ```
170
+
171
+ ### Querying the proof chain
172
+
173
+ ```typescript
174
+ // Get a specific proof record
175
+ const proof = await client.proofs.get('proof-123');
176
+
177
+ // List proofs for an entity
178
+ const proofs = await client.proofs.list('agent-123', {
179
+ from: new Date('2026-01-01'),
180
+ outcome: 'SUCCESS',
181
+ pageSize: 50,
182
+ });
183
+
184
+ // Get chain statistics
185
+ const stats = await client.proofs.getStats('agent-123');
186
+ // Returns: { totalRecords, successRate, averageTrustScore, chainIntegrity }
187
+
188
+ // Verify proof chain integrity (hash-chain validation)
189
+ const verification = await client.proofs.verify('agent-123');
190
+ console.log('Chain valid:', verification.valid);
191
+ if (verification.errors.length > 0) {
192
+ console.error('Integrity errors:', verification.errors);
193
+ }
194
+ ```
195
+
196
+ ### Handling webhooks
197
+
198
+ ```typescript
199
+ import { WebhookRouter, parseWebhookPayload } from '@vorionsys/cognigate';
200
+
201
+ const router = new WebhookRouter();
202
+
203
+ // Handle specific event types
204
+ router.on('trust.tier_changed', async (event) => {
205
+ console.log(`Agent ${event.entityId} tier changed:`, event.payload);
206
+ });
207
+
208
+ router.on('governance.decision', async (event) => {
209
+ if (event.payload.decision === 'ESCALATE') {
210
+ // Alert a human reviewer
211
+ }
212
+ });
213
+
214
+ // Handle all events (logging, analytics, etc.)
215
+ router.onAll(async (event) => {
216
+ await logEvent(event);
217
+ });
218
+
219
+ // Express middleware (signature verification included)
220
+ app.post('/webhooks/cognigate', router.middleware(process.env.WEBHOOK_SECRET!));
221
+
222
+ // Or verify manually
223
+ app.post('/webhooks/cognigate', async (req, res) => {
224
+ try {
225
+ const event = await parseWebhookPayload(
226
+ req.body,
227
+ req.headers['x-cognigate-signature'] as string,
228
+ process.env.WEBHOOK_SECRET!
229
+ );
230
+ await router.handle(event);
231
+ res.json({ received: true });
232
+ } catch (error) {
233
+ res.status(400).json({ error: (error as Error).message });
234
+ }
235
+ });
236
+ ```
237
+
238
+ ### Proof Bridge (Proof Plane integration)
239
+
240
+ The proof bridge forwards Cognigate `governance.decision` webhook events to the Vorion Proof Plane, creating cross-system `DECISION_MADE` audit records.
241
+
242
+ ```typescript
243
+ import { WebhookRouter } from '@vorionsys/cognigate';
244
+ import { createProofBridge } from '@vorionsys/cognigate/proof-bridge';
245
+ import { ProofPlane, memoryStore } from '@vorionsys/proof-plane';
246
+
247
+ const router = new WebhookRouter();
248
+ const proofPlane = new ProofPlane({ storage: memoryStore() });
249
+
250
+ const bridge = createProofBridge({
251
+ proofPlane,
252
+ webhookRouter: router,
253
+ });
254
+
255
+ // governance.decision events now automatically emit DECISION_MADE proofs
256
+
257
+ // Later, disconnect the bridge:
258
+ bridge.disconnect();
259
+ ```
260
+
261
+ ### Trust tiers (BASIS specification)
262
+
263
+ ```typescript
264
+ import { Cognigate, TrustTier, TIER_THRESHOLDS } from '@vorionsys/cognigate';
265
+
266
+ // Derive tier from score
267
+ const tier = Cognigate.getTierFromScore(750);
268
+ // Returns: TrustTier.T4_STANDARD
269
+
270
+ // Get human-readable tier name
271
+ const name = Cognigate.getTierName(TrustTier.T5_TRUSTED);
272
+ // Returns: "Trusted"
273
+
274
+ // Get score thresholds for a tier
275
+ const thresholds = Cognigate.getTierThresholds(TrustTier.T4_STANDARD);
276
+ // Returns: { min: 650, max: 799, name: "Standard" }
277
+ ```
278
+
279
+ The eight BASIS trust tiers:
280
+
281
+ | Tier | Score range | Name | Description |
282
+ |---|---|---|---|
283
+ | T0 | 0--199 | Sandbox | Isolated, no external access |
284
+ | T1 | 200--349 | Observed | Read-only, monitored |
285
+ | T2 | 350--499 | Provisional | Basic operations, supervised |
286
+ | T3 | 500--649 | Monitored | Standard operations with monitoring |
287
+ | T4 | 650--799 | Standard | External API access, policy-governed |
288
+ | T5 | 800--875 | Trusted | Cross-agent communication |
289
+ | T6 | 876--950 | Certified | Admin tasks, minimal oversight |
290
+ | T7 | 951--1000 | Autonomous | Full autonomy, self-governance |
291
+
292
+ ### Error handling
293
+
294
+ ```typescript
295
+ import { Cognigate, CognigateError } from '@vorionsys/cognigate';
296
+
297
+ try {
298
+ const status = await client.trust.getStatus('invalid-id');
299
+ } catch (error) {
300
+ if (error instanceof CognigateError) {
301
+ console.log('Code:', error.code); // e.g. 'NOT_FOUND'
302
+ console.log('Message:', error.message); // e.g. 'Entity not found'
303
+ console.log('Status:', error.status); // e.g. 404
304
+ console.log('Details:', error.details); // additional context
305
+ }
306
+ }
307
+ ```
308
+
309
+ The client automatically retries server errors (5xx) with exponential backoff. Client errors (4xx) are thrown immediately.
310
+
311
+ ---
312
+
313
+ ## API reference
314
+
315
+ ### Main export: `@vorionsys/cognigate`
316
+
317
+ #### Classes
318
+
319
+ | Export | Description |
320
+ |---|---|
321
+ | `Cognigate` | Main SDK client. Instantiate with `CognigateConfig` to access all sub-clients. |
322
+ | `CognigateError` | Error class with `code`, `status`, and `details` properties. |
323
+ | `WebhookRouter` | Event router for Cognigate webhooks with Express middleware support. |
324
+
325
+ #### Sub-clients (accessed via `Cognigate` instance)
326
+
327
+ | Property | Type | Description |
328
+ |---|---|---|
329
+ | `client.agents` | `AgentsClient` | CRUD operations for agents: `list`, `get`, `create`, `update`, `delete`, `pause`, `resume`. |
330
+ | `client.trust` | `TrustClient` | Trust score queries: `getStatus`, `getHistory`, `submitOutcome`. |
331
+ | `client.governance` | `GovernanceClient` | Governance enforcement: `parseIntent`, `enforce`, `evaluate`, `canPerform`. |
332
+ | `client.proofs` | `ProofsClient` | Proof chain access: `get`, `list`, `getStats`, `verify`. |
333
+
334
+ #### Static methods on `Cognigate`
335
+
336
+ | Method | Description |
337
+ |---|---|
338
+ | `Cognigate.getTierFromScore(score)` | Convert a 0--1000 score to a `TrustTier` enum value. |
339
+ | `Cognigate.getTierName(tier)` | Get the human-readable name of a tier. |
340
+ | `Cognigate.getTierThresholds(tier)` | Get `{ min, max, name }` for a tier. |
341
+
342
+ #### Enums and constants
343
+
344
+ | Export | Description |
345
+ |---|---|
346
+ | `TrustTier` | Enum: `T0_SANDBOX` through `T7_AUTONOMOUS`. |
347
+ | `TIER_THRESHOLDS` | Mapping from `TrustTier` to `{ min, max, name }`. |
348
+
349
+ #### Types
350
+
351
+ | Type | Description |
352
+ |---|---|
353
+ | `CognigateConfig` | Client configuration: `apiKey`, `baseUrl?`, `timeout?`, `retries?`, `debug?`, `webhookSecret?`. |
354
+ | `Agent` | Registered agent record. |
355
+ | `CreateAgentRequest` | Payload for creating an agent. |
356
+ | `UpdateAgentRequest` | Payload for updating an agent. |
357
+ | `TrustStatus` | Trust score, tier, capabilities, factor scores, compliance status. |
358
+ | `GovernanceDecision` | Union: `'ALLOW' \| 'DENY' \| 'ESCALATE' \| 'DEGRADE'`. |
359
+ | `GovernanceResult` | Full decision result with reasoning, capabilities, constraints, and proof ID. |
360
+ | `Intent` | Structured representation of a parsed action request. |
361
+ | `IntentParseResult` | Parse result with confidence score and alternative interpretations. |
362
+ | `ProofRecord` | Immutable hash-chained audit record for a single decision. |
363
+ | `ProofChainStats` | Aggregate stats: total records, success rate, average score, chain integrity. |
364
+ | `WebhookEvent` | Webhook payload with type, entity ID, and signature. |
365
+ | `WebhookEventType` | Union of all supported event types (e.g. `'trust.tier_changed'`). |
366
+ | `ApiResponse<T>` | Standard API response wrapper. |
367
+ | `ApiError` | API error structure. |
368
+ | `PaginatedResponse<T>` | Paginated list with `items`, `total`, `page`, `pageSize`, `hasMore`. |
369
+ | `AgentsClient` | Type of the agents sub-client. |
370
+ | `TrustClient` | Type of the trust sub-client. |
371
+ | `GovernanceClient` | Type of the governance sub-client. |
372
+ | `ProofsClient` | Type of the proofs sub-client. |
373
+
374
+ #### Zod schemas (runtime validation)
375
+
376
+ | Export | Validates |
377
+ |---|---|
378
+ | `TrustStatusSchema` | `TrustStatus` objects |
379
+ | `GovernanceResultSchema` | `GovernanceResult` objects |
380
+ | `ProofRecordSchema` | `ProofRecord` objects |
381
+ | `AgentSchema` | `Agent` objects |
382
+
383
+ #### Webhook utilities
384
+
385
+ | Export | Description |
386
+ |---|---|
387
+ | `verifyWebhookSignature(payload, signature, secret)` | HMAC-SHA256 signature verification with timing-safe comparison. |
388
+ | `parseWebhookPayload(body, signature, secret)` | Verify signature and parse the webhook body into a `WebhookEvent`. |
389
+ | `WebhookRouter` | Event router: `on(type, handler)`, `onAll(handler)`, `handle(event)`, `middleware(secret)`. |
390
+
391
+ ### Sub-export: `@vorionsys/cognigate/proof-bridge`
392
+
393
+ | Export | Description |
394
+ |---|---|
395
+ | `createProofBridge(config)` | Create a bridge forwarding `governance.decision` webhooks to the Proof Plane. Returns a `ProofBridgeHandle`. |
396
+ | `ProofPlaneEmitter` | Structural interface for Proof Plane integration (avoids hard dependency on `@vorionsys/proof-plane`). |
397
+ | `ProofBridgeConfig` | Config: `{ proofPlane, webhookRouter }`. |
398
+ | `ProofBridgeHandle` | Handle with `disconnect()` method to stop forwarding. |
399
+
400
+ ---
401
+
402
+ ## Webhook event types
403
+
404
+ | Event type | Fired when |
405
+ |---|---|
406
+ | `agent.created` | A new agent is registered |
407
+ | `agent.updated` | An agent's configuration changes |
408
+ | `agent.deleted` | An agent is deleted |
409
+ | `agent.status_changed` | An agent's status changes (active/paused/suspended) |
410
+ | `trust.score_changed` | An agent's trust score is updated |
411
+ | `trust.tier_changed` | An agent's trust tier changes |
412
+ | `governance.decision` | A governance decision is rendered |
413
+ | `proof.recorded` | A proof record is committed to the chain |
414
+ | `alert.triggered` | A system or compliance alert fires |
415
+
416
+ ---
417
+
418
+ ## Configuration reference
419
+
420
+ ```typescript
421
+ interface CognigateConfig {
422
+ /** API key (required). */
423
+ apiKey: string;
424
+ /** Base URL for the Cognigate API. Default: https://cognigate.dev/v1 */
425
+ baseUrl?: string;
426
+ /** Request timeout in milliseconds. Default: 30000 */
427
+ timeout?: number;
428
+ /** Number of retries for server errors. Default: 3 */
429
+ retries?: number;
430
+ /** Enable debug logging. Default: false */
431
+ debug?: boolean;
432
+ /** Webhook signing secret for signature verification. */
433
+ webhookSecret?: string;
434
+ }
435
+ ```
436
+
437
+ ---
438
+
439
+ ## Requirements
440
+
441
+ - Node.js >= 18.0.0
442
+ - TypeScript >= 5.0.0 (peer dependency)
443
+
444
+ ---
445
+
446
+ ## License
447
+
448
+ [Apache-2.0](./LICENSE)
449
+
450
+ ---
451
+
452
+ ## Contributing
453
+
454
+ This package is part of the [Vorion monorepo](https://github.com/vorionsys/vorion). See the root `CONTRIBUTING.md` for guidelines.
455
+
456
+ ## Links
457
+
458
+ - [Cognigate API Documentation](https://cognigate.dev)
459
+ - [Vorion Monorepo](https://github.com/vorionsys/vorion)
460
+ - [npm: @vorionsys/cognigate](https://www.npmjs.com/package/@vorionsys/cognigate)