@paysentry/observe 1.0.0 → 1.0.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 +56 -0
  2. package/package.json +11 -7
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # @paysentry/observe
2
+
3
+ Payment observability for AI agents. Track what agents spend, where, and why — across x402, ACP, AP2, and Visa TAP.
4
+
5
+ Part of [PaySentry](https://github.com/mkmkkkkk/paysentry).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @paysentry/observe @paysentry/core
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```typescript
16
+ import { SpendTracker, SpendAnalytics, SpendAlerts } from '@paysentry/observe';
17
+
18
+ const tracker = new SpendTracker();
19
+ const analytics = new SpendAnalytics(tracker);
20
+ const alerts = new SpendAlerts(tracker);
21
+
22
+ // Track a transaction
23
+ tracker.record(tx);
24
+
25
+ // Get per-agent analytics
26
+ const report = analytics.getAgentAnalytics('my-agent');
27
+ console.log(report.spendByProtocol);
28
+ // Map { 'x402:USDC' => { totalAmount: 12.50, transactionCount: 250 } }
29
+
30
+ // Alert when daily spend exceeds 80% of budget
31
+ alerts.addRule({
32
+ id: 'daily-budget',
33
+ type: 'budget_threshold',
34
+ severity: 'warning',
35
+ config: {
36
+ threshold: 500,
37
+ currency: 'USDC',
38
+ windowMs: 86400000,
39
+ alertAtPercent: 0.8,
40
+ },
41
+ });
42
+
43
+ alerts.onAlert((alert) => {
44
+ console.log(`[${alert.severity}] ${alert.message}`);
45
+ });
46
+ ```
47
+
48
+ ## Features
49
+
50
+ - **SpendTracker** — Real-time transaction indexing by agent, service, protocol
51
+ - **SpendAnalytics** — Time-series analytics, per-agent breakdowns, anomaly detection (z-score)
52
+ - **SpendAlerts** — Budget thresholds, rate spike detection, new recipient alerts
53
+
54
+ ## License
55
+
56
+ MIT
package/package.json CHANGED
@@ -1,28 +1,32 @@
1
1
  {
2
2
  "name": "@paysentry/observe",
3
- "version": "1.0.0",
4
- "description": "Payment observability for AI agents track what agents spend, where, and why",
3
+ "version": "1.0.2",
4
+ "description": "Payment observability for AI agents \u2014 track what agents spend, where, and why",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
12
13
  }
13
14
  },
14
15
  "scripts": {
15
- "build": "tsc",
16
+ "build": "tsc --build",
16
17
  "clean": "tsc --build --clean"
17
18
  },
18
19
  "dependencies": {
19
- "@paysentry/core": "1.0.0"
20
+ "@paysentry/core": ">=1.0.0"
20
21
  },
21
22
  "license": "MIT",
22
- "files": ["dist"],
23
+ "files": [
24
+ "dist",
25
+ "README.md"
26
+ ],
23
27
  "repository": {
24
28
  "type": "git",
25
- "url": "https://github.com/paysentry/paysentry",
29
+ "url": "https://github.com/mkmkkkkk/paysentry",
26
30
  "directory": "packages/observe"
27
31
  }
28
32
  }