@paysentry/observe 1.0.0 → 1.0.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 +56 -0
- package/package.json +8 -5
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paysentry/observe",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Payment observability for AI agents
|
|
3
|
+
"version": "1.0.1",
|
|
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",
|
|
@@ -16,13 +16,16 @@
|
|
|
16
16
|
"clean": "tsc --build --clean"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@paysentry/core": "1.0.0"
|
|
19
|
+
"@paysentry/core": ">=1.0.0"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
|
-
"files": [
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
23
26
|
"repository": {
|
|
24
27
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/mkmkkkkk/paysentry",
|
|
26
29
|
"directory": "packages/observe"
|
|
27
30
|
}
|
|
28
31
|
}
|