@vanditk2/agentvault-trust 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 +69 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -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,69 @@
|
|
|
1
|
+
# `@vanditk2/agentvault-trust`
|
|
2
|
+
|
|
3
|
+
The `TrustProvider` interface for [AgentVault](https://github.com/vandit-kunapareddi/agentvault), plus `SimpleTrustProvider` as a reference implementation. Write your own provider against this contract — on-chain reputation, behavioural scoring, identity-attested, anything — and drop it in behind the checkpoint's trust gate.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @vanditk2/agentvault-trust
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What's in here
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
export interface TrustProvider {
|
|
15
|
+
gate(ctx: AgentTrustContext): Promise<GateResult>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface AgentTrustContext {
|
|
19
|
+
walletAddress: string;
|
|
20
|
+
known: boolean;
|
|
21
|
+
active: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface GateResult {
|
|
25
|
+
tier: string; // "verified" | "probation" | "expired" | "unknown" | ...
|
|
26
|
+
score: number; // 0–100
|
|
27
|
+
allow: boolean;
|
|
28
|
+
reason?: string; // populated when `allow` is false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class SimpleTrustProvider implements TrustProvider {
|
|
32
|
+
constructor(options?: { minScore?: number });
|
|
33
|
+
gate(ctx: AgentTrustContext): Promise<GateResult>;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Implementing your own
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import type {
|
|
41
|
+
AgentTrustContext,
|
|
42
|
+
GateResult,
|
|
43
|
+
TrustProvider,
|
|
44
|
+
} from "@vanditk2/agentvault-trust";
|
|
45
|
+
|
|
46
|
+
export class MyProvider implements TrustProvider {
|
|
47
|
+
async gate(ctx: AgentTrustContext): Promise<GateResult> {
|
|
48
|
+
// Score the agent however you want — on-chain lookup, internal
|
|
49
|
+
// ML model, external reputation API, etc.
|
|
50
|
+
const score = await scoreFromMyService(ctx.walletAddress);
|
|
51
|
+
return {
|
|
52
|
+
tier: score >= 80 ? "verified" : "untrusted",
|
|
53
|
+
score,
|
|
54
|
+
allow: score >= 70,
|
|
55
|
+
reason: score < 70 ? "Below threshold" : undefined,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
A runnable reference implementation (calling an external reputation HTTP service, with full never-fail-open error handling) lives at [`examples/custom-trust-provider`](https://github.com/vandit-kunapareddi/agentvault/tree/main/examples/custom-trust-provider).
|
|
62
|
+
|
|
63
|
+
## Wiring it into the checkpoint
|
|
64
|
+
|
|
65
|
+
Swap `SimpleTrustProvider` for your class in [`apps/checkpoint/src/trust.ts`](https://github.com/vandit-kunapareddi/agentvault/blob/main/apps/checkpoint/src/trust.ts) — one-line change.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
[MIT](./LICENSE)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface AgentTrustContext {
|
|
2
|
+
walletAddress: string;
|
|
3
|
+
known: boolean;
|
|
4
|
+
active: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface GateResult {
|
|
7
|
+
tier: string;
|
|
8
|
+
score: number;
|
|
9
|
+
allow: boolean;
|
|
10
|
+
reason?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TrustProvider {
|
|
13
|
+
gate(ctx: AgentTrustContext): Promise<GateResult>;
|
|
14
|
+
}
|
|
15
|
+
export interface SimpleTrustProviderOptions {
|
|
16
|
+
minScore?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare class SimpleTrustProvider implements TrustProvider {
|
|
19
|
+
private readonly minScore;
|
|
20
|
+
constructor(options?: SimpleTrustProviderOptions);
|
|
21
|
+
gate(ctx: AgentTrustContext): Promise<GateResult>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAID,qBAAa,mBAAoB,YAAW,aAAa;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,OAAO,GAAE,0BAA+B;IAI9C,IAAI,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;CA0BxD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const DEFAULT_MIN_SCORE = 50;
|
|
2
|
+
export class SimpleTrustProvider {
|
|
3
|
+
minScore;
|
|
4
|
+
constructor(options = {}) {
|
|
5
|
+
this.minScore = options.minScore ?? DEFAULT_MIN_SCORE;
|
|
6
|
+
}
|
|
7
|
+
async gate(ctx) {
|
|
8
|
+
if (!ctx.known) {
|
|
9
|
+
return {
|
|
10
|
+
tier: "unknown",
|
|
11
|
+
score: 10,
|
|
12
|
+
allow: false,
|
|
13
|
+
reason: "Wallet is not a registered agent",
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (!ctx.active) {
|
|
17
|
+
const score = 30;
|
|
18
|
+
return {
|
|
19
|
+
tier: "expired",
|
|
20
|
+
score,
|
|
21
|
+
allow: score >= this.minScore,
|
|
22
|
+
reason: "Agent credential is inactive or expired",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const score = 85;
|
|
26
|
+
return {
|
|
27
|
+
tier: "verified",
|
|
28
|
+
score,
|
|
29
|
+
allow: score >= this.minScore,
|
|
30
|
+
reason: score >= this.minScore ? undefined : "Trust score below required threshold",
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqBA,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,OAAO,mBAAmB;IACb,QAAQ,CAAS;IAElC,YAAY,UAAsC,EAAE;QAClD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAsB;QAC/B,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,EAAE;gBACT,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,kCAAkC;aAC3C,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,KAAK,GAAG,EAAE,CAAC;YACjB,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,KAAK;gBACL,KAAK,EAAE,KAAK,IAAI,IAAI,CAAC,QAAQ;gBAC7B,MAAM,EAAE,yCAAyC;aAClD,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,KAAK;YACL,KAAK,EAAE,KAAK,IAAI,IAAI,CAAC,QAAQ;YAC7B,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,sCAAsC;SACpF,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vanditk2/agentvault-trust",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The TrustProvider interface for AgentVault — plus SimpleTrustProvider as a reference implementation. Write your own provider against this contract.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agentvault",
|
|
7
|
+
"agentic-payments",
|
|
8
|
+
"ai-agents",
|
|
9
|
+
"trust",
|
|
10
|
+
"reputation"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "Vandit Kunapareddi",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/vandit-kunapareddi/agentvault.git",
|
|
17
|
+
"directory": "packages/trust"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/vandit-kunapareddi/agentvault#readme",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/vandit-kunapareddi/agentvault/issues"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.build.json",
|
|
45
|
+
"prepublishOnly": "npm run build"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"typescript": "^5.6.0"
|
|
49
|
+
}
|
|
50
|
+
}
|