usertrust 0.2.3 → 0.2.4
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/dist/shared/errors.d.ts
CHANGED
|
@@ -2,30 +2,44 @@ export declare class InsufficientBalanceError extends Error {
|
|
|
2
2
|
readonly userId: string;
|
|
3
3
|
readonly required: number;
|
|
4
4
|
readonly available: number;
|
|
5
|
+
readonly hint: string;
|
|
6
|
+
readonly docsUrl: string;
|
|
5
7
|
constructor(userId: string, required: number, available: number);
|
|
6
8
|
}
|
|
7
9
|
export declare class PolicyDeniedError extends Error {
|
|
8
10
|
readonly reason: string;
|
|
11
|
+
readonly hint: string;
|
|
12
|
+
readonly docsUrl: string;
|
|
9
13
|
constructor(reason: string);
|
|
10
14
|
}
|
|
11
15
|
export declare class AccountNotFoundError extends Error {
|
|
12
16
|
readonly userId: string;
|
|
17
|
+
readonly hint: string;
|
|
18
|
+
readonly docsUrl: string;
|
|
13
19
|
constructor(userId: string);
|
|
14
20
|
}
|
|
15
21
|
export declare class IdempotencyConflictError extends Error {
|
|
16
22
|
readonly key: string;
|
|
23
|
+
readonly hint: string;
|
|
24
|
+
readonly docsUrl: string;
|
|
17
25
|
constructor(key: string);
|
|
18
26
|
}
|
|
19
27
|
export declare class LedgerUnavailableError extends Error {
|
|
20
28
|
readonly cause_message: string;
|
|
29
|
+
readonly hint: string;
|
|
30
|
+
readonly docsUrl: string;
|
|
21
31
|
constructor(reason: string);
|
|
22
32
|
}
|
|
23
33
|
export declare class AuditDegradedError extends Error {
|
|
24
34
|
readonly cause_message: string;
|
|
35
|
+
readonly hint: string;
|
|
36
|
+
readonly docsUrl: string;
|
|
25
37
|
constructor(reason: string);
|
|
26
38
|
}
|
|
27
39
|
export declare class VaultNotInitializedError extends Error {
|
|
28
40
|
readonly path: string;
|
|
41
|
+
readonly hint: string;
|
|
42
|
+
readonly docsUrl: string;
|
|
29
43
|
constructor(path: string);
|
|
30
44
|
}
|
|
31
45
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAGA,qBAAa,wBAAyB,SAAQ,KAAK;IAClD,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAGA,qBAAa,wBAAyB,SAAQ,KAAK;IAClD,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAa/D;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC3C,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,MAAM,EAAE,MAAM;CAU1B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC9C,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,MAAM,EAAE,MAAM;CAU1B;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IAClD,SAAgB,GAAG,EAAE,MAAM,CAAC;IAC5B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,GAAG,EAAE,MAAM;CASvB;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAChD,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,MAAM,EAAE,MAAM;CAU1B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC5C,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,MAAM,EAAE,MAAM;CAS1B;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IAClD,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,IAAI,EAAE,MAAM;CASxB"}
|
package/dist/shared/errors.js
CHANGED
|
@@ -4,60 +4,102 @@ export class InsufficientBalanceError extends Error {
|
|
|
4
4
|
userId;
|
|
5
5
|
required;
|
|
6
6
|
available;
|
|
7
|
+
hint;
|
|
8
|
+
docsUrl;
|
|
7
9
|
constructor(userId, required, available) {
|
|
8
|
-
|
|
10
|
+
const hint = "Increase the budget in trust() options or add funds via the ledger.";
|
|
11
|
+
const docsUrl = "https://usertrust.ai/docs/errors/insufficient-balance";
|
|
12
|
+
super(`Insufficient balance for user ${userId}: need ${required}, have ${available}\n\n Hint: ${hint}\n Docs: ${docsUrl}`);
|
|
9
13
|
this.name = "InsufficientBalanceError";
|
|
10
14
|
this.userId = userId;
|
|
11
15
|
this.required = required;
|
|
12
16
|
this.available = available;
|
|
17
|
+
this.hint = hint;
|
|
18
|
+
this.docsUrl = docsUrl;
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
export class PolicyDeniedError extends Error {
|
|
16
22
|
reason;
|
|
23
|
+
hint;
|
|
24
|
+
docsUrl;
|
|
17
25
|
constructor(reason) {
|
|
18
|
-
|
|
26
|
+
const hint = 'Check your policy rules in .usertrust/policies/ or use { pii: "warn" } to downgrade PII enforcement.';
|
|
27
|
+
const docsUrl = "https://usertrust.ai/docs/errors/policy-denied";
|
|
28
|
+
super(`Policy denied: ${reason}\n\n Hint: ${hint}\n Docs: ${docsUrl}`);
|
|
19
29
|
this.name = "PolicyDeniedError";
|
|
20
30
|
this.reason = reason;
|
|
31
|
+
this.hint = hint;
|
|
32
|
+
this.docsUrl = docsUrl;
|
|
21
33
|
}
|
|
22
34
|
}
|
|
23
35
|
export class AccountNotFoundError extends Error {
|
|
24
36
|
userId;
|
|
37
|
+
hint;
|
|
38
|
+
docsUrl;
|
|
25
39
|
constructor(userId) {
|
|
26
|
-
|
|
40
|
+
const hint = 'Run "npx usertrust init" to create accounts, or verify the userId matches your config.';
|
|
41
|
+
const docsUrl = "https://usertrust.ai/docs/errors/account-not-found";
|
|
42
|
+
super(`Account not found for user: ${userId}\n\n Hint: ${hint}\n Docs: ${docsUrl}`);
|
|
27
43
|
this.name = "AccountNotFoundError";
|
|
28
44
|
this.userId = userId;
|
|
45
|
+
this.hint = hint;
|
|
46
|
+
this.docsUrl = docsUrl;
|
|
29
47
|
}
|
|
30
48
|
}
|
|
31
49
|
export class IdempotencyConflictError extends Error {
|
|
32
50
|
key;
|
|
51
|
+
hint;
|
|
52
|
+
docsUrl;
|
|
33
53
|
constructor(key) {
|
|
34
|
-
|
|
54
|
+
const hint = "This transfer was already submitted. Use a unique transferId for retries.";
|
|
55
|
+
const docsUrl = "https://usertrust.ai/docs/errors/idempotency-conflict";
|
|
56
|
+
super(`Idempotency conflict for key: ${key}\n\n Hint: ${hint}\n Docs: ${docsUrl}`);
|
|
35
57
|
this.name = "IdempotencyConflictError";
|
|
36
58
|
this.key = key;
|
|
59
|
+
this.hint = hint;
|
|
60
|
+
this.docsUrl = docsUrl;
|
|
37
61
|
}
|
|
38
62
|
}
|
|
39
63
|
export class LedgerUnavailableError extends Error {
|
|
40
64
|
cause_message;
|
|
65
|
+
hint;
|
|
66
|
+
docsUrl;
|
|
41
67
|
constructor(reason) {
|
|
42
|
-
|
|
68
|
+
const hint = 'Start TigerBeetle with "npx usertrust tb start" or use { dryRun: true } to skip the ledger.';
|
|
69
|
+
const docsUrl = "https://usertrust.ai/docs/errors/ledger-unavailable";
|
|
70
|
+
super(`Ledger unavailable: ${reason}\n\n Hint: ${hint}\n Docs: ${docsUrl}`);
|
|
43
71
|
this.name = "LedgerUnavailableError";
|
|
44
72
|
this.cause_message = reason;
|
|
73
|
+
this.hint = hint;
|
|
74
|
+
this.docsUrl = docsUrl;
|
|
45
75
|
}
|
|
46
76
|
}
|
|
47
77
|
export class AuditDegradedError extends Error {
|
|
48
78
|
cause_message;
|
|
79
|
+
hint;
|
|
80
|
+
docsUrl;
|
|
49
81
|
constructor(reason) {
|
|
50
|
-
|
|
82
|
+
const hint = "Check disk space and permissions on the .usertrust/audit/ directory.";
|
|
83
|
+
const docsUrl = "https://usertrust.ai/docs/errors/audit-degraded";
|
|
84
|
+
super(`Audit degraded: ${reason}\n\n Hint: ${hint}\n Docs: ${docsUrl}`);
|
|
51
85
|
this.name = "AuditDegradedError";
|
|
52
86
|
this.cause_message = reason;
|
|
87
|
+
this.hint = hint;
|
|
88
|
+
this.docsUrl = docsUrl;
|
|
53
89
|
}
|
|
54
90
|
}
|
|
55
91
|
export class VaultNotInitializedError extends Error {
|
|
56
92
|
path;
|
|
93
|
+
hint;
|
|
94
|
+
docsUrl;
|
|
57
95
|
constructor(path) {
|
|
58
|
-
|
|
96
|
+
const hint = 'Run "npx usertrust init" to create the vault directory.';
|
|
97
|
+
const docsUrl = "https://usertrust.ai/docs/errors/vault-not-initialized";
|
|
98
|
+
super(`Vault not initialized at: ${path}\n\n Hint: ${hint}\n Docs: ${docsUrl}`);
|
|
59
99
|
this.name = "VaultNotInitializedError";
|
|
60
100
|
this.path = path;
|
|
101
|
+
this.hint = hint;
|
|
102
|
+
this.docsUrl = docsUrl;
|
|
61
103
|
}
|
|
62
104
|
}
|
|
63
105
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAClC,MAAM,CAAS;IACf,QAAQ,CAAS;IACjB,SAAS,CAAS;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAClC,MAAM,CAAS;IACf,QAAQ,CAAS;IACjB,SAAS,CAAS;IAClB,IAAI,CAAS;IACb,OAAO,CAAS;IAEhC,YAAY,MAAc,EAAE,QAAgB,EAAE,SAAiB;QAC9D,MAAM,IAAI,GAAG,qEAAqE,CAAC;QACnF,MAAM,OAAO,GAAG,uDAAuD,CAAC;QACxE,KAAK,CACJ,iCAAiC,MAAM,UAAU,QAAQ,UAAU,SAAS,eAAe,IAAI,aAAa,OAAO,EAAE,CACrH,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD;AAED,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC3B,MAAM,CAAS;IACf,IAAI,CAAS;IACb,OAAO,CAAS;IAEhC,YAAY,MAAc;QACzB,MAAM,IAAI,GACT,sGAAsG,CAAC;QACxG,MAAM,OAAO,GAAG,gDAAgD,CAAC;QACjE,KAAK,CAAC,kBAAkB,MAAM,eAAe,IAAI,aAAa,OAAO,EAAE,CAAC,CAAC;QACz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1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "usertrust",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Financial governance for AI agents. Every LLM call becomes an immutable, auditable transaction.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Usertools, Inc. <hello@usertools.ai> (https://usertrust.ai)",
|
|
@@ -47,7 +47,9 @@
|
|
|
47
47
|
"build": "tsc",
|
|
48
48
|
"prepublishOnly": "tsc"
|
|
49
49
|
},
|
|
50
|
-
"files": [
|
|
50
|
+
"files": [
|
|
51
|
+
"dist"
|
|
52
|
+
],
|
|
51
53
|
"peerDependencies": {
|
|
52
54
|
"@anthropic-ai/sdk": ">=0.30.0",
|
|
53
55
|
"openai": ">=4.70.0"
|