@vanditk2/agentvault-types 0.1.0
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/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/index.d.ts +104 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vandit Kunapareddi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# `@vanditk2/agentvault-types`
|
|
2
|
+
|
|
3
|
+
Shared TypeScript types for [AgentVault](https://github.com/vandit-kunapareddi/agentvault) — the public contract every external protocol handler, trust provider, or webhook consumer is written against.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @vanditk2/agentvault-types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What's in here
|
|
12
|
+
|
|
13
|
+
Just types. No runtime code, no dependencies.
|
|
14
|
+
|
|
15
|
+
- `Protocol` — `"x402" | "mpp" | "acp" | "unknown"` (the union widens to any string so you can register custom protocols)
|
|
16
|
+
- `CredentialPayload` — the JWT shape the checkpoint issues + verifies
|
|
17
|
+
- `CheckpointRequest` / `CheckpointResponse` / `CheckpointStatus`
|
|
18
|
+
- `PaymentReceipt`
|
|
19
|
+
- `HandlerArgs` / `ProtocolHandler` — the contract every protocol handler implements
|
|
20
|
+
- `EscalationStatus` / `EscalationDecision` / `EscalationRow` / `ResolveEscalationRequest`
|
|
21
|
+
|
|
22
|
+
## When to use it
|
|
23
|
+
|
|
24
|
+
If you're writing **a custom protocol handler** to register with the AgentVault checkpoint, you'll import `ProtocolHandler`, `HandlerArgs`, `PaymentReceipt`. See [`examples/custom-protocol-handler`](https://github.com/vandit-kunapareddi/agentvault/tree/main/examples/custom-protocol-handler) for a worked example.
|
|
25
|
+
|
|
26
|
+
If you're writing **a webhook subscriber**, the event payload shapes are documented in [`docs/WEBHOOKS.md`](https://github.com/vandit-kunapareddi/agentvault/blob/main/docs/WEBHOOKS.md) — they reference these types.
|
|
27
|
+
|
|
28
|
+
If you're building **an agent that pays through AgentVault**, you probably want [`@vanditk2/agentvault-sdk`](https://www.npmjs.com/package/@vanditk2/agentvault-sdk) instead, which re-exports the relevant types.
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
[MIT](./LICENSE)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in protocols the checkpoint and SDK know about by name. External
|
|
3
|
+
* protocol handlers can register themselves with any string — the union
|
|
4
|
+
* here is just for autocomplete and as documentation of the built-ins.
|
|
5
|
+
* The `(string & {})` widens the type to accept arbitrary strings without
|
|
6
|
+
* collapsing the literal autocomplete suggestions.
|
|
7
|
+
*/
|
|
8
|
+
export type Protocol = "x402" | "mpp" | "acp" | "unknown" | (string & {});
|
|
9
|
+
export interface CredentialPayload {
|
|
10
|
+
agentId: string;
|
|
11
|
+
agentName: string;
|
|
12
|
+
walletAddress: string;
|
|
13
|
+
authorizedBy: string;
|
|
14
|
+
dailyCap: number;
|
|
15
|
+
perTxLimit: number;
|
|
16
|
+
approvedVendors: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Optional per-vendor daily spend caps, keyed by vendor hostname. When set,
|
|
19
|
+
* a payment is blocked if today's spend with that specific vendor plus the
|
|
20
|
+
* current amount would exceed the per-vendor limit, independently of the
|
|
21
|
+
* global daily cap. Vendors not present in the map fall back to the global
|
|
22
|
+
* limits.
|
|
23
|
+
*/
|
|
24
|
+
vendorLimits?: Record<string, number>;
|
|
25
|
+
supportedProtocols: Protocol[];
|
|
26
|
+
issuedAt: number;
|
|
27
|
+
expiresAt: number;
|
|
28
|
+
}
|
|
29
|
+
export interface CheckpointRequest {
|
|
30
|
+
credential: string;
|
|
31
|
+
vendor: string;
|
|
32
|
+
amount: number;
|
|
33
|
+
protocol?: Protocol;
|
|
34
|
+
endpoint?: string;
|
|
35
|
+
}
|
|
36
|
+
export type CheckpointStatus = "approved" | "blocked" | "escalated" | "recognized";
|
|
37
|
+
export interface PaymentReceipt {
|
|
38
|
+
protocol: Protocol;
|
|
39
|
+
receiptId: string;
|
|
40
|
+
vendor: string;
|
|
41
|
+
amount: number;
|
|
42
|
+
currency: "USDC";
|
|
43
|
+
settled: boolean;
|
|
44
|
+
timestamp: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Arguments passed into a protocol handler by the checkpoint router. The
|
|
48
|
+
* pipeline has already run trust + budget + vendor checks by the time a
|
|
49
|
+
* handler is called — the handler's only job is to execute (or simulate)
|
|
50
|
+
* the payment and return a receipt.
|
|
51
|
+
*/
|
|
52
|
+
export interface HandlerArgs {
|
|
53
|
+
vendor: string;
|
|
54
|
+
amount: number;
|
|
55
|
+
endpoint?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The contract every protocol handler implements. Returning a receipt with
|
|
59
|
+
* `settled: false` is logged as "recognized" (not approved); throwing is
|
|
60
|
+
* caught by the checkpoint and surfaced as a blocked transaction with the
|
|
61
|
+
* error message as the reason.
|
|
62
|
+
*/
|
|
63
|
+
export type ProtocolHandler = (args: HandlerArgs) => Promise<PaymentReceipt>;
|
|
64
|
+
export interface CheckpointResponse {
|
|
65
|
+
status: CheckpointStatus;
|
|
66
|
+
reason?: string;
|
|
67
|
+
protocol?: Protocol;
|
|
68
|
+
trustTier?: string;
|
|
69
|
+
receipt?: PaymentReceipt;
|
|
70
|
+
}
|
|
71
|
+
export type PaymentResult = CheckpointResponse;
|
|
72
|
+
export interface MockPaymentRequest {
|
|
73
|
+
amount: number;
|
|
74
|
+
agentId?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface MockPaymentResponse {
|
|
77
|
+
receiptId: string;
|
|
78
|
+
vendor: string;
|
|
79
|
+
amount: number;
|
|
80
|
+
currency: "USDC";
|
|
81
|
+
timestamp: string;
|
|
82
|
+
}
|
|
83
|
+
export type EscalationStatus = "pending" | "approved" | "blocked" | "timed_out";
|
|
84
|
+
export type EscalationDecision = "approved" | "blocked";
|
|
85
|
+
export interface EscalationRow {
|
|
86
|
+
id: string;
|
|
87
|
+
transactionId: string;
|
|
88
|
+
agentId: string;
|
|
89
|
+
agentName: string;
|
|
90
|
+
vendor: string;
|
|
91
|
+
amount: number;
|
|
92
|
+
reason: string | null;
|
|
93
|
+
status: EscalationStatus;
|
|
94
|
+
notifiedAt: string | null;
|
|
95
|
+
resolvedAt: string | null;
|
|
96
|
+
resolvedBy: string | null;
|
|
97
|
+
createdAt: string;
|
|
98
|
+
deadlineAt: string | null;
|
|
99
|
+
}
|
|
100
|
+
export interface ResolveEscalationRequest {
|
|
101
|
+
decision: EscalationDecision;
|
|
102
|
+
resolvedBy?: string;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,KAAK,GACL,KAAK,GACL,SAAS,GACT,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,kBAAkB,EAAE,QAAQ,EAAE,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,CAAC;AAEnF,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,CA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M,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vanditk2/agentvault-types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared TypeScript types for AgentVault — the public contract for protocol handlers, credentials, escalations, and webhook events.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agentvault",
|
|
7
|
+
"agentic-payments",
|
|
8
|
+
"ai-agents",
|
|
9
|
+
"x402",
|
|
10
|
+
"mpp",
|
|
11
|
+
"acp",
|
|
12
|
+
"types"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "Vandit Kunapareddi",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/vandit-kunapareddi/agentvault.git",
|
|
19
|
+
"directory": "packages/types"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/vandit-kunapareddi/agentvault#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/vandit-kunapareddi/agentvault/issues"
|
|
24
|
+
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc -p tsconfig.build.json",
|
|
47
|
+
"prepublishOnly": "npm run build"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"typescript": "^5.6.0"
|
|
51
|
+
}
|
|
52
|
+
}
|