@hesohq/sdk 0.4.0 → 0.4.1-dev.24

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 (2) hide show
  1. package/README.md +88 -0
  2. package/package.json +11 -5
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # @hesohq/sdk
2
+
3
+ **The compliance layer for AI agents, for Node.** Verify heso **Action Receipts**,
4
+ enforce a minimum trust level, gate a Node agent's actions against policy, and push
5
+ receipts to the cloud outbox — with the native verifier bundled (zero crypto in
6
+ TypeScript).
7
+
8
+ You hold the signing keys. heso's cloud can verify and mirror receipts but can
9
+ **never forge one** — so anyone (a customer, an auditor, a court) can check exactly
10
+ what your agent did, and that it was authorized, without trusting heso at all.
11
+
12
+ - **Site** · [heso.ca](https://www.heso.ca)
13
+ - **Docs** · [heso.ca/docs](https://www.heso.ca/docs)
14
+ - **Verify a receipt (no account)** · [heso.ca/verify](https://www.heso.ca/verify)
15
+
16
+ ```sh
17
+ npm install @hesohq/sdk # or: pnpm add @hesohq/sdk (Node 18+)
18
+ ```
19
+
20
+ The native verifier (`@hesohq/node`) is pulled in automatically — verification runs
21
+ locally and offline. A cloud API key is needed only for the cloud client
22
+ (`pushReceipt`, `pollApproval`, and friends).
23
+
24
+ ## Verify a receipt
25
+
26
+ ```ts
27
+ import { gate } from '@hesohq/sdk'
28
+
29
+ const result = gate(receipt, { minTrust: 'L1' })
30
+ // → { verdict: 'Valid', trust: 'L1', ... } re-runs hash + signature math locally
31
+ ```
32
+
33
+ Throw on anything below your bar:
34
+
35
+ ```ts
36
+ import { assertGate } from '@hesohq/sdk'
37
+
38
+ assertGate(receipt, { minTrust: 'L1' }) // raises unless Valid and ≥ L1
39
+ ```
40
+
41
+ Or branch on the decision:
42
+
43
+ ```ts
44
+ import { isDecisionAllowed } from '@hesohq/sdk'
45
+ import type { ActionReceipt } from '@hesohq/sdk'
46
+
47
+ if (isDecisionAllowed(receipt)) { /* ... */ }
48
+ ```
49
+
50
+ ## Gate a Node agent
51
+
52
+ ```ts
53
+ import { wrap, pushReceipt } from '@hesohq/sdk'
54
+
55
+ const guarded = wrap(agentClient, {
56
+ onReceipt: async (receiptJson) => {
57
+ await pushReceipt(JSON.parse(receiptJson)) // server re-verifies before mirroring
58
+ },
59
+ })
60
+ ```
61
+
62
+ There are also thin adapters for the **AI SDK** (`aiSdk`) and **Mastra** (`mastra`),
63
+ all built on the same `engine.gate` core.
64
+
65
+ ## Push to the cloud outbox
66
+
67
+ ```ts
68
+ import { configure, pushReceipt } from '@hesohq/sdk'
69
+
70
+ configure(process.env.HESO_API_KEY!, 'https://api.heso.ca')
71
+
72
+ const result = await pushReceipt(receipt) // server re-verifies, then mirrors
73
+ ```
74
+
75
+ `pushReceipts` takes an array for batches. The cloud holds no signing keys — it only
76
+ verifies and mirrors what you've already signed.
77
+
78
+ ## Trust model
79
+
80
+ heso proves an action was **authorized** under policy, and at L1 that an authorized
81
+ human **approved or blocked** it. It does **not** prove the action's outcome was
82
+ truthful — that's unprovable from the artifact. Trust grades are L0 (operator) and
83
+ L1 (operator + human approver). The receipt format is specified in
84
+ [`ACTION-RECEIPT-1.0`](https://github.com/heso-inc/heso).
85
+
86
+ ---
87
+
88
+ Proprietary. See [heso.ca](https://www.heso.ca) for licensing and the hosted console.
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@hesohq/sdk",
3
- "version": "0.4.0",
4
- "description": "HESO Enterprise SDK thin TypeScript wrapper over @hesohq/core with gating helpers, cloud client, and wire types",
3
+ "version": "0.4.1-dev.24",
4
+ "description": "The compliance layer for AI agents (Node) verify heso Action Receipts, gate agent actions against policy, and push receipts to the cloud.",
5
+ "homepage": "https://www.heso.ca",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/heso-inc/heso.git"
9
+ },
5
10
  "main": "./dist/index.js",
6
11
  "types": "./dist/index.d.ts",
7
12
  "exports": {
@@ -15,13 +20,14 @@
15
20
  }
16
21
  },
17
22
  "files": [
18
- "dist"
23
+ "dist",
24
+ "README.md"
19
25
  ],
20
26
  "dependencies": {
21
- "@hesohq/core": "0.4.0"
27
+ "@hesohq/core": "0.4.1-dev.24"
22
28
  },
23
29
  "optionalDependencies": {
24
- "@hesohq/node": "0.4.0"
30
+ "@hesohq/node": "0.4.1-dev.24"
25
31
  },
26
32
  "devDependencies": {
27
33
  "typescript": "^5",