@agent-receipts/sdk 0.2.1 → 0.2.2

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 +30 -0
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -99,6 +99,36 @@ const publicKey = await ar.getPublicKey()
99
99
  // 64-char hex string (Ed25519 public key)
100
100
  ```
101
101
 
102
+ ### `ar.track()` with Constraints
103
+
104
+ ```typescript
105
+ const receipt = await ar.track({
106
+ action: 'generate_summary',
107
+ input: { document_id: 'doc-q4-2024' },
108
+ output: { summary: 'Revenue grew 12% YoY...' },
109
+ latency_ms: 1200,
110
+ cost_usd: 0.005,
111
+ constraints: [
112
+ { type: 'max_latency_ms', value: 5000 },
113
+ { type: 'max_cost_usd', value: 0.01 },
114
+ { type: 'min_confidence', value: 0.8 },
115
+ ],
116
+ })
117
+ // receipt.constraint_result.passed → true/false
118
+ ```
119
+
120
+ ### `ar.getJudgments(receiptId)` — Get judgments
121
+
122
+ ```typescript
123
+ const judgments = await ar.getJudgments('rcpt_8f3k2j4n')
124
+ ```
125
+
126
+ ### `ar.cleanup()` — Delete expired receipts
127
+
128
+ ```typescript
129
+ const { deleted, remaining } = await ar.cleanup()
130
+ ```
131
+
102
132
  ## Examples
103
133
 
104
134
  See the [examples](https://github.com/webaesbyamin/agent-receipts/tree/main/examples) directory for complete usage patterns including chained receipts and multi-step pipelines.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-receipts/sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "TypeScript SDK for Agent Receipts — local-first action tracking",
5
5
  "license": "MIT",
6
6
  "author": "Amin <amin@webaes.co> (https://webaes.co)",
@@ -39,9 +39,9 @@
39
39
  "dist"
40
40
  ],
41
41
  "dependencies": {
42
- "@agent-receipts/schema": "0.2.1",
43
- "@agent-receipts/mcp-server": "0.2.1",
44
- "@agent-receipts/crypto": "0.2.1"
42
+ "@agent-receipts/schema": "0.2.2",
43
+ "@agent-receipts/crypto": "0.2.2",
44
+ "@agent-receipts/mcp-server": "0.2.2"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^20.0.0",