@xshieldai/aegis-guard 0.3.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.
- package/README.md +16 -16
- package/package.json +2 -2
- package/src/acc-bus.ts +1 -1
- package/src/envelope.ts +1 -1
- package/src/index.ts +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @xshieldai/aegis-guard
|
|
2
2
|
|
|
3
|
-
> **🔍 Verification status (2026-05
|
|
4
|
-
> - **Tests:** ✅ **
|
|
5
|
-
> - **Examples:** ✅ runnable quickstart: [examples/quickstart.ts](examples/quickstart.ts) — `bun run examples/quickstart.ts` shows all 5 Locks in action with receipts
|
|
6
|
-
> - **Live demo:** ⚠️ planned (Tier 3, see [PROOF-STACK.md](
|
|
3
|
+
> **🔍 Verification status (2026-10-05 IST — v0.3.1)**
|
|
4
|
+
> - **Tests:** ✅ **70/70 passing** in the repository; the npm package ships `src/` only, so run them from a clone ([tests/aegis-guard.test.ts](https://github.com/rocketlang/aegis/blob/master/packages/aegis-guard/tests/aegis-guard.test.ts) — `bun test`)
|
|
5
|
+
> - **Examples:** ✅ runnable quickstart, in the repository (not in the npm package): [examples/quickstart.ts](https://github.com/rocketlang/aegis/blob/master/packages/aegis-guard/examples/quickstart.ts) — `bun run examples/quickstart.ts` shows all 5 Locks in action with receipts
|
|
6
|
+
> - **Live demo:** ⚠️ planned (Tier 3, see [PROOF-STACK.md](https://github.com/rocketlang/aegis/blob/master/PROOF-STACK.md))
|
|
7
7
|
> - **Phase-1 limits:** documented in the v0.2.0 ACC section below
|
|
8
8
|
|
|
9
9
|
AEGIS Guard SDK — reusable approval-token, nonce, idempotency, SENSE, and quality-evidence primitives for AEGIS-governed services.
|
|
@@ -25,9 +25,9 @@ The Five Locks were proven across 13 batches (62–74) of carbonx-backend. This
|
|
|
25
25
|
## Install
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
bun add @
|
|
28
|
+
bun add @xshieldai/aegis-guard
|
|
29
29
|
# or
|
|
30
|
-
npm install @
|
|
30
|
+
npm install @xshieldai/aegis-guard
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
@@ -35,7 +35,7 @@ npm install @rocketlang/aegis-guard
|
|
|
35
35
|
### LOCK_1 + LOCK_2 — decision + identity
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
|
-
import { verifyApprovalToken, verifyScopedApprovalToken } from '@
|
|
38
|
+
import { verifyApprovalToken, verifyScopedApprovalToken } from '@xshieldai/aegis-guard';
|
|
39
39
|
|
|
40
40
|
// LOCK_1 — base token verification (service_id + capability + operation)
|
|
41
41
|
const payload = verifyApprovalToken(token, 'my-service', 'settle', 'record_settle');
|
|
@@ -50,7 +50,7 @@ const payload = verifyScopedApprovalToken(
|
|
|
50
50
|
### LOCK_3 — observability (SENSE)
|
|
51
51
|
|
|
52
52
|
```typescript
|
|
53
|
-
import { emitAegisSenseEvent, digestApprovalToken, configureSenseTransport } from '@
|
|
53
|
+
import { emitAegisSenseEvent, digestApprovalToken, configureSenseTransport } from '@xshieldai/aegis-guard';
|
|
54
54
|
|
|
55
55
|
// Wire your logger (default: process.stdout JSON)
|
|
56
56
|
configureSenseTransport((event) => logger.info(event, `SENSE:${event.event_type}`));
|
|
@@ -73,7 +73,7 @@ emitAegisSenseEvent({
|
|
|
73
73
|
### LOCK_4 — rollback guard (idempotency check)
|
|
74
74
|
|
|
75
75
|
```typescript
|
|
76
|
-
import { checkIdempotency, buildIdempotencyFingerprint } from '@
|
|
76
|
+
import { checkIdempotency, buildIdempotencyFingerprint } from '@xshieldai/aegis-guard';
|
|
77
77
|
|
|
78
78
|
const existing = await db.findByExternalRef(args.externalRef);
|
|
79
79
|
const fp = buildIdempotencyFingerprint({ amount: args.amount, vessel_id: args.vesselId });
|
|
@@ -86,7 +86,7 @@ if (isDuplicate && !safeNoOp) throw new Error('payload mismatch on duplicate ext
|
|
|
86
86
|
### LOCK_5 — nonce replay prevention
|
|
87
87
|
|
|
88
88
|
```typescript
|
|
89
|
-
import { verifyAndConsumeNonce } from '@
|
|
89
|
+
import { verifyAndConsumeNonce } from '@xshieldai/aegis-guard';
|
|
90
90
|
|
|
91
91
|
// Requires nonce in payload; throws IrrNoApprovalError on missing or replayed nonce
|
|
92
92
|
await verifyAndConsumeNonce(payload, redisNonceStore);
|
|
@@ -95,7 +95,7 @@ await verifyAndConsumeNonce(payload, redisNonceStore);
|
|
|
95
95
|
### Quality evidence
|
|
96
96
|
|
|
97
97
|
```typescript
|
|
98
|
-
import { buildQualityMaskAtPromotion, meetsHgQualityRequirement } from '@
|
|
98
|
+
import { buildQualityMaskAtPromotion, meetsHgQualityRequirement } from '@xshieldai/aegis-guard';
|
|
99
99
|
|
|
100
100
|
const mask = buildQualityMaskAtPromotion({
|
|
101
101
|
tests_passed: true,
|
|
@@ -111,7 +111,7 @@ const ready = meetsHgQualityRequirement('HG-2B-financial', mask);
|
|
|
111
111
|
The default `defaultNonceStore` is in-memory (single-process only). Multi-instance deployments must provide a Redis-backed store:
|
|
112
112
|
|
|
113
113
|
```typescript
|
|
114
|
-
import { type NonceStore } from '@
|
|
114
|
+
import { type NonceStore } from '@xshieldai/aegis-guard';
|
|
115
115
|
|
|
116
116
|
const redisNonceStore: NonceStore = {
|
|
117
117
|
async consumeNonce(nonce, ttlMs) {
|
|
@@ -145,7 +145,7 @@ v0.2.0 behaves identically to v0.1.0 — no emission, no state, no side effect.
|
|
|
145
145
|
### Wire it in 3 lines
|
|
146
146
|
|
|
147
147
|
```typescript
|
|
148
|
-
import { setEventBus, type EventBus, type AccReceipt } from '@
|
|
148
|
+
import { setEventBus, type EventBus, type AccReceipt } from '@xshieldai/aegis-guard';
|
|
149
149
|
|
|
150
150
|
const myBus: EventBus = {
|
|
151
151
|
emit: (r: AccReceipt) => console.log(`[ACC] ${r.event_type} verdict=${r.verdict} ${r.summary}`),
|
|
@@ -200,12 +200,12 @@ consumers ingest these events without translation.
|
|
|
200
200
|
etc.) are a consumer choice — implement the `EventBus` interface and
|
|
201
201
|
call `setEventBus(yourBus)`.
|
|
202
202
|
|
|
203
|
-
### Use with `@
|
|
203
|
+
### Use with `@xshieldai/aegis-suite`
|
|
204
204
|
|
|
205
205
|
If you installed the meta-package, you can wire all 6 primitives in one call:
|
|
206
206
|
|
|
207
207
|
```typescript
|
|
208
|
-
import { wireAllToBus } from '@
|
|
208
|
+
import { wireAllToBus } from '@xshieldai/aegis-suite'; // available in suite v0.2.0+
|
|
209
209
|
wireAllToBus(); // default: in-memory bus + SQLite writer to ~/.aegis/acc-events.db
|
|
210
210
|
```
|
|
211
211
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xshieldai/aegis-guard",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "AEGIS Guard SDK — Five Locks primitives (approval-token, nonce, idempotency, SENSE, quality-evidence) + opt-in Agentic Control Center event bus for AEGIS-governed services",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Capt. Anil Sharma <capt.anil.sharma@powerpbox.org>",
|
|
8
|
-
"homepage": "https://github.com/rocketlang/aegis/tree/
|
|
8
|
+
"homepage": "https://github.com/rocketlang/aegis/tree/master/packages/aegis-guard",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/rocketlang/aegis.git",
|
package/src/acc-bus.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) 2026 Capt. Anil Sharma (rocketlang). All rights reserved.
|
|
3
3
|
// See LICENSE for details.
|
|
4
4
|
//
|
|
5
|
-
// @
|
|
5
|
+
// @xshieldai/aegis-guard — opt-in ACC event bus integration (v0.2.0)
|
|
6
6
|
// @rule:ACC-003 — Opt-in event bus. emit only when setEventBus() called.
|
|
7
7
|
// @rule:ACC-004 — Lightweight OSS receipt shape (strict subset of EE PRAMANA).
|
|
8
8
|
// @rule:ACC-YK-003 — Stateless-primitive contract preserved. No bus = no emit.
|
package/src/envelope.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @
|
|
1
|
+
// @xshieldai/aegis-guard — Agent Session Envelope helpers (ASE-T020)
|
|
2
2
|
//
|
|
3
3
|
// issueEnvelope — POST /api/v1/aegis/session — proxy-native agent frameworks use this at startup
|
|
4
4
|
// verifyEnvelope — GET /api/v1/aegis/sessions/:id/audit — check seal integrity + drift
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @
|
|
1
|
+
// @xshieldai/aegis-guard — AEGIS Guard SDK public API
|
|
2
2
|
// Five Locks proved in carbonx-backend (batches 62-74). Batch 93 makes them reusable.
|
|
3
3
|
// v0.2.0 adds opt-in Agentic Control Center (ACC) event bus integration.
|
|
4
4
|
|