@trigguard/protocol 0.1.2 → 0.1.3

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,26 +1,45 @@
1
- # TrigGuard Protocol
1
+ # `@trigguard/protocol` (TypeScript SDK)
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@trigguard/protocol)](https://www.npmjs.com/package/@trigguard/protocol)
4
4
 
5
- Canonical protocol definitions for TrigGuard governance decisions: vocabulary (`PERMIT`, `DENY`, `SILENCE`), enforcement semantics, and the `DecisionRecord` shape used across products and tooling.
5
+ **Reference implementation** for the TrigGuard protocol in TypeScript: vocabulary (`PERMIT`, `DENY`, `SILENCE`), enforcement semantics, and the `DecisionRecord` shape, plus JSON snapshots aligned with [`core/contracts/decision_contract.json`](../../core/contracts/decision_contract.json).
6
6
 
7
- **Package name:** `@trigguard/protocol` — types and contract snapshots; runtime evaluation and policy engines live in other packages and services. Integrations **conform** to this contract.
7
+ **Language-agnostic specification:** [`spec/TG_PROTOCOL.md`](../../spec/TG_PROTOCOL.md)this npm package is an SDK, not the full protocol.
8
8
 
9
- ## Install
9
+ **Runtime evaluation and policy engines** live in other packages and services; integrations **conform** to the spec.
10
+
11
+ ## Quick start
10
12
 
11
13
  ```bash
12
14
  npm install @trigguard/protocol
13
15
  ```
14
16
 
17
+ ```typescript
18
+ import { DECISION, ENFORCEMENT, type DecisionRecord } from "@trigguard/protocol";
19
+
20
+ const record: DecisionRecord = {
21
+ decision: DECISION.PERMIT,
22
+ enforcement: ENFORCEMENT.EXECUTED,
23
+ reason_code: "NO_POLICY_VIOLATION",
24
+ timestamp: new Date().toISOString(),
25
+ };
26
+ ```
27
+
28
+ There is **no** `evaluate()` or `validateDecision()` in this package — only **types and canonical constants** so your code matches [`spec/TG_PROTOCOL.md`](../../spec/TG_PROTOCOL.md). For JSON Schema and contract JSON via subpaths, see [Subpath exports](#subpath-exports-json).
29
+
30
+ ## Install and paths
31
+
15
32
  Published on the public registry under the `@trigguard` scope. For release process, see `docs/release/PROTOCOL_RELEASE.md` in the monorepo.
16
33
 
17
34
  **Develop inside the repo** (no registry), use a path or workspace:
18
35
 
19
36
  ```json
20
- "@trigguard/protocol": "file:../packages/protocol"
37
+ "@trigguard/protocol": "file:implementations/typescript"
21
38
  ```
22
39
 
23
- or install from a Git URL / workspace as documented in the main [TrigGuard repository](https://github.com/TrigGuard-AI/TrigGuard).
40
+ (From a package at the repository root. From `packages/*`, use `file:../../implementations/typescript`.)
41
+
42
+ Or install from a Git URL / workspace as documented in the main [TrigGuard repository](https://github.com/TrigGuard-AI/TrigGuard).
24
43
 
25
44
  ## Decision model
26
45
 
@@ -32,27 +51,7 @@ or install from a Git URL / workspace as documented in the main [TrigGuard repos
32
51
 
33
52
  Policy-only layers may restrict emitted decisions to **PERMIT** / **DENY**; full protocol surfaces also use **SILENCE** where applicable.
34
53
 
35
- ## Example import (TypeScript)
36
-
37
- ```typescript
38
- import {
39
- type Decision,
40
- type DecisionRecord,
41
- DECISION,
42
- DECISIONS,
43
- SILENCE_DEFINITION,
44
- } from "@trigguard/protocol";
45
-
46
- const d: Decision = "PERMIT";
47
- const record: DecisionRecord = {
48
- decision: DECISION.PERMIT,
49
- enforcement: "EXECUTED",
50
- reason_code: "NO_POLICY_VIOLATION",
51
- timestamp: new Date().toISOString(),
52
- };
53
- ```
54
-
55
- There is **no** `evaluate()` in this package — evaluation lives in TrigGuard services and kernels. This package supplies **types and canonical constants** so callers and SDKs share one contract.
54
+ Other useful exports: `type Decision`, `DECISIONS`, `SILENCE_DEFINITION`, `REASON_CODES`, `decisionContract`.
56
55
 
57
56
  ## Subpath exports (JSON)
58
57
 
@@ -65,7 +64,7 @@ const contract = require("@trigguard/protocol/contract");
65
64
 
66
65
  ## Build (maintainers / CI)
67
66
 
68
- From `packages/protocol`:
67
+ From `implementations/typescript`:
69
68
 
70
69
  ```bash
71
70
  npm install
@@ -76,7 +75,7 @@ npm run build
76
75
 
77
76
  ## Repository
78
77
 
79
- Canonical source: [github.com/TrigGuard-AI/TrigGuard](https://github.com/TrigGuard-AI/TrigGuard) — `packages/protocol/`.
78
+ Canonical source: [github.com/TrigGuard-AI/TrigGuard](https://github.com/TrigGuard-AI/TrigGuard) — `implementations/typescript/` (spec: [`spec/`](../spec/)).
80
79
 
81
80
  For installation paths and release tagging, see:
82
81
 
package/dist/schema.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "title": "TrigGuardCanonicalDecisionRecord",
4
- "description": "Authoritative shape for protocol decision records. reason_code values align with core/contracts/decision_contract.json reasonCode registry.",
4
+ "description": "Authoritative shape for protocol decision records. reason_code values align with core/contracts/decision_contract.json reasonCode registry. Keep spec/decision_contract.schema.json and implementations/typescript/src/schema.json byte-identical (CI: scripts/check_protocol_sync.sh).",
5
5
  "type": "object",
6
6
  "required": ["decision", "enforcement", "reason_code", "timestamp"],
7
7
  "properties": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@trigguard/protocol",
3
- "version": "0.1.2",
4
- "description": "Shared TypeScript types and JSON contract snapshots for TrigGuard authorization decisions and records.",
3
+ "version": "0.1.3",
4
+ "description": "TypeScript SDK: types and JSON snapshots for the TrigGuard protocol (see repository spec/).",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {