@suveren/gateway 0.19.5 → 0.20.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.
Files changed (46) hide show
  1. package/content/integrations/crm.json +1 -1
  2. package/content/integrations/deploy-github.json +1 -1
  3. package/content/integrations/erp.json +1 -1
  4. package/content/integrations/mail.json +1 -1
  5. package/content/integrations/records.json +1 -1
  6. package/dist/control-plane/index.mjs +21 -13
  7. package/dist/mcp-server/{chunk-ZRRZFGRL.mjs → chunk-APIQIEUA.mjs} +39 -27
  8. package/dist/mcp-server/http.mjs +308 -97
  9. package/dist/mcp-server/report-verify-cli.mjs +1 -1
  10. package/dist/ui/assets/index-1s1q-XLL.js +116 -0
  11. package/dist/ui/index.html +1 -1
  12. package/node_modules/@hap/core/README.md +92 -29
  13. package/node_modules/@hap/core/dist/index.d.mts +614 -593
  14. package/node_modules/@hap/core/dist/index.d.ts +614 -593
  15. package/node_modules/@hap/core/dist/index.js +774 -749
  16. package/node_modules/@hap/core/dist/index.mjs +744 -724
  17. package/node_modules/@hap/core/package.json +1 -1
  18. package/node_modules/@hap/core/src/base64url.ts +39 -0
  19. package/node_modules/@hap/core/src/commitment-modes.ts +0 -21
  20. package/node_modules/@hap/core/src/errors.ts +76 -0
  21. package/node_modules/@hap/core/src/frame.ts +47 -178
  22. package/node_modules/@hap/core/src/gatekeeper.ts +219 -600
  23. package/node_modules/@hap/core/src/identity.ts +9 -12
  24. package/node_modules/@hap/core/src/index.ts +8 -4
  25. package/node_modules/@hap/core/src/mandate.ts +177 -166
  26. package/node_modules/@hap/core/src/owner-signature.ts +282 -0
  27. package/node_modules/@hap/core/src/profile.ts +234 -0
  28. package/node_modules/@hap/core/src/ticket.ts +148 -0
  29. package/node_modules/@hap/core/src/types.ts +191 -344
  30. package/node_modules/@hap/core/src/versions.ts +47 -0
  31. package/package.json +2 -2
  32. package/profiles/calendar/0.6.profile.json +191 -0
  33. package/profiles/charge/0.6.profile.json +211 -0
  34. package/profiles/customers/0.9.profile.json +182 -0
  35. package/profiles/delegation/0.3.profile.json +118 -0
  36. package/profiles/deploy/0.11.profile.json +177 -0
  37. package/profiles/email/0.8.profile.json +226 -0
  38. package/profiles/index.json +12 -1
  39. package/profiles/publish/0.6.profile.json +187 -0
  40. package/profiles/purchase/0.7.profile.json +235 -0
  41. package/profiles/records/0.6.profile.json +118 -0
  42. package/profiles/reporting/0.3.profile.json +98 -0
  43. package/profiles/sales/0.4.profile.json +291 -0
  44. package/dist/ui/assets/index-Du68zJhH.js +0 -116
  45. package/node_modules/@hap/core/src/attestation.ts +0 -173
  46. package/node_modules/@hap/core/src/receipt.ts +0 -74
@@ -14,7 +14,7 @@
14
14
  <meta name="apple-mobile-web-app-title" content="Suveren" />
15
15
  <meta name="theme-color" content="#111111" />
16
16
  <title>Suveren</title>
17
- <script type="module" crossorigin src="/assets/index-Du68zJhH.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-1s1q-XLL.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-blnpvM2g.css">
19
19
  </head>
20
20
  <body>
@@ -2,6 +2,13 @@
2
2
 
3
3
  Core types, cryptographic primitives, and verification logic for the [Human Agency Protocol](https://humanagencyprotocol.org).
4
4
 
5
+ **v0.7 vocabulary** — the wire renames *attestation* → **mandate**, *execution
6
+ receipt* → **mandate ticket**, *context* → **scope**, and *Decision Owner* →
7
+ **Mandate Owner** (protocol.md → *Migration from v0.6*). This package issues
8
+ and verifies `version: "0.7"` artifacts only — there is no backward-compat
9
+ verify path for v0.5/v0.6; a v0.6 mandate fails verification with
10
+ `VERSION_UNSUPPORTED` and must be re-issued. See the rename table below.
11
+
5
12
  ## Install
6
13
 
7
14
  ```bash
@@ -10,11 +17,17 @@ npm install @humanagencyp/hap-core
10
17
 
11
18
  ## What's included
12
19
 
13
- - **Types** — `AgentProfile`, `AgentBoundsParams`, `AgentContextParams`, execution context schemas, gate questions
14
- - **Frame** — Canonical hashing of bounds and context (`computeBoundsHash`, `computeContextHash`)
15
- - **Attestation** — Ed25519 signing and verification of attestation blobs
16
- - **Gatekeeper** — Execution verification against bounds, context constraints, and cumulative tracking
17
- - **Profiles** — Runtime profile registry (`registerProfile`, `getProfile`, `getAllProfiles`, `clearProfiles`)
20
+ - **Types** — `AgentProfile`, `AgentBoundsParams`, `AgentScopeParams`, `Mandate`/`MandatePayload`, execution context schemas
21
+ - **Frame** — Canonical hashing of bounds and scope (`computeBoundsHash`, `computeScopeHash`)
22
+ - **Mandate** — Ed25519 signing and verification of mandate blobs (`signMandate`, `verifyMandate`, `verifyMandateSignature`)
23
+ - **Owner Signature** — the `HAP-mandate-projection` and `HAP-approval` objects and their verification (`buildMandateProjection`, `verifyOwnerSignature(s)`, `signApproval`/`verifyApproval`)
24
+ - **Ticket** — the signed mandate-ticket wire type and holder-side verification (`signTicket`, `verifyTicketSignature`, `publicTicketView`)
25
+ - **Gatekeeper** — local (Phase 1) execution verification: mandate signature/expiry/hash checks, `per_transaction` bounds, `enum` capability flags, scope constraints. **Does not** enforce `cumulative_sum`/`cumulative_count` bounds — those are Authority-Server-only (protocol.md → *Enforcement Authority*)
26
+ - **Profile** — `computeProfileHash` (content address of a provisioned profile) and `validateProfile` (authoring-time checks)
27
+ - **Versions** — `negotiateVersion`, `PROTOCOL_VERSION`, `SUPPORTED_VERSIONS`
28
+ - **Errors** — the canonical v0.7 error-code list (`HapErrorCode`, `HapError`)
29
+ - **base64url** — strict (no padding, no standard-base64 characters) encode/decode
30
+ - **Profiles registry** — `registerProfile`, `getProfile`, `getAllProfiles`, `clearProfiles`
18
31
 
19
32
  ## Usage
20
33
 
@@ -22,7 +35,7 @@ npm install @humanagencyp/hap-core
22
35
  import {
23
36
  type AgentProfile,
24
37
  computeBoundsHash,
25
- computeContextHash,
38
+ computeScopeHash,
26
39
  verify,
27
40
  registerProfile,
28
41
  getProfile,
@@ -31,40 +44,90 @@ import {
31
44
  // Register a profile
32
45
  registerProfile(profile.id, profile);
33
46
 
34
- // Compute deterministic hashes for bounds and context
47
+ // Compute deterministic hashes for bounds and scope
35
48
  const boundsHash = computeBoundsHash(bounds, profile);
36
- const contextHash = computeContextHash(context, profile);
49
+ const scopeHash = computeScopeHash(scope, profile);
37
50
 
38
- // Verify an execution against bounds and attestations
39
- const result = await verify(
40
- { frame, attestations, execution, context },
41
- publicKeyHex,
42
- );
51
+ // Verify an execution against bounds and mandates (Gatekeeper, Phase 1 — never
52
+ // reaches the wire). The AS public key is resolved from each mandate's own
53
+ // `issuer` DID, never supplied by the caller.
54
+ const result = await verify({ bounds, mandates, execution, scope });
43
55
 
44
56
  if (result.approved) {
45
- // Execution is within bounds
57
+ // Execution is within bounds — request a ticket from the Authority Server next.
46
58
  }
47
59
  ```
48
60
 
49
61
  ## Constraint types
50
62
 
51
- The gatekeeper enforces three types of constraints from the profile's bounds and context schemas:
63
+ The Gatekeeper enforces two kinds of constraints locally, from the profile's
64
+ bounds and scope schemas:
52
65
 
53
- | Type | Description | Example |
66
+ | Type | Enforced by | Example |
54
67
  |---|---|---|
55
- | `max` | Numeric upper bound | `amount_max: 1000` |
56
- | `enum` | Value must be in allowed set | `currency: ["USD", "EUR"]` |
57
- | `subset` | Every item must appear in bound | `allowed_domains: "acme.com,partner.org"` |
58
-
59
- ## Cumulative tracking
60
-
61
- Bounds fields ending in `_daily_max` or `_monthly_max` are checked against cumulative execution logs. The gatekeeper resolves running totals from an `ExecutionLog` interface:
62
-
63
- ```typescript
64
- interface ExecutionLog {
65
- sumByWindow(profileId: string, path: string, field: string, window: 'daily' | 'monthly'): Promise<number>;
66
- }
67
- ```
68
+ | `per_transaction` bound | Gatekeeper (and the AS at ticket time) | `amount_max: 1000` |
69
+ | `enum` bound (capability flag) | Gatekeeper and AS at mandate time | `read_access: ["unlimited", "none"]` |
70
+ | scope `enum` | Gatekeeper only (the AS only ever holds `scope_hash`) | `currency: ["USD", "EUR"]` |
71
+ | scope `subset` | Gatekeeper only | `allowed_domains: "acme.com,partner.org"` |
72
+
73
+ `cumulative_sum` and `cumulative_count` bounds are **Authority-Server-only**
74
+ (protocol.md → *Enforcement Authority*; *Migration from v0.6* semantic change
75
+ 9: "Local cumulative enforcement is removed, not merely deprecated"). The
76
+ Gatekeeper MUST NOT refuse an execution on a cumulative bound from its own
77
+ records — only the AS's ticket history is authoritative for a running total
78
+ across every Gatekeeper exercising the bucket.
79
+
80
+ ## v0.6 → v0.7 rename table
81
+
82
+ Mechanical, 1:1 (full list: protocol.md → *Migration from v0.6*):
83
+
84
+ | v0.6 | v0.7 |
85
+ |---|---|
86
+ | `attestation.ts` | `mandate.ts` |
87
+ | `mandate.ts` (owner-signed projection) | `owner-signature.ts` |
88
+ | `receipt.ts` | `ticket.ts` |
89
+ | `Attestation` / `AttestationPayload` / `AttestationHeader` | `Mandate` / `MandatePayload` / `MandateHeader` |
90
+ | `OwnerMandate` | `MandateOwnerEntry` |
91
+ | `MandateBinding` | `OwnerSignatureBinding` |
92
+ | `ProfileContextField` / `AgentContextParams` | `ProfileScopeField` / `AgentScopeParams` |
93
+ | `AgentProfile.contextSchema` | `AgentProfile.scopeSchema` |
94
+ | `AgentProfile.receipt_lookup` | `AgentProfile.ticket_lookup` |
95
+ | `encode/decodeAttestationBlob` | `encode/decodeMandateBlob` |
96
+ | `attestationId` | `mandateBlobId` |
97
+ | `verifyAttestationSignature` | `verifyMandateSignature` |
98
+ | `checkAttestationExpiry` | `checkMandateExpiry` |
99
+ | `verifyAttestationV4` | `verifyMandate` |
100
+ | `verifyContextHash` / `canonicalContext` / `computeContextHash` / `validateContextParams` | `verifyScopeHash` / `canonicalScope` / `computeScopeHash` / `validateScopeParams` |
101
+ | `ReceiptPayload` / `verifyReceiptSignature` | `TicketPayload` / `verifyTicketSignature` |
102
+ | `verifyOwnerMandate(s)` | `verifyOwnerSignature(s)` |
103
+ | `MandateError` | `OwnerSignatureError` |
104
+ | `mandateSigningBytes` | `projectionSigningBytes` |
105
+
106
+ Removed (v0.3 and the dual-version Gatekeeper path are retired, no alias):
107
+ `verifyAttestation`, `verifyFrameHash`, `isV4Attestation`, `frameSchema`,
108
+ `canonicalFrame`/`computeFrameHash`/`validateFrameParams`, `AgentFrameParams`,
109
+ `DOMAIN_NOT_COVERED`, local cumulative bounds enforcement.
110
+
111
+ Error codes renamed to their canonical v0.7 names (protocol.md → *Error
112
+ Codes*): `MALFORMED_ATTESTATION` → `MALFORMED_MANDATE`, `ATTESTATION_REVOKED`
113
+ → `MANDATE_REVOKED`, `MANDATE_SIGNATURE_*` → `OWNER_SIGNATURE_*`,
114
+ `BOUNDS_MISMATCH` → `BOUNDS_HASH_MISMATCH`, `CONTEXT_MISMATCH` →
115
+ `SCOPE_HASH_MISMATCH`, `CONTEXT_INVALID_VALUE` → `SCOPE_INVALID_VALUE`, and
116
+ others — see `src/errors.ts` for the full canonical list.
117
+
118
+ **v0.7 only, in brief:** 0.5/0.6 mandates fail verification with
119
+ `VERSION_UNSUPPORTED` and must be re-issued; signatures are strict
120
+ base64url (standard base64 is rejected, not silently repaired); the
121
+ Gatekeeper no longer enforces cumulative bounds locally.
122
+
123
+ ## Conformance vectors
124
+
125
+ `npm test` consumes the spec's published conformance vectors directly from
126
+ `content/0.7/vectors/*.json` (a sibling checkout of
127
+ [hap-protocol](https://github.com/humanagencyprotocol/hap-protocol) — see
128
+ `test/vectors/_spec-dir.ts`), rather than keeping a copy of their values in
129
+ this repo. If that sibling checkout is absent, the vector tests skip locally
130
+ with a warning but **fail** in CI (`CI=true`).
68
131
 
69
132
  ## License
70
133