@trigguard/protocol 0.1.1 → 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,24 +1,45 @@
1
- # `@trigguard/protocol`
1
+ # `@trigguard/protocol` (TypeScript SDK)
2
2
 
3
- The TrigGuard protocol defines the **contract for deterministic authorization decisions** between AI systems and execution surfaces: vocabulary (`PERMIT`, `DENY`, `SILENCE`), enforcement semantics, and the `DecisionRecord` shape used across aligned products and tooling.
3
+ [![npm version](https://img.shields.io/npm/v/@trigguard/protocol)](https://www.npmjs.com/package/@trigguard/protocol)
4
4
 
5
- **This package is governance and types only** not runtime evaluation, policy engines, or business logic. Those live elsewhere in the monorepo and **conform** to this contract.
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
- ## Install
7
+ **Language-agnostic specification:** [`spec/TG_PROTOCOL.md`](../../spec/TG_PROTOCOL.md) — this npm package is an SDK, not the full protocol.
8
+
9
+ **Runtime evaluation and policy engines** live in other packages and services; integrations **conform** to the spec.
10
+
11
+ ## Quick start
8
12
 
9
13
  ```bash
10
14
  npm install @trigguard/protocol
11
15
  ```
12
16
 
13
- *(Requires the package to be published to the npm registry under the `@trigguard` scope; see `docs/release/PROTOCOL_RELEASE.md`.)*
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
14
31
 
15
- Until publish is configured, depend on the repo:
32
+ Published on the public registry under the `@trigguard` scope. For release process, see `docs/release/PROTOCOL_RELEASE.md` in the monorepo.
33
+
34
+ **Develop inside the repo** (no registry), use a path or workspace:
16
35
 
17
36
  ```json
18
- "@trigguard/protocol": "file:../packages/protocol"
37
+ "@trigguard/protocol": "file:implementations/typescript"
19
38
  ```
20
39
 
21
- 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).
22
43
 
23
44
  ## Decision model
24
45
 
@@ -30,27 +51,7 @@ or install from a Git URL / workspace as documented in the main [TrigGuard repos
30
51
 
31
52
  Policy-only layers may restrict emitted decisions to **PERMIT** / **DENY**; full protocol surfaces also use **SILENCE** where applicable.
32
53
 
33
- ## Example import (TypeScript)
34
-
35
- ```typescript
36
- import {
37
- type Decision,
38
- type DecisionRecord,
39
- DECISION,
40
- DECISIONS,
41
- SILENCE_DEFINITION,
42
- } from "@trigguard/protocol";
43
-
44
- const d: Decision = "PERMIT";
45
- const record: DecisionRecord = {
46
- decision: DECISION.PERMIT,
47
- enforcement: "EXECUTED",
48
- reason_code: "NO_POLICY_VIOLATION",
49
- timestamp: new Date().toISOString(),
50
- };
51
- ```
52
-
53
- 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`.
54
55
 
55
56
  ## Subpath exports (JSON)
56
57
 
@@ -63,7 +64,7 @@ const contract = require("@trigguard/protocol/contract");
63
64
 
64
65
  ## Build (maintainers / CI)
65
66
 
66
- From `packages/protocol`:
67
+ From `implementations/typescript`:
67
68
 
68
69
  ```bash
69
70
  npm install
@@ -74,7 +75,7 @@ npm run build
74
75
 
75
76
  ## Repository
76
77
 
77
- 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/)).
78
79
 
79
80
  For installation paths and release tagging, see:
80
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.1",
4
- "description": "Canonical TrigGuard protocol types and contract snapshots (governance layer, not business logic).",
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": {